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.

ISR macro

#define ISR

Declares 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.

isr_t type

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>.

ivt_vector_t struct

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

VECTOR() macro

#define VECTOR(handler, psr)

Constructs an instance of ivt_vector_t.

INTERRUPT_VECTORS() macro

#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.

_interrupt_handler() function

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.

DEFAULT_VECTOR macro

#define DEFAULT_VECTOR

The default interrupt vector used for interrupts in absence of a specific handler.

EXCEPTION_COUNT macro

#define EXCEPTION_COUNT 16

The number of exception vectors in the IVT, including the reset vector.

INTERRUPT_COUNT macro

#define INTERRUPT_COUNT 48

The number of application-specific interrupt vectors in the IVT.

⚠️ **GitHub.com Fallback** ⚠️