Skip to content

Commit 418a599

Browse files
Frank Rowandrobherring
authored andcommitted
Add items to Devicetree Source Format chapter
Add items to Devicetree Source Format chapter - Add naming convention for DTS files and DTS include files - Add /include/ compiler directive - Add ";" to end of node definition - Add /delete-node/ and /delete-property/ - Add arithmetic, bitwise, logical, and ternary expressions Note that cpp directives are not included in this patch, and are not yet specified in this appendix. Signed-off-by: Frank Rowand <[email protected]> Signed-off-by: Rob Herring <[email protected]>
1 parent 01eae0f commit 418a599

File tree

1 file changed

+74
-1
lines changed

1 file changed

+74
-1
lines changed

source/source-language.rst

Lines changed: 74 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,19 @@ devicetree in the form expected by the kernel. The following description is
99
not a formal syntax definition of DTS, but describes the basic
1010
constructs used to represent devicetrees.
1111

12+
The name of DTS files should end with ".dts".
13+
14+
Compiler directives
15+
-------------------
16+
17+
Other source files can be included from a DTS file. The name of include
18+
files should end with ".dtsi". Included files can in turn include
19+
additional files.
20+
21+
::
22+
23+
/include/ "FILE"
24+
1225
Node and property definitions
1326
-----------------------------
1427

@@ -21,11 +34,18 @@ preceded by a label.
2134
[label:] node-name[@unit-address] {
2235
[properties definitions]
2336
[child nodes]
24-
}
37+
};
2538

2639
Nodes may contain property definitions and/or child node definitions. If
2740
both are present, properties shall come before child nodes.
2841

42+
Previously defined nodes may be deleted.
43+
44+
::
45+
46+
/delete-node/ node-name;
47+
/delete-node/ &label;
48+
2949
Property definitions are name value pairs in the form:
3050

3151
::
@@ -39,6 +59,12 @@ form:
3959

4060
[label:] property-name;
4161

62+
Previously defined properties may be deleted.
63+
64+
::
65+
66+
/delete-property/ property-name;
67+
4268
Property values may be defined as an array of 32-bit integer cells, as
4369
null-terminated strings, as bytestrings or a combination of these.
4470

@@ -48,6 +74,53 @@ null-terminated strings, as bytestrings or a combination of these.
4874
::
4975

5076
interrupts = <17 0xc>;
77+
- values may be represented as arithmetic, bitwise, or logical expressions
78+
within parenthesis.
79+
80+
::
81+
82+
Arithmetic operators
83+
84+
+ add
85+
- subtract
86+
* multiply
87+
/ divide
88+
89+
::
90+
91+
Bitwise operators
92+
93+
& and
94+
| or
95+
^ exclusive or
96+
~ not
97+
<< left shift
98+
>> right shift
99+
100+
::
101+
102+
Logical operators
103+
104+
&& and
105+
|| or
106+
! not
107+
108+
::
109+
110+
Relational operators
111+
112+
< less than
113+
> greater than
114+
<= less than or equal
115+
>= greater than or equal
116+
== equal
117+
!= not equal
118+
119+
::
120+
121+
Ternary operators
122+
123+
?: (condition ? value_if_true : value_if_false)
51124

52125
- A 64-bit value is represented with two 32-bit cells. Example:
53126

0 commit comments

Comments
 (0)