在哪里开始学习linux的DMA /设备驱动程序/内存分配 [英] Where to start learning about linux DMA / device drivers / memory allocation
问题描述
我正在移植/调试一个设备驱动程序(由另一个内核模块使用),并面临一个死胡同,因为dma_sync_single_for_device()失败,内核哎呀。
I'm porting / debugging a device driver (that is used by another kernel module) and facing a dead end because dma_sync_single_for_device() fails with an kernel oops.
我不知道该功能应该做什么,谷歌搜索不是真的有帮助,所以我可能需要总体了解更多的这些东西。
I have no clue what that function is supposed to do and googling does not really help, so I probably need to learn more about this stuff in total.
问题是,在哪里开始?
哦,是的,如果它是相关的,代码应该运行在PowerPC上(而Linux是OpenWRT)
Oh yeah, in case it is relevant, the code is supposed to run on a PowerPC (and the linux is OpenWRT)
编辑:
在线资源优先(书需要几天交付:)
On-line resources preferrable (books take a few days to be delivered :)
推荐答案
在线:
图书:
基本Linux设备驱动程序(只有前4 - 5章)
Essential Linux Device Drivers ( Only the first 4 - 5 chapters )
有用的资源:
Linux交叉引用(可搜索所有内核源代码内核)
the Linux Cross Reference ( Searchable Kernel Source for all Kernels )
dma_sync_single_for_device
调用 dma_sync_single_range_for_cpu
在文件中有一点进一步,这是源文档(我认为即使这是对于arm,接口和行为是一样的):
dma_sync_single_for_device
calls dma_sync_single_range_for_cpu
a little further up in the file and this is the source documentation ( I assume that even though this is for arm the interface and behavior are the same ):
/**
380 * dma_sync_single_range_for_cpu
381 * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
382 * @handle: DMA address of buffer
383 * @offset: offset of region to start sync
384 * @size: size of region to sync
385 * @dir: DMA transfer direction (same as passed to dma_map_single)
386 *
387 * Make physical memory consistent for a single streaming mode DMA
388 * translation after a transfer.
389 *
390 * If you perform a dma_map_single() but wish to interrogate the
391 * buffer using the cpu, yet do not wish to teardown the PCI dma
392 * mapping, you must call this function before doing so. At the
393 * next point you give the PCI dma address back to the card, you
394 * must first the perform a dma_sync_for_device, and then the
395 * device again owns the buffer.
396 */
这篇关于在哪里开始学习linux的DMA /设备驱动程序/内存分配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!