diff --git a/arch/misoc/include/irq.h b/arch/misoc/include/irq.h index 1fbf884fc3b..a21987b00a4 100644 --- a/arch/misoc/include/irq.h +++ b/arch/misoc/include/irq.h @@ -53,7 +53,11 @@ * Pre-processor Definitions ****************************************************************************/ -#define NR_IRQS 32 +/* 32 True interrupts plus the sofware interrupt */ + +#define MISOC_NINTERRUPTS 32 +#define MISOC_IRQ_SWINT 32 +#define NR_IRQS 33 /**************************************************************************** * Public Function Prototypes diff --git a/arch/misoc/src/lm32/lm32_decodeirq.c b/arch/misoc/src/lm32/lm32_decodeirq.c index bdf0abe240d..0df3f73ed96 100644 --- a/arch/misoc/src/lm32/lm32_decodeirq.c +++ b/arch/misoc/src/lm32/lm32_decodeirq.c @@ -77,7 +77,7 @@ uint32_t *lm32_decodeirq(uint32_t *regs) /* Decode and dispatch interrupts */ - for (irq = 0; irq < NR_IRQS & instat != 0; i++) + for (irq = 0; irq < MISOC_NINTERRUPTS & instat != 0; i++) { uint32_t bit = (1 << irq); diff --git a/arch/misoc/src/lm32/lm32_irq.c b/arch/misoc/src/lm32/lm32_irq.c index d64623dfa3e..4218d8872b2 100644 --- a/arch/misoc/src/lm32/lm32_irq.c +++ b/arch/misoc/src/lm32/lm32_irq.c @@ -74,6 +74,13 @@ void lm32_irq_initialize(void) irq_setie(1); } +/**************************************************************************** + * Name: up_irq_save + * + * Description: + * + ****************************************************************************/ + irqstate_t up_irq_save(void) { irqstate_t flags; @@ -88,6 +95,13 @@ irqstate_t up_irq_save(void) return flags; } +/**************************************************************************** + * Name: up_irq_restore + * + * Description: + * + ****************************************************************************/ + void up_irq_restore(irqstate_t flags) { /* Restore the interrupt state returned by up_save_irq() */ @@ -109,11 +123,16 @@ void up_disable_irq(int irq) DEBUGASSERT(irq >= 0 && irq < NR_IRQS); - /* Disable interrupts by clearing the bit that corresponds to the irq */ + /* Ignore any attempt to disable software interrupts */ - flags = irq_getmask(); - flags &= ~(1 << irq); - irq_setmask(flags); + if (irq < MISOC_NINTERRUPTS) + { + /* Disable interrupts by clearing the bit that corresponds to the irq */ + + flags = irq_getmask(); + flags &= ~(1 << irq); + irq_setmask(flags); + } } /**************************************************************************** @@ -129,9 +148,14 @@ void up_enable_irq(int irq) irqstate_t flags; DEBUGASSERT(irq >= 0 && irq < NR_IRQS); - /* Enable interrupts by setting the bit that corresponds to the irq */ + /* Ignore any attempt to enable software interrupts */ - flags = irq_getmask(); - flags |= (1 << irq); - irq_setmask(flags); + if (irq < MISOC_NINTERRUPTS) + { + /* Enable interrupts by setting the bit that corresponds to the irq */ + + flags = irq_getmask(); + flags |= (1 << irq); + irq_setmask(flags); + } }