DeviceTree - 设备树源文件编码规范

文档版本:Linux Kernel 6.9.0-rc3 
Devicetree Sources (DTS) Coding Style
在编写 Devicetree Sources (DTS) 时,请遵守以下准则。它们应被视为对 Devicetree 规范和 dtc 编译器(包括 W=1 和 W=2 版本)中已有规则的补充。
When writing Devicetree Sources (DTS) please observe below guidelines. They should be considered complementary to any rules expressed already in the Devicetree Specification and the dtc compiler (including W=1 and W=2 builds).
个别架构和子架构可以定义额外的规则,使编码风格更加严格。
Individual architectures and subarchitectures can define additional rules, making the coding style stricter.
Naming and Valid Characters [ 命名和有效字符 ]
《Devicetree 规范》允许在节点和属性名称中使用多种字符,但这种编码方式缩小了字符范围,以提高代码的可读性。
The Devicetree Specification allows a broad range of characters in node and property names, but this coding style narrows the range down to achieve better code readability.
1,节点和属性名称只能使用以下字符:
  • 小写字母 [a-z]
  • 数字: [0-9]
  • 破折号: -
2,标签只能使用以下字符:
  • 小写字符: [a-z]
  • 数字: [0-9]
  • 下划线: _
3,除非总线另有规定,否则单元地址应使用小写十六进制数字,不含前导零(填充)。
4,属性中的十六进制值,如 "reg",应使用小写十六进制。地址部分可以用前导零填充。
1. Node and property names can use only the following characters:
    * Lowercase characters: [a-z]
    * Digits: [0-9]
    * Dash: -
2. Labels can use only the following characters:
    * Lowercase characters: [a-z]
    * Digits: [0-9]
    * Underscore: _
3. Unless a bus defines differently, unit addresses shall use lowercase hexadecimal digits, without leading zeros (padding).
4. Hex values in properties, e.g. “reg”, shall use lowercase hex. The address part can be padded with leading zeros.
Example:
gpi_dma2: dma-controller@a00000 {
        compatible = "qcom,sm8550-gpi-dma", "qcom,sm6350-gpi-dma";
   &nb
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

夜流冰

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值