![]() |
S32 SDK
|
The S32 SDK Interrupt Manager provides a set of API/services to configure the Interrupt Controller (NVIC).
The Nested-Vectored Interrupt Controller (NVIC) module implements a relocatable vector table supporting many external interrupts, a single non-maskable interrupt (NMI), and priority levels. The NVIC contains the address of the function to execute for a particular handler. The address is fetched via the instruction port allowing parallel register stacking and look-up. The first sixteen entries are allocated to internal sources with the others mapping to MCU-defined interrupts.
The Interrupt Manager provides a set of APIs so that the application can enable or disable an interrupt for a specific device and also set priority, and other features. Additionally, it provides a way to update the vector table for a specific device interrupt handler.
Each chip has its own set of supported interrupt names defined in the chip-specific header file (see IRQn_Type).
This is an example to enable/disable an interrupt for the ADC0_IRQn:
Typedefs | |
typedef void(* | isr_t) (void) |
Interrupt handler type. More... | |
Functions | |
void | DefaultISR (void) |
Default ISR. More... | |
Interrupt manager APIs | |
void | INT_SYS_InstallHandler (IRQn_Type irqNumber, const isr_t newHandler, isr_t *const oldHandler) |
Installs an interrupt handler routine for a given IRQ number. More... | |
void | INT_SYS_EnableIRQ (IRQn_Type irqNumber) |
Enables an interrupt for a given IRQ number. More... | |
void | INT_SYS_DisableIRQ (IRQn_Type irqNumber) |
Disables an interrupt for a given IRQ number. More... | |
void | INT_SYS_EnableIRQGlobal (void) |
Enables system interrupt. More... | |
void | INT_SYS_DisableIRQGlobal (void) |
Disable system interrupt. More... | |
static void | INT_SYS_SetPriority (IRQn_Type irqNumber, uint8_t priority) |
Set Interrupt Priority. More... | |
static uint8_t | INT_SYS_GetPriority (IRQn_Type irqNumber) |
Get Interrupt Priority. More... | |
static void | INT_SYS_ClearPending (IRQn_Type irqNumber) |
Clear Pending Interrupt. More... | |
static void | INT_SYS_SetPending (IRQn_Type irqNumber) |
Set Pending Interrupt. More... | |
static uint32_t | INT_SYS_GetPending (IRQn_Type irqNumber) |
Get Pending Interrupt. More... | |
static uint32_t | INT_SYS_GetActive (IRQn_Type irqNumber) |
Get Active Interrupt. More... | |
typedef void(* isr_t) (void) |
Interrupt handler type.
Definition at line 71 of file interrupt_manager.h.
void DefaultISR | ( | void | ) |
Default ISR.
|
inlinestatic |
Clear Pending Interrupt.
The function clears the pending bit of a peripheral interrupt or a directed interrupt to this CPU (if available). Implements INT_SYS_ClearPending_Activity
irqNumber | IRQ number |
Definition at line 233 of file interrupt_manager.h.
void INT_SYS_DisableIRQ | ( | IRQn_Type | irqNumber | ) |
Disables an interrupt for a given IRQ number.
This function disables the individual interrupt for a specified IRQ number. It calls the system NVIC API to access the interrupt control register and MSCM (if available) API for interrupt routing.
irqNumber | IRQ number |
Definition at line 163 of file interrupt_manager.c.
void INT_SYS_DisableIRQGlobal | ( | void | ) |
Disable system interrupt.
This function disables the global interrupt by calling the core API.
Definition at line 213 of file interrupt_manager.c.
void INT_SYS_EnableIRQ | ( | IRQn_Type | irqNumber | ) |
Enables an interrupt for a given IRQ number.
This function enables the individual interrupt for a specified IRQ number. It calls the system NVIC API to access the interrupt control register and MSCM (if available) API for interrupt routing. The input IRQ number does not include the core interrupts, only the peripheral interrupts and directed CPU interrupts (if available), from 0 to a maximum supported IRQ.
irqNumber | IRQ number |
Definition at line 136 of file interrupt_manager.c.
void INT_SYS_EnableIRQGlobal | ( | void | ) |
Enables system interrupt.
This function enables the global interrupt by calling the core API.
Definition at line 190 of file interrupt_manager.c.
|
inlinestatic |
Get Active Interrupt.
The function gets the active state of a peripheral interrupt. Implements INT_SYS_GetActive_Activity
irqNumber | IRQ number |
Definition at line 317 of file interrupt_manager.h.
|
inlinestatic |
Get Pending Interrupt.
The function gets the pending bit of a peripheral interrupt or a directed interrupt to this CPU (if available). Implements INT_SYS_GetPending_Activity
irqNumber | IRQ number |
Definition at line 289 of file interrupt_manager.h.
|
inlinestatic |
Get Interrupt Priority.
The function gets the priority of an interrupt.
Note: The priority cannot be obtained for every core interrupt. Implements INT_SYS_GetPriority_Activity
irqNumber | Interrupt number. |
Definition at line 197 of file interrupt_manager.h.
void INT_SYS_InstallHandler | ( | IRQn_Type | irqNumber, |
const isr_t | newHandler, | ||
isr_t *const | oldHandler | ||
) |
Installs an interrupt handler routine for a given IRQ number.
This function lets the application register/replace the interrupt handler for a specified IRQ number. The IRQ number is different than the vector number. IRQ 0 starts from the vector 16 address. See a chip-specific reference manual for details and the startup_<SoC>.s file for each chip family to find out the default interrupt handler for each device. This function converts the IRQ number to the vector number by adding 16 to it.
irqNumber | IRQ number |
newHandler | New interrupt handler routine address pointer |
oldHandler | Pointer to a location to store current interrupt handler |
Definition at line 93 of file interrupt_manager.c.
|
inlinestatic |
Set Pending Interrupt.
The function configures the pending bit of a peripheral interrupt. Implements INT_SYS_SetPending_Activity
irqNumber | IRQ number |
Definition at line 269 of file interrupt_manager.h.
|
inlinestatic |
Set Interrupt Priority.
The function sets the priority of an interrupt.
Note: The priority cannot be set for every core interrupt. Implements INT_SYS_SetPriority_Activity
irqNumber | Interrupt number. |
priority | Priority to set. |
Definition at line 163 of file interrupt_manager.h.