参考: http://blog.csdn.net/softwoker/article/details/45114725
of_dma_request_slave_channel就是根据设备树,获得对应的dma channel,由于其细节部分主要是解析设备树,这里不展开。
DMA驱动一致性和流式的基本认识:
一致性DMA与流式DMA主要是内存的申请方式和访问控制权限不一样:
一致性DMA内存申请:
void *dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *handle, gfp_t gfp);
流式DMA内存申请:
dma_addr_t dma_map_single(struct device *dev, void *buffer, size_t size, enum dma_data_direction direction);
如果映射成功,返回的是总线地址,否则返回NULL.最后一个参数DMA的方向,可能取DMA_TO_DEVICE, DMA_FORM_DEVICE, DMA_BIDIRECTIONAL和DMA_NONE
一致性申请的内存区域DMA和CPU能够同时访问,所以可以认为一致性是同步的
流式申请的内存区域DMA和CPU不能同时访问,DMA释放之后CPU才能访问,所以认为是异步的