Zephyr API Documentation 4.0.99
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 ZEPHYR_INCLUDE_DEVICETREE_H_
17#define ZEPHYR_INCLUDE_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
243#define DT_HAS_ALIAS(alias_name) DT_NODE_EXISTS(DT_ALIAS(alias_name))
244
339#define DT_INST(inst, compat) UTIL_CAT(DT_N_INST, DT_DASH(inst, compat))
340
364#define DT_PARENT(node_id) DT_CAT(node_id, _PARENT)
365
389#define DT_GPARENT(node_id) DT_PARENT(DT_PARENT(node_id))
390
426#define DT_CHILD(node_id, child) UTIL_CAT(node_id, DT_S_PREFIX(child))
427
469#define DT_COMPAT_GET_ANY_STATUS_OKAY(compat) \
470 COND_CODE_1(DT_HAS_COMPAT_STATUS_OKAY(compat), \
471 (DT_INST(0, compat)), \
472 (DT_INVALID_NODE))
473
501#define DT_NODE_PATH(node_id) DT_CAT(node_id, _PATH)
502
527#define DT_NODE_FULL_NAME(node_id) DT_CAT(node_id, _FULL_NAME)
528
555#define DT_NODE_FULL_NAME_UNQUOTED(node_id) DT_CAT(node_id, _FULL_NAME_UNQUOTED)
556
583#define DT_NODE_FULL_NAME_TOKEN(node_id) DT_CAT(node_id, _FULL_NAME_TOKEN)
584
613#define DT_NODE_FULL_NAME_UPPER_TOKEN(node_id) DT_CAT(node_id, _FULL_NAME_UPPER_TOKEN)
614
641#define DT_NODE_CHILD_IDX(node_id) DT_CAT(node_id, _CHILD_IDX)
642
649#define DT_CHILD_NUM(node_id) DT_CAT(node_id, _CHILD_NUM)
650
651
659#define DT_CHILD_NUM_STATUS_OKAY(node_id) \
660 DT_CAT(node_id, _CHILD_NUM_STATUS_OKAY)
661
682#define DT_SAME_NODE(node_id1, node_id2) \
683 (DT_DEP_ORD(node_id1) == (DT_DEP_ORD(node_id2)))
684
709#define DT_NODELABEL_STRING_ARRAY(node_id) \
710 { DT_FOREACH_NODELABEL(node_id, DT_NODELABEL_STRING_ARRAY_ENTRY_INTERNAL) }
711
752#define DT_PROP(node_id, prop) DT_CAT3(node_id, _P_, prop)
753
786#define DT_PROP_LEN(node_id, prop) DT_CAT4(node_id, _P_, prop, _LEN)
787
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))
805
826#define DT_PROP_HAS_IDX(node_id, prop, idx) \
827 IS_ENABLED(DT_CAT6(node_id, _P_, prop, _IDX_, idx, _EXISTS))
828
861#define DT_PROP_HAS_NAME(node_id, prop, name) \
862 IS_ENABLED(DT_CAT6(node_id, _P_, prop, _NAME_, name, _EXISTS))
863
898#define DT_PROP_BY_IDX(node_id, prop, idx) \
899 DT_CAT5(node_id, _P_, prop, _IDX_, idx)
900
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))
917
973#define DT_ENUM_IDX_BY_IDX(node_id, prop, idx) \
974 DT_CAT6(node_id, _P_, prop, _IDX_, idx, _ENUM_IDX)
975
982#define DT_ENUM_IDX(node_id, prop) DT_ENUM_IDX_BY_IDX(node_id, prop, 0)
983
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))
1002
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)
1013
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))
1025
1033#define DT_ENUM_HAS_VALUE(node_id, prop, value) \
1034 DT_ENUM_HAS_VALUE_BY_IDX(node_id, prop, 0, value)
1035
1095#define DT_STRING_TOKEN(node_id, prop) \
1096 DT_CAT4(node_id, _P_, prop, _STRING_TOKEN)
1097
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))
1114
1172#define DT_STRING_UPPER_TOKEN(node_id, prop) \
1173 DT_CAT4(node_id, _P_, prop, _STRING_UPPER_TOKEN)
1174
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))
1192
1233#define DT_STRING_UNQUOTED(node_id, prop) \
1234 DT_CAT4(node_id, _P_, prop, _STRING_UNQUOTED)
1235
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))
1253
1301#define DT_STRING_TOKEN_BY_IDX(node_id, prop, idx) \
1302 DT_CAT6(node_id, _P_, prop, _IDX_, idx, _STRING_TOKEN)
1303
1351#define DT_STRING_UPPER_TOKEN_BY_IDX(node_id, prop, idx) \
1352 DT_CAT6(node_id, _P_, prop, _IDX_, idx, _STRING_UPPER_TOKEN)
1353
1394#define DT_STRING_UNQUOTED_BY_IDX(node_id, prop, idx) \
1395 DT_CAT6(node_id, _P_, prop, _IDX_, idx, _STRING_UNQUOTED)
1396
1397/*
1398 * phandle properties
1399 *
1400 * These are special-cased to manage the impedance mismatch between
1401 * phandles, which are just uint32_t node properties that only make sense
1402 * within the tree itself, and C values.
1403 */
1404
1450#define DT_PROP_BY_PHANDLE_IDX(node_id, phs, idx, prop) \
1451 DT_PROP(DT_PHANDLE_BY_IDX(node_id, phs, idx), prop)
1452
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)
1474
1486#define DT_PROP_BY_PHANDLE(node_id, ph, prop) \
1487 DT_PROP_BY_PHANDLE_IDX(node_id, ph, 0, prop)
1488
1543#define DT_PHA_BY_IDX(node_id, pha, idx, cell) \
1544 DT_CAT7(node_id, _P_, pha, _IDX_, idx, _VAL_, cell)
1545
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)
1571
1579#define DT_PHA(node_id, pha, cell) DT_PHA_BY_IDX(node_id, pha, 0, cell)
1580
1595#define DT_PHA_OR(node_id, pha, cell, default_value) \
1596 DT_PHA_BY_IDX_OR(node_id, pha, 0, cell, default_value)
1597
1638#define DT_PHA_BY_NAME(node_id, pha, name, cell) \
1639 DT_CAT7(node_id, _P_, pha, _NAME_, name, _VAL_, cell)
1640
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)
1664
1712#define DT_PHANDLE_BY_NAME(node_id, pha, name) \
1713 DT_CAT6(node_id, _P_, pha, _NAME_, name, _PH)
1714
1764#define DT_PHANDLE_BY_IDX(node_id, prop, idx) \
1765 DT_CAT6(node_id, _P_, prop, _IDX_, idx, _PH)
1766
1778#define DT_PHANDLE(node_id, prop) DT_PHANDLE_BY_IDX(node_id, prop, 0)
1779
1826#define DT_NUM_RANGES(node_id) DT_CAT(node_id, _RANGES_NUM)
1827
1880#define DT_RANGES_HAS_IDX(node_id, idx) \
1881 IS_ENABLED(DT_CAT4(node_id, _RANGES_IDX_, idx, _EXISTS))
1882
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))
1937
1975#define DT_RANGES_CHILD_BUS_FLAGS_BY_IDX(node_id, idx) \
1976 DT_CAT4(node_id, _RANGES_IDX_, idx, _VAL_CHILD_BUS_FLAGS)
1977
2024#define DT_RANGES_CHILD_BUS_ADDRESS_BY_IDX(node_id, idx) \
2025 DT_CAT4(node_id, _RANGES_IDX_, idx, _VAL_CHILD_BUS_ADDRESS)
2026
2073#define DT_RANGES_PARENT_BUS_ADDRESS_BY_IDX(node_id, idx) \
2074 DT_CAT4(node_id, _RANGES_IDX_, idx, _VAL_PARENT_BUS_ADDRESS)
2075
2122#define DT_RANGES_LENGTH_BY_IDX(node_id, idx) \
2123 DT_CAT4(node_id, _RANGES_IDX_, idx, _VAL_LENGTH)
2124
2164#define DT_FOREACH_RANGE(node_id, fn) \
2165 DT_CAT(node_id, _FOREACH_RANGE)(fn)
2166
2212#define DT_NODE_VENDOR_BY_IDX(node_id, idx) \
2213 DT_CAT3(node_id, _COMPAT_VENDOR_IDX_, idx)
2214
2227#define DT_NODE_VENDOR_HAS_IDX(node_id, idx) \
2228 IS_ENABLED(DT_CAT4(node_id, _COMPAT_VENDOR_IDX_, idx, _EXISTS))
2229
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))
2247
2256#define DT_NODE_VENDOR_OR(node_id, default_value) \
2257 DT_NODE_VENDOR_BY_IDX_OR(node_id, 0, default_value)
2258
2288#define DT_NODE_MODEL_BY_IDX(node_id, idx) \
2289 DT_CAT3(node_id, _COMPAT_MODEL_IDX_, idx)
2290
2303#define DT_NODE_MODEL_HAS_IDX(node_id, idx) \
2304 IS_ENABLED(DT_CAT4(node_id, _COMPAT_MODEL_IDX_, idx, _EXISTS))
2305
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))
2323
2332#define DT_NODE_MODEL_OR(node_id, default_value) \
2333 DT_NODE_MODEL_BY_IDX_OR(node_id, 0, default_value)
2334
2352#define DT_NUM_REGS(node_id) DT_CAT(node_id, _REG_NUM)
2353
2365#define DT_REG_HAS_IDX(node_id, idx) \
2366 IS_ENABLED(DT_CAT4(node_id, _REG_IDX_, idx, _EXISTS))
2367
2379#define DT_REG_HAS_NAME(node_id, name) \
2380 IS_ENABLED(DT_CAT4(node_id, _REG_NAME_, name, _EXISTS))
2381
2393#define DT_REG_ADDR_BY_IDX_RAW(node_id, idx) \
2394 DT_CAT4(node_id, _REG_IDX_, idx, _VAL_ADDRESS)
2395
2407#define DT_REG_ADDR_RAW(node_id) \
2408 DT_REG_ADDR_BY_IDX_RAW(node_id, 0)
2409
2416#define DT_REG_ADDR_BY_IDX(node_id, idx) \
2417 DT_U32_C(DT_REG_ADDR_BY_IDX_RAW(node_id, idx))
2418
2430#define DT_REG_SIZE_BY_IDX(node_id, idx) \
2431 DT_U32_C(DT_CAT4(node_id, _REG_IDX_, idx, _VAL_SIZE))
2432
2440#define DT_REG_ADDR(node_id) DT_REG_ADDR_BY_IDX(node_id, 0)
2441
2452#define DT_REG_ADDR_U64(node_id) DT_U64_C(DT_REG_ADDR_BY_IDX_RAW(node_id, 0))
2453
2461#define DT_REG_SIZE(node_id) DT_REG_SIZE_BY_IDX(node_id, 0)
2462
2469#define DT_REG_ADDR_BY_NAME(node_id, name) \
2470 DT_U32_C(DT_CAT4(node_id, _REG_NAME_, name, _VAL_ADDRESS))
2471
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))
2483
2496#define DT_REG_ADDR_BY_NAME_U64(node_id, name) \
2497 DT_U64_C(DT_CAT4(node_id, _REG_NAME_, name, _VAL_ADDRESS))
2498
2505#define DT_REG_SIZE_BY_NAME(node_id, name) \
2506 DT_U32_C(DT_CAT4(node_id, _REG_NAME_, name, _VAL_SIZE))
2507
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))
2519
2520
2539#define DT_NUM_IRQS(node_id) DT_CAT(node_id, _IRQ_NUM)
2540
2565#define DT_NUM_NODELABELS(node_id) DT_CAT(node_id, _NODELABEL_NUM)
2566
2573#define DT_IRQ_LEVEL(node_id) DT_CAT(node_id, _IRQ_LEVEL)
2574
2585#define DT_IRQ_HAS_IDX(node_id, idx) \
2586 IS_ENABLED(DT_CAT4(node_id, _IRQ_IDX_, idx, _EXISTS))
2587
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))
2600
2608#define DT_IRQ_HAS_CELL(node_id, cell) DT_IRQ_HAS_CELL_AT_IDX(node_id, 0, cell)
2609
2619#define DT_IRQ_HAS_NAME(node_id, name) \
2620 IS_ENABLED(DT_CAT4(node_id, _IRQ_NAME_, name, _VAL_irq_EXISTS))
2621
2657#define DT_IRQ_BY_IDX(node_id, idx, cell) \
2658 DT_CAT5(node_id, _IRQ_IDX_, idx, _VAL_, cell)
2659
2675#define DT_IRQ_BY_NAME(node_id, name, cell) \
2676 DT_CAT5(node_id, _IRQ_NAME_, name, _VAL_, cell)
2677
2685#define DT_IRQ(node_id, cell) DT_IRQ_BY_IDX(node_id, 0, cell)
2686
2729#define DT_IRQ_INTC_BY_IDX(node_id, idx) \
2730 DT_CAT4(node_id, _IRQ_IDX_, idx, _CONTROLLER)
2731
2776#define DT_IRQ_INTC_BY_NAME(node_id, name) \
2777 DT_CAT4(node_id, _IRQ_NAME_, name, _CONTROLLER)
2778
2818#define DT_IRQ_INTC(node_id) \
2819 DT_IRQ_INTC_BY_IDX(node_id, 0)
2820
2825/* DT helper macro to encode a node's IRQN to level 1 according to the multi-level scheme */
2826#define DT_IRQN_L1_INTERNAL(node_id, idx) DT_IRQ_BY_IDX(node_id, idx, irq)
2827/* DT helper macro to encode a node's IRQN to level 2 according to the multi-level scheme */
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))
2831/* DT helper macro to encode a node's IRQN to level 3 according to the multi-level scheme */
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))
2836/* DT helper macro for the macros above */
2837#define DT_IRQN_LVL_INTERNAL(node_id, idx, level) DT_CAT3(DT_IRQN_L, level, _INTERNAL)(node_id, idx)
2838
2843#define DT_MULTI_LEVEL_IRQN_INTERNAL(node_id, idx) \
2844 DT_IRQN_LVL_INTERNAL(node_id, idx, DT_IRQ_LEVEL(node_id))
2845
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)))
2862
2873#define DT_IRQN(node_id) DT_IRQN_BY_IDX(node_id, 0)
2874
2893#define DT_CHOSEN(prop) DT_CAT(DT_CHOSEN_, prop)
2894
2901#define DT_HAS_CHOSEN(prop) IS_ENABLED(DT_CAT3(DT_CHOSEN_, prop, _EXISTS))
2902
2922#define DT_FOREACH_NODE(fn) DT_FOREACH_HELPER(fn)
2923
2936#define DT_FOREACH_NODE_VARGS(fn, ...) DT_FOREACH_VARGS_HELPER(fn, __VA_ARGS__)
2937
2949#define DT_FOREACH_STATUS_OKAY_NODE(fn) DT_FOREACH_OKAY_HELPER(fn)
2950
2965#define DT_FOREACH_STATUS_OKAY_NODE_VARGS(fn, ...) DT_FOREACH_OKAY_VARGS_HELPER(fn, __VA_ARGS__)
2966
3010#define DT_FOREACH_CHILD(node_id, fn) \
3011 DT_CAT(node_id, _FOREACH_CHILD)(fn)
3012
3053#define DT_FOREACH_CHILD_SEP(node_id, fn, sep) \
3054 DT_CAT(node_id, _FOREACH_CHILD_SEP)(fn, sep)
3055
3071#define DT_FOREACH_CHILD_VARGS(node_id, fn, ...) \
3072 DT_CAT(node_id, _FOREACH_CHILD_VARGS)(fn, __VA_ARGS__)
3073
3089#define DT_FOREACH_CHILD_SEP_VARGS(node_id, fn, sep, ...) \
3090 DT_CAT(node_id, _FOREACH_CHILD_SEP_VARGS)(fn, sep, __VA_ARGS__)
3091
3107#define DT_FOREACH_CHILD_STATUS_OKAY(node_id, fn) \
3108 DT_CAT(node_id, _FOREACH_CHILD_STATUS_OKAY)(fn)
3109
3126#define DT_FOREACH_CHILD_STATUS_OKAY_SEP(node_id, fn, sep) \
3127 DT_CAT(node_id, _FOREACH_CHILD_STATUS_OKAY_SEP)(fn, sep)
3128
3148#define DT_FOREACH_CHILD_STATUS_OKAY_VARGS(node_id, fn, ...) \
3149 DT_CAT(node_id, _FOREACH_CHILD_STATUS_OKAY_VARGS)(fn, __VA_ARGS__)
3150
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__)
3171
3222#define DT_FOREACH_PROP_ELEM(node_id, prop, fn) \
3223 DT_CAT4(node_id, _P_, prop, _FOREACH_PROP_ELEM)(fn)
3224
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)
3269
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__)
3292
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__)
3312
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)), \
3369 ())
3370
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__)), \
3419 ())
3420
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__)), \
3437 ())
3438
3439
3478#define DT_FOREACH_NODELABEL(node_id, fn) DT_CAT(node_id, _FOREACH_NODELABEL)(fn)
3479
3517#define DT_FOREACH_NODELABEL_VARGS(node_id, fn, ...) \
3518 DT_CAT(node_id, _FOREACH_NODELABEL_VARGS)(fn, __VA_ARGS__)
3519
3544#define DT_NODE_EXISTS(node_id) IS_ENABLED(DT_CAT(node_id, _EXISTS))
3545
3567#define DT_NODE_HAS_STATUS(node_id, status) \
3568 DT_NODE_HAS_STATUS_INTERNAL(node_id, status)
3569
3590#define DT_NODE_HAS_STATUS_OKAY(node_id) DT_NODE_HAS_STATUS(node_id, okay)
3591
3611#define DT_HAS_COMPAT_STATUS_OKAY(compat) \
3612 IS_ENABLED(DT_CAT(DT_COMPAT_HAS_OKAY_, compat))
3613
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)))
3623
3651#define DT_NODE_HAS_COMPAT(node_id, compat) \
3652 IS_ENABLED(DT_CAT3(node_id, _COMPAT_MATCHES_, compat))
3653
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))
3670
3684#define DT_NODE_HAS_PROP(node_id, prop) \
3685 IS_ENABLED(DT_CAT4(node_id, _P_, prop, _EXISTS))
3686
3687
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))
3707
3717#define DT_PHA_HAS_CELL(node_id, pha, cell) \
3718 DT_PHA_HAS_CELL_AT_IDX(node_id, pha, 0, cell)
3719
3761#define DT_BUS(node_id) DT_CAT(node_id, _BUS)
3762
3791#define DT_ON_BUS(node_id, bus) IS_ENABLED(DT_CAT3(node_id, _BUS_, bus))
3792
3809#define DT_DRV_INST(inst) DT_INST(inst, DT_DRV_COMPAT)
3810
3818#define DT_INST_PARENT(inst) DT_PARENT(DT_DRV_INST(inst))
3819
3827#define DT_INST_GPARENT(inst) DT_GPARENT(DT_DRV_INST(inst))
3828
3838#define DT_INST_CHILD(inst, child) \
3839 DT_CHILD(DT_DRV_INST(inst), child)
3840
3850#define DT_INST_CHILD_NUM(inst) DT_CHILD_NUM(DT_DRV_INST(inst))
3851
3861#define DT_INST_CHILD_NUM_STATUS_OKAY(inst) \
3862 DT_CHILD_NUM_STATUS_OKAY(DT_DRV_INST(inst))
3863
3872#define DT_INST_NODELABEL_STRING_ARRAY(inst) DT_NODELABEL_STRING_ARRAY(DT_DRV_INST(inst))
3873
3882#define DT_INST_NUM_NODELABELS(inst) DT_NUM_NODELABELS(DT_DRV_INST(inst))
3883
3898#define DT_INST_FOREACH_CHILD(inst, fn) \
3899 DT_FOREACH_CHILD(DT_DRV_INST(inst), fn)
3900
3914#define DT_INST_FOREACH_CHILD_SEP(inst, fn, sep) \
3915 DT_FOREACH_CHILD_SEP(DT_DRV_INST(inst), fn, sep)
3916
3932#define DT_INST_FOREACH_CHILD_VARGS(inst, fn, ...) \
3933 DT_FOREACH_CHILD_VARGS(DT_DRV_INST(inst), fn, __VA_ARGS__)
3934
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__)
3951
3963#define DT_INST_FOREACH_CHILD_STATUS_OKAY(inst, fn) \
3964 DT_FOREACH_CHILD_STATUS_OKAY(DT_DRV_INST(inst), fn)
3965
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)
3982
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__)
3998
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__)
4016
4024#define DT_INST_ENUM_IDX_BY_IDX(inst, prop, idx) \
4025 DT_ENUM_IDX_BY_IDX(DT_DRV_INST(inst), prop, idx)
4026
4033#define DT_INST_ENUM_IDX(inst, prop) \
4034 DT_ENUM_IDX(DT_DRV_INST(inst), prop)
4035
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)
4047
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)
4058
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)
4069
4078#define DT_INST_ENUM_HAS_VALUE(inst, prop, value) \
4079 DT_ENUM_HAS_VALUE(DT_DRV_INST(inst), prop, value)
4080
4087#define DT_INST_PROP(inst, prop) DT_PROP(DT_DRV_INST(inst), prop)
4088
4095#define DT_INST_PROP_LEN(inst, prop) DT_PROP_LEN(DT_DRV_INST(inst), prop)
4096
4106#define DT_INST_PROP_HAS_IDX(inst, prop, idx) \
4107 DT_PROP_HAS_IDX(DT_DRV_INST(inst), prop, idx)
4108
4117#define DT_INST_PROP_HAS_NAME(inst, prop, name) \
4118 DT_PROP_HAS_NAME(DT_DRV_INST(inst), prop, name)
4119
4127#define DT_INST_PROP_BY_IDX(inst, prop, idx) \
4128 DT_PROP_BY_IDX(DT_DRV_INST(inst), prop, idx)
4129
4137#define DT_INST_PROP_OR(inst, prop, default_value) \
4138 DT_PROP_OR(DT_DRV_INST(inst), prop, default_value)
4139
4147#define DT_INST_PROP_LEN_OR(inst, prop, default_value) \
4148 DT_PROP_LEN_OR(DT_DRV_INST(inst), prop, default_value)
4149
4159#define DT_INST_STRING_TOKEN(inst, prop) \
4160 DT_STRING_TOKEN(DT_DRV_INST(inst), prop)
4161
4169#define DT_INST_STRING_UPPER_TOKEN(inst, prop) \
4170 DT_STRING_UPPER_TOKEN(DT_DRV_INST(inst), prop)
4171
4180#define DT_INST_STRING_UNQUOTED(inst, prop) \
4181 DT_STRING_UNQUOTED(DT_DRV_INST(inst), prop)
4182
4190#define DT_INST_STRING_TOKEN_BY_IDX(inst, prop, idx) \
4191 DT_STRING_TOKEN_BY_IDX(DT_DRV_INST(inst), prop, idx)
4192
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)
4202
4210#define DT_INST_STRING_UNQUOTED_BY_IDX(inst, prop, idx) \
4211 DT_STRING_UNQUOTED_BY_IDX(DT_DRV_INST(inst), prop, idx)
4212
4221#define DT_INST_PROP_BY_PHANDLE(inst, ph, prop) \
4222 DT_INST_PROP_BY_PHANDLE_IDX(inst, ph, 0, prop)
4223
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)
4237
4246#define DT_INST_PHA_BY_IDX(inst, pha, idx, cell) \
4247 DT_PHA_BY_IDX(DT_DRV_INST(inst), pha, idx, cell)
4248
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)
4260
4269#define DT_INST_PHA(inst, pha, cell) DT_INST_PHA_BY_IDX(inst, pha, 0, cell)
4270
4279#define DT_INST_PHA_OR(inst, pha, cell, default_value) \
4280 DT_INST_PHA_BY_IDX_OR(inst, pha, 0, cell, default_value)
4281
4291#define DT_INST_PHA_BY_NAME(inst, pha, name, cell) \
4292 DT_PHA_BY_NAME(DT_DRV_INST(inst), pha, name, cell)
4293
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)
4305
4314#define DT_INST_PHANDLE_BY_NAME(inst, pha, name) \
4315 DT_PHANDLE_BY_NAME(DT_DRV_INST(inst), pha, name) \
4316
4326#define DT_INST_PHANDLE_BY_IDX(inst, prop, idx) \
4327 DT_PHANDLE_BY_IDX(DT_DRV_INST(inst), prop, idx)
4328
4337#define DT_INST_PHANDLE(inst, prop) DT_INST_PHANDLE_BY_IDX(inst, prop, 0)
4338
4346#define DT_INST_REG_HAS_IDX(inst, idx) DT_REG_HAS_IDX(DT_DRV_INST(inst), idx)
4347
4355#define DT_INST_REG_HAS_NAME(inst, name) DT_REG_HAS_NAME(DT_DRV_INST(inst), name)
4356
4363#define DT_INST_REG_ADDR_BY_IDX_RAW(inst, idx) DT_REG_ADDR_BY_IDX_RAW(DT_DRV_INST(inst), idx)
4364
4371#define DT_INST_REG_ADDR_BY_IDX(inst, idx) DT_REG_ADDR_BY_IDX(DT_DRV_INST(inst), idx)
4372
4379#define DT_INST_REG_SIZE_BY_IDX(inst, idx) \
4380 DT_REG_SIZE_BY_IDX(DT_DRV_INST(inst), idx)
4381
4388#define DT_INST_REG_ADDR_BY_NAME(inst, name) \
4389 DT_REG_ADDR_BY_NAME(DT_DRV_INST(inst), name)
4390
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)
4401
4414#define DT_INST_REG_ADDR_BY_NAME_U64(inst, name) \
4415 DT_REG_ADDR_BY_NAME_U64(DT_DRV_INST(inst), name)
4416
4423#define DT_INST_REG_SIZE_BY_NAME(inst, name) \
4424 DT_REG_SIZE_BY_NAME(DT_DRV_INST(inst), name)
4425
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)
4436
4442#define DT_INST_REG_ADDR_RAW(inst) DT_INST_REG_ADDR_BY_IDX_RAW(inst, 0)
4443
4449#define DT_INST_REG_ADDR(inst) DT_INST_REG_ADDR_BY_IDX(inst, 0)
4450
4462#define DT_INST_REG_ADDR_U64(inst) DT_REG_ADDR_U64(DT_DRV_INST(inst))
4463
4469#define DT_INST_REG_SIZE(inst) DT_INST_REG_SIZE_BY_IDX(inst, 0)
4470
4477#define DT_INST_NUM_IRQS(inst) DT_NUM_IRQS(DT_DRV_INST(inst))
4478
4485#define DT_INST_IRQ_LEVEL(inst) DT_IRQ_LEVEL(DT_DRV_INST(inst))
4486
4494#define DT_INST_IRQ_BY_IDX(inst, idx, cell) \
4495 DT_IRQ_BY_IDX(DT_DRV_INST(inst), idx, cell)
4496
4503#define DT_INST_IRQ_INTC_BY_IDX(inst, idx) \
4504 DT_IRQ_INTC_BY_IDX(DT_DRV_INST(inst), idx)
4505
4512#define DT_INST_IRQ_INTC_BY_NAME(inst, name) \
4513 DT_IRQ_INTC_BY_NAME(DT_DRV_INST(inst), name)
4514
4522#define DT_INST_IRQ_INTC(inst) \
4523 DT_INST_IRQ_INTC_BY_IDX(inst, 0)
4524
4532#define DT_INST_IRQ_BY_NAME(inst, name, cell) \
4533 DT_IRQ_BY_NAME(DT_DRV_INST(inst), name, cell)
4534
4541#define DT_INST_IRQ(inst, cell) DT_INST_IRQ_BY_IDX(inst, 0, cell)
4542
4548#define DT_INST_IRQN(inst) DT_IRQN(DT_DRV_INST(inst))
4549
4556#define DT_INST_IRQN_BY_IDX(inst, idx) DT_IRQN_BY_IDX(DT_DRV_INST(inst), idx)
4557
4563#define DT_INST_BUS(inst) DT_BUS(DT_DRV_INST(inst))
4564
4572#define DT_INST_ON_BUS(inst, bus) DT_ON_BUS(DT_DRV_INST(inst), bus)
4573
4583#define DT_INST_STRING_TOKEN_OR(inst, name, default_value) \
4584 DT_STRING_TOKEN_OR(DT_DRV_INST(inst), name, default_value)
4585
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)
4596
4605#define DT_INST_STRING_UNQUOTED_OR(inst, name, default_value) \
4606 DT_STRING_UNQUOTED_OR(DT_DRV_INST(inst), name, default_value)
4607
4608/*
4609 * @brief Test if any enabled node with the given compatible is on
4610 * the given bus type
4611 *
4612 * This is like DT_ANY_INST_ON_BUS_STATUS_OKAY(), except it can also
4613 * be useful for handling multiple compatibles in single source file.
4614 *
4615 * Example devicetree overlay:
4616 *
4617 * @code{.dts}
4618 * &i2c0 {
4619 * temp: temperature-sensor@76 {
4620 * compatible = "vnd,some-sensor";
4621 * reg = <0x76>;
4622 * };
4623 * };
4624 * @endcode
4625 *
4626 * Example usage, assuming `i2c0` is an I2C bus controller node, and
4627 * therefore `temp` is on an I2C bus:
4628 *
4629 * @code{.c}
4630 * DT_HAS_COMPAT_ON_BUS_STATUS_OKAY(vnd_some_sensor, i2c) // 1
4631 * @endcode
4632 *
4633 * @param compat lowercase-and-underscores compatible, without quotes
4634 * @param bus a binding's bus type as a C token, lowercased and without quotes
4635 * @return 1 if any enabled node with that compatible is on that bus type,
4636 * 0 otherwise
4637 */
4638#define DT_HAS_COMPAT_ON_BUS_STATUS_OKAY(compat, bus) \
4639 IS_ENABLED(DT_CAT4(DT_COMPAT_, compat, _BUS_, bus))
4640
4673#define DT_ANY_INST_ON_BUS_STATUS_OKAY(bus) \
4674 DT_HAS_COMPAT_ON_BUS_STATUS_OKAY(DT_DRV_COMPAT, bus)
4675
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))
4722
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)
4769
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)), \
4839 ())
4840
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__)), \
4857 ())
4858
4868#define DT_INST_FOREACH_NODELABEL(inst, fn) \
4869 DT_FOREACH_NODELABEL(DT_DRV_INST(inst), fn)
4870
4882#define DT_INST_FOREACH_NODELABEL_VARGS(inst, fn, ...) \
4883 DT_FOREACH_NODELABEL_VARGS(DT_DRV_INST(inst), fn, __VA_ARGS__)
4884
4895#define DT_INST_FOREACH_PROP_ELEM(inst, prop, fn) \
4896 DT_FOREACH_PROP_ELEM(DT_DRV_INST(inst), prop, fn)
4897
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)
4912
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__)
4929
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, \
4949 __VA_ARGS__)
4950
4957#define DT_INST_NODE_HAS_PROP(inst, prop) \
4958 DT_NODE_HAS_PROP(DT_DRV_INST(inst), prop)
4959
4966#define DT_INST_NODE_HAS_COMPAT(inst, compat) \
4967 DT_NODE_HAS_COMPAT(DT_DRV_INST(inst), compat)
4968
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)
4981
4991#define DT_INST_PHA_HAS_CELL(inst, pha, cell) \
4992 DT_INST_PHA_HAS_CELL_AT_IDX(inst, pha, 0, cell)
4993
5001#define DT_INST_IRQ_HAS_IDX(inst, idx) DT_IRQ_HAS_IDX(DT_DRV_INST(inst), idx)
5002
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)
5013
5021#define DT_INST_IRQ_HAS_CELL(inst, cell) \
5022 DT_INST_IRQ_HAS_CELL_AT_IDX(inst, 0, cell)
5023
5030#define DT_INST_IRQ_HAS_NAME(inst, name) \
5031 DT_IRQ_HAS_NAME(DT_DRV_INST(inst), name)
5032
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)
5066
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
5075
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
5105/*
5106 * If you need to define a bigger DT_CATN(), do so here. Don't leave
5107 * any "holes" of undefined macros, please.
5108 */
5109
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))
5117
5121#define DT_COMPAT_NODE_HAS_PROP_AND_OR(inst, compat, prop) \
5122 DT_NODE_HAS_PROP(DT_INST(inst, compat), prop) ||
5123
5128#if defined(_LINKER) || defined(_ASMLANGUAGE)
5129#define DT_U32_C(_v) (_v)
5130#else
5131#define DT_U32_C(_v) UINT32_C(_v)
5132#endif
5133
5138#if defined(_LINKER) || defined(_ASMLANGUAGE)
5139#define DT_U64_C(_v) (_v)
5140#else
5141#define DT_U64_C(_v) UINT64_C(_v)
5142#endif
5143
5144/* Helpers for DT_NODELABEL_STRING_ARRAY. We define our own stringify
5145 * in order to avoid adding a dependency on toolchain.h..
5146 */
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
5150
5153/* have these last so they have access to all previously defined macros */
5156#include <zephyr/devicetree/gpio.h>
5157#include <zephyr/devicetree/spi.h>
5158#include <zephyr/devicetree/dma.h>
5159#include <zephyr/devicetree/pwms.h>
5163#include <zephyr/devicetree/can.h>
5165#include <zephyr/devicetree/mbox.h>
5166
5167#endif /* ZEPHYR_INCLUDE_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.