如何在Linux中访问DMA
我正在 Linux 中编写一个设备驱动程序,需要为其实现 DMA。
很明显,DMA
缓冲区可以通过调用 pci_alloc_concient()
来分配。但是我们如何从用户级别向这些缓冲区写入命令呢?
任务包括将值写入特定寄存器,这些任务是如何使用 DMA 命令实现的?
I am writing a device driver in Linux for which I need to implement DMA
.
It is clear that DMA
buffers can be allocated by a call to pci_alloc_consistent()
. But how can we write commands to those buffers from user level?
Tasks include writing values to specific registers, how are these implemented using DMA
commands?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我相信您可以通过 I/O 操作使用 DMA 进行编写,您可以通过 GNU C 库访问这些操作。您必须使用 ioperm 或 iopl 等系统调用并以 root 身份运行才能访问 DMA 寄存器。至少这就是获取可用于 DMA 访问的 IO 空间的访问权限的方式。虽然我可能无法完全回答这个问题,但希望这能为您指明一个好的方向。
I believe you can write with DMA through I/O operations that you may access through a GNU C library . You must use system calls such as ioperm or iopl and run as root to gain access to DMA registers. At least thats how one gains access to IO space which may be used for DMA access. Though I may not answer the question completely, hopefully this points you in a good direction.