开发者

Where can I find the IRQ number in request_irq function?

开发者 https://www.devze.com 2023-01-03 14:48 出处:网络
I\'m learning device driver programming in Linux. I am wondering where I could find the IRQ number to be used as 开发者_运维百科the \"irq\" parameter in the request_irq function?

I'm learning device driver programming in Linux. I am wondering where I could find the IRQ number to be used as 开发者_运维百科the "irq" parameter in the request_irq function?

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

Thanks


You seem learning the device programming from the wrong side - without a device.

If you have e.g. device on PCI but, then its IRQ is negotiated by the PCI and is available via Linux PCI subsystem.

If you have some custom wired device, quite often its IRQ line is hardwired and you should ask the people who made the custom device where it was wired to and what IRQ it is.

Otherwise buy yourself a copy of LDD3 - it's worth it and describes all that in details.


If you have only a single interrupt controller the irq number is simply the hardware IRQ number.

If you have more then one PIC you need to look in the board specific initialization include files to see which offset was given to the specific PIC your device is connected to and add that to the hardware IRQ number.

It is usually an include file named irqs.h in the include/ directory of of the board specific files. E.g. for an Arm based Bcmring board, the file is in linux/arch/arm/mach-bcmring/include/mach/irqs.h

0

精彩评论

暂无评论...
验证码 换一张
取 消