Zephyr API Documentation 4.0.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
devicetree.h
Go to the documentation of this file.
1/*
2 * SPDX-License-Identifier: Apache-2.0
3 * Copyright (c) 2020 Nordic Semiconductor
4 * Copyright (c) 2020, Linaro Ltd.
5 *
6 * Not a generated file. Feel free to modify.
7 */
8
16#ifndef DEVICETREE_H
17#define DEVICETREE_H
18
19#include <zephyr/devicetree_generated.h>
21
22#if !defined(_LINKER) && !defined(_ASMLANGUAGE)
23#include <stdint.h>
24#endif
25
26#include <zephyr/sys/util.h>
27
37/*
38 * Property suffixes
39 * -----------------
40 *
41 * These are the optional parts that come after the _P_<property>
42 * part in DT_N_<path-id>_P_<property-id> macros, or the "prop-suf"
43 * nonterminal in the DT guide's macros.bnf file.
44 *
45 * Before adding new ones, check this list to avoid conflicts. If any
46 * are missing from this list, please add them. It should be complete.
47 *
48 * _ENUM_IDX: property's value as an index into bindings enum
49 * _ENUM_VAL_<val>_EXISTS property's value as a token exists
50 * _EXISTS: property is defined
51 * _FOREACH_PROP_ELEM: helper for "iterating" over values in the property
52 * _FOREACH_PROP_ELEM_VARGS: foreach functions with variable number of arguments
53 * _IDX_<i>: logical index into property
54 * _IDX_<i>_EXISTS: logical index into property is defined
55 * _IDX_<i>_PH: phandle array's phandle by index (or phandle, phandles)
56 * _IDX_<i>_STRING_TOKEN: string array element value as a token
57 * _IDX_<i>_STRING_UPPER_TOKEN: string array element value as a uppercased token
58 * _IDX <i>_STRING_UNQUOTED: string array element value as a sequence of tokens, with no quotes
59 * _IDX_<i>_VAL_<val>: phandle array's specifier value by index
60 * _IDX_<i>_VAL_<val>_EXISTS: cell value exists, by index
61 * _LEN: property logical length
62 * _NAME_<name>_PH: phandle array's phandle by name
63 * _NAME_<name>_VAL_<val>: phandle array's property specifier by name
64 * _NAME_<name>_VAL_<val>_EXISTS: cell value exists, by name
65 * _STRING_TOKEN: string property's value as a token
66 * _STRING_UPPER_TOKEN: like _STRING_TOKEN, but uppercased
67 * _STRING_UNQUOTED: string property's value as a sequence of tokens, with no quotes
68 */
69
83#define DT_INVALID_NODE _
84
88#define DT_ROOT DT_N
89
140#define DT_PATH(...) DT_PATH_INTERNAL(__VA_ARGS__)
141
196#define DT_NODELABEL(label) DT_CAT(DT_N_NODELABEL_, label)
197
236#define DT_ALIAS(alias) DT_CAT(DT_N_ALIAS_, alias)
237
332#define DT_INST(inst, compat) UTIL_CAT(DT_N_INST, DT_DASH(inst, compat))
333
357#define DT_PARENT(node_id) DT_CAT(node_id, _PARENT)
358
382#define DT_GPARENT(node_id) DT_PARENT(DT_PARENT(node_id))
383
419#define DT_CHILD(node_id, child) UTIL_CAT(node_id, DT_S_PREFIX(child))
420
462#define DT_COMPAT_GET_ANY_STATUS_OKAY(compat) \
463 COND_CODE_1(DT_HAS_COMPAT_STATUS_OKAY(compat), \
464 (DT_INST(0, compat)), \
465 (DT_INVALID_NODE))
466
494#define DT_NODE_PATH(node_id) DT_CAT(node_id, _PATH)
495
520#define DT_NODE_FULL_NAME(node_id) DT_CAT(node_id, _FULL_NAME)
521
548#define DT_NODE_FULL_NAME_UNQUOTED(node_id) DT_CAT(node_id, _FULL_NAME_UNQUOTED)
549
576#define DT_NODE_FULL_NAME_TOKEN(node_id) DT_CAT(node_id, _FULL_NAME_TOKEN)
577
606#define DT_NODE_FULL_NAME_UPPER_TOKEN(node_id) DT_CAT(node_id, _FULL_NAME_UPPER_TOKEN)
607
634#define DT_NODE_CHILD_IDX(node_id) DT_CAT(node_id, _CHILD_IDX)
635
642#define DT_CHILD_NUM(node_id) DT_CAT(node_id, _CHILD_NUM)
643
644
652#define DT_CHILD_NUM_STATUS_OKAY(node_id) \
653 DT_CAT(node_id, _CHILD_NUM_STATUS_OKAY)
654
675#define DT_SAME_NODE(node_id1, node_id2) \
676 (DT_DEP_ORD(node_id1) == (DT_DEP_ORD(node_id2)))
677
702#define DT_NODELABEL_STRING_ARRAY(node_id) \
703 { DT_FOREACH_NODELABEL(node_id, DT_NODELABEL_STRING_ARRAY_ENTRY_INTERNAL) }
704
745#define DT_PROP(node_id, prop) DT_CAT3(node_id, _P_, prop)
746
779#define DT_PROP_LEN(node_id, prop) DT_CAT4(node_id, _P_, prop, _LEN)
780
795#define DT_PROP_LEN_OR(node_id, prop, default_value) \
796 COND_CODE_1(DT_NODE_HAS_PROP(node_id, prop), \
797 (DT_PROP_LEN(node_id, prop)), (default_value))
798
819#define DT_PROP_HAS_IDX(node_id, prop, idx) \
820 IS_ENABLED(DT_CAT6(node_id, _P_, prop, _IDX_, idx, _EXISTS))
821
854#define DT_PROP_HAS_NAME(node_id, prop, name) \
855 IS_ENABLED(DT_CAT6(node_id, _P_, prop, _NAME_, name, _EXISTS))
856
891#define DT_PROP_BY_IDX(node_id, prop, idx) \
892 DT_CAT5(node_id, _P_, prop, _IDX_, idx)
893
907#define DT_PROP_OR(node_id, prop, default_value) \
908 COND_CODE_1(DT_NODE_HAS_PROP(node_id, prop), \
909 (DT_PROP(node_id, prop)), (default_value))
910
966#define DT_ENUM_IDX_BY_IDX(node_id, prop, idx) \
967 DT_CAT6(node_id, _P_, prop, _IDX_, idx, _ENUM_IDX)
968
975#define DT_ENUM_IDX(node_id, prop) DT_ENUM_IDX_BY_IDX(node_id, prop, 0)
976
992#define DT_ENUM_IDX_BY_IDX_OR(node_id, prop, idx, default_idx_value) \
993 COND_CODE_1(DT_PROP_HAS_IDX(node_id, prop, idx), \
994 (DT_ENUM_IDX_BY_IDX(node_id, prop, idx)), (default_idx_value))
995
1004#define DT_ENUM_IDX_OR(node_id, prop, default_idx_value) \
1005 DT_ENUM_IDX_BY_IDX_OR(node_id, prop, 0, default_idx_value)
1006
1016#define DT_ENUM_HAS_VALUE_BY_IDX(node_id, prop, idx, value) \
1017 IS_ENABLED(DT_CAT8(node_id, _P_, prop, _IDX_, idx, _ENUM_VAL_, value, _EXISTS))
1018
1026#define DT_ENUM_HAS_VALUE(node_id, prop, value) \
1027 DT_ENUM_HAS_VALUE_BY_IDX(node_id, prop, 0, value)
1028
1088#define DT_STRING_TOKEN(node_id, prop) \
1089 DT_CAT4(node_id, _P_, prop, _STRING_TOKEN)
1090
1104#define DT_STRING_TOKEN_OR(node_id, prop, default_value) \
1105 COND_CODE_1(DT_NODE_HAS_PROP(node_id, prop), \
1106 (DT_STRING_TOKEN(node_id, prop)), (default_value))
1107
1165#define DT_STRING_UPPER_TOKEN(node_id, prop) \
1166 DT_CAT4(node_id, _P_, prop, _STRING_UPPER_TOKEN)
1167
1182#define DT_STRING_UPPER_TOKEN_OR(node_id, prop, default_value) \
1183 COND_CODE_1(DT_NODE_HAS_PROP(node_id, prop), \
1184 (DT_STRING_UPPER_TOKEN(node_id, prop)), (default_value))
1185
1226#define DT_STRING_UNQUOTED(node_id, prop) \
1227 DT_CAT4(node_id, _P_, prop, _STRING_UNQUOTED)
1228
1243#define DT_STRING_UNQUOTED_OR(node_id, prop, default_value) \
1244 COND_CODE_1(DT_NODE_HAS_PROP(node_id, prop), \
1245 (DT_STRING_UNQUOTED(node_id, prop)), (default_value))
1246
1294#define DT_STRING_TOKEN_BY_IDX(node_id, prop, idx) \
1295 DT_CAT6(node_id, _P_, prop, _IDX_, idx, _STRING_TOKEN)
1296
1344#define DT_STRING_UPPER_TOKEN_BY_IDX(node_id, prop, idx) \
1345 DT_CAT6(node_id, _P_, prop, _IDX_, idx, _STRING_UPPER_TOKEN)
1346
1387#define DT_STRING_UNQUOTED_BY_IDX(node_id, prop, idx) \
1388 DT_CAT6(node_id, _P_, prop, _IDX_, idx, _STRING_UNQUOTED)
1389
1390/*
1391 * phandle properties
1392 *
1393 * These are special-cased to manage the impedance mismatch between
1394 * phandles, which are just uint32_t node properties that only make sense
1395 * within the tree itself, and C values.
1396 */
1397
1443#define DT_PROP_BY_PHANDLE_IDX(node_id, phs, idx, prop) \
1444 DT_PROP(DT_PHANDLE_BY_IDX(node_id, phs, idx), prop)
1445
1465#define DT_PROP_BY_PHANDLE_IDX_OR(node_id, phs, idx, prop, default_value) \
1466 DT_PROP_OR(DT_PHANDLE_BY_IDX(node_id, phs, idx), prop, default_value)
1467
1479#define DT_PROP_BY_PHANDLE(node_id, ph, prop) \
1480 DT_PROP_BY_PHANDLE_IDX(node_id, ph, 0, prop)
1481
1536#define DT_PHA_BY_IDX(node_id, pha, idx, cell) \
1537 DT_CAT7(node_id, _P_, pha, _IDX_, idx, _VAL_, cell)
1538
1562#define DT_PHA_BY_IDX_OR(node_id, pha, idx, cell, default_value) \
1563 DT_PROP_OR(node_id, DT_CAT5(pha, _IDX_, idx, _VAL_, cell), default_value)
1564
1572#define DT_PHA(node_id, pha, cell) DT_PHA_BY_IDX(node_id, pha, 0, cell)
1573
1588#define DT_PHA_OR(node_id, pha, cell, default_value) \
1589 DT_PHA_BY_IDX_OR(node_id, pha, 0, cell, default_value)
1590
1631#define DT_PHA_BY_NAME(node_id, pha, name, cell) \
1632 DT_CAT7(node_id, _P_, pha, _NAME_, name, _VAL_, cell)
1633
1655#define DT_PHA_BY_NAME_OR(node_id, pha, name, cell, default_value) \
1656 DT_PROP_OR(node_id, DT_CAT5(pha, _NAME_, name, _VAL_, cell), default_value)
1657
1705#define DT_PHANDLE_BY_NAME(node_id, pha, name) \
1706 DT_CAT6(node_id, _P_, pha, _NAME_, name, _PH)
1707
1757#define DT_PHANDLE_BY_IDX(node_id, prop, idx) \
1758 DT_CAT6(node_id, _P_, prop, _IDX_, idx, _PH)
1759
1771#define DT_PHANDLE(node_id, prop) DT_PHANDLE_BY_IDX(node_id, prop, 0)
1772
1819#define DT_NUM_RANGES(node_id) DT_CAT(node_id, _RANGES_NUM)
1820
1873#define DT_RANGES_HAS_IDX(node_id, idx) \
1874 IS_ENABLED(DT_CAT4(node_id, _RANGES_IDX_, idx, _EXISTS))
1875
1928#define DT_RANGES_HAS_CHILD_BUS_FLAGS_AT_IDX(node_id, idx) \
1929 IS_ENABLED(DT_CAT4(node_id, _RANGES_IDX_, idx, _VAL_CHILD_BUS_FLAGS_EXISTS))
1930
1968#define DT_RANGES_CHILD_BUS_FLAGS_BY_IDX(node_id, idx) \
1969 DT_CAT4(node_id, _RANGES_IDX_, idx, _VAL_CHILD_BUS_FLAGS)
1970
2017#define DT_RANGES_CHILD_BUS_ADDRESS_BY_IDX(node_id, idx) \
2018 DT_CAT4(node_id, _RANGES_IDX_, idx, _VAL_CHILD_BUS_ADDRESS)
2019
2066#define DT_RANGES_PARENT_BUS_ADDRESS_BY_IDX(node_id, idx) \
2067 DT_CAT4(node_id, _RANGES_IDX_, idx, _VAL_PARENT_BUS_ADDRESS)
2068
2115#define DT_RANGES_LENGTH_BY_IDX(node_id, idx) \
2116 DT_CAT4(node_id, _RANGES_IDX_, idx, _VAL_LENGTH)
2117
2157#define DT_FOREACH_RANGE(node_id, fn) \
2158 DT_CAT(node_id, _FOREACH_RANGE)(fn)
2159
2205#define DT_NODE_VENDOR_BY_IDX(node_id, idx) \
2206 DT_CAT3(node_id, _COMPAT_VENDOR_IDX_, idx)
2207
2220#define DT_NODE_VENDOR_HAS_IDX(node_id, idx) \
2221 IS_ENABLED(DT_CAT4(node_id, _COMPAT_VENDOR_IDX_, idx, _EXISTS))
2222
2237#define DT_NODE_VENDOR_BY_IDX_OR(node_id, idx, default_value) \
2238 COND_CODE_1(DT_NODE_VENDOR_HAS_IDX(node_id, idx), \
2239 (DT_NODE_VENDOR_BY_IDX(node_id, idx)), (default_value))
2240
2249#define DT_NODE_VENDOR_OR(node_id, default_value) \
2250 DT_NODE_VENDOR_BY_IDX_OR(node_id, 0, default_value)
2251
2281#define DT_NODE_MODEL_BY_IDX(node_id, idx) \
2282 DT_CAT3(node_id, _COMPAT_MODEL_IDX_, idx)
2283
2296#define DT_NODE_MODEL_HAS_IDX(node_id, idx) \
2297 IS_ENABLED(DT_CAT4(node_id, _COMPAT_MODEL_IDX_, idx, _EXISTS))
2298
2313#define DT_NODE_MODEL_BY_IDX_OR(node_id, idx, default_value) \
2314 COND_CODE_1(DT_NODE_MODEL_HAS_IDX(node_id, idx), \
2315 (DT_NODE_MODEL_BY_IDX(node_id, idx)), (default_value))
2316
2325#define DT_NODE_MODEL_OR(node_id, default_value) \
2326 DT_NODE_MODEL_BY_IDX_OR(node_id, 0, default_value)
2327
2345#define DT_NUM_REGS(node_id) DT_CAT(node_id, _REG_NUM)
2346
2358#define DT_REG_HAS_IDX(node_id, idx) \
2359 IS_ENABLED(DT_CAT4(node_id, _REG_IDX_, idx, _EXISTS))
2360
2372#define DT_REG_HAS_NAME(node_id, name) \
2373 IS_ENABLED(DT_CAT4(node_id, _REG_NAME_, name, _EXISTS))
2374
2386#define DT_REG_ADDR_BY_IDX_RAW(node_id, idx) \
2387 DT_CAT4(node_id, _REG_IDX_, idx, _VAL_ADDRESS)
2388
2400#define DT_REG_ADDR_RAW(node_id) \
2401 DT_REG_ADDR_BY_IDX_RAW(node_id, 0)
2402
2409#define DT_REG_ADDR_BY_IDX(node_id, idx) \
2410 DT_U32_C(DT_REG_ADDR_BY_IDX_RAW(node_id, idx))
2411
2423#define DT_REG_SIZE_BY_IDX(node_id, idx) \
2424 DT_U32_C(DT_CAT4(node_id, _REG_IDX_, idx, _VAL_SIZE))
2425
2433#define DT_REG_ADDR(node_id) DT_REG_ADDR_BY_IDX(node_id, 0)
2434
2445#define DT_REG_ADDR_U64(node_id) DT_U64_C(DT_REG_ADDR_BY_IDX_RAW(node_id, 0))
2446
2454#define DT_REG_SIZE(node_id) DT_REG_SIZE_BY_IDX(node_id, 0)
2455
2462#define DT_REG_ADDR_BY_NAME(node_id, name) \
2463 DT_U32_C(DT_CAT4(node_id, _REG_NAME_, name, _VAL_ADDRESS))
2464
2473#define DT_REG_ADDR_BY_NAME_OR(node_id, name, default_value) \
2474 COND_CODE_1(DT_REG_HAS_NAME(node_id, name), \
2475 (DT_REG_ADDR_BY_NAME(node_id, name)), (default_value))
2476
2489#define DT_REG_ADDR_BY_NAME_U64(node_id, name) \
2490 DT_U64_C(DT_CAT4(node_id, _REG_NAME_, name, _VAL_ADDRESS))
2491
2498#define DT_REG_SIZE_BY_NAME(node_id, name) \
2499 DT_U32_C(DT_CAT4(node_id, _REG_NAME_, name, _VAL_SIZE))
2500
2509#define DT_REG_SIZE_BY_NAME_OR(node_id, name, default_value) \
2510 COND_CODE_1(DT_REG_HAS_NAME(node_id, name), \
2511 (DT_REG_SIZE_BY_NAME(node_id, name)), (default_value))
2512
2513
2532#define DT_NUM_IRQS(node_id) DT_CAT(node_id, _IRQ_NUM)
2533
2558#define DT_NUM_NODELABELS(node_id) DT_CAT(node_id, _NODELABEL_NUM)
2559
2566#define DT_IRQ_LEVEL(node_id) DT_CAT(node_id, _IRQ_LEVEL)
2567
2578#define DT_IRQ_HAS_IDX(node_id, idx) \
2579 IS_ENABLED(DT_CAT4(node_id, _IRQ_IDX_, idx, _EXISTS))
2580
2591#define DT_IRQ_HAS_CELL_AT_IDX(node_id, idx, cell) \
2592 IS_ENABLED(DT_CAT6(node_id, _IRQ_IDX_, idx, _VAL_, cell, _EXISTS))
2593
2601#define DT_IRQ_HAS_CELL(node_id, cell) DT_IRQ_HAS_CELL_AT_IDX(node_id, 0, cell)
2602
2612#define DT_IRQ_HAS_NAME(node_id, name) \
2613 IS_ENABLED(DT_CAT4(node_id, _IRQ_NAME_, name, _VAL_irq_EXISTS))
2614
2650#define DT_IRQ_BY_IDX(node_id, idx, cell) \
2651 DT_CAT5(node_id, _IRQ_IDX_, idx, _VAL_, cell)
2652
2668#define DT_IRQ_BY_NAME(node_id, name, cell) \
2669 DT_CAT5(node_id, _IRQ_NAME_, name, _VAL_, cell)
2670
2678#define DT_IRQ(node_id, cell) DT_IRQ_BY_IDX(node_id, 0, cell)
2679
2722#define DT_IRQ_INTC_BY_IDX(node_id, idx) \
2723 DT_CAT4(node_id, _IRQ_IDX_, idx, _CONTROLLER)
2724
2769#define DT_IRQ_INTC_BY_NAME(node_id, name) \
2770 DT_CAT4(node_id, _IRQ_NAME_, name, _CONTROLLER)
2771
2811#define DT_IRQ_INTC(node_id) \
2812 DT_IRQ_INTC_BY_IDX(node_id, 0)
2813
2818/* DT helper macro to encode a node's IRQN to level 1 according to the multi-level scheme */
2819#define DT_IRQN_L1_INTERNAL(node_id, idx) DT_IRQ_BY_IDX(node_id, idx, irq)
2820/* DT helper macro to encode a node's IRQN to level 2 according to the multi-level scheme */
2821#define DT_IRQN_L2_INTERNAL(node_id, idx) \
2822 (IRQ_TO_L2(DT_IRQN_L1_INTERNAL(node_id, idx)) | \
2823 DT_IRQ(DT_IRQ_INTC_BY_IDX(node_id, idx), irq))
2824/* DT helper macro to encode a node's IRQN to level 3 according to the multi-level scheme */
2825#define DT_IRQN_L3_INTERNAL(node_id, idx) \
2826 (IRQ_TO_L3(DT_IRQN_L1_INTERNAL(node_id, idx)) | \
2827 IRQ_TO_L2(DT_IRQ(DT_IRQ_INTC_BY_IDX(node_id, idx), irq)) | \
2828 DT_IRQ(DT_IRQ_INTC(DT_IRQ_INTC_BY_IDX(node_id, idx)), irq))
2829/* DT helper macro for the macros above */
2830#define DT_IRQN_LVL_INTERNAL(node_id, idx, level) DT_CAT3(DT_IRQN_L, level, _INTERNAL)(node_id, idx)
2831
2836#define DT_MULTI_LEVEL_IRQN_INTERNAL(node_id, idx) \
2837 DT_IRQN_LVL_INTERNAL(node_id, idx, DT_IRQ_LEVEL(node_id))
2838
2851#define DT_IRQN_BY_IDX(node_id, idx) \
2852 COND_CODE_1(IS_ENABLED(CONFIG_MULTI_LEVEL_INTERRUPTS), \
2853 (DT_MULTI_LEVEL_IRQN_INTERNAL(node_id, idx)), \
2854 (DT_IRQ_BY_IDX(node_id, idx, irq)))
2855
2866#define DT_IRQN(node_id) DT_IRQN_BY_IDX(node_id, 0)
2867
2886#define DT_CHOSEN(prop) DT_CAT(DT_CHOSEN_, prop)
2887
2894#define DT_HAS_CHOSEN(prop) IS_ENABLED(DT_CAT3(DT_CHOSEN_, prop, _EXISTS))
2895
2915#define DT_FOREACH_NODE(fn) DT_FOREACH_HELPER(fn)
2916
2929#define DT_FOREACH_NODE_VARGS(fn, ...) DT_FOREACH_VARGS_HELPER(fn, __VA_ARGS__)
2930
2942#define DT_FOREACH_STATUS_OKAY_NODE(fn) DT_FOREACH_OKAY_HELPER(fn)
2943
2958#define DT_FOREACH_STATUS_OKAY_NODE_VARGS(fn, ...) DT_FOREACH_OKAY_VARGS_HELPER(fn, __VA_ARGS__)
2959
3003#define DT_FOREACH_CHILD(node_id, fn) \
3004 DT_CAT(node_id, _FOREACH_CHILD)(fn)
3005
3046#define DT_FOREACH_CHILD_SEP(node_id, fn, sep) \
3047 DT_CAT(node_id, _FOREACH_CHILD_SEP)(fn, sep)
3048
3064#define DT_FOREACH_CHILD_VARGS(node_id, fn, ...) \
3065 DT_CAT(node_id, _FOREACH_CHILD_VARGS)(fn, __VA_ARGS__)
3066
3082#define DT_FOREACH_CHILD_SEP_VARGS(node_id, fn, sep, ...) \
3083 DT_CAT(node_id, _FOREACH_CHILD_SEP_VARGS)(fn, sep, __VA_ARGS__)
3084
3100#define DT_FOREACH_CHILD_STATUS_OKAY(node_id, fn) \
3101 DT_CAT(node_id, _FOREACH_CHILD_STATUS_OKAY)(fn)
3102
3119#define DT_FOREACH_CHILD_STATUS_OKAY_SEP(node_id, fn, sep) \
3120 DT_CAT(node_id, _FOREACH_CHILD_STATUS_OKAY_SEP)(fn, sep)
3121
3141#define DT_FOREACH_CHILD_STATUS_OKAY_VARGS(node_id, fn, ...) \
3142 DT_CAT(node_id, _FOREACH_CHILD_STATUS_OKAY_VARGS)(fn, __VA_ARGS__)
3143
3162#define DT_FOREACH_CHILD_STATUS_OKAY_SEP_VARGS(node_id, fn, sep, ...) \
3163 DT_CAT(node_id, _FOREACH_CHILD_STATUS_OKAY_SEP_VARGS)(fn, sep, __VA_ARGS__)
3164
3215#define DT_FOREACH_PROP_ELEM(node_id, prop, fn) \
3216 DT_CAT4(node_id, _P_, prop, _FOREACH_PROP_ELEM)(fn)
3217
3260#define DT_FOREACH_PROP_ELEM_SEP(node_id, prop, fn, sep) \
3261 DT_CAT4(node_id, _P_, prop, _FOREACH_PROP_ELEM_SEP)(fn, sep)
3262
3283#define DT_FOREACH_PROP_ELEM_VARGS(node_id, prop, fn, ...) \
3284 DT_CAT4(node_id, _P_, prop, _FOREACH_PROP_ELEM_VARGS)(fn, __VA_ARGS__)
3285
3302#define DT_FOREACH_PROP_ELEM_SEP_VARGS(node_id, prop, fn, sep, ...) \
3303 DT_CAT4(node_id, _P_, prop, _FOREACH_PROP_ELEM_SEP_VARGS)( \
3304 fn, sep, __VA_ARGS__)
3305
3359#define DT_FOREACH_STATUS_OKAY(compat, fn) \
3360 COND_CODE_1(DT_HAS_COMPAT_STATUS_OKAY(compat), \
3361 (UTIL_CAT(DT_FOREACH_OKAY_, compat)(fn)), \
3362 ())
3363
3408#define DT_FOREACH_STATUS_OKAY_VARGS(compat, fn, ...) \
3409 COND_CODE_1(DT_HAS_COMPAT_STATUS_OKAY(compat), \
3410 (DT_CAT(DT_FOREACH_OKAY_VARGS_, \
3411 compat)(fn, __VA_ARGS__)), \
3412 ())
3413
3426#define DT_COMPAT_FOREACH_STATUS_OKAY_VARGS(compat, fn, ...) \
3427 COND_CODE_1(DT_HAS_COMPAT_STATUS_OKAY(compat), \
3428 (UTIL_CAT(DT_FOREACH_OKAY_INST_VARGS_, \
3429 compat)(fn, compat, __VA_ARGS__)), \
3430 ())
3431
3432
3471#define DT_FOREACH_NODELABEL(node_id, fn) DT_CAT(node_id, _FOREACH_NODELABEL)(fn)
3472
3510#define DT_FOREACH_NODELABEL_VARGS(node_id, fn, ...) \
3511 DT_CAT(node_id, _FOREACH_NODELABEL_VARGS)(fn, __VA_ARGS__)
3512
3537#define DT_NODE_EXISTS(node_id) IS_ENABLED(DT_CAT(node_id, _EXISTS))
3538
3560#define DT_NODE_HAS_STATUS(node_id, status) \
3561 DT_NODE_HAS_STATUS_INTERNAL(node_id, status)
3562
3583#define DT_NODE_HAS_STATUS_OKAY(node_id) DT_NODE_HAS_STATUS(node_id, okay)
3584
3604#define DT_HAS_COMPAT_STATUS_OKAY(compat) \
3605 IS_ENABLED(DT_CAT(DT_COMPAT_HAS_OKAY_, compat))
3606
3613#define DT_NUM_INST_STATUS_OKAY(compat) \
3614 UTIL_AND(DT_HAS_COMPAT_STATUS_OKAY(compat), \
3615 UTIL_CAT(DT_N_INST, DT_DASH(compat, NUM_OKAY)))
3616
3644#define DT_NODE_HAS_COMPAT(node_id, compat) \
3645 IS_ENABLED(DT_CAT3(node_id, _COMPAT_MATCHES_, compat))
3646
3661#define DT_NODE_HAS_COMPAT_STATUS(node_id, compat, status) \
3662 UTIL_AND(DT_NODE_HAS_COMPAT(node_id, compat), DT_NODE_HAS_STATUS(node_id, status))
3663
3677#define DT_NODE_HAS_PROP(node_id, prop) \
3678 IS_ENABLED(DT_CAT4(node_id, _P_, prop, _EXISTS))
3679
3680
3697#define DT_PHA_HAS_CELL_AT_IDX(node_id, pha, idx, cell) \
3698 IS_ENABLED(DT_CAT8(node_id, _P_, pha, \
3699 _IDX_, idx, _VAL_, cell, _EXISTS))
3700
3710#define DT_PHA_HAS_CELL(node_id, pha, cell) \
3711 DT_PHA_HAS_CELL_AT_IDX(node_id, pha, 0, cell)
3712
3754#define DT_BUS(node_id) DT_CAT(node_id, _BUS)
3755
3784#define DT_ON_BUS(node_id, bus) IS_ENABLED(DT_CAT3(node_id, _BUS_, bus))
3785
3802#define DT_DRV_INST(inst) DT_INST(inst, DT_DRV_COMPAT)
3803
3811#define DT_INST_PARENT(inst) DT_PARENT(DT_DRV_INST(inst))
3812
3820#define DT_INST_GPARENT(inst) DT_GPARENT(DT_DRV_INST(inst))
3821
3831#define DT_INST_CHILD(inst, child) \
3832 DT_CHILD(DT_DRV_INST(inst), child)
3833
3843#define DT_INST_CHILD_NUM(inst) DT_CHILD_NUM(DT_DRV_INST(inst))
3844
3854#define DT_INST_CHILD_NUM_STATUS_OKAY(inst) \
3855 DT_CHILD_NUM_STATUS_OKAY(DT_DRV_INST(inst))
3856
3865#define DT_INST_NODELABEL_STRING_ARRAY(inst) DT_NODELABEL_STRING_ARRAY(DT_DRV_INST(inst))
3866
3875#define DT_INST_NUM_NODELABELS(inst) DT_NUM_NODELABELS(DT_DRV_INST(inst))
3876
3891#define DT_INST_FOREACH_CHILD(inst, fn) \
3892 DT_FOREACH_CHILD(DT_DRV_INST(inst), fn)
3893
3907#define DT_INST_FOREACH_CHILD_SEP(inst, fn, sep) \
3908 DT_FOREACH_CHILD_SEP(DT_DRV_INST(inst), fn, sep)
3909
3925#define DT_INST_FOREACH_CHILD_VARGS(inst, fn, ...) \
3926 DT_FOREACH_CHILD_VARGS(DT_DRV_INST(inst), fn, __VA_ARGS__)
3927
3942#define DT_INST_FOREACH_CHILD_SEP_VARGS(inst, fn, sep, ...) \
3943 DT_FOREACH_CHILD_SEP_VARGS(DT_DRV_INST(inst), fn, sep, __VA_ARGS__)
3944
3956#define DT_INST_FOREACH_CHILD_STATUS_OKAY(inst, fn) \
3957 DT_FOREACH_CHILD_STATUS_OKAY(DT_DRV_INST(inst), fn)
3958
3973#define DT_INST_FOREACH_CHILD_STATUS_OKAY_SEP(inst, fn, sep) \
3974 DT_FOREACH_CHILD_STATUS_OKAY_SEP(DT_DRV_INST(inst), fn, sep)
3975
3989#define DT_INST_FOREACH_CHILD_STATUS_OKAY_VARGS(inst, fn, ...) \
3990 DT_FOREACH_CHILD_STATUS_OKAY_VARGS(DT_DRV_INST(inst), fn, __VA_ARGS__)
3991
4007#define DT_INST_FOREACH_CHILD_STATUS_OKAY_SEP_VARGS(inst, fn, sep, ...) \
4008 DT_FOREACH_CHILD_STATUS_OKAY_SEP_VARGS(DT_DRV_INST(inst), fn, sep, __VA_ARGS__)
4009
4017#define DT_INST_ENUM_IDX_BY_IDX(inst, prop, idx) \
4018 DT_ENUM_IDX_BY_IDX(DT_DRV_INST(inst), prop, idx)
4019
4026#define DT_INST_ENUM_IDX(inst, prop) \
4027 DT_ENUM_IDX(DT_DRV_INST(inst), prop)
4028
4038#define DT_INST_ENUM_IDX_BY_IDX_OR(inst, prop, idx, default_idx_value) \
4039 DT_ENUM_IDX_BY_IDX_OR(DT_DRV_INST(inst), prop, idx, default_idx_value)
4040
4049#define DT_INST_ENUM_IDX_OR(inst, prop, default_idx_value) \
4050 DT_ENUM_IDX_OR(DT_DRV_INST(inst), prop, default_idx_value)
4051
4060#define DT_INST_ENUM_HAS_VALUE_BY_IDX(inst, prop, idx, value) \
4061 DT_ENUM_HAS_VALUE_BY_IDX(DT_DRV_INST(inst), prop, idx, value)
4062
4071#define DT_INST_ENUM_HAS_VALUE(inst, prop, value) \
4072 DT_ENUM_HAS_VALUE(DT_DRV_INST(inst), prop, value)
4073
4080#define DT_INST_PROP(inst, prop) DT_PROP(DT_DRV_INST(inst), prop)
4081
4088#define DT_INST_PROP_LEN(inst, prop) DT_PROP_LEN(DT_DRV_INST(inst), prop)
4089
4099#define DT_INST_PROP_HAS_IDX(inst, prop, idx) \
4100 DT_PROP_HAS_IDX(DT_DRV_INST(inst), prop, idx)
4101
4110#define DT_INST_PROP_HAS_NAME(inst, prop, name) \
4111 DT_PROP_HAS_NAME(DT_DRV_INST(inst), prop, name)
4112
4120#define DT_INST_PROP_BY_IDX(inst, prop, idx) \
4121 DT_PROP_BY_IDX(DT_DRV_INST(inst), prop, idx)
4122
4130#define DT_INST_PROP_OR(inst, prop, default_value) \
4131 DT_PROP_OR(DT_DRV_INST(inst), prop, default_value)
4132
4140#define DT_INST_PROP_LEN_OR(inst, prop, default_value) \
4141 DT_PROP_LEN_OR(DT_DRV_INST(inst), prop, default_value)
4142
4152#define DT_INST_STRING_TOKEN(inst, prop) \
4153 DT_STRING_TOKEN(DT_DRV_INST(inst), prop)
4154
4162#define DT_INST_STRING_UPPER_TOKEN(inst, prop) \
4163 DT_STRING_UPPER_TOKEN(DT_DRV_INST(inst), prop)
4164
4173#define DT_INST_STRING_UNQUOTED(inst, prop) \
4174 DT_STRING_UNQUOTED(DT_DRV_INST(inst), prop)
4175
4183#define DT_INST_STRING_TOKEN_BY_IDX(inst, prop, idx) \
4184 DT_STRING_TOKEN_BY_IDX(DT_DRV_INST(inst), prop, idx)
4185
4193#define DT_INST_STRING_UPPER_TOKEN_BY_IDX(inst, prop, idx) \
4194 DT_STRING_UPPER_TOKEN_BY_IDX(DT_DRV_INST(inst), prop, idx)
4195
4203#define DT_INST_STRING_UNQUOTED_BY_IDX(inst, prop, idx) \
4204 DT_STRING_UNQUOTED_BY_IDX(DT_DRV_INST(inst), prop, idx)
4205
4214#define DT_INST_PROP_BY_PHANDLE(inst, ph, prop) \
4215 DT_INST_PROP_BY_PHANDLE_IDX(inst, ph, 0, prop)
4216
4228#define DT_INST_PROP_BY_PHANDLE_IDX(inst, phs, idx, prop) \
4229 DT_PROP_BY_PHANDLE_IDX(DT_DRV_INST(inst), phs, idx, prop)
4230
4239#define DT_INST_PHA_BY_IDX(inst, pha, idx, cell) \
4240 DT_PHA_BY_IDX(DT_DRV_INST(inst), pha, idx, cell)
4241
4251#define DT_INST_PHA_BY_IDX_OR(inst, pha, idx, cell, default_value) \
4252 DT_PHA_BY_IDX_OR(DT_DRV_INST(inst), pha, idx, cell, default_value)
4253
4262#define DT_INST_PHA(inst, pha, cell) DT_INST_PHA_BY_IDX(inst, pha, 0, cell)
4263
4272#define DT_INST_PHA_OR(inst, pha, cell, default_value) \
4273 DT_INST_PHA_BY_IDX_OR(inst, pha, 0, cell, default_value)
4274
4284#define DT_INST_PHA_BY_NAME(inst, pha, name, cell) \
4285 DT_PHA_BY_NAME(DT_DRV_INST(inst), pha, name, cell)
4286
4296#define DT_INST_PHA_BY_NAME_OR(inst, pha, name, cell, default_value) \
4297 DT_PHA_BY_NAME_OR(DT_DRV_INST(inst), pha, name, cell, default_value)
4298
4307#define DT_INST_PHANDLE_BY_NAME(inst, pha, name) \
4308 DT_PHANDLE_BY_NAME(DT_DRV_INST(inst), pha, name) \
4309
4319#define DT_INST_PHANDLE_BY_IDX(inst, prop, idx) \
4320 DT_PHANDLE_BY_IDX(DT_DRV_INST(inst), prop, idx)
4321
4330#define DT_INST_PHANDLE(inst, prop) DT_INST_PHANDLE_BY_IDX(inst, prop, 0)
4331
4339#define DT_INST_REG_HAS_IDX(inst, idx) DT_REG_HAS_IDX(DT_DRV_INST(inst), idx)
4340
4348#define DT_INST_REG_HAS_NAME(inst, name) DT_REG_HAS_NAME(DT_DRV_INST(inst), name)
4349
4356#define DT_INST_REG_ADDR_BY_IDX_RAW(inst, idx) DT_REG_ADDR_BY_IDX_RAW(DT_DRV_INST(inst), idx)
4357
4364#define DT_INST_REG_ADDR_BY_IDX(inst, idx) DT_REG_ADDR_BY_IDX(DT_DRV_INST(inst), idx)
4365
4372#define DT_INST_REG_SIZE_BY_IDX(inst, idx) \
4373 DT_REG_SIZE_BY_IDX(DT_DRV_INST(inst), idx)
4374
4381#define DT_INST_REG_ADDR_BY_NAME(inst, name) \
4382 DT_REG_ADDR_BY_NAME(DT_DRV_INST(inst), name)
4383
4392#define DT_INST_REG_ADDR_BY_NAME_OR(inst, name, default_value) \
4393 DT_REG_ADDR_BY_NAME_OR(DT_DRV_INST(inst), name, default_value)
4394
4407#define DT_INST_REG_ADDR_BY_NAME_U64(inst, name) \
4408 DT_REG_ADDR_BY_NAME_U64(DT_DRV_INST(inst), name)
4409
4416#define DT_INST_REG_SIZE_BY_NAME(inst, name) \
4417 DT_REG_SIZE_BY_NAME(DT_DRV_INST(inst), name)
4418
4427#define DT_INST_REG_SIZE_BY_NAME_OR(inst, name, default_value) \
4428 DT_REG_SIZE_BY_NAME_OR(DT_DRV_INST(inst), name, default_value)
4429
4435#define DT_INST_REG_ADDR_RAW(inst) DT_INST_REG_ADDR_BY_IDX_RAW(inst, 0)
4436
4442#define DT_INST_REG_ADDR(inst) DT_INST_REG_ADDR_BY_IDX(inst, 0)
4443
4455#define DT_INST_REG_ADDR_U64(inst) DT_REG_ADDR_U64(DT_DRV_INST(inst))
4456
4462#define DT_INST_REG_SIZE(inst) DT_INST_REG_SIZE_BY_IDX(inst, 0)
4463
4470#define DT_INST_NUM_IRQS(inst) DT_NUM_IRQS(DT_DRV_INST(inst))
4471
4478#define DT_INST_IRQ_LEVEL(inst) DT_IRQ_LEVEL(DT_DRV_INST(inst))
4479
4487#define DT_INST_IRQ_BY_IDX(inst, idx, cell) \
4488 DT_IRQ_BY_IDX(DT_DRV_INST(inst), idx, cell)
4489
4496#define DT_INST_IRQ_INTC_BY_IDX(inst, idx) \
4497 DT_IRQ_INTC_BY_IDX(DT_DRV_INST(inst), idx)
4498
4505#define DT_INST_IRQ_INTC_BY_NAME(inst, name) \
4506 DT_IRQ_INTC_BY_NAME(DT_DRV_INST(inst), name)
4507
4515#define DT_INST_IRQ_INTC(inst) \
4516 DT_INST_IRQ_INTC_BY_IDX(inst, 0)
4517
4525#define DT_INST_IRQ_BY_NAME(inst, name, cell) \
4526 DT_IRQ_BY_NAME(DT_DRV_INST(inst), name, cell)
4527
4534#define DT_INST_IRQ(inst, cell) DT_INST_IRQ_BY_IDX(inst, 0, cell)
4535
4541#define DT_INST_IRQN(inst) DT_IRQN(DT_DRV_INST(inst))
4542
4549#define DT_INST_IRQN_BY_IDX(inst, idx) DT_IRQN_BY_IDX(DT_DRV_INST(inst), idx)
4550
4556#define DT_INST_BUS(inst) DT_BUS(DT_DRV_INST(inst))
4557
4565#define DT_INST_ON_BUS(inst, bus) DT_ON_BUS(DT_DRV_INST(inst), bus)
4566
4576#define DT_INST_STRING_TOKEN_OR(inst, name, default_value) \
4577 DT_STRING_TOKEN_OR(DT_DRV_INST(inst), name, default_value)
4578
4587#define DT_INST_STRING_UPPER_TOKEN_OR(inst, name, default_value) \
4588 DT_STRING_UPPER_TOKEN_OR(DT_DRV_INST(inst), name, default_value)
4589
4598#define DT_INST_STRING_UNQUOTED_OR(inst, name, default_value) \
4599 DT_STRING_UNQUOTED_OR(DT_DRV_INST(inst), name, default_value)
4600
4601/*
4602 * @brief Test if any enabled node with the given compatible is on
4603 * the given bus type
4604 *
4605 * This is like DT_ANY_INST_ON_BUS_STATUS_OKAY(), except it can also
4606 * be useful for handling multiple compatibles in single source file.
4607 *
4608 * Example devicetree overlay:
4609 *
4610 * @code{.dts}
4611 * &i2c0 {
4612 * temp: temperature-sensor@76 {
4613 * compatible = "vnd,some-sensor";
4614 * reg = <0x76>;
4615 * };
4616 * };
4617 * @endcode
4618 *
4619 * Example usage, assuming `i2c0` is an I2C bus controller node, and
4620 * therefore `temp` is on an I2C bus:
4621 *
4622 * @code{.c}
4623 * DT_HAS_COMPAT_ON_BUS_STATUS_OKAY(vnd_some_sensor, i2c) // 1
4624 * @endcode
4625 *
4626 * @param compat lowercase-and-underscores compatible, without quotes
4627 * @param bus a binding's bus type as a C token, lowercased and without quotes
4628 * @return 1 if any enabled node with that compatible is on that bus type,
4629 * 0 otherwise
4630 */
4631#define DT_HAS_COMPAT_ON_BUS_STATUS_OKAY(compat, bus) \
4632 IS_ENABLED(DT_CAT4(DT_COMPAT_, compat, _BUS_, bus))
4633
4666#define DT_ANY_INST_ON_BUS_STATUS_OKAY(bus) \
4667 DT_HAS_COMPAT_ON_BUS_STATUS_OKAY(DT_DRV_COMPAT, bus)
4668
4713#define DT_ANY_INST_HAS_PROP_STATUS_OKAY(prop) \
4714 COND_CODE_1(IS_EMPTY(DT_ANY_INST_HAS_PROP_STATUS_OKAY_(prop)), (0), (1))
4715
4760#define DT_ANY_COMPAT_HAS_PROP_STATUS_OKAY(compat, prop) \
4761 (DT_COMPAT_FOREACH_STATUS_OKAY_VARGS(compat, DT_COMPAT_NODE_HAS_PROP_AND_OR, prop) 0)
4762
4828#define DT_INST_FOREACH_STATUS_OKAY(fn) \
4829 COND_CODE_1(DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT), \
4830 (UTIL_CAT(DT_FOREACH_OKAY_INST_, \
4831 DT_DRV_COMPAT)(fn)), \
4832 ())
4833
4846#define DT_INST_FOREACH_STATUS_OKAY_VARGS(fn, ...) \
4847 COND_CODE_1(DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT), \
4848 (UTIL_CAT(DT_FOREACH_OKAY_INST_VARGS_, \
4849 DT_DRV_COMPAT)(fn, __VA_ARGS__)), \
4850 ())
4851
4861#define DT_INST_FOREACH_NODELABEL(inst, fn) \
4862 DT_FOREACH_NODELABEL(DT_DRV_INST(inst), fn)
4863
4875#define DT_INST_FOREACH_NODELABEL_VARGS(inst, fn, ...) \
4876 DT_FOREACH_NODELABEL_VARGS(DT_DRV_INST(inst), fn, __VA_ARGS__)
4877
4888#define DT_INST_FOREACH_PROP_ELEM(inst, prop, fn) \
4889 DT_FOREACH_PROP_ELEM(DT_DRV_INST(inst), prop, fn)
4890
4903#define DT_INST_FOREACH_PROP_ELEM_SEP(inst, prop, fn, sep) \
4904 DT_FOREACH_PROP_ELEM_SEP(DT_DRV_INST(inst), prop, fn, sep)
4905
4920#define DT_INST_FOREACH_PROP_ELEM_VARGS(inst, prop, fn, ...) \
4921 DT_FOREACH_PROP_ELEM_VARGS(DT_DRV_INST(inst), prop, fn, __VA_ARGS__)
4922
4940#define DT_INST_FOREACH_PROP_ELEM_SEP_VARGS(inst, prop, fn, sep, ...) \
4941 DT_FOREACH_PROP_ELEM_SEP_VARGS(DT_DRV_INST(inst), prop, fn, sep, \
4942 __VA_ARGS__)
4943
4950#define DT_INST_NODE_HAS_PROP(inst, prop) \
4951 DT_NODE_HAS_PROP(DT_DRV_INST(inst), prop)
4952
4959#define DT_INST_NODE_HAS_COMPAT(inst, compat) \
4960 DT_NODE_HAS_COMPAT(DT_DRV_INST(inst), compat)
4961
4972#define DT_INST_PHA_HAS_CELL_AT_IDX(inst, pha, idx, cell) \
4973 DT_PHA_HAS_CELL_AT_IDX(DT_DRV_INST(inst), pha, idx, cell)
4974
4984#define DT_INST_PHA_HAS_CELL(inst, pha, cell) \
4985 DT_INST_PHA_HAS_CELL_AT_IDX(inst, pha, 0, cell)
4986
4994#define DT_INST_IRQ_HAS_IDX(inst, idx) DT_IRQ_HAS_IDX(DT_DRV_INST(inst), idx)
4995
5004#define DT_INST_IRQ_HAS_CELL_AT_IDX(inst, idx, cell) \
5005 DT_IRQ_HAS_CELL_AT_IDX(DT_DRV_INST(inst), idx, cell)
5006
5014#define DT_INST_IRQ_HAS_CELL(inst, cell) \
5015 DT_INST_IRQ_HAS_CELL_AT_IDX(inst, 0, cell)
5016
5023#define DT_INST_IRQ_HAS_NAME(inst, name) \
5024 DT_IRQ_HAS_NAME(DT_DRV_INST(inst), name)
5025
5043#define DT_ANY_INST_HAS_PROP_STATUS_OKAY__(idx, prop) \
5044 COND_CODE_1(DT_INST_NODE_HAS_PROP(idx, prop), (1,), ())
5057#define DT_ANY_INST_HAS_PROP_STATUS_OKAY_(prop) \
5058 DT_INST_FOREACH_STATUS_OKAY_VARGS(DT_ANY_INST_HAS_PROP_STATUS_OKAY__, prop)
5059
5060#define DT_PATH_INTERNAL(...) \
5061 UTIL_CAT(DT_ROOT, MACRO_MAP_CAT(DT_S_PREFIX, __VA_ARGS__))
5067#define DT_S_PREFIX(name) _S_##name
5068
5083#define DT_CAT(a1, a2) a1 ## a2
5085#define DT_CAT3(a1, a2, a3) a1 ## a2 ## a3
5087#define DT_CAT4(a1, a2, a3, a4) a1 ## a2 ## a3 ## a4
5089#define DT_CAT5(a1, a2, a3, a4, a5) a1 ## a2 ## a3 ## a4 ## a5
5091#define DT_CAT6(a1, a2, a3, a4, a5, a6) a1 ## a2 ## a3 ## a4 ## a5 ## a6
5093#define DT_CAT7(a1, a2, a3, a4, a5, a6, a7) \
5094 a1 ## a2 ## a3 ## a4 ## a5 ## a6 ## a7
5096#define DT_CAT8(a1, a2, a3, a4, a5, a6, a7, a8) \
5097 a1 ## a2 ## a3 ## a4 ## a5 ## a6 ## a7 ## a8
5098/*
5099 * If you need to define a bigger DT_CATN(), do so here. Don't leave
5100 * any "holes" of undefined macros, please.
5101 */
5102
5104#define DT_DASH(...) MACRO_MAP_CAT(DT_DASH_PREFIX, __VA_ARGS__)
5106#define DT_DASH_PREFIX(name) _##name
5108#define DT_NODE_HAS_STATUS_INTERNAL(node_id, status) \
5109 IS_ENABLED(DT_CAT3(node_id, _STATUS_, status))
5110
5114#define DT_COMPAT_NODE_HAS_PROP_AND_OR(inst, compat, prop) \
5115 DT_NODE_HAS_PROP(DT_INST(inst, compat), prop) ||
5116
5121#if defined(_LINKER) || defined(_ASMLANGUAGE)
5122#define DT_U32_C(_v) (_v)
5123#else
5124#define DT_U32_C(_v) UINT32_C(_v)
5125#endif
5126
5131#if defined(_LINKER) || defined(_ASMLANGUAGE)
5132#define DT_U64_C(_v) (_v)
5133#else
5134#define DT_U64_C(_v) UINT64_C(_v)
5135#endif
5136
5137/* Helpers for DT_NODELABEL_STRING_ARRAY. We define our own stringify
5138 * in order to avoid adding a dependency on toolchain.h..
5139 */
5140#define DT_NODELABEL_STRING_ARRAY_ENTRY_INTERNAL(nodelabel) DT_STRINGIFY_INTERNAL(nodelabel),
5141#define DT_STRINGIFY_INTERNAL(arg) DT_STRINGIFY_INTERNAL_HELPER(arg)
5142#define DT_STRINGIFY_INTERNAL_HELPER(arg) #arg
5143
5146/* have these last so they have access to all previously defined macros */
5149#include <zephyr/devicetree/gpio.h>
5150#include <zephyr/devicetree/spi.h>
5151#include <zephyr/devicetree/dma.h>
5152#include <zephyr/devicetree/pwms.h>
5156#include <zephyr/devicetree/can.h>
5158#include <zephyr/devicetree/mbox.h>
5159
5160#endif /* DEVICETREE_H */
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.
Misc utilities.