soc/software: Rename NR_IRQ to CONFIG_CPU_INTERRUPTS.

This commit is contained in:
Florent Kermarrec 2023-11-13 09:14:57 +01:00
parent d7253ffd0e
commit edc6871ace
2 changed files with 4 additions and 4 deletions

View file

@ -1320,7 +1320,7 @@ class SoC(LiteXModule, SoCCoreCompat):
# SoC IRQ Interconnect --------------------------------------------------------------------- # SoC IRQ Interconnect ---------------------------------------------------------------------
if hasattr(self, "cpu") and hasattr(self.cpu, "interrupt"): 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()): for name, loc in sorted(self.irq.locs.items()):
if name in self.cpu.interrupts.keys(): if name in self.cpu.interrupts.keys():
continue continue

View file

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