#interrupt-cells = <2>; 这个子节点怎么设置 举例
时间: 2023-06-20 14:04:03 浏览: 56
这个子节点是用来描述中断控制器(interrupt controller)的,其中 #interrupt-cells 属性表示中断描述符(interrupt specifier)的数量。一般来说,每个中断都需要两个中断描述符:第一个是中断编号(interrupt number),第二个是中断触发类型(interrupt trigger type)。因此,#interrupt-cells 设置为 2 是比较常见的。
下面是一个例子,假设一个设备有两个中断,中断编号分别为 5 和 6,中断触发类型都是上升沿触发。那么对应的 Device Tree 配置如下:
```
interrupt-parent = <&gpio>;
interrupts = <5 0x2>, <6 0x2>;
gpio: gpio-controller {
#interrupt-cells = <2>;
/* ... */
};
```
其中,&gpio 是中断控制器节点的 phandle,<5 0x2> 表示中断编号为 5,触发类型为上升沿触发(0x2),<6 0x2> 同理。
相关问题
intc: interrupt-controller@a0021000 { compatible = "arm,cortex-a7-gic"; //中断控制器的厂商,名字 #interrupt-cells = <3>; //子节点设置这个节点的时候,成员需要3个 interrupt-controller; //空属性,标识这个节点是中断控制器的节点 reg = <0xa0021000 0x1000>, //控制器地址 <0xa0022000 0x2000>; }; 请问#interrupt-cells = <3>; 这个子节点怎么设置
这个子节点指的是连接到中断控制器的设备节点,#interrupt-cells = <3> 表示这个设备使用3个值来描述中断,通常这三个值分别是中断编号、中断触发类型和中断优先级。
例如,如果你有一个名为uart0的串口设备连接到这个中断控制器,你需要添加一个子节点来描述这个设备的中断,例如:
```
uart0: serial@9000000 {
compatible = "my-serial";
reg = <0x9000000 0x1000>;
interrupts = <0 4 1>; // 中断号为0,触发类型为4,优先级为1
};
```
其中,中断号是指连接到这个中断控制器的设备中断编号,触发类型是指中断触发的方式,优先级是指中断优先级。这些值的具体含义需要参考中断控制器的文档来确定。
gpiof: gpio@50007000 { interrupt-controller; #interrupt-cells = <2>; reg = <0x50007000 0x400>; clocks = <&rcc GPIOF>; st,bank-name = "GPIOF"; status = "disabled"; }; }; #interrupt-cells = <2>; 这个子节点怎么设置
这是一个中断控制器的节点,它的 #interrupt-cells 属性应该设置为 2,因为它处理的是两个中断参数。同时,它的 reg 属性指定了该节点在设备树上的地址和大小。clocks 属性指定了该节点所需的时钟源,st,bank-name 属性指定了该 GPIO 的名称,status 属性指定了该节点当前的状态是否启用("disabled"表示未启用)。你可以根据实际情况来修改这些属性。
相关推荐
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)