Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename codegen #359

Open
wants to merge 2 commits into
base: freedom-metal-next
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion freedom-metal.make
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
16 changes: 8 additions & 8 deletions scripts/codegen.py → scripts/freedom-metal-generate
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
),
}
)
Expand All @@ -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
),
}
)
Expand Down