Smaller vector tables: Add irq_mapped_t.
This commit is contained in:
parent
04c9ccdd2d
commit
e1218c4b4b
4 changed files with 49 additions and 12 deletions
14
arch/Kconfig
14
arch/Kconfig
|
@ -636,19 +636,19 @@ config ARCH_MINIMAL_VECTORTABLE
|
|||
provides:
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
const irq_t g_irqmap[NR_IRQS] =
|
||||
const irq_mapped_t g_irqmap[NR_IRQS] =
|
||||
{
|
||||
... IRQ to index mapping values ...
|
||||
};
|
||||
|
||||
This table is index by the hardware IRQ number and provides a value
|
||||
in the range of 0 to CONFIG_ARCH_NUSER_INTERRUPTS that the new,
|
||||
in the range of 0 to CONFIG_ARCH_NUSER_INTERRUPTS that is the new,
|
||||
mapped index into the vector table. Unused, unmapped interrupts
|
||||
should be set to (irq_t)-1. So, for example, if g_irqmap[37] == 24,
|
||||
Then the hardware interrupt vector 37 will be mapped to the interrupt
|
||||
vector table at index 24. if g_irqmap[42] == (irq_t)-1, then hardware
|
||||
interrupt vector 42 is not used and if it occurs will result in an
|
||||
unexpected interrupt crash.
|
||||
should be set to (irq_mapped_t)-1. So, for example, if g_irqmap[37]
|
||||
== 24, then the hardware interrupt vector 37 will be mapped to the
|
||||
interrupt vector table at index 24. if g_irqmap[42] ==
|
||||
(irq_mapped_t)-1, then hardware interrupt vector 42 is not used and
|
||||
if it occurs will result in an unexpected interrupt crash.
|
||||
|
||||
config ARCH_NUSER_INTERRUPTS
|
||||
int "Number of interrupts"
|
||||
|
|
|
@ -65,7 +65,9 @@
|
|||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
/* This type is an integer type large enough to hold the largest IRQ number. */
|
||||
/* This type is an unsigned integer type large enough to hold the largest
|
||||
* IRQ number.
|
||||
*/
|
||||
|
||||
#if NR_IRQS <= 256
|
||||
typedef uint8_t irq_t;
|
||||
|
@ -75,6 +77,20 @@ typedef uint16_t irq_t;
|
|||
typedef uint32_t irq_t;
|
||||
#endif
|
||||
|
||||
/* This type is an unsigned integer type large enough to hold the largest
|
||||
* mapped vector table index.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_ARCH_MINIMAL_VECTORTABLE
|
||||
#if CONFIG_ARCH_NUSER_INTERRUPTS <= 256
|
||||
typedef uint8_t irq_mapped_t;
|
||||
#elif CONFIG_ARCH_NUSER_INTERRUPTS <= 65536
|
||||
typedef uint16_t irq_mapped_t;
|
||||
#else
|
||||
typedef uint32_t irq_mapped_t;
|
||||
#endif
|
||||
#endif /* CONFIG_ARCH_MINIMAL_VECTORTABLE */
|
||||
|
||||
/* This struct defines the form of an interrupt service routine */
|
||||
|
||||
typedef int (*xcpt_t)(int irq, FAR void *context, FAR void *arg);
|
||||
|
@ -97,6 +113,20 @@ extern "C"
|
|||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ARCH_MINIMAL_VECTORTABLE
|
||||
/* This is the interrupt vector mapping table. This must be provided by
|
||||
* architecture specific logic if CONFIG_ARCH_MINIMAL_VECTORTABLE is define
|
||||
* in the configuration.
|
||||
*
|
||||
* REVISIT: Currently declared in sched/irq/irq.h. This declaration here
|
||||
* introduces a circular dependency since it depends on NR_IRQS which is
|
||||
* defined in arch/irq.h but arch/irq.h includes nuttx/irq.h and we get
|
||||
* here with NR_IRQS undefined.
|
||||
*/
|
||||
|
||||
/* EXTERN const irq_mapped_t g_irqmap[NR_IRQS]; */
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
|
|
@ -91,9 +91,16 @@ extern struct irq_info_s g_irqvector[NR_IRQS];
|
|||
#endif
|
||||
|
||||
#ifdef CONFIG_ARCH_MINIMAL_VECTORTABLE
|
||||
/* This is the interrupt vector mapping table */
|
||||
/* This is the interrupt vector mapping table. This must be provided by
|
||||
* architecture specific logic if CONFIG_ARCH_MINIMAL_VECTORTABLE is define
|
||||
* in the configuration.
|
||||
*
|
||||
* REVISIT: This should be declared in include/nuttx/irq.h. The declaration
|
||||
* at that location, however, introduces a circular include dependency so the
|
||||
* declaration is here for the time being.
|
||||
*/
|
||||
|
||||
extern const irq_t g_irqmap[NR_IRQS];
|
||||
extern const irq_mapped_t g_irqmap[NR_IRQS];
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
|
|
|
@ -75,8 +75,8 @@ void irq_dispatch(int irq, FAR void *context)
|
|||
else
|
||||
{
|
||||
#ifdef CONFIG_ARCH_MINIMAL_VECTORTABLE
|
||||
int ndx = g_irqmap[irq];
|
||||
if ((unsigned)ndx >= CONFIG_ARCH_NUSER_INTERRUPTS)
|
||||
irq_mapped_t ndx = g_irqmap[irq];
|
||||
if (ndx >= CONFIG_ARCH_NUSER_INTERRUPTS)
|
||||
{
|
||||
vector = irq_unexpected_isr;
|
||||
arg = NULL;
|
||||
|
|
Loading…
Reference in a new issue