S32 SDK
Interrupt Manager (Interrupt)

Detailed Description

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.

Overview

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.

Interrupt Names

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 Documentation

typedef void(* isr_t) (void)

Interrupt handler type.

Definition at line 71 of file interrupt_manager.h.

Function Documentation

void DefaultISR ( void  )

Default ISR.

static void INT_SYS_ClearPending ( IRQn_Type  irqNumber)
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

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

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

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

static uint32_t INT_SYS_GetActive ( IRQn_Type  irqNumber)
inlinestatic

Get Active Interrupt.

The function gets the active state of a peripheral interrupt. Implements INT_SYS_GetActive_Activity

Parameters
irqNumberIRQ number
Returns
active Active status 0/1

Definition at line 317 of file interrupt_manager.h.

static uint32_t INT_SYS_GetPending ( IRQn_Type  irqNumber)
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

Parameters
irqNumberIRQ number
Returns
pending Pending status 0/1

Definition at line 289 of file interrupt_manager.h.

static uint8_t INT_SYS_GetPriority ( IRQn_Type  irqNumber)
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

Parameters
irqNumberInterrupt number.
Returns
priority Priority of the interrupt.

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.

Note
This method is applicable only if interrupt vector is copied in RAM, flash_vector_table symbol is used to control this from linker options.
Parameters
irqNumberIRQ number
newHandlerNew interrupt handler routine address pointer
oldHandlerPointer to a location to store current interrupt handler

Definition at line 93 of file interrupt_manager.c.

static void INT_SYS_SetPending ( IRQn_Type  irqNumber)
inlinestatic

Set Pending Interrupt.

The function configures the pending bit of a peripheral interrupt. Implements INT_SYS_SetPending_Activity

Parameters
irqNumberIRQ number

Definition at line 269 of file interrupt_manager.h.

static void INT_SYS_SetPriority ( IRQn_Type  irqNumber,
uint8_t  priority 
)
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

Parameters
irqNumberInterrupt number.
priorityPriority to set.

Definition at line 163 of file interrupt_manager.h.