linux设备树-of_parse_phandle_with_args

1.设备树实例

interrupt-controller@1 {

        compatible = "vendor,gic";

        #interrupt-cells = <2>;

        interrupt-controller;

        reg = <0x01 0x1000>;

};

deviceA {

        compatible = "vendor,device-a";

        reg = <0x02 0x100>;

        interrupts = <&interrupt-controller 3 1>;

};

of_parse_phandle_with_args(node, "interrupts", "#interrupt-cells", 0, &irq_args);

函数声明

int of_parse_phandle_with_args(const struct device_node *np,
     const char *list_name, const char *cells_name, 
        int index,  struct of_phandle_args *out_args)

参数说明:

np 指向当前节点;即 deviceA

list_name 指向节点中 phandle 列表的属性名;  即interrupts

cells_name 参数指明 phandle 指向的节点所含的 cells 个数;即  #interrupt-cells = <2>;

index 表示 phandle 列 表的索引,0 代表第一个 phandle,1 代表第二个 phandle;

out_args 参数用于存储 phandle 中的参数。即两个参数: 3 1

相关推荐

  1. Linux设备

    2024-04-22 00:50:02       49 阅读
  2. Linux Driver | 设备开发之初识设备

    2024-04-22 00:50:02       64 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-04-22 00:50:02       98 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-04-22 00:50:02       106 阅读
  3. 在Django里面运行非项目文件

    2024-04-22 00:50:02       87 阅读
  4. Python语言-面向对象

    2024-04-22 00:50:02       96 阅读

热门阅读

  1. js 处理时间一些函数

    2024-04-22 00:50:02       38 阅读
  2. 对观察者模式的理解

    2024-04-22 00:50:02       33 阅读
  3. LightGBM原生接口和Sklearn接口参数详解

    2024-04-22 00:50:02       30 阅读
  4. 如何在windows 安装linux 虚拟机

    2024-04-22 00:50:02       36 阅读
  5. SQL中WITH RECURSIVE的用法

    2024-04-22 00:50:02       39 阅读
  6. 【需求】人像数据集采集

    2024-04-22 00:50:02       31 阅读