首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >DTS文件说明-别名

DTS文件说明-别名
EN

Stack Overflow用户
提问于 2013-07-19 13:28:29
回答 1查看 7.1K关注 0票数 5

我正在尝试理解DTS文件中的以下代码片段。

代码语言:javascript
复制
/dts-v1/;

/ {
    model = "MPC8313ERDB";
    compatible = "MPC8313ERDB", "MPC831xRDB", "MPC83xxRDB";
    #address-cells = <1>;
    #size-cells = <1>;

    aliases {
        ethernet0 = &enet0;
        serial0 = &serial0;
        serial1 = &serial1;
        pci0 = &pci0;
    };

别名部分是做什么的?

我的理解如下。

对于ethernet0,我们可以使用enet0。

但是为什么是serial0=&serial0呢?

和serial1 =&序列1

有谁能简要介绍一下吗?

谢谢。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-07-19 18:23:48

在DTS的aliases部分,我们可以看到以下格式的条目

property = &label;

每个条目由以下内容组成:

a. property --这里定义的新的属性

b. &label -- 指向label引用的node的完整DTS路径

它基本上将b的值赋给a。此后,可以使用简写property访问由label标识的节点的长名称。

请注意,此赋值的RHS使用的是labels和,而不是各个节点的短名称。就像C代码中的label引用定义它的行上的指令一样,DTS中的label引用该行上定义的单个节点(使用其完整的长路径)。

例如,考虑以下DTS,

lxr.free-electrons.com/source/arch/powerpc/boot/dts/mpc8313erdb.dts

aliases部分由以下内容组成:

代码语言:javascript
复制
 20         aliases {
 21                 ethernet0 = &enet0;
 22                 ethernet1 = &enet1;
 23                 serial0 = &serial0;
 24                 serial1 = &serial1;
 25                 pci0 = &pci0;
 26         };

新定义的属性(LHS)

  • ethernet0
  • ethernet1
  • serial0
  • serial1
  • pci0

请参阅相应的标签(RHS)

  • enet0
  • enet1
  • serial0
  • serial1
  • pci0

例如,属性ethernet0现在设置为"/soc8313@e0000000/ethernet@24000",即在the line where the label enet0 is defined上定义的节点。

更新

  1. 为什么仅为ethernet0serial0 ... ?

定义别名

Linux源:

代码语言:javascript
复制
- Further down the line, the developer intends to access these nodes in the kernel source code. Once an **alias** is defined in the DTS, a **handle to the node it is referring to** is obtained by simply searching for it in the `aliases` section rather than searching for it in the entire DTS.

内核源中的函数。

  1. 为什么中的pci0节点不是soc8313节点下的

代码语言:javascript
复制
- On MPC8313, the **PCI** and **DMA** blocks are interfaced via the IO-Sequencer(IOS). Hence the special treatment as compared to the other blocks (ethernet, I2C, UART) that are connected directly to the system bus.

票数 9
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/17738709

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档