Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS
Instance-based devicetree APIs

Macros

#define DT_DRV_INST(inst)   DT_INST(inst, DT_DRV_COMPAT)
 Node identifier for an instance of a DT_DRV_COMPAT compatible. More...
 
#define DT_INST_FOREACH_CHILD(inst, fn)    DT_FOREACH_CHILD(DT_DRV_INST(inst), fn)
 Call "fn" on all child nodes of DT_DRV_INST(inst). More...
 
#define DT_INST_FOREACH_CHILD_VARGS(inst, fn, ...)    DT_FOREACH_CHILD_VARGS(DT_DRV_INST(inst), fn, __VA_ARGS__)
 Call "fn" on all child nodes of DT_DRV_INST(inst). More...
 
#define DT_INST_PROP(inst, prop)   DT_PROP(DT_DRV_INST(inst), prop)
 Get a DT_DRV_COMPAT instance property. More...
 
#define DT_INST_PROP_LEN(inst, prop)   DT_PROP_LEN(DT_DRV_INST(inst), prop)
 Get a DT_DRV_COMPAT property length. More...
 
#define DT_INST_PROP_HAS_IDX(inst, prop, idx)    DT_PROP_HAS_IDX(DT_DRV_INST(inst), prop, idx)
 Is index "idx" valid for an array type property on a DT_DRV_COMPAT instance? More...
 
#define DT_INST_PROP_BY_IDX(inst, prop, idx)    DT_PROP_BY_IDX(DT_DRV_INST(inst), prop, idx)
 Get a DT_DRV_COMPAT element value in an array property. More...
 
#define DT_INST_PROP_OR(inst, prop, default_value)    DT_PROP_OR(DT_DRV_INST(inst), prop, default_value)
 Like DT_INST_PROP(), but with a fallback to default_value. More...
 
#define DT_INST_LABEL(inst)   DT_INST_PROP(inst, label)
 Get a DT_DRV_COMPAT instance's "label" property. More...
 
#define DT_INST_PROP_BY_PHANDLE(inst, ph, prop)    DT_INST_PROP_BY_PHANDLE_IDX(inst, ph, 0, prop)
 Get a DT_DRV_COMPAT instance's property value from a phandle's node. More...
 
#define DT_INST_PROP_BY_PHANDLE_IDX(inst, phs, idx, prop)    DT_PROP_BY_PHANDLE_IDX(DT_DRV_INST(inst), phs, idx, prop)
 Get a DT_DRV_COMPAT instance's property value from a phandle in a property. More...
 
#define DT_INST_PHA_BY_IDX(inst, pha, idx, cell)    DT_PHA_BY_IDX(DT_DRV_INST(inst), pha, idx, cell)
 Get a DT_DRV_COMPAT instance's phandle-array specifier value at an index. More...
 
#define DT_INST_PHA_BY_IDX_OR(inst, pha, idx, cell, default_value)    DT_PHA_BY_IDX_OR(DT_DRV_INST(inst), pha, idx, cell, default_value)
 Like DT_INST_PHA_BY_IDX(), but with a fallback to default_value. More...
 
#define DT_INST_PHA(inst, pha, cell)   DT_INST_PHA_BY_IDX(inst, pha, 0, cell)
 Get a DT_DRV_COMPAT instance's phandle-array specifier value Equivalent to DT_INST_PHA_BY_IDX(inst, pha, 0, cell) More...
 
#define DT_INST_PHA_OR(inst, pha, cell, default_value)    DT_INST_PHA_BY_IDX_OR(inst, pha, 0, cell, default_value)
 Like DT_INST_PHA(), but with a fallback to default_value. More...
 
#define DT_INST_PHA_BY_NAME(inst, pha, name, cell)    DT_PHA_BY_NAME(DT_DRV_INST(inst), pha, name, cell)
 Get a DT_DRV_COMPAT instance's value within a phandle-array specifier by name. More...
 
#define DT_INST_PHA_BY_NAME_OR(inst, pha, name, cell, default_value)    DT_PHA_BY_NAME_OR(DT_DRV_INST(inst), pha, name, cell, default_value)
 Like DT_INST_PHA_BY_NAME(), but with a fallback to default_value. More...
 
#define DT_INST_PHANDLE_BY_NAME(inst, pha, name)    DT_PHANDLE_BY_NAME(DT_DRV_INST(inst), pha, name) \
 Get a DT_DRV_COMPAT instance's phandle node identifier from a phandle array by name. More...
 
#define DT_INST_PHANDLE_BY_IDX(inst, prop, idx)    DT_PHANDLE_BY_IDX(DT_DRV_INST(inst), prop, idx)
 Get a DT_DRV_COMPAT instance's node identifier for a phandle in a property. More...
 
#define DT_INST_PHANDLE(inst, prop)   DT_INST_PHANDLE_BY_IDX(inst, prop, 0)
 Get a DT_DRV_COMPAT instance's node identifier for a phandle property's value. More...
 
#define DT_INST_REG_HAS_IDX(inst, idx)   DT_REG_HAS_IDX(DT_DRV_INST(inst), idx)
 is "idx" a valid register block index on a DT_DRV_COMPAT instance? More...
 
#define DT_INST_REG_ADDR_BY_IDX(inst, idx)   DT_REG_ADDR_BY_IDX(DT_DRV_INST(inst), idx)
 Get a DT_DRV_COMPAT instance's idx-th register block's address. More...
 
#define DT_INST_REG_SIZE_BY_IDX(inst, idx)    DT_REG_SIZE_BY_IDX(DT_DRV_INST(inst), idx)
 Get a DT_DRV_COMPAT instance's idx-th register block's size. More...
 
#define DT_INST_REG_ADDR_BY_NAME(inst, name)    DT_REG_ADDR_BY_NAME(DT_DRV_INST(inst), name)
 Get a DT_DRV_COMPAT's register block address by name. More...
 
#define DT_INST_REG_SIZE_BY_NAME(inst, name)    DT_REG_SIZE_BY_NAME(DT_DRV_INST(inst), name)
 Get a DT_DRV_COMPAT's register block size by name. More...
 
#define DT_INST_REG_ADDR(inst)   DT_INST_REG_ADDR_BY_IDX(inst, 0)
 Get a DT_DRV_COMPAT's (only) register block address. More...
 
#define DT_INST_REG_SIZE(inst)   DT_INST_REG_SIZE_BY_IDX(inst, 0)
 Get a DT_DRV_COMPAT's (only) register block size. More...
 
#define DT_INST_IRQ_BY_IDX(inst, idx, cell)    DT_IRQ_BY_IDX(DT_DRV_INST(inst), idx, cell)
 Get a DT_DRV_COMPAT interrupt specifier value at an index. More...
 
#define DT_INST_IRQ_BY_NAME(inst, name, cell)    DT_IRQ_BY_NAME(DT_DRV_INST(inst), name, cell)
 Get a DT_DRV_COMPAT interrupt specifier value by name. More...
 
#define DT_INST_IRQ(inst, cell)   DT_INST_IRQ_BY_IDX(inst, 0, cell)
 Get a DT_DRV_COMPAT interrupt specifier's value. More...
 
#define DT_INST_IRQN(inst)   DT_INST_IRQ(inst, irq)
 Get a DT_DRV_COMPAT's (only) irq number. More...
 
#define DT_INST_BUS(inst)   DT_BUS(DT_DRV_INST(inst))
 Get a DT_DRV_COMPAT's bus node identifier. More...
 
#define DT_INST_BUS_LABEL(inst)   DT_BUS_LABEL(DT_DRV_INST(inst))
 Get a DT_DRV_COMPAT's bus node's label property. More...
 
#define DT_INST_ON_BUS(inst, bus)   DT_ON_BUS(DT_DRV_INST(inst), bus)
 Test if a DT_DRV_COMPAT's bus type is a given type. More...
 
#define DT_ANY_INST_ON_BUS_STATUS_OKAY(bus)    DT_COMPAT_ON_BUS_INTERNAL(DT_DRV_COMPAT, bus)
 Test if any DT_DRV_COMPAT node is on a bus of a given type and has status okay. More...
 
#define DT_INST_FOREACH_STATUS_OKAY(fn)
 Call "fn" on all nodes with compatible DT_DRV_COMPAT and status "okay". More...
 
#define DT_INST_FOREACH_STATUS_OKAY_VARGS(fn, ...)
 Call "fn" on all nodes with compatible DT_DRV_COMPAT and status "okay" with multiple arguments. More...
 
#define DT_INST_FOREACH_PROP_ELEM(inst, prop, fn)    DT_FOREACH_PROP_ELEM(DT_DRV_INST(inst), prop, fn)
 Invokes "fn" for each element of property "prop" for a DT_DRV_COMPAT instance. More...
 
#define DT_INST_FOREACH_PROP_ELEM_VARGS(inst, prop, fn, ...)    DT_FOREACH_PROP_ELEM_VARGS(DT_DRV_INST(inst), prop, fn, __VA_ARGS__)
 Invokes "fn" for each element of property "prop" for a DT_DRV_COMPAT instance with multiple arguments. More...
 
#define DT_INST_NODE_HAS_PROP(inst, prop)    DT_NODE_HAS_PROP(DT_DRV_INST(inst), prop)
 Does a DT_DRV_COMPAT instance have a property? More...
 
#define DT_INST_PHA_HAS_CELL_AT_IDX(inst, pha, idx, cell)    DT_PHA_HAS_CELL_AT_IDX(DT_DRV_INST(inst), pha, idx, cell)
 Does a phandle array have a named cell specifier at an index for a DT_DRV_COMPAT instance? More...
 
#define DT_INST_PHA_HAS_CELL(inst, pha, cell)    DT_INST_PHA_HAS_CELL_AT_IDX(inst, pha, 0, cell)
 Does a phandle array have a named cell specifier at index 0 for a DT_DRV_COMPAT instance? More...
 
#define DT_INST_IRQ_HAS_IDX(inst, idx)   DT_IRQ_HAS_IDX(DT_DRV_INST(inst), idx)
 is index valid for interrupt property on a DT_DRV_COMPAT instance? More...
 
#define DT_INST_IRQ_HAS_CELL_AT_IDX(inst, idx, cell)    DT_IRQ_HAS_CELL_AT_IDX(DT_DRV_INST(inst), idx, cell)
 Does a DT_DRV_COMPAT instance have an interrupt named cell specifier? More...
 
#define DT_INST_IRQ_HAS_CELL(inst, cell)    DT_INST_IRQ_HAS_CELL_AT_IDX(inst, 0, cell)
 Does a DT_DRV_COMPAT instance have an interrupt value? More...
 
#define DT_INST_IRQ_HAS_NAME(inst, name)    DT_IRQ_HAS_NAME(DT_DRV_INST(inst), name)
 Does a DT_DRV_COMPAT instance have an interrupt value? More...
 

Detailed Description

Macro Definition Documentation

◆ DT_ANY_INST_ON_BUS_STATUS_OKAY

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

#include <include/devicetree.h>

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

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

Example devicetree overlay:

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

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

#define DT_DRV_COMPAT vnd_some_sensor

DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) // 1
Parameters
busa binding's bus type as a C token, lowercased and without quotes
Returns
1 if any enabled node with that compatible is on that bus type, 0 otherwise

◆ DT_DRV_INST

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

#include <include/devicetree.h>

Node identifier for an instance of a DT_DRV_COMPAT compatible.

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

◆ DT_INST_BUS

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

#include <include/devicetree.h>

Get a DT_DRV_COMPAT's bus node identifier.

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

◆ DT_INST_BUS_LABEL

#define DT_INST_BUS_LABEL (   inst)    DT_BUS_LABEL(DT_DRV_INST(inst))

#include <include/devicetree.h>

Get a DT_DRV_COMPAT's bus node's label property.

Parameters
instinstance number
Returns
the label property of the instance's bus controller

◆ DT_INST_FOREACH_CHILD

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

#include <include/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.

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

◆ DT_INST_FOREACH_CHILD_VARGS

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

#include <include/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.

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_PROP_ELEM

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

#include <include/devicetree.h>

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

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

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

◆ DT_INST_FOREACH_PROP_ELEM_VARGS

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

#include <include/devicetree.h>

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

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

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

◆ DT_INST_FOREACH_STATUS_OKAY

#define DT_INST_FOREACH_STATUS_OKAY (   fn)

#include <include/devicetree.h>

Value:
(UTIL_CAT(DT_FOREACH_OKAY_INST_, \
DT_DRV_COMPAT)(fn)), \
())
#define DT_DRV_COMPAT
Definition: csk_wifi.c:5
#define DT_HAS_COMPAT_STATUS_OKAY(compat)
Does the devicetree have a status "okay" node with a compatible?
Definition: devicetree.h:1881
#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:156
#define UTIL_CAT(a,...)
Definition: util_internal.h:84

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";
        label = "DEV_A";
};

b {
        compatible = "vnd,device";
        status = "okay";
        label = "DEV_B";
};

c {
        compatible = "vnd,device";
        status = "disabled";
        label = "DEV_C";
};

Example usage:

#define DT_DRV_COMPAT vnd_device
#define MY_FN(inst) DT_INST_LABEL(inst),

DT_INST_FOREACH_STATUS_OKAY(MY_FN)

This expands to:

MY_FN(0) MY_FN(1)

and from there, to either this:

"DEV_A", "DEV_B",

or this:

"DEV_B", "DEV_A",

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

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

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

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

◆ DT_INST_FOREACH_STATUS_OKAY_VARGS

#define DT_INST_FOREACH_STATUS_OKAY_VARGS (   fn,
  ... 
)

#include <include/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 as its only parameter.
...variable number of arguments to pass to fn
See also
DT_INST_FOREACH_STATUS_OKAY

◆ DT_INST_IRQ

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

#include <include/devicetree.h>

Get a DT_DRV_COMPAT interrupt specifier's value.

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

◆ DT_INST_IRQ_BY_IDX

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

#include <include/devicetree.h>

Get a DT_DRV_COMPAT interrupt specifier value at an index.

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

◆ DT_INST_IRQ_BY_NAME

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

#include <include/devicetree.h>

Get a DT_DRV_COMPAT interrupt specifier value by name.

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

◆ DT_INST_IRQ_HAS_CELL

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

#include <include/devicetree.h>

Does a DT_DRV_COMPAT instance have an interrupt value?

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

◆ DT_INST_IRQ_HAS_CELL_AT_IDX

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

#include <include/devicetree.h>

Does a DT_DRV_COMPAT instance have an interrupt named cell specifier?

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

◆ DT_INST_IRQ_HAS_IDX

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

#include <include/devicetree.h>

is index valid for interrupt property on a DT_DRV_COMPAT instance?

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

◆ DT_INST_IRQ_HAS_NAME

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

#include <include/devicetree.h>

Does a DT_DRV_COMPAT instance have an interrupt value?

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

◆ DT_INST_IRQN

#define DT_INST_IRQN (   inst)    DT_INST_IRQ(inst, irq)

#include <include/devicetree.h>

Get a DT_DRV_COMPAT's (only) irq number.

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

◆ DT_INST_LABEL

#define DT_INST_LABEL (   inst)    DT_INST_PROP(inst, label)

#include <include/devicetree.h>

Get a DT_DRV_COMPAT instance's "label" property.

Parameters
instinstance number
Returns
instance's label property value

◆ DT_INST_NODE_HAS_PROP

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

#include <include/devicetree.h>

Does a DT_DRV_COMPAT instance have a property?

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

◆ DT_INST_ON_BUS

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

#include <include/devicetree.h>

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

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

◆ DT_INST_PHA

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

#include <include/devicetree.h>

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

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

◆ DT_INST_PHA_BY_IDX

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

#include <include/devicetree.h>

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

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

◆ DT_INST_PHA_BY_IDX_OR

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

#include <include/devicetree.h>

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

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

◆ DT_INST_PHA_BY_NAME

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

#include <include/devicetree.h>

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

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

◆ DT_INST_PHA_BY_NAME_OR

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

#include <include/devicetree.h>

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

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

◆ DT_INST_PHA_HAS_CELL

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

#include <include/devicetree.h>

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

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

◆ DT_INST_PHA_HAS_CELL_AT_IDX

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

#include <include/devicetree.h>

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

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

◆ DT_INST_PHA_OR

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

#include <include/devicetree.h>

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

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

◆ DT_INST_PHANDLE

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

#include <include/devicetree.h>

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

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

◆ DT_INST_PHANDLE_BY_IDX

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

#include <include/devicetree.h>

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

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

◆ DT_INST_PHANDLE_BY_NAME

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

#include <include/devicetree.h>

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

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

◆ DT_INST_PROP

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

#include <include/devicetree.h>

Get a DT_DRV_COMPAT instance property.

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

◆ DT_INST_PROP_BY_IDX

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

#include <include/devicetree.h>

Get a DT_DRV_COMPAT element value in an array property.

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

◆ DT_INST_PROP_BY_PHANDLE

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

#include <include/devicetree.h>

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

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

◆ DT_INST_PROP_BY_PHANDLE_IDX

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

#include <include/devicetree.h>

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

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

◆ DT_INST_PROP_HAS_IDX

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

#include <include/devicetree.h>

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

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

◆ DT_INST_PROP_LEN

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

#include <include/devicetree.h>

Get a DT_DRV_COMPAT property length.

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

◆ DT_INST_PROP_OR

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

#include <include/devicetree.h>

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

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

◆ DT_INST_REG_ADDR

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

#include <include/devicetree.h>

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

Parameters
instinstance number
Returns
instance's register block address

◆ DT_INST_REG_ADDR_BY_IDX

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

#include <include/devicetree.h>

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

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

◆ DT_INST_REG_ADDR_BY_NAME

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

#include <include/devicetree.h>

Get a DT_DRV_COMPAT's register block address by name.

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

◆ DT_INST_REG_HAS_IDX

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

#include <include/devicetree.h>

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

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

◆ DT_INST_REG_SIZE

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

#include <include/devicetree.h>

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

Parameters
instinstance number
Returns
instance's register block size

◆ DT_INST_REG_SIZE_BY_IDX

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

#include <include/devicetree.h>

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

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

◆ DT_INST_REG_SIZE_BY_NAME

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

#include <include/devicetree.h>

Get a DT_DRV_COMPAT's register block size by name.

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