Zephyr Project API 4.0.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
Instance-based devicetree APIs

Macros

#define DT_DRV_INST(inst)   DT_INST(inst, DT_DRV_COMPAT)
 Node identifier for an instance of a DT_DRV_COMPAT compatible.
 
#define DT_INST_PARENT(inst)   DT_PARENT(DT_DRV_INST(inst))
 Get a DT_DRV_COMPAT parent's node identifier.
 
#define DT_INST_GPARENT(inst)   DT_GPARENT(DT_DRV_INST(inst))
 Get a DT_DRV_COMPAT grandparent's node identifier.
 
#define DT_INST_CHILD(inst, child)    DT_CHILD(DT_DRV_INST(inst), child)
 Get a node identifier for a child node of DT_DRV_INST(inst)
 
#define DT_INST_CHILD_NUM(inst)   DT_CHILD_NUM(DT_DRV_INST(inst))
 Get the number of child nodes of a given node.
 
#define DT_INST_CHILD_NUM_STATUS_OKAY(inst)    DT_CHILD_NUM_STATUS_OKAY(DT_DRV_INST(inst))
 Get the number of child nodes of a given node.
 
#define DT_INST_NODELABEL_STRING_ARRAY(inst)   DT_NODELABEL_STRING_ARRAY(DT_DRV_INST(inst))
 Get a string array of DT_DRV_INST(inst)'s node labels.
 
#define DT_INST_NUM_NODELABELS(inst)   DT_NUM_NODELABELS(DT_DRV_INST(inst))
 Get the number of node labels by instance number.
 
#define DT_INST_FOREACH_CHILD(inst, fn)    DT_FOREACH_CHILD(DT_DRV_INST(inst), fn)
 Call fn on all child nodes of DT_DRV_INST(inst).
 
#define DT_INST_FOREACH_CHILD_SEP(inst, fn, sep)    DT_FOREACH_CHILD_SEP(DT_DRV_INST(inst), fn, sep)
 Call fn on all child nodes of DT_DRV_INST(inst) with a separator.
 
#define DT_INST_FOREACH_CHILD_VARGS(inst, fn, ...)    DT_FOREACH_CHILD_VARGS(DT_DRV_INST(inst), fn, __VA_ARGS__)
 Call fn on all child nodes of DT_DRV_INST(inst).
 
#define DT_INST_FOREACH_CHILD_SEP_VARGS(inst, fn, sep, ...)    DT_FOREACH_CHILD_SEP_VARGS(DT_DRV_INST(inst), fn, sep, __VA_ARGS__)
 Call fn on all child nodes of DT_DRV_INST(inst) with separator.
 
#define DT_INST_FOREACH_CHILD_STATUS_OKAY(inst, fn)    DT_FOREACH_CHILD_STATUS_OKAY(DT_DRV_INST(inst), fn)
 Call fn on all child nodes of DT_DRV_INST(inst) with status okay.
 
#define DT_INST_FOREACH_CHILD_STATUS_OKAY_SEP(inst, fn, sep)    DT_FOREACH_CHILD_STATUS_OKAY_SEP(DT_DRV_INST(inst), fn, sep)
 Call fn on all child nodes of DT_DRV_INST(inst) with status okay and with separator.
 
#define DT_INST_FOREACH_CHILD_STATUS_OKAY_VARGS(inst, fn, ...)    DT_FOREACH_CHILD_STATUS_OKAY_VARGS(DT_DRV_INST(inst), fn, __VA_ARGS__)
 Call fn on all child nodes of DT_DRV_INST(inst) with status okay and multiple arguments.
 
#define DT_INST_FOREACH_CHILD_STATUS_OKAY_SEP_VARGS(inst, fn, sep, ...)    DT_FOREACH_CHILD_STATUS_OKAY_SEP_VARGS(DT_DRV_INST(inst), fn, sep, __VA_ARGS__)
 Call fn on all child nodes of DT_DRV_INST(inst) with status okay and with separator and multiple arguments.
 
#define DT_INST_ENUM_IDX_BY_IDX(inst, prop, idx)    DT_ENUM_IDX_BY_IDX(DT_DRV_INST(inst), prop, idx)
 Get a DT_DRV_COMPAT property array value's index into its enumeration values.
 
#define DT_INST_ENUM_IDX(inst, prop)    DT_ENUM_IDX(DT_DRV_INST(inst), prop)
 Get a DT_DRV_COMPAT value's index into its enumeration values.
 
#define DT_INST_ENUM_IDX_BY_IDX_OR(inst, prop, idx, default_idx_value)    DT_ENUM_IDX_BY_IDX_OR(DT_DRV_INST(inst), prop, idx, default_idx_value)
 Like DT_INST_ENUM_IDX_BY_IDX(), but with a fallback to a default enum index.
 
#define DT_INST_ENUM_IDX_OR(inst, prop, default_idx_value)    DT_ENUM_IDX_OR(DT_DRV_INST(inst), prop, default_idx_value)
 Like DT_INST_ENUM_IDX(), but with a fallback to a default enum index.
 
#define DT_INST_ENUM_HAS_VALUE_BY_IDX(inst, prop, idx, value)    DT_ENUM_HAS_VALUE_BY_IDX(DT_DRV_INST(inst), prop, idx, value)
 Does a DT_DRV_COMPAT enumeration property have a given value by index?
 
#define DT_INST_ENUM_HAS_VALUE(inst, prop, value)    DT_ENUM_HAS_VALUE(DT_DRV_INST(inst), prop, value)
 Does a DT_DRV_COMPAT enumeration property have a given value?
 
#define DT_INST_PROP(inst, prop)   DT_PROP(DT_DRV_INST(inst), prop)
 Get a DT_DRV_COMPAT instance property.
 
#define DT_INST_PROP_LEN(inst, prop)   DT_PROP_LEN(DT_DRV_INST(inst), prop)
 Get a DT_DRV_COMPAT property length.
 
#define DT_INST_PROP_HAS_IDX(inst, prop, idx)    DT_PROP_HAS_IDX(DT_DRV_INST(inst), prop, idx)
 Is index idx valid for an array type property on a DT_DRV_COMPAT instance?
 
#define DT_INST_PROP_HAS_NAME(inst, prop, name)    DT_PROP_HAS_NAME(DT_DRV_INST(inst), prop, name)
 Is name name available in a foo-names property?
 
#define DT_INST_PROP_BY_IDX(inst, prop, idx)    DT_PROP_BY_IDX(DT_DRV_INST(inst), prop, idx)
 Get a DT_DRV_COMPAT element value in an array property.
 
#define DT_INST_PROP_OR(inst, prop, default_value)    DT_PROP_OR(DT_DRV_INST(inst), prop, default_value)
 Like DT_INST_PROP(), but with a fallback to default_value.
 
#define DT_INST_PROP_LEN_OR(inst, prop, default_value)    DT_PROP_LEN_OR(DT_DRV_INST(inst), prop, default_value)
 Like DT_INST_PROP_LEN(), but with a fallback to default_value.
 
#define DT_INST_STRING_TOKEN(inst, prop)    DT_STRING_TOKEN(DT_DRV_INST(inst), prop)
 Get a DT_DRV_COMPAT instance's string property's value as a token.
 
#define DT_INST_STRING_UPPER_TOKEN(inst, prop)    DT_STRING_UPPER_TOKEN(DT_DRV_INST(inst), prop)
 Like DT_INST_STRING_TOKEN(), but uppercased.
 
#define DT_INST_STRING_UNQUOTED(inst, prop)    DT_STRING_UNQUOTED(DT_DRV_INST(inst), prop)
 Get a DT_DRV_COMPAT instance's string property's value as an unquoted sequence of tokens.
 
#define DT_INST_STRING_TOKEN_BY_IDX(inst, prop, idx)    DT_STRING_TOKEN_BY_IDX(DT_DRV_INST(inst), prop, idx)
 Get an element out of string-array property as a token.
 
#define DT_INST_STRING_UPPER_TOKEN_BY_IDX(inst, prop, idx)    DT_STRING_UPPER_TOKEN_BY_IDX(DT_DRV_INST(inst), prop, idx)
 Like DT_INST_STRING_TOKEN_BY_IDX(), but uppercased.
 
#define DT_INST_STRING_UNQUOTED_BY_IDX(inst, prop, idx)    DT_STRING_UNQUOTED_BY_IDX(DT_DRV_INST(inst), prop, idx)
 Get an element out of string-array property as an unquoted sequence of tokens.
 
#define DT_INST_PROP_BY_PHANDLE(inst, ph, prop)    DT_INST_PROP_BY_PHANDLE_IDX(inst, ph, 0, prop)
 Get a DT_DRV_COMPAT instance's property value from a phandle's node.
 
#define DT_INST_PROP_BY_PHANDLE_IDX(inst, phs, idx, prop)    DT_PROP_BY_PHANDLE_IDX(DT_DRV_INST(inst), phs, idx, prop)
 Get a DT_DRV_COMPAT instance's property value from a phandle in a property.
 
#define DT_INST_PHA_BY_IDX(inst, pha, idx, cell)    DT_PHA_BY_IDX(DT_DRV_INST(inst), pha, idx, cell)
 Get a DT_DRV_COMPAT instance's phandle-array specifier value at an index.
 
#define DT_INST_PHA_BY_IDX_OR(inst, pha, idx, cell, default_value)    DT_PHA_BY_IDX_OR(DT_DRV_INST(inst), pha, idx, cell, default_value)
 Like DT_INST_PHA_BY_IDX(), but with a fallback to default_value.
 
#define DT_INST_PHA(inst, pha, cell)   DT_INST_PHA_BY_IDX(inst, pha, 0, cell)
 Get a DT_DRV_COMPAT instance's phandle-array specifier value Equivalent to DT_INST_PHA_BY_IDX(inst, pha, 0, cell)
 
#define DT_INST_PHA_OR(inst, pha, cell, default_value)    DT_INST_PHA_BY_IDX_OR(inst, pha, 0, cell, default_value)
 Like DT_INST_PHA(), but with a fallback to default_value.
 
#define DT_INST_PHA_BY_NAME(inst, pha, name, cell)    DT_PHA_BY_NAME(DT_DRV_INST(inst), pha, name, cell)
 Get a DT_DRV_COMPAT instance's value within a phandle-array specifier by name.
 
#define DT_INST_PHA_BY_NAME_OR(inst, pha, name, cell, default_value)    DT_PHA_BY_NAME_OR(DT_DRV_INST(inst), pha, name, cell, default_value)
 Like DT_INST_PHA_BY_NAME(), but with a fallback to default_value.
 
#define DT_INST_PHANDLE_BY_NAME(inst, pha, name)    DT_PHANDLE_BY_NAME(DT_DRV_INST(inst), pha, name) \
 Get a DT_DRV_COMPAT instance's phandle node identifier from a phandle array by name.
 
#define DT_INST_PHANDLE_BY_IDX(inst, prop, idx)    DT_PHANDLE_BY_IDX(DT_DRV_INST(inst), prop, idx)
 Get a DT_DRV_COMPAT instance's node identifier for a phandle in a property.
 
#define DT_INST_PHANDLE(inst, prop)   DT_INST_PHANDLE_BY_IDX(inst, prop, 0)
 Get a DT_DRV_COMPAT instance's node identifier for a phandle property's value.
 
#define DT_INST_REG_HAS_IDX(inst, idx)   DT_REG_HAS_IDX(DT_DRV_INST(inst), idx)
 is idx a valid register block index on a DT_DRV_COMPAT instance?
 
#define DT_INST_REG_HAS_NAME(inst, name)   DT_REG_HAS_NAME(DT_DRV_INST(inst), name)
 is name a valid register block name on a DT_DRV_COMPAT instance?
 
#define DT_INST_REG_ADDR_BY_IDX_RAW(inst, idx)   DT_REG_ADDR_BY_IDX_RAW(DT_DRV_INST(inst), idx)
 Get a DT_DRV_COMPAT instance's idx-th register block's raw address.
 
#define DT_INST_REG_ADDR_BY_IDX(inst, idx)   DT_REG_ADDR_BY_IDX(DT_DRV_INST(inst), idx)
 Get a DT_DRV_COMPAT instance's idx-th register block's address.
 
#define DT_INST_REG_SIZE_BY_IDX(inst, idx)    DT_REG_SIZE_BY_IDX(DT_DRV_INST(inst), idx)
 Get a DT_DRV_COMPAT instance's idx-th register block's size.
 
#define DT_INST_REG_ADDR_BY_NAME(inst, name)    DT_REG_ADDR_BY_NAME(DT_DRV_INST(inst), name)
 Get a DT_DRV_COMPAT's register block address by name.
 
#define DT_INST_REG_ADDR_BY_NAME_OR(inst, name, default_value)    DT_REG_ADDR_BY_NAME_OR(DT_DRV_INST(inst), name, default_value)
 Like DT_INST_REG_ADDR_BY_NAME(), but with a fallback to default_value.
 
#define DT_INST_REG_ADDR_BY_NAME_U64(inst, name)    DT_REG_ADDR_BY_NAME_U64(DT_DRV_INST(inst), name)
 64-bit version of DT_INST_REG_ADDR_BY_NAME()
 
#define DT_INST_REG_SIZE_BY_NAME(inst, name)    DT_REG_SIZE_BY_NAME(DT_DRV_INST(inst), name)
 Get a DT_DRV_COMPAT's register block size by name.
 
#define DT_INST_REG_SIZE_BY_NAME_OR(inst, name, default_value)    DT_REG_SIZE_BY_NAME_OR(DT_DRV_INST(inst), name, default_value)
 Like DT_INST_REG_SIZE_BY_NAME(), but with a fallback to default_value.
 
#define DT_INST_REG_ADDR_RAW(inst)   DT_INST_REG_ADDR_BY_IDX_RAW(inst, 0)
 Get a DT_DRV_COMPAT's (only) register block raw address.
 
#define DT_INST_REG_ADDR(inst)   DT_INST_REG_ADDR_BY_IDX(inst, 0)
 Get a DT_DRV_COMPAT's (only) register block address.
 
#define DT_INST_REG_ADDR_U64(inst)   DT_REG_ADDR_U64(DT_DRV_INST(inst))
 64-bit version of DT_INST_REG_ADDR()
 
#define DT_INST_REG_SIZE(inst)   DT_INST_REG_SIZE_BY_IDX(inst, 0)
 Get a DT_DRV_COMPAT's (only) register block size.
 
#define DT_INST_NUM_IRQS(inst)   DT_NUM_IRQS(DT_DRV_INST(inst))
 Get a DT_DRV_COMPAT's number of interrupts.
 
#define DT_INST_IRQ_LEVEL(inst)   DT_IRQ_LEVEL(DT_DRV_INST(inst))
 Get a DT_DRV_COMPAT interrupt level.
 
#define DT_INST_IRQ_BY_IDX(inst, idx, cell)    DT_IRQ_BY_IDX(DT_DRV_INST(inst), idx, cell)
 Get a DT_DRV_COMPAT interrupt specifier value at an index.
 
#define DT_INST_IRQ_INTC_BY_IDX(inst, idx)    DT_IRQ_INTC_BY_IDX(DT_DRV_INST(inst), idx)
 Get a DT_DRV_COMPAT interrupt specifier's interrupt controller by index.
 
#define DT_INST_IRQ_INTC_BY_NAME(inst, name)    DT_IRQ_INTC_BY_NAME(DT_DRV_INST(inst), name)
 Get a DT_DRV_COMPAT interrupt specifier's interrupt controller by name.
 
#define DT_INST_IRQ_INTC(inst)    DT_INST_IRQ_INTC_BY_IDX(inst, 0)
 Get a DT_DRV_COMPAT interrupt specifier's interrupt controller.
 
#define DT_INST_IRQ_BY_NAME(inst, name, cell)    DT_IRQ_BY_NAME(DT_DRV_INST(inst), name, cell)
 Get a DT_DRV_COMPAT interrupt specifier value by name.
 
#define DT_INST_IRQ(inst, cell)   DT_INST_IRQ_BY_IDX(inst, 0, cell)
 Get a DT_DRV_COMPAT interrupt specifier's value.
 
#define DT_INST_IRQN(inst)   DT_IRQN(DT_DRV_INST(inst))
 Get a DT_DRV_COMPAT's (only) irq number.
 
#define DT_INST_IRQN_BY_IDX(inst, idx)   DT_IRQN_BY_IDX(DT_DRV_INST(inst), idx)
 Get a DT_DRV_COMPAT's irq number at index.
 
#define DT_INST_BUS(inst)   DT_BUS(DT_DRV_INST(inst))
 Get a DT_DRV_COMPAT's bus node identifier.
 
#define DT_INST_ON_BUS(inst, bus)   DT_ON_BUS(DT_DRV_INST(inst), bus)
 Test if a DT_DRV_COMPAT's bus type is a given type.
 
#define DT_INST_STRING_TOKEN_OR(inst, name, default_value)    DT_STRING_TOKEN_OR(DT_DRV_INST(inst), name, default_value)
 Like DT_INST_STRING_TOKEN(), but with a fallback to default_value.
 
#define DT_INST_STRING_UPPER_TOKEN_OR(inst, name, default_value)    DT_STRING_UPPER_TOKEN_OR(DT_DRV_INST(inst), name, default_value)
 Like DT_INST_STRING_UPPER_TOKEN(), but with a fallback to default_value.
 
#define DT_INST_STRING_UNQUOTED_OR(inst, name, default_value)    DT_STRING_UNQUOTED_OR(DT_DRV_INST(inst), name, default_value)
 Like DT_INST_STRING_UNQUOTED(), but with a fallback to default_value.
 
#define DT_HAS_COMPAT_ON_BUS_STATUS_OKAY(compat, bus)    IS_ENABLED(DT_CAT4(DT_COMPAT_, compat, _BUS_, bus))
 
#define DT_ANY_INST_ON_BUS_STATUS_OKAY(bus)    DT_HAS_COMPAT_ON_BUS_STATUS_OKAY(DT_DRV_COMPAT, bus)
 Test if any DT_DRV_COMPAT node is on a bus of a given type and has status okay.
 
#define DT_ANY_INST_HAS_PROP_STATUS_OKAY(prop)    COND_CODE_1(IS_EMPTY(DT_ANY_INST_HAS_PROP_STATUS_OKAY_(prop)), (0), (1))
 Check if any DT_DRV_COMPAT node with status okay has a given property.
 
#define DT_ANY_COMPAT_HAS_PROP_STATUS_OKAY(compat, prop)    (DT_COMPAT_FOREACH_STATUS_OKAY_VARGS(compat, DT_COMPAT_NODE_HAS_PROP_AND_OR, prop) 0)
 Check if any device node with status okay has a given property.
 
#define DT_INST_FOREACH_STATUS_OKAY(fn)
 Call fn on all nodes with compatible DT_DRV_COMPAT and status okay
 
#define DT_INST_FOREACH_STATUS_OKAY_VARGS(fn, ...)
 Call fn on all nodes with compatible DT_DRV_COMPAT and status okay with multiple arguments.
 
#define DT_INST_FOREACH_NODELABEL(inst, fn)    DT_FOREACH_NODELABEL(DT_DRV_INST(inst), fn)
 Call fn on all node labels for a given DT_DRV_COMPAT instance.
 
#define DT_INST_FOREACH_NODELABEL_VARGS(inst, fn, ...)    DT_FOREACH_NODELABEL_VARGS(DT_DRV_INST(inst), fn, __VA_ARGS__)
 Call fn on all node labels for a given DT_DRV_COMPAT instance with multiple arguments.
 
#define DT_INST_FOREACH_PROP_ELEM(inst, prop, fn)    DT_FOREACH_PROP_ELEM(DT_DRV_INST(inst), prop, fn)
 Invokes fn for each element of property prop for a DT_DRV_COMPAT instance.
 
#define DT_INST_FOREACH_PROP_ELEM_SEP(inst, prop, fn, sep)    DT_FOREACH_PROP_ELEM_SEP(DT_DRV_INST(inst), prop, fn, sep)
 Invokes fn for each element of property prop for a DT_DRV_COMPAT instance with a separator.
 
#define DT_INST_FOREACH_PROP_ELEM_VARGS(inst, prop, fn, ...)    DT_FOREACH_PROP_ELEM_VARGS(DT_DRV_INST(inst), prop, fn, __VA_ARGS__)
 Invokes fn for each element of property prop for a DT_DRV_COMPAT instance with multiple arguments.
 
#define DT_INST_FOREACH_PROP_ELEM_SEP_VARGS(inst, prop, fn, sep, ...)
 Invokes fn for each element of property prop for a DT_DRV_COMPAT instance with multiple arguments and a separator.
 
#define DT_INST_NODE_HAS_PROP(inst, prop)    DT_NODE_HAS_PROP(DT_DRV_INST(inst), prop)
 Does a DT_DRV_COMPAT instance have a property?
 
#define DT_INST_NODE_HAS_COMPAT(inst, compat)    DT_NODE_HAS_COMPAT(DT_DRV_INST(inst), compat)
 Does a DT_DRV_COMPAT instance have the compatible?
 
#define DT_INST_PHA_HAS_CELL_AT_IDX(inst, pha, idx, cell)    DT_PHA_HAS_CELL_AT_IDX(DT_DRV_INST(inst), pha, idx, cell)
 Does a phandle array have a named cell specifier at an index for a DT_DRV_COMPAT instance?
 
#define DT_INST_PHA_HAS_CELL(inst, pha, cell)    DT_INST_PHA_HAS_CELL_AT_IDX(inst, pha, 0, cell)
 Does a phandle array have a named cell specifier at index 0 for a DT_DRV_COMPAT instance?
 
#define DT_INST_IRQ_HAS_IDX(inst, idx)   DT_IRQ_HAS_IDX(DT_DRV_INST(inst), idx)
 is index valid for interrupt property on a DT_DRV_COMPAT instance?
 
#define DT_INST_IRQ_HAS_CELL_AT_IDX(inst, idx, cell)    DT_IRQ_HAS_CELL_AT_IDX(DT_DRV_INST(inst), idx, cell)
 Does a DT_DRV_COMPAT instance have an interrupt named cell specifier?
 
#define DT_INST_IRQ_HAS_CELL(inst, cell)    DT_INST_IRQ_HAS_CELL_AT_IDX(inst, 0, cell)
 Does a DT_DRV_COMPAT instance have an interrupt value?
 
#define DT_INST_IRQ_HAS_NAME(inst, name)    DT_IRQ_HAS_NAME(DT_DRV_INST(inst), name)
 Does a DT_DRV_COMPAT instance have an interrupt value?
 

Detailed Description

Macro Definition Documentation

◆ DT_ANY_COMPAT_HAS_PROP_STATUS_OKAY

#define DT_ANY_COMPAT_HAS_PROP_STATUS_OKAY (   compat,
  prop 
)     (DT_COMPAT_FOREACH_STATUS_OKAY_VARGS(compat, DT_COMPAT_NODE_HAS_PROP_AND_OR, prop) 0)

#include <include/zephyr/devicetree.h>

Check if any device node with status okay has a given property.

Parameters
compatlowercase-and-underscores devicetree compatible
proplowercase-and-underscores property name

Example devicetree overlay:

&i2c0 {
sensor0: sensor@0 {
compatible = "vnd,some-sensor";
status = "okay";
reg = <0>;
foo = <1>;
bar = <2>;
};
sensor1: sensor@1 {
compatible = "vnd,some-sensor";
status = "okay";
reg = <1>;
foo = <2>;
};
sensor2: sensor@2 {
compatible = "vnd,some-sensor";
status = "disabled";
reg = <2>;
baz = <1>;
};
};

Example usage:

DT_ANY_COMPAT_HAS_PROP_STATUS_OKAY(vnd_some_sensor, foo) // 1
DT_ANY_COMPAT_HAS_PROP_STATUS_OKAY(vnd_some_sensor, bar) // 1
DT_ANY_COMPAT_HAS_PROP_STATUS_OKAY(vnd_some_sensor, baz) // 0
#define DT_ANY_COMPAT_HAS_PROP_STATUS_OKAY(compat, prop)
Check if any device node with status okay has a given property.
Definition devicetree.h:4760

◆ DT_ANY_INST_HAS_PROP_STATUS_OKAY

#define DT_ANY_INST_HAS_PROP_STATUS_OKAY (   prop)     COND_CODE_1(IS_EMPTY(DT_ANY_INST_HAS_PROP_STATUS_OKAY_(prop)), (0), (1))

#include <include/zephyr/devicetree.h>

Check if any DT_DRV_COMPAT node with status okay has a given property.

Parameters
proplowercase-and-underscores property name

Example devicetree overlay:

&i2c0 {
sensor0: sensor@0 {
compatible = "vnd,some-sensor";
status = "okay";
reg = <0>;
foo = <1>;
bar = <2>;
};
sensor1: sensor@1 {
compatible = "vnd,some-sensor";
status = "okay";
reg = <1>;
foo = <2>;
};
sensor2: sensor@2 {
compatible = "vnd,some-sensor";
status = "disabled";
reg = <2>;
baz = <1>;
};
};

Example usage:

#define DT_DRV_COMPAT vnd_some_sensor
#define DT_ANY_INST_HAS_PROP_STATUS_OKAY(prop)
Check if any DT_DRV_COMPAT node with status okay has a given property.
Definition devicetree.h:4713

◆ DT_ANY_INST_ON_BUS_STATUS_OKAY

#define DT_ANY_INST_ON_BUS_STATUS_OKAY (   bus)     DT_HAS_COMPAT_ON_BUS_STATUS_OKAY(DT_DRV_COMPAT, bus)

#include <include/zephyr/devicetree.h>

Test if any DT_DRV_COMPAT node is on a bus of a given type and has status okay.

This is a special-purpose macro which can be useful when writing drivers for devices which can appear on multiple buses. One example is a sensor device which may be wired on an I2C or SPI bus.

Example devicetree overlay:

&i2c0 {
temp: temperature-sensor@76 {
compatible = "vnd,some-sensor";
reg = <0x76>;
};
};

Example usage, assuming i2c0 is an I2C bus controller node, and therefore temp is on an I2C bus:

#define DT_DRV_COMPAT vnd_some_sensor
#define DT_ANY_INST_ON_BUS_STATUS_OKAY(bus)
Test if any DT_DRV_COMPAT node is on a bus of a given type and has status okay.
Definition devicetree.h:4666
Parameters
busa binding's bus type as a C token, lowercased and without quotes
Returns
1 if any enabled node with that compatible is on that bus type, 0 otherwise

◆ DT_DRV_INST

#define DT_DRV_INST (   inst)    DT_INST(inst, DT_DRV_COMPAT)

#include <include/zephyr/devicetree.h>

Node identifier for an instance of a DT_DRV_COMPAT compatible.

Parameters
instinstance number
Returns
a node identifier for the node with DT_DRV_COMPAT compatible and instance number inst

◆ DT_HAS_COMPAT_ON_BUS_STATUS_OKAY

#define DT_HAS_COMPAT_ON_BUS_STATUS_OKAY (   compat,
  bus 
)     IS_ENABLED(DT_CAT4(DT_COMPAT_, compat, _BUS_, bus))

◆ DT_INST_BUS

#define DT_INST_BUS (   inst)    DT_BUS(DT_DRV_INST(inst))

#include <include/zephyr/devicetree.h>

Get a DT_DRV_COMPAT's bus node identifier.

Parameters
instinstance number
Returns
node identifier for the instance's bus node

◆ DT_INST_CHILD

#define DT_INST_CHILD (   inst,
  child 
)     DT_CHILD(DT_DRV_INST(inst), child)

#include <include/zephyr/devicetree.h>

Get a node identifier for a child node of DT_DRV_INST(inst)

Parameters
instinstance number
childlowercase-and-underscores child node name
Returns
node identifier for the node with the name referred to by 'child'
See also
DT_CHILD

◆ DT_INST_CHILD_NUM

#define DT_INST_CHILD_NUM (   inst)    DT_CHILD_NUM(DT_DRV_INST(inst))

#include <include/zephyr/devicetree.h>

Get the number of child nodes of a given node.

This is equivalent to

See also
DT_CHILD_NUM(DT_DRV_INST(inst)).
Parameters
instDevicetree instance number
Returns
Number of child nodes

◆ DT_INST_CHILD_NUM_STATUS_OKAY

#define DT_INST_CHILD_NUM_STATUS_OKAY (   inst)     DT_CHILD_NUM_STATUS_OKAY(DT_DRV_INST(inst))

#include <include/zephyr/devicetree.h>

Get the number of child nodes of a given node.

This is equivalent to

See also
DT_CHILD_NUM_STATUS_OKAY(DT_DRV_INST(inst)).
Parameters
instDevicetree instance number
Returns
Number of child nodes which status are okay

◆ DT_INST_ENUM_HAS_VALUE

#define DT_INST_ENUM_HAS_VALUE (   inst,
  prop,
  value 
)     DT_ENUM_HAS_VALUE(DT_DRV_INST(inst), prop, value)

#include <include/zephyr/devicetree.h>

Does a DT_DRV_COMPAT enumeration property have a given value?

Parameters
instinstance number
proplowercase-and-underscores property name
valuelowercase-and-underscores enumeration value
Returns
1 if the node property has the value value, 0 otherwise.

◆ DT_INST_ENUM_HAS_VALUE_BY_IDX

#define DT_INST_ENUM_HAS_VALUE_BY_IDX (   inst,
  prop,
  idx,
  value 
)     DT_ENUM_HAS_VALUE_BY_IDX(DT_DRV_INST(inst), prop, idx, value)

#include <include/zephyr/devicetree.h>

Does a DT_DRV_COMPAT enumeration property have a given value by index?

Parameters
instinstance number
proplowercase-and-underscores property name
idxthe index to get
valuelowercase-and-underscores enumeration value
Returns
zero-based index of the property's value in its enum

◆ DT_INST_ENUM_IDX

#define DT_INST_ENUM_IDX (   inst,
  prop 
)     DT_ENUM_IDX(DT_DRV_INST(inst), prop)

#include <include/zephyr/devicetree.h>

Get a DT_DRV_COMPAT value's index into its enumeration values.

Parameters
instinstance number
proplowercase-and-underscores property name
Returns
zero-based index of the property's value in its enum: list

◆ DT_INST_ENUM_IDX_BY_IDX

#define DT_INST_ENUM_IDX_BY_IDX (   inst,
  prop,
  idx 
)     DT_ENUM_IDX_BY_IDX(DT_DRV_INST(inst), prop, idx)

#include <include/zephyr/devicetree.h>

Get a DT_DRV_COMPAT property array value's index into its enumeration values.

Parameters
instinstance number
proplowercase-and-underscores property name
idxthe index to get
Returns
zero-based index of the property's value in its enum: list

◆ DT_INST_ENUM_IDX_BY_IDX_OR

#define DT_INST_ENUM_IDX_BY_IDX_OR (   inst,
  prop,
  idx,
  default_idx_value 
)     DT_ENUM_IDX_BY_IDX_OR(DT_DRV_INST(inst), prop, idx, default_idx_value)

#include <include/zephyr/devicetree.h>

Like DT_INST_ENUM_IDX_BY_IDX(), but with a fallback to a default enum index.

Parameters
instinstance number
proplowercase-and-underscores property name
idxthe index to get
default_idx_valuea fallback index value to expand to
Returns
zero-based index of the property's value in its enum if present, default_idx_value otherwise

◆ DT_INST_ENUM_IDX_OR

#define DT_INST_ENUM_IDX_OR (   inst,
  prop,
  default_idx_value 
)     DT_ENUM_IDX_OR(DT_DRV_INST(inst), prop, default_idx_value)

#include <include/zephyr/devicetree.h>

Like DT_INST_ENUM_IDX(), but with a fallback to a default enum index.

Parameters
instinstance number
proplowercase-and-underscores property name
default_idx_valuea fallback index value to expand to
Returns
zero-based index of the property's value in its enum if present, default_idx_value otherwise

◆ DT_INST_FOREACH_CHILD

#define DT_INST_FOREACH_CHILD (   inst,
  fn 
)     DT_FOREACH_CHILD(DT_DRV_INST(inst), fn)

#include <include/zephyr/devicetree.h>

Call fn on all child nodes of DT_DRV_INST(inst).

The macro fn should take one argument, which is the node identifier for the child node.

The children will be iterated over in the same order as they appear in the final devicetree.

Parameters
instinstance number
fnmacro to invoke on each child node identifier
See also
DT_FOREACH_CHILD

◆ DT_INST_FOREACH_CHILD_SEP

#define DT_INST_FOREACH_CHILD_SEP (   inst,
  fn,
  sep 
)     DT_FOREACH_CHILD_SEP(DT_DRV_INST(inst), fn, sep)

#include <include/zephyr/devicetree.h>

Call fn on all child nodes of DT_DRV_INST(inst) with a separator.

The macro fn should take one argument, which is the node identifier for the child node.

Parameters
instinstance number
fnmacro to invoke on each child node identifier
sepSeparator (e.g. comma or semicolon). Must be in parentheses; this is required to enable providing a comma as separator.
See also
DT_FOREACH_CHILD_SEP

◆ DT_INST_FOREACH_CHILD_SEP_VARGS

#define DT_INST_FOREACH_CHILD_SEP_VARGS (   inst,
  fn,
  sep,
  ... 
)     DT_FOREACH_CHILD_SEP_VARGS(DT_DRV_INST(inst), fn, sep, __VA_ARGS__)

#include <include/zephyr/devicetree.h>

Call fn on all child nodes of DT_DRV_INST(inst) with separator.

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.

Parameters
instinstance number
fnmacro to invoke on each child node identifier
sepSeparator (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
See also
DT_FOREACH_CHILD_SEP_VARGS

◆ DT_INST_FOREACH_CHILD_STATUS_OKAY

#define DT_INST_FOREACH_CHILD_STATUS_OKAY (   inst,
  fn 
)     DT_FOREACH_CHILD_STATUS_OKAY(DT_DRV_INST(inst), fn)

#include <include/zephyr/devicetree.h>

Call fn on all child nodes of DT_DRV_INST(inst) with status okay.

The macro fn should take one argument, which is the node identifier for the child node.

Parameters
instinstance number
fnmacro to invoke on each child node identifier
See also
DT_FOREACH_CHILD_STATUS_OKAY

◆ DT_INST_FOREACH_CHILD_STATUS_OKAY_SEP

#define DT_INST_FOREACH_CHILD_STATUS_OKAY_SEP (   inst,
  fn,
  sep 
)     DT_FOREACH_CHILD_STATUS_OKAY_SEP(DT_DRV_INST(inst), fn, sep)

#include <include/zephyr/devicetree.h>

Call fn on all child nodes of DT_DRV_INST(inst) with status okay and with separator.

The macro fn should take one argument, which is the node identifier for the child node.

Parameters
instinstance number
fnmacro to invoke on each child node identifier
sepSeparator (e.g. comma or semicolon). Must be in parentheses; this is required to enable providing a comma as separator.
See also
DT_FOREACH_CHILD_STATUS_OKAY_SEP

◆ DT_INST_FOREACH_CHILD_STATUS_OKAY_SEP_VARGS

#define DT_INST_FOREACH_CHILD_STATUS_OKAY_SEP_VARGS (   inst,
  fn,
  sep,
  ... 
)     DT_FOREACH_CHILD_STATUS_OKAY_SEP_VARGS(DT_DRV_INST(inst), fn, sep, __VA_ARGS__)

#include <include/zephyr/devicetree.h>

Call fn on all child nodes of DT_DRV_INST(inst) with status okay and 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.

Parameters
instinstance number
fnmacro to invoke on each child node identifier
sepSeparator (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
See also
DT_FOREACH_CHILD_STATUS_OKAY_SEP_VARGS

◆ DT_INST_FOREACH_CHILD_STATUS_OKAY_VARGS

#define DT_INST_FOREACH_CHILD_STATUS_OKAY_VARGS (   inst,
  fn,
  ... 
)     DT_FOREACH_CHILD_STATUS_OKAY_VARGS(DT_DRV_INST(inst), fn, __VA_ARGS__)

#include <include/zephyr/devicetree.h>

Call fn on all child nodes of DT_DRV_INST(inst) with status okay 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.

Parameters
instinstance number
fnmacro to invoke on each child node identifier
...variable number of arguments to pass to fn
See also
DT_FOREACH_CHILD_STATUS_OKAY_VARGS

◆ DT_INST_FOREACH_CHILD_VARGS

#define DT_INST_FOREACH_CHILD_VARGS (   inst,
  fn,
  ... 
)     DT_FOREACH_CHILD_VARGS(DT_DRV_INST(inst), fn, __VA_ARGS__)

#include <include/zephyr/devicetree.h>

Call fn on all child nodes of DT_DRV_INST(inst).

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.

Parameters
instinstance number
fnmacro to invoke on each child node identifier
...variable number of arguments to pass to fn
See also
DT_FOREACH_CHILD

◆ DT_INST_FOREACH_NODELABEL

#define DT_INST_FOREACH_NODELABEL (   inst,
  fn 
)     DT_FOREACH_NODELABEL(DT_DRV_INST(inst), fn)

#include <include/zephyr/devicetree.h>

Call fn on all node labels for a given DT_DRV_COMPAT instance.

Equivalent to DT_FOREACH_NODELABEL(DT_DRV_INST(inst), fn).

Parameters
instinstance number
fnmacro which will be passed each node label for the node with that instance number

◆ DT_INST_FOREACH_NODELABEL_VARGS

#define DT_INST_FOREACH_NODELABEL_VARGS (   inst,
  fn,
  ... 
)     DT_FOREACH_NODELABEL_VARGS(DT_DRV_INST(inst), fn, __VA_ARGS__)

#include <include/zephyr/devicetree.h>

Call fn on all node labels for a given DT_DRV_COMPAT instance with multiple arguments.

Equivalent to DT_FOREACH_NODELABEL_VARGS(DT_DRV_INST(inst), fn, ...).

Parameters
instinstance number
fnmacro which will be passed each node label for the node with that instance number
...additional arguments to pass to fn

◆ DT_INST_FOREACH_PROP_ELEM

#define DT_INST_FOREACH_PROP_ELEM (   inst,
  prop,
  fn 
)     DT_FOREACH_PROP_ELEM(DT_DRV_INST(inst), prop, fn)

#include <include/zephyr/devicetree.h>

Invokes fn for each element of property prop for a DT_DRV_COMPAT instance.

Equivalent to DT_FOREACH_PROP_ELEM(DT_DRV_INST(inst), prop, fn).

Parameters
instinstance number
proplowercase-and-underscores property name
fnmacro to invoke

◆ DT_INST_FOREACH_PROP_ELEM_SEP

#define DT_INST_FOREACH_PROP_ELEM_SEP (   inst,
  prop,
  fn,
  sep 
)     DT_FOREACH_PROP_ELEM_SEP(DT_DRV_INST(inst), prop, fn, sep)

#include <include/zephyr/devicetree.h>

Invokes fn for each element of property prop for a DT_DRV_COMPAT instance with a separator.

Equivalent to DT_FOREACH_PROP_ELEM_SEP(DT_DRV_INST(inst), prop, fn, sep).

Parameters
instinstance number
proplowercase-and-underscores property name
fnmacro to invoke
sepSeparator (e.g. comma or semicolon). Must be in parentheses; this is required to enable providing a comma as separator.

◆ DT_INST_FOREACH_PROP_ELEM_SEP_VARGS

#define DT_INST_FOREACH_PROP_ELEM_SEP_VARGS (   inst,
  prop,
  fn,
  sep,
  ... 
)

#include <include/zephyr/devicetree.h>

Value:
__VA_ARGS__)
#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.
Definition devicetree.h:3302
#define DT_DRV_INST(inst)
Node identifier for an instance of a DT_DRV_COMPAT compatible.
Definition devicetree.h:3802

Invokes fn for each element of property prop for a DT_DRV_COMPAT instance with multiple arguments and a separator.

Equivalent to DT_FOREACH_PROP_ELEM_SEP_VARGS(DT_DRV_INST(inst), prop, fn, sep, VA_ARGS)

Parameters
instinstance number
proplowercase-and-underscores property name
fnmacro to invoke
sepSeparator (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
See also
DT_INST_FOREACH_PROP_ELEM

◆ DT_INST_FOREACH_PROP_ELEM_VARGS

#define DT_INST_FOREACH_PROP_ELEM_VARGS (   inst,
  prop,
  fn,
  ... 
)     DT_FOREACH_PROP_ELEM_VARGS(DT_DRV_INST(inst), prop, fn, __VA_ARGS__)

#include <include/zephyr/devicetree.h>

Invokes fn for each element of property prop for a DT_DRV_COMPAT instance with multiple arguments.

Equivalent to DT_FOREACH_PROP_ELEM_VARGS(DT_DRV_INST(inst), prop, fn, VA_ARGS)

Parameters
instinstance number
proplowercase-and-underscores property name
fnmacro to invoke
...variable number of arguments to pass to fn
See also
DT_INST_FOREACH_PROP_ELEM

◆ DT_INST_FOREACH_STATUS_OKAY

#define DT_INST_FOREACH_STATUS_OKAY (   fn)

#include <include/zephyr/devicetree.h>

Value:
(UTIL_CAT(DT_FOREACH_OKAY_INST_, \
DT_DRV_COMPAT)(fn)), \
())
#define DT_HAS_COMPAT_STATUS_OKAY(compat)
Does the devicetree have a status okay node with a compatible?
Definition devicetree.h:3604
#define COND_CODE_1(_flag, _if_1_code, _else_code)
Insert code depending on whether _flag expands to 1 or not.
Definition util_macro.h:195
#define UTIL_CAT(a,...)
Definition util_internal.h:104

Call fn on all nodes with compatible DT_DRV_COMPAT and status okay

This macro calls fn(inst) on each inst number that refers to a node with status okay. Whitespace is added between invocations.

Example devicetree fragment:

a {
compatible = "vnd,device";
status = "okay";
foobar = "DEV_A";
};
b {
compatible = "vnd,device";
status = "okay";
foobar = "DEV_B";
};
c {
compatible = "vnd,device";
status = "disabled";
foobar = "DEV_C";
};

Example usage:

#define DT_DRV_COMPAT vnd_device
#define MY_FN(inst) DT_INST_PROP(inst, foobar),
#define DT_INST_FOREACH_STATUS_OKAY(fn)
Call fn on all nodes with compatible DT_DRV_COMPAT and status okay
Definition devicetree.h:4828

This expands to:

MY_FN(0) MY_FN(1)

and from there, to either this:

"DEV_A", "DEV_B",

or this:

"DEV_B", "DEV_A",

No guarantees are made about the order that a and b appear in the expansion.

Note that fn is responsible for adding commas, semicolons, or other separators or terminators.

Device drivers should use this macro whenever possible to instantiate a struct device for each enabled node in the devicetree of the driver's compatible DT_DRV_COMPAT.

Parameters
fnMacro to call for each enabled node. Must accept an instance number as its only parameter.

◆ DT_INST_FOREACH_STATUS_OKAY_VARGS

#define DT_INST_FOREACH_STATUS_OKAY_VARGS (   fn,
  ... 
)

#include <include/zephyr/devicetree.h>

Value:
(UTIL_CAT(DT_FOREACH_OKAY_INST_VARGS_, \
DT_DRV_COMPAT)(fn, __VA_ARGS__)), \
())

Call fn on all nodes with compatible DT_DRV_COMPAT and status okay with multiple arguments.

Parameters
fnMacro to call for each enabled node. Must accept an instance number.
...variable number of arguments to pass to fn
See also
DT_INST_FOREACH_STATUS_OKAY
DT_COMPAT_FOREACH_STATUS_OKAY_VARGS

◆ DT_INST_GPARENT

#define DT_INST_GPARENT (   inst)    DT_GPARENT(DT_DRV_INST(inst))

#include <include/zephyr/devicetree.h>

Get a DT_DRV_COMPAT grandparent's node identifier.

Parameters
instinstance number
Returns
a node identifier for the instance's grandparent
See also
DT_GPARENT

◆ DT_INST_IRQ

#define DT_INST_IRQ (   inst,
  cell 
)    DT_INST_IRQ_BY_IDX(inst, 0, cell)

#include <include/zephyr/devicetree.h>

Get a DT_DRV_COMPAT interrupt specifier's value.

Parameters
instinstance number
cellcell name specifier
Returns
the named value at that index

◆ DT_INST_IRQ_BY_IDX

#define DT_INST_IRQ_BY_IDX (   inst,
  idx,
  cell 
)     DT_IRQ_BY_IDX(DT_DRV_INST(inst), idx, cell)

#include <include/zephyr/devicetree.h>

Get a DT_DRV_COMPAT interrupt specifier value at an index.

Parameters
instinstance number
idxlogical index into the interrupt specifier array
cellcell name specifier
Returns
the named value at the specifier given by the index

◆ DT_INST_IRQ_BY_NAME

#define DT_INST_IRQ_BY_NAME (   inst,
  name,
  cell 
)     DT_IRQ_BY_NAME(DT_DRV_INST(inst), name, cell)

#include <include/zephyr/devicetree.h>

Get a DT_DRV_COMPAT interrupt specifier value by name.

Parameters
instinstance number
namelowercase-and-underscores interrupt specifier name
cellcell name specifier
Returns
the named value at the specifier given by the index

◆ DT_INST_IRQ_HAS_CELL

#define DT_INST_IRQ_HAS_CELL (   inst,
  cell 
)     DT_INST_IRQ_HAS_CELL_AT_IDX(inst, 0, cell)

#include <include/zephyr/devicetree.h>

Does a DT_DRV_COMPAT instance have an interrupt value?

Parameters
instinstance number
cellnamed cell value whose existence to check
Returns
1 if the named cell exists in the interrupt specifier at index 0 0 otherwise.

◆ DT_INST_IRQ_HAS_CELL_AT_IDX

#define DT_INST_IRQ_HAS_CELL_AT_IDX (   inst,
  idx,
  cell 
)     DT_IRQ_HAS_CELL_AT_IDX(DT_DRV_INST(inst), idx, cell)

#include <include/zephyr/devicetree.h>

Does a DT_DRV_COMPAT instance have an interrupt named cell specifier?

Parameters
instinstance number
idxindex to check
cellnamed cell value whose existence to check
Returns
1 if the named cell exists in the interrupt specifier at index idx 0 otherwise.

◆ DT_INST_IRQ_HAS_IDX

#define DT_INST_IRQ_HAS_IDX (   inst,
  idx 
)    DT_IRQ_HAS_IDX(DT_DRV_INST(inst), idx)

#include <include/zephyr/devicetree.h>

is index valid for interrupt property on a DT_DRV_COMPAT instance?

Parameters
instinstance number
idxlogical index into the interrupt specifier array
Returns
1 if the idx is valid for the interrupt property 0 otherwise.

◆ DT_INST_IRQ_HAS_NAME

#define DT_INST_IRQ_HAS_NAME (   inst,
  name 
)     DT_IRQ_HAS_NAME(DT_DRV_INST(inst), name)

#include <include/zephyr/devicetree.h>

Does a DT_DRV_COMPAT instance have an interrupt value?

Parameters
instinstance number
namelowercase-and-underscores interrupt specifier name
Returns
1 if name is a valid named specifier

◆ DT_INST_IRQ_INTC

#define DT_INST_IRQ_INTC (   inst)     DT_INST_IRQ_INTC_BY_IDX(inst, 0)

#include <include/zephyr/devicetree.h>

Get a DT_DRV_COMPAT interrupt specifier's interrupt controller.

Note
Equivalent to DT_INST_IRQ_INTC_BY_IDX(node_id, 0)
Parameters
instinstance number
Returns
node_id of interrupt specifier's interrupt controller
See also
DT_INST_IRQ_INTC_BY_IDX()

◆ DT_INST_IRQ_INTC_BY_IDX

#define DT_INST_IRQ_INTC_BY_IDX (   inst,
  idx 
)     DT_IRQ_INTC_BY_IDX(DT_DRV_INST(inst), idx)

#include <include/zephyr/devicetree.h>

Get a DT_DRV_COMPAT interrupt specifier's interrupt controller by index.

Parameters
instinstance number
idxinterrupt specifier's index
Returns
node_id of interrupt specifier's interrupt controller

◆ DT_INST_IRQ_INTC_BY_NAME

#define DT_INST_IRQ_INTC_BY_NAME (   inst,
  name 
)     DT_IRQ_INTC_BY_NAME(DT_DRV_INST(inst), name)

#include <include/zephyr/devicetree.h>

Get a DT_DRV_COMPAT interrupt specifier's interrupt controller by name.

Parameters
instinstance number
nameinterrupt specifier's name
Returns
node_id of interrupt specifier's interrupt controller

◆ DT_INST_IRQ_LEVEL

#define DT_INST_IRQ_LEVEL (   inst)    DT_IRQ_LEVEL(DT_DRV_INST(inst))

#include <include/zephyr/devicetree.h>

Get a DT_DRV_COMPAT interrupt level.

Parameters
instinstance number
Returns
interrupt level

◆ DT_INST_IRQN

#define DT_INST_IRQN (   inst)    DT_IRQN(DT_DRV_INST(inst))

#include <include/zephyr/devicetree.h>

Get a DT_DRV_COMPAT's (only) irq number.

Parameters
instinstance number
Returns
the interrupt number for the node's only interrupt

◆ DT_INST_IRQN_BY_IDX

#define DT_INST_IRQN_BY_IDX (   inst,
  idx 
)    DT_IRQN_BY_IDX(DT_DRV_INST(inst), idx)

#include <include/zephyr/devicetree.h>

Get a DT_DRV_COMPAT's irq number at index.

Parameters
instinstance number
idxlogical index into the interrupt specifier array
Returns
the interrupt number for the node's idx-th interrupt

◆ DT_INST_NODE_HAS_COMPAT

#define DT_INST_NODE_HAS_COMPAT (   inst,
  compat 
)     DT_NODE_HAS_COMPAT(DT_DRV_INST(inst), compat)

#include <include/zephyr/devicetree.h>

Does a DT_DRV_COMPAT instance have the compatible?

Parameters
instinstance number
compatlowercase-and-underscores compatible, without quotes
Returns
1 if the instance matches the compatible, 0 otherwise.

◆ DT_INST_NODE_HAS_PROP

#define DT_INST_NODE_HAS_PROP (   inst,
  prop 
)     DT_NODE_HAS_PROP(DT_DRV_INST(inst), prop)

#include <include/zephyr/devicetree.h>

Does a DT_DRV_COMPAT instance have a property?

Parameters
instinstance number
proplowercase-and-underscores property name
Returns
1 if the instance has the property, 0 otherwise.

◆ DT_INST_NODELABEL_STRING_ARRAY

#define DT_INST_NODELABEL_STRING_ARRAY (   inst)    DT_NODELABEL_STRING_ARRAY(DT_DRV_INST(inst))

#include <include/zephyr/devicetree.h>

Get a string array of DT_DRV_INST(inst)'s node labels.

Equivalent to DT_NODELABEL_STRING_ARRAY(DT_DRV_INST(inst)).

Parameters
instinstance number
Returns
an array initializer for an array of the instance's node labels as strings

◆ DT_INST_NUM_IRQS

#define DT_INST_NUM_IRQS (   inst)    DT_NUM_IRQS(DT_DRV_INST(inst))

#include <include/zephyr/devicetree.h>

Get a DT_DRV_COMPAT's number of interrupts.

Parameters
instinstance number
Returns
number of interrupts

◆ DT_INST_NUM_NODELABELS

#define DT_INST_NUM_NODELABELS (   inst)    DT_NUM_NODELABELS(DT_DRV_INST(inst))

#include <include/zephyr/devicetree.h>

Get the number of node labels by instance number.

Equivalent to DT_NUM_NODELABELS(DT_DRV_INST(inst)).

Parameters
instinstance number
Returns
the number of node labels that the node with that instance number has

◆ DT_INST_ON_BUS

#define DT_INST_ON_BUS (   inst,
  bus 
)    DT_ON_BUS(DT_DRV_INST(inst), bus)

#include <include/zephyr/devicetree.h>

Test if a DT_DRV_COMPAT's bus type is a given type.

Parameters
instinstance number
busa binding's bus type as a C token, lowercased and without quotes
Returns
1 if the given instance is on a bus of the given type, 0 otherwise

◆ DT_INST_PARENT

#define DT_INST_PARENT (   inst)    DT_PARENT(DT_DRV_INST(inst))

#include <include/zephyr/devicetree.h>

Get a DT_DRV_COMPAT parent's node identifier.

Parameters
instinstance number
Returns
a node identifier for the instance's parent
See also
DT_PARENT

◆ DT_INST_PHA

#define DT_INST_PHA (   inst,
  pha,
  cell 
)    DT_INST_PHA_BY_IDX(inst, pha, 0, cell)

#include <include/zephyr/devicetree.h>

Get a DT_DRV_COMPAT instance's phandle-array specifier value Equivalent to DT_INST_PHA_BY_IDX(inst, pha, 0, cell)

Parameters
instinstance number
phalowercase-and-underscores property with type phandle-array
cellbinding's cell name for the specifier at pha index 0
Returns
the cell value

◆ DT_INST_PHA_BY_IDX

#define DT_INST_PHA_BY_IDX (   inst,
  pha,
  idx,
  cell 
)     DT_PHA_BY_IDX(DT_DRV_INST(inst), pha, idx, cell)

#include <include/zephyr/devicetree.h>

Get a DT_DRV_COMPAT instance's phandle-array specifier value at an index.

Parameters
instinstance number
phalowercase-and-underscores property with type phandle-array
idxlogical index into the property pha
cellbinding's cell name within the specifier at index idx
Returns
the value of the cell inside the specifier at index idx

◆ DT_INST_PHA_BY_IDX_OR

#define DT_INST_PHA_BY_IDX_OR (   inst,
  pha,
  idx,
  cell,
  default_value 
)     DT_PHA_BY_IDX_OR(DT_DRV_INST(inst), pha, idx, cell, default_value)

#include <include/zephyr/devicetree.h>

Like DT_INST_PHA_BY_IDX(), but with a fallback to default_value.

Parameters
instinstance number
phalowercase-and-underscores property with type phandle-array
idxlogical index into the property pha
cellbinding's cell name within the specifier at index idx
default_valuea fallback value to expand to
Returns
DT_INST_PHA_BY_IDX(inst, pha, idx, cell) or default_value

◆ DT_INST_PHA_BY_NAME

#define DT_INST_PHA_BY_NAME (   inst,
  pha,
  name,
  cell 
)     DT_PHA_BY_NAME(DT_DRV_INST(inst), pha, name, cell)

#include <include/zephyr/devicetree.h>

Get a DT_DRV_COMPAT instance's value within a phandle-array specifier by name.

Parameters
instinstance number
phalowercase-and-underscores property with type phandle-array
namelowercase-and-underscores name of a specifier in pha
cellbinding's cell name for the named specifier
Returns
the cell value

◆ DT_INST_PHA_BY_NAME_OR

#define DT_INST_PHA_BY_NAME_OR (   inst,
  pha,
  name,
  cell,
  default_value 
)     DT_PHA_BY_NAME_OR(DT_DRV_INST(inst), pha, name, cell, default_value)

#include <include/zephyr/devicetree.h>

Like DT_INST_PHA_BY_NAME(), but with a fallback to default_value.

Parameters
instinstance number
phalowercase-and-underscores property with type phandle-array
namelowercase-and-underscores name of a specifier in pha
cellbinding's cell name for the named specifier
default_valuea fallback value to expand to
Returns
DT_INST_PHA_BY_NAME(inst, pha, name, cell) or default_value

◆ DT_INST_PHA_HAS_CELL

#define DT_INST_PHA_HAS_CELL (   inst,
  pha,
  cell 
)     DT_INST_PHA_HAS_CELL_AT_IDX(inst, pha, 0, cell)

#include <include/zephyr/devicetree.h>

Does a phandle array have a named cell specifier at index 0 for a DT_DRV_COMPAT instance?

Parameters
instinstance number
phalowercase-and-underscores property with type phandle-array
cellnamed cell value whose existence to check
Returns
1 if the named cell exists in the specifier at index 0, 0 otherwise.

◆ DT_INST_PHA_HAS_CELL_AT_IDX

#define DT_INST_PHA_HAS_CELL_AT_IDX (   inst,
  pha,
  idx,
  cell 
)     DT_PHA_HAS_CELL_AT_IDX(DT_DRV_INST(inst), pha, idx, cell)

#include <include/zephyr/devicetree.h>

Does a phandle array have a named cell specifier at an index for a DT_DRV_COMPAT instance?

Parameters
instinstance number
phalowercase-and-underscores property with type phandle-array
idxindex to check
cellnamed cell value whose existence to check
Returns
1 if the named cell exists in the specifier at index idx, 0 otherwise.

◆ DT_INST_PHA_OR

#define DT_INST_PHA_OR (   inst,
  pha,
  cell,
  default_value 
)     DT_INST_PHA_BY_IDX_OR(inst, pha, 0, cell, default_value)

#include <include/zephyr/devicetree.h>

Like DT_INST_PHA(), but with a fallback to default_value.

Parameters
instinstance number
phalowercase-and-underscores property with type phandle-array
cellbinding's cell name for the specifier at pha index 0
default_valuea fallback value to expand to
Returns
DT_INST_PHA(inst, pha, cell) or default_value

◆ DT_INST_PHANDLE

#define DT_INST_PHANDLE (   inst,
  prop 
)    DT_INST_PHANDLE_BY_IDX(inst, prop, 0)

#include <include/zephyr/devicetree.h>

Get a DT_DRV_COMPAT instance's node identifier for a phandle property's value.

Parameters
instinstance number
proplowercase-and-underscores property of inst with type phandle
Returns
a node identifier for the node pointed to by "ph"

◆ DT_INST_PHANDLE_BY_IDX

#define DT_INST_PHANDLE_BY_IDX (   inst,
  prop,
  idx 
)     DT_PHANDLE_BY_IDX(DT_DRV_INST(inst), prop, idx)

#include <include/zephyr/devicetree.h>

Get a DT_DRV_COMPAT instance's node identifier for a phandle in a property.

Parameters
instinstance number
proplowercase-and-underscores property name in inst with type phandle, phandles or phandle-array
idxindex into prop
Returns
a node identifier for the phandle at index idx in prop

◆ DT_INST_PHANDLE_BY_NAME

#define DT_INST_PHANDLE_BY_NAME (   inst,
  pha,
  name 
)     DT_PHANDLE_BY_NAME(DT_DRV_INST(inst), pha, name) \

#include <include/zephyr/devicetree.h>

Get a DT_DRV_COMPAT instance's phandle node identifier from a phandle array by name.

Parameters
instinstance number
phalowercase-and-underscores property with type phandle-array
namelowercase-and-underscores name of an element in pha
Returns
node identifier for the phandle at the element named "name"

◆ DT_INST_PROP

#define DT_INST_PROP (   inst,
  prop 
)    DT_PROP(DT_DRV_INST(inst), prop)

#include <include/zephyr/devicetree.h>

Get a DT_DRV_COMPAT instance property.

Parameters
instinstance number
proplowercase-and-underscores property name
Returns
a representation of the property's value

◆ DT_INST_PROP_BY_IDX

#define DT_INST_PROP_BY_IDX (   inst,
  prop,
  idx 
)     DT_PROP_BY_IDX(DT_DRV_INST(inst), prop, idx)

#include <include/zephyr/devicetree.h>

Get a DT_DRV_COMPAT element value in an array property.

Parameters
instinstance number
proplowercase-and-underscores property name
idxthe index to get
Returns
a representation of the idx-th element of the property

◆ DT_INST_PROP_BY_PHANDLE

#define DT_INST_PROP_BY_PHANDLE (   inst,
  ph,
  prop 
)     DT_INST_PROP_BY_PHANDLE_IDX(inst, ph, 0, prop)

#include <include/zephyr/devicetree.h>

Get a DT_DRV_COMPAT instance's property value from a phandle's node.

Parameters
instinstance number
phlowercase-and-underscores property of inst with type phandle
proplowercase-and-underscores property of the phandle's node
Returns
the value of prop as described in the DT_PROP() documentation

◆ DT_INST_PROP_BY_PHANDLE_IDX

#define DT_INST_PROP_BY_PHANDLE_IDX (   inst,
  phs,
  idx,
  prop 
)     DT_PROP_BY_PHANDLE_IDX(DT_DRV_INST(inst), phs, idx, prop)

#include <include/zephyr/devicetree.h>

Get a DT_DRV_COMPAT instance's property value from a phandle in a property.

Parameters
instinstance number
phslowercase-and-underscores property with type phandle, phandles, or phandle-array
idxlogical index into "phs", which must be zero if "phs" has type phandle
proplowercase-and-underscores property of the phandle's node
Returns
the value of prop as described in the DT_PROP() documentation

◆ DT_INST_PROP_HAS_IDX

#define DT_INST_PROP_HAS_IDX (   inst,
  prop,
  idx 
)     DT_PROP_HAS_IDX(DT_DRV_INST(inst), prop, idx)

#include <include/zephyr/devicetree.h>

Is index idx valid for an array type property on a DT_DRV_COMPAT instance?

Parameters
instinstance number
proplowercase-and-underscores property name
idxindex to check
Returns
1 if idx is a valid index into the given property, 0 otherwise.

◆ DT_INST_PROP_HAS_NAME

#define DT_INST_PROP_HAS_NAME (   inst,
  prop,
  name 
)     DT_PROP_HAS_NAME(DT_DRV_INST(inst), prop, name)

#include <include/zephyr/devicetree.h>

Is name name available in a foo-names property?

Parameters
instinstance number
propa lowercase-and-underscores prop-names type property
namea lowercase-and-underscores name to check
Returns
An expression which evaluates to 1 if name is an available name into the given property, and 0 otherwise.

◆ DT_INST_PROP_LEN

#define DT_INST_PROP_LEN (   inst,
  prop 
)    DT_PROP_LEN(DT_DRV_INST(inst), prop)

#include <include/zephyr/devicetree.h>

Get a DT_DRV_COMPAT property length.

Parameters
instinstance number
proplowercase-and-underscores property name
Returns
logical length of the property

◆ DT_INST_PROP_LEN_OR

#define DT_INST_PROP_LEN_OR (   inst,
  prop,
  default_value 
)     DT_PROP_LEN_OR(DT_DRV_INST(inst), prop, default_value)

#include <include/zephyr/devicetree.h>

Like DT_INST_PROP_LEN(), but with a fallback to default_value.

Parameters
instinstance number
proplowercase-and-underscores property name
default_valuea fallback value to expand to
Returns
DT_INST_PROP_LEN(inst, prop) or default_value

◆ DT_INST_PROP_OR

#define DT_INST_PROP_OR (   inst,
  prop,
  default_value 
)     DT_PROP_OR(DT_DRV_INST(inst), prop, default_value)

#include <include/zephyr/devicetree.h>

Like DT_INST_PROP(), but with a fallback to default_value.

Parameters
instinstance number
proplowercase-and-underscores property name
default_valuea fallback value to expand to
Returns
DT_INST_PROP(inst, prop) or default_value

◆ DT_INST_REG_ADDR

#define DT_INST_REG_ADDR (   inst)    DT_INST_REG_ADDR_BY_IDX(inst, 0)

#include <include/zephyr/devicetree.h>

Get a DT_DRV_COMPAT's (only) register block address.

Parameters
instinstance number
Returns
instance's register block address

◆ DT_INST_REG_ADDR_BY_IDX

#define DT_INST_REG_ADDR_BY_IDX (   inst,
  idx 
)    DT_REG_ADDR_BY_IDX(DT_DRV_INST(inst), idx)

#include <include/zephyr/devicetree.h>

Get a DT_DRV_COMPAT instance's idx-th register block's address.

Parameters
instinstance number
idxindex of the register whose address to return
Returns
address of the instance's idx-th register block

◆ DT_INST_REG_ADDR_BY_IDX_RAW

#define DT_INST_REG_ADDR_BY_IDX_RAW (   inst,
  idx 
)    DT_REG_ADDR_BY_IDX_RAW(DT_DRV_INST(inst), idx)

#include <include/zephyr/devicetree.h>

Get a DT_DRV_COMPAT instance's idx-th register block's raw address.

Parameters
instinstance number
idxindex of the register whose address to return
Returns
address of the instance's idx-th register block

◆ DT_INST_REG_ADDR_BY_NAME

#define DT_INST_REG_ADDR_BY_NAME (   inst,
  name 
)     DT_REG_ADDR_BY_NAME(DT_DRV_INST(inst), name)

#include <include/zephyr/devicetree.h>

Get a DT_DRV_COMPAT's register block address by name.

Parameters
instinstance number
namelowercase-and-underscores register specifier name
Returns
address of the register block with the given name

◆ DT_INST_REG_ADDR_BY_NAME_OR

#define DT_INST_REG_ADDR_BY_NAME_OR (   inst,
  name,
  default_value 
)     DT_REG_ADDR_BY_NAME_OR(DT_DRV_INST(inst), name, default_value)

#include <include/zephyr/devicetree.h>

Like DT_INST_REG_ADDR_BY_NAME(), but with a fallback to default_value.

Parameters
instinstance number
namelowercase-and-underscores register specifier name
default_valuea fallback value to expand to
Returns
address of the register block specified by name if present, default_value otherwise

◆ DT_INST_REG_ADDR_BY_NAME_U64

#define DT_INST_REG_ADDR_BY_NAME_U64 (   inst,
  name 
)     DT_REG_ADDR_BY_NAME_U64(DT_DRV_INST(inst), name)

#include <include/zephyr/devicetree.h>

64-bit version of DT_INST_REG_ADDR_BY_NAME()

This macro version adds the appropriate suffix for 64-bit unsigned integer literals. Note that this macro is equivalent to DT_INST_REG_ADDR_BY_NAME() in linker/ASM context.

Parameters
instinstance number
namelowercase-and-underscores register specifier name
Returns
address of the register block with the given name

◆ DT_INST_REG_ADDR_RAW

#define DT_INST_REG_ADDR_RAW (   inst)    DT_INST_REG_ADDR_BY_IDX_RAW(inst, 0)

#include <include/zephyr/devicetree.h>

Get a DT_DRV_COMPAT's (only) register block raw address.

Parameters
instinstance number
Returns
instance's register block address

◆ DT_INST_REG_ADDR_U64

#define DT_INST_REG_ADDR_U64 (   inst)    DT_REG_ADDR_U64(DT_DRV_INST(inst))

#include <include/zephyr/devicetree.h>

64-bit version of DT_INST_REG_ADDR()

This macro version adds the appropriate suffix for 64-bit unsigned integer literals. Note that this macro is equivalent to DT_INST_REG_ADDR() in linker/ASM context.

Parameters
instinstance number
Returns
instance's register block address

◆ DT_INST_REG_HAS_IDX

#define DT_INST_REG_HAS_IDX (   inst,
  idx 
)    DT_REG_HAS_IDX(DT_DRV_INST(inst), idx)

#include <include/zephyr/devicetree.h>

is idx a valid register block index on a DT_DRV_COMPAT instance?

Parameters
instinstance number
idxindex to check
Returns
1 if idx is a valid register block index, 0 otherwise.

◆ DT_INST_REG_HAS_NAME

#define DT_INST_REG_HAS_NAME (   inst,
  name 
)    DT_REG_HAS_NAME(DT_DRV_INST(inst), name)

#include <include/zephyr/devicetree.h>

is name a valid register block name on a DT_DRV_COMPAT instance?

Parameters
instinstance number
namename to check
Returns
1 if name is a valid register block name, 0 otherwise.

◆ DT_INST_REG_SIZE

#define DT_INST_REG_SIZE (   inst)    DT_INST_REG_SIZE_BY_IDX(inst, 0)

#include <include/zephyr/devicetree.h>

Get a DT_DRV_COMPAT's (only) register block size.

Parameters
instinstance number
Returns
instance's register block size

◆ DT_INST_REG_SIZE_BY_IDX

#define DT_INST_REG_SIZE_BY_IDX (   inst,
  idx 
)     DT_REG_SIZE_BY_IDX(DT_DRV_INST(inst), idx)

#include <include/zephyr/devicetree.h>

Get a DT_DRV_COMPAT instance's idx-th register block's size.

Parameters
instinstance number
idxindex of the register whose size to return
Returns
size of the instance's idx-th register block

◆ DT_INST_REG_SIZE_BY_NAME

#define DT_INST_REG_SIZE_BY_NAME (   inst,
  name 
)     DT_REG_SIZE_BY_NAME(DT_DRV_INST(inst), name)

#include <include/zephyr/devicetree.h>

Get a DT_DRV_COMPAT's register block size by name.

Parameters
instinstance number
namelowercase-and-underscores register specifier name
Returns
size of the register block with the given name

◆ DT_INST_REG_SIZE_BY_NAME_OR

#define DT_INST_REG_SIZE_BY_NAME_OR (   inst,
  name,
  default_value 
)     DT_REG_SIZE_BY_NAME_OR(DT_DRV_INST(inst), name, default_value)

#include <include/zephyr/devicetree.h>

Like DT_INST_REG_SIZE_BY_NAME(), but with a fallback to default_value.

Parameters
instinstance number
namelowercase-and-underscores register specifier name
default_valuea fallback value to expand to
Returns
size of the register block specified by name if present, default_value otherwise

◆ DT_INST_STRING_TOKEN

#define DT_INST_STRING_TOKEN (   inst,
  prop 
)     DT_STRING_TOKEN(DT_DRV_INST(inst), prop)

#include <include/zephyr/devicetree.h>

Get a DT_DRV_COMPAT instance's string property's value as a token.

Parameters
instinstance number
proplowercase-and-underscores property name
Returns
the value of prop as a token, i.e. without any quotes and with special characters converted to underscores

◆ DT_INST_STRING_TOKEN_BY_IDX

#define DT_INST_STRING_TOKEN_BY_IDX (   inst,
  prop,
  idx 
)     DT_STRING_TOKEN_BY_IDX(DT_DRV_INST(inst), prop, idx)

#include <include/zephyr/devicetree.h>

Get an element out of string-array property as a token.

Parameters
instinstance number
proplowercase-and-underscores property name
idxthe index to get
Returns
the element in prop at index idx as a token

◆ DT_INST_STRING_TOKEN_OR

#define DT_INST_STRING_TOKEN_OR (   inst,
  name,
  default_value 
)     DT_STRING_TOKEN_OR(DT_DRV_INST(inst), name, default_value)

#include <include/zephyr/devicetree.h>

Like DT_INST_STRING_TOKEN(), but with a fallback to default_value.

Parameters
instinstance number
namelowercase-and-underscores property name
default_valuea fallback value to expand to
Returns
if prop exists, its value as a token, i.e. without any quotes and with special characters converted to underscores. Otherwise default_value

◆ DT_INST_STRING_UNQUOTED

#define DT_INST_STRING_UNQUOTED (   inst,
  prop 
)     DT_STRING_UNQUOTED(DT_DRV_INST(inst), prop)

#include <include/zephyr/devicetree.h>

Get a DT_DRV_COMPAT instance's string property's value as an unquoted sequence of tokens.

Parameters
instinstance number
proplowercase-and-underscores property name
Returns
the value of prop as a sequence of tokens, with no quotes

◆ DT_INST_STRING_UNQUOTED_BY_IDX

#define DT_INST_STRING_UNQUOTED_BY_IDX (   inst,
  prop,
  idx 
)     DT_STRING_UNQUOTED_BY_IDX(DT_DRV_INST(inst), prop, idx)

#include <include/zephyr/devicetree.h>

Get an element out of string-array property as an unquoted sequence of tokens.

Parameters
instinstance number
proplowercase-and-underscores property name
idxthe index to get
Returns
the value of prop at index idx as a sequence of tokens, with no quotes

◆ DT_INST_STRING_UNQUOTED_OR

#define DT_INST_STRING_UNQUOTED_OR (   inst,
  name,
  default_value 
)     DT_STRING_UNQUOTED_OR(DT_DRV_INST(inst), name, default_value)

#include <include/zephyr/devicetree.h>

Like DT_INST_STRING_UNQUOTED(), but with a fallback to default_value.

Parameters
instinstance number
namelowercase-and-underscores property name
default_valuea fallback value to expand to
Returns
the property's value as a sequence of tokens, with no quotes, or default_value

◆ DT_INST_STRING_UPPER_TOKEN

#define DT_INST_STRING_UPPER_TOKEN (   inst,
  prop 
)     DT_STRING_UPPER_TOKEN(DT_DRV_INST(inst), prop)

#include <include/zephyr/devicetree.h>

Like DT_INST_STRING_TOKEN(), but uppercased.

Parameters
instinstance number
proplowercase-and-underscores property name
Returns
the value of prop as an uppercased token, i.e. without any quotes and with special characters converted to underscores

◆ DT_INST_STRING_UPPER_TOKEN_BY_IDX

#define DT_INST_STRING_UPPER_TOKEN_BY_IDX (   inst,
  prop,
  idx 
)     DT_STRING_UPPER_TOKEN_BY_IDX(DT_DRV_INST(inst), prop, idx)

#include <include/zephyr/devicetree.h>

Like DT_INST_STRING_TOKEN_BY_IDX(), but uppercased.

Parameters
instinstance number
proplowercase-and-underscores property name
idxthe index to get
Returns
the element in prop at index idx as an uppercased token

◆ DT_INST_STRING_UPPER_TOKEN_OR

#define DT_INST_STRING_UPPER_TOKEN_OR (   inst,
  name,
  default_value 
)     DT_STRING_UPPER_TOKEN_OR(DT_DRV_INST(inst), name, default_value)

#include <include/zephyr/devicetree.h>

Like DT_INST_STRING_UPPER_TOKEN(), but with a fallback to default_value.

Parameters
instinstance number
namelowercase-and-underscores property name
default_valuea fallback value to expand to
Returns
the property's value as an uppercased token, or default_value