Could some one elaborate irq_create_mapping, irq_find_mapping, to use request_irq

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Could some one elaborate irq_create_mapping, irq_find_mapping, to use request_irq

2,672 次查看
ramakrishnakatt
Contributor II

Could some one elaborate irq_create_mapping, irq_find_mapping, to use request_irq

Thanks

Rama

1 回复

1,610 次查看
scottwood
NXP Employee
NXP Employee

Linux IRQ numbers, as used by request_irq() and similar functions, are arbitrary software tokens rather than hardware IRQ numbers.  To obtain such a token (called a virtual IRQ number, or virq) you need to create a mapping.  The most common way to do that is to either use irq_of_parse_and_map(), or get the virq from a bus-specific structure (e.g. struct pci_dev or struct platform_device).

irq_create_mapping() is the low-level function used by the above methods of translation.  It's possible to use it directly, but you normally shouldn't have to.  If you find yourself wanting to use it, it probably means that you have hardware that should be described in the device tree but isn't.

irq_find_mapping() is one method used by interrupt controller drivers to turn a hardware interrupt number into a virq using an existing mapping.  If you're not writing an interrupt controller driver or something similar, you don't need this.