简体   繁体   English

如何确定USB设备的IRQ号?

[英]How to determine the IRQ number for a USB device?

I am new to driver development. 我是驾驶员开发的新手。 However, I purchased an OSR USB FX2 Learning Kit, which comes with sample codes for Windows kernel/user mode driver. 但是,我购买了OSR USB FX2学习套件,其中包含Windows内核/用户模式驱动程序的示例代码。 However, I am writing the driver in Linux (Ubuntu 12). 但是,我正在Linux(Ubuntu 12)中编写驱动程序。 I have successfully been able to send control commands and receive the return of control commands from the device. 我已经能够成功发送控制命令并从设备接收控制命令的返回。 I also have been able to successfully send and read data over the BULK OUT/IN endpoints the device supports. 我还能够通过设备支持的BULK OUT / IN端点成功发送和读取数据。

There is only one more experiment I have yet to complete. 我还没有完成一个实验。 The device has the following endpoints: 设备具有以下端点:

1. BULK (OUT) --> Address 0x06
2. BULK (IN)  --> Address 0x88
3. INTERRUPT (IN) --> Address 0x81

I am unable to figure out how to find the IRQ number for the INTERRUPT (IN) endpoint. 我无法弄清楚如何找到INTERRUPT(IN)端点的IRQ号 I understand how to install an IRQ handler using: 我了解如何使用以下方法安装IRQ处理程序:

int request_irq (unsigned int irq,
                 irq_handler_t handler,
                 unsigned long irqflags,
                 const char * devname,
                 void * dev_id);

and write the handler with the correct function prototype. 并使用正确的函数原型编写处理程序。 However, I am wondering how I would find what IRQ line (IRQ number) the device is interrupting on? 但是,我想知道如何找到设备中断的IRQ线(IRQ号)? That is, how do I determine what the value of the argument unsigned int irq in the request_irq function above should be? 也就是说,如何确定上述request_irq函数中的unsigned int irq参数的值应为多少? I read through the book "Linux Device Drivers, Third Edition" how the IRQ number is determined for parallel ports. 我通读了《 Linux设备驱动程序,第三版》一书,该书如何确定并行端口的IRQ号。 However, how does this work for USB and how would I go about probing or finding out what this number should be for the USB device? 但是,这对USB如何起作用,我将如何进行探测或找出USB设备应使用的数字呢?

You don't need to deal with interrupts for writing a USB device driver, if you would like a good tutorial on it have a look at 如果您想了解有关USB设备驱动程序的优秀教程,则无需处理中断。

http://www.linuxforu.com/2011/10/usb-drivers-in-linux-1/ http://www.linuxforu.com/2011/10/usb-drivers-in-linux-1/

which is an excellent starting point to learn how to write USB drivers; 这是学习如何编写USB驱动程序的绝佳起点;

If you have specific issues as you go along; 如果您在进行过程中遇到特定问题,请联系我们; post them we'll see how it goes :) 发布它们,我们将看看情况如何:)

EDIT 编辑

you can use platform_get_irq or platform_get_irq_byname to get the irq for the device. 您可以使用platform_get_irq或platform_get_irq_byname来获取设备的irq。

EDIT 2: 编辑2:

I also point you to http://lwn.net/images/pdf/LDD3/ch10.pdf for your viewing pleasure :-) Shows you how to retrieve IRQs assigned to devices. 我也将您的浏览指向http://lwn.net/images/pdf/LDD3/ch10.pdf :-)向您展示如何检索分配给设备的IRQ。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM