|
4817 | 4817 | * DT_ANY_INST_HAS_PROP_STATUS_OKAY(baz) // 0
|
4818 | 4818 | * @endcode
|
4819 | 4819 | */
|
4820 |
| -#define DT_ANY_INST_HAS_PROP_STATUS_OKAY(prop) \ |
4821 |
| - COND_CODE_1(IS_EMPTY(DT_ANY_INST_HAS_PROP_STATUS_OKAY_(prop)), (0), (1)) |
| 4820 | +#define DT_ANY_INST_HAS_PROP_STATUS_OKAY(prop) \ |
| 4821 | + UTIL_NOT(IS_EMPTY( \ |
| 4822 | + DT_INST_FOREACH_STATUS_OKAY_VARGS(DT_ANY_INST_HAS_PROP_STATUS_OKAY_, prop))) |
4822 | 4823 |
|
4823 | 4824 | /**
|
4824 | 4825 | * @brief Check if any device node with status `okay` has a given
|
|
4914 | 4915 | * DT_ANY_INST_HAS_BOOL_STATUS_OKAY(baz) // 0
|
4915 | 4916 | * @endcode
|
4916 | 4917 | */
|
4917 |
| -#define DT_ANY_INST_HAS_BOOL_STATUS_OKAY(prop) \ |
4918 |
| - COND_CODE_1(IS_EMPTY(DT_ANY_INST_HAS_BOOL_STATUS_OKAY_(prop)), (0), (1)) |
| 4918 | +#define DT_ANY_INST_HAS_BOOL_STATUS_OKAY(prop) \ |
| 4919 | + UTIL_NOT(IS_EMPTY( \ |
| 4920 | + DT_INST_FOREACH_STATUS_OKAY_VARGS(DT_ANY_INST_HAS_BOOL_STATUS_OKAY_, prop))) |
4919 | 4921 |
|
4920 | 4922 | /**
|
4921 | 4923 | * @brief Call @p fn on all nodes with compatible `DT_DRV_COMPAT`
|
|
5186 | 5188 |
|
5187 | 5189 | /** @cond INTERNAL_HIDDEN */
|
5188 | 5190 |
|
5189 |
| -/** @brief Helper for DT_ANY_INST_HAS_PROP_STATUS_OKAY_ |
| 5191 | +/** @brief Helper for DT_ANY_INST_HAS_PROP_STATUS_OKAY |
5190 | 5192 | *
|
5191 | 5193 | * This macro generates token "1," for instance of a device,
|
5192 | 5194 | * identified by index @p idx, if instance has property @p prop.
|
|
5197 | 5199 | * @return Macro evaluates to `1,` if instance has the property,
|
5198 | 5200 | * otherwise it evaluates to literal nothing.
|
5199 | 5201 | */
|
5200 |
| -#define DT_ANY_INST_HAS_PROP_STATUS_OKAY__(idx, prop) \ |
5201 |
| - COND_CODE_1(DT_INST_NODE_HAS_PROP(idx, prop), (1,), ()) |
5202 |
| -/** @brief Helper for DT_ANY_INST_HAS_PROP_STATUS_OKAY |
5203 |
| - * |
5204 |
| - * This macro uses DT_ANY_INST_HAS_PROP_STATUS_OKAY_ with |
5205 |
| - * DT_INST_FOREACH_STATUS_OKAY_VARG to generate comma separated list of 1, |
5206 |
| - * where each 1 on the list represents instance that has a property |
5207 |
| - * @p prop; the list may be empty, and the upper bound on number of |
5208 |
| - * list elements is number of device instances. |
5209 |
| - * |
5210 |
| - * @param prop property to check |
5211 |
| - * |
5212 |
| - * @return Evaluates to list of 1s (e.g: 1,1,1,) or nothing. |
5213 |
| - */ |
5214 |
| -#define DT_ANY_INST_HAS_PROP_STATUS_OKAY_(prop) \ |
5215 |
| - DT_INST_FOREACH_STATUS_OKAY_VARGS(DT_ANY_INST_HAS_PROP_STATUS_OKAY__, prop) |
| 5202 | +#define DT_ANY_INST_HAS_PROP_STATUS_OKAY_(idx, prop) \ |
| 5203 | + IF_ENABLED(DT_INST_NODE_HAS_PROP(idx, prop), (1,)) |
5216 | 5204 |
|
5217 |
| -/** @brief Helper for DT_ANY_INST_HAS_BOOL_STATUS_OKAY_ |
| 5205 | +/** @brief Helper for DT_ANY_INST_HAS_BOOL_STATUS_OKAY |
5218 | 5206 | *
|
5219 | 5207 | * This macro generates token "1," for instance of a device,
|
5220 | 5208 | * identified by index @p idx, if instance has boolean property
|
|
5226 | 5214 | * @return Macro evaluates to `1,` if instance property value is 1,
|
5227 | 5215 | * otherwise it evaluates to literal nothing.
|
5228 | 5216 | */
|
5229 |
| -#define DT_ANY_INST_HAS_BOOL_STATUS_OKAY__(idx, prop) \ |
5230 |
| - COND_CODE_1(DT_INST_PROP(idx, prop), (1,), ()) |
5231 |
| -/** @brief Helper for DT_ANY_INST_HAS_BOOL_STATUS_OKAY |
5232 |
| - * |
5233 |
| - * This macro uses DT_ANY_INST_HAS_BOOL_STATUS_OKAY_ with |
5234 |
| - * DT_INST_FOREACH_STATUS_OKAY_VARG to generate comma separated list of 1, |
5235 |
| - * where each 1 on the list represents instance that has a property |
5236 |
| - * @p prop of value 1; the list may be empty, and the upper bound on number of |
5237 |
| - * list elements is number of device instances. |
5238 |
| - * |
5239 |
| - * @param prop property to check |
5240 |
| - * |
5241 |
| - * @return Evaluates to list of 1s (e.g: 1,1,1,) or nothing. |
5242 |
| - */ |
5243 |
| -#define DT_ANY_INST_HAS_BOOL_STATUS_OKAY_(prop) \ |
5244 |
| - DT_INST_FOREACH_STATUS_OKAY_VARGS(DT_ANY_INST_HAS_BOOL_STATUS_OKAY__, prop) |
| 5217 | +#define DT_ANY_INST_HAS_BOOL_STATUS_OKAY_(idx, prop) \ |
| 5218 | + IF_ENABLED(DT_INST_PROP(idx, prop), (1,)) |
5245 | 5219 |
|
5246 | 5220 | #define DT_PATH_INTERNAL(...) \
|
5247 | 5221 | UTIL_CAT(DT_ROOT, MACRO_MAP_CAT(DT_S_PREFIX, __VA_ARGS__))
|
|
0 commit comments