Zephyr Project API 3.7.0
A Scalable Open Source RTOS
|
Macros | |
#define | DT_FOREACH_NODE(fn) DT_FOREACH_HELPER(fn) |
Invokes fn for every node in the tree. | |
#define | DT_FOREACH_NODE_VARGS(fn, ...) DT_FOREACH_VARGS_HELPER(fn, __VA_ARGS__) |
Invokes fn for every node in the tree with multiple arguments. | |
#define | DT_FOREACH_STATUS_OKAY_NODE(fn) DT_FOREACH_OKAY_HELPER(fn) |
Invokes fn for every status okay node in the tree. | |
#define | DT_FOREACH_STATUS_OKAY_NODE_VARGS(fn, ...) DT_FOREACH_OKAY_VARGS_HELPER(fn, __VA_ARGS__) |
Invokes fn for every status okay node in the tree with multiple arguments. | |
#define | DT_FOREACH_CHILD(node_id, fn) DT_CAT(node_id, _FOREACH_CHILD)(fn) |
Invokes fn for each child of node_id . | |
#define | DT_FOREACH_CHILD_SEP(node_id, fn, sep) DT_CAT(node_id, _FOREACH_CHILD_SEP)(fn, sep) |
Invokes fn for each child of node_id with a separator. | |
#define | DT_FOREACH_CHILD_VARGS(node_id, fn, ...) DT_CAT(node_id, _FOREACH_CHILD_VARGS)(fn, __VA_ARGS__) |
Invokes fn for each child of node_id with multiple arguments. | |
#define | DT_FOREACH_CHILD_SEP_VARGS(node_id, fn, sep, ...) DT_CAT(node_id, _FOREACH_CHILD_SEP_VARGS)(fn, sep, __VA_ARGS__) |
Invokes fn for each child of node_id with separator and multiple arguments. | |
#define | DT_FOREACH_CHILD_STATUS_OKAY(node_id, fn) DT_CAT(node_id, _FOREACH_CHILD_STATUS_OKAY)(fn) |
Call fn on the child nodes with status okay | |
#define | DT_FOREACH_CHILD_STATUS_OKAY_SEP(node_id, fn, sep) DT_CAT(node_id, _FOREACH_CHILD_STATUS_OKAY_SEP)(fn, sep) |
Call fn on the child nodes with status okay with separator. | |
#define | DT_FOREACH_CHILD_STATUS_OKAY_VARGS(node_id, fn, ...) DT_CAT(node_id, _FOREACH_CHILD_STATUS_OKAY_VARGS)(fn, __VA_ARGS__) |
Call fn on the child nodes with status okay with multiple arguments. | |
#define | DT_FOREACH_CHILD_STATUS_OKAY_SEP_VARGS(node_id, fn, sep, ...) DT_CAT(node_id, _FOREACH_CHILD_STATUS_OKAY_SEP_VARGS)(fn, sep, __VA_ARGS__) |
Call fn on the child nodes with status okay with separator and multiple arguments. | |
#define | DT_FOREACH_PROP_ELEM(node_id, prop, fn) DT_CAT4(node_id, _P_, prop, _FOREACH_PROP_ELEM)(fn) |
Invokes fn for each element in the value of property prop . | |
#define | DT_FOREACH_PROP_ELEM_SEP(node_id, prop, fn, sep) DT_CAT4(node_id, _P_, prop, _FOREACH_PROP_ELEM_SEP)(fn, sep) |
Invokes fn for each element in the value of property prop with separator. | |
#define | DT_FOREACH_PROP_ELEM_VARGS(node_id, prop, fn, ...) DT_CAT4(node_id, _P_, prop, _FOREACH_PROP_ELEM_VARGS)(fn, __VA_ARGS__) |
Invokes fn for each element in the value of property prop with multiple arguments. | |
#define | DT_FOREACH_PROP_ELEM_SEP_VARGS(node_id, prop, fn, sep, ...) |
Invokes fn for each element in the value of property prop with multiple arguments and a separator. | |
#define | DT_FOREACH_STATUS_OKAY(compat, fn) |
Invokes fn for each status okay node of a compatible. | |
#define | DT_FOREACH_STATUS_OKAY_VARGS(compat, fn, ...) |
Invokes fn for each status okay node of a compatible with multiple arguments. | |
#define | DT_FOREACH_NODELABEL(node_id, fn) DT_CAT(node_id, _FOREACH_NODELABEL)(fn) |
Invokes fn for each node label of a given node. | |
#define | DT_FOREACH_NODELABEL_VARGS(node_id, fn, ...) DT_CAT(node_id, _FOREACH_NODELABEL_VARGS)(fn, __VA_ARGS__) |
Invokes fn for each node label of a given node with multiple arguments. | |
#define DT_FOREACH_CHILD | ( | node_id, | |
fn | |||
) | DT_CAT(node_id, _FOREACH_CHILD)(fn) |
#include <include/zephyr/devicetree.h>
Invokes fn
for each child of node_id
.
The macro fn
must take one parameter, which will be the node identifier of a child node of node_id
.
The children will be iterated over in the same order as they appear in the final devicetree.
Example devicetree fragment:
Example usage:
This expands to:
node_id | node identifier |
fn | macro to invoke |
#define DT_FOREACH_CHILD_SEP | ( | node_id, | |
fn, | |||
sep | |||
) | DT_CAT(node_id, _FOREACH_CHILD_SEP)(fn, sep) |
#include <include/zephyr/devicetree.h>
Invokes fn
for each child of node_id
with a separator.
The macro fn
must take one parameter, which will be the node identifier of a child node of node_id
.
Example devicetree fragment:
Example usage:
This expands to:
node_id | node identifier |
fn | macro to invoke |
sep | Separator (e.g. comma or semicolon). Must be in parentheses; this is required to enable providing a comma as separator. |
#define DT_FOREACH_CHILD_SEP_VARGS | ( | node_id, | |
fn, | |||
sep, | |||
... | |||
) | DT_CAT(node_id, _FOREACH_CHILD_SEP_VARGS)(fn, sep, __VA_ARGS__) |
#include <include/zephyr/devicetree.h>
Invokes fn
for each child of node_id
with separator and multiple arguments.
The macro fn
takes multiple arguments. The first should be the node identifier for the child node. The remaining are passed-in by the caller.
node_id | node identifier |
fn | macro to invoke |
sep | Separator (e.g. comma or semicolon). Must be in parentheses; this is required to enable providing a comma as separator. |
... | variable number of arguments to pass to fn |
#define DT_FOREACH_CHILD_STATUS_OKAY | ( | node_id, | |
fn | |||
) | DT_CAT(node_id, _FOREACH_CHILD_STATUS_OKAY)(fn) |
#include <include/zephyr/devicetree.h>
Call fn
on the child nodes with status okay
The macro fn
should take one argument, which is the node identifier for the child node.
As usual, both a missing status and an ok
status are treated as okay
.
The children will be iterated over in the same order as they appear in the final devicetree.
node_id | node identifier |
fn | macro to invoke |
#define DT_FOREACH_CHILD_STATUS_OKAY_SEP | ( | node_id, | |
fn, | |||
sep | |||
) | DT_CAT(node_id, _FOREACH_CHILD_STATUS_OKAY_SEP)(fn, sep) |
#include <include/zephyr/devicetree.h>
Call fn
on the child nodes with status okay
with separator.
The macro fn
should take one argument, which is the node identifier for the child node.
As usual, both a missing status and an ok
status are treated as okay
.
node_id | node identifier |
fn | macro to invoke |
sep | Separator (e.g. comma or semicolon). Must be in parentheses; this is required to enable providing a comma as separator. |
#define DT_FOREACH_CHILD_STATUS_OKAY_SEP_VARGS | ( | node_id, | |
fn, | |||
sep, | |||
... | |||
) | DT_CAT(node_id, _FOREACH_CHILD_STATUS_OKAY_SEP_VARGS)(fn, sep, __VA_ARGS__) |
#include <include/zephyr/devicetree.h>
Call fn
on the child nodes with status okay
with separator and multiple arguments.
The macro fn
takes multiple arguments. The first should be the node identifier for the child node. The remaining are passed-in by the caller.
As usual, both a missing status and an ok
status are treated as okay
.
node_id | node identifier |
fn | macro to invoke |
sep | Separator (e.g. comma or semicolon). Must be in parentheses; this is required to enable providing a comma as separator. |
... | variable number of arguments to pass to fn |
#define DT_FOREACH_CHILD_STATUS_OKAY_VARGS | ( | node_id, | |
fn, | |||
... | |||
) | DT_CAT(node_id, _FOREACH_CHILD_STATUS_OKAY_VARGS)(fn, __VA_ARGS__) |
#include <include/zephyr/devicetree.h>
Call fn
on the child nodes with status okay
with multiple arguments.
The macro fn
takes multiple arguments. The first should be the node identifier for the child node. The remaining are passed-in by the caller.
As usual, both a missing status and an ok
status are treated as okay
.
The children will be iterated over in the same order as they appear in the final devicetree.
node_id | node identifier |
fn | macro to invoke |
... | variable number of arguments to pass to fn |
#define DT_FOREACH_CHILD_VARGS | ( | node_id, | |
fn, | |||
... | |||
) | DT_CAT(node_id, _FOREACH_CHILD_VARGS)(fn, __VA_ARGS__) |
#include <include/zephyr/devicetree.h>
Invokes fn
for each child of node_id
with multiple arguments.
The macro fn
takes multiple arguments. The first should be the node identifier for the child node. The remaining are passed-in by the caller.
The children will be iterated over in the same order as they appear in the final devicetree.
node_id | node identifier |
fn | macro to invoke |
... | variable number of arguments to pass to fn |
#define DT_FOREACH_NODE | ( | fn | ) | DT_FOREACH_HELPER(fn) |
#include <include/zephyr/devicetree.h>
Invokes fn
for every node in the tree.
The macro fn
must take one parameter, which will be a node identifier. The macro is expanded once for each node in the tree. The order that nodes are visited in is not specified.
fn | macro to invoke |
#define DT_FOREACH_NODE_VARGS | ( | fn, | |
... | |||
) | DT_FOREACH_VARGS_HELPER(fn, __VA_ARGS__) |
#include <include/zephyr/devicetree.h>
Invokes fn
for every node in the tree with multiple arguments.
The macro fn
takes multiple arguments. The first should be the node identifier for the node. The remaining are passed-in by the caller.
The macro is expanded once for each node in the tree. The order that nodes are visited in is not specified.
fn | macro to invoke |
... | variable number of arguments to pass to fn |
#define DT_FOREACH_NODELABEL | ( | node_id, | |
fn | |||
) | DT_CAT(node_id, _FOREACH_NODELABEL)(fn) |
#include <include/zephyr/devicetree.h>
Invokes fn
for each node label of a given node.
The order of the node labels in this macro's expansion matches the order in the final devicetree, with duplicates removed.
Node labels are passed to fn
as tokens. Note that devicetree node labels are always valid C tokens (see "6.2 Labels" in Devicetree Specification v0.4 for details). The node labels are passed as tokens to fn
as-is, without any lowercasing or conversion of special characters to underscores.
Example devicetree fragment:
Example usage:
This expands to:
node_id | node identifier whose node labels to use |
fn | macro which will be passed each node label in order |
#define DT_FOREACH_NODELABEL_VARGS | ( | node_id, | |
fn, | |||
... | |||
) | DT_CAT(node_id, _FOREACH_NODELABEL_VARGS)(fn, __VA_ARGS__) |
#include <include/zephyr/devicetree.h>
Invokes fn
for each node label of a given node with multiple arguments.
This is like DT_FOREACH_NODELABEL() except you can also pass additional arguments to fn
.
Example devicetree fragment:
Example usage:
This expands to:
node_id | node identifier whose node labels to use |
fn | macro which will be passed each node label in order |
... | additional arguments to pass to fn |
#define DT_FOREACH_PROP_ELEM | ( | node_id, | |
prop, | |||
fn | |||
) | DT_CAT4(node_id, _P_, prop, _FOREACH_PROP_ELEM)(fn) |
#include <include/zephyr/devicetree.h>
Invokes fn
for each element in the value of property prop
.
The macro fn
must take three parameters: fn(node_id, prop, idx). node_id
and prop
are the same as what is passed to DT_FOREACH_PROP_ELEM(), and idx
is the current index into the array. The idx
values are integer literals starting from 0.
The prop
argument must refer to a property that can be passed to DT_PROP_LEN().
Example devicetree fragment:
Example usage:
This expands to:
In general, this macro expands to:
fn(node_id, prop, 0) fn(node_id, prop, 1) [...] fn(node_id, prop, n-1)
where n
is the number of elements in prop
, as it would be returned by DT_PROP_LEN(node_id, prop)
.
node_id | node identifier |
prop | lowercase-and-underscores property name |
fn | macro to invoke |
#define DT_FOREACH_PROP_ELEM_SEP | ( | node_id, | |
prop, | |||
fn, | |||
sep | |||
) | DT_CAT4(node_id, _P_, prop, _FOREACH_PROP_ELEM_SEP)(fn, sep) |
#include <include/zephyr/devicetree.h>
Invokes fn
for each element in the value of property prop
with separator.
Example devicetree fragment:
Example usage:
This expands as a first step to:
The prop
parameter has the same restrictions as the same parameter given to DT_FOREACH_PROP_ELEM().
node_id | node identifier |
prop | lowercase-and-underscores property name |
fn | macro to invoke |
sep | Separator (e.g. comma or semicolon). Must be in parentheses; this is required to enable providing a comma as separator. |
#define DT_FOREACH_PROP_ELEM_SEP_VARGS | ( | node_id, | |
prop, | |||
fn, | |||
sep, | |||
... | |||
) |
#include <include/zephyr/devicetree.h>
Invokes fn
for each element in the value of property prop
with multiple arguments and a separator.
The prop
parameter has the same restrictions as the same parameter given to DT_FOREACH_PROP_ELEM().
node_id | node identifier |
prop | lowercase-and-underscores property name |
fn | macro to invoke |
sep | Separator (e.g. comma or semicolon). Must be in parentheses; this is required to enable providing a comma as separator. |
... | variable number of arguments to pass to fn |
#define DT_FOREACH_PROP_ELEM_VARGS | ( | node_id, | |
prop, | |||
fn, | |||
... | |||
) | DT_CAT4(node_id, _P_, prop, _FOREACH_PROP_ELEM_VARGS)(fn, __VA_ARGS__) |
#include <include/zephyr/devicetree.h>
Invokes fn
for each element in the value of property prop
with multiple arguments.
The macro fn
must take multiple parameters: fn(node_id, prop, idx, ...)
. node_id
and prop
are the same as what is passed to DT_FOREACH_PROP_ELEM(), and idx
is the current index into the array. The idx
values are integer literals starting from 0. The remaining arguments are passed-in by the caller.
The prop
parameter has the same restrictions as the same parameter given to DT_FOREACH_PROP_ELEM().
node_id | node identifier |
prop | lowercase-and-underscores property name |
fn | macro to invoke |
... | variable number of arguments to pass to fn |
#define DT_FOREACH_STATUS_OKAY | ( | compat, | |
fn | |||
) |
#include <include/zephyr/devicetree.h>
Invokes fn
for each status okay
node of a compatible.
This macro expands to:
fn(node_id_1) fn(node_id_2) ... fn(node_id_n)
where each node_id_<i>
is a node identifier for some node with compatible compat
and status okay
. Whitespace is added between expansions as shown above.
Example devicetree fragment:
Example usage:
This expands to one of the following:
"/a" "/c" "/c" "/a"
"One of the following" is because no guarantees are made about the order that node identifiers are passed to fn
in the expansion.
(The /c
string literal is present because a missing status property is always treated as if the status were set to okay
.)
Note also that fn
is responsible for adding commas, semicolons, or other terminators as needed.
compat | lowercase-and-underscores devicetree compatible |
fn | Macro to call for each enabled node. Must accept a node_id as its only parameter. |
#define DT_FOREACH_STATUS_OKAY_NODE | ( | fn | ) | DT_FOREACH_OKAY_HELPER(fn) |
#include <include/zephyr/devicetree.h>
Invokes fn
for every status okay
node in the tree.
The macro fn
must take one parameter, which will be a node identifier. The macro is expanded once for each node in the tree with status okay
(as usual, a missing status property is treated as status okay
). The order that nodes are visited in is not specified.
fn | macro to invoke |
#define DT_FOREACH_STATUS_OKAY_NODE_VARGS | ( | fn, | |
... | |||
) | DT_FOREACH_OKAY_VARGS_HELPER(fn, __VA_ARGS__) |
#include <include/zephyr/devicetree.h>
Invokes fn
for every status okay
node in the tree with multiple arguments.
The macro fn
takes multiple arguments. The first should be the node identifier for the node. The remaining are passed-in by the caller.
The macro is expanded once for each node in the tree with status okay
(as usual, a missing status property is treated as status okay
). The order that nodes are visited in is not specified.
fn | macro to invoke |
... | variable number of arguments to pass to fn |
#define DT_FOREACH_STATUS_OKAY_VARGS | ( | compat, | |
fn, | |||
... | |||
) |
#include <include/zephyr/devicetree.h>
Invokes fn
for each status okay
node of a compatible with multiple arguments.
This is like DT_FOREACH_STATUS_OKAY() except you can also pass additional arguments to fn
.
Example devicetree fragment:
Example usage:
This expands to one of the following:
i.e. it sets x
to 7. As with DT_FOREACH_STATUS_OKAY(), there are no guarantees about the order nodes appear in the expansion.
compat | lowercase-and-underscores devicetree compatible |
fn | Macro to call for each enabled node. Must accept a node_id as its only parameter. |
... | Additional arguments to pass to fn |