16#ifndef ZEPHYR_INCLUDE_DEVICETREE_H_
17#define ZEPHYR_INCLUDE_DEVICETREE_H_
19#include <zephyr/devicetree_generated.h>
22#if !defined(_LINKER) && !defined(_ASMLANGUAGE)
83#define DT_INVALID_NODE _
140#define DT_PATH(...) DT_PATH_INTERNAL(__VA_ARGS__)
196#define DT_NODELABEL(label) DT_CAT(DT_N_NODELABEL_, label)
236#define DT_ALIAS(alias) DT_CAT(DT_N_ALIAS_, alias)
243#define DT_HAS_ALIAS(alias_name) DT_NODE_EXISTS(DT_ALIAS(alias_name))
339#define DT_INST(inst, compat) UTIL_CAT(DT_N_INST, DT_DASH(inst, compat))
364#define DT_PARENT(node_id) DT_CAT(node_id, _PARENT)
389#define DT_GPARENT(node_id) DT_PARENT(DT_PARENT(node_id))
426#define DT_CHILD(node_id, child) UTIL_CAT(node_id, DT_S_PREFIX(child))
469#define DT_COMPAT_GET_ANY_STATUS_OKAY(compat) \
470 COND_CODE_1(DT_HAS_COMPAT_STATUS_OKAY(compat), \
471 (DT_INST(0, compat)), \
501#define DT_NODE_PATH(node_id) DT_CAT(node_id, _PATH)
527#define DT_NODE_FULL_NAME(node_id) DT_CAT(node_id, _FULL_NAME)
555#define DT_NODE_FULL_NAME_UNQUOTED(node_id) DT_CAT(node_id, _FULL_NAME_UNQUOTED)
583#define DT_NODE_FULL_NAME_TOKEN(node_id) DT_CAT(node_id, _FULL_NAME_TOKEN)
613#define DT_NODE_FULL_NAME_UPPER_TOKEN(node_id) DT_CAT(node_id, _FULL_NAME_UPPER_TOKEN)
641#define DT_NODE_CHILD_IDX(node_id) DT_CAT(node_id, _CHILD_IDX)
649#define DT_CHILD_NUM(node_id) DT_CAT(node_id, _CHILD_NUM)
659#define DT_CHILD_NUM_STATUS_OKAY(node_id) \
660 DT_CAT(node_id, _CHILD_NUM_STATUS_OKAY)
682#define DT_SAME_NODE(node_id1, node_id2) \
683 (DT_DEP_ORD(node_id1) == (DT_DEP_ORD(node_id2)))
709#define DT_NODELABEL_STRING_ARRAY(node_id) \
710 { DT_FOREACH_NODELABEL(node_id, DT_NODELABEL_STRING_ARRAY_ENTRY_INTERNAL) }
752#define DT_PROP(node_id, prop) DT_CAT3(node_id, _P_, prop)
786#define DT_PROP_LEN(node_id, prop) DT_CAT4(node_id, _P_, prop, _LEN)
802#define DT_PROP_LEN_OR(node_id, prop, default_value) \
803 COND_CODE_1(DT_NODE_HAS_PROP(node_id, prop), \
804 (DT_PROP_LEN(node_id, prop)), (default_value))
826#define DT_PROP_HAS_IDX(node_id, prop, idx) \
827 IS_ENABLED(DT_CAT6(node_id, _P_, prop, _IDX_, idx, _EXISTS))
861#define DT_PROP_HAS_NAME(node_id, prop, name) \
862 IS_ENABLED(DT_CAT6(node_id, _P_, prop, _NAME_, name, _EXISTS))
898#define DT_PROP_BY_IDX(node_id, prop, idx) \
899 DT_CAT5(node_id, _P_, prop, _IDX_, idx)
914#define DT_PROP_OR(node_id, prop, default_value) \
915 COND_CODE_1(DT_NODE_HAS_PROP(node_id, prop), \
916 (DT_PROP(node_id, prop)), (default_value))
973#define DT_ENUM_IDX_BY_IDX(node_id, prop, idx) \
974 DT_CAT6(node_id, _P_, prop, _IDX_, idx, _ENUM_IDX)
982#define DT_ENUM_IDX(node_id, prop) DT_ENUM_IDX_BY_IDX(node_id, prop, 0)
999#define DT_ENUM_IDX_BY_IDX_OR(node_id, prop, idx, default_idx_value) \
1000 COND_CODE_1(DT_PROP_HAS_IDX(node_id, prop, idx), \
1001 (DT_ENUM_IDX_BY_IDX(node_id, prop, idx)), (default_idx_value))
1011#define DT_ENUM_IDX_OR(node_id, prop, default_idx_value) \
1012 DT_ENUM_IDX_BY_IDX_OR(node_id, prop, 0, default_idx_value)
1023#define DT_ENUM_HAS_VALUE_BY_IDX(node_id, prop, idx, value) \
1024 IS_ENABLED(DT_CAT8(node_id, _P_, prop, _IDX_, idx, _ENUM_VAL_, value, _EXISTS))
1033#define DT_ENUM_HAS_VALUE(node_id, prop, value) \
1034 DT_ENUM_HAS_VALUE_BY_IDX(node_id, prop, 0, value)
1095#define DT_STRING_TOKEN(node_id, prop) \
1096 DT_CAT4(node_id, _P_, prop, _STRING_TOKEN)
1111#define DT_STRING_TOKEN_OR(node_id, prop, default_value) \
1112 COND_CODE_1(DT_NODE_HAS_PROP(node_id, prop), \
1113 (DT_STRING_TOKEN(node_id, prop)), (default_value))
1172#define DT_STRING_UPPER_TOKEN(node_id, prop) \
1173 DT_CAT4(node_id, _P_, prop, _STRING_UPPER_TOKEN)
1189#define DT_STRING_UPPER_TOKEN_OR(node_id, prop, default_value) \
1190 COND_CODE_1(DT_NODE_HAS_PROP(node_id, prop), \
1191 (DT_STRING_UPPER_TOKEN(node_id, prop)), (default_value))
1233#define DT_STRING_UNQUOTED(node_id, prop) \
1234 DT_CAT4(node_id, _P_, prop, _STRING_UNQUOTED)
1250#define DT_STRING_UNQUOTED_OR(node_id, prop, default_value) \
1251 COND_CODE_1(DT_NODE_HAS_PROP(node_id, prop), \
1252 (DT_STRING_UNQUOTED(node_id, prop)), (default_value))
1301#define DT_STRING_TOKEN_BY_IDX(node_id, prop, idx) \
1302 DT_CAT6(node_id, _P_, prop, _IDX_, idx, _STRING_TOKEN)
1351#define DT_STRING_UPPER_TOKEN_BY_IDX(node_id, prop, idx) \
1352 DT_CAT6(node_id, _P_, prop, _IDX_, idx, _STRING_UPPER_TOKEN)
1394#define DT_STRING_UNQUOTED_BY_IDX(node_id, prop, idx) \
1395 DT_CAT6(node_id, _P_, prop, _IDX_, idx, _STRING_UNQUOTED)
1450#define DT_PROP_BY_PHANDLE_IDX(node_id, phs, idx, prop) \
1451 DT_PROP(DT_PHANDLE_BY_IDX(node_id, phs, idx), prop)
1472#define DT_PROP_BY_PHANDLE_IDX_OR(node_id, phs, idx, prop, default_value) \
1473 DT_PROP_OR(DT_PHANDLE_BY_IDX(node_id, phs, idx), prop, default_value)
1486#define DT_PROP_BY_PHANDLE(node_id, ph, prop) \
1487 DT_PROP_BY_PHANDLE_IDX(node_id, ph, 0, prop)
1543#define DT_PHA_BY_IDX(node_id, pha, idx, cell) \
1544 DT_CAT7(node_id, _P_, pha, _IDX_, idx, _VAL_, cell)
1569#define DT_PHA_BY_IDX_OR(node_id, pha, idx, cell, default_value) \
1570 DT_PROP_OR(node_id, DT_CAT5(pha, _IDX_, idx, _VAL_, cell), default_value)
1579#define DT_PHA(node_id, pha, cell) DT_PHA_BY_IDX(node_id, pha, 0, cell)
1595#define DT_PHA_OR(node_id, pha, cell, default_value) \
1596 DT_PHA_BY_IDX_OR(node_id, pha, 0, cell, default_value)
1638#define DT_PHA_BY_NAME(node_id, pha, name, cell) \
1639 DT_CAT7(node_id, _P_, pha, _NAME_, name, _VAL_, cell)
1662#define DT_PHA_BY_NAME_OR(node_id, pha, name, cell, default_value) \
1663 DT_PROP_OR(node_id, DT_CAT5(pha, _NAME_, name, _VAL_, cell), default_value)
1712#define DT_PHANDLE_BY_NAME(node_id, pha, name) \
1713 DT_CAT6(node_id, _P_, pha, _NAME_, name, _PH)
1764#define DT_PHANDLE_BY_IDX(node_id, prop, idx) \
1765 DT_CAT6(node_id, _P_, prop, _IDX_, idx, _PH)
1778#define DT_PHANDLE(node_id, prop) DT_PHANDLE_BY_IDX(node_id, prop, 0)
1826#define DT_NUM_RANGES(node_id) DT_CAT(node_id, _RANGES_NUM)
1880#define DT_RANGES_HAS_IDX(node_id, idx) \
1881 IS_ENABLED(DT_CAT4(node_id, _RANGES_IDX_, idx, _EXISTS))
1935#define DT_RANGES_HAS_CHILD_BUS_FLAGS_AT_IDX(node_id, idx) \
1936 IS_ENABLED(DT_CAT4(node_id, _RANGES_IDX_, idx, _VAL_CHILD_BUS_FLAGS_EXISTS))
1975#define DT_RANGES_CHILD_BUS_FLAGS_BY_IDX(node_id, idx) \
1976 DT_CAT4(node_id, _RANGES_IDX_, idx, _VAL_CHILD_BUS_FLAGS)
2024#define DT_RANGES_CHILD_BUS_ADDRESS_BY_IDX(node_id, idx) \
2025 DT_CAT4(node_id, _RANGES_IDX_, idx, _VAL_CHILD_BUS_ADDRESS)
2073#define DT_RANGES_PARENT_BUS_ADDRESS_BY_IDX(node_id, idx) \
2074 DT_CAT4(node_id, _RANGES_IDX_, idx, _VAL_PARENT_BUS_ADDRESS)
2122#define DT_RANGES_LENGTH_BY_IDX(node_id, idx) \
2123 DT_CAT4(node_id, _RANGES_IDX_, idx, _VAL_LENGTH)
2164#define DT_FOREACH_RANGE(node_id, fn) \
2165 DT_CAT(node_id, _FOREACH_RANGE)(fn)
2212#define DT_NODE_VENDOR_BY_IDX(node_id, idx) \
2213 DT_CAT3(node_id, _COMPAT_VENDOR_IDX_, idx)
2227#define DT_NODE_VENDOR_HAS_IDX(node_id, idx) \
2228 IS_ENABLED(DT_CAT4(node_id, _COMPAT_VENDOR_IDX_, idx, _EXISTS))
2244#define DT_NODE_VENDOR_BY_IDX_OR(node_id, idx, default_value) \
2245 COND_CODE_1(DT_NODE_VENDOR_HAS_IDX(node_id, idx), \
2246 (DT_NODE_VENDOR_BY_IDX(node_id, idx)), (default_value))
2256#define DT_NODE_VENDOR_OR(node_id, default_value) \
2257 DT_NODE_VENDOR_BY_IDX_OR(node_id, 0, default_value)
2288#define DT_NODE_MODEL_BY_IDX(node_id, idx) \
2289 DT_CAT3(node_id, _COMPAT_MODEL_IDX_, idx)
2303#define DT_NODE_MODEL_HAS_IDX(node_id, idx) \
2304 IS_ENABLED(DT_CAT4(node_id, _COMPAT_MODEL_IDX_, idx, _EXISTS))
2320#define DT_NODE_MODEL_BY_IDX_OR(node_id, idx, default_value) \
2321 COND_CODE_1(DT_NODE_MODEL_HAS_IDX(node_id, idx), \
2322 (DT_NODE_MODEL_BY_IDX(node_id, idx)), (default_value))
2332#define DT_NODE_MODEL_OR(node_id, default_value) \
2333 DT_NODE_MODEL_BY_IDX_OR(node_id, 0, default_value)
2352#define DT_NUM_REGS(node_id) DT_CAT(node_id, _REG_NUM)
2365#define DT_REG_HAS_IDX(node_id, idx) \
2366 IS_ENABLED(DT_CAT4(node_id, _REG_IDX_, idx, _EXISTS))
2379#define DT_REG_HAS_NAME(node_id, name) \
2380 IS_ENABLED(DT_CAT4(node_id, _REG_NAME_, name, _EXISTS))
2393#define DT_REG_ADDR_BY_IDX_RAW(node_id, idx) \
2394 DT_CAT4(node_id, _REG_IDX_, idx, _VAL_ADDRESS)
2407#define DT_REG_ADDR_RAW(node_id) \
2408 DT_REG_ADDR_BY_IDX_RAW(node_id, 0)
2416#define DT_REG_ADDR_BY_IDX(node_id, idx) \
2417 DT_U32_C(DT_REG_ADDR_BY_IDX_RAW(node_id, idx))
2430#define DT_REG_SIZE_BY_IDX(node_id, idx) \
2431 DT_U32_C(DT_CAT4(node_id, _REG_IDX_, idx, _VAL_SIZE))
2440#define DT_REG_ADDR(node_id) DT_REG_ADDR_BY_IDX(node_id, 0)
2452#define DT_REG_ADDR_U64(node_id) DT_U64_C(DT_REG_ADDR_BY_IDX_RAW(node_id, 0))
2461#define DT_REG_SIZE(node_id) DT_REG_SIZE_BY_IDX(node_id, 0)
2469#define DT_REG_ADDR_BY_NAME(node_id, name) \
2470 DT_U32_C(DT_CAT4(node_id, _REG_NAME_, name, _VAL_ADDRESS))
2480#define DT_REG_ADDR_BY_NAME_OR(node_id, name, default_value) \
2481 COND_CODE_1(DT_REG_HAS_NAME(node_id, name), \
2482 (DT_REG_ADDR_BY_NAME(node_id, name)), (default_value))
2496#define DT_REG_ADDR_BY_NAME_U64(node_id, name) \
2497 DT_U64_C(DT_CAT4(node_id, _REG_NAME_, name, _VAL_ADDRESS))
2505#define DT_REG_SIZE_BY_NAME(node_id, name) \
2506 DT_U32_C(DT_CAT4(node_id, _REG_NAME_, name, _VAL_SIZE))
2516#define DT_REG_SIZE_BY_NAME_OR(node_id, name, default_value) \
2517 COND_CODE_1(DT_REG_HAS_NAME(node_id, name), \
2518 (DT_REG_SIZE_BY_NAME(node_id, name)), (default_value))
2539#define DT_NUM_IRQS(node_id) DT_CAT(node_id, _IRQ_NUM)
2565#define DT_NUM_NODELABELS(node_id) DT_CAT(node_id, _NODELABEL_NUM)
2573#define DT_IRQ_LEVEL(node_id) DT_CAT(node_id, _IRQ_LEVEL)
2585#define DT_IRQ_HAS_IDX(node_id, idx) \
2586 IS_ENABLED(DT_CAT4(node_id, _IRQ_IDX_, idx, _EXISTS))
2598#define DT_IRQ_HAS_CELL_AT_IDX(node_id, idx, cell) \
2599 IS_ENABLED(DT_CAT6(node_id, _IRQ_IDX_, idx, _VAL_, cell, _EXISTS))
2608#define DT_IRQ_HAS_CELL(node_id, cell) DT_IRQ_HAS_CELL_AT_IDX(node_id, 0, cell)
2619#define DT_IRQ_HAS_NAME(node_id, name) \
2620 IS_ENABLED(DT_CAT4(node_id, _IRQ_NAME_, name, _VAL_irq_EXISTS))
2657#define DT_IRQ_BY_IDX(node_id, idx, cell) \
2658 DT_CAT5(node_id, _IRQ_IDX_, idx, _VAL_, cell)
2675#define DT_IRQ_BY_NAME(node_id, name, cell) \
2676 DT_CAT5(node_id, _IRQ_NAME_, name, _VAL_, cell)
2685#define DT_IRQ(node_id, cell) DT_IRQ_BY_IDX(node_id, 0, cell)
2729#define DT_IRQ_INTC_BY_IDX(node_id, idx) \
2730 DT_CAT4(node_id, _IRQ_IDX_, idx, _CONTROLLER)
2776#define DT_IRQ_INTC_BY_NAME(node_id, name) \
2777 DT_CAT4(node_id, _IRQ_NAME_, name, _CONTROLLER)
2818#define DT_IRQ_INTC(node_id) \
2819 DT_IRQ_INTC_BY_IDX(node_id, 0)
2826#define DT_IRQN_L1_INTERNAL(node_id, idx) DT_IRQ_BY_IDX(node_id, idx, irq)
2828#define DT_IRQN_L2_INTERNAL(node_id, idx) \
2829 (IRQ_TO_L2(DT_IRQN_L1_INTERNAL(node_id, idx)) | \
2830 DT_IRQ(DT_IRQ_INTC_BY_IDX(node_id, idx), irq))
2832#define DT_IRQN_L3_INTERNAL(node_id, idx) \
2833 (IRQ_TO_L3(DT_IRQN_L1_INTERNAL(node_id, idx)) | \
2834 IRQ_TO_L2(DT_IRQ(DT_IRQ_INTC_BY_IDX(node_id, idx), irq)) | \
2835 DT_IRQ(DT_IRQ_INTC(DT_IRQ_INTC_BY_IDX(node_id, idx)), irq))
2837#define DT_IRQN_LVL_INTERNAL(node_id, idx, level) DT_CAT3(DT_IRQN_L, level, _INTERNAL)(node_id, idx)
2843#define DT_MULTI_LEVEL_IRQN_INTERNAL(node_id, idx) \
2844 DT_IRQN_LVL_INTERNAL(node_id, idx, DT_IRQ_LEVEL(node_id))
2858#define DT_IRQN_BY_IDX(node_id, idx) \
2859 COND_CODE_1(IS_ENABLED(CONFIG_MULTI_LEVEL_INTERRUPTS), \
2860 (DT_MULTI_LEVEL_IRQN_INTERNAL(node_id, idx)), \
2861 (DT_IRQ_BY_IDX(node_id, idx, irq)))
2873#define DT_IRQN(node_id) DT_IRQN_BY_IDX(node_id, 0)
2893#define DT_CHOSEN(prop) DT_CAT(DT_CHOSEN_, prop)
2901#define DT_HAS_CHOSEN(prop) IS_ENABLED(DT_CAT3(DT_CHOSEN_, prop, _EXISTS))
2922#define DT_FOREACH_NODE(fn) DT_FOREACH_HELPER(fn)
2936#define DT_FOREACH_NODE_VARGS(fn, ...) DT_FOREACH_VARGS_HELPER(fn, __VA_ARGS__)
2949#define DT_FOREACH_STATUS_OKAY_NODE(fn) DT_FOREACH_OKAY_HELPER(fn)
2965#define DT_FOREACH_STATUS_OKAY_NODE_VARGS(fn, ...) DT_FOREACH_OKAY_VARGS_HELPER(fn, __VA_ARGS__)
3010#define DT_FOREACH_CHILD(node_id, fn) \
3011 DT_CAT(node_id, _FOREACH_CHILD)(fn)
3053#define DT_FOREACH_CHILD_SEP(node_id, fn, sep) \
3054 DT_CAT(node_id, _FOREACH_CHILD_SEP)(fn, sep)
3071#define DT_FOREACH_CHILD_VARGS(node_id, fn, ...) \
3072 DT_CAT(node_id, _FOREACH_CHILD_VARGS)(fn, __VA_ARGS__)
3089#define DT_FOREACH_CHILD_SEP_VARGS(node_id, fn, sep, ...) \
3090 DT_CAT(node_id, _FOREACH_CHILD_SEP_VARGS)(fn, sep, __VA_ARGS__)
3107#define DT_FOREACH_CHILD_STATUS_OKAY(node_id, fn) \
3108 DT_CAT(node_id, _FOREACH_CHILD_STATUS_OKAY)(fn)
3126#define DT_FOREACH_CHILD_STATUS_OKAY_SEP(node_id, fn, sep) \
3127 DT_CAT(node_id, _FOREACH_CHILD_STATUS_OKAY_SEP)(fn, sep)
3148#define DT_FOREACH_CHILD_STATUS_OKAY_VARGS(node_id, fn, ...) \
3149 DT_CAT(node_id, _FOREACH_CHILD_STATUS_OKAY_VARGS)(fn, __VA_ARGS__)
3169#define DT_FOREACH_CHILD_STATUS_OKAY_SEP_VARGS(node_id, fn, sep, ...) \
3170 DT_CAT(node_id, _FOREACH_CHILD_STATUS_OKAY_SEP_VARGS)(fn, sep, __VA_ARGS__)
3222#define DT_FOREACH_PROP_ELEM(node_id, prop, fn) \
3223 DT_CAT4(node_id, _P_, prop, _FOREACH_PROP_ELEM)(fn)
3267#define DT_FOREACH_PROP_ELEM_SEP(node_id, prop, fn, sep) \
3268 DT_CAT4(node_id, _P_, prop, _FOREACH_PROP_ELEM_SEP)(fn, sep)
3290#define DT_FOREACH_PROP_ELEM_VARGS(node_id, prop, fn, ...) \
3291 DT_CAT4(node_id, _P_, prop, _FOREACH_PROP_ELEM_VARGS)(fn, __VA_ARGS__)
3309#define DT_FOREACH_PROP_ELEM_SEP_VARGS(node_id, prop, fn, sep, ...) \
3310 DT_CAT4(node_id, _P_, prop, _FOREACH_PROP_ELEM_SEP_VARGS)( \
3311 fn, sep, __VA_ARGS__)
3366#define DT_FOREACH_STATUS_OKAY(compat, fn) \
3367 COND_CODE_1(DT_HAS_COMPAT_STATUS_OKAY(compat), \
3368 (UTIL_CAT(DT_FOREACH_OKAY_, compat)(fn)), \
3415#define DT_FOREACH_STATUS_OKAY_VARGS(compat, fn, ...) \
3416 COND_CODE_1(DT_HAS_COMPAT_STATUS_OKAY(compat), \
3417 (DT_CAT(DT_FOREACH_OKAY_VARGS_, \
3418 compat)(fn, __VA_ARGS__)), \
3433#define DT_COMPAT_FOREACH_STATUS_OKAY_VARGS(compat, fn, ...) \
3434 COND_CODE_1(DT_HAS_COMPAT_STATUS_OKAY(compat), \
3435 (UTIL_CAT(DT_FOREACH_OKAY_INST_VARGS_, \
3436 compat)(fn, compat, __VA_ARGS__)), \
3478#define DT_FOREACH_NODELABEL(node_id, fn) DT_CAT(node_id, _FOREACH_NODELABEL)(fn)
3517#define DT_FOREACH_NODELABEL_VARGS(node_id, fn, ...) \
3518 DT_CAT(node_id, _FOREACH_NODELABEL_VARGS)(fn, __VA_ARGS__)
3544#define DT_NODE_EXISTS(node_id) IS_ENABLED(DT_CAT(node_id, _EXISTS))
3567#define DT_NODE_HAS_STATUS(node_id, status) \
3568 DT_NODE_HAS_STATUS_INTERNAL(node_id, status)
3590#define DT_NODE_HAS_STATUS_OKAY(node_id) DT_NODE_HAS_STATUS(node_id, okay)
3611#define DT_HAS_COMPAT_STATUS_OKAY(compat) \
3612 IS_ENABLED(DT_CAT(DT_COMPAT_HAS_OKAY_, compat))
3620#define DT_NUM_INST_STATUS_OKAY(compat) \
3621 UTIL_AND(DT_HAS_COMPAT_STATUS_OKAY(compat), \
3622 UTIL_CAT(DT_N_INST, DT_DASH(compat, NUM_OKAY)))
3651#define DT_NODE_HAS_COMPAT(node_id, compat) \
3652 IS_ENABLED(DT_CAT3(node_id, _COMPAT_MATCHES_, compat))
3668#define DT_NODE_HAS_COMPAT_STATUS(node_id, compat, status) \
3669 UTIL_AND(DT_NODE_HAS_COMPAT(node_id, compat), DT_NODE_HAS_STATUS(node_id, status))
3684#define DT_NODE_HAS_PROP(node_id, prop) \
3685 IS_ENABLED(DT_CAT4(node_id, _P_, prop, _EXISTS))
3704#define DT_PHA_HAS_CELL_AT_IDX(node_id, pha, idx, cell) \
3705 IS_ENABLED(DT_CAT8(node_id, _P_, pha, \
3706 _IDX_, idx, _VAL_, cell, _EXISTS))
3717#define DT_PHA_HAS_CELL(node_id, pha, cell) \
3718 DT_PHA_HAS_CELL_AT_IDX(node_id, pha, 0, cell)
3761#define DT_BUS(node_id) DT_CAT(node_id, _BUS)
3791#define DT_ON_BUS(node_id, bus) IS_ENABLED(DT_CAT3(node_id, _BUS_, bus))
3809#define DT_DRV_INST(inst) DT_INST(inst, DT_DRV_COMPAT)
3818#define DT_INST_PARENT(inst) DT_PARENT(DT_DRV_INST(inst))
3827#define DT_INST_GPARENT(inst) DT_GPARENT(DT_DRV_INST(inst))
3838#define DT_INST_CHILD(inst, child) \
3839 DT_CHILD(DT_DRV_INST(inst), child)
3850#define DT_INST_CHILD_NUM(inst) DT_CHILD_NUM(DT_DRV_INST(inst))
3861#define DT_INST_CHILD_NUM_STATUS_OKAY(inst) \
3862 DT_CHILD_NUM_STATUS_OKAY(DT_DRV_INST(inst))
3872#define DT_INST_NODELABEL_STRING_ARRAY(inst) DT_NODELABEL_STRING_ARRAY(DT_DRV_INST(inst))
3882#define DT_INST_NUM_NODELABELS(inst) DT_NUM_NODELABELS(DT_DRV_INST(inst))
3898#define DT_INST_FOREACH_CHILD(inst, fn) \
3899 DT_FOREACH_CHILD(DT_DRV_INST(inst), fn)
3914#define DT_INST_FOREACH_CHILD_SEP(inst, fn, sep) \
3915 DT_FOREACH_CHILD_SEP(DT_DRV_INST(inst), fn, sep)
3932#define DT_INST_FOREACH_CHILD_VARGS(inst, fn, ...) \
3933 DT_FOREACH_CHILD_VARGS(DT_DRV_INST(inst), fn, __VA_ARGS__)
3949#define DT_INST_FOREACH_CHILD_SEP_VARGS(inst, fn, sep, ...) \
3950 DT_FOREACH_CHILD_SEP_VARGS(DT_DRV_INST(inst), fn, sep, __VA_ARGS__)
3963#define DT_INST_FOREACH_CHILD_STATUS_OKAY(inst, fn) \
3964 DT_FOREACH_CHILD_STATUS_OKAY(DT_DRV_INST(inst), fn)
3980#define DT_INST_FOREACH_CHILD_STATUS_OKAY_SEP(inst, fn, sep) \
3981 DT_FOREACH_CHILD_STATUS_OKAY_SEP(DT_DRV_INST(inst), fn, sep)
3996#define DT_INST_FOREACH_CHILD_STATUS_OKAY_VARGS(inst, fn, ...) \
3997 DT_FOREACH_CHILD_STATUS_OKAY_VARGS(DT_DRV_INST(inst), fn, __VA_ARGS__)
4014#define DT_INST_FOREACH_CHILD_STATUS_OKAY_SEP_VARGS(inst, fn, sep, ...) \
4015 DT_FOREACH_CHILD_STATUS_OKAY_SEP_VARGS(DT_DRV_INST(inst), fn, sep, __VA_ARGS__)
4024#define DT_INST_ENUM_IDX_BY_IDX(inst, prop, idx) \
4025 DT_ENUM_IDX_BY_IDX(DT_DRV_INST(inst), prop, idx)
4033#define DT_INST_ENUM_IDX(inst, prop) \
4034 DT_ENUM_IDX(DT_DRV_INST(inst), prop)
4045#define DT_INST_ENUM_IDX_BY_IDX_OR(inst, prop, idx, default_idx_value) \
4046 DT_ENUM_IDX_BY_IDX_OR(DT_DRV_INST(inst), prop, idx, default_idx_value)
4056#define DT_INST_ENUM_IDX_OR(inst, prop, default_idx_value) \
4057 DT_ENUM_IDX_OR(DT_DRV_INST(inst), prop, default_idx_value)
4067#define DT_INST_ENUM_HAS_VALUE_BY_IDX(inst, prop, idx, value) \
4068 DT_ENUM_HAS_VALUE_BY_IDX(DT_DRV_INST(inst), prop, idx, value)
4078#define DT_INST_ENUM_HAS_VALUE(inst, prop, value) \
4079 DT_ENUM_HAS_VALUE(DT_DRV_INST(inst), prop, value)
4087#define DT_INST_PROP(inst, prop) DT_PROP(DT_DRV_INST(inst), prop)
4095#define DT_INST_PROP_LEN(inst, prop) DT_PROP_LEN(DT_DRV_INST(inst), prop)
4106#define DT_INST_PROP_HAS_IDX(inst, prop, idx) \
4107 DT_PROP_HAS_IDX(DT_DRV_INST(inst), prop, idx)
4117#define DT_INST_PROP_HAS_NAME(inst, prop, name) \
4118 DT_PROP_HAS_NAME(DT_DRV_INST(inst), prop, name)
4127#define DT_INST_PROP_BY_IDX(inst, prop, idx) \
4128 DT_PROP_BY_IDX(DT_DRV_INST(inst), prop, idx)
4137#define DT_INST_PROP_OR(inst, prop, default_value) \
4138 DT_PROP_OR(DT_DRV_INST(inst), prop, default_value)
4147#define DT_INST_PROP_LEN_OR(inst, prop, default_value) \
4148 DT_PROP_LEN_OR(DT_DRV_INST(inst), prop, default_value)
4159#define DT_INST_STRING_TOKEN(inst, prop) \
4160 DT_STRING_TOKEN(DT_DRV_INST(inst), prop)
4169#define DT_INST_STRING_UPPER_TOKEN(inst, prop) \
4170 DT_STRING_UPPER_TOKEN(DT_DRV_INST(inst), prop)
4180#define DT_INST_STRING_UNQUOTED(inst, prop) \
4181 DT_STRING_UNQUOTED(DT_DRV_INST(inst), prop)
4190#define DT_INST_STRING_TOKEN_BY_IDX(inst, prop, idx) \
4191 DT_STRING_TOKEN_BY_IDX(DT_DRV_INST(inst), prop, idx)
4200#define DT_INST_STRING_UPPER_TOKEN_BY_IDX(inst, prop, idx) \
4201 DT_STRING_UPPER_TOKEN_BY_IDX(DT_DRV_INST(inst), prop, idx)
4210#define DT_INST_STRING_UNQUOTED_BY_IDX(inst, prop, idx) \
4211 DT_STRING_UNQUOTED_BY_IDX(DT_DRV_INST(inst), prop, idx)
4221#define DT_INST_PROP_BY_PHANDLE(inst, ph, prop) \
4222 DT_INST_PROP_BY_PHANDLE_IDX(inst, ph, 0, prop)
4235#define DT_INST_PROP_BY_PHANDLE_IDX(inst, phs, idx, prop) \
4236 DT_PROP_BY_PHANDLE_IDX(DT_DRV_INST(inst), phs, idx, prop)
4246#define DT_INST_PHA_BY_IDX(inst, pha, idx, cell) \
4247 DT_PHA_BY_IDX(DT_DRV_INST(inst), pha, idx, cell)
4258#define DT_INST_PHA_BY_IDX_OR(inst, pha, idx, cell, default_value) \
4259 DT_PHA_BY_IDX_OR(DT_DRV_INST(inst), pha, idx, cell, default_value)
4269#define DT_INST_PHA(inst, pha, cell) DT_INST_PHA_BY_IDX(inst, pha, 0, cell)
4279#define DT_INST_PHA_OR(inst, pha, cell, default_value) \
4280 DT_INST_PHA_BY_IDX_OR(inst, pha, 0, cell, default_value)
4291#define DT_INST_PHA_BY_NAME(inst, pha, name, cell) \
4292 DT_PHA_BY_NAME(DT_DRV_INST(inst), pha, name, cell)
4303#define DT_INST_PHA_BY_NAME_OR(inst, pha, name, cell, default_value) \
4304 DT_PHA_BY_NAME_OR(DT_DRV_INST(inst), pha, name, cell, default_value)
4314#define DT_INST_PHANDLE_BY_NAME(inst, pha, name) \
4315 DT_PHANDLE_BY_NAME(DT_DRV_INST(inst), pha, name) \
4326#define DT_INST_PHANDLE_BY_IDX(inst, prop, idx) \
4327 DT_PHANDLE_BY_IDX(DT_DRV_INST(inst), prop, idx)
4337#define DT_INST_PHANDLE(inst, prop) DT_INST_PHANDLE_BY_IDX(inst, prop, 0)
4346#define DT_INST_REG_HAS_IDX(inst, idx) DT_REG_HAS_IDX(DT_DRV_INST(inst), idx)
4355#define DT_INST_REG_HAS_NAME(inst, name) DT_REG_HAS_NAME(DT_DRV_INST(inst), name)
4363#define DT_INST_REG_ADDR_BY_IDX_RAW(inst, idx) DT_REG_ADDR_BY_IDX_RAW(DT_DRV_INST(inst), idx)
4371#define DT_INST_REG_ADDR_BY_IDX(inst, idx) DT_REG_ADDR_BY_IDX(DT_DRV_INST(inst), idx)
4379#define DT_INST_REG_SIZE_BY_IDX(inst, idx) \
4380 DT_REG_SIZE_BY_IDX(DT_DRV_INST(inst), idx)
4388#define DT_INST_REG_ADDR_BY_NAME(inst, name) \
4389 DT_REG_ADDR_BY_NAME(DT_DRV_INST(inst), name)
4399#define DT_INST_REG_ADDR_BY_NAME_OR(inst, name, default_value) \
4400 DT_REG_ADDR_BY_NAME_OR(DT_DRV_INST(inst), name, default_value)
4414#define DT_INST_REG_ADDR_BY_NAME_U64(inst, name) \
4415 DT_REG_ADDR_BY_NAME_U64(DT_DRV_INST(inst), name)
4423#define DT_INST_REG_SIZE_BY_NAME(inst, name) \
4424 DT_REG_SIZE_BY_NAME(DT_DRV_INST(inst), name)
4434#define DT_INST_REG_SIZE_BY_NAME_OR(inst, name, default_value) \
4435 DT_REG_SIZE_BY_NAME_OR(DT_DRV_INST(inst), name, default_value)
4442#define DT_INST_REG_ADDR_RAW(inst) DT_INST_REG_ADDR_BY_IDX_RAW(inst, 0)
4449#define DT_INST_REG_ADDR(inst) DT_INST_REG_ADDR_BY_IDX(inst, 0)
4462#define DT_INST_REG_ADDR_U64(inst) DT_REG_ADDR_U64(DT_DRV_INST(inst))
4469#define DT_INST_REG_SIZE(inst) DT_INST_REG_SIZE_BY_IDX(inst, 0)
4477#define DT_INST_NUM_IRQS(inst) DT_NUM_IRQS(DT_DRV_INST(inst))
4485#define DT_INST_IRQ_LEVEL(inst) DT_IRQ_LEVEL(DT_DRV_INST(inst))
4494#define DT_INST_IRQ_BY_IDX(inst, idx, cell) \
4495 DT_IRQ_BY_IDX(DT_DRV_INST(inst), idx, cell)
4503#define DT_INST_IRQ_INTC_BY_IDX(inst, idx) \
4504 DT_IRQ_INTC_BY_IDX(DT_DRV_INST(inst), idx)
4512#define DT_INST_IRQ_INTC_BY_NAME(inst, name) \
4513 DT_IRQ_INTC_BY_NAME(DT_DRV_INST(inst), name)
4522#define DT_INST_IRQ_INTC(inst) \
4523 DT_INST_IRQ_INTC_BY_IDX(inst, 0)
4532#define DT_INST_IRQ_BY_NAME(inst, name, cell) \
4533 DT_IRQ_BY_NAME(DT_DRV_INST(inst), name, cell)
4541#define DT_INST_IRQ(inst, cell) DT_INST_IRQ_BY_IDX(inst, 0, cell)
4548#define DT_INST_IRQN(inst) DT_IRQN(DT_DRV_INST(inst))
4556#define DT_INST_IRQN_BY_IDX(inst, idx) DT_IRQN_BY_IDX(DT_DRV_INST(inst), idx)
4563#define DT_INST_BUS(inst) DT_BUS(DT_DRV_INST(inst))
4572#define DT_INST_ON_BUS(inst, bus) DT_ON_BUS(DT_DRV_INST(inst), bus)
4583#define DT_INST_STRING_TOKEN_OR(inst, name, default_value) \
4584 DT_STRING_TOKEN_OR(DT_DRV_INST(inst), name, default_value)
4594#define DT_INST_STRING_UPPER_TOKEN_OR(inst, name, default_value) \
4595 DT_STRING_UPPER_TOKEN_OR(DT_DRV_INST(inst), name, default_value)
4605#define DT_INST_STRING_UNQUOTED_OR(inst, name, default_value) \
4606 DT_STRING_UNQUOTED_OR(DT_DRV_INST(inst), name, default_value)
4638#define DT_HAS_COMPAT_ON_BUS_STATUS_OKAY(compat, bus) \
4639 IS_ENABLED(DT_CAT4(DT_COMPAT_, compat, _BUS_, bus))
4673#define DT_ANY_INST_ON_BUS_STATUS_OKAY(bus) \
4674 DT_HAS_COMPAT_ON_BUS_STATUS_OKAY(DT_DRV_COMPAT, bus)
4720#define DT_ANY_INST_HAS_PROP_STATUS_OKAY(prop) \
4721 COND_CODE_1(IS_EMPTY(DT_ANY_INST_HAS_PROP_STATUS_OKAY_(prop)), (0), (1))
4767#define DT_ANY_COMPAT_HAS_PROP_STATUS_OKAY(compat, prop) \
4768 (DT_COMPAT_FOREACH_STATUS_OKAY_VARGS(compat, DT_COMPAT_NODE_HAS_PROP_AND_OR, prop) 0)
4835#define DT_INST_FOREACH_STATUS_OKAY(fn) \
4836 COND_CODE_1(DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT), \
4837 (UTIL_CAT(DT_FOREACH_OKAY_INST_, \
4838 DT_DRV_COMPAT)(fn)), \
4853#define DT_INST_FOREACH_STATUS_OKAY_VARGS(fn, ...) \
4854 COND_CODE_1(DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT), \
4855 (UTIL_CAT(DT_FOREACH_OKAY_INST_VARGS_, \
4856 DT_DRV_COMPAT)(fn, __VA_ARGS__)), \
4868#define DT_INST_FOREACH_NODELABEL(inst, fn) \
4869 DT_FOREACH_NODELABEL(DT_DRV_INST(inst), fn)
4882#define DT_INST_FOREACH_NODELABEL_VARGS(inst, fn, ...) \
4883 DT_FOREACH_NODELABEL_VARGS(DT_DRV_INST(inst), fn, __VA_ARGS__)
4895#define DT_INST_FOREACH_PROP_ELEM(inst, prop, fn) \
4896 DT_FOREACH_PROP_ELEM(DT_DRV_INST(inst), prop, fn)
4910#define DT_INST_FOREACH_PROP_ELEM_SEP(inst, prop, fn, sep) \
4911 DT_FOREACH_PROP_ELEM_SEP(DT_DRV_INST(inst), prop, fn, sep)
4927#define DT_INST_FOREACH_PROP_ELEM_VARGS(inst, prop, fn, ...) \
4928 DT_FOREACH_PROP_ELEM_VARGS(DT_DRV_INST(inst), prop, fn, __VA_ARGS__)
4947#define DT_INST_FOREACH_PROP_ELEM_SEP_VARGS(inst, prop, fn, sep, ...) \
4948 DT_FOREACH_PROP_ELEM_SEP_VARGS(DT_DRV_INST(inst), prop, fn, sep, \
4957#define DT_INST_NODE_HAS_PROP(inst, prop) \
4958 DT_NODE_HAS_PROP(DT_DRV_INST(inst), prop)
4966#define DT_INST_NODE_HAS_COMPAT(inst, compat) \
4967 DT_NODE_HAS_COMPAT(DT_DRV_INST(inst), compat)
4979#define DT_INST_PHA_HAS_CELL_AT_IDX(inst, pha, idx, cell) \
4980 DT_PHA_HAS_CELL_AT_IDX(DT_DRV_INST(inst), pha, idx, cell)
4991#define DT_INST_PHA_HAS_CELL(inst, pha, cell) \
4992 DT_INST_PHA_HAS_CELL_AT_IDX(inst, pha, 0, cell)
5001#define DT_INST_IRQ_HAS_IDX(inst, idx) DT_IRQ_HAS_IDX(DT_DRV_INST(inst), idx)
5011#define DT_INST_IRQ_HAS_CELL_AT_IDX(inst, idx, cell) \
5012 DT_IRQ_HAS_CELL_AT_IDX(DT_DRV_INST(inst), idx, cell)
5021#define DT_INST_IRQ_HAS_CELL(inst, cell) \
5022 DT_INST_IRQ_HAS_CELL_AT_IDX(inst, 0, cell)
5030#define DT_INST_IRQ_HAS_NAME(inst, name) \
5031 DT_IRQ_HAS_NAME(DT_DRV_INST(inst), name)
5050#define DT_ANY_INST_HAS_PROP_STATUS_OKAY__(idx, prop) \
5051 COND_CODE_1(DT_INST_NODE_HAS_PROP(idx, prop), (1,), ())
5064#define DT_ANY_INST_HAS_PROP_STATUS_OKAY_(prop) \
5065 DT_INST_FOREACH_STATUS_OKAY_VARGS(DT_ANY_INST_HAS_PROP_STATUS_OKAY__, prop)
5067#define DT_PATH_INTERNAL(...) \
5068 UTIL_CAT(DT_ROOT, MACRO_MAP_CAT(DT_S_PREFIX, __VA_ARGS__))
5074#define DT_S_PREFIX(name) _S_##name
5090#define DT_CAT(a1, a2) a1 ## a2
5092#define DT_CAT3(a1, a2, a3) a1 ## a2 ## a3
5094#define DT_CAT4(a1, a2, a3, a4) a1 ## a2 ## a3 ## a4
5096#define DT_CAT5(a1, a2, a3, a4, a5) a1 ## a2 ## a3 ## a4 ## a5
5098#define DT_CAT6(a1, a2, a3, a4, a5, a6) a1 ## a2 ## a3 ## a4 ## a5 ## a6
5100#define DT_CAT7(a1, a2, a3, a4, a5, a6, a7) \
5101 a1 ## a2 ## a3 ## a4 ## a5 ## a6 ## a7
5103#define DT_CAT8(a1, a2, a3, a4, a5, a6, a7, a8) \
5104 a1 ## a2 ## a3 ## a4 ## a5 ## a6 ## a7 ## a8
5111#define DT_DASH(...) MACRO_MAP_CAT(DT_DASH_PREFIX, __VA_ARGS__)
5113#define DT_DASH_PREFIX(name) _##name
5115#define DT_NODE_HAS_STATUS_INTERNAL(node_id, status) \
5116 IS_ENABLED(DT_CAT3(node_id, _STATUS_, status))
5121#define DT_COMPAT_NODE_HAS_PROP_AND_OR(inst, compat, prop) \
5122 DT_NODE_HAS_PROP(DT_INST(inst, compat), prop) ||
5128#if defined(_LINKER) || defined(_ASMLANGUAGE)
5129#define DT_U32_C(_v) (_v)
5131#define DT_U32_C(_v) UINT32_C(_v)
5138#if defined(_LINKER) || defined(_ASMLANGUAGE)
5139#define DT_U64_C(_v) (_v)
5141#define DT_U64_C(_v) UINT64_C(_v)
5147#define DT_NODELABEL_STRING_ARRAY_ENTRY_INTERNAL(nodelabel) DT_STRINGIFY_INTERNAL(nodelabel),
5148#define DT_STRINGIFY_INTERNAL(arg) DT_STRINGIFY_INTERNAL_HELPER(arg)
5149#define DT_STRINGIFY_INTERNAL_HELPER(arg) #arg
Clocks Devicetree macro public API header file.
CAN devicetree macro public API header file.
DMA Devicetree macro public API header file.
GPIO Devicetree macro public API header file.
MBOX Devicetree macro public API header file.
Devicetree pin control helpers.
Reset Controller Devicetree macro public API header file.
SPI Devicetree macro public API header file.
Flash Devicetree macro public API header file.
IO channels devicetree macro public API header file.
Public interface for multi-level interrupts.
Devicetree node dependency ordinals.
PWMs Devicetree macro public API header file.