devicetree: add DT_PARENT()
This macro takes a node identifier, and returns the parent node's identifier. Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This commit is contained in:
parent
b6e6ba0429
commit
6e27343e7b
4 changed files with 47 additions and 3 deletions
|
@ -212,6 +212,26 @@
|
|||
*/
|
||||
#define DT_INST(inst, compat) UTIL_CAT(DT_N_INST, DT_DASH(inst, compat))
|
||||
|
||||
/**
|
||||
* @brief Get a node identifier for a parent node
|
||||
*
|
||||
* Example devicetree fragment:
|
||||
*
|
||||
* parent: parent-node {
|
||||
* child: child-node {
|
||||
* ...
|
||||
* };
|
||||
* };
|
||||
*
|
||||
* The following generate equivalent node identifiers:
|
||||
*
|
||||
* DT_NODELABEL(parent)
|
||||
* DT_PARENT(DT_NODELABEL(child))
|
||||
*
|
||||
* @param node_id node identifier
|
||||
*/
|
||||
#define DT_PARENT(node_id) UTIL_CAT(node_id, _PARENT)
|
||||
|
||||
/**
|
||||
* @brief Get a node identifier for a child node
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue