ivt.h header - ylab-nsu/cdm16-llvm-neo GitHub Wiki
#include <cdm/ivt.h>Macros for defining interrupt service routines and the interrupt vector table.
#define ISRDeclares an interrupt service routine. The function must have the same signature as isr_t.
Important
Each C function referenced in the interrupt vector table must be marked with ISR.
typedef ISR void isr_t(context_t *context);The type of interrupt service routines. The parameter is a pointer to the saved processor context. See context_t.
Note
You don't need to explicitly include <cdm/register.h> to use context_t. It is also defined in <cdm/ivt.h>.
typedef struct {
isr_t *handler;
psr_t psr;
} ivt_vector_t;Interrupt vector table entry.
Fields:
-
handler- pointer to the interrupt service routine -
psr- the value that will be put into PSR before handling the interrupt request
#define VECTOR(handler, psr)Constructs an instance of ivt_vector_t.
#define INTERRUPT_VECTORS(...)
INTERRUPT_VECTORS(
VECTOR(example_handler1, psr1),
VECTOR(example_handler2, psr2)
);Note
Only supported on the cdm target.
Defines one or more application specific interrupts in the IVT.
Each argument of type ivt_vector_t (up to INTERRUPT_COUNT vectors) is placed in the IVT sequentially starting from index EXCEPTION_COUNT.
The rest of the IVT is filled with DEFAULT_VECTOR.
Important
Must not be used more than once in the entire application.
isr_t _interrupt_handler;The default interrupt service routine. Puts the value 0xDED0 into r0 and halts the processor by default.
This behavior can be overridden. See common definitions.
#define DEFAULT_VECTORThe default interrupt vector used for interrupts in absence of a specific handler.
#define EXCEPTION_COUNT 16The number of exception vectors in the IVT, including the reset vector.
#define INTERRUPT_COUNT 48The number of application-specific interrupt vectors in the IVT.