LM32: Add a fake IRQ number for a software interrupt.

This commit is contained in:
Gregory Nutt 2016-11-04 11:17:12 -06:00
parent b2126738cd
commit 50efe4a906
3 changed files with 38 additions and 10 deletions
arch/misoc

@ -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

@ -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);

@ -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);
}
}