0

I have written one device driver of parallel port driver with IRQ handler.

Now, first i must have to access IRQ7 because my parallel port gives interrupt on it(I had seen that on /proc/interrupts).

Now, the problem that i faced is my request_irq() function fails whenever i am trying to request for irq7.

Also, my cat /proc/interrupt is looks like::

CPU0 CPU1
0: 98 0 IO-APIC-edge timer
1: 11764 2178 IO-APIC-edge i8042

3: 2 0 IO-APIC-edge
4: 2 0 IO-APIC-edge
7: 8 0 IO-APIC-edge parport0

8: 1 0 IO-APIC-edge rtc0

9: 0 0 IO-APIC-fasteoi acpi

Where i don't know what is parport0. As per my thinking, because of this parport0 my request_irq fails.

I had read that: The `parport' code provides parallel-port support under Linux. This includes the ability to share one port between multiple device drivers. You can pass parameters to the parport code to override its automatic detection of your hardware. This is particularly useful if you want to use IRQs, since in general these can't be autoprobed successfully. By default IRQs are not used even if they can be probed. This is because there are a lot of people using the same IRQ for their parallel port and a sound card or network card.

So, how can i register my interrupt handler on irq7 so that i can manage interrupts from parallel port?

4

2 回答 2

0

如果您检查 request_irq 的返回码,它会有所帮助。它会告诉你失败的原因。正如 rakib 所指出的,很可能安装了 parport0(默认驱动程序)。您可以尝试注册一个 SHARED IRQ 处理程序 - 这应该可以工作:大多数 IRQ 是可共享的(SA_SHIRQ 标志)。还要记住不要将 NULL 指针作为您的设备 ID 传递。

于 2013-05-17T17:51:25.547 回答
0

您的系统上已经安装了并行端口驱动程序。这就是内核无法为您的驱动程序分配 irq 的原因。首先,卸载当前的并行驱动程序,然后重试。

于 2013-05-17T09:33:53.313 回答