|
Zephyr API Documentation
2.7.0-rc2
A Scalable Open Source RTOS
|
Macros | |
| #define | DT_PROP(node_id, prop) DT_CAT(node_id, _P_##prop) |
| Get a devicetree property value. More... | |
| #define | DT_PROP_LEN(node_id, prop) DT_PROP(node_id, prop##_LEN) |
| Get a property's logical length. More... | |
| #define | DT_PROP_LEN_OR(node_id, prop, default_value) |
| Like DT_PROP_LEN(), but with a fallback to default_value. More... | |
| #define | DT_PROP_HAS_IDX(node_id, prop, idx) IS_ENABLED(DT_CAT6(node_id, _P_, prop, _IDX_, idx, _EXISTS)) |
| Is index "idx" valid for an array type property? More... | |
| #define | DT_PROP_BY_IDX(node_id, prop, idx) DT_PROP(node_id, prop##_IDX_##idx) |
| Get the value at index "idx" in an array type property. More... | |
| #define | DT_PROP_OR(node_id, prop, default_value) |
| Like DT_PROP(), but with a fallback to default_value. More... | |
| #define | DT_LABEL(node_id) DT_PROP(node_id, label) |
| Equivalent to DT_PROP(node_id, label) More... | |
| #define | DT_ENUM_IDX(node_id, prop) DT_PROP(node_id, prop##_ENUM_IDX) |
| Get a property value's index into its enumeration values. More... | |
| #define | DT_ENUM_IDX_OR(node_id, prop, default_idx_value) |
| Like DT_ENUM_IDX(), but with a fallback to a default enum index. More... | |
| #define | DT_STRING_TOKEN(node_id, prop) DT_CAT4(node_id, _P_, prop, _STRING_TOKEN) |
| Get a string property's value as a token. More... | |
| #define | DT_STRING_UPPER_TOKEN(node_id, prop) DT_CAT4(node_id, _P_, prop, _STRING_UPPER_TOKEN) |
| Like DT_STRING_TOKEN(), but uppercased. More... | |
| #define | DT_ENUM_TOKEN(node_id, prop) |
| Get an enumeration property's value as a token. More... | |
| #define | DT_ENUM_UPPER_TOKEN(node_id, prop) |
| Like DT_ENUM_TOKEN(), but uppercased. More... | |
| #define | DT_PROP_BY_PHANDLE_IDX(node_id, phs, idx, prop) DT_PROP(DT_PHANDLE_BY_IDX(node_id, phs, idx), prop) |
| Get a property value from a phandle in a property. More... | |
| #define | DT_PROP_BY_PHANDLE_IDX_OR(node_id, phs, idx, prop, default_value) DT_PROP_OR(DT_PHANDLE_BY_IDX(node_id, phs, idx), prop, default_value) |
| Like DT_PROP_BY_PHANDLE_IDX(), but with a fallback to default_value. More... | |
| #define | DT_PROP_BY_PHANDLE(node_id, ph, prop) DT_PROP_BY_PHANDLE_IDX(node_id, ph, 0, prop) |
| Get a property value from a phandle's node. More... | |
| #define | DT_PHA_BY_IDX(node_id, pha, idx, cell) DT_PROP(node_id, pha##_IDX_##idx##_VAL_##cell) |
| Get a phandle-array specifier cell value at an index. More... | |
| #define | DT_PHA_BY_IDX_OR(node_id, pha, idx, cell, default_value) DT_PROP_OR(node_id, pha##_IDX_##idx##_VAL_##cell, default_value) |
| Like DT_PHA_BY_IDX(), but with a fallback to default_value. More... | |
| #define | DT_PHA(node_id, pha, cell) DT_PHA_BY_IDX(node_id, pha, 0, cell) |
| Equivalent to DT_PHA_BY_IDX(node_id, pha, 0, cell) More... | |
| #define | DT_PHA_OR(node_id, pha, cell, default_value) DT_PHA_BY_IDX_OR(node_id, pha, 0, cell, default_value) |
| Like DT_PHA(), but with a fallback to default_value. More... | |
| #define | DT_PHA_BY_NAME(node_id, pha, name, cell) DT_PROP(node_id, pha##_NAME_##name##_VAL_##cell) |
| Get a value within a phandle-array specifier by name. More... | |
| #define | DT_PHA_BY_NAME_OR(node_id, pha, name, cell, default_value) DT_PROP_OR(node_id, pha##_NAME_##name##_VAL_##cell, default_value) |
| Like DT_PHA_BY_NAME(), but with a fallback to default_value. More... | |
| #define | DT_PHANDLE_BY_NAME(node_id, pha, name) DT_PROP(node_id, pha##_NAME_##name##_PH) |
| Get a phandle's node identifier from a phandle array by name. More... | |
| #define | DT_PHANDLE_BY_IDX(node_id, prop, idx) DT_CAT6(node_id, _P_, prop, _IDX_, idx, _PH) |
| Get a node identifier for a phandle in a property. More... | |
| #define | DT_PHANDLE(node_id, prop) DT_PHANDLE_BY_IDX(node_id, prop, 0) |
| Get a node identifier for a phandle property's value. More... | |
| #define DT_ENUM_IDX | ( | node_id, | |
| prop | |||
| ) | DT_PROP(node_id, prop##_ENUM_IDX) |
#include <include/devicetree.h>
Get a property value's index into its enumeration values.
The return values start at zero.
Example devicetree fragment:
usb1: usb@12340000 {
maximum-speed = "full-speed";
};
usb2: usb@12341000 {
maximum-speed = "super-speed";
};
Example bindings fragment:
properties:
maximum-speed:
type: string
enum:
- "low-speed"
- "full-speed"
- "high-speed"
- "super-speed"
Example usage:
DT_ENUM_IDX(DT_NODELABEL(usb1), maximum_speed) // 1 DT_ENUM_IDX(DT_NODELABEL(usb2), maximum_speed) // 3
| node_id | node identifier |
| prop | lowercase-and-underscores property name |
| #define DT_ENUM_IDX_OR | ( | node_id, | |
| prop, | |||
| default_idx_value | |||
| ) |
#include <include/devicetree.h>
Like DT_ENUM_IDX(), but with a fallback to a default enum index.
If the value exists, this expands to its zero based index value thanks to DT_ENUM_IDX(node_id, prop).
Otherwise, this expands to provided default index enum value.
| node_id | node identifier |
| prop | lowercase-and-underscores property name |
| default_idx_value | a fallback index value to expand to |
| #define DT_ENUM_TOKEN | ( | node_id, | |
| prop | |||
| ) |
#include <include/devicetree.h>
Get an enumeration property's value as a token.
This allows you to "remove the quotes" from some string-valued properties. That can be useful, for example, when pasting the values onto some other token to form an enum in C using the ## preprocessor operator.
DT_ENUM_TOKEN() can only be used for properties with string type whose binding has an "enum:". The values in the binding's "enum:" list must be unique after converting non-alphanumeric characters to underscores.
It is an error to use DT_ENUM_TOKEN() in other circumstances.
Example devicetree fragment:
n1: node-1 {
prop = "foo";
};
n2: node-2 {
prop = "FOO";
}
n3: node-3 {
prop = "123 foo";
};
Example bindings fragment:
properties:
prop:
type: string
enum:
- "foo"
- "FOO"
- "123 foo"
Example usage:
DT_ENUM_TOKEN(DT_NODELABEL(n1), prop) // foo DT_ENUM_TOKEN(DT_NODELABEL(n2), prop) // FOO DT_ENUM_TOKEN(DT_NODELABEL(n3), prop) // 123_foo
Notice how:
FOO as a token. It is not* converted to foo.123_foo as a token.| node_id | node identifier |
| prop | lowercase-and-underscores property name with suitable enumeration of values in its binding |
prop as a token, i.e. without any quotes and with special characters converted to underscores | #define DT_ENUM_UPPER_TOKEN | ( | node_id, | |
| prop | |||
| ) |
#include <include/devicetree.h>
Like DT_ENUM_TOKEN(), but uppercased.
This allows you to "remove the quotes and capitalize" some string-valued properties.
DT_ENUM_UPPER_TOKEN() can only be used for properties with string type whose binding has an "enum:". The values in the binding's "enum:" list must be unique after converting non-alphanumeric characters to underscores and capitalizating any letters.
It is an error to use DT_ENUM_UPPER_TOKEN() in other circumstances.
Example devicetree fragment:
n1: node-1 {
prop = "foo";
};
n2: node-2 {
prop = "123 foo";
};
Example bindings fragment:
properties:
prop:
type: string
enum:
- "foo"
- "123 foo"
Example usage:
DT_ENUM_TOKEN((DT_NODELABEL(n1), prop) // FOO DT_ENUM_TOKEN((DT_NODELABEL(n2), prop) // 123_FOO
Notice how:
FOO as a token, i.e. it is uppercased.123_FOO as a token, i.e. it is uppercased and whitespace becomes an underscore.| node_id | node identifier |
| prop | lowercase-and-underscores property name with suitable enumeration of values in its binding |
prop as a capitalized token, i.e. upper case, without any quotes, and with special characters converted to underscores | #define DT_LABEL | ( | node_id | ) | DT_PROP(node_id, label) |
#include <include/devicetree.h>
Equivalent to DT_PROP(node_id, label)
This is a convenience for the Zephyr device API, which uses label properties as device_get_binding() arguments.
| node_id | node identifier |
| #define DT_PHA | ( | node_id, | |
| pha, | |||
| cell | |||
| ) | DT_PHA_BY_IDX(node_id, pha, 0, cell) |
#include <include/devicetree.h>
Equivalent to DT_PHA_BY_IDX(node_id, pha, 0, cell)
| node_id | node identifier |
| pha | lowercase-and-underscores property with type "phandle-array" |
| cell | lowercase-and-underscores cell name |
| #define DT_PHA_BY_IDX | ( | node_id, | |
| pha, | |||
| idx, | |||
| cell | |||
| ) | DT_PROP(node_id, pha##_IDX_##idx##_VAL_##cell) |
#include <include/devicetree.h>
Get a phandle-array specifier cell value at an index.
It might help to read the argument order as being similar to "node->phandle_array[index].cell". That is, the cell value is in the "pha" property of "node_id", inside the specifier at index "idx".
Example devicetree fragment:
gpio0: gpio@... {
#gpio-cells = <2>;
};
gpio1: gpio@... {
#gpio-cells = <2>;
};
led: led_0 {
gpios = <&gpio0 17 0x1>, <&gpio1 5 0x3>;
};
Bindings fragment for the gpio0 and gpio1 nodes:
gpio-cells: - pin - flags
Above, "gpios" has two elements:
Example usage:
#define LED DT_NODELABEL(led) DT_PHA_BY_IDX(LED, gpios, 0, pin) // 17 DT_PHA_BY_IDX(LED, gpios, 1, flags) // 0x3
| node_id | node identifier |
| pha | lowercase-and-underscores property with type "phandle-array" |
| idx | logical index into "pha" |
| cell | lowercase-and-underscores cell name within the specifier at "pha" index "idx" |
| #define DT_PHA_BY_IDX_OR | ( | node_id, | |
| pha, | |||
| idx, | |||
| cell, | |||
| default_value | |||
| ) | DT_PROP_OR(node_id, pha##_IDX_##idx##_VAL_##cell, default_value) |
#include <include/devicetree.h>
Like DT_PHA_BY_IDX(), but with a fallback to default_value.
If the value exists, this expands to DT_PHA_BY_IDX(node_id, pha, idx, cell). The default_value parameter is not expanded in this case.
Otherwise, this expands to default_value.
| node_id | node identifier |
| pha | lowercase-and-underscores property with type "phandle-array" |
| idx | logical index into "pha" |
| cell | lowercase-and-underscores cell name within the specifier at "pha" index "idx" |
| default_value | a fallback value to expand to |
| #define DT_PHA_BY_NAME | ( | node_id, | |
| pha, | |||
| name, | |||
| cell | |||
| ) | DT_PROP(node_id, pha##_NAME_##name##_VAL_##cell) |
#include <include/devicetree.h>
Get a value within a phandle-array specifier by name.
This is like DT_PHA_BY_IDX(), except it treats "pha" as a structure where each array element has a name.
It might help to read the argument order as being similar to "node->phandle_struct.name.cell". That is, the cell value is in the "pha" property of "node_id", treated as a data structure where each array element has a name.
Example devicetree fragment:
n: node {
io-channels = <&adc1 10>, <&adc2 20>;
io-channel-names = "SENSOR", "BANDGAP";
};
Bindings fragment for the "adc1" and "adc2" nodes:
io-channel-cells: - input
Example usage:
DT_PHA_BY_NAME(DT_NODELABEL(n), io_channels, sensor, input) // 10 DT_PHA_BY_NAME(DT_NODELABEL(n), io_channels, bandgap, input) // 20
| node_id | node identifier |
| pha | lowercase-and-underscores property with type "phandle-array" |
| name | lowercase-and-underscores name of a specifier in "pha" |
| cell | lowercase-and-underscores cell name in the named specifier |
| #define DT_PHA_BY_NAME_OR | ( | node_id, | |
| pha, | |||
| name, | |||
| cell, | |||
| default_value | |||
| ) | DT_PROP_OR(node_id, pha##_NAME_##name##_VAL_##cell, default_value) |
#include <include/devicetree.h>
Like DT_PHA_BY_NAME(), but with a fallback to default_value.
If the value exists, this expands to DT_PHA_BY_NAME(node_id, pha, name, cell). The default_value parameter is not expanded in this case.
Otherwise, this expands to default_value.
| node_id | node identifier |
| pha | lowercase-and-underscores property with type "phandle-array" |
| name | lowercase-and-underscores name of a specifier in "pha" |
| cell | lowercase-and-underscores cell name in the named specifier |
| default_value | a fallback value to expand to |
| #define DT_PHA_OR | ( | node_id, | |
| pha, | |||
| cell, | |||
| default_value | |||
| ) | DT_PHA_BY_IDX_OR(node_id, pha, 0, cell, default_value) |
#include <include/devicetree.h>
Like DT_PHA(), but with a fallback to default_value.
If the value exists, this expands to DT_PHA(node_id, pha, cell). The default_value parameter is not expanded in this case.
Otherwise, this expands to default_value.
| node_id | node identifier |
| pha | lowercase-and-underscores property with type "phandle-array" |
| cell | lowercase-and-underscores cell name |
| default_value | a fallback value to expand to |
| #define DT_PHANDLE | ( | node_id, | |
| prop | |||
| ) | DT_PHANDLE_BY_IDX(node_id, prop, 0) |
#include <include/devicetree.h>
Get a node identifier for a phandle property's value.
This is equivalent to DT_PHANDLE_BY_IDX(node_id, prop, 0). Its primary benefit is readability when "prop" has type "phandle".
| node_id | node identifier |
| prop | lowercase-and-underscores property of "node_id" with type "phandle" |
| #define DT_PHANDLE_BY_IDX | ( | node_id, | |
| prop, | |||
| idx | |||
| ) | DT_CAT6(node_id, _P_, prop, _IDX_, idx, _PH) |
#include <include/devicetree.h>
Get a node identifier for a phandle in a property.
When a node's value at a logical index contains a phandle, this macro returns a node identifier for the node with that phandle.
Therefore, if "prop" has type "phandle", "idx" must be zero. (A "phandle" type is treated as a "phandles" with a fixed length of 1).
Example devicetree fragment:
n1: node-1 {
foo = <&n2 &n3>;
};
n2: node-2 { ... };
n3: node-3 { ... };
Above, "foo" has type phandles and has two elements:
Example usage:
#define N1 DT_NODELABEL(n1) DT_PHANDLE_BY_IDX(N1, foo, 0) // node identifier for node-2 DT_PHANDLE_BY_IDX(N1, foo, 1) // node identifier for node-3
Behavior is analogous for phandle-arrays.
| node_id | node identifier |
| prop | lowercase-and-underscores property name in "node_id" with type "phandle", "phandles" or "phandle-array" |
| idx | index into "prop" |
| #define DT_PHANDLE_BY_NAME | ( | node_id, | |
| pha, | |||
| name | |||
| ) | DT_PROP(node_id, pha##_NAME_##name##_PH) |
#include <include/devicetree.h>
Get a phandle's node identifier from a phandle array by name.
It might help to read the argument order as being similar to "node->phandle_struct.name.phandle". That is, the phandle array is treated as a structure with named elements. The return value is the node identifier for a phandle inside the structure.
Example devicetree fragment:
adc1: adc@... {
label = "ADC_1";
};
adc2: adc@... {
label = "ADC_2";
};
n: node {
io-channels = <&adc1 10>, <&adc2 20>;
io-channel-names = "SENSOR", "BANDGAP";
};
Above, "io-channels" has two elements:
Example usage:
#define NODE DT_NODELABEL(n) DT_LABEL(DT_PHANDLE_BY_NAME(NODE, io_channels, sensor)) // "ADC_1" DT_LABEL(DT_PHANDLE_BY_NAME(NODE, io_channels, bandgap)) // "ADC_2"
Notice how devicetree properties and names are lowercased, and non-alphanumeric characters are converted to underscores.
| node_id | node identifier |
| pha | lowercase-and-underscores property with type "phandle-array" |
| name | lowercase-and-underscores name of an element in "pha" |
| #define DT_PROP | ( | node_id, | |
| prop | |||
| ) | DT_CAT(node_id, _P_##prop) |
#include <include/devicetree.h>
Get a devicetree property value.
For properties whose bindings have the following types, this macro expands to:
A property's type is usually defined by its binding. In some special cases, it has an assumed type defined by the devicetree specification even when no binding is available: "compatible" has type string-array, "status" and "label" have type string, and "interrupt-controller" has type boolean.
For other properties or properties with unknown type due to a missing binding, behavior is undefined.
For usage examples, see DT_PATH(), DT_ALIAS(), DT_NODELABEL(), and DT_INST() above.
| node_id | node identifier |
| prop | lowercase-and-underscores property name |
| #define DT_PROP_BY_IDX | ( | node_id, | |
| prop, | |||
| idx | |||
| ) | DT_PROP(node_id, prop##_IDX_##idx) |
#include <include/devicetree.h>
Get the value at index "idx" in an array type property.
It might help to read the argument order as being similar to "node->property[index]".
When the property's binding has type array, string-array, uint8-array, or phandles, this expands to the idx-th array element as an integer, string literal, or node identifier respectively.
These properties are handled as special cases:
For non-array properties, behavior is undefined.
| node_id | node identifier |
| prop | lowercase-and-underscores property name |
| idx | the index to get |
| #define DT_PROP_BY_PHANDLE | ( | node_id, | |
| ph, | |||
| prop | |||
| ) | DT_PROP_BY_PHANDLE_IDX(node_id, ph, 0, prop) |
#include <include/devicetree.h>
Get a property value from a phandle's node.
This is equivalent to DT_PROP_BY_PHANDLE_IDX(node_id, ph, 0, prop).
| node_id | node identifier |
| ph | lowercase-and-underscores property of "node_id" with type "phandle" |
| prop | lowercase-and-underscores property of the phandle's node |
| #define DT_PROP_BY_PHANDLE_IDX | ( | node_id, | |
| phs, | |||
| idx, | |||
| prop | |||
| ) | DT_PROP(DT_PHANDLE_BY_IDX(node_id, phs, idx), prop) |
#include <include/devicetree.h>
Get a property value from a phandle in a property.
This is a shorthand for:
DT_PROP(DT_PHANDLE_BY_IDX(node_id, phs, idx), prop)
That is, "prop" is a property of the phandle's node, not a property of "node_id".
Example devicetree fragment:
n1: node-1 {
foo = <&n2 &n3>;
};
n2: node-2 {
bar = <42>;
};
n3: node-3 {
baz = <43>;
};
Example usage:
#define N1 DT_NODELABEL(n1) DT_PROP_BY_PHANDLE_IDX(N1, foo, 0, bar) // 42 DT_PROP_BY_PHANDLE_IDX(N1, foo, 1, baz) // 43
| node_id | node identifier |
| phs | lowercase-and-underscores property with type "phandle", "phandles", or "phandle-array" |
| idx | logical index into "phs", which must be zero if "phs" has type "phandle" |
| prop | lowercase-and-underscores property of the phandle's node |
| #define DT_PROP_BY_PHANDLE_IDX_OR | ( | node_id, | |
| phs, | |||
| idx, | |||
| prop, | |||
| default_value | |||
| ) | DT_PROP_OR(DT_PHANDLE_BY_IDX(node_id, phs, idx), prop, default_value) |
#include <include/devicetree.h>
Like DT_PROP_BY_PHANDLE_IDX(), but with a fallback to default_value.
If the value exists, this expands to DT_PROP_BY_PHANDLE_IDX(node_id, phs, idx, prop). The default_value parameter is not expanded in this case.
Otherwise, this expands to default_value.
| node_id | node identifier |
| phs | lowercase-and-underscores property with type "phandle", "phandles", or "phandle-array" |
| idx | logical index into "phs", which must be zero if "phs" has type "phandle" |
| prop | lowercase-and-underscores property of the phandle's node |
| default_value | a fallback value to expand to |
| #define DT_PROP_HAS_IDX | ( | node_id, | |
| prop, | |||
| idx | |||
| ) | IS_ENABLED(DT_CAT6(node_id, _P_, prop, _IDX_, idx, _EXISTS)) |
#include <include/devicetree.h>
Is index "idx" valid for an array type property?
If this returns 1, then DT_PROP_BY_IDX(node_id, prop, idx) or DT_PHA_BY_IDX(node_id, prop, idx, ...) are valid at index "idx". If it returns 0, it is an error to use those macros with that index.
These properties are handled as special cases:
It is an error to use this macro with the reg or interrupts properties.
| node_id | node identifier |
| prop | a lowercase-and-underscores property with a logical length |
| idx | index to check |
| #define DT_PROP_LEN | ( | node_id, | |
| prop | |||
| ) | DT_PROP(node_id, prop##_LEN) |
#include <include/devicetree.h>
Get a property's logical length.
Here, "length" is a number of elements, which may differ from the property's size in bytes.
The return value depends on the property's type:
These properties are handled as special cases:
It is an error to use this macro with the reg or interrupts properties.
For other properties, behavior is undefined.
| node_id | node identifier |
| prop | a lowercase-and-underscores property with a logical length |
| #define DT_PROP_LEN_OR | ( | node_id, | |
| prop, | |||
| default_value | |||
| ) |
#include <include/devicetree.h>
Like DT_PROP_LEN(), but with a fallback to default_value.
If the property is defined (as determined by DT_NODE_HAS_PROP()), this expands to DT_PROP_LEN(node_id, prop). The default_value parameter is not expanded in this case.
Otherwise, this expands to default_value.
| node_id | node identifier |
| prop | a lowercase-and-underscores property with a logical length |
| default_value | a fallback value to expand to |
| #define DT_PROP_OR | ( | node_id, | |
| prop, | |||
| default_value | |||
| ) |
#include <include/devicetree.h>
Like DT_PROP(), but with a fallback to default_value.
If the value exists, this expands to DT_PROP(node_id, prop). The default_value parameter is not expanded in this case.
Otherwise, this expands to default_value.
| node_id | node identifier |
| prop | lowercase-and-underscores property name |
| default_value | a fallback value to expand to |
| #define DT_STRING_TOKEN | ( | node_id, | |
| prop | |||
| ) | DT_CAT4(node_id, _P_, prop, _STRING_TOKEN) |
#include <include/devicetree.h>
Get a string property's value as a token.
This removes "the quotes" from string-valued properties, and converts non-alphanumeric characters to underscores. That can be useful, for example, when programmatically using the value to form a C variable or code.
DT_STRING_TOKEN() can only be used for properties with string type.
It is an error to use DT_STRING_TOKEN() in other circumstances.
Example devicetree fragment:
n1: node-1 {
prop = "foo";
};
n2: node-2 {
prop = "FOO";
}
n3: node-3 {
prop = "123 foo";
};
Example bindings fragment:
properties:
prop:
type: string
Example usage:
DT_STRING_TOKEN(DT_NODELABEL(n1), prop) // foo DT_STRING_TOKEN(DT_NODELABEL(n2), prop) // FOO DT_STRING_TOKEN(DT_NODELABEL(n3), prop) // 123_foo
Notice how:
FOO as a token. It is not converted to foo.123_foo as a token.| node_id | node identifier |
| prop | lowercase-and-underscores property string name |
prop as a token, i.e. without any quotes and with special characters converted to underscores | #define DT_STRING_UPPER_TOKEN | ( | node_id, | |
| prop | |||
| ) | DT_CAT4(node_id, _P_, prop, _STRING_UPPER_TOKEN) |
#include <include/devicetree.h>
Like DT_STRING_TOKEN(), but uppercased.
This removes "the quotes and capitalize" from string-valued properties, and converts non-alphanumeric characters to underscores. That can be useful, for example, when programmatically using the value to form a C variable or code.
DT_STRING_UPPER_TOKEN() can only be used for properties with string type.
It is an error to use DT_STRING_UPPER_TOKEN() in other circumstances.
Example devicetree fragment:
n1: node-1 {
prop = "foo";
};
n2: node-2 {
prop = "123 foo";
};
Example bindings fragment:
properties:
prop:
type: string
Example usage:
DT_STRING_UPPER_TOKEN(DT_NODELABEL(n1), prop) // FOO DT_STRING_UPPER_TOKEN(DT_NODELABEL(n2), prop) // 123_FOO
Notice how:
FOO as a token, i.e. it is uppercased.123_FOO as a token, i.e. it is uppercased and whitespace becomes an underscore.| node_id | node identifier |
| prop | lowercase-and-underscores property string name |
prop as a token, i.e. without any quotes and with special characters converted to underscores