Lines Matching +full:child +full:- +full:prop

2  * SPDX-License-Identifier: Apache-2.0
36 * -----------------
39 * part in DT_N_<path-id>_P_<property-id> macros, or the "prop-suf"
72 * @defgroup devicetree-generic-id Node identifiers and helpers
97 * The arguments to this macro are the names of non-root nodes in the
99 * Non-alphanumeric characters in each name must be converted to
109 * current-speed = <115200>;
120 * Example usage with DT_PROP() to get the `current-speed` property:
126 * (The `current-speed` property is also in `lowercase-and-underscores`
131 * - the first argument corresponds to a child node of the root (`soc` above)
132 * - a second argument corresponds to a child of the first argument
135 * - and so on for deeper nodes in the desired node's path
137 * @param ... lowercase-and-underscores node names along the node's path,
146 * Convert non-alphanumeric characters in the node label to
156 * current-speed = <115200>;
168 * current-speed property:
178 * L2_0: l2-cache {
179 * cache-level = <2>;
185 * Example usage to get the cache-level property:
194 * @param label lowercase-and-underscores node label name
204 * non-alphanumeric characters in the alias property to underscores to
212 * my-serial = &serial1;
218 * current-speed = <115200>;
226 * `serial@40001000` node. Notice how `my-serial` in the devicetree
228 * DT_PROP() to get the current-speed property:
234 * @param alias lowercase-and-underscores alias name.
243 * instance numbers, which are zero-based indexes specific to that
246 * lowercase-and-underscores version of the compatible, @p compat.
250 * - for each compatible, instance numbers start at 0 and are contiguous
251 * - exactly one instance number is assigned for each node with a compatible,
253 * - enabled nodes (status property is `okay` or missing) are assigned the
259 * - instance numbers **in no way reflect** any numbering scheme that
263 * - there **is no general guarantee** that the same node will have
271 * compatible = "vnd,soc-serial";
273 * current-speed = <9600>;
278 * compatible = "vnd,soc-serial";
280 * current-speed = <57600>;
285 * compatible = "vnd,soc-serial";
286 * current-speed = <115200>;
292 * `"vnd,soc-serial"`, that compatible has nodes with instance numbers
306 * // have instance number 0, so this could be the current-speed
312 * // this expands to 115200, and vice-versa.
321 * Notice how `"vnd,soc-serial"` in the devicetree becomes `vnd_soc_serial`
322 * (without quotes) in the DT_INST() arguments. (As usual, `current-speed`
329 * @param compat lowercase-and-underscores compatible, without quotes
341 * parent: parent-node {
342 * child: child-node {
352 * DT_PARENT(DT_NODELABEL(child))
366 * gparent: grandparent-node {
367 * parent: parent-node {
368 * child: child-node { ... }
376 * DT_GPARENT(DT_NODELABEL(child))
377 * DT_PARENT(DT_PARENT(DT_NODELABEL(child))
386 * @brief Get a node identifier for a child node
392 * soc-label: soc {
395 * current-speed = <115200>;
410 * Node labels like `serial1` cannot be used as the @p child argument
417 * @param child lowercase-and-underscores child node name
418 * @return node identifier for the node with the name referred to by 'child'
420 #define DT_CHILD(node_id, child) UTIL_CAT(node_id, DT_S_PREFIX(child)) argument
433 * node-a {
438 * node-b {
443 * node-c {
455 * This expands to a node identifier for either `node-a` or `node-b`.
456 * It will not expand to a node identifier for `node-c`, because that
459 * @param compat lowercase-and-underscores compatible, without quotes
479 * node: my-node@12345678 { ... };
487 * DT_NODE_PATH(DT_NODELABEL(node)) // "/soc/my-node@12345678"
498 * @brief Get a devicetree node's name with unit-address as a string literal
500 * This returns the node name and unit-address from a node identifier.
507 * node: my-node@12345678 { ... };
515 * DT_NODE_FULL_NAME(DT_NODELABEL(node)) // "my-node@12345678"
519 * @return the node's name with unit-address as a string in the devicetree
526 * Indexes are zero-based.
534 * c1: child-1 {};
535 * c2: child-2 {};
579 * @defgroup devicetree-generic-prop Property accessors
590 * - string: a string literal
591 * - boolean: `0` if the property is false, or `1` if it is true
592 * - int: the property's value as an integer literal
593 * - array, uint8-array, string-array: an initializer expression in braces,
596 * - phandle: a node identifier for the node with that phandle
601 * type string-array, `status` has type string, and
602 * `interrupt-controller` has type boolean.
611 * @param prop lowercase-and-underscores property name
614 #define DT_PROP(node_id, prop) DT_CAT3(node_id, _P_, prop) argument
624 * - for types array, string-array, and uint8-array, this expands
626 * - for type phandles, this expands to the number of phandles
627 * - for type phandle-array, this expands to the number of
629 * - for type phandle, this expands to 1 (so that a phandle
631 * - for type string, this expands to 1 (so that a string can be
632 * treated as a degenerate case of string-array with length 1)
636 * - reg property: use `DT_NUM_REGS(node_id)` instead
637 * - interrupts property: use `DT_NUM_IRQS(node_id)` instead
639 * It is an error to use this macro with the `ranges`, `dma-ranges`, `reg`
645 * @param prop a lowercase-and-underscores property with a logical length
648 #define DT_PROP_LEN(node_id, prop) DT_CAT4(node_id, _P_, prop, _LEN) argument
654 * this expands to DT_PROP_LEN(node_id, prop). The @p default_value
660 * @param prop a lowercase-and-underscores property with a logical length
664 #define DT_PROP_LEN_OR(node_id, prop, default_value) \ argument
665 COND_CODE_1(DT_NODE_HAS_PROP(node_id, prop), \
666 (DT_PROP_LEN(node_id, prop)), (default_value))
671 * If this returns 1, then DT_PROP_BY_IDX(node_id, prop, idx) or
672 * DT_PHA_BY_IDX(node_id, prop, idx, ...) are valid at index @p idx.
677 * - `reg` property: use DT_REG_HAS_IDX(node_id, idx) instead
678 * - `interrupts` property: use DT_IRQ_HAS_IDX(node_id, idx) instead
683 * @param prop a lowercase-and-underscores property with a logical length
688 #define DT_PROP_HAS_IDX(node_id, prop, idx) \ argument
689 IS_ENABLED(DT_CAT6(node_id, _P_, prop, _IDX_, idx, _EXISTS))
692 * @brief Is name @p name available in a `foo-names` property?
696 * - `interrupts` property: use DT_IRQ_HAS_NAME(node_id, idx) instead
703 * nx: node-x {
705 * foo-names = "event", "error";
718 * @param prop a lowercase-and-underscores `prop-names` type property
719 * @param name a lowercase-and-underscores name to check
723 #define DT_PROP_HAS_NAME(node_id, prop, name) \ argument
724 IS_ENABLED(DT_CAT6(node_id, _P_, prop, _NAME_, name, _EXISTS))
730 * `node->property[index]`.
734 * - for types array, string-array, uint8-array, and phandles,
735 * this expands to the idx-th array element as an
739 * - for type phandle, idx must be 0 and the expansion is a node
742 * - for type string, idx must be 0 and the expansion is the the
743 * entire string (this treats string like string-array of length 1)
747 * - `reg`: use DT_REG_ADDR_BY_IDX() or DT_REG_SIZE_BY_IDX() instead
748 * - `interrupts`: use DT_IRQ_BY_IDX()
749 * - `ranges`: use DT_NUM_RANGES()
750 * - `dma-ranges`: it is an error to use this property with
756 * @param prop lowercase-and-underscores property name
758 * @return a representation of the idx-th element of the property
760 #define DT_PROP_BY_IDX(node_id, prop, idx) \ argument
761 DT_CAT5(node_id, _P_, prop, _IDX_, idx)
766 * If the value exists, this expands to DT_PROP(node_id, prop).
772 * @param prop lowercase-and-underscores property name
776 #define DT_PROP_OR(node_id, prop, default_value) \ argument
777 COND_CODE_1(DT_NODE_HAS_PROP(node_id, prop), \
778 (DT_PROP(node_id, prop)), (default_value))
800 * maximum-speed = "full-speed";
803 * maximum-speed = "super-speed";
811 * maximum-speed:
814 * - "low-speed"
815 * - "full-speed"
816 * - "high-speed"
817 * - "super-speed"
828 * @param prop lowercase-and-underscores property name
829 * @return zero-based index of the property's value in its enum: list
831 #define DT_ENUM_IDX(node_id, prop) DT_CAT4(node_id, _P_, prop, _ENUM_IDX) argument
837 * DT_ENUM_IDX(node_id, prop).
842 * @param prop lowercase-and-underscores property name
844 * @return zero-based index of the property's value in its enum if present,
847 #define DT_ENUM_IDX_OR(node_id, prop, default_idx_value) \ argument
848 COND_CODE_1(DT_NODE_HAS_PROP(node_id, prop), \
849 (DT_ENUM_IDX(node_id, prop)), (default_idx_value))
855 * @param prop lowercase-and-underscores property name
856 * @param value lowercase-and-underscores enumeration value
859 #define DT_ENUM_HAS_VALUE(node_id, prop, value) \ argument
860 IS_ENABLED(DT_CAT6(node_id, _P_, prop, _ENUM_VAL_, value, _EXISTS))
866 * converting any non-alphanumeric characters to underscores. This can
877 * n1: node-1 {
878 * prop = "foo";
880 * n2: node-2 {
881 * prop = "FOO";
883 * n3: node-3 {
884 * prop = "123 foo";
892 * prop:
899 * DT_STRING_TOKEN(DT_NODELABEL(n1), prop) // foo
900 * DT_STRING_TOKEN(DT_NODELABEL(n2), prop) // FOO
901 * DT_STRING_TOKEN(DT_NODELABEL(n3), prop) // 123_foo
906 * - Unlike C identifiers, the property values may begin with a
910 * - The uppercased `"FOO"` in the DTS remains `FOO` as a token. It is
913 * - The whitespace in the DTS `"123 foo"` string is converted to
917 * @param prop lowercase-and-underscores property name
918 * @return the value of @p prop as a token, i.e. without any quotes
921 #define DT_STRING_TOKEN(node_id, prop) \ argument
922 DT_CAT4(node_id, _P_, prop, _STRING_TOKEN)
927 * If the value exists, this expands to DT_STRING_TOKEN(node_id, prop).
933 * @param prop lowercase-and-underscores property name
937 #define DT_STRING_TOKEN_OR(node_id, prop, default_value) \ argument
938 COND_CODE_1(DT_NODE_HAS_PROP(node_id, prop), \
939 (DT_STRING_TOKEN(node_id, prop)), (default_value))
945 * converting any non-alphanumeric characters to underscores, and
956 * n1: node-1 {
957 * prop = "foo";
959 * n2: node-2 {
960 * prop = "123 foo";
968 * prop:
976 * DT_STRING_UPPER_TOKEN(DT_NODELABEL(n1), prop) // FOO
977 * DT_STRING_UPPER_TOKEN(DT_NODELABEL(n2), prop) // 123_FOO
982 * - Unlike C identifiers, the property values may begin with a
986 * - The lowercased `"foo"` in the DTS becomes `FOO` as a token, i.e.
989 * - The whitespace in the DTS `"123 foo"` string is converted to
994 * @param prop lowercase-and-underscores property name
995 * @return the value of @p prop as an uppercased token, i.e. without
998 #define DT_STRING_UPPER_TOKEN(node_id, prop) \ argument
999 DT_CAT4(node_id, _P_, prop, _STRING_UPPER_TOKEN)
1004 * If the value exists, this expands to DT_STRING_UPPER_TOKEN(node_id, prop).
1010 * @param prop lowercase-and-underscores property name
1015 #define DT_STRING_UPPER_TOKEN_OR(node_id, prop, default_value) \ argument
1016 COND_CODE_1(DT_NODE_HAS_PROP(node_id, prop), \
1017 (DT_STRING_UPPER_TOKEN(node_id, prop)), (default_value))
1022 * This removes "the quotes" from string-valued properties.
1033 * n1: node-1 {
1034 * prop = "12.7";
1036 * n2: node-2 {
1037 * prop = "0.5";
1039 * n3: node-3 {
1040 * prop = "A B C";
1046 * prop:
1051 * DT_STRING_UNQUOTED(DT_NODELABEL(n1), prop) // 12.7
1052 * DT_STRING_UNQUOTED(DT_NODELABEL(n2), prop) // 0.5
1053 * DT_STRING_UNQUOTED(DT_NODELABEL(n3), prop) // A B C
1056 * @param prop lowercase-and-underscores property name
1059 #define DT_STRING_UNQUOTED(node_id, prop) \ argument
1060 DT_CAT4(node_id, _P_, prop, _STRING_UNQUOTED)
1065 * If the value exists, this expands to DT_STRING_UNQUOTED(node_id, prop).
1071 * @param prop lowercase-and-underscores property name
1076 #define DT_STRING_UNQUOTED_OR(node_id, prop, default_value) \ argument
1077 COND_CODE_1(DT_NODE_HAS_PROP(node_id, prop), \
1078 (DT_STRING_UNQUOTED(node_id, prop)), (default_value))
1081 * @brief Get an element out of a string-array property as a token.
1084 * non-alphanumeric characters to underscores. That can be useful, for example,
1088 * string-array type.
1095 * n1: node-1 {
1096 * prop = "f1", "F2";
1098 * n2: node-2 {
1099 * prop = "123 foo", "456 FOO";
1107 * prop:
1108 * type: string-array
1114 * DT_STRING_TOKEN_BY_IDX(DT_NODELABEL(n1), prop, 0) // f1
1115 * DT_STRING_TOKEN_BY_IDX(DT_NODELABEL(n1), prop, 1) // F2
1116 * DT_STRING_TOKEN_BY_IDX(DT_NODELABEL(n2), prop, 0) // 123_foo
1117 * DT_STRING_TOKEN_BY_IDX(DT_NODELABEL(n2), prop, 1) // 456_FOO
1123 * @param prop lowercase-and-underscores property name
1125 * @return the element in @p prop at index @p idx as a token
1127 #define DT_STRING_TOKEN_BY_IDX(node_id, prop, idx) \ argument
1128 DT_CAT6(node_id, _P_, prop, _IDX_, idx, _STRING_TOKEN)
1134 * converts non-alphanumeric characters to underscores. That can be useful, for
1138 * string-array type.
1145 * n1: node-1 {
1146 * prop = "f1", "F2";
1148 * n2: node-2 {
1149 * prop = "123 foo", "456 FOO";
1157 * prop:
1158 * type: string-array
1164 * DT_STRING_UPPER_TOKEN_BY_IDX(DT_NODELABEL(n1), prop, 0) // F1
1165 * DT_STRING_UPPER_TOKEN_BY_IDX(DT_NODELABEL(n1), prop, 1) // F2
1166 * DT_STRING_UPPER_TOKEN_BY_IDX(DT_NODELABEL(n2), prop, 0) // 123_FOO
1167 * DT_STRING_UPPER_TOKEN_BY_IDX(DT_NODELABEL(n2), prop, 1) // 456_FOO
1173 * @param prop lowercase-and-underscores property name
1175 * @return the element in @p prop at index @p idx as an uppercased token
1177 #define DT_STRING_UPPER_TOKEN_BY_IDX(node_id, prop, idx) \ argument
1178 DT_CAT6(node_id, _P_, prop, _IDX_, idx, _STRING_UPPER_TOKEN)
1183 * This removes "the quotes" from string-valued item.
1189 * string-array type.
1195 * n1: node-1 {
1196 * prop = "12.7", "34.1";
1198 * n2: node-2 {
1199 * prop = "A B", "C D";
1205 * prop:
1206 * type: string-array
1210 * DT_STRING_UNQUOTED_BY_IDX(DT_NODELABEL(n1), prop, 0) // 12.7
1211 * DT_STRING_UNQUOTED_BY_IDX(DT_NODELABEL(n1), prop, 1) // 34.1
1212 * DT_STRING_UNQUOTED_BY_IDX(DT_NODELABEL(n2), prop, 0) // A B
1213 * DT_STRING_UNQUOTED_BY_IDX(DT_NODELABEL(n2), prop, 1) // C D
1216 * @param prop lowercase-and-underscores property name
1220 #define DT_STRING_UNQUOTED_BY_IDX(node_id, prop, idx) \ argument
1221 DT_CAT4(node_id, _P_, prop##_IDX_##idx, _STRING_UNQUOTED)
1226 * These are special-cased to manage the impedance mismatch between
1237 * DT_PROP(DT_PHANDLE_BY_IDX(node_id, phs, idx), prop)
1240 * That is, @p prop is a property of the phandle's node, not a
1246 * n1: node-1 {
1250 * n2: node-2 {
1254 * n3: node-3 {
1269 * @param phs lowercase-and-underscores property with type `phandle`,
1270 * `phandles`, or `phandle-array`
1273 * @param prop lowercase-and-underscores property of the phandle's node
1276 #define DT_PROP_BY_PHANDLE_IDX(node_id, phs, idx, prop) \ argument
1277 DT_PROP(DT_PHANDLE_BY_IDX(node_id, phs, idx), prop)
1284 * idx, prop). The @p default_value parameter is not expanded in this
1290 * @param phs lowercase-and-underscores property with type `phandle`,
1291 * `phandles`, or `phandle-array`
1294 * @param prop lowercase-and-underscores property of the phandle's node
1298 #define DT_PROP_BY_PHANDLE_IDX_OR(node_id, phs, idx, prop, default_value) \ argument
1299 DT_PROP_OR(DT_PHANDLE_BY_IDX(node_id, phs, idx), prop, default_value)
1304 * This is equivalent to DT_PROP_BY_PHANDLE_IDX(node_id, ph, 0, prop).
1307 * @param ph lowercase-and-underscores property of @p node_id
1309 * @param prop lowercase-and-underscores property of the phandle's node
1312 #define DT_PROP_BY_PHANDLE(node_id, ph, prop) \ argument
1313 DT_PROP_BY_PHANDLE_IDX(node_id, ph, 0, prop)
1316 * @brief Get a phandle-array specifier cell value at an index
1319 * `node->phandle_array[index].cell`. That is, the cell value is in
1327 * #gpio-cells = <2>;
1331 * #gpio-cells = <2>;
1342 * gpio-cells:
1343 * - pin
1344 * - flags
1349 * - index 0 has specifier <17 0x1>, so its `pin` cell is 17, and its
1351 * - index 1 has specifier <5 0x3>, so `pin` is 5 and `flags` is 0x3
1363 * @param pha lowercase-and-underscores property with type `phandle-array`
1365 * @param cell lowercase-and-underscores cell name within the specifier
1388 * @param pha lowercase-and-underscores property with type `phandle-array`
1390 * @param cell lowercase-and-underscores cell name within the specifier
1401 * @param pha lowercase-and-underscores property with type `phandle-array`
1402 * @param cell lowercase-and-underscores cell name
1416 * @param pha lowercase-and-underscores property with type `phandle-array`
1417 * @param cell lowercase-and-underscores cell name
1425 * @brief Get a value within a phandle-array specifier by name
1431 * `node->phandle_struct.name.cell`. That is, the cell value is in the
1439 * io-channels = <&adc1 10>, <&adc2 20>;
1440 * io-channel-names = "SENSOR", "BANDGAP";
1447 * io-channel-cells:
1448 * - input
1459 * @param pha lowercase-and-underscores property with type `phandle-array`
1460 * @param name lowercase-and-underscores name of a specifier in @p pha
1461 * @param cell lowercase-and-underscores cell name in the named specifier
1482 * @param pha lowercase-and-underscores property with type `phandle-array`
1483 * @param name lowercase-and-underscores name of a specifier in @p pha
1484 * @param cell lowercase-and-underscores cell name in the named specifier
1495 * `node->phandle_struct.name.phandle`. That is, the phandle array is
1511 * io-channels = <&adc1 10>, <&adc2 20>;
1512 * io-channel-names = "SENSOR", "BANDGAP";
1516 * Above, "io-channels" has two elements:
1518 * - the element named `"SENSOR"` has phandle `&adc1`
1519 * - the element named `"BANDGAP"` has phandle `&adc2`
1531 * non-alphanumeric characters are converted to underscores.
1534 * @param pha lowercase-and-underscores property with type `phandle-array`
1535 * @param name lowercase-and-underscores name of an element in @p pha
1547 * Therefore, if @p prop has type `phandle`, @p idx must be zero. (A
1554 * n1: node-1 {
1558 * n2: node-2 { ... };
1559 * n3: node-3 { ... };
1564 * - index 0 has phandle `&n2`, which is `node-2`'s phandle
1565 * - index 1 has phandle `&n3`, which is `node-3`'s phandle
1572 * DT_PHANDLE_BY_IDX(N1, foo, 0) // node identifier for node-2
1573 * DT_PHANDLE_BY_IDX(N1, foo, 1) // node identifier for node-3
1576 * Behavior is analogous for phandle-arrays.
1585 * @param prop lowercase-and-underscores property name in @p node_id
1586 * with type `phandle`, `phandles` or `phandle-array`
1587 * @param idx index into @p prop
1590 #define DT_PHANDLE_BY_IDX(node_id, prop, idx) \ argument
1591 DT_CAT6(node_id, _P_, prop, _IDX_, idx, _PH)
1596 * This is equivalent to DT_PHANDLE_BY_IDX(node_id, prop, 0). Its primary
1597 * benefit is readability when @p prop has type `phandle`.
1600 * @param prop lowercase-and-underscores property of @p node_id
1604 #define DT_PHANDLE(node_id, prop) DT_PHANDLE_BY_IDX(node_id, prop, 0) argument
1611 * @defgroup devicetree-ranges-prop ranges property
1627 * #address-cells = <3>;
1628 * #size-cells = <2>;
1672 * #address-cells = <3>;
1673 * #size-cells = <2>;
1710 * @brief Does a ranges property have child bus flags at index?
1721 * #address-cells = <2>;
1726 * #address-cells = <3>;
1727 * #size-cells = <2>;
1758 * @return 1 if @p idx is a valid child bus flags index,
1765 * @brief Get the ranges property child bus flags at index
1767 * When the node is a PCIe bus, the Child Bus Address has an extra cell used to store some
1768 * flags, thus this cell is extracted from the Child Bus Address as Child Bus Flags field.
1774 * #address-cells = <2>;
1779 * #address-cells = <3>;
1780 * #size-cells = <2>;
1799 * @returns range child bus flags field at idx
1805 * @brief Get the ranges property child bus address at index
1807 * When the node is a PCIe bus, the Child Bus Address has an extra cell used to store some
1808 * flags, thus this cell is removed from the Child Bus Address.
1814 * #address-cells = <2>;
1819 * #address-cells = <3>;
1820 * #size-cells = <2>;
1848 * @returns range child bus address field at idx
1857 * for child bus flags cells when the node is a PCIe bus.
1863 * #address-cells = <2>;
1868 * #address-cells = <3>;
1869 * #size-cells = <2>;
1906 * for child bus flags cells when the node is a PCIe bus.
1912 * #address-cells = <2>;
1917 * #address-cells = <3>;
1918 * #size-cells = <2>;
1998 * @defgroup devicetree-generic-vendor Vendor and model name helpers
2010 * Example vendor-prefixes.txt:
2012 * vnd A stand-in for a real vendor
2013 * zephyr Zephyr-specific binding
2018 * n1: node-1 {
2026 * DT_NODE_VENDOR_BY_IDX(DT_NODELABEL(n1), 0) // "A stand-in for a real vendor"
2027 * DT_NODE_VENDOR_BY_IDX(DT_NODELABEL(n1), 2) // "Zephyr-specific binding"
2036 * @return string literal of the idx-th vendor
2066 * @return string literal of the idx-th vendor
2068 * @return string literal of the idx-th vendor or "default_value"
2090 * Example vendor-prefixes.txt:
2092 * vnd A stand-in for a real vendor
2093 * zephyr Zephyr-specific binding
2097 * n1: node-1 {
2112 * @return string literal of the idx-th model
2142 * @return string literal of the idx-th model
2144 * @return string literal of the idx-th model or "default_value"
2166 * @defgroup devicetree-reg-prop reg property
2198 * @return address of the idx-th register block
2212 * @return size of the idx-th register block
2227 * @brief 64-bit version of DT_REG_ADDR()
2229 * This macro version adds the appropriate suffix for 64-bit unsigned
2250 * @param name lowercase-and-underscores register specifier name
2257 * @brief 64-bit version of DT_REG_ADDR_BY_NAME()
2259 * This macro version adds the appropriate suffix for 64-bit unsigned
2265 * @param name lowercase-and-underscores register specifier name
2274 * @param name lowercase-and-underscores register specifier name
2285 * @defgroup devicetree-interrupts-prop interrupts property
2340 * @param name lowercase-and-underscores interrupt specifier name
2351 * "node->interrupts[index].cell".
2359 * my-serial: serial@abcd1234 {
2364 * Assuming the node's interrupt domain has "#interrupt-cells = <2>;" and
2371 * ------------- -----
2389 * `node->interrupts.name.cell`.
2396 * @param name lowercase-and-underscores interrupt specifier name
2429 * @defgroup devicetree-generic-chosen Chosen nodes
2437 * This is only valid to call if `DT_HAS_CHOSEN(prop)` is 1.
2438 * @param prop lowercase-and-underscores property name for
2442 #define DT_CHOSEN(prop) DT_CAT(DT_CHOSEN_, prop) argument
2446 * @param prop lowercase-and-underscores devicetree property
2450 #define DT_HAS_CHOSEN(prop) IS_ENABLED(DT_CAT3(DT_CHOSEN_, prop, _EXISTS)) argument
2457 * @defgroup devicetree-generic-foreach "For-each" macros
2477 * identifier for the node. The remaining are passed-in by the caller.
2505 * identifier for the node. The remaining are passed-in by the caller.
2517 * @brief Invokes @p fn for each child of @p node_id
2520 * identifier of a child node of @p node_id.
2529 * child-1 {
2532 * child-2 {
2563 * @brief Invokes @p fn for each child of @p node_id with a separator
2566 * identifier of a child node of @p node_id.
2572 * child-1 {
2575 * child-2 {
2593 * "child-1", "child-2"
2606 * @brief Invokes @p fn for each child of @p node_id with multiple arguments
2609 * identifier for the child node. The remaining are passed-in by the caller.
2624 * @brief Invokes @p fn for each child of @p node_id with separator and multiple
2628 * identifier for the child node. The remaining are passed-in by the caller.
2642 * @brief Call @p fn on the child nodes with status `okay`
2645 * identifier for the child node.
2660 * @brief Call @p fn on the child nodes with status `okay` with separator
2663 * identifier for the child node.
2679 * @brief Call @p fn on the child nodes with status `okay` with multiple
2683 * identifier for the child node. The remaining are passed-in by the caller.
2701 * @brief Call @p fn on the child nodes with status `okay` with separator and
2705 * identifier for the child node. The remaining are passed-in by the caller.
2722 * @brief Invokes @p fn for each element in the value of property @p prop.
2724 * The macro @p fn must take three parameters: fn(node_id, prop, idx).
2725 * @p node_id and @p prop are the same as what is passed to
2729 * The @p prop argument must refer to a property that can be passed to
2736 * my-ints = <1 2 3>;
2743 * #define TIMES_TWO(node_id, prop, idx) \
2744 * (2 * DT_PROP_BY_IDX(node_id, prop, idx)),
2761 * fn(node_id, prop, 0) fn(node_id, prop, 1) [...] fn(node_id, prop, n-1)
2763 * where `n` is the number of elements in @p prop, as it would be
2764 * returned by `DT_PROP_LEN(node_id, prop)`.
2767 * @param prop lowercase-and-underscores property name
2771 #define DT_FOREACH_PROP_ELEM(node_id, prop, fn) \ argument
2772 DT_CAT4(node_id, _P_, prop, _FOREACH_PROP_ELEM)(fn)
2775 * @brief Invokes @p fn for each element in the value of property @p prop with
2782 * my-gpios = <&gpioa 0 GPIO_ACTICE_HIGH>,
2805 * The @p prop parameter has the same restrictions as the same parameter
2809 * @param prop lowercase-and-underscores property name
2816 #define DT_FOREACH_PROP_ELEM_SEP(node_id, prop, fn, sep) \ argument
2817 DT_CAT4(node_id, _P_, prop, _FOREACH_PROP_ELEM_SEP)(fn, sep)
2820 * @brief Invokes @p fn for each element in the value of property @p prop with
2824 * `fn(node_id, prop, idx, ...)`. @p node_id and @p prop are the same as what
2827 * remaining arguments are passed-in by the caller.
2829 * The @p prop parameter has the same restrictions as the same parameter
2833 * @param prop lowercase-and-underscores property name
2839 #define DT_FOREACH_PROP_ELEM_VARGS(node_id, prop, fn, ...) \ argument
2840 DT_CAT4(node_id, _P_, prop, _FOREACH_PROP_ELEM_VARGS)(fn, __VA_ARGS__)
2843 * @brief Invokes @p fn for each element in the value of property @p prop with
2846 * The @p prop parameter has the same restrictions as the same parameter
2850 * @param prop lowercase-and-underscores property name
2858 #define DT_FOREACH_PROP_ELEM_SEP_VARGS(node_id, prop, fn, sep, ...) \ argument
2859 DT_CAT4(node_id, _P_, prop, _FOREACH_PROP_ELEM_SEP_VARGS)( \
2911 * @param compat lowercase-and-underscores devicetree compatible
2959 * @param compat lowercase-and-underscores devicetree compatible
2975 * @defgroup devicetree-generic-exist Existence checks
3008 * - exists in the devicetree, and
3009 * - has a status property matching the second argument
3036 * @param compat lowercase-and-underscores compatible, without quotes
3045 * @param compat lowercase-and-underscores compatible, without quotes
3059 * compatible = "vnd,specific-device", "generic-device";
3075 * @param compat lowercase-and-underscores compatible, without quotes
3093 * @param compat lowercase-and-underscores compatible, without quotes
3106 * truth value, use DT_PROP(node_id, prop) instead.
3109 * @param prop lowercase-and-underscores property name
3112 #define DT_NODE_HAS_PROP(node_id, prop) \ argument
3113 IS_ENABLED(DT_CAT4(node_id, _P_, prop, _EXISTS))
3119 * If this returns 1, then the phandle-array property @p pha has a cell
3125 * @param pha lowercase-and-underscores property with type `phandle-array`
3127 * @param cell lowercase-and-underscores cell name whose existence to check
3139 * @param pha lowercase-and-underscores property with type `phandle-array`
3140 * @param cell lowercase-and-underscores cell name whose existence to check
3153 * @defgroup devicetree-generic-bus Bus helpers
3172 * clock-frequency = < 100000 >;
3208 * temp: temperature-sensor@76 {
3209 * compatible = "vnd,some-sensor";
3224 * @param bus lowercase-and-underscores bus type as a C token (i.e.
3236 * @defgroup devicetree-inst Instance-based devicetree APIs
3268 * @brief Get a node identifier for a child node of DT_DRV_INST(inst)
3271 * @param child lowercase-and-underscores child node name
3272 * @return node identifier for the node with the name referred to by 'child'
3276 #define DT_INST_CHILD(inst, child) \ argument
3277 DT_CHILD(DT_DRV_INST(inst), child)
3280 * @brief Call @p fn on all child nodes of DT_DRV_INST(inst).
3283 * identifier for the child node.
3289 * @param fn macro to invoke on each child node identifier
3297 * @brief Call @p fn on all child nodes of DT_DRV_INST(inst) with a separator
3300 * identifier for the child node.
3303 * @param fn macro to invoke on each child node identifier
3313 * @brief Call @p fn on all child nodes of DT_DRV_INST(inst).
3316 * identifier for the child node. The remaining are passed-in by the caller.
3322 * @param fn macro to invoke on each child node identifier
3331 * @brief Call @p fn on all child nodes of DT_DRV_INST(inst) with separator.
3334 * identifier for the child node. The remaining are passed-in by the caller.
3337 * @param fn macro to invoke on each child node identifier
3348 * @brief Call @p fn on all child nodes of DT_DRV_INST(inst) with status `okay`.
3351 * identifier for the child node.
3354 * @param fn macro to invoke on each child node identifier
3362 * @brief Call @p fn on all child nodes of DT_DRV_INST(inst) with status `okay`
3366 * identifier for the child node.
3369 * @param fn macro to invoke on each child node identifier
3379 * @brief Call @p fn on all child nodes of DT_DRV_INST(inst) with status `okay`
3383 * identifier for the child node. The remaining are passed-in by the caller.
3386 * @param fn macro to invoke on each child node identifier
3395 * @brief Call @p fn on all child nodes of DT_DRV_INST(inst) with status `okay`
3399 * identifier for the child node. The remaining are passed-in by the caller.
3402 * @param fn macro to invoke on each child node identifier
3415 * @param prop lowercase-and-underscores property name
3416 * @return zero-based index of the property's value in its enum: list
3418 #define DT_INST_ENUM_IDX(inst, prop) \ argument
3419 DT_ENUM_IDX(DT_DRV_INST(inst), prop)
3424 * @param prop lowercase-and-underscores property name
3426 * @return zero-based index of the property's value in its enum if present,
3429 #define DT_INST_ENUM_IDX_OR(inst, prop, default_idx_value) \ argument
3430 DT_ENUM_IDX_OR(DT_DRV_INST(inst), prop, default_idx_value)
3436 * @param prop lowercase-and-underscores property name
3437 * @param value lowercase-and-underscores enumeration value
3440 #define DT_INST_ENUM_HAS_VALUE(inst, prop, value) \ argument
3441 DT_ENUM_HAS_VALUE(DT_DRV_INST(inst), prop, value)
3446 * @param prop lowercase-and-underscores property name
3449 #define DT_INST_PROP(inst, prop) DT_PROP(DT_DRV_INST(inst), prop) argument
3454 * @param prop lowercase-and-underscores property name
3457 #define DT_INST_PROP_LEN(inst, prop) DT_PROP_LEN(DT_DRV_INST(inst), prop) argument
3463 * @param prop lowercase-and-underscores property name
3468 #define DT_INST_PROP_HAS_IDX(inst, prop, idx) \ argument
3469 DT_PROP_HAS_IDX(DT_DRV_INST(inst), prop, idx)
3472 * @brief Is name @p name available in a `foo-names` property?
3474 * @param prop a lowercase-and-underscores `prop-names` type property
3475 * @param name a lowercase-and-underscores name to check
3479 #define DT_INST_PROP_HAS_NAME(inst, prop, name) \ argument
3480 DT_PROP_HAS_NAME(DT_DRV_INST(inst), prop, name)
3485 * @param prop lowercase-and-underscores property name
3487 * @return a representation of the idx-th element of the property
3489 #define DT_INST_PROP_BY_IDX(inst, prop, idx) \ argument
3490 DT_PROP_BY_IDX(DT_DRV_INST(inst), prop, idx)
3495 * @param prop lowercase-and-underscores property name
3497 * @return DT_INST_PROP(inst, prop) or @p default_value
3499 #define DT_INST_PROP_OR(inst, prop, default_value) \ argument
3500 DT_PROP_OR(DT_DRV_INST(inst), prop, default_value)
3505 * @param prop lowercase-and-underscores property name
3507 * @return DT_INST_PROP_LEN(inst, prop) or @p default_value
3509 #define DT_INST_PROP_LEN_OR(inst, prop, default_value) \ argument
3510 DT_PROP_LEN_OR(DT_DRV_INST(inst), prop, default_value)
3525 * @param prop lowercase-and-underscores property name
3526 * @return the value of @p prop as a token, i.e. without any quotes
3529 #define DT_INST_STRING_TOKEN(inst, prop) \ argument
3530 DT_STRING_TOKEN(DT_DRV_INST(inst), prop)
3535 * @param prop lowercase-and-underscores property name
3536 * @return the value of @p prop as an uppercased token, i.e. without
3539 #define DT_INST_STRING_UPPER_TOKEN(inst, prop) \ argument
3540 DT_STRING_UPPER_TOKEN(DT_DRV_INST(inst), prop)
3547 * @param prop lowercase-and-underscores property name
3548 * @return the value of @p prop as a sequence of tokens, with no quotes
3550 #define DT_INST_STRING_UNQUOTED(inst, prop) \ argument
3551 DT_STRING_UNQUOTED(DT_DRV_INST(inst), prop)
3554 * @brief Get an element out of string-array property as a token.
3556 * @param prop lowercase-and-underscores property name
3558 * @return the element in @p prop at index @p idx as a token
3560 #define DT_INST_STRING_TOKEN_BY_IDX(inst, prop, idx) \ argument
3561 DT_STRING_TOKEN_BY_IDX(DT_DRV_INST(inst), prop, idx)
3566 * @param prop lowercase-and-underscores property name
3568 * @return the element in @p prop at index @p idx as an uppercased token
3570 #define DT_INST_STRING_UPPER_TOKEN_BY_IDX(inst, prop, idx) \ argument
3571 DT_STRING_UPPER_TOKEN_BY_IDX(DT_DRV_INST(inst), prop, idx)
3574 * @brief Get an element out of string-array property as an unquoted sequence of tokens.
3576 * @param prop lowercase-and-underscores property name
3578 * @return the value of @p prop at index @p idx as a sequence of tokens, with no quotes
3580 #define DT_INST_STRING_UNQUOTED_BY_IDX(inst, prop, idx) \ argument
3581 DT_STRING_UNQUOTED_BY_IDX(DT_DRV_INST(inst), prop, idx)
3586 * @param ph lowercase-and-underscores property of @p inst
3588 * @param prop lowercase-and-underscores property of the phandle's node
3589 * @return the value of @p prop as described in the DT_PROP() documentation
3591 #define DT_INST_PROP_BY_PHANDLE(inst, ph, prop) \ argument
3592 DT_INST_PROP_BY_PHANDLE_IDX(inst, ph, 0, prop)
3598 * @param phs lowercase-and-underscores property with type `phandle`,
3599 * `phandles`, or `phandle-array`
3602 * @param prop lowercase-and-underscores property of the phandle's node
3603 * @return the value of @p prop as described in the DT_PROP() documentation
3605 #define DT_INST_PROP_BY_PHANDLE_IDX(inst, phs, idx, prop) \ argument
3606 DT_PROP_BY_PHANDLE_IDX(DT_DRV_INST(inst), phs, idx, prop)
3609 * @brief Get a `DT_DRV_COMPAT` instance's phandle-array specifier value at an index
3611 * @param pha lowercase-and-underscores property with type `phandle-array`
3622 * @param pha lowercase-and-underscores property with type `phandle-array`
3632 * @brief Get a `DT_DRV_COMPAT` instance's phandle-array specifier value
3635 * @param pha lowercase-and-underscores property with type `phandle-array`
3644 * @param pha lowercase-and-underscores property with type `phandle-array`
3653 * @brief Get a `DT_DRV_COMPAT` instance's value within a phandle-array
3656 * @param pha lowercase-and-underscores property with type `phandle-array`
3657 * @param name lowercase-and-underscores name of a specifier in @p pha
3667 * @param pha lowercase-and-underscores property with type `phandle-array`
3668 * @param name lowercase-and-underscores name of a specifier in @p pha
3680 * @param pha lowercase-and-underscores property with type `phandle-array`
3681 * @param name lowercase-and-underscores name of an element in @p pha
3691 * @param prop lowercase-and-underscores property name in @p inst
3692 * with type `phandle`, `phandles` or `phandle-array`
3693 * @param idx index into @p prop
3694 * @return a node identifier for the phandle at index @p idx in @p prop
3696 #define DT_INST_PHANDLE_BY_IDX(inst, prop, idx) \ argument
3697 DT_PHANDLE_BY_IDX(DT_DRV_INST(inst), prop, idx)
3703 * @param prop lowercase-and-underscores property of @p inst
3707 #define DT_INST_PHANDLE(inst, prop) DT_INST_PHANDLE_BY_IDX(inst, prop, 0) argument
3719 * @brief Get a `DT_DRV_COMPAT` instance's idx-th register block's address
3722 * @return address of the instance's idx-th register block
3727 * @brief Get a `DT_DRV_COMPAT` instance's idx-th register block's size
3730 * @return size of the instance's idx-th register block
3738 * @param name lowercase-and-underscores register specifier name
3745 * @brief 64-bit version of DT_INST_REG_ADDR_BY_NAME()
3747 * This macro version adds the appropriate suffix for 64-bit unsigned
3753 * @param name lowercase-and-underscores register specifier name
3762 * @param name lowercase-and-underscores register specifier name
3776 * @brief 64-bit version of DT_INST_REG_ADDR()
3778 * This macro version adds the appropriate suffix for 64-bit unsigned
3808 * @param name lowercase-and-underscores interrupt specifier name
3859 * @param name lowercase-and-underscores property name
3861 * @return if @p prop exists, its value as a token, i.e. without any quotes and
3872 * @param name lowercase-and-underscores property name
3883 * @param name lowercase-and-underscores property name
3901 * temp: temperature-sensor@76 {
3902 * compatible = "vnd,some-sensor";
3915 * @param compat lowercase-and-underscores compatible, without quotes
3927 * This is a special-purpose macro which can be useful when writing
3935 * temp: temperature-sensor@76 {
3936 * compatible = "vnd,some-sensor";
3962 * @param prop lowercase-and-underscores property name
3969 * compatible = "vnd,some-sensor";
3977 * compatible = "vnd,some-sensor";
3984 * compatible = "vnd,some-sensor";
4002 #define DT_ANY_INST_HAS_PROP_STATUS_OKAY(prop) \ argument
4003 (DT_INST_FOREACH_STATUS_OKAY_VARGS(DT_INST_NODE_HAS_PROP_AND_OR, prop) 0)
4094 * @brief Invokes @p fn for each element of property @p prop for
4097 * Equivalent to DT_FOREACH_PROP_ELEM(DT_DRV_INST(inst), prop, fn).
4100 * @param prop lowercase-and-underscores property name
4103 #define DT_INST_FOREACH_PROP_ELEM(inst, prop, fn) \ argument
4104 DT_FOREACH_PROP_ELEM(DT_DRV_INST(inst), prop, fn)
4107 * @brief Invokes @p fn for each element of property @p prop for
4110 * Equivalent to DT_FOREACH_PROP_ELEM_SEP(DT_DRV_INST(inst), prop, fn, sep).
4113 * @param prop lowercase-and-underscores property name
4118 #define DT_INST_FOREACH_PROP_ELEM_SEP(inst, prop, fn, sep) \ argument
4119 DT_FOREACH_PROP_ELEM_SEP(DT_DRV_INST(inst), prop, fn, sep)
4122 * @brief Invokes @p fn for each element of property @p prop for
4126 * DT_FOREACH_PROP_ELEM_VARGS(DT_DRV_INST(inst), prop, fn, __VA_ARGS__)
4129 * @param prop lowercase-and-underscores property name
4135 #define DT_INST_FOREACH_PROP_ELEM_VARGS(inst, prop, fn, ...) \ argument
4136 DT_FOREACH_PROP_ELEM_VARGS(DT_DRV_INST(inst), prop, fn, __VA_ARGS__)
4139 * @brief Invokes @p fn for each element of property @p prop for
4143 * DT_FOREACH_PROP_ELEM_SEP_VARGS(DT_DRV_INST(inst), prop, fn, sep,
4147 * @param prop lowercase-and-underscores property name
4155 #define DT_INST_FOREACH_PROP_ELEM_SEP_VARGS(inst, prop, fn, sep, ...) \ argument
4156 DT_FOREACH_PROP_ELEM_SEP_VARGS(DT_DRV_INST(inst), prop, fn, sep, \
4162 * @param prop lowercase-and-underscores property name
4165 #define DT_INST_NODE_HAS_PROP(inst, prop) \ argument
4166 DT_NODE_HAS_PROP(DT_DRV_INST(inst), prop)
4172 * @param pha lowercase-and-underscores property with type `phandle-array`
4185 * @param pha lowercase-and-underscores property with type `phandle-array`
4226 * @param name lowercase-and-underscores interrupt specifier name
4256 * since its macro-based API is fiddly and can be hard to get right.
4290 #define DT_INST_NODE_HAS_PROP_AND_OR(inst, prop) \ argument
4291 DT_INST_NODE_HAS_PROP(inst, prop) ||
4306 #include <zephyr/devicetree/io-channels.h>
4312 #include <zephyr/devicetree/fixed-partitions.h>