dts里的中断【转】

dts里的中断

  1. 产生中断的设备 (interrupt generating devices)
    interrupts: 产生的中断号, 会被interrupts-extended覆盖, 通常两者用其一;
    interrupt-parent: 标识此设备节点属于哪一个中断控制器, 如果没有设置这个属性, 会自动依附父节点的;
    interrupts-extended: 当设备连接到多个中断控制器时使用; 它与属性interrupts相互排斥, 二者只能用其一,
    当两者都存在时, interrupts-extended优先;

  2. 中断控制器 (interrupt controllers)
    #interrupt-cells: 描述中断的cells的个数;
    interrupt-controller: 一个空属性, 标识该节点是中断控制器节点;

  3. 关联属性 (nexus properties)
    interrupt-map: 每一行包含5个成员:
    child unit address: cell数量取决于自身节点的"#address-cells";
    child interrupt specifier: 子节点中断号, cell数量取决于自身节点"#interrupt-cells";
    interrupt-parent: 子节点要映射到这里;
    parent unit address: cell数量取决于interrupt-parent节点的"#address-cells";
    parent interrupt specifier: 父中断编号, cell数量取决于父节点的"#interrupt-cells";

    interrupt-map-mask: 与"interrupt-map"执行&操作;

    #interrupt-cells: 同上;

  4. 例子

soc {
    
    
	compatible = "simple-bus";
	#address-cells = <1>;
	#size-cells = <1>;
	
	open-pic {
    
    
		clock-frequency = <0>;
		interrupt-controller;
		#address-cells =<0>;
		#interrupt-cells = <2>;
	};

	pci {
    
    
		#interrupt-cells = <1>;
		#size-cells = <2>;
		#address-cells = <3>;
		interrupt-map-mask = <0xf800 0 0 7>;
		interrupt-map = <
			/* IDSEL 0x11 - PCI slot 1 */
			0x8800 0 0 1 &open-pic 2 1 /* INTA */
			0x8800 0 0 2 &open-pic 3 1 /* INTB */
			0x8800 0 0 3 &open-pic 4 1 /* INTC */
			0x8800 0 0 4 &open-pic 1 1 /* INTD */
			/* IDSEL 0x12 - PCI slot 2 */
			0x9000 0 0 1 &open-pic 3 1 /* INTA */
			0x9000 0 0 2 &open-pic 4 1 /* INTB */
			0x9000 0 0 3 &open-pic 1 1 /* INTC */
			0x9000 0 0 4 &open-pic 2 1 /* INTD */
		>;
	};
};

上面中断映射表解析:
child unit address: 0x8800 0 0 (因为: #address-cells = <3>;)
child interrupt specifiler: 1 (因为: #interrupt-cells = <1>;)
interrupt-parent: &open-pic
parent unit address: empty (因为open-pic的#address-cells =<0>;)
parent interrupt specifier: 2 1 (因为open-pic的#interrupt-cells = <2>)

おすすめ

転載: blog.csdn.net/a13821684483/article/details/127058102
DTS