devicetree: Add DT_FOREACH_CHILD_STATUS_OKAY macro

The macro only iterates the enabled child nodes and invokes
provided macro for each node.

Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
This commit is contained in:
Hou Zhiqiang 2021-04-26 16:22:38 +08:00 committed by Anas Nashif
commit 0700a24276
5 changed files with 41 additions and 0 deletions

View file

@ -1485,6 +1485,21 @@
#define DT_FOREACH_CHILD(node_id, fn) \
DT_CAT(node_id, _FOREACH_CHILD)(fn)
/**
* @brief 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".
*
* @param node_id node identifier
* @param fn macro to invoke
*/
#define DT_FOREACH_CHILD_STATUS_OKAY(node_id, fn) \
DT_CAT(node_id, _FOREACH_CHILD_STATUS_OKAY)(fn)
/**
* @brief Invokes "fn" for each element in the value of property "prop".
*