Skip to content

Class hal::cortex_m::interrupt

ClassList > hal > cortex_m > interrupt

Cortex M series interrupt controller.

  • #include <interrupt.hpp>

Classes

Type Name
class exception_number
represents an interrupt request number along with helper functions for setting up the interrupt controller registers.

Public Static Attributes

Type Name
constexpr size_t core_interrupts = = 16
The core interrupts that all cortex m3, m4, m7 processors have.

Public Functions

Type Name
void disable ()
disable interrupt and set the service routine handler to "nop".
void enable (interrupt_pointer p_handler)
enable interrupt and set the service routine handler.
interrupt (exception_number p_id)
Construct a new interrupt object.
bool verify_vector_enabled (interrupt_pointer p_handler)
determine if a particular handler has been put into the interrupt vector table.

Public Static Functions

Type Name
void disable_interrupts ()
void enable_interrupts ()
const std::span< interrupt_pointer > get_vector_table ()
Get a reference to interrupt vector table object.
void initialize ()
Initializes the interrupt vector table.
void nop ()
Place holder interrupt that performs no work.
void reinitialize ()
Reinitialize vector table.

Public Static Attributes Documentation

variable core_interrupts

constexpr size_t hal::cortex_m::interrupt::core_interrupts;

Public Functions Documentation

function disable

disable interrupt and set the service routine handler to "nop".

void hal::cortex_m::interrupt::disable () 

If the IRQ is invalid, then nothing happens.

function enable

enable interrupt and set the service routine handler.

void hal::cortex_m::interrupt::enable (
    interrupt_pointer p_handler
) 

Parameters:

  • p_handler - the interrupt service routine handler to be executed when the hardware interrupt is fired.

function interrupt

Construct a new interrupt object.

explicit hal::cortex_m::interrupt::interrupt (
    exception_number p_id
) 

Parameters:

  • p_id - interrupt to configure

function verify_vector_enabled

determine if a particular handler has been put into the interrupt vector table.

bool hal::cortex_m::interrupt::verify_vector_enabled (
    interrupt_pointer p_handler
) 

Generally used by unit testing code.

Parameters:

  • p_handler - the handler to check against

Returns:

true - the handler is equal to the handler in the table

Returns:

false - the handler is not at this index in the table

Public Static Functions Documentation

function disable_interrupts

static void hal::cortex_m::interrupt::disable_interrupts () 

function enable_interrupts

static void hal::cortex_m::interrupt::enable_interrupts () 

function get_vector_table

Get a reference to interrupt vector table object.

static const std::span< interrupt_pointer > hal::cortex_m::interrupt::get_vector_table () 

Returns:

const std::span<interrupt_pointer> - interrupt vector table

function initialize

Initializes the interrupt vector table.

template<size_t VectorCount>
static inline void hal::cortex_m::interrupt::initialize () 

This template function does the following: * Statically allocates a 512-byte aligned an interrupt vector table the size of VectorCount. * Set the default handlers for all interrupt vectors to the "nop" function which does nothing * Set vector_table span to the statically allocated vector table. * Finally it relocates the system's interrupt vector table away from the hard coded vector table in ROM/Flash memory to the statically allocated table in RAM.

Internally, this function checks if it has been called before and will simply return early if so. Making this function safe to call multiple times so long as the VectorCount template parameter is the same with each invocation.

Calling this function with differing VectorCount values will result in multiple statically allocated interrupt vector tables, which will simply waste space in RAM. Only the first call is used as the IVT.

Template parameters:

  • VectorCount - the number of interrupts available for this system

function nop

static void hal::cortex_m::interrupt::nop () 

function reinitialize

Reinitialize vector table.

template<size_t VectorCount>
static inline void hal::cortex_m::interrupt::reinitialize () 

Will reset the entries of the vector table. Careful to not use this after any drivers have already put entries on to the vector table. This will also disable all interrupts currently enabled on the system.

Template parameters:

  • VectorCount - the number of interrupts available for this system

The documentation for this class was generated from the following file libraries/include/libhal-armcortex/interrupt.hpp