我正在移植/调试设备驱动程序(由另一个内核模块使用)并面临死胡同,因为dma_sync_single_for_device()因内核oops而失败。
我不知道该功能应该做什么,谷歌搜索并没有真正帮助,所以我可能需要更多地了解这些东西。
问题是,从哪里开始?
哦,是的,如果它是相关的,代码应该在PowerPC上运行(并且linux是OpenWRT)
编辑: 在线资源是可取的(书籍需要几天才能交付:)
答案 0 :(得分:9)
在线方式:
Anatomy of the Linux slab allocator
Understanding the Linux Virtual Memory Manager
Linux Device Drivers, Third Edition
The Linux Kernel Module Programming Guide
Writing device drivers in Linux: A brief tutorial
书籍:
Linux Kernel Development (2nd Edition)
Essential Linux Device Drivers(仅限前4至5章)
有用的资源:
the Linux Cross Reference(所有内核的可搜索内核源代码)
API changes in the 2.6 kernel series
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 */
答案 1 :(得分:5)
答案 2 :(得分:3)
Linux Device Drivers书的章节(与理解Linux内核相同的系列,由@Matthew Flaschen推荐)可能很有用。
您可以从LWN Website下载indiivudal章节。 Chapter 16处理DMA。