Skip to content

Commit

Permalink
soc/software: Rename NR_IRQ to CONFIG_CPU_INTERRUPTS.
Browse files Browse the repository at this point in the history
  • Loading branch information
enjoy-digital committed Nov 13, 2023
1 parent d7253ff commit edc6871
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion litex/soc/integration/soc.py
Original file line number Diff line number Diff line change
Expand Up @@ -1320,7 +1320,7 @@ def finalize(self):

# SoC IRQ Interconnect ---------------------------------------------------------------------
if hasattr(self, "cpu") and hasattr(self.cpu, "interrupt"):
self.add_constant("NR_IRQ", max(self.irq.locs.values()) + 1)
self.add_config("CPU_INTERRUPTS", max(self.irq.locs.values()) + 1)
for name, loc in sorted(self.irq.locs.items()):
if name in self.cpu.interrupts.keys():
continue
Expand Down
6 changes: 3 additions & 3 deletions litex/soc/software/libbase/isr.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,11 @@ void isr(void)
struct irq_table
{
isr_t isr;
} irq_table[NR_IRQ];
} irq_table[CONFIG_CPU_INTERRUPTS];

int irq_attach(unsigned int irq, isr_t isr)
{
if (irq >= NR_IRQ) {
if (irq >= CONFIG_CPU_INTERRUPTS) {
printf("Inv irq %d\n", irq);
return -1;
}
Expand All @@ -222,7 +222,7 @@ void isr(void)
while (irqs)
{
const unsigned int irq = __builtin_ctz(irqs);
if (irq < NR_IRQ && irq_table[irq].isr)
if ((irq < CONFIG_CPU_INTERRUPTS) && irq_table[irq].isr)
irq_table[irq].isr();
else {
irq_setmask(irq_getmask() & ~(1<<irq));
Expand Down

0 comments on commit edc6871

Please sign in to comment.