19#include <devicetree_unfixed.h>
20#include <devicetree_fixups.h>
76#define DT_INVALID_NODE _
129#define DT_PATH(...) DT_PATH_INTERNAL(__VA_ARGS__)
177#define DT_NODELABEL(label) DT_CAT(DT_N_NODELABEL_, label)
213#define DT_ALIAS(alias) DT_CAT(DT_N_ALIAS_, alias)
305#define DT_INST(inst, compat) UTIL_CAT(DT_N_INST, DT_DASH(inst, compat))
326#define DT_PARENT(node_id) UTIL_CAT(node_id, _PARENT)
347#define DT_GPARENT(node_id) DT_PARENT(DT_PARENT(node_id))
380#define DT_CHILD(node_id, child) UTIL_CAT(node_id, DT_S_PREFIX(child))
418#define DT_COMPAT_GET_ANY_STATUS_OKAY(compat) \
419 COND_CODE_1(DT_HAS_COMPAT_STATUS_OKAY(compat), \
420 (DT_INST(0, compat)), \
446#define DT_NODE_PATH(node_id) DT_CAT(node_id, _PATH)
468#define DT_NODE_FULL_NAME(node_id) DT_CAT(node_id, _FULL_NAME)
485#define DT_SAME_NODE(node_id1, node_id2) \
486 (DT_DEP_ORD(node_id1) == (DT_DEP_ORD(node_id2)))
531#define DT_PROP(node_id, prop) DT_CAT(node_id, _P_##prop)
560#define DT_PROP_LEN(node_id, prop) DT_PROP(node_id, prop##_LEN)
576#define DT_PROP_LEN_OR(node_id, prop, default_value) \
577 COND_CODE_1(DT_NODE_HAS_PROP(node_id, prop), \
578 (DT_PROP_LEN(node_id, prop)), (default_value))
600#define DT_PROP_HAS_IDX(node_id, prop, idx) \
601 IS_ENABLED(DT_CAT6(node_id, _P_, prop, _IDX_, idx, _EXISTS))
625#define DT_PROP_BY_IDX(node_id, prop, idx) DT_PROP(node_id, prop##_IDX_##idx)
640#define DT_PROP_OR(node_id, prop, default_value) \
641 COND_CODE_1(DT_NODE_HAS_PROP(node_id, prop), \
642 (DT_PROP(node_id, prop)), (default_value))
652#define DT_LABEL(node_id) DT_PROP(node_id, label)
688#define DT_ENUM_IDX(node_id, prop) DT_PROP(node_id, prop##_ENUM_IDX)
704#define DT_ENUM_IDX_OR(node_id, prop, default_idx_value) \
705 COND_CODE_1(DT_NODE_HAS_PROP(node_id, prop), \
706 (DT_ENUM_IDX(node_id, prop)), (default_idx_value))
760#define DT_STRING_TOKEN(node_id, prop) \
761 DT_CAT4(node_id, _P_, prop, _STRING_TOKEN)
812#define DT_STRING_UPPER_TOKEN(node_id, prop) \
813 DT_CAT4(node_id, _P_, prop, _STRING_UPPER_TOKEN)
876#define DT_ENUM_TOKEN(node_id, prop) \
878 DT_CAT4(node_id, _P_, prop, _ENUM_TOKEN)
936#define DT_ENUM_UPPER_TOKEN(node_id, prop) \
938 DT_CAT4(node_id, _P_, prop, _ENUM_UPPER_TOKEN)
987#define DT_PROP_BY_PHANDLE_IDX(node_id, phs, idx, prop) \
988 DT_PROP(DT_PHANDLE_BY_IDX(node_id, phs, idx), prop)
1009#define DT_PROP_BY_PHANDLE_IDX_OR(node_id, phs, idx, prop, default_value) \
1010 DT_PROP_OR(DT_PHANDLE_BY_IDX(node_id, phs, idx), prop, default_value)
1023#define DT_PROP_BY_PHANDLE(node_id, ph, prop) \
1024 DT_PROP_BY_PHANDLE_IDX(node_id, ph, 0, prop)
1074#define DT_PHA_BY_IDX(node_id, pha, idx, cell) \
1075 DT_PROP(node_id, pha##_IDX_##idx##_VAL_##cell)
1094#define DT_PHA_BY_IDX_OR(node_id, pha, idx, cell, default_value) \
1095 DT_PROP_OR(node_id, pha##_IDX_##idx##_VAL_##cell, default_value)
1108#define DT_PHA(node_id, pha, cell) DT_PHA_BY_IDX(node_id, pha, 0, cell)
1124#define DT_PHA_OR(node_id, pha, cell, default_value) \
1125 DT_PHA_BY_IDX_OR(node_id, pha, 0, cell, default_value)
1161#define DT_PHA_BY_NAME(node_id, pha, name, cell) \
1162 DT_PROP(node_id, pha##_NAME_##name##_VAL_##cell)
1179#define DT_PHA_BY_NAME_OR(node_id, pha, name, cell, default_value) \
1180 DT_PROP_OR(node_id, pha##_NAME_##name##_VAL_##cell, default_value)
1229#define DT_PHANDLE_BY_NAME(node_id, pha, name) \
1230 DT_PROP(node_id, pha##_NAME_##name##_PH)
1271#define DT_PHANDLE_BY_IDX(node_id, prop, idx) \
1272 DT_CAT6(node_id, _P_, prop, _IDX_, idx, _PH)
1290#define DT_PHANDLE(node_id, prop) DT_PHANDLE_BY_IDX(node_id, prop, 0)
1309#define DT_NUM_REGS(node_id) DT_CAT(node_id, _REG_NUM)
1322#define DT_REG_HAS_IDX(node_id, idx) \
1323 IS_ENABLED(DT_CAT(node_id, _REG_IDX_##idx##_EXISTS))
1331#define DT_REG_ADDR_BY_IDX(node_id, idx) \
1332 DT_CAT(node_id, _REG_IDX_##idx##_VAL_ADDRESS)
1345#define DT_REG_SIZE_BY_IDX(node_id, idx) \
1346 DT_CAT(node_id, _REG_IDX_##idx##_VAL_SIZE)
1355#define DT_REG_ADDR(node_id) DT_REG_ADDR_BY_IDX(node_id, 0)
1364#define DT_REG_SIZE(node_id) DT_REG_SIZE_BY_IDX(node_id, 0)
1372#define DT_REG_ADDR_BY_NAME(node_id, name) \
1373 DT_CAT(node_id, _REG_NAME_##name##_VAL_ADDRESS)
1381#define DT_REG_SIZE_BY_NAME(node_id, name) \
1382 DT_CAT(node_id, _REG_NAME_##name##_VAL_SIZE)
1402#define DT_NUM_IRQS(node_id) DT_CAT(node_id, _IRQ_NUM)
1414#define DT_IRQ_HAS_IDX(node_id, idx) \
1415 IS_ENABLED(DT_CAT(node_id, _IRQ_IDX_##idx##_EXISTS))
1427#define DT_IRQ_HAS_CELL_AT_IDX(node_id, idx, cell) \
1428 IS_ENABLED(DT_CAT(node_id, _IRQ_IDX_##idx##_VAL_##cell##_EXISTS))
1437#define DT_IRQ_HAS_CELL(node_id, cell) DT_IRQ_HAS_CELL_AT_IDX(node_id, 0, cell)
1448#define DT_IRQ_HAS_NAME(node_id, name) \
1449 IS_ENABLED(DT_CAT(node_id, _IRQ_NAME_##name##_VAL_irq_EXISTS))
1484#define DT_IRQ_BY_IDX(node_id, idx, cell) \
1485 DT_CAT(node_id, _IRQ_IDX_##idx##_VAL_##cell)
1502#define DT_IRQ_BY_NAME(node_id, name, cell) \
1503 DT_CAT(node_id, _IRQ_NAME_##name##_VAL_##cell)
1512#define DT_IRQ(node_id, cell) DT_IRQ_BY_IDX(node_id, 0, cell)
1524#define DT_IRQN(node_id) DT_IRQ(node_id, irq)
1544#define DT_CHOSEN(prop) DT_CAT(DT_CHOSEN_, prop)
1552#define DT_HAS_CHOSEN(prop) IS_ENABLED(DT_CHOSEN_##prop##_EXISTS)
1598#define DT_FOREACH_CHILD(node_id, fn) \
1599 DT_CAT(node_id, _FOREACH_CHILD)(fn)
1613#define DT_FOREACH_CHILD_VARGS(node_id, fn, ...) \
1614 DT_CAT(node_id, _FOREACH_CHILD_VARGS)(fn, __VA_ARGS__)
1628#define DT_FOREACH_CHILD_STATUS_OKAY(node_id, fn) \
1629 DT_CAT(node_id, _FOREACH_CHILD_STATUS_OKAY)(fn)
1647#define DT_FOREACH_CHILD_STATUS_OKAY_VARGS(node_id, fn, ...) \
1648 DT_CAT(node_id, _FOREACH_CHILD_STATUS_OKAY_VARGS)(fn, __VA_ARGS__)
1694#define DT_FOREACH_PROP_ELEM(node_id, prop, fn) \
1695 DT_CAT4(node_id, _P_, prop, _FOREACH_PROP_ELEM)(fn)
1714#define DT_FOREACH_PROP_ELEM_VARGS(node_id, prop, fn, ...) \
1715 DT_CAT4(node_id, _P_, prop, _FOREACH_PROP_ELEM_VARGS)(fn, __VA_ARGS__)
1767#define DT_FOREACH_STATUS_OKAY(compat, fn) \
1768 COND_CODE_1(DT_HAS_COMPAT_STATUS_OKAY(compat), \
1769 (UTIL_CAT(DT_FOREACH_OKAY_, compat)(fn)), \
1810#define DT_FOREACH_STATUS_OKAY_VARGS(compat, fn, ...) \
1811 COND_CODE_1(DT_HAS_COMPAT_STATUS_OKAY(compat), \
1812 (UTIL_CAT(DT_FOREACH_OKAY_VARGS_, \
1813 compat)(fn, __VA_ARGS__)), \
1840#define DT_NODE_EXISTS(node_id) IS_ENABLED(DT_CAT(node_id, _EXISTS))
1861#define DT_NODE_HAS_STATUS(node_id, status) \
1862 DT_NODE_HAS_STATUS_INTERNAL(node_id, status)
1881#define DT_HAS_COMPAT_STATUS_OKAY(compat) \
1882 IS_ENABLED(DT_CAT(DT_COMPAT_HAS_OKAY_, compat))
1890#define DT_NUM_INST_STATUS_OKAY(compat) \
1891 UTIL_AND(DT_HAS_COMPAT_STATUS_OKAY(compat), \
1892 UTIL_CAT(DT_N_INST, DT_DASH(compat, NUM_OKAY)))
1917#define DT_NODE_HAS_COMPAT(node_id, compat) \
1918 IS_ENABLED(DT_CAT(node_id, _COMPAT_MATCHES_##compat))
1932#define DT_NODE_HAS_COMPAT_STATUS(node_id, compat, status) \
1933 DT_NODE_HAS_COMPAT(node_id, compat) && DT_NODE_HAS_STATUS(node_id, status)
1948#define DT_NODE_HAS_PROP(node_id, prop) \
1949 IS_ENABLED(DT_CAT(node_id, _P_##prop##_EXISTS))
1968#define DT_PHA_HAS_CELL_AT_IDX(node_id, pha, idx, cell) \
1969 IS_ENABLED(DT_PROP(node_id, \
1970 pha##_IDX_##idx##_VAL_##cell##_EXISTS))
1981#define DT_PHA_HAS_CELL(node_id, pha, cell) \
1982 DT_PHA_HAS_CELL_AT_IDX(node_id, pha, 0, cell)
2022#define DT_BUS(node_id) DT_CAT(node_id, _BUS)
2029#define DT_BUS_LABEL(node_id) DT_PROP(DT_BUS(node_id), label)
2055#define DT_ON_BUS(node_id, bus) IS_ENABLED(DT_CAT(node_id, _BUS_##bus))
2073#define DT_DRV_INST(inst) DT_INST(inst, DT_DRV_COMPAT)
2086#define DT_INST_FOREACH_CHILD(inst, fn) \
2087 DT_FOREACH_CHILD(DT_DRV_INST(inst), fn)
2101#define DT_INST_FOREACH_CHILD_VARGS(inst, fn, ...) \
2102 DT_FOREACH_CHILD_VARGS(DT_DRV_INST(inst), fn, __VA_ARGS__)
2110#define DT_INST_PROP(inst, prop) DT_PROP(DT_DRV_INST(inst), prop)
2118#define DT_INST_PROP_LEN(inst, prop) DT_PROP_LEN(DT_DRV_INST(inst), prop)
2129#define DT_INST_PROP_HAS_IDX(inst, prop, idx) \
2130 DT_PROP_HAS_IDX(DT_DRV_INST(inst), prop, idx)
2139#define DT_INST_PROP_BY_IDX(inst, prop, idx) \
2140 DT_PROP_BY_IDX(DT_DRV_INST(inst), prop, idx)
2149#define DT_INST_PROP_OR(inst, prop, default_value) \
2150 DT_PROP_OR(DT_DRV_INST(inst), prop, default_value)
2157#define DT_INST_LABEL(inst) DT_INST_PROP(inst, label)
2167#define DT_INST_PROP_BY_PHANDLE(inst, ph, prop) \
2168 DT_INST_PROP_BY_PHANDLE_IDX(inst, ph, 0, prop)
2181#define DT_INST_PROP_BY_PHANDLE_IDX(inst, phs, idx, prop) \
2182 DT_PROP_BY_PHANDLE_IDX(DT_DRV_INST(inst), phs, idx, prop)
2192#define DT_INST_PHA_BY_IDX(inst, pha, idx, cell) \
2193 DT_PHA_BY_IDX(DT_DRV_INST(inst), pha, idx, cell)
2204#define DT_INST_PHA_BY_IDX_OR(inst, pha, idx, cell, default_value) \
2205 DT_PHA_BY_IDX_OR(DT_DRV_INST(inst), pha, idx, cell, default_value)
2215#define DT_INST_PHA(inst, pha, cell) DT_INST_PHA_BY_IDX(inst, pha, 0, cell)
2225#define DT_INST_PHA_OR(inst, pha, cell, default_value) \
2226 DT_INST_PHA_BY_IDX_OR(inst, pha, 0, cell, default_value)
2237#define DT_INST_PHA_BY_NAME(inst, pha, name, cell) \
2238 DT_PHA_BY_NAME(DT_DRV_INST(inst), pha, name, cell)
2249#define DT_INST_PHA_BY_NAME_OR(inst, pha, name, cell, default_value) \
2250 DT_PHA_BY_NAME_OR(DT_DRV_INST(inst), pha, name, cell, default_value)
2260#define DT_INST_PHANDLE_BY_NAME(inst, pha, name) \
2261 DT_PHANDLE_BY_NAME(DT_DRV_INST(inst), pha, name) \
2272#define DT_INST_PHANDLE_BY_IDX(inst, prop, idx) \
2273 DT_PHANDLE_BY_IDX(DT_DRV_INST(inst), prop, idx)
2283#define DT_INST_PHANDLE(inst, prop) DT_INST_PHANDLE_BY_IDX(inst, prop, 0)
2292#define DT_INST_REG_HAS_IDX(inst, idx) DT_REG_HAS_IDX(DT_DRV_INST(inst), idx)
2300#define DT_INST_REG_ADDR_BY_IDX(inst, idx) DT_REG_ADDR_BY_IDX(DT_DRV_INST(inst), idx)
2308#define DT_INST_REG_SIZE_BY_IDX(inst, idx) \
2309 DT_REG_SIZE_BY_IDX(DT_DRV_INST(inst), idx)
2317#define DT_INST_REG_ADDR_BY_NAME(inst, name) \
2318 DT_REG_ADDR_BY_NAME(DT_DRV_INST(inst), name)
2326#define DT_INST_REG_SIZE_BY_NAME(inst, name) \
2327 DT_REG_SIZE_BY_NAME(DT_DRV_INST(inst), name)
2334#define DT_INST_REG_ADDR(inst) DT_INST_REG_ADDR_BY_IDX(inst, 0)
2341#define DT_INST_REG_SIZE(inst) DT_INST_REG_SIZE_BY_IDX(inst, 0)
2350#define DT_INST_IRQ_BY_IDX(inst, idx, cell) \
2351 DT_IRQ_BY_IDX(DT_DRV_INST(inst), idx, cell)
2360#define DT_INST_IRQ_BY_NAME(inst, name, cell) \
2361 DT_IRQ_BY_NAME(DT_DRV_INST(inst), name, cell)
2369#define DT_INST_IRQ(inst, cell) DT_INST_IRQ_BY_IDX(inst, 0, cell)
2376#define DT_INST_IRQN(inst) DT_INST_IRQ(inst, irq)
2383#define DT_INST_BUS(inst) DT_BUS(DT_DRV_INST(inst))
2390#define DT_INST_BUS_LABEL(inst) DT_BUS_LABEL(DT_DRV_INST(inst))
2399#define DT_INST_ON_BUS(inst, bus) DT_ON_BUS(DT_DRV_INST(inst), bus)
2429#define DT_ANY_INST_ON_BUS_STATUS_OKAY(bus) \
2430 DT_COMPAT_ON_BUS_INTERNAL(DT_DRV_COMPAT, bus)
2491#define DT_INST_FOREACH_STATUS_OKAY(fn) \
2492 COND_CODE_1(DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT), \
2493 (UTIL_CAT(DT_FOREACH_OKAY_INST_, \
2494 DT_DRV_COMPAT)(fn)), \
2508#define DT_INST_FOREACH_STATUS_OKAY_VARGS(fn, ...) \
2509 COND_CODE_1(DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT), \
2510 (UTIL_CAT(DT_FOREACH_OKAY_INST_VARGS_, \
2511 DT_DRV_COMPAT)(fn, __VA_ARGS__)), \
2524#define DT_INST_FOREACH_PROP_ELEM(inst, prop, fn) \
2525 DT_FOREACH_PROP_ELEM(DT_DRV_INST(inst), prop, fn)
2541#define DT_INST_FOREACH_PROP_ELEM_VARGS(inst, prop, fn, ...) \
2542 DT_FOREACH_PROP_ELEM_VARGS(DT_DRV_INST(inst), prop, fn, __VA_ARGS__)
2550#define DT_INST_NODE_HAS_PROP(inst, prop) \
2551 DT_NODE_HAS_PROP(DT_DRV_INST(inst), prop)
2563#define DT_INST_PHA_HAS_CELL_AT_IDX(inst, pha, idx, cell) \
2564 DT_PHA_HAS_CELL_AT_IDX(DT_DRV_INST(inst), pha, idx, cell)
2575#define DT_INST_PHA_HAS_CELL(inst, pha, cell) \
2576 DT_INST_PHA_HAS_CELL_AT_IDX(inst, pha, 0, cell)
2585#define DT_INST_IRQ_HAS_IDX(inst, idx) DT_IRQ_HAS_IDX(DT_DRV_INST(inst), idx)
2595#define DT_INST_IRQ_HAS_CELL_AT_IDX(inst, idx, cell) \
2596 DT_IRQ_HAS_CELL_AT_IDX(DT_DRV_INST(inst), idx, cell)
2605#define DT_INST_IRQ_HAS_CELL(inst, cell) \
2606 DT_INST_IRQ_HAS_CELL_AT_IDX(inst, 0, cell)
2614#define DT_INST_IRQ_HAS_NAME(inst, name) \
2615 DT_IRQ_HAS_NAME(DT_DRV_INST(inst), name)
2622#define DT_PATH_INTERNAL(...) \
2623 UTIL_CAT(DT_ROOT, MACRO_MAP_CAT(DT_S_PREFIX, __VA_ARGS__))
2625#define DT_S_PREFIX(name) _S_##name
2641#define DT_CAT(a1, a2) a1 ## a2
2643#define DT_CAT3(a1, a2, a3) a1 ## a2 ## a3
2645#define DT_CAT4(a1, a2, a3, a4) a1 ## a2 ## a3 ## a4
2647#define DT_CAT5(a1, a2, a3, a4, a5) a1 ## a2 ## a3 ## a4 ## a5
2649#define DT_CAT6(a1, a2, a3, a4, a5, a6) a1 ## a2 ## a3 ## a4 ## a5 ## a6
2656#define DT_DASH(...) MACRO_MAP_CAT(DT_DASH_PREFIX, __VA_ARGS__)
2658#define DT_DASH_PREFIX(name) _##name
2660#define DT_NODE_HAS_STATUS_INTERNAL(node_id, status) \
2661 IS_ENABLED(DT_CAT(node_id, _STATUS_ ## status))
2663#define DT_COMPAT_ON_BUS_INTERNAL(compat, bus) \
2664 IS_ENABLED(UTIL_CAT(DT_CAT(DT_COMPAT_, compat), _BUS_##bus))
Clocks Devicetree macro public API header file.
DMA Devicetree macro public API header file.
GPIO Devicetree macro public API header file.
SPI Devicetree macro public API header file.
Zephyr-specific devicetree /chosen properties.
Flash Devicetree macro public API header file.
IO channels devicetree macro public API header file.
Devicetree node dependency ordinals.
Devicetree pin control helpers.
PWMs Devicetree macro public API header file.