@@ -34,18 +34,18 @@ identifier* for it. This is a just a C macro that refers to the node.
3434These are the main ways to get a node identifier:
3535
3636By path
37- Use :c:func : `DT_PATH() ` along with the node's full path in the devicetree,
37+ Use :c:macro : `DT_PATH() ` along with the node's full path in the devicetree,
3838 starting from the root node. This is mostly useful if you happen to know the
3939 exact node you're looking for.
4040
4141By node label
42- Use :c:func : `DT_NODELABEL() ` to get a node identifier from a :ref: `node
42+ Use :c:macro : `DT_NODELABEL() ` to get a node identifier from a :ref: `node
4343 label <dt-node-labels>`. Node labels are often provided by SoC :file: `.dtsi `
4444 files to give nodes names that match the SoC datasheet, like ``i2c1 ``,
4545 ``spi2 ``, etc.
4646
4747By alias
48- Use :c:func : `DT_ALIAS() ` to get a node identifier for a property of the
48+ Use :c:macro : `DT_ALIAS() ` to get a node identifier for a property of the
4949 special ``/aliases `` node. This is sometimes done by applications (like
5050 :zephyr:code-sample: `blinky `, which uses the ``led0 `` alias) that need to
5151 refer to *some * device of a particular type ("the board's user LED") but
@@ -54,14 +54,14 @@ By alias
5454By instance number
5555 This is done primarily by device drivers, as instance numbers are a way to
5656 refer to individual nodes based on a matching compatible. Get these with
57- :c:func : `DT_INST() `, but be careful doing so. See below.
57+ :c:macro : `DT_INST() `, but be careful doing so. See below.
5858
5959By chosen node
60- Use :c:func : `DT_CHOSEN() ` to get a node identifier for ``/chosen `` node
60+ Use :c:macro : `DT_CHOSEN() ` to get a node identifier for ``/chosen `` node
6161 properties.
6262
6363By parent/child
64- Use :c:func : `DT_PARENT() ` and :c:func : `DT_CHILD() ` to get a node identifier
64+ Use :c:macro : `DT_PARENT() ` and :c:macro : `DT_CHILD() ` to get a node identifier
6565 for a parent or child node, starting from a node identifier you already have.
6666
6767Two node identifiers which refer to the same node are identical and can be used
@@ -82,7 +82,7 @@ Here are a few ways to get node identifiers for the ``i2c@40002000`` node:
8282- ``DT_NODELABEL(i2c1) ``
8383- ``DT_ALIAS(sensor_controller) ``
8484- ``DT_INST(x, vnd_soc_i2c) `` for some unknown number ``x ``. See the
85- :c:func : `DT_INST() ` documentation for details.
85+ :c:macro : `DT_INST() ` documentation for details.
8686
8787.. important ::
8888
@@ -133,7 +133,7 @@ The right API to use to read property values depends on the node and property.
133133Checking properties and values
134134==============================
135135
136- You can use :c:func : `DT_NODE_HAS_PROP() ` to check if a node has a property. For
136+ You can use :c:macro : `DT_NODE_HAS_PROP() ` to check if a node has a property. For
137137the :ref: `example devicetree <dt-node-main-ex >` above:
138138
139139.. code-block :: c
@@ -202,7 +202,7 @@ Its properties can be accessed like this:
202202 unsigned char b[] = DT_PROP(FOO, b); /* {0xaa, 0xbb, 0xcc, 0xdd} */
203203 char* c[] = DT_PROP(FOO, c); /* {"foo", "bar"} */
204204
205- You can use :c:func : `DT_PROP_LEN() ` to get logical array lengths in number of
205+ You can use :c:macro : `DT_PROP_LEN() ` to get logical array lengths in number of
206206elements.
207207
208208.. code-block :: c
@@ -226,12 +226,12 @@ total number of register blocks in the node's ``reg`` property.
226226
227227You **cannot ** read register block addresses and lengths with ``DT_PROP(node,
228228reg) ``. Instead, if a node only has one register block, use
229- :c:func : `DT_REG_ADDR ` or :c:func : `DT_REG_SIZE `:
229+ :c:macro : `DT_REG_ADDR ` or :c:macro : `DT_REG_SIZE `:
230230
231231- ``DT_REG_ADDR(node_id) ``: the given node's register block address
232232- ``DT_REG_SIZE(node_id) ``: its size
233233
234- Use :c:func : `DT_REG_ADDR_BY_IDX ` or :c:func : `DT_REG_SIZE_BY_IDX ` instead if the
234+ Use :c:macro : `DT_REG_ADDR_BY_IDX ` or :c:macro : `DT_REG_SIZE_BY_IDX ` instead if the
235235node has multiple register blocks:
236236
237237- ``DT_REG_ADDR_BY_IDX(node_id, idx) ``: address of register block at index
@@ -261,7 +261,7 @@ Given a node identifier ``node_id``, ``DT_NUM_IRQS(node_id)`` is the total
261261number of interrupt specifiers in the node's ``interrupts `` property.
262262
263263The most general purpose API macro for accessing these is
264- :c:func : `DT_IRQ_BY_IDX `:
264+ :c:macro : `DT_IRQ_BY_IDX `:
265265
266266.. code-block :: c
267267
@@ -274,7 +274,7 @@ macro, check the bindings file for the node you are interested in to find the
274274``val `` names.
275275
276276Most Zephyr devicetree bindings have a cell named ``irq ``, which is the
277- interrupt number. You can use :c:func : `DT_IRQN ` as a convenient way to get a
277+ interrupt number. You can use :c:macro : `DT_IRQN ` as a convenient way to get a
278278processed view of this value.
279279
280280.. warning ::
@@ -302,8 +302,8 @@ syntax introduced in :ref:`dt-writing-property-values`. Properties which
302302contain phandles have type ``phandle ``, ``phandles ``, or ``phandle-array `` in
303303their bindings. We'll call these "phandle properties" for short.
304304
305- You can convert a phandle to a node identifier using :c:func : `DT_PHANDLE `,
306- :c:func : `DT_PHANDLE_BY_IDX `, or :c:func : `DT_PHANDLE_BY_NAME `, depending on the
305+ You can convert a phandle to a node identifier using :c:macro : `DT_PHANDLE `,
306+ :c:macro : `DT_PHANDLE_BY_IDX `, or :c:macro : `DT_PHANDLE_BY_NAME `, depending on the
307307type of property you are working with.
308308
309309One common use case for phandle properties is referring to other hardware in
@@ -312,13 +312,13 @@ phandle to a Zephyr driver-level :ref:`struct device <device_model_api>`.
312312See :ref: `dt-get-device ` for ways to do that.
313313
314314Another common use case is accessing specifier values in a phandle array. The
315- general purpose APIs for this are :c:func : `DT_PHA_BY_IDX ` and :c:func : `DT_PHA `.
316- There are also hardware-specific shorthands like :c:func : `DT_GPIO_CTLR_BY_IDX `,
317- :c:func : `DT_GPIO_CTLR `,
318- :c:func : `DT_GPIO_PIN_BY_IDX `, :c:func : `DT_GPIO_PIN `,
319- :c:func : `DT_GPIO_FLAGS_BY_IDX `, and :c:func : `DT_GPIO_FLAGS `.
315+ general purpose APIs for this are :c:macro : `DT_PHA_BY_IDX ` and :c:macro : `DT_PHA `.
316+ There are also hardware-specific shorthands like :c:macro : `DT_GPIO_CTLR_BY_IDX `,
317+ :c:macro : `DT_GPIO_CTLR `,
318+ :c:macro : `DT_GPIO_PIN_BY_IDX `, :c:macro : `DT_GPIO_PIN `,
319+ :c:macro : `DT_GPIO_FLAGS_BY_IDX `, and :c:macro : `DT_GPIO_FLAGS `.
320320
321- See :c:func : `DT_PHA_HAS_CELL_AT_IDX ` and :c:func : `DT_PROP_HAS_IDX ` for ways to
321+ See :c:macro : `DT_PHA_HAS_CELL_AT_IDX ` and :c:macro : `DT_PROP_HAS_IDX ` for ways to
322322check if a specifier value is present in a phandle property.
323323
324324.. _other-devicetree-apis :
@@ -328,12 +328,12 @@ Other APIs
328328
329329Here are pointers to some other available APIs.
330330
331- - :c:func : `DT_CHOSEN `, :c:func : `DT_HAS_CHOSEN `: for properties
331+ - :c:macro : `DT_CHOSEN `, :c:macro : `DT_HAS_CHOSEN `: for properties
332332 of the special ``/chosen `` node
333- - :c:func : `DT_HAS_COMPAT_STATUS_OKAY `, :c:func : `DT_NODE_HAS_COMPAT `: global- and
333+ - :c:macro : `DT_HAS_COMPAT_STATUS_OKAY `, :c:macro : `DT_NODE_HAS_COMPAT `: global- and
334334 node-specific tests related to the ``compatible `` property
335- - :c:func : `DT_BUS `: get a node's bus controller, if there is one
336- - :c:func : `DT_ENUM_IDX `: for properties whose values are among a fixed list of
335+ - :c:macro : `DT_BUS `: get a node's bus controller, if there is one
336+ - :c:macro : `DT_ENUM_IDX `: for properties whose values are among a fixed list of
337337 choices
338338- :ref: `devicetree-flash-api `: APIs for managing fixed flash partitions.
339339 Also see :ref: `flash_map_api `, which wraps this in a more user-friendly API.
@@ -346,7 +346,7 @@ rely on :ref:`instance identifiers <dt-node-identifiers>`.
346346
347347To use these, you must define ``DT_DRV_COMPAT `` to the ``compat `` value your
348348driver implements support for. This ``compat `` value is what you would pass to
349- :c:func : `DT_INST `.
349+ :c:macro : `DT_INST `.
350350
351351If you do that, you can access the properties of individual instances of your
352352compatible with less typing, like this:
0 commit comments