Linux用户空间PCI驱动程序 [英] Linux user space PCI driver

查看:210
本文介绍了Linux用户空间PCI驱动程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试编写一个在用户空间中运行的PCI设备驱动程序.不是我的主意,客户想要什么. Target是嵌入式Linux主板,永远不会有一个以上的用户.我是一位经验丰富的C程序员,并且了解Linux,只是不熟悉Linux驱动程序开发.

I'm trying to write a PCI device driver that runs in user space. Not my idea, what the client wants. Target is an embedded Linux board that will never have more than a single user. I'm an experienced C programmer and know Linux, just not familiar with Linux driver development.

这真的是设备驱动程序还是库?我需要使用典型的调用pci_register_driver等吗?还是可以仅使用fopen并使用mmap和ioperm访问设备?

Is this really a device driver or just a library? Do I need to use the typical calls pci_register_driver, etc. or can I just access the device using fopen, and using mmap and ioperm to get to it?

将使用MSI模型完成中断.还需要处理DMA传输.该设备将向用户流式传输大量数据.

Interrupts will be done using the MSI model. Also need to handle DMA transfers. The device will be streaming lots of data to the user.

关于此主题的信息不多,LDD3仅投入了几页,因此我在SO上找不到其他任何东西.

There's not much info out there on this subject, LDD3 only devotes a couple of pages to it, and there's nothing else that I could find here on SO.

提前谢谢!

推荐答案

如果没有驱动程序处理PCI卡,则仅需要端口访问权限,就可以使用ioperm(或iopl-取决于地址)对其进行访问.

If there is no driver handling the PCI card it would be possible to access it using ioperm (or iopl - depending on the address) if only port accesses are required.

没有内核模式驱动程序,绝对不可能使用DMA和中断.

Using DMA and interrupts is definitely impossible without a kernel-mode driver.

通过Google搜索,我发现了一些有关通用内核模式驱动程序"之类的文本,该文本允许编写用户模式驱动程序(包括DMA和中断).

By googleing I found some text about something like a "generic kernel-mode driver" that allows writing user-mode drivers (including DMA and interrupts).

您应该询问客户Linux板上安装了哪种类型的用于访问PCI卡的内核模式驱动程序.

You should ask your customer which kind of kernel-mode drivers for accessing PCI cards is installed on the Linux board.

这篇关于Linux用户空间PCI驱动程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆