scripts: dts: gen_defines: Generate interrupt-controller macro
Extend the gen_defines.py write_interrupts(node) function to generate macros to get the interrupt controller for an interrupt specifier by idx and by name. The information is already generated by edtlib.py and stored in node.interrupts[].controller. This addition uses the node pointed to by the controller member to generate the following example output define DT_N_S_device1_IRQ_IDX_0_CONTROLLER \ DT_N_S_gpio_800 define DT_N_S_device1_IRQ_NAME_test4_CONTROLLER \ N_S_device1_IRQ_IDX_0_CONTROLLER Signed-off-by: Bjarki Arge Andreasen <bjarki@arge-andreasen.me>
This commit is contained in:
parent
cbc9439bc0
commit
08d6ff059e
2
doc/build/dts/macros.bnf
vendored
2
doc/build/dts/macros.bnf
vendored
|
@ -40,8 +40,10 @@ node-macro =/ %s"DT_N" path-id %s"_IRQ_NUM"
|
||||||
node-macro =/ %s"DT_N" path-id %s"_IRQ_IDX_" DIGIT "_EXISTS"
|
node-macro =/ %s"DT_N" path-id %s"_IRQ_IDX_" DIGIT "_EXISTS"
|
||||||
node-macro =/ %s"DT_N" path-id %s"_IRQ_IDX_" DIGIT
|
node-macro =/ %s"DT_N" path-id %s"_IRQ_IDX_" DIGIT
|
||||||
%s"_VAL_" dt-name [ %s"_EXISTS" ]
|
%s"_VAL_" dt-name [ %s"_EXISTS" ]
|
||||||
|
node-macro =/ %s"DT_N" path-id %s"_CONTROLLER"
|
||||||
node-macro =/ %s"DT_N" path-id %s"_IRQ_NAME_" dt-name
|
node-macro =/ %s"DT_N" path-id %s"_IRQ_NAME_" dt-name
|
||||||
%s"_VAL_" dt-name [ %s"_EXISTS" ]
|
%s"_VAL_" dt-name [ %s"_EXISTS" ]
|
||||||
|
node-macro =/ %s"DT_N" path-id %s"_IRQ_NAME_" dt-name "_CONTROLLER"
|
||||||
; The ranges property is also special.
|
; The ranges property is also special.
|
||||||
node-macro =/ %s"DT_N" path-id %s"_RANGES_NUM"
|
node-macro =/ %s"DT_N" path-id %s"_RANGES_NUM"
|
||||||
node-macro =/ %s"DT_N" path-id %s"_RANGES_IDX_" DIGIT "_EXISTS"
|
node-macro =/ %s"DT_N" path-id %s"_RANGES_IDX_" DIGIT "_EXISTS"
|
||||||
|
|
|
@ -477,6 +477,13 @@ def write_interrupts(node):
|
||||||
name_vals.append((name_macro, f"DT_{idx_macro}"))
|
name_vals.append((name_macro, f"DT_{idx_macro}"))
|
||||||
name_vals.append((name_macro + "_EXISTS", 1))
|
name_vals.append((name_macro + "_EXISTS", 1))
|
||||||
|
|
||||||
|
idx_controller_macro = f"{path_id}_IRQ_IDX_{i}_CONTROLLER"
|
||||||
|
idx_controller_path = f"DT_{irq.controller.z_path_id}"
|
||||||
|
idx_vals.append((idx_controller_macro, idx_controller_path))
|
||||||
|
if irq.name:
|
||||||
|
name_controller_macro = f"{path_id}_IRQ_NAME_{str2ident(irq.name)}_CONTROLLER"
|
||||||
|
name_vals.append((name_controller_macro, f"DT_{idx_controller_macro}"))
|
||||||
|
|
||||||
for macro, val in idx_vals:
|
for macro, val in idx_vals:
|
||||||
out_dt_define(macro, val)
|
out_dt_define(macro, val)
|
||||||
for macro, val in name_vals:
|
for macro, val in name_vals:
|
||||||
|
|
Loading…
Reference in a new issue