Specifications
This is the Title of the Book, eMatter Edition
Copyright © 2005 O’Reilly & Associates, Inc. All rights reserved.
Quick Reference
|
459
int residue;
unsigned long flags = claim_dma_lock ( );
residue = get_dma_residue(channel);
release_dma_lock(flags);
return (residue = = 0);
}
The only thing that remains to be done is to configure the device board. This device-
specific task usually consists of reading or writing a few I/O ports. Devices differ in
significant ways. For example, some devices expect the programmer to tell the hard-
ware how big the DMA buffer is, and sometimes the driver has to read a value that is
hardwired into the device. For configuring the board, the hardware manual is your
only friend.
Quick Reference
This chapter introduced the following symbols related to memory handling.
Introductory Material
#include <linux/mm.h>
#include <asm/page.h>
Most of the functions and structures related to memory management are proto-
typed and defined in these header files.
void *__va(unsigned long physaddr);
unsigned long __pa(void *kaddr);
Macros that convert between kernel logical addresses and physical addresses.
PAGE_SIZE
PAGE_SHIFT
Constants that give the size (in bytes) of a page on the underlying hardware and
the number of bits that a page frame number must be shifted to turn it into a
physical address.
struct page
Structure that represents a hardware page in the system memory map.
struct page *virt_to_page(void *kaddr);
void *page_address(struct page *page);
struct page *pfn_to_page(int pfn);
Macros that convert between kernel logical addresses and their associated mem-
ory map entries. page_address works only for low-memory pages or high-memory
pages that have been explicitly mapped. pfn_to_page converts a page frame num-
ber to its associated
struct page pointer.
,ch15.13676 Page 459 Friday, January 21, 2005 11:04 AM