Zephyr API Documentation 4.0.99
A Scalable Open Source RTOS
|
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_BY_IDX(inst, prop, idx) |
Get a DT_DRV_COMPAT property array value's index into its enumeration values. | |
#define | DT_INST_ENUM_IDX(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) |
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) |
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) |
Does a DT_DRV_COMPAT enumeration property have a given value by 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_RAW(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) |
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_RAW(inst) |
Get a DT_DRV_COMPAT 's (only) register block raw address. | |
#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? | |
#define DT_ANY_COMPAT_HAS_PROP_STATUS_OKAY | ( | compat, | |
prop ) |
#include <zephyr/devicetree.h>
Check if any device node with status okay
has a given property.
compat | lowercase-and-underscores devicetree compatible |
prop | lowercase-and-underscores property name |
Example devicetree overlay:
Example usage:
#define DT_ANY_INST_HAS_PROP_STATUS_OKAY | ( | prop | ) |
#include <zephyr/devicetree.h>
Check if any DT_DRV_COMPAT
node with status okay
has a given property.
prop | lowercase-and-underscores property name |
Example devicetree overlay:
Example usage:
#define DT_ANY_INST_ON_BUS_STATUS_OKAY | ( | bus | ) |
#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:
Example usage, assuming i2c0
is an I2C bus controller node, and therefore temp
is on an I2C bus:
bus | a binding's bus type as a C token, lowercased and without quotes |
#define DT_DRV_INST | ( | inst | ) |
#include <zephyr/devicetree.h>
Node identifier for an instance of a DT_DRV_COMPAT
compatible.
inst | instance number |
DT_DRV_COMPAT
compatible and instance number inst
#define DT_HAS_COMPAT_ON_BUS_STATUS_OKAY | ( | compat, | |
bus ) |
#include <zephyr/devicetree.h>
#define DT_INST_BUS | ( | inst | ) |
#include <zephyr/devicetree.h>
Get a DT_DRV_COMPAT
's bus node identifier.
inst | instance number |
#define DT_INST_CHILD | ( | inst, | |
child ) |
#include <zephyr/devicetree.h>
Get a node identifier for a child node of DT_DRV_INST(inst)
inst | instance number |
child | lowercase-and-underscores child node name |
#define DT_INST_CHILD_NUM | ( | inst | ) |
#include <zephyr/devicetree.h>
Get the number of child nodes of a given node.
This is equivalent to
DT_CHILD_NUM(DT_DRV_INST(inst))
.inst | Devicetree instance number |
#define DT_INST_CHILD_NUM_STATUS_OKAY | ( | inst | ) |
#include <zephyr/devicetree.h>
Get the number of child nodes of a given node.
This is equivalent to
inst | Devicetree instance number |
#define DT_INST_ENUM_HAS_VALUE | ( | inst, | |
prop, | |||
value ) |
#include <zephyr/devicetree.h>
Does a DT_DRV_COMPAT
enumeration property have a given value?
inst | instance number |
prop | lowercase-and-underscores property name |
value | lowercase-and-underscores enumeration value |
#define DT_INST_ENUM_HAS_VALUE_BY_IDX | ( | inst, | |
prop, | |||
idx, | |||
value ) |
#include <zephyr/devicetree.h>
Does a DT_DRV_COMPAT
enumeration property have a given value by index?
inst | instance number |
prop | lowercase-and-underscores property name |
idx | the index to get |
value | lowercase-and-underscores enumeration value |
#define DT_INST_ENUM_IDX | ( | inst, | |
prop ) |
#include <zephyr/devicetree.h>
Get a DT_DRV_COMPAT
value's index into its enumeration values.
inst | instance number |
prop | lowercase-and-underscores property name |
#define DT_INST_ENUM_IDX_BY_IDX | ( | inst, | |
prop, | |||
idx ) |
#include <zephyr/devicetree.h>
Get a DT_DRV_COMPAT
property array value's index into its enumeration values.
inst | instance number |
prop | lowercase-and-underscores property name |
idx | the index to get |
#define DT_INST_ENUM_IDX_BY_IDX_OR | ( | inst, | |
prop, | |||
idx, | |||
default_idx_value ) |
#include <zephyr/devicetree.h>
Like DT_INST_ENUM_IDX_BY_IDX(), but with a fallback to a default enum index.
inst | instance number |
prop | lowercase-and-underscores property name |
idx | the index to get |
default_idx_value | a fallback index value to expand to |
#define DT_INST_ENUM_IDX_OR | ( | inst, | |
prop, | |||
default_idx_value ) |
#include <zephyr/devicetree.h>
Like DT_INST_ENUM_IDX(), but with a fallback to a default enum index.
inst | instance number |
prop | lowercase-and-underscores property name |
default_idx_value | a fallback index value to expand to |
#define DT_INST_FOREACH_CHILD | ( | inst, | |
fn ) |
#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.
inst | instance number |
fn | macro to invoke on each child node identifier |
#define DT_INST_FOREACH_CHILD_SEP | ( | inst, | |
fn, | |||
sep ) |
#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.
inst | instance number |
fn | macro to invoke on each child node identifier |
sep | Separator (e.g. comma or semicolon). Must be in parentheses; this is required to enable providing a comma as separator. |
#define DT_INST_FOREACH_CHILD_SEP_VARGS | ( | inst, | |
fn, | |||
sep, | |||
... ) |
#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.
inst | instance number |
fn | macro to invoke on each child node identifier |
sep | Separator (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 |
#define DT_INST_FOREACH_CHILD_STATUS_OKAY | ( | inst, | |
fn ) |
#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.
inst | instance number |
fn | macro to invoke on each child node identifier |
#define DT_INST_FOREACH_CHILD_STATUS_OKAY_SEP | ( | inst, | |
fn, | |||
sep ) |
#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.
inst | instance number |
fn | macro to invoke on each child node identifier |
sep | Separator (e.g. comma or semicolon). Must be in parentheses; this is required to enable providing a comma as separator. |
#define DT_INST_FOREACH_CHILD_STATUS_OKAY_SEP_VARGS | ( | inst, | |
fn, | |||
sep, | |||
... ) |
#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.
inst | instance number |
fn | macro to invoke on each child node identifier |
sep | Separator (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 |
#define DT_INST_FOREACH_CHILD_STATUS_OKAY_VARGS | ( | inst, | |
fn, | |||
... ) |
#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.
inst | instance number |
fn | macro to invoke on each child node identifier |
... | variable number of arguments to pass to fn |
#define DT_INST_FOREACH_CHILD_VARGS | ( | inst, | |
fn, | |||
... ) |
#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.
inst | instance number |
fn | macro to invoke on each child node identifier |
... | variable number of arguments to pass to fn |
#define DT_INST_FOREACH_NODELABEL | ( | inst, | |
fn ) |
#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).
inst | instance number |
fn | macro which will be passed each node label for the node with that instance number |
#define DT_INST_FOREACH_NODELABEL_VARGS | ( | inst, | |
fn, | |||
... ) |
#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, ...).
inst | instance number |
fn | macro which will be passed each node label for the node with that instance number |
... | additional arguments to pass to fn |
#define DT_INST_FOREACH_PROP_ELEM | ( | inst, | |
prop, | |||
fn ) |
#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).
inst | instance number |
prop | lowercase-and-underscores property name |
fn | macro to invoke |
#define DT_INST_FOREACH_PROP_ELEM_SEP | ( | inst, | |
prop, | |||
fn, | |||
sep ) |
#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).
inst | instance number |
prop | lowercase-and-underscores property name |
fn | macro to invoke |
sep | Separator (e.g. comma or semicolon). Must be in parentheses; this is required to enable providing a comma as separator. |
#define DT_INST_FOREACH_PROP_ELEM_SEP_VARGS | ( | inst, | |
prop, | |||
fn, | |||
sep, | |||
... ) |
#include <zephyr/devicetree.h>
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)
inst | instance number |
prop | lowercase-and-underscores property name |
fn | macro to invoke |
sep | Separator (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 |
#define DT_INST_FOREACH_PROP_ELEM_VARGS | ( | inst, | |
prop, | |||
fn, | |||
... ) |
#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)
inst | instance number |
prop | lowercase-and-underscores property name |
fn | macro to invoke |
... | variable number of arguments to pass to fn |
#define DT_INST_FOREACH_STATUS_OKAY | ( | fn | ) |
#include <zephyr/devicetree.h>
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:
Example usage:
This expands to:
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
.
fn | Macro to call for each enabled node. Must accept an instance number as its only parameter. |
#define DT_INST_FOREACH_STATUS_OKAY_VARGS | ( | fn, | |
... ) |
#include <zephyr/devicetree.h>
Call fn
on all nodes with compatible DT_DRV_COMPAT
and status okay
with multiple arguments.
fn | Macro to call for each enabled node. Must accept an instance number. |
... | variable number of arguments to pass to fn |
#define DT_INST_GPARENT | ( | inst | ) |
#include <zephyr/devicetree.h>
Get a DT_DRV_COMPAT
grandparent's node identifier.
inst | instance number |
#define DT_INST_IRQ | ( | inst, | |
cell ) |
#include <zephyr/devicetree.h>
Get a DT_DRV_COMPAT
interrupt specifier's value.
inst | instance number |
cell | cell name specifier |
#define DT_INST_IRQ_BY_IDX | ( | inst, | |
idx, | |||
cell ) |
#include <zephyr/devicetree.h>
Get a DT_DRV_COMPAT
interrupt specifier value at an index.
inst | instance number |
idx | logical index into the interrupt specifier array |
cell | cell name specifier |
#define DT_INST_IRQ_BY_NAME | ( | inst, | |
name, | |||
cell ) |
#include <zephyr/devicetree.h>
Get a DT_DRV_COMPAT
interrupt specifier value by name.
inst | instance number |
name | lowercase-and-underscores interrupt specifier name |
cell | cell name specifier |
#define DT_INST_IRQ_HAS_CELL | ( | inst, | |
cell ) |
#include <zephyr/devicetree.h>
Does a DT_DRV_COMPAT
instance have an interrupt value?
inst | instance number |
cell | named cell value whose existence to check |
cell
exists in the interrupt specifier at index 0 0 otherwise. #define DT_INST_IRQ_HAS_CELL_AT_IDX | ( | inst, | |
idx, | |||
cell ) |
#include <zephyr/devicetree.h>
Does a DT_DRV_COMPAT
instance have an interrupt named cell specifier?
inst | instance number |
idx | index to check |
cell | named cell value whose existence to check |
cell
exists in the interrupt specifier at index idx
0 otherwise. #define DT_INST_IRQ_HAS_IDX | ( | inst, | |
idx ) |
#include <zephyr/devicetree.h>
is index valid for interrupt property on a DT_DRV_COMPAT
instance?
inst | instance number |
idx | logical index into the interrupt specifier array |
idx
is valid for the interrupt property 0 otherwise. #define DT_INST_IRQ_HAS_NAME | ( | inst, | |
name ) |
#include <zephyr/devicetree.h>
Does a DT_DRV_COMPAT
instance have an interrupt value?
inst | instance number |
name | lowercase-and-underscores interrupt specifier name |
name
is a valid named specifier #define DT_INST_IRQ_INTC | ( | inst | ) |
#include <zephyr/devicetree.h>
Get a DT_DRV_COMPAT
interrupt specifier's interrupt controller.
inst | instance number |
#define DT_INST_IRQ_INTC_BY_IDX | ( | inst, | |
idx ) |
#include <zephyr/devicetree.h>
Get a DT_DRV_COMPAT
interrupt specifier's interrupt controller by index.
inst | instance number |
idx | interrupt specifier's index |
#define DT_INST_IRQ_INTC_BY_NAME | ( | inst, | |
name ) |
#include <zephyr/devicetree.h>
Get a DT_DRV_COMPAT
interrupt specifier's interrupt controller by name.
inst | instance number |
name | interrupt specifier's name |
#define DT_INST_IRQ_LEVEL | ( | inst | ) |
#include <zephyr/devicetree.h>
Get a DT_DRV_COMPAT
interrupt level.
inst | instance number |
#define DT_INST_IRQN | ( | inst | ) |
#include <zephyr/devicetree.h>
Get a DT_DRV_COMPAT
's (only) irq number.
inst | instance number |
#define DT_INST_IRQN_BY_IDX | ( | inst, | |
idx ) |
#include <zephyr/devicetree.h>
Get a DT_DRV_COMPAT
's irq number at index.
inst | instance number |
idx | logical index into the interrupt specifier array |
#define DT_INST_NODE_HAS_COMPAT | ( | inst, | |
compat ) |
#include <zephyr/devicetree.h>
Does a DT_DRV_COMPAT instance have the compatible?
inst | instance number |
compat | lowercase-and-underscores compatible, without quotes |
#define DT_INST_NODE_HAS_PROP | ( | inst, | |
prop ) |
#include <zephyr/devicetree.h>
Does a DT_DRV_COMPAT instance have a property?
inst | instance number |
prop | lowercase-and-underscores property name |
#define DT_INST_NODELABEL_STRING_ARRAY | ( | inst | ) |
#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)).
inst | instance number |
#define DT_INST_NUM_IRQS | ( | inst | ) |
#include <zephyr/devicetree.h>
Get a DT_DRV_COMPAT
's number of interrupts.
inst | instance number |
#define DT_INST_NUM_NODELABELS | ( | inst | ) |
#include <zephyr/devicetree.h>
Get the number of node labels by instance number.
Equivalent to DT_NUM_NODELABELS(DT_DRV_INST(inst)).
inst | instance number |
#define DT_INST_ON_BUS | ( | inst, | |
bus ) |
#include <zephyr/devicetree.h>
Test if a DT_DRV_COMPAT
's bus type is a given type.
inst | instance number |
bus | a binding's bus type as a C token, lowercased and without quotes |
#define DT_INST_PARENT | ( | inst | ) |
#include <zephyr/devicetree.h>
Get a DT_DRV_COMPAT
parent's node identifier.
inst | instance number |
#define DT_INST_PHA | ( | inst, | |
pha, | |||
cell ) |
#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)
inst | instance number |
pha | lowercase-and-underscores property with type phandle-array |
cell | binding's cell name for the specifier at pha index 0 |
#define DT_INST_PHA_BY_IDX | ( | inst, | |
pha, | |||
idx, | |||
cell ) |
#include <zephyr/devicetree.h>
Get a DT_DRV_COMPAT
instance's phandle-array specifier value at an index.
inst | instance number |
pha | lowercase-and-underscores property with type phandle-array |
idx | logical index into the property pha |
cell | binding's cell name within the specifier at index idx |
idx
#define DT_INST_PHA_BY_IDX_OR | ( | inst, | |
pha, | |||
idx, | |||
cell, | |||
default_value ) |
#include <zephyr/devicetree.h>
Like DT_INST_PHA_BY_IDX(), but with a fallback to default_value.
inst | instance number |
pha | lowercase-and-underscores property with type phandle-array |
idx | logical index into the property pha |
cell | binding's cell name within the specifier at index idx |
default_value | a fallback value to expand to |
#define DT_INST_PHA_BY_NAME | ( | inst, | |
pha, | |||
name, | |||
cell ) |
#include <zephyr/devicetree.h>
Get a DT_DRV_COMPAT
instance's value within a phandle-array specifier by name.
inst | instance number |
pha | lowercase-and-underscores property with type phandle-array |
name | lowercase-and-underscores name of a specifier in pha |
cell | binding's cell name for the named specifier |
#define DT_INST_PHA_BY_NAME_OR | ( | inst, | |
pha, | |||
name, | |||
cell, | |||
default_value ) |
#include <zephyr/devicetree.h>
Like DT_INST_PHA_BY_NAME(), but with a fallback to default_value.
inst | instance number |
pha | lowercase-and-underscores property with type phandle-array |
name | lowercase-and-underscores name of a specifier in pha |
cell | binding's cell name for the named specifier |
default_value | a fallback value to expand to |
#define DT_INST_PHA_HAS_CELL | ( | inst, | |
pha, | |||
cell ) |
#include <zephyr/devicetree.h>
Does a phandle array have a named cell specifier at index 0 for a DT_DRV_COMPAT
instance?
inst | instance number |
pha | lowercase-and-underscores property with type phandle-array |
cell | named cell value whose existence to check |
cell
exists in the specifier at index 0, 0 otherwise. #define DT_INST_PHA_HAS_CELL_AT_IDX | ( | inst, | |
pha, | |||
idx, | |||
cell ) |
#include <zephyr/devicetree.h>
Does a phandle array have a named cell specifier at an index for a DT_DRV_COMPAT
instance?
inst | instance number |
pha | lowercase-and-underscores property with type phandle-array |
idx | index to check |
cell | named cell value whose existence to check |
cell
exists in the specifier at index idx
, 0 otherwise. #define DT_INST_PHA_OR | ( | inst, | |
pha, | |||
cell, | |||
default_value ) |
#include <zephyr/devicetree.h>
Like DT_INST_PHA(), but with a fallback to default_value.
inst | instance number |
pha | lowercase-and-underscores property with type phandle-array |
cell | binding's cell name for the specifier at pha index 0 |
default_value | a fallback value to expand to |
#define DT_INST_PHANDLE | ( | inst, | |
prop ) |
#include <zephyr/devicetree.h>
Get a DT_DRV_COMPAT
instance's node identifier for a phandle property's value.
inst | instance number |
prop | lowercase-and-underscores property of inst with type phandle |
#define DT_INST_PHANDLE_BY_IDX | ( | inst, | |
prop, | |||
idx ) |
#include <zephyr/devicetree.h>
Get a DT_DRV_COMPAT
instance's node identifier for a phandle in a property.
inst | instance number |
prop | lowercase-and-underscores property name in inst with type phandle , phandles or phandle-array |
idx | index into prop |
idx
in prop
#define DT_INST_PHANDLE_BY_NAME | ( | inst, | |
pha, | |||
name ) |
#include <zephyr/devicetree.h>
Get a DT_DRV_COMPAT
instance's phandle node identifier from a phandle array by name.
inst | instance number |
pha | lowercase-and-underscores property with type phandle-array |
name | lowercase-and-underscores name of an element in pha |
#define DT_INST_PROP | ( | inst, | |
prop ) |
#include <zephyr/devicetree.h>
Get a DT_DRV_COMPAT
instance property.
inst | instance number |
prop | lowercase-and-underscores property name |
#define DT_INST_PROP_BY_IDX | ( | inst, | |
prop, | |||
idx ) |
#include <zephyr/devicetree.h>
Get a DT_DRV_COMPAT
element value in an array property.
inst | instance number |
prop | lowercase-and-underscores property name |
idx | the index to get |
#define DT_INST_PROP_BY_PHANDLE | ( | inst, | |
ph, | |||
prop ) |
#include <zephyr/devicetree.h>
Get a DT_DRV_COMPAT
instance's property value from a phandle's node.
inst | instance number |
ph | lowercase-and-underscores property of inst with type phandle |
prop | lowercase-and-underscores property of the phandle's node |
prop
as described in the DT_PROP() documentation #define DT_INST_PROP_BY_PHANDLE_IDX | ( | inst, | |
phs, | |||
idx, | |||
prop ) |
#include <zephyr/devicetree.h>
Get a DT_DRV_COMPAT
instance's property value from a phandle in a property.
inst | instance number |
phs | lowercase-and-underscores property with type phandle , phandles , or phandle-array |
idx | logical index into "phs", which must be zero if "phs" has type phandle |
prop | lowercase-and-underscores property of the phandle's node |
prop
as described in the DT_PROP() documentation #define DT_INST_PROP_HAS_IDX | ( | inst, | |
prop, | |||
idx ) |
#include <zephyr/devicetree.h>
Is index idx
valid for an array type property on a DT_DRV_COMPAT
instance?
inst | instance number |
prop | lowercase-and-underscores property name |
idx | index to check |
idx
is a valid index into the given property, 0 otherwise. #define DT_INST_PROP_HAS_NAME | ( | inst, | |
prop, | |||
name ) |
#include <zephyr/devicetree.h>
Is name name
available in a foo-names
property?
inst | instance number |
prop | a lowercase-and-underscores prop-names type property |
name | a lowercase-and-underscores name to check |
name
is an available name into the given property, and 0 otherwise. #define DT_INST_PROP_LEN | ( | inst, | |
prop ) |
#include <zephyr/devicetree.h>
Get a DT_DRV_COMPAT
property length.
inst | instance number |
prop | lowercase-and-underscores property name |
#define DT_INST_PROP_LEN_OR | ( | inst, | |
prop, | |||
default_value ) |
#include <zephyr/devicetree.h>
Like DT_INST_PROP_LEN(), but with a fallback to default_value
.
inst | instance number |
prop | lowercase-and-underscores property name |
default_value | a fallback value to expand to |
default_value
#define DT_INST_PROP_OR | ( | inst, | |
prop, | |||
default_value ) |
#include <zephyr/devicetree.h>
Like DT_INST_PROP(), but with a fallback to default_value
.
inst | instance number |
prop | lowercase-and-underscores property name |
default_value | a fallback value to expand to |
default_value
#define DT_INST_REG_ADDR | ( | inst | ) |
#include <zephyr/devicetree.h>
Get a DT_DRV_COMPAT
's (only) register block address.
inst | instance number |
#define DT_INST_REG_ADDR_BY_IDX | ( | inst, | |
idx ) |
#include <zephyr/devicetree.h>
Get a DT_DRV_COMPAT
instance's idx-th register block's address.
inst | instance number |
idx | index of the register whose address to return |
#define DT_INST_REG_ADDR_BY_IDX_RAW | ( | inst, | |
idx ) |
#include <zephyr/devicetree.h>
Get a DT_DRV_COMPAT
instance's idx-th register block's raw address.
inst | instance number |
idx | index of the register whose address to return |
#define DT_INST_REG_ADDR_BY_NAME | ( | inst, | |
name ) |
#include <zephyr/devicetree.h>
Get a DT_DRV_COMPAT
's register block address by name.
inst | instance number |
name | lowercase-and-underscores register specifier name |
name
#define DT_INST_REG_ADDR_BY_NAME_OR | ( | inst, | |
name, | |||
default_value ) |
#include <zephyr/devicetree.h>
Like DT_INST_REG_ADDR_BY_NAME(), but with a fallback to default_value
.
inst | instance number |
name | lowercase-and-underscores register specifier name |
default_value | a fallback value to expand to |
default_value
otherwise #define DT_INST_REG_ADDR_BY_NAME_U64 | ( | inst, | |
name ) |
#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.
inst | instance number |
name | lowercase-and-underscores register specifier name |
name
#define DT_INST_REG_ADDR_RAW | ( | inst | ) |
#include <zephyr/devicetree.h>
Get a DT_DRV_COMPAT
's (only) register block raw address.
inst | instance number |
#define DT_INST_REG_ADDR_U64 | ( | inst | ) |
#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.
inst | instance number |
#define DT_INST_REG_HAS_IDX | ( | inst, | |
idx ) |
#include <zephyr/devicetree.h>
is idx
a valid register block index on a DT_DRV_COMPAT
instance?
inst | instance number |
idx | index to check |
idx
is a valid register block index, 0 otherwise. #define DT_INST_REG_HAS_NAME | ( | inst, | |
name ) |
#include <zephyr/devicetree.h>
is name
a valid register block name on a DT_DRV_COMPAT
instance?
inst | instance number |
name | name to check |
name
is a valid register block name, 0 otherwise. #define DT_INST_REG_SIZE | ( | inst | ) |
#include <zephyr/devicetree.h>
Get a DT_DRV_COMPAT
's (only) register block size.
inst | instance number |
#define DT_INST_REG_SIZE_BY_IDX | ( | inst, | |
idx ) |
#include <zephyr/devicetree.h>
Get a DT_DRV_COMPAT
instance's idx-th register block's size.
inst | instance number |
idx | index of the register whose size to return |
#define DT_INST_REG_SIZE_BY_NAME | ( | inst, | |
name ) |
#include <zephyr/devicetree.h>
Get a DT_DRV_COMPAT
's register block size by name.
inst | instance number |
name | lowercase-and-underscores register specifier name |
name
#define DT_INST_REG_SIZE_BY_NAME_OR | ( | inst, | |
name, | |||
default_value ) |
#include <zephyr/devicetree.h>
Like DT_INST_REG_SIZE_BY_NAME(), but with a fallback to default_value
.
inst | instance number |
name | lowercase-and-underscores register specifier name |
default_value | a fallback value to expand to |
default_value
otherwise #define DT_INST_STRING_TOKEN | ( | inst, | |
prop ) |
#include <zephyr/devicetree.h>
Get a DT_DRV_COMPAT
instance's string property's value as a token.
inst | instance number |
prop | lowercase-and-underscores property name |
prop
as a token, i.e. without any quotes and with special characters converted to underscores #define DT_INST_STRING_TOKEN_BY_IDX | ( | inst, | |
prop, | |||
idx ) |
#include <zephyr/devicetree.h>
Get an element out of string-array property as a token.
inst | instance number |
prop | lowercase-and-underscores property name |
idx | the index to get |
prop
at index idx
as a token #define DT_INST_STRING_TOKEN_OR | ( | inst, | |
name, | |||
default_value ) |
#include <zephyr/devicetree.h>
Like DT_INST_STRING_TOKEN(), but with a fallback to default_value
.
inst | instance number |
name | lowercase-and-underscores property name |
default_value | a fallback value to expand to |
prop
exists, its value as a token, i.e. without any quotes and with special characters converted to underscores. Otherwise default_value
#define DT_INST_STRING_UNQUOTED | ( | inst, | |
prop ) |
#include <zephyr/devicetree.h>
Get a DT_DRV_COMPAT
instance's string property's value as an unquoted sequence of tokens.
inst | instance number |
prop | lowercase-and-underscores property name |
prop
as a sequence of tokens, with no quotes #define DT_INST_STRING_UNQUOTED_BY_IDX | ( | inst, | |
prop, | |||
idx ) |
#include <zephyr/devicetree.h>
Get an element out of string-array property as an unquoted sequence of tokens.
inst | instance number |
prop | lowercase-and-underscores property name |
idx | the index to get |
prop
at index idx
as a sequence of tokens, with no quotes #define DT_INST_STRING_UNQUOTED_OR | ( | inst, | |
name, | |||
default_value ) |
#include <zephyr/devicetree.h>
Like DT_INST_STRING_UNQUOTED(), but with a fallback to default_value
.
inst | instance number |
name | lowercase-and-underscores property name |
default_value | a fallback value to expand to |
default_value
#define DT_INST_STRING_UPPER_TOKEN | ( | inst, | |
prop ) |
#include <zephyr/devicetree.h>
Like DT_INST_STRING_TOKEN(), but uppercased.
inst | instance number |
prop | lowercase-and-underscores property name |
prop
as an uppercased token, i.e. without any quotes and with special characters converted to underscores #define DT_INST_STRING_UPPER_TOKEN_BY_IDX | ( | inst, | |
prop, | |||
idx ) |
#include <zephyr/devicetree.h>
Like DT_INST_STRING_TOKEN_BY_IDX(), but uppercased.
inst | instance number |
prop | lowercase-and-underscores property name |
idx | the index to get |
prop
at index idx
as an uppercased token #define DT_INST_STRING_UPPER_TOKEN_OR | ( | inst, | |
name, | |||
default_value ) |
#include <zephyr/devicetree.h>
Like DT_INST_STRING_UPPER_TOKEN(), but with a fallback to default_value
.
inst | instance number |
name | lowercase-and-underscores property name |
default_value | a fallback value to expand to |
default_value