linux - 结构设备中的 of_node 参数是什么?

标签 linux linux-kernel linux-device-driver device-tree

struct device中的解释说

Associated device tree node.

但是,我并没有清楚地理解这一点。

谁能举个例子?

最佳答案

of_node 与 Open Firmware 有关,它包含设备树的信息。

设备树就像详细描述硬件的配置文件(命名节点和属性)。

设备树的主要优点是您不必为特定硬件不断修改内核。您所要做的就是在设备树 fmt 中定义您的硬件并将其提供给引导加载程序。引导加载程序(例如 uboot)将设备树信息传递给内核,内核根据从引导加载程序收到的这些信息初始化设备。

下面是设备树的例子。

{
    compatible = "acme,coyotes-revenge";

    cpus {
        cpu@0 {
            compatible = "arm,cortex-a9";
        };
        cpu@1 {
            compatible = "arm,cortex-a9";
        };
    };

    serial@101F0000 {
        compatible = "arm,pl011";
    };

    serial@101F2000 {
        compatible = "arm,pl011";
    };

    interrupt-controller@10140000 {
        compatible = "arm,pl190";
    };

    external-bus {
        ethernet@0,0 {
            compatible = "smc,smc91c111";
        };

        i2c@1,0 {
            compatible = "acme,a1234-i2c-bus";
            rtc@58 {
                compatible = "maxim,ds1338";
            };
        };

        flash@2,0 {
            compatible = "samsung,k8f1315ebm", "cfi-flash";
        };
    };
};

关于linux - 结构设备中的 of_node 参数是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22783154/

相关文章:

regex - Linux 中包含多行正则表达式和数据模式的 2 个文件之间的 PCRE 模式匹配验证

c++ - Linux,C++,使用 poll/select 等待事件(不阻塞执行线程)

linux - "struct file_operations"参数是什么?

linux - 设备驱动程序代码编译?

c - 错误: ‘struct tty_driver’ has no member named ‘ioctl’

linux - 分配静态 ttyUSB

java - 如何使用 Vagrant 连接两个虚拟机(postgreSQL 和 tomee)?

linux - 如何在 Linux 上使用 while 检查 2 个条件

c - 如何确保函数在内核模块中运行?

git - 向邮件列表提交庞大的补丁集