/* * Set both the DMA mask and the coherent DMA mask to the same thing. * Note that we don't check the return value from dma_set_coherent_mask() * as the DMA API guarantees that the coherent DMA mask can be set to * the same or smaller than the streaming DMA mask. */staticin...
int dma_set_mask_and_coherent(struct device *dev, u64 mask); 这将为流式 API 和连贯 API 一起设置掩码。如果您有一些特殊要求,则可以使用以下两个单独的调用来代替:流映射的设置是通过调用 dma_set_mask() 来执行的: int dma_set_mask(struct device *dev, u64 mask); 通过调用 dma_set_coherent...
* Set both the DMA mask and the coherent DMA mask to the same thing. * Note that we don't check the return value from dma_set_coherent_mask() * as the DMA API guarantees that the coherent DMA mask can be set to * the same or smaller than the streaming DMA mask. */staticinline ...
intdma_set_mask(structdevice *dev,u64 mask); 比如一个只能访问24位地址的DMA外设,就使用dma_set_mask(dev,0xffffff) 编程流程 下面是在内核程序中使用DMA内存的流程: 一致性DMA 如果在驱动中使用DMA缓冲区,可以使用内核提供的已经考虑到一致性的API: /** * request_dma - 申请DMA通道 * On certain pla...
int dma_set_mask(struct device *dev, u64 mask); 比如,对于只能在24位地址上执行DMA操作的设备而言,就应该调用dma_set_mask(dev, 0xffffffff).DMA映射包括两个方面的工作:分配一片DMA缓冲区;为这片缓冲区产生设备可访问的地址。结合前面所讲的,DMA映射必须考虑Cache一致性问题。内核中提供了一下函数用于分配...
其中的函数dma_set_mask_and_coherent()用于对dma_mask和coherent_dma_mask赋值。 dma_mask表示的是该设备通过DMA方式可寻址的物理地址范围,coherent_dma_mask表示所有设备通过DMA方式可寻址的公共的物理地址范围, 因为不是所有的硬件设备都能够支持64bit的地址宽度。
device_prep_dma_xxx:为DMA传输准备描述符,xxx:controller具有啥cap_mask,就要实现相应的接口 device_issue_pending:从pending queue中取走第一个传输描述符并启动传输,当传输完成后将会移到列表中下一个传输描述符,可以在中断上下文中使用。 device_tx_status:获取传输状态 ...
这样当primaII的SD驱动调用dma_alloc_coherent()的时候,GFP_DMA标记被设置,以指挥内核从DMA ZONE申请内存。但是,其他的外设,mask覆盖了整个4GB,调用dma_alloc_coherent()获得的内存就不需要一定是来自DMA ZONE。 4.dma_alloc_coherent()申请的内存是非cache的吗?
dma_mask表示的是该设备通过DMA方式可寻址的物理地址范围,coherent_dma_mask表示所有设备通过DMA方式可寻址的公共的物理地址范围, 因为不是所有的硬件设备都能够支持64bit的地址宽度。 /include/linux/dma-mapping.h /* * Set both the DMA mask and the coherent DMA mask to the same thing. ...
1、通知内核设备执行DMA的寻址能力,说明设备支持64位还是32位的DMA地址。如果不支持64位的地址,则尝试32位的: err = dma_set_mask(pci_dev_to_dev(pdev), DMA_BIT_MASK(64)); if (!err) { err = dma_set_coherent_mask(pci_dev_to_dev(pdev), ...