From edc6871aceefcdeef16a76e7d70afb52f7229115 Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Mon, 13 Nov 2023 09:14:57 +0100 Subject: [PATCH] soc/software: Rename NR_IRQ to CONFIG_CPU_INTERRUPTS. --- litex/soc/integration/soc.py | 2 +- litex/soc/software/libbase/isr.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/litex/soc/integration/soc.py b/litex/soc/integration/soc.py index 613c81402..96d7f2abb 100644 --- a/litex/soc/integration/soc.py +++ b/litex/soc/integration/soc.py @@ -1320,7 +1320,7 @@ class SoC(LiteXModule, SoCCoreCompat): # 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 diff --git a/litex/soc/software/libbase/isr.c b/litex/soc/software/libbase/isr.c index 6c052b2d7..268605d72 100644 --- a/litex/soc/software/libbase/isr.c +++ b/litex/soc/software/libbase/isr.c @@ -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; } @@ -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<