zoukankan      html  css  js  c++  java
  • Decicetree FORMAT (VERSION 1)

    设备树示意图:

    一 DTS 文件布局(layout):

    /dts-v1/; // 表示版本
    [memory reservations] // 格式为: /memreserve/ <address> <length>;
    / {                   //"/"表示根,”{};“表示节点。
    [property definitions]
    [child nodes]
    };

    多节点布局:

    /dts-v1/;
    /{
       cpu{
    
        }; 
       memory{
    
        };
        i2c{
    
        };
       .......  
    };

    二 节点的格式:设备树中的基本单元,被称为“node”,其格式为:

    [label:] node-name[@unit-address] {
    [properties definitions]
    [child nodes]
    };

    1 label 是标号,可以省略。label 的作用是为了方便地引用 node,比如:

    /dts-v1/;
    / {
    uart0: uart@fe001000 {
    compatible="ns16550";
    reg=<0xfe001000 0x100>;
    };
    };

    可以使用下面 2 种方法来修改 uart@fe001000 这个 node:

    // 在根节点之外使用 label 引用 node:
    &uart0 {
    status = “disabled”;
    };
    或在根节点之外使用全路径:
    &{/uart@fe001000} {
    status = “disabled”;
    };

    2 properties 的格式
    简单地说,properties 就是“name=value”,value 有多种取值方式。
    ① Property 格式 1:[label:] property-name = value;
    ② Property 格式 2(没有值):[label:] property-name;
    Property 取值只有 3 种:

    arrays of cells(1 个或多个 32 位数据, 64 位数据使用 232 位数据表示),
    string(字符串),
    bytestring(1 个或多个字节)

    示例:
    a. Arrays of cells : cell 就是一个 32 位的数据,用尖括号包围起来
      interrupts = <17 0xc>;
    b. 64bit 数据使用 2 个 cell 来表示,用尖括号包围起来:
      clock-frequency = <0x00000001 0x00000000>;
    c. A null-terminated string (有结束符的字符串),用双引号包围起来:
       compatible = "simple-bus";
    d. A bytestring(字节序列) ,用中括号包围起来:

    local-mac-address = [00 00 12 34 56 78]; // 每个 byte 使用 2 个 16 进制数来表示
    local-mac-address = [000012345678]; // 每个 byte 使用 2 个 16 进制数来表示
    

    e. 可以是各种值的组合, 用逗号隔开:

    compatible = "ns16550", "ns8250";
    example = <0xf00f0000 19>, "a strange property format";
    

      

    懒惰不会让你一下子跌到 但会在不知不觉中减少你的收获; 勤奋也不会让你一夜成功 但会在不知不觉中积累你的成果 越努力,越幸运。
  • 相关阅读:
    20200414:mysql原子性和持久性怎么保证
    20200417:说说redis的rdb原理。假设服务器的内存8g,redis父进程占用了6g,子进程fork父进程后,子父进程总共占用内存12g,如何解决内存不足的问题?(挖)
    [九省联考2018]秘密袭击coat
    CF1158F Density of subarrays
    忘情
    [IOI2018] meetings 会议
    [AGC013E] Placing Squares
    [八省联考2018]林克卡特树
    [NOI2016] 国王饮水记
    [十二省联考 2019]皮配
  • 原文地址:https://www.cnblogs.com/Rainingday/p/12517409.html
Copyright © 2011-2022 走看看