我正在移植/debugging一个设备驱动程序(由另一个内核模块使用),并面临死胡同,因为dma_sync_single_for_device()失败与内核oops。
我不知道这个function应该做什么,Google使用google并没有什么帮助,所以我可能需要更多地了解这个function。
问题是,从哪里开始?
哦,是的,如果是相关的,代码应该运行在PowerPC上(而Linux是OpenWRT)
编辑:在线资源优先(书籍需要几天交付:)
线上:
Linux slab分配器的剖析
了解Linux虚拟内存管理器
Linux设备驱动程序,第三版
Linux内核模块编程指南
在Linux中编写设备驱动程序:一个简短的教程
图书:
Linux内核开发(第2版)
基本的Linux设备驱动程序 (只有前4-5章)
有用的资源:
Linux交叉引用 (所有内核的可搜索内核源代码)
2.6内核系列中的API更改
dma_sync_single_for_device
在文件中调用了dma_sync_single_range_for_cpu
,这是源文件(我认为即使这是用于arm的界面和行为是相同的):
/** 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内核 ?
Linux设备驱动程序手册的章节(与@Matthew Flaschen推荐的“了解Linux内核”相同)可能是有用的。
您可以从LWN网站下载独立章节。 第16章涉及DMA。