Zephyr Project API 4.0.0
A Scalable Open Source RTOS
|
Macros | |
#define | DT_NUM_RANGES(node_id) DT_CAT(node_id, _RANGES_NUM) |
Get the number of range blocks in the ranges property. | |
#define | DT_RANGES_HAS_IDX(node_id, idx) IS_ENABLED(DT_CAT4(node_id, _RANGES_IDX_, idx, _EXISTS)) |
Is idx a valid range block index? | |
#define | DT_RANGES_HAS_CHILD_BUS_FLAGS_AT_IDX(node_id, idx) IS_ENABLED(DT_CAT4(node_id, _RANGES_IDX_, idx, _VAL_CHILD_BUS_FLAGS_EXISTS)) |
Does a ranges property have child bus flags at index? | |
#define | DT_RANGES_CHILD_BUS_FLAGS_BY_IDX(node_id, idx) DT_CAT4(node_id, _RANGES_IDX_, idx, _VAL_CHILD_BUS_FLAGS) |
Get the ranges property child bus flags at index. | |
#define | DT_RANGES_CHILD_BUS_ADDRESS_BY_IDX(node_id, idx) DT_CAT4(node_id, _RANGES_IDX_, idx, _VAL_CHILD_BUS_ADDRESS) |
Get the ranges property child bus address at index. | |
#define | DT_RANGES_PARENT_BUS_ADDRESS_BY_IDX(node_id, idx) DT_CAT4(node_id, _RANGES_IDX_, idx, _VAL_PARENT_BUS_ADDRESS) |
Get the ranges property parent bus address at index. | |
#define | DT_RANGES_LENGTH_BY_IDX(node_id, idx) DT_CAT4(node_id, _RANGES_IDX_, idx, _VAL_LENGTH) |
Get the ranges property length at index. | |
#define | DT_FOREACH_RANGE(node_id, fn) DT_CAT(node_id, _FOREACH_RANGE)(fn) |
Invokes fn for each entry of node_id ranges property. | |
#define DT_FOREACH_RANGE | ( | node_id, | |
fn | |||
) | DT_CAT(node_id, _FOREACH_RANGE)(fn) |
#include <include/zephyr/devicetree.h>
Invokes fn
for each entry of node_id
ranges property.
The macro fn
must take two parameters, node_id
which will be the node identifier of the node with the ranges property and idx
the index of the ranges block.
Example devicetree fragment:
Example usage:
This expands to:
node_id | node identifier |
fn | macro to invoke |
#define DT_NUM_RANGES | ( | node_id | ) | DT_CAT(node_id, _RANGES_NUM) |
#include <include/zephyr/devicetree.h>
Get the number of range blocks in the ranges property.
Use this instead of DT_PROP_LEN(node_id, ranges).
Example devicetree fragment:
Example usage:
node_id | node identifier |
#define DT_RANGES_CHILD_BUS_ADDRESS_BY_IDX | ( | node_id, | |
idx | |||
) | DT_CAT4(node_id, _RANGES_IDX_, idx, _VAL_CHILD_BUS_ADDRESS) |
#include <include/zephyr/devicetree.h>
Get the ranges property child bus address at index.
When the node is a PCIe bus, the Child Bus Address has an extra cell used to store some flags, thus this cell is removed from the Child Bus Address.
Example devicetree fragments:
Example usage:
node_id | node identifier |
idx | logical index into the ranges array |
#define DT_RANGES_CHILD_BUS_FLAGS_BY_IDX | ( | node_id, | |
idx | |||
) | DT_CAT4(node_id, _RANGES_IDX_, idx, _VAL_CHILD_BUS_FLAGS) |
#include <include/zephyr/devicetree.h>
Get the ranges property child bus flags at index.
When the node is a PCIe bus, the Child Bus Address has an extra cell used to store some flags, thus this cell is extracted from the Child Bus Address as Child Bus Flags field.
Example devicetree fragments:
Example usage:
node_id | node identifier |
idx | logical index into the ranges array |
#define DT_RANGES_HAS_CHILD_BUS_FLAGS_AT_IDX | ( | node_id, | |
idx | |||
) | IS_ENABLED(DT_CAT4(node_id, _RANGES_IDX_, idx, _VAL_CHILD_BUS_FLAGS_EXISTS)) |
#include <include/zephyr/devicetree.h>
Does a ranges property have child bus flags at index?
If this returns 1, then DT_RANGES_CHILD_BUS_FLAGS_BY_IDX(node_id, idx) is valid. If it returns 0, it is an error to use this macro with index idx
. This macro only returns 1 for PCIe buses (i.e. nodes whose bindings specify they are "pcie" bus nodes.)
Example devicetree fragment:
Example usage:
node_id | node identifier |
idx | logical index into the ranges array |
idx
is a valid child bus flags index, 0 otherwise. #define DT_RANGES_HAS_IDX | ( | node_id, | |
idx | |||
) | IS_ENABLED(DT_CAT4(node_id, _RANGES_IDX_, idx, _EXISTS)) |
#include <include/zephyr/devicetree.h>
Is idx
a valid range block index?
If this returns 1, then DT_RANGES_CHILD_BUS_ADDRESS_BY_IDX(node_id, idx), DT_RANGES_PARENT_BUS_ADDRESS_BY_IDX(node_id, idx) or DT_RANGES_LENGTH_BY_IDX(node_id, idx) are valid. For DT_RANGES_CHILD_BUS_FLAGS_BY_IDX(node_id, idx) the return value of DT_RANGES_HAS_CHILD_BUS_FLAGS_AT_IDX(node_id, idx) will indicate validity. If it returns 0, it is an error to use those macros with index idx
, including DT_RANGES_CHILD_BUS_FLAGS_BY_IDX(node_id, idx).
Example devicetree fragment:
Example usage:
node_id | node identifier |
idx | index to check |
idx
is a valid register block index, 0 otherwise. #define DT_RANGES_LENGTH_BY_IDX | ( | node_id, | |
idx | |||
) | DT_CAT4(node_id, _RANGES_IDX_, idx, _VAL_LENGTH) |
#include <include/zephyr/devicetree.h>
Get the ranges property length at index.
Similarly to DT_RANGES_CHILD_BUS_ADDRESS_BY_IDX(), this properly accounts for child bus flags cells when the node is a PCIe bus.
Example devicetree fragment:
Example usage:
node_id | node identifier |
idx | logical index into the ranges array |
#define DT_RANGES_PARENT_BUS_ADDRESS_BY_IDX | ( | node_id, | |
idx | |||
) | DT_CAT4(node_id, _RANGES_IDX_, idx, _VAL_PARENT_BUS_ADDRESS) |
#include <include/zephyr/devicetree.h>
Get the ranges property parent bus address at index.
Similarly to DT_RANGES_CHILD_BUS_ADDRESS_BY_IDX(), this properly accounts for child bus flags cells when the node is a PCIe bus.
Example devicetree fragment:
Example usage:
node_id | node identifier |
idx | logical index into the ranges array |