Zephyr API Documentation
3.6.99
A Scalable Open Source RTOS
|
Macros | |
#define | DT_NODE_EXISTS(node_id) IS_ENABLED(DT_CAT(node_id, _EXISTS)) |
Does a node identifier refer to a node? | |
#define | DT_NODE_HAS_STATUS(node_id, status) DT_NODE_HAS_STATUS_INTERNAL(node_id, status) |
Does a node identifier refer to a node with a status? | |
#define | DT_HAS_COMPAT_STATUS_OKAY(compat) IS_ENABLED(DT_CAT(DT_COMPAT_HAS_OKAY_, compat)) |
Does the devicetree have a status okay node with a compatible? | |
#define | DT_NUM_INST_STATUS_OKAY(compat) |
Get the number of instances of a given compatible with status okay | |
#define | DT_NODE_HAS_COMPAT(node_id, compat) IS_ENABLED(DT_CAT3(node_id, _COMPAT_MATCHES_, compat)) |
Does a devicetree node match a compatible? | |
#define | DT_NODE_HAS_COMPAT_STATUS(node_id, compat, status) DT_NODE_HAS_COMPAT(node_id, compat) && DT_NODE_HAS_STATUS(node_id, status) |
Does a devicetree node have a compatible and status? | |
#define | DT_NODE_HAS_PROP(node_id, prop) IS_ENABLED(DT_CAT4(node_id, _P_, prop, _EXISTS)) |
Does a devicetree node have a property? | |
#define | DT_PHA_HAS_CELL_AT_IDX(node_id, pha, idx, cell) |
Does a phandle array have a named cell specifier at an index? | |
#define | DT_PHA_HAS_CELL(node_id, pha, cell) DT_PHA_HAS_CELL_AT_IDX(node_id, pha, 0, cell) |
Equivalent to DT_PHA_HAS_CELL_AT_IDX(node_id, pha, 0, cell) | |
#define DT_HAS_COMPAT_STATUS_OKAY | ( | compat | ) | IS_ENABLED(DT_CAT(DT_COMPAT_HAS_OKAY_, compat)) |
#include <zephyr/devicetree.h>
Does the devicetree have a status okay
node with a compatible?
Test for whether the devicetree has any nodes with status okay
and the given compatible. That is, this returns 1 if and only if there is at least one node_id
for which both of these expressions return 1:
As usual, both a missing status and an ok
status are treated as okay
.
compat | lowercase-and-underscores compatible, without quotes |
#define DT_NODE_EXISTS | ( | node_id | ) | IS_ENABLED(DT_CAT(node_id, _EXISTS)) |
#include <zephyr/devicetree.h>
Does a node identifier refer to a node?
Tests whether a node identifier refers to a node which exists, i.e. is defined in the devicetree.
It doesn't matter whether or not the node has a matching binding, or what the node's status value is. This is purely a check of whether the node exists at all.
node_id | a node identifier |
#define DT_NODE_HAS_COMPAT | ( | node_id, | |
compat | |||
) | IS_ENABLED(DT_CAT3(node_id, _COMPAT_MATCHES_, compat)) |
#include <zephyr/devicetree.h>
Does a devicetree node match a compatible?
Example devicetree fragment:
Example usages which evaluate to 1:
This macro only uses the value of the compatible property. Whether or not a particular compatible has a matching binding has no effect on its value, nor does the node's status.
node_id | node identifier |
compat | lowercase-and-underscores compatible, without quotes |
compat
, 0 otherwise. #define DT_NODE_HAS_COMPAT_STATUS | ( | node_id, | |
compat, | |||
status | |||
) | DT_NODE_HAS_COMPAT(node_id, compat) && DT_NODE_HAS_STATUS(node_id, status) |
#include <zephyr/devicetree.h>
Does a devicetree node have a compatible and status?
This is equivalent to:
node_id | node identifier |
compat | lowercase-and-underscores compatible, without quotes |
status | okay or disabled as a token, not a string |
#define DT_NODE_HAS_PROP | ( | node_id, | |
prop | |||
) | IS_ENABLED(DT_CAT4(node_id, _P_, prop, _EXISTS)) |
#include <zephyr/devicetree.h>
Does a devicetree node have a property?
Tests whether a devicetree node has a property defined.
This tests whether the property is defined at all, not whether a boolean property is true or false. To get a boolean property's truth value, use DT_PROP(node_id, prop) instead.
node_id | node identifier |
prop | lowercase-and-underscores property name |
#define DT_NODE_HAS_STATUS | ( | node_id, | |
status | |||
) | DT_NODE_HAS_STATUS_INTERNAL(node_id, status) |
#include <zephyr/devicetree.h>
Does a node identifier refer to a node with a status?
Example uses:
Tests whether a node identifier refers to a node which:
ok
status in the devicetree is treated as if it were okay
instead)node_id | a node identifier |
status | a status as one of the tokens okay or disabled, not a string |
#define DT_NUM_INST_STATUS_OKAY | ( | compat | ) |
#include <zephyr/devicetree.h>
Get the number of instances of a given compatible with status okay
compat | lowercase-and-underscores compatible, without quotes |
okay
#define DT_PHA_HAS_CELL | ( | node_id, | |
pha, | |||
cell | |||
) | DT_PHA_HAS_CELL_AT_IDX(node_id, pha, 0, cell) |
#include <zephyr/devicetree.h>
Equivalent to DT_PHA_HAS_CELL_AT_IDX(node_id, pha, 0, cell)
node_id | node identifier |
pha | lowercase-and-underscores property with type phandle-array |
cell | lowercase-and-underscores cell name whose existence to check at index idx |
#define DT_PHA_HAS_CELL_AT_IDX | ( | node_id, | |
pha, | |||
idx, | |||
cell | |||
) |
#include <zephyr/devicetree.h>
Does a phandle array have a named cell specifier at an index?
If this returns 1, then the phandle-array property pha
has a cell named cell
at index idx
, and therefore DT_PHA_BY_IDX(node_id,
pha, idx, cell) is valid. If it returns 0, it's an error to use DT_PHA_BY_IDX() with the same arguments.
node_id | node identifier |
pha | lowercase-and-underscores property with type phandle-array |
idx | index to check within pha |
cell | lowercase-and-underscores cell name whose existence to check at index idx |