LM32: Add a fake IRQ number for a software interrupt.
This commit is contained in:
parent
b2126738cd
commit
50efe4a906
@ -53,7 +53,11 @@
|
|||||||
* Pre-processor Definitions
|
* 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
|
* Public Function Prototypes
|
||||||
|
@ -77,7 +77,7 @@ uint32_t *lm32_decodeirq(uint32_t *regs)
|
|||||||
|
|
||||||
/* Decode and dispatch interrupts */
|
/* 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);
|
uint32_t bit = (1 << irq);
|
||||||
|
|
||||||
|
@ -74,6 +74,13 @@ void lm32_irq_initialize(void)
|
|||||||
irq_setie(1);
|
irq_setie(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: up_irq_save
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
irqstate_t up_irq_save(void)
|
irqstate_t up_irq_save(void)
|
||||||
{
|
{
|
||||||
irqstate_t flags;
|
irqstate_t flags;
|
||||||
@ -88,6 +95,13 @@ irqstate_t up_irq_save(void)
|
|||||||
return flags;
|
return flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: up_irq_restore
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
void up_irq_restore(irqstate_t flags)
|
void up_irq_restore(irqstate_t flags)
|
||||||
{
|
{
|
||||||
/* Restore the interrupt state returned by up_save_irq() */
|
/* Restore the interrupt state returned by up_save_irq() */
|
||||||
@ -109,12 +123,17 @@ void up_disable_irq(int irq)
|
|||||||
|
|
||||||
DEBUGASSERT(irq >= 0 && irq < NR_IRQS);
|
DEBUGASSERT(irq >= 0 && irq < NR_IRQS);
|
||||||
|
|
||||||
|
/* Ignore any attempt to disable software interrupts */
|
||||||
|
|
||||||
|
if (irq < MISOC_NINTERRUPTS)
|
||||||
|
{
|
||||||
/* Disable interrupts by clearing the bit that corresponds to the irq */
|
/* Disable interrupts by clearing the bit that corresponds to the irq */
|
||||||
|
|
||||||
flags = irq_getmask();
|
flags = irq_getmask();
|
||||||
flags &= ~(1 << irq);
|
flags &= ~(1 << irq);
|
||||||
irq_setmask(flags);
|
irq_setmask(flags);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_enable_irq
|
* Name: up_enable_irq
|
||||||
@ -129,9 +148,14 @@ void up_enable_irq(int irq)
|
|||||||
irqstate_t flags;
|
irqstate_t flags;
|
||||||
DEBUGASSERT(irq >= 0 && irq < NR_IRQS);
|
DEBUGASSERT(irq >= 0 && irq < NR_IRQS);
|
||||||
|
|
||||||
|
/* Ignore any attempt to enable software interrupts */
|
||||||
|
|
||||||
|
if (irq < MISOC_NINTERRUPTS)
|
||||||
|
{
|
||||||
/* Enable interrupts by setting the bit that corresponds to the irq */
|
/* Enable interrupts by setting the bit that corresponds to the irq */
|
||||||
|
|
||||||
flags = irq_getmask();
|
flags = irq_getmask();
|
||||||
flags |= (1 << irq);
|
flags |= (1 << irq);
|
||||||
irq_setmask(flags);
|
irq_setmask(flags);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user