从设备树中获取信息并请求 irq

Getting information from the device tree and requesting irq

上下文

在我使用的设备树中,在其节点之一中,字段 interrupts 是:

interrupts = <0x0 0x1d 0x4>;

(来自Pynq板的设备树,配备双核ARM A9的ZYnq设备)

现在,在设备树 .probe 函数中,我使用 Linux 内核 API:

irq_line = platform_get_irq(pdev, 0);

为了让 irq 用于函数 request_irq(在 ldd3 第 10 章中描述)。

执行 irq_line = platform_get_irq(pdev, 0); 后,我得到的值 0x2e 与设备树的 interrupts 字段不匹配。

问题

  1. <0x0 0x1d 0x4> 个数字到底是多少?我知道,根据 elinux.org,:

interrupts - A property of a device node containing a list of interrupt specifiers, one for each interrupt output signal on the device.

  1. 如何使用 irq 线(也许从这些数字开始)? irq线是否与设备树有关?

  2. 为什么我得到的值与 interrupts 的任何一个字段都不匹配?

我确定我误解了一些重要的话题,对不起。并感谢您阅读问题并分享您的知识。

What are exactly the <0x0 0x1d 0x4> numbers? I know that, in according to elinux.org, (interrupts = <0x0 0x1d 0x4>;)

首先你需要查看设备节点的中断父节点,这个父节点将#interrupt-cells 属性 which specifies number of bits needed to encode a interrupt source,所以从你的条目中断= <0x0 0x1d 0x4> ;表示如下:

0x0  = shared processor interrupts
0x1d = interrupt number
0x4  = active high level-sensitive/[IRQ_TYPE_LEVEL_HIGH][2] 

How can I get the irq line to use (maybe starting from these numbers)? Is the irq line related to the device tree?

Why am I getting a value that doesn't match with no one of the fields of interrupts?

回答得很好here also refer this