mirror of
https://github.com/apache/nuttx.git
synced 2026-06-04 14:53:47 +08:00
shced/irq: Add up_irq_to_ndx interface
Use architecture-specific up_irq_to_ndx() interface to map IRQ numbers to vector table indices Signed-off-by: pangzhen1 <pangzhen1@xiaomi.com>
This commit is contained in:
@@ -37,7 +37,8 @@
|
||||
****************************************************************************/
|
||||
|
||||
static spinlock_t g_irqlock = SP_UNLOCKED;
|
||||
#ifdef CONFIG_ARCH_MINIMAL_VECTORTABLE_DYNAMIC
|
||||
#if defined(CONFIG_ARCH_MINIMAL_VECTORTABLE_DYNAMIC) && \
|
||||
!defined(CONFIG_ARCH_IRQ_TO_NDX)
|
||||
static int g_irqmap_count = 1;
|
||||
#endif
|
||||
|
||||
@@ -56,7 +57,9 @@ static int g_irqmap_count = 1;
|
||||
* declaration is here for the time being.
|
||||
*/
|
||||
|
||||
# if !defined(CONFIG_ARCH_IRQ_TO_NDX)
|
||||
irq_mapped_t g_irqmap[NR_IRQS];
|
||||
# endif
|
||||
int g_irqrevmap[CONFIG_ARCH_NUSER_INTERRUPTS];
|
||||
#endif
|
||||
|
||||
@@ -64,7 +67,8 @@ int g_irqrevmap[CONFIG_ARCH_NUSER_INTERRUPTS];
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ARCH_MINIMAL_VECTORTABLE_DYNAMIC
|
||||
#if defined(CONFIG_ARCH_MINIMAL_VECTORTABLE_DYNAMIC) && \
|
||||
!defined(CONFIG_ARCH_IRQ_TO_NDX)
|
||||
int irq_to_ndx(int irq)
|
||||
{
|
||||
DEBUGASSERT(g_irqmap_count < CONFIG_ARCH_NUSER_INTERRUPTS);
|
||||
@@ -80,7 +84,8 @@ int irq_to_ndx(int irq)
|
||||
spin_unlock_irqrestore(&g_irqlock, flags);
|
||||
return g_irqmap[irq];
|
||||
}
|
||||
#elif defined(CONFIG_ARCH_MINIMAL_VECTORTABLE)
|
||||
#elif defined(CONFIG_ARCH_MINIMAL_VECTORTABLE) && \
|
||||
!defined(CONFIG_ARCH_IRQ_TO_NDX)
|
||||
int ndx_to_irq(int ndx)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -77,15 +77,9 @@ static int irqchain_dispatch(int irq, FAR void *context, FAR void *arg)
|
||||
{
|
||||
FAR struct irqchain_s *curr;
|
||||
FAR struct irqchain_s *prev;
|
||||
int ndx;
|
||||
int ndx = IRQ_TO_NDX(irq);
|
||||
int ret = 0;
|
||||
|
||||
#ifdef CONFIG_ARCH_MINIMAL_VECTORTABLE
|
||||
ndx = g_irqmap[irq];
|
||||
#else
|
||||
ndx = irq;
|
||||
#endif
|
||||
|
||||
curr = g_irqvector[ndx].arg;
|
||||
while (curr != NULL)
|
||||
{
|
||||
|
||||
@@ -102,13 +102,12 @@ void irq_dispatch(int irq, FAR void *context)
|
||||
#endif
|
||||
xcpt_t vector = irq_unexpected_isr;
|
||||
FAR void *arg = NULL;
|
||||
int ndx = irq;
|
||||
unsigned int ndx = IRQ_TO_NDX(irq);
|
||||
|
||||
#if NR_IRQS > 0
|
||||
if (irq >= 0 && irq < NR_IRQS)
|
||||
{
|
||||
#ifdef CONFIG_ARCH_MINIMAL_VECTORTABLE
|
||||
ndx = g_irqmap[irq];
|
||||
if (ndx < CONFIG_ARCH_NUSER_INTERRUPTS)
|
||||
{
|
||||
if (g_irqvector[ndx].handler)
|
||||
|
||||
Reference in New Issue
Block a user