Specifications

This is the Title of the Book, eMatter Edition
Copyright © 2005 O’Reilly & Associates, Inc. All rights reserved.
462
|
Chapter 15: Memory Mapping and DMA
dma_addr_t dma_map_single(struct device *dev, void *buffer, size_t size, enum
dma_data_direction direction);
void dma_unmap_single(struct device *dev, dma_addr_t bus_addr, size_t size,
enum dma_data_direction direction);
Create and destroy a single-use, streaming DMA mapping.
void dma_sync_single_for_cpu(struct device *dev, dma_handle_t bus_addr, size_t
size, enum dma_data_direction direction);
void dma_sync_single_for_device(struct device *dev, dma_handle_t bus_addr,
size_t size, enum dma_data_direction direction);
Synchronizes a buffer that has a streaming mapping. These functions must be
used if the processor must access a buffer while the streaming mapping is in
place (i.e., while the device owns the buffer).
#include <asm/scatterlist.h>
struct scatterlist { /* ... */ };
dma_addr_t sg_dma_address(struct scatterlist *sg);
unsigned int sg_dma_len(struct scatterlist *sg);
The scatterlist structure describes an I/O operation that involves more than
one buffer. The macros sg_dma_address and sg_dma_len may be used to extract
bus addresses and buffer lengths to pass to the device when implementing scat-
ter/gather operations.
dma_map_sg(struct device *dev, struct scatterlist *list, int nents,
enum dma_data_direction direction);
dma_unmap_sg(struct device *dev, struct scatterlist *list, int nents, enum
dma_data_direction direction);
void dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int
nents, enum dma_data_direction direction);
void dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int
nents, enum dma_data_direction direction);
dma_map_sg maps a scatter/gather operation, and dma_unmap_sg undoes
that mapping. If the buffers must be accessed while the mapping is active,
dma_sync_sg_* may be used to synchronize things.
/proc/dma
File that contains a textual snapshot of the allocated channels in the DMA con-
trollers. PCI-based DMA is not shown because each board works indepen-
dently, without the need to allocate a channel in the DMA controller.
#include <asm/dma.h>
Header that defines or prototypes all the functions and macros related to DMA.
It must be included to use any of the following symbols.
,ch15.13676 Page 462 Friday, January 21, 2005 11:04 AM