From 1d0012d617554e948c71c7f2a7f1a330686f1c62 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Thu, 1 Oct 2020 16:37:20 -0700 Subject: [PATCH 1/2] freedom-metal-generate: Use interrupt source_id in .ini file This switches how interrupts are named in the application configuration file from the actual IRQ number to the index within the device 'interrupts' list, allowing .ini files to be relatively independent of the interrupt mapping of the target device. Signed-off-by: Keith Packard --- scripts/codegen.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/scripts/codegen.py b/scripts/codegen.py index 55e2c2c2..a2ae1148 100644 --- a/scripts/codegen.py +++ b/scripts/codegen.py @@ -118,17 +118,17 @@ def local_interrupt_is_hw_vectored(compatible, irq, config): return False -def local_interrupt_priority(compatible, irq, config): +def local_interrupt_priority(compatible, source_id, config): """ - Given the compatible string, local interrupt id, and config, determines the interrupt - priority setting. + Given the compatible string, index within that devices interrupt parameter, + and config, determines the interrupt priority setting. """ if config is None: return 0 if "interrupts.priority" in config: if compatible in config["interrupts.priority"]: for config_id, config_prio in config["interrupts.priority"][compatible]: - if config_id == irq: + if config_id == source_id: return config_prio return 0 @@ -171,10 +171,10 @@ def int_parent_is_clic(n): }, "id": irq_id, "hwvectored": local_interrupt_is_hw_vectored( - node.get_field("compatible"), irq_id, config + node.get_field("compatible"), source_id, config ), "priority": local_interrupt_priority( - node.get_field("compatible"), irq_id, config + node.get_field("compatible"), source_id, config ), } ) @@ -194,10 +194,10 @@ def int_parent_is_clic(n): }, "id": irq_id, "hwvectored": local_interrupt_is_hw_vectored( - "sifive,local-external-interrupts0", irq_id, config + "sifive,local-external-interrupts0", source_id, config ), "priority": local_interrupt_priority( - "sifive,local-external-interrupts0", irq_id, config + "sifive,local-external-interrupts0", source_id, config ), } ) From c33f8967979d0a1f089becbd70991ae2ee3540b1 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Thu, 1 Oct 2020 16:36:17 -0700 Subject: [PATCH 2/2] Rename codegen.py to freedom-metal-generate This makes the tool name unique, which is useful for documentation. Signed-off-by: Keith Packard --- freedom-metal.make | 2 +- scripts/{codegen.py => freedom-metal-generate} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename scripts/{codegen.py => freedom-metal-generate} (100%) diff --git a/freedom-metal.make b/freedom-metal.make index 6fae4f64..772d3b46 100644 --- a/freedom-metal.make +++ b/freedom-metal.make @@ -91,7 +91,7 @@ clean:: rm -rf metal .deps metal/metal.mk: $(METAL_MK_DEPEND) - python3 $(FREEDOM_METAL)/scripts/codegen.py --dts $(DEVICETREE) --source-paths $(FREEDOM_METAL) $(FREEDOM_METAL)/sifive-blocks --output-dir=metal + python3 $(FREEDOM_METAL)/scripts/freedom-metal-generate --dts $(DEVICETREE) --source-paths $(FREEDOM_METAL) $(FREEDOM_METAL)/sifive-blocks --output-dir=metal ESDK_SETTINGS_GENERATOR ?= $(FREEDOM_METAL)/../scripts/esdk-settings-generator diff --git a/scripts/codegen.py b/scripts/freedom-metal-generate similarity index 100% rename from scripts/codegen.py rename to scripts/freedom-metal-generate