mirror of
https://github.com/apache/nuttx.git
synced 2026-05-30 21:36:28 +08:00
LM32: Add a fake IRQ number for a software interrupt.
This commit is contained in:
@@ -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,11 +123,16 @@ void up_disable_irq(int irq)
|
|||||||
|
|
||||||
DEBUGASSERT(irq >= 0 && irq < NR_IRQS);
|
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();
|
if (irq < MISOC_NINTERRUPTS)
|
||||||
flags &= ~(1 << irq);
|
{
|
||||||
irq_setmask(flags);
|
/* 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;
|
irqstate_t flags;
|
||||||
DEBUGASSERT(irq >= 0 && irq < NR_IRQS);
|
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();
|
if (irq < MISOC_NINTERRUPTS)
|
||||||
flags |= (1 << irq);
|
{
|
||||||
irq_setmask(flags);
|
/* Enable interrupts by setting the bit that corresponds to the irq */
|
||||||
|
|
||||||
|
flags = irq_getmask();
|
||||||
|
flags |= (1 << irq);
|
||||||
|
irq_setmask(flags);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user