Skip to contentSkip to conversation

Add items to Devicetree Source Format chapter

PATCH Superseded Frank Rowand 2 participants 3 messages Jun 3, 2016 – Jun 7, 2016 2 messages not in the archive

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add items to Devicetree Source Format chapter

From: Frank Rowand <[email protected]>

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, and logical expressions

Note that cpp directives are not included in this patch, and are not yet specified in this appendix.

---
 source/source-language.rst |   60 ++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 59 insertions(+), 1 deletion(-)
source/source-language.rst +59 -1
Index: b/source/source-language.rst
===================================================================
@@ -9,6 +9,19 @@ devicetree in the form expected by the k
 not a formal syntax definition of DTS, but describes the basic
 constructs used to represent devicetrees.
 
+The name of DTS files should end with ".dts".
+
+Compiler directives
+-------------------
+
+Other source files can be included from a DTS file.  The name of include
+files should end with ".dtsi".  Included files can in turn include
+additional files.
+
+::
+
+    /include/ "FILE"
+
 Node and property definitions
 -----------------------------
 
@@ -21,11 +34,18 @@ preceded by a label.
     [label:] node-name[@unit-address] {
         [properties definitions]
         [child nodes]
-    }
+    };
 
 Nodes may contain property definitions and/or child node definitions. If
 both are present, properties shall come before child nodes.
 
+Previously defined nodes may be deleted.
+
+::
+
+    /delete-node/ node-name;
+    /delete-node/ &label;
+
 Property definitions are name value pairs in the form:
 
 ::
@@ -39,6 +59,12 @@ form:
 
         [label:] property-name;
 
+Previously defined properties may be deleted.
+
+::
+
+    /delete-property/ property-name;
+
 Property values may be defined as an array of 32-bit integer cells, as
 null-terminated strings, as bytestrings or a combination of these.
 
@@ -48,6 +74,38 @@ null-terminated strings, as bytestrings
 ::
 
         interrupts = <17 0xc>;
+-  values may be represented as arithmetic, bitwise, or logical expressions
+   within parenthesis.
+
+::
+
+    Arithmetic operators
+
+    +   add
+    -   subtract
+    *   multiply
+    /   divide
+    <<  left shift
+    >>  right shift
+
+::
+
+    Bitwise operators
+
+    &&   and
+    ||   or
+
+::
+
+    Logical operators
+
+    <    less than
+    >    greater than
+    <=   less than or equal
+    >=   greater than or equal
+    ==   equal
+    !=   not equal
+
 
 -  A 64-bit value is represented with two 32-bit cells. Example:
 
#2 lore raw
In reply to a message not in the archive
Quoted 89 lines · Frank Rowand

From: Frank Rowand <[email protected]>

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, and logical expressions

Note that cpp directives are not included in this patch, and are not yet specified in this appendix.

---
 source/source-language.rst |   60 ++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 59 insertions(+), 1 deletion(-)

Index: b/source/source-language.rst
===================================================================

source/source-language.rst +37 -1
@@ -9,6 +9,19 @@ devicetree in the form expected by the k
 not a formal syntax definition of DTS, but describes the basic
 constructs used to represent devicetrees.
 
+The name of DTS files should end with ".dts".
+
+Compiler directives
+-------------------
+
+Other source files can be included from a DTS file.  The name of include
+files should end with ".dtsi".  Included files can in turn include
+additional files.
+
+::
+
+    /include/ "FILE"
+
 Node and property definitions
 -----------------------------
 
@@ -21,11 +34,18 @@ preceded by a label.
     [label:] node-name[@unit-address] {
         [properties definitions]
         [child nodes]
-    }
+    };
 
 Nodes may contain property definitions and/or child node definitions. If
 both are present, properties shall come before child nodes.
 
+Previously defined nodes may be deleted.
+
+::
+
+    /delete-node/ node-name;
+    /delete-node/ &label;
+
 Property definitions are name value pairs in the form:
 
 ::
@@ -39,6 +59,12 @@ form:
 
         [label:] property-name;
 
+Previously defined properties may be deleted.
+
+::
+
+    /delete-property/ property-name;
+
 Property values may be defined as an array of 32-bit integer cells, as
 null-terminated strings, as bytestrings or a combination of these.
 
@@ -48,6 +74,38 @@ null-terminated strings, as bytestrings
 ::
 
         interrupts = <17 0xc>;
+-  values may be represented as arithmetic, bitwise, or logical expressions
+   within parenthesis.
+
+::
+
+    Arithmetic operators
+
+    +   add
+    -   subtract
+    *   multiply

source/source-language.rst null-terminated strings, as bytestrings · line 96

Quoted 10 lines
source/source-language.rst +10 -0
+    /   divide
+    <<  left shift
+    >>  right shift
+
+::
+
+    Bitwise operators
+
+    &&   and
+    ||   or

Is this correct that these are not logical operators? From the dtc source in dtc-parser.y, it looks like both bitwise and logical ops are supported and XOR.

Quoted 19 lines
source/source-language.rst +12 -1
+
+::
+
+    Logical operators
+
+    <    less than
+    >    greater than
+    <=   less than or equal
+    >=   greater than or equal
+    ==   equal
+    !=   not equal
+
 
 -  A 64-bit value is represented with two 32-bit cells. Example:
 
--

To unsubscribe from this list: send the line "unsubscribe devicetree-spec" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw
In reply to a message not in the archive
Quoted 23 lines · Rob Herring
Quoted 22 lines · Frank Rowand

From: Frank Rowand <[email protected]>

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, and logical expressions

Note that cpp directives are not included in this patch, and are not yet specified in this appendix.

---
 source/source-language.rst |   60 ++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 59 insertions(+), 1 deletion(-)

Index: b/source/source-language.rst
===================================================================

source/source-language.rst +0 -0

< snip >

Quoted 9 lines

source/source-language.rst null-terminated strings, as bytestrings · line 96

Quoted 5 lines
source/source-language.rst +5 -0
+
+    Bitwise operators
+
+    &&   and
+    ||   or

Is this correct that these are not logical operators? From the dtc source in dtc-parser.y, it looks like both bitwise and logical ops are supported and XOR.

Thanks for catching that. It was a thinko, plus I did not catch the XOR. I also missed NOT and TERNARY. New patch on the way.

Quoted 21 lines
Quoted 20 lines
source/source-language.rst +12 -1
+
+::
+
+    Logical operators
+
+    <    less than
+    >    greater than
+    <=   less than or equal
+    >=   greater than or equal
+    ==   equal
+    !=   not equal
+
 
 -  A 64-bit value is represented with two 32-bit cells. Example:
 
--

To unsubscribe from this list: send the line "unsubscribe devicetree-spec" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html