|
Zephyr Project API 4.0.0
A Scalable Open Source RTOS
|
Macros | |
| #define | DT_NUM_REGS(node_id) DT_CAT(node_id, _REG_NUM) |
| Get the number of register blocks in the reg property. | |
| #define | DT_REG_HAS_IDX(node_id, idx) IS_ENABLED(DT_CAT4(node_id, _REG_IDX_, idx, _EXISTS)) |
Is idx a valid register block index? | |
| #define | DT_REG_HAS_NAME(node_id, name) IS_ENABLED(DT_CAT4(node_id, _REG_NAME_, name, _EXISTS)) |
Is name a valid register block name? | |
| #define | DT_REG_ADDR_BY_IDX_RAW(node_id, idx) DT_CAT4(node_id, _REG_IDX_, idx, _VAL_ADDRESS) |
Get the base raw address of the register block at index idx. | |
| #define | DT_REG_ADDR_RAW(node_id) DT_REG_ADDR_BY_IDX_RAW(node_id, 0) |
| Get a node's (only) register block raw address. | |
| #define | DT_REG_ADDR_BY_IDX(node_id, idx) DT_U32_C(DT_REG_ADDR_BY_IDX_RAW(node_id, idx)) |
Get the base address of the register block at index idx. | |
| #define | DT_REG_SIZE_BY_IDX(node_id, idx) DT_U32_C(DT_CAT4(node_id, _REG_IDX_, idx, _VAL_SIZE)) |
Get the size of the register block at index idx. | |
| #define | DT_REG_ADDR(node_id) DT_REG_ADDR_BY_IDX(node_id, 0) |
| Get a node's (only) register block address. | |
| #define | DT_REG_ADDR_U64(node_id) DT_U64_C(DT_REG_ADDR_BY_IDX_RAW(node_id, 0)) |
| 64-bit version of DT_REG_ADDR() | |
| #define | DT_REG_SIZE(node_id) DT_REG_SIZE_BY_IDX(node_id, 0) |
| Get a node's (only) register block size. | |
| #define | DT_REG_ADDR_BY_NAME(node_id, name) DT_U32_C(DT_CAT4(node_id, _REG_NAME_, name, _VAL_ADDRESS)) |
| Get a register block's base address by name. | |
| #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. | |
| #define | DT_REG_ADDR_BY_NAME_U64(node_id, name) DT_U64_C(DT_CAT4(node_id, _REG_NAME_, name, _VAL_ADDRESS)) |
| 64-bit version of DT_REG_ADDR_BY_NAME() | |
| #define | DT_REG_SIZE_BY_NAME(node_id, name) DT_U32_C(DT_CAT4(node_id, _REG_NAME_, name, _VAL_SIZE)) |
| Get a register block's size by name. | |
| #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. | |
| #define DT_NUM_REGS | ( | node_id | ) | DT_CAT(node_id, _REG_NUM) |
#include <include/zephyr/devicetree.h>
Get the number of register blocks in the reg property.
Use this instead of DT_PROP_LEN(node_id, reg).
| node_id | node identifier |
| #define DT_REG_ADDR | ( | node_id | ) | DT_REG_ADDR_BY_IDX(node_id, 0) |
#include <include/zephyr/devicetree.h>
Get a node's (only) register block address.
Equivalent to DT_REG_ADDR_BY_IDX(node_id, 0).
| node_id | node identifier |
| #define DT_REG_ADDR_BY_IDX | ( | node_id, | |
| idx | |||
| ) | DT_U32_C(DT_REG_ADDR_BY_IDX_RAW(node_id, idx)) |
#include <include/zephyr/devicetree.h>
Get the base address of the register block at index idx.
| node_id | node identifier |
| idx | index of the register whose address to return |
| #define DT_REG_ADDR_BY_IDX_RAW | ( | node_id, | |
| idx | |||
| ) | DT_CAT4(node_id, _REG_IDX_, idx, _VAL_ADDRESS) |
#include <include/zephyr/devicetree.h>
Get the base raw address of the register block at index idx.
Get the base address of the register block at index idx without any type suffix. This can be used to index other devicetree properties, use the non _RAW macros for assigning values in actual code.
| node_id | node identifier |
| idx | index of the register whose address to return |
| #define DT_REG_ADDR_BY_NAME | ( | node_id, | |
| name | |||
| ) | DT_U32_C(DT_CAT4(node_id, _REG_NAME_, name, _VAL_ADDRESS)) |
#include <include/zephyr/devicetree.h>
Get a register block's base address by name.
| node_id | node identifier |
| name | lowercase-and-underscores register specifier name |
| #define DT_REG_ADDR_BY_NAME_OR | ( | node_id, | |
| name, | |||
| default_value | |||
| ) |
#include <include/zephyr/devicetree.h>
Like DT_REG_ADDR_BY_NAME(), but with a fallback to default_value.
| node_id | node identifier |
| name | lowercase-and-underscores register specifier name |
| default_value | a fallback value to expand to |
default_value otherwise | #define DT_REG_ADDR_BY_NAME_U64 | ( | node_id, | |
| name | |||
| ) | DT_U64_C(DT_CAT4(node_id, _REG_NAME_, name, _VAL_ADDRESS)) |
#include <include/zephyr/devicetree.h>
64-bit version of DT_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_REG_ADDR_BY_NAME() in linker/ASM context.
| node_id | node identifier |
| name | lowercase-and-underscores register specifier name |
| #define DT_REG_ADDR_RAW | ( | node_id | ) | DT_REG_ADDR_BY_IDX_RAW(node_id, 0) |
#include <include/zephyr/devicetree.h>
Get a node's (only) register block raw address.
Get a node's only register block address without any type suffix. This can be used to index other devicetree properties, use the non _RAW macros for assigning values in actual code.
Equivalent to DT_REG_ADDR_BY_IDX_RAW(node_id, 0).
| node_id | node identifier |
| #define DT_REG_ADDR_U64 | ( | node_id | ) | DT_U64_C(DT_REG_ADDR_BY_IDX_RAW(node_id, 0)) |
#include <include/zephyr/devicetree.h>
64-bit version of DT_REG_ADDR()
This macro version adds the appropriate suffix for 64-bit unsigned integer literals. Note that this macro is equivalent to DT_REG_ADDR() in linker/ASM context.
| node_id | node identifier |
| #define DT_REG_HAS_IDX | ( | node_id, | |
| idx | |||
| ) | IS_ENABLED(DT_CAT4(node_id, _REG_IDX_, idx, _EXISTS)) |
#include <include/zephyr/devicetree.h>
Is idx a valid register block index?
If this returns 1, then DT_REG_ADDR_BY_IDX(node_id, idx) or DT_REG_SIZE_BY_IDX(node_id, idx) are valid. If it returns 0, it is an error to use those macros with index idx.
| node_id | node identifier |
| idx | index to check |
idx is a valid register block index, 0 otherwise. | #define DT_REG_HAS_NAME | ( | node_id, | |
| name | |||
| ) | IS_ENABLED(DT_CAT4(node_id, _REG_NAME_, name, _EXISTS)) |
#include <include/zephyr/devicetree.h>
Is name a valid register block name?
If this returns 1, then DT_REG_ADDR_BY_NAME(node_id, name) or DT_REG_SIZE_BY_NAME(node_id, name) are valid. If it returns 0, it is an error to use those macros with name name.
| node_id | node identifier |
| name | name to check |
name is a valid register block name, 0 otherwise. | #define DT_REG_SIZE | ( | node_id | ) | DT_REG_SIZE_BY_IDX(node_id, 0) |
#include <include/zephyr/devicetree.h>
Get a node's (only) register block size.
Equivalent to DT_REG_SIZE_BY_IDX(node_id, 0).
| node_id | node identifier |
| #define DT_REG_SIZE_BY_IDX | ( | node_id, | |
| idx | |||
| ) | DT_U32_C(DT_CAT4(node_id, _REG_IDX_, idx, _VAL_SIZE)) |
#include <include/zephyr/devicetree.h>
Get the size of the register block at index idx.
This is the size of an individual register block, not the total number of register blocks in the property; use DT_NUM_REGS() for that.
| node_id | node identifier |
| idx | index of the register whose size to return |
| #define DT_REG_SIZE_BY_NAME | ( | node_id, | |
| name | |||
| ) | DT_U32_C(DT_CAT4(node_id, _REG_NAME_, name, _VAL_SIZE)) |
#include <include/zephyr/devicetree.h>
Get a register block's size by name.
| node_id | node identifier |
| name | lowercase-and-underscores register specifier name |
| #define DT_REG_SIZE_BY_NAME_OR | ( | node_id, | |
| name, | |||
| default_value | |||
| ) |
#include <include/zephyr/devicetree.h>
Like DT_REG_SIZE_BY_NAME(), but with a fallback to default_value.
| node_id | node identifier |
| name | lowercase-and-underscores register specifier name |
| default_value | a fallback value to expand to |
default_value otherwise