Zephyr API Documentation
3.6.99
A Scalable Open Source RTOS
|
Macros | |
#define | DT_NODE_VENDOR_BY_IDX(node_id, idx) DT_CAT3(node_id, _COMPAT_VENDOR_IDX_, idx) |
Get the vendor at index idx as a string literal. | |
#define | DT_NODE_VENDOR_HAS_IDX(node_id, idx) IS_ENABLED(DT_CAT4(node_id, _COMPAT_VENDOR_IDX_, idx, _EXISTS)) |
Does a node's compatible property have a vendor at an index? | |
#define | DT_NODE_VENDOR_BY_IDX_OR(node_id, idx, default_value) |
Like DT_NODE_VENDOR_BY_IDX(), but with a fallback to default_value. | |
#define | DT_NODE_VENDOR_OR(node_id, default_value) DT_NODE_VENDOR_BY_IDX_OR(node_id, 0, default_value) |
Get the node's (only) vendor as a string literal. | |
#define | DT_NODE_MODEL_BY_IDX(node_id, idx) DT_CAT3(node_id, _COMPAT_MODEL_IDX_, idx) |
Get the model at index "idx" as a string literal. | |
#define | DT_NODE_MODEL_HAS_IDX(node_id, idx) IS_ENABLED(DT_CAT4(node_id, _COMPAT_MODEL_IDX_, idx, _EXISTS)) |
Does a node's compatible property have a model at an index? | |
#define | DT_NODE_MODEL_BY_IDX_OR(node_id, idx, default_value) |
Like DT_NODE_MODEL_BY_IDX(), but with a fallback to default_value. | |
#define | DT_NODE_MODEL_OR(node_id, default_value) DT_NODE_MODEL_BY_IDX_OR(node_id, 0, default_value) |
Get the node's (only) model as a string literal. | |
#define DT_NODE_MODEL_BY_IDX | ( | node_id, | |
idx | |||
) | DT_CAT3(node_id, _COMPAT_MODEL_IDX_, idx) |
#include <zephyr/devicetree.h>
Get the model at index "idx" as a string literal.
The model is a string extracted from the compatible after the vendor prefix.
Example vendor-prefixes.txt:
vnd A stand-in for a real vendor zephyr Zephyr-specific binding
Example devicetree fragment:
n1: node-1 { compatible = "vnd,model1", "gpio", "zephyr,model2"; };
Example usage:
DT_NODE_MODEL_BY_IDX(DT_NODELABEL(n1), 0) // "model1" DT_NODE_MODEL_BY_IDX(DT_NODELABEL(n1), 2) // "model2"
Notice that the compatible at index 1 doesn't match any entries in the vendor prefix file and therefore index 1 is not a valid model index. Use DT_NODE_MODEL_HAS_IDX(node_id, idx) to determine if an index is valid.
node_id | node identifier |
idx | index of the model to return |
#define DT_NODE_MODEL_BY_IDX_OR | ( | node_id, | |
idx, | |||
default_value | |||
) |
#include <zephyr/devicetree.h>
Like DT_NODE_MODEL_BY_IDX(), but with a fallback to default_value.
If the value exists, this expands to DT_NODE_MODEL_BY_IDX(node_id, idx). The default_value parameter is not expanded in this case.
Otherwise, this expands to default_value.
node_id | node identifier |
idx | index of the model to return |
default_value | a fallback value to expand to |
#define DT_NODE_MODEL_HAS_IDX | ( | node_id, | |
idx | |||
) | IS_ENABLED(DT_CAT4(node_id, _COMPAT_MODEL_IDX_, idx, _EXISTS)) |
#include <zephyr/devicetree.h>
Does a node's compatible property have a model at an index?
If this returns 1, then DT_NODE_MODEL_BY_IDX(node_id, idx) is valid. If it returns 0, it is an error to use DT_NODE_MODEL_BY_IDX(node_id, idx) with index "idx".
node_id | node identifier |
idx | index of the model to check |
#define DT_NODE_MODEL_OR | ( | node_id, | |
default_value | |||
) | DT_NODE_MODEL_BY_IDX_OR(node_id, 0, default_value) |
#include <zephyr/devicetree.h>
Get the node's (only) model as a string literal.
Equivalent to DT_NODE_MODEL_BY_IDX_OR(node_id, 0, default_value).
node_id | node identifier |
default_value | a fallback value to expand to |
#define DT_NODE_VENDOR_BY_IDX | ( | node_id, | |
idx | |||
) | DT_CAT3(node_id, _COMPAT_VENDOR_IDX_, idx) |
#include <zephyr/devicetree.h>
Get the vendor at index idx
as a string literal.
The vendor is a string extracted from vendor prefixes if an entry exists that matches the node's compatible prefix. There may be as many as one vendor prefixes file per directory in DTS_ROOT.
Example vendor-prefixes.txt:
vnd A stand-in for a real vendor zephyr Zephyr-specific binding
Example devicetree fragment:
Example usage:
Notice that the compatible at index 1 doesn't match any entries in the vendor prefix file and therefore index 1 is not a valid vendor index. Use DT_NODE_VENDOR_HAS_IDX(node_id, idx) to determine if an index is valid.
node_id | node identifier |
idx | index of the vendor to return |
#define DT_NODE_VENDOR_BY_IDX_OR | ( | node_id, | |
idx, | |||
default_value | |||
) |
#include <zephyr/devicetree.h>
Like DT_NODE_VENDOR_BY_IDX(), but with a fallback to default_value.
If the value exists, this expands to DT_NODE_VENDOR_BY_IDX(node_id, idx). The default_value parameter is not expanded in this case.
Otherwise, this expands to default_value.
node_id | node identifier |
idx | index of the vendor to return |
default_value | a fallback value to expand to |
#define DT_NODE_VENDOR_HAS_IDX | ( | node_id, | |
idx | |||
) | IS_ENABLED(DT_CAT4(node_id, _COMPAT_VENDOR_IDX_, idx, _EXISTS)) |
#include <zephyr/devicetree.h>
Does a node's compatible property have a vendor at an index?
If this returns 1, then DT_NODE_VENDOR_BY_IDX(node_id, idx) is valid. If it returns 0, it is an error to use DT_NODE_VENDOR_BY_IDX(node_id, idx) with index idx
.
node_id | node identifier |
idx | index of the vendor to check |
idx
is a valid vendor index, 0 otherwise. #define DT_NODE_VENDOR_OR | ( | node_id, | |
default_value | |||
) | DT_NODE_VENDOR_BY_IDX_OR(node_id, 0, default_value) |
#include <zephyr/devicetree.h>
Get the node's (only) vendor as a string literal.
Equivalent to DT_NODE_VENDOR_BY_IDX_OR(node_id, 0, default_value).
node_id | node identifier |
default_value | a fallback value to expand to |