mirror of
https://github.com/apache/nuttx.git
synced 2026-05-28 20:08:15 +08:00
Smaller vector tables: Add irq_mapped_t.
This commit is contained in:
+7
-7
@@ -636,19 +636,19 @@ config ARCH_MINIMAL_VECTORTABLE
|
|||||||
provides:
|
provides:
|
||||||
|
|
||||||
#include <nuttx/arch.h>
|
#include <nuttx/arch.h>
|
||||||
const irq_t g_irqmap[NR_IRQS] =
|
const irq_mapped_t g_irqmap[NR_IRQS] =
|
||||||
{
|
{
|
||||||
... IRQ to index mapping values ...
|
... IRQ to index mapping values ...
|
||||||
};
|
};
|
||||||
|
|
||||||
This table is index by the hardware IRQ number and provides a value
|
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
|
mapped index into the vector table. Unused, unmapped interrupts
|
||||||
should be set to (irq_t)-1. So, for example, if g_irqmap[37] == 24,
|
should be set to (irq_mapped_t)-1. So, for example, if g_irqmap[37]
|
||||||
Then the hardware interrupt vector 37 will be mapped to the interrupt
|
== 24, then the hardware interrupt vector 37 will be mapped to the
|
||||||
vector table at index 24. if g_irqmap[42] == (irq_t)-1, then hardware
|
interrupt vector table at index 24. if g_irqmap[42] ==
|
||||||
interrupt vector 42 is not used and if it occurs will result in an
|
(irq_mapped_t)-1, then hardware interrupt vector 42 is not used and
|
||||||
unexpected interrupt crash.
|
if it occurs will result in an unexpected interrupt crash.
|
||||||
|
|
||||||
config ARCH_NUSER_INTERRUPTS
|
config ARCH_NUSER_INTERRUPTS
|
||||||
int "Number of interrupts"
|
int "Number of interrupts"
|
||||||
|
|||||||
+31
-1
@@ -65,7 +65,9 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifndef __ASSEMBLY__
|
#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
|
#if NR_IRQS <= 256
|
||||||
typedef uint8_t irq_t;
|
typedef uint8_t irq_t;
|
||||||
@@ -75,6 +77,20 @@ typedef uint16_t irq_t;
|
|||||||
typedef uint32_t irq_t;
|
typedef uint32_t irq_t;
|
||||||
#endif
|
#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 */
|
/* This struct defines the form of an interrupt service routine */
|
||||||
|
|
||||||
typedef int (*xcpt_t)(int irq, FAR void *context, FAR void *arg);
|
typedef int (*xcpt_t)(int irq, FAR void *context, FAR void *arg);
|
||||||
@@ -97,6 +113,20 @@ extern "C"
|
|||||||
#define EXTERN extern
|
#define EXTERN extern
|
||||||
#endif
|
#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
|
* Public Function Prototypes
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|||||||
+9
-2
@@ -91,9 +91,16 @@ extern struct irq_info_s g_irqvector[NR_IRQS];
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_ARCH_MINIMAL_VECTORTABLE
|
#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
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_SMP
|
#ifdef CONFIG_SMP
|
||||||
|
|||||||
@@ -75,8 +75,8 @@ void irq_dispatch(int irq, FAR void *context)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_ARCH_MINIMAL_VECTORTABLE
|
#ifdef CONFIG_ARCH_MINIMAL_VECTORTABLE
|
||||||
int ndx = g_irqmap[irq];
|
irq_mapped_t ndx = g_irqmap[irq];
|
||||||
if ((unsigned)ndx >= CONFIG_ARCH_NUSER_INTERRUPTS)
|
if (ndx >= CONFIG_ARCH_NUSER_INTERRUPTS)
|
||||||
{
|
{
|
||||||
vector = irq_unexpected_isr;
|
vector = irq_unexpected_isr;
|
||||||
arg = NULL;
|
arg = NULL;
|
||||||
|
|||||||
Reference in New Issue
Block a user