scripts/dts: gen_defines: Generates _EXISTS for reg & irq macros
Add generation of the following macros:
DT_N_<node-id>_REG_IDX_<idx>_EXISTS 1
DT_N_<node-id>_IRQ_IDX_<idx>_EXISTS 1
This will allow us to use IS_ENABLED() in DT_REG_HAS_IDX and
DT_IRQ_HAS_IDX which matches behavior of other DT_*_HAS_* macros as
well as lets use these with COND_CODE_1.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
diff --git a/scripts/dts/gen_defines.py b/scripts/dts/gen_defines.py
index bc544c6..a5ef1f3 100755
--- a/scripts/dts/gen_defines.py
+++ b/scripts/dts/gen_defines.py
@@ -239,6 +239,7 @@
idx_vals.append((f"{path_id}_REG_NUM", len(node.regs)))
for i, reg in enumerate(node.regs):
+ idx_vals.append((f"{path_id}_REG_IDX_{i}_EXISTS", 1))
if reg.addr is not None:
idx_macro = f"{path_id}_REG_IDX_{i}_VAL_ADDRESS"
idx_vals.append((idx_macro,
@@ -312,6 +313,7 @@
cell_value = map_arm_gic_irq_type(irq, cell_value)
cell_value = encode_zephyr_multi_level_irq(irq, cell_value)
+ idx_vals.append((f"{path_id}_IRQ_IDX_{i}_EXISTS", 1))
idx_macro = f"{path_id}_IRQ_IDX_{i}_VAL_{name}"
idx_vals.append((idx_macro, cell_value))
idx_vals.append((idx_macro + "_EXISTS", 1))