LP43: Add support for more than 63 interrupts (not currently needed)

This commit is contained in:
Gregory Nutt 2016-05-31 11:39:51 -06:00
parent 4f81a60ef6
commit 828c898a80

View File

@ -246,18 +246,45 @@ static int lpc43_irqinfo(int irq, uintptr_t *regaddr, uint32_t *bit,
if (irq >= LPC43_IRQ_EXTINT)
{
/* NOTE: We assume that there are at least 32 interrupts */
if (irq < (LPC43_IRQ_EXTINT + 32))
{
/* Interrupt in range {0-31} */
*regaddr = (NVIC_IRQ0_31_ENABLE + offset);
*bit = 1 << (irq - LPC43_IRQ_EXTINT);
}
else if (irq < LPC43M4_IRQ_NIRQS)
#if LPC43M4_IRQ_NIRQS > 95
# error Extension to interrupt logic needed
#elif LPC43M4_IRQ_NIRQS > 63
else if (irq < (LPC43_IRQ_EXTINT + 64))
{
/* Interrupt in range {32-63} */
*regaddr = (NVIC_IRQ32_63_ENABLE + offset);
*bit = 1 << (irq - LPC43_IRQ_EXTINT - 32);
}
else if (irq < LPC43M4_IRQ_NIRQS)
{
/* Interrupt in range {64-LPC43M4_IRQ_NIRQS}, LPC43M4_IRQ_NIRQS <= 95 */
*regaddr = (NVIC_IRQ64_95_ENABLE + offset);
*bit = 1 << (irq - LPC43_IRQ_EXTINT - 64);
}
#else /* if LPC43M4_IRQ_NIRQS > 31 */
else if (irq < LPC43M4_IRQ_NIRQS)
{
/* Interrupt in range {32-LPC43M4_IRQ_NIRQS}, LPC43M4_IRQ_NIRQS <= 63 */
*regaddr = (NVIC_IRQ32_63_ENABLE + offset);
*bit = 1 << (irq - LPC43_IRQ_EXTINT - 32);
}
#endif
else
{
/* Interrupt >= LPC43M4_IRQ_NIRQS */
return ERROR; /* Invalid interrupt */
}
}