Lines Matching +full:line +full:- +full:addresses
1 .. _dt-syntax:
6 As the name indicates, a devicetree is a tree. The human-readable text format
24 .. code-block:: devicetree
26 /dts-v1/;
29 a-node {
30 subnode_nodelabel: a-sub-node {
36 The ``/dts-v1/;`` line means the file's contents are in version 1 of the DTS
37 syntax, which has replaced a now-obsolete "version 0".
46 #. A node named ``a-node``, which is a child of the root node
47 #. A node named ``a-sub-node``, which is a child of ``a-node``
49 .. _dt-node-labels:
52 the labeled node. Above, ``a-sub-node`` has the node label
61 ``a-sub-node`` is ``/a-node/a-sub-node``.
68 array of what are called *cells*. A cell is just a 32-bit unsigned integer.
70 Node ``a-sub-node`` has a property named ``foo``, whose value is a cell with
74 See :ref:`dt-writing-property-values` below for more example property values.
86 :figclass: align-center
95 .. code-block:: devicetree
97 /dts-v1/;
101 i2c-bus-controller {
102 i2c-peripheral-1 {
104 i2c-peripheral-2 {
106 i2c-peripheral-3 {
119 Here's a tree representing the same example, but with real-world node
123 :figclass: align-center
125 I2C devicetree example with real-world names and properties.
131 .. code-block:: devicetree
133 /dts-v1/;
138 compatible = "nordic,nrf-twim";
157 .. _dt-unit-address:
159 Unit addresses
162 In addition to showing more real-world names and properties, the above example
163 introduces a new devicetree concept: unit addresses. Unit addresses are the
165 ``i2c@40003000``, or ``39`` in ``apds9960@39``. Unit addresses are optional:
168 In devicetree, unit addresses give a node's address in the
169 address space of its parent node. Here are some example unit addresses for
172 Memory-mapped peripherals
183 An index representing the peripheral's chip select line number.
184 (If there is no chip select line, 0 is used.)
191 Memory-mapped flash
201 .. code-block:: devicetree
216 .. _dt-important-props:
233 :zephyr_file:`dts/bindings/vendor-prefixes.txt` contains a list of commonly
237 It is also sometimes a value like ``gpio-keys``, ``mmio-sram``, or
238 ``fixed-clock`` when the hardware's behavior is generic.
241 :ref:`bindings <dt-bindings>` for the node. Device drivers use
247 allow the system to match from most- to least-specific device drivers.
249 Within Zephyr's bindings syntax, this property has type ``string-array``.
261 - Devices accessed via memory-mapped I/O registers (like ``i2c@40003000``):
264 - I2C devices (like ``apds9960@39`` and its siblings):
267 - SPI devices: ``address`` is a chip select line number; there is no
271 unit addresses described above. This is not a coincidence. The ``reg``
279 ``"okay"``, ``"disabled"``, ``"reserved"``, ``"fail"``, and ``"fail-sss"``.
311 which is distinct from the standard :ref:`node label <dt-node-labels>`.
318 .. _dt-writing-property-values:
324 types in the table below are described in detail in :ref:`dt-bindings`.
329 .. list-table::
330 :header-rows: 1
333 * - Property type
334 - How to write
335 - Example
337 * - string
338 - Double quoted
339 - ``a-string = "hello, world!";``
341 * - int
342 - between angle brackets (``<`` and ``>``)
343 - ``an-int = <1>;``
345 * - boolean
346 - for ``true``, with no value (for ``false``, use ``/delete-property/``)
347 - ``my-true-boolean;``
349 * - array
350 - between angle brackets (``<`` and ``>``), separated by spaces
351 - ``foo = <0xdeadbeef 1234 0>;``
353 * - uint8-array
354 - in hexadecimal *without* leading ``0x``, between square brackets (``[`` and ``]``).
355 - ``a-byte-array = [00 01 ab];``
357 * - string-array
358 - separated by commas
359 - ``a-string-array = "string one", "string two", "string three";``
361 * - phandle
362 - between angle brackets (``<`` and ``>``)
363 - ``a-phandle = <&mynode>;``
365 * - phandles
366 - between angle brackets (``<`` and ``>``), separated by spaces
367 - ``some-phandles = <&mynode0 &mynode1 &mynode2>;``
369 * - phandle-array
370 - between angle brackets (``<`` and ``>``), separated by spaces
371 - ``a-phandle-array = <&mynode0 1 2>, <&mynode1 3 4>;``
375 - The values in the ``phandle``, ``phandles``, and ``phandle-array`` types are
376 described further in :ref:`dt-phandles`
378 - Boolean properties are true if present. They should not have a value.
381 - The ``foo`` property value above has three *cells* with values 0xdeadbeef, 1234,
386 - 64-bit integers are written as two 32-bit cells in big-endian order. The value
389 - The ``a-byte-array`` property value is the three bytes 0x00, 0x01, and 0xab, in
392 - Parentheses, arithmetic operators, and bitwise operators are allowed. The
395 .. code-block:: devicetree
401 - Property values refer to other nodes in the devicetree by their *phandles*.
403 <dt-node-labels>`. Here is an example devicetree fragment:
405 .. code-block:: devicetree
419 In the devicetree, a phandle value is a cell -- which again is just a 32-bit
422 :ref:`dt-from-c`.
424 - Array and similar type property values can be split into several ``<>``
427 .. code-block:: devicetree
431 foo = <&label1 1 2>, <&label2 3 4>; // Okay for 'type: phandle-array'
434 logically grouped into blocks of sub-values.
436 .. _dt-alias-chosen:
441 There are two additional ways beyond :ref:`node labels <dt-node-labels>` to
447 .. code-block:: devicetree
449 /dts-v1/;
457 my-uart = &uart0;
470 Above, ``my-uart`` is an alias for the node with path ``/soc/serial@12340000``.
476 example, :zephyr:code-sample:`blinky` uses this to abstract the LED to blink via the
479 The ``/chosen`` node's properties are used to configure system- or
480 subsystem-wide values. See :ref:`devicetree-chosen-nodes` for more information.