Zephyr API 3.6.99
Loading...
Searching...
No Matches
Instance-based devicetree APIs

Macros

#define DT_DRV_INST(inst)
 Node identifier for an instance of a DT_DRV_COMPAT compatible.
 
#define DT_INST_PARENT(inst)
 Get a DT_DRV_COMPAT parent's node identifier.
 
#define DT_INST_GPARENT(inst)
 Get a DT_DRV_COMPAT grandparent's node identifier.
 
#define DT_INST_CHILD(inst, child)
 Get a node identifier for a child node of DT_DRV_INST(inst)
 
#define DT_INST_CHILD_NUM(inst)
 Get the number of child nodes of a given node.
 
#define DT_INST_CHILD_NUM_STATUS_OKAY(inst)
 Get the number of child nodes of a given node.
 
#define DT_INST_NODELABEL_STRING_ARRAY(inst)
 Get a string array of DT_DRV_INST(inst)'s node labels.
 
#define DT_INST_NUM_NODELABELS(inst)
 Get the number of node labels by instance number.
 
#define DT_INST_FOREACH_CHILD(inst, fn)
 Call fn on all child nodes of DT_DRV_INST(inst).
 
#define DT_INST_FOREACH_CHILD_SEP(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, ...)
 Call fn on all child nodes of DT_DRV_INST(inst).
 
#define DT_INST_FOREACH_CHILD_SEP_VARGS(inst, fn, sep, ...)
 Call fn on all child nodes of DT_DRV_INST(inst) with separator.
 
#define DT_INST_FOREACH_CHILD_STATUS_OKAY(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)
 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, ...)
 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, ...)
 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(inst, prop)
 Get a DT_DRV_COMPAT value's index into its enumeration values.
 
#define DT_INST_ENUM_IDX_OR(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(inst, prop, value)
 Does a DT_DRV_COMPAT enumeration property have a given value?
 
#define DT_INST_PROP(inst, prop)
 Get a DT_DRV_COMPAT instance property.
 
#define DT_INST_PROP_LEN(inst, prop)
 Get a DT_DRV_COMPAT property length.
 
#define DT_INST_PROP_HAS_IDX(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)
 Is name name available in a foo-names property?
 
#define DT_INST_PROP_BY_IDX(inst, prop, idx)
 Get a DT_DRV_COMPAT element value in an array property.
 
#define DT_INST_PROP_OR(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)
 Like DT_INST_PROP_LEN(), but with a fallback to default_value.
 
#define DT_INST_STRING_TOKEN(inst, prop)
 Get a DT_DRV_COMPAT instance's string property's value as a token.
 
#define DT_INST_STRING_UPPER_TOKEN(inst, prop)
 Like DT_INST_STRING_TOKEN(), but uppercased.
 
#define DT_INST_STRING_UNQUOTED(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)
 Get an element out of string-array property as a token.
 
#define DT_INST_STRING_UPPER_TOKEN_BY_IDX(inst, prop, idx)
 Like DT_INST_STRING_TOKEN_BY_IDX(), but uppercased.
 
#define DT_INST_STRING_UNQUOTED_BY_IDX(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)
 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)
 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)
 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)
 Like DT_INST_PHA_BY_IDX(), but with a fallback to default_value.
 
#define DT_INST_PHA(inst, pha, 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)
 Like DT_INST_PHA(), but with a fallback to default_value.
 
#define DT_INST_PHA_BY_NAME(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)
 Like DT_INST_PHA_BY_NAME(), but with a fallback to default_value.
 
#define DT_INST_PHANDLE_BY_NAME(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)
 Get a DT_DRV_COMPAT instance's node identifier for a phandle in a property.
 
#define DT_INST_PHANDLE(inst, prop)
 Get a DT_DRV_COMPAT instance's node identifier for a phandle property's value.
 
#define DT_INST_REG_HAS_IDX(inst, idx)
 is idx a valid register block index on a DT_DRV_COMPAT instance?
 
#define DT_INST_REG_HAS_NAME(inst, name)
 is name a valid register block name on a DT_DRV_COMPAT instance?
 
#define DT_INST_REG_ADDR_BY_IDX(inst, idx)
 Get a DT_DRV_COMPAT instance's idx-th register block's address.
 
#define DT_INST_REG_SIZE_BY_IDX(inst, idx)
 Get a DT_DRV_COMPAT instance's idx-th register block's size.
 
#define DT_INST_REG_ADDR_BY_NAME(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)
 Like DT_INST_REG_ADDR_BY_NAME(), but with a fallback to default_value.
 
#define DT_INST_REG_ADDR_BY_NAME_U64(inst, name)
 64-bit version of DT_INST_REG_ADDR_BY_NAME()
 
#define DT_INST_REG_SIZE_BY_NAME(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)
 Like DT_INST_REG_SIZE_BY_NAME(), but with a fallback to default_value.
 
#define DT_INST_REG_ADDR(inst)
 Get a DT_DRV_COMPAT's (only) register block address.
 
#define DT_INST_REG_ADDR_U64(inst)
 64-bit version of DT_INST_REG_ADDR()
 
#define DT_INST_REG_SIZE(inst)
 Get a DT_DRV_COMPAT's (only) register block size.
 
#define DT_INST_NUM_IRQS(inst)
 Get a DT_DRV_COMPAT's number of interrupts.
 
#define DT_INST_IRQ_LEVEL(inst)
 Get a DT_DRV_COMPAT interrupt level.
 
#define DT_INST_IRQ_BY_IDX(inst, idx, cell)
 Get a DT_DRV_COMPAT interrupt specifier value at an index.
 
#define DT_INST_IRQ_INTC_BY_IDX(inst, idx)
 Get a DT_DRV_COMPAT interrupt specifier's interrupt controller by index.
 
#define DT_INST_IRQ_INTC_BY_NAME(inst, name)
 Get a DT_DRV_COMPAT interrupt specifier's interrupt controller by name.
 
#define DT_INST_IRQ_INTC(inst)
 Get a DT_DRV_COMPAT interrupt specifier's interrupt controller.
 
#define DT_INST_IRQ_BY_NAME(inst, name, cell)
 Get a DT_DRV_COMPAT interrupt specifier value by name.
 
#define DT_INST_IRQ(inst, cell)
 Get a DT_DRV_COMPAT interrupt specifier's value.
 
#define DT_INST_IRQN(inst)
 Get a DT_DRV_COMPAT's (only) irq number.
 
#define DT_INST_IRQN_BY_IDX(inst, idx)
 Get a DT_DRV_COMPAT's irq number at index.
 
#define DT_INST_BUS(inst)
 Get a DT_DRV_COMPAT's bus node identifier.
 
#define DT_INST_ON_BUS(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)
 Like DT_INST_STRING_TOKEN(), but with a fallback to default_value.
 
#define DT_INST_STRING_UPPER_TOKEN_OR(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)
 Like DT_INST_STRING_UNQUOTED(), but with a fallback to default_value.
 
#define DT_HAS_COMPAT_ON_BUS_STATUS_OKAY(compat, bus)
 
#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.
 
#define DT_ANY_INST_HAS_PROP_STATUS_OKAY(prop)
 Check if any DT_DRV_COMPAT node with status okay has a given property.
 
#define DT_ANY_COMPAT_HAS_PROP_STATUS_OKAY(compat, prop)
 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)
 Call fn on all node labels for a given DT_DRV_COMPAT instance.
 
#define DT_INST_FOREACH_NODELABEL_VARGS(inst, fn, ...)
 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)
 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)
 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, ...)
 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)
 Does a DT_DRV_COMPAT instance have a property?
 
#define DT_INST_NODE_HAS_COMPAT(inst, compat)
 Does a DT_DRV_COMPAT instance have the compatible?
 
#define DT_INST_PHA_HAS_CELL_AT_IDX(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)
 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)
 is index valid for interrupt property on a DT_DRV_COMPAT instance?
 
#define DT_INST_IRQ_HAS_CELL_AT_IDX(inst, idx, cell)
 Does a DT_DRV_COMPAT instance have an interrupt named cell specifier?
 
#define DT_INST_IRQ_HAS_CELL(inst, cell)
 Does a DT_DRV_COMPAT instance have an interrupt value?
 
#define DT_INST_IRQ_HAS_NAME(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 )

#include <zephyr/devicetree.h>

Value:
(DT_COMPAT_FOREACH_STATUS_OKAY_VARGS(compat, DT_COMPAT_NODE_HAS_PROP_AND_OR, prop) 0)
#define DT_COMPAT_FOREACH_STATUS_OKAY_VARGS(compat, fn,...)
Call fn on all nodes with compatible compat and status okay with multiple arguments.
Definition devicetree.h:3269

Check if any device 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:

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:4554

◆ DT_ANY_INST_HAS_PROP_STATUS_OKAY

#define DT_ANY_INST_HAS_PROP_STATUS_OKAY ( prop)

#include <zephyr/devicetree.h>

Value:
COND_CODE_1(IS_EMPTY(DT_ANY_INST_HAS_PROP_STATUS_OKAY_(prop)), (0), (1))
#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:179
#define IS_EMPTY(...)
Check if a macro has a replacement expression.
Definition util_macro.h:277

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:4508

◆ DT_ANY_INST_ON_BUS_STATUS_OKAY

#define DT_ANY_INST_ON_BUS_STATUS_OKAY ( bus)

#include <zephyr/devicetree.h>

Value:
#define DT_HAS_COMPAT_ON_BUS_STATUS_OKAY(compat, bus)
Definition devicetree.h:4426

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:4461
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)

#include <zephyr/devicetree.h>

Value:
DT_INST(inst, DT_DRV_COMPAT)
#define DT_INST(inst, compat)
Get a node identifier for an instance of a compatible.
Definition devicetree.h:336

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 )

#include <zephyr/devicetree.h>

Value:
IS_ENABLED(DT_CAT4(DT_COMPAT_, compat, _BUS_, bus))
#define IS_ENABLED(config_macro)
Check for macro definition in compiler-visible expressions.
Definition util_macro.h:124

◆ DT_INST_BUS

#define DT_INST_BUS ( inst)

#include <zephyr/devicetree.h>

Value:
#define DT_BUS(node_id)
Node's bus controller.
Definition devicetree.h:3597
#define DT_DRV_INST(inst)
Node identifier for an instance of a DT_DRV_COMPAT compatible.
Definition devicetree.h:3645

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 )

#include <zephyr/devicetree.h>

Value:
DT_CHILD(DT_DRV_INST(inst), child)
#define DT_CHILD(node_id, child)
Get a node identifier for a child node.
Definition devicetree.h:423

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)

#include <zephyr/devicetree.h>

Value:
#define DT_CHILD_NUM(node_id)
Get the number of child nodes of a given node.
Definition devicetree.h:560

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)

#include <zephyr/devicetree.h>

Value:
#define DT_CHILD_NUM_STATUS_OKAY(node_id)
Get the number of child nodes of a given node which child nodes' status are okay.
Definition devicetree.h:570

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 )

#include <zephyr/devicetree.h>

Value:
DT_ENUM_HAS_VALUE(DT_DRV_INST(inst), prop, value)
#define DT_ENUM_HAS_VALUE(node_id, prop, value)
Does a node enumeration property have a given value?
Definition devicetree.h:897

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_IDX

#define DT_INST_ENUM_IDX ( inst,
prop )

#include <zephyr/devicetree.h>

Value:
DT_ENUM_IDX(DT_DRV_INST(inst), prop)
#define DT_ENUM_IDX(node_id, prop)
Get a property value's index into its enumeration values.
Definition devicetree.h:869

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_OR

#define DT_INST_ENUM_IDX_OR ( inst,
prop,
default_idx_value )

#include <zephyr/devicetree.h>

Value:
DT_ENUM_IDX_OR(DT_DRV_INST(inst), prop, default_idx_value)
#define DT_ENUM_IDX_OR(node_id, prop, default_idx_value)
Like DT_ENUM_IDX(), but with a fallback to a default enum index.
Definition devicetree.h:885

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 )

#include <zephyr/devicetree.h>

Value:
#define DT_FOREACH_CHILD(node_id, fn)
Invokes fn for each child of node_id.
Definition devicetree.h:2846

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 )

#include <zephyr/devicetree.h>

Value:
#define DT_FOREACH_CHILD_SEP(node_id, fn, sep)
Invokes fn for each child of node_id with a separator.
Definition devicetree.h:2889

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,
... )

#include <zephyr/devicetree.h>

Value:
DT_FOREACH_CHILD_SEP_VARGS(DT_DRV_INST(inst), fn, sep, __VA_ARGS__)
#define DT_FOREACH_CHILD_SEP_VARGS(node_id, fn, sep,...)
Invokes fn for each child of node_id with separator and multiple arguments.
Definition devicetree.h:2925

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 )

#include <zephyr/devicetree.h>

Value:
#define DT_FOREACH_CHILD_STATUS_OKAY(node_id, fn)
Call fn on the child nodes with status okay
Definition devicetree.h:2943

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 )

#include <zephyr/devicetree.h>

Value:
#define DT_FOREACH_CHILD_STATUS_OKAY_SEP(node_id, fn, sep)
Call fn on the child nodes with status okay with separator.
Definition devicetree.h:2962

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,
... )

#include <zephyr/devicetree.h>

Value:
#define DT_FOREACH_CHILD_STATUS_OKAY_SEP_VARGS(node_id, fn, sep,...)
Call fn on the child nodes with status okay with separator and multiple arguments.
Definition devicetree.h:3005

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,
... )

#include <zephyr/devicetree.h>

Value:
#define DT_FOREACH_CHILD_STATUS_OKAY_VARGS(node_id, fn,...)
Call fn on the child nodes with status okay with multiple arguments.
Definition devicetree.h:2984

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,
... )

#include <zephyr/devicetree.h>

Value:
DT_FOREACH_CHILD_VARGS(DT_DRV_INST(inst), fn, __VA_ARGS__)
#define DT_FOREACH_CHILD_VARGS(node_id, fn,...)
Invokes fn for each child of node_id with multiple arguments.
Definition devicetree.h:2907

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 )

#include <zephyr/devicetree.h>

Value:
#define DT_FOREACH_NODELABEL(node_id, fn)
Invokes fn for each node label of a given node.
Definition devicetree.h:3314

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,
... )

#include <zephyr/devicetree.h>

Value:
DT_FOREACH_NODELABEL_VARGS(DT_DRV_INST(inst), fn, __VA_ARGS__)
#define DT_FOREACH_NODELABEL_VARGS(node_id, fn,...)
Invokes fn for each node label of a given node with multiple arguments.
Definition devicetree.h:3353

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 )

#include <zephyr/devicetree.h>

Value:
#define DT_FOREACH_PROP_ELEM(node_id, prop, fn)
Invokes fn for each element in the value of property prop.
Definition devicetree.h:3058

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 )

#include <zephyr/devicetree.h>

Value:
DT_FOREACH_PROP_ELEM_SEP(DT_DRV_INST(inst), prop, fn, sep)
#define DT_FOREACH_PROP_ELEM_SEP(node_id, prop, fn, sep)
Invokes fn for each element in the value of property prop with separator.
Definition devicetree.h:3103

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 <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:3145

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,
... )

#include <zephyr/devicetree.h>

Value:
DT_FOREACH_PROP_ELEM_VARGS(DT_DRV_INST(inst), prop, fn, __VA_ARGS__)
#define DT_FOREACH_PROP_ELEM_VARGS(node_id, prop, fn,...)
Invokes fn for each element in the value of property prop with multiple arguments.
Definition devicetree.h:3126

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 <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:3447
#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:4622

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 <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)

#include <zephyr/devicetree.h>

Value:
#define DT_GPARENT(node_id)
Get a node identifier for a grandparent node.
Definition devicetree.h:386

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 )

#include <zephyr/devicetree.h>

Value:
DT_INST_IRQ_BY_IDX(inst, 0, cell)
#define DT_INST_IRQ_BY_IDX(inst, idx, cell)
Get a DT_DRV_COMPAT interrupt specifier value at an index.
Definition devicetree.h:4282

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 )

#include <zephyr/devicetree.h>

Value:
DT_IRQ_BY_IDX(DT_DRV_INST(inst), idx, cell)
#define DT_IRQ_BY_IDX(node_id, idx, cell)
Get a value within an interrupt specifier at an index.
Definition devicetree.h:2493

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 )

#include <zephyr/devicetree.h>

Value:
DT_IRQ_BY_NAME(DT_DRV_INST(inst), name, cell)
#define DT_IRQ_BY_NAME(node_id, name, cell)
Get a value within an interrupt specifier by name.
Definition devicetree.h:2511

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 )

#include <zephyr/devicetree.h>

Value:
#define DT_INST_IRQ_HAS_CELL_AT_IDX(inst, idx, cell)
Does a DT_DRV_COMPAT instance have an interrupt named cell specifier?
Definition devicetree.h:4798

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 )

#include <zephyr/devicetree.h>

Value:
#define DT_IRQ_HAS_CELL_AT_IDX(node_id, idx, cell)
Does an interrupts property have a named cell specifier at an index? If this returns 1,...
Definition devicetree.h:2434

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 )

#include <zephyr/devicetree.h>

Value:
#define DT_IRQ_HAS_IDX(node_id, idx)
Is idx a valid interrupt index?
Definition devicetree.h:2421

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 )

#include <zephyr/devicetree.h>

Value:
#define DT_IRQ_HAS_NAME(node_id, name)
Does an interrupts property have a named specifier value at an index? If this returns 1,...
Definition devicetree.h:2455

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)

#include <zephyr/devicetree.h>

Value:
#define DT_INST_IRQ_INTC_BY_IDX(inst, idx)
Get a DT_DRV_COMPAT interrupt specifier's interrupt controller by index.
Definition devicetree.h:4291

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 )

#include <zephyr/devicetree.h>

Value:
#define DT_IRQ_INTC_BY_IDX(node_id, idx)
Get an interrupt specifier's interrupt controller by index.
Definition devicetree.h:2565

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 )

#include <zephyr/devicetree.h>

Value:
#define DT_IRQ_INTC_BY_NAME(node_id, name)
Get an interrupt specifier's interrupt controller by name.
Definition devicetree.h:2612

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)

#include <zephyr/devicetree.h>

Value:
#define DT_IRQ_LEVEL(node_id)
Get the interrupt level for the node.
Definition devicetree.h:2409

Get a DT_DRV_COMPAT interrupt level.

Parameters
instinstance number
Returns
interrupt level

◆ DT_INST_IRQN

#define DT_INST_IRQN ( inst)

#include <zephyr/devicetree.h>

Value:
#define DT_IRQN(node_id)
Get a node's (only) irq number.
Definition devicetree.h:2709

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 )

#include <zephyr/devicetree.h>

Value:
#define DT_IRQN_BY_IDX(node_id, idx)
Get the node's Zephyr interrupt number at index If.
Definition devicetree.h:2694

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 )

#include <zephyr/devicetree.h>

Value:
#define DT_NODE_HAS_COMPAT(node_id, compat)
Does a devicetree node match a compatible?
Definition devicetree.h:3487

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 )

#include <zephyr/devicetree.h>

Value:
#define DT_NODE_HAS_PROP(node_id, prop)
Does a devicetree node have a property?
Definition devicetree.h:3520

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)

#include <zephyr/devicetree.h>

Value:
#define DT_NODELABEL_STRING_ARRAY(node_id)
Get a devicetree node's node labels as an array of strings.
Definition devicetree.h:620

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)

#include <zephyr/devicetree.h>

Value:
#define DT_NUM_IRQS(node_id)
Get the number of interrupt sources for the node.
Definition devicetree.h:2375

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)

#include <zephyr/devicetree.h>

Value:
#define DT_NUM_NODELABELS(node_id)
Get the number of node labels that a node has.
Definition devicetree.h:2401

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 )

#include <zephyr/devicetree.h>

Value:
#define DT_ON_BUS(node_id, bus)
Is a node on a bus of a given type?
Definition devicetree.h:3627

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)

#include <zephyr/devicetree.h>

Value:
#define DT_PARENT(node_id)
Get a node identifier for a parent node.
Definition devicetree.h:361

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 )

#include <zephyr/devicetree.h>

Value:
DT_INST_PHA_BY_IDX(inst, pha, 0, cell)
#define DT_INST_PHA_BY_IDX(inst, pha, idx, cell)
Get a DT_DRV_COMPAT instance's phandle-array specifier value at an index.
Definition devicetree.h:4049

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 )

#include <zephyr/devicetree.h>

Value:
DT_PHA_BY_IDX(DT_DRV_INST(inst), pha, idx, cell)
#define DT_PHA_BY_IDX(node_id, pha, idx, cell)
Get a phandle-array specifier cell value at an index.
Definition devicetree.h:1407

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 )

#include <zephyr/devicetree.h>

Value:
DT_PHA_BY_IDX_OR(DT_DRV_INST(inst), pha, idx, cell, default_value)
#define DT_PHA_BY_IDX_OR(node_id, pha, idx, cell, default_value)
Like DT_PHA_BY_IDX(), but with a fallback to default_value.
Definition devicetree.h:1433

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 )

#include <zephyr/devicetree.h>

Value:
DT_PHA_BY_NAME(DT_DRV_INST(inst), pha, name, cell)
#define DT_PHA_BY_NAME(node_id, pha, name, cell)
Get a value within a phandle-array specifier by name.
Definition devicetree.h:1502

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 )

#include <zephyr/devicetree.h>

Value:
DT_PHA_BY_NAME_OR(DT_DRV_INST(inst), pha, name, cell, default_value)
#define DT_PHA_BY_NAME_OR(node_id, pha, name, cell, default_value)
Like DT_PHA_BY_NAME(), but with a fallback to default_value.
Definition devicetree.h:1526

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 )

#include <zephyr/devicetree.h>

Value:
DT_INST_PHA_HAS_CELL_AT_IDX(inst, pha, 0, cell)
#define DT_INST_PHA_HAS_CELL_AT_IDX(inst, pha, idx, cell)
Does a phandle array have a named cell specifier at an index for a DT_DRV_COMPAT instance?
Definition devicetree.h:4766

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 )

#include <zephyr/devicetree.h>

Value:
DT_PHA_HAS_CELL_AT_IDX(DT_DRV_INST(inst), pha, idx, cell)
#define DT_PHA_HAS_CELL_AT_IDX(node_id, pha, idx, cell)
Does a phandle array have a named cell specifier at an index?
Definition devicetree.h:3540

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 )

#include <zephyr/devicetree.h>

Value:
DT_INST_PHA_BY_IDX_OR(inst, pha, 0, cell, default_value)
#define DT_INST_PHA_BY_IDX_OR(inst, pha, idx, cell, default_value)
Like DT_INST_PHA_BY_IDX(), but with a fallback to default_value.
Definition devicetree.h:4061

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 )

#include <zephyr/devicetree.h>

Value:
DT_INST_PHANDLE_BY_IDX(inst, prop, 0)
#define DT_INST_PHANDLE_BY_IDX(inst, prop, idx)
Get a DT_DRV_COMPAT instance's node identifier for a phandle in a property.
Definition devicetree.h:4129

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 )

#include <zephyr/devicetree.h>

Value:
DT_PHANDLE_BY_IDX(DT_DRV_INST(inst), prop, idx)
#define DT_PHANDLE_BY_IDX(node_id, prop, idx)
Get a node identifier for a phandle in a property.
Definition devicetree.h:1628

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 )

#include <zephyr/devicetree.h>

Value:
DT_PHANDLE_BY_NAME(DT_DRV_INST(inst), pha, name) \
#define DT_PHANDLE_BY_NAME(node_id, pha, name)
Get a phandle's node identifier from a phandle array by name.
Definition devicetree.h:1576

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 )

#include <zephyr/devicetree.h>

Value:
DT_PROP(DT_DRV_INST(inst), prop)
#define DT_PROP(node_id, prop)
Get a devicetree property value.
Definition devicetree.h:663

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 )

#include <zephyr/devicetree.h>

Value:
DT_PROP_BY_IDX(DT_DRV_INST(inst), prop, idx)
#define DT_PROP_BY_IDX(node_id, prop, idx)
Get the value at index idx in an array type property.
Definition devicetree.h:809

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 )

#include <zephyr/devicetree.h>

Value:
DT_INST_PROP_BY_PHANDLE_IDX(inst, ph, 0, prop)
#define DT_INST_PROP_BY_PHANDLE_IDX(inst, phs, idx, prop)
Get a DT_DRV_COMPAT instance's property value from a phandle in a property.
Definition devicetree.h:4038

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 )

#include <zephyr/devicetree.h>

Value:
DT_PROP_BY_PHANDLE_IDX(DT_DRV_INST(inst), phs, idx, prop)
#define DT_PROP_BY_PHANDLE_IDX(node_id, phs, idx, prop)
Get a property value from a phandle in a property.
Definition devicetree.h:1314

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 )

#include <zephyr/devicetree.h>

Value:
DT_PROP_HAS_IDX(DT_DRV_INST(inst), prop, idx)
#define DT_PROP_HAS_IDX(node_id, prop, idx)
Is index idx valid for an array type property?
Definition devicetree.h:737

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 )

#include <zephyr/devicetree.h>

Value:
DT_PROP_HAS_NAME(DT_DRV_INST(inst), prop, name)
#define DT_PROP_HAS_NAME(node_id, prop, name)
Is name name available in a foo-names property?
Definition devicetree.h:772

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 )

#include <zephyr/devicetree.h>

Value:
#define DT_PROP_LEN(node_id, prop)
Get a property's logical length.
Definition devicetree.h:697

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 )

#include <zephyr/devicetree.h>

Value:
DT_PROP_LEN_OR(DT_DRV_INST(inst), prop, default_value)
#define DT_PROP_LEN_OR(node_id, prop, default_value)
Like DT_PROP_LEN(), but with a fallback to default_value.
Definition devicetree.h:713

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 )

#include <zephyr/devicetree.h>

Value:
DT_PROP_OR(DT_DRV_INST(inst), prop, default_value)
#define DT_PROP_OR(node_id, prop, default_value)
Like DT_PROP(), but with a fallback to default_value.
Definition devicetree.h:825

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)

#include <zephyr/devicetree.h>

Value:
#define DT_INST_REG_ADDR_BY_IDX(inst, idx)
Get a DT_DRV_COMPAT instance's idx-th register block's address.
Definition devicetree.h:4166

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 )

#include <zephyr/devicetree.h>

Value:
#define DT_REG_ADDR_BY_IDX(node_id, idx)
Get the base address of the register block at index idx.
Definition devicetree.h:2252

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_NAME

#define DT_INST_REG_ADDR_BY_NAME ( inst,
name )

#include <zephyr/devicetree.h>

Value:
#define DT_REG_ADDR_BY_NAME(node_id, name)
Get a register block's base address by name.
Definition devicetree.h:2305

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 )

#include <zephyr/devicetree.h>

Value:
DT_REG_ADDR_BY_NAME_OR(DT_DRV_INST(inst), name, default_value)
#define DT_REG_ADDR_BY_NAME_OR(node_id, name, default_value)
Like DT_REG_ADDR_BY_NAME(), but with a fallback to default_value.
Definition devicetree.h:2316

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 )

#include <zephyr/devicetree.h>

Value:
DT_U64_C(DT_INST_REG_ADDR_BY_NAME(inst, name))
#define DT_INST_REG_ADDR_BY_NAME(inst, name)
Get a DT_DRV_COMPAT's register block address by name.
Definition devicetree.h:4183

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_U64

#define DT_INST_REG_ADDR_U64 ( inst)

#include <zephyr/devicetree.h>

Value:
DT_U64_C(DT_INST_REG_ADDR(inst))
#define DT_INST_REG_ADDR(inst)
Get a DT_DRV_COMPAT's (only) register block address.
Definition devicetree.h:4237

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 )

#include <zephyr/devicetree.h>

Value:
#define DT_REG_HAS_IDX(node_id, idx)
Is idx a valid register block index?
Definition devicetree.h:2229

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 )

#include <zephyr/devicetree.h>

Value:
#define DT_REG_HAS_NAME(node_id, name)
Is name a valid register block name?
Definition devicetree.h:2243

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)

#include <zephyr/devicetree.h>

Value:
#define DT_INST_REG_SIZE_BY_IDX(inst, idx)
Get a DT_DRV_COMPAT instance's idx-th register block's size.
Definition devicetree.h:4174

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 )

#include <zephyr/devicetree.h>

Value:
#define DT_REG_SIZE_BY_IDX(node_id, idx)
Get the size of the register block at index idx.
Definition devicetree.h:2266

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 )

#include <zephyr/devicetree.h>

Value:
#define DT_REG_SIZE_BY_NAME(node_id, name)
Get a register block's size by name.
Definition devicetree.h:2341

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 )

#include <zephyr/devicetree.h>

Value:
DT_REG_SIZE_BY_NAME_OR(DT_DRV_INST(inst), name, default_value)
#define DT_REG_SIZE_BY_NAME_OR(node_id, name, default_value)
Like DT_REG_SIZE_BY_NAME(), but with a fallback to default_value.
Definition devicetree.h:2352

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 )

#include <zephyr/devicetree.h>

Value:
#define DT_STRING_TOKEN(node_id, prop)
Get a string property's value as a token.
Definition devicetree.h:959

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 )

#include <zephyr/devicetree.h>

Value:
#define DT_STRING_TOKEN_BY_IDX(node_id, prop, idx)
Get an element out of a string-array property as a token.
Definition devicetree.h:1165

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 )

#include <zephyr/devicetree.h>

Value:
DT_STRING_TOKEN_OR(DT_DRV_INST(inst), name, default_value)
#define DT_STRING_TOKEN_OR(node_id, prop, default_value)
Like DT_STRING_TOKEN(), but with a fallback to default_value.
Definition devicetree.h:975

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 )

#include <zephyr/devicetree.h>

Value:
#define DT_STRING_UNQUOTED(node_id, prop)
Get a string property's value as an unquoted sequence of tokens.
Definition devicetree.h:1097

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 )

#include <zephyr/devicetree.h>

Value:
#define DT_STRING_UNQUOTED_BY_IDX(node_id, prop, idx)
Get a string array item value as an unquoted sequence of tokens.
Definition devicetree.h:1258

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 )

#include <zephyr/devicetree.h>

Value:
DT_STRING_UNQUOTED_OR(DT_DRV_INST(inst), name, default_value)
#define DT_STRING_UNQUOTED_OR(node_id, prop, default_value)
Like DT_STRING_UNQUOTED(), but with a fallback to default_value.
Definition devicetree.h:1114

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 )

#include <zephyr/devicetree.h>

Value:
#define DT_STRING_UPPER_TOKEN(node_id, prop)
Like DT_STRING_TOKEN(), but uppercased.
Definition devicetree.h:1036

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 )

#include <zephyr/devicetree.h>

Value:
#define DT_STRING_UPPER_TOKEN_BY_IDX(node_id, prop, idx)
Like DT_STRING_TOKEN_BY_IDX(), but uppercased.
Definition devicetree.h:1215

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 )

#include <zephyr/devicetree.h>

Value:
DT_STRING_UPPER_TOKEN_OR(DT_DRV_INST(inst), name, default_value)
#define DT_STRING_UPPER_TOKEN_OR(node_id, prop, default_value)
Like DT_STRING_UPPER_TOKEN(), but with a fallback to default_value.
Definition devicetree.h:1053

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