Skip to content

Commit e7c3436

Browse files
rruuaanngmmahadevan108
authored andcommitted
doc: build: dts: Fix incorrect rst tag
Replaced incorrect ':c:func:' tag for devicetree macro with ':c:macro' tag. Signed-off-by: James Roy <[email protected]>
1 parent 525ba38 commit e7c3436

File tree

2 files changed

+37
-37
lines changed

2 files changed

+37
-37
lines changed

doc/build/dts/api-usage.rst

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,18 @@ identifier* for it. This is a just a C macro that refers to the node.
3434
These are the main ways to get a node identifier:
3535

3636
By 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

4141
By 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

4747
By 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
5454
By 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

5959
By 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

6363
By 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

6767
Two 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.
133133
Checking 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
137137
the :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
206206
elements.
207207

208208
.. code-block:: c
@@ -226,12 +226,12 @@ total number of register blocks in the node's ``reg`` property.
226226

227227
You **cannot** read register block addresses and lengths with ``DT_PROP(node,
228228
reg)``. 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
235235
node 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
261261
number of interrupt specifiers in the node's ``interrupts`` property.
262262

263263
The 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

276276
Most 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
278278
processed view of this value.
279279

280280
.. warning::
@@ -302,8 +302,8 @@ syntax introduced in :ref:`dt-writing-property-values`. Properties which
302302
contain phandles have type ``phandle``, ``phandles``, or ``phandle-array`` in
303303
their 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
307307
type of property you are working with.
308308

309309
One 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>`.
312312
See :ref:`dt-get-device` for ways to do that.
313313

314314
Another 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
322322
check if a specifier value is present in a phandle property.
323323

324324
.. _other-devicetree-apis:
@@ -328,12 +328,12 @@ Other APIs
328328

329329
Here 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

347347
To use these, you must define ``DT_DRV_COMPAT`` to the ``compat`` value your
348348
driver implements support for. This ``compat`` value is what you would pass to
349-
:c:func:`DT_INST`.
349+
:c:macro:`DT_INST`.
350350

351351
If you do that, you can access the properties of individual instances of your
352352
compatible with less typing, like this:

doc/build/dts/howtos.rst

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ works best for your requirements. Here are some examples:
101101
#define MY_SERIAL DT_PATH(soc, serial_40002000)
102102
103103
Once you have a node identifier there are two ways to proceed. One way to get a
104-
device is to use :c:func:`DEVICE_DT_GET`:
104+
device is to use :c:macro:`DEVICE_DT_GET`:
105105

106106
.. code-block:: c
107107
@@ -112,9 +112,9 @@ device is to use :c:func:`DEVICE_DT_GET`:
112112
return -ENODEV;
113113
}
114114
115-
There are variants of :c:func:`DEVICE_DT_GET` such as
116-
:c:func:`DEVICE_DT_GET_OR_NULL`, :c:func:`DEVICE_DT_GET_ONE` or
117-
:c:func:`DEVICE_DT_GET_ANY`. This idiom fetches the device pointer at
115+
There are variants of :c:macro:`DEVICE_DT_GET` such as
116+
:c:macro:`DEVICE_DT_GET_OR_NULL`, :c:macro:`DEVICE_DT_GET_ONE` or
117+
:c:macro:`DEVICE_DT_GET_ANY`. This idiom fetches the device pointer at
118118
build-time, which means there is no runtime penalty. This method is useful if
119119
you want to store the device pointer as configuration data. But because the
120120
device may not be initialized, or may have failed to initialize, you must verify
@@ -510,12 +510,12 @@ using instance numbers. Do this after defining ``my_api_funcs``.
510510
MY_DEV_INIT_LEVEL, MY_DEV_INIT_PRIORITY, \
511511
&my_api_funcs);
512512
513-
Notice the use of APIs like :c:func:`DT_INST_PROP` and
514-
:c:func:`DEVICE_DT_INST_DEFINE` to access devicetree node data. These
513+
Notice the use of APIs like :c:macro:`DT_INST_PROP` and
514+
:c:macro:`DEVICE_DT_INST_DEFINE` to access devicetree node data. These
515515
APIs retrieve data from the devicetree for instance number ``inst`` of
516516
the node with compatible determined by ``DT_DRV_COMPAT``.
517517

518-
Finally, pass the instantiation macro to :c:func:`DT_INST_FOREACH_STATUS_OKAY`:
518+
Finally, pass the instantiation macro to :c:macro:`DT_INST_FOREACH_STATUS_OKAY`:
519519

520520
.. code-block:: c
521521
@@ -534,7 +534,7 @@ Option 2: create devices using node labels
534534
Some device drivers cannot use instance numbers. One example is an SoC
535535
peripheral driver which relies on vendor HAL APIs specialized for individual IP
536536
blocks to implement Zephyr driver callbacks. Cases like this should use
537-
:c:func:`DT_NODELABEL` to refer to individual nodes in the devicetree
537+
:c:macro:`DT_NODELABEL` to refer to individual nodes in the devicetree
538538
representing the supported peripherals on the SoC. The devicetree.h
539539
:ref:`devicetree-generic-apis` can then be used to access node data.
540540

@@ -587,8 +587,8 @@ devicetree to operate on specific device nodes:
587587
MY_DEV_INIT_LEVEL, MY_DEV_INIT_PRIORITY, \
588588
&my_api_funcs)
589589
590-
Notice the use of APIs like :c:func:`DT_PROP` and
591-
:c:func:`DEVICE_DT_DEFINE` to access devicetree node data.
590+
Notice the use of APIs like :c:macro:`DT_PROP` and
591+
:c:macro:`DEVICE_DT_DEFINE` to access devicetree node data.
592592

593593
Finally, manually detect each enabled devicetree node and use
594594
``CREATE_MY_DEVICE`` to instantiate each ``struct device``:
@@ -621,7 +621,7 @@ its SPI bus controller device. Some advice:
621621
- In particular, for bus devices, your driver's binding should include a
622622
file like :zephyr_file:`dts/bindings/spi/spi-device.yaml` which provides
623623
common definitions for devices addressable via a specific bus. This enables
624-
use of APIs like :c:func:`DT_BUS` to obtain a node identifier for the bus
624+
use of APIs like :c:macro:`DT_BUS` to obtain a node identifier for the bus
625625
node. You can then :ref:`dt-get-device` for the bus in the usual way.
626626

627627
Search existing bindings and device drivers for examples.

0 commit comments

Comments
 (0)