Interrupt Manager#
Interrupt management service can be used for general interrupt management.
The source files for Interrupt Manager platform software module are present under platform/services/interrupt_manager.
Overview#
The Interrupt Manager is a service that offers interupt management functions and configurations for setting the interrupt vector in RAM, managing the core reset initiation function and doing general interrupt management operations.
Configuration Options#
Some properties of the Interrupt Manager are compile-time configurable. These properties are set in the sl_interrupt_manager_s2_config.h file. These are the available configuration parameters with default values defined.
// <q SL_INTERRUPT_MANAGER_S2_INTERRUPTS_IN_RAM> Put the interrupt vector table in RAM.
// <i> Set to 1 to put the vector table in RAM.
// <i> Default: 0
#define SL_INTERRUPT_MANAGER_S2_INTERRUPTS_IN_RAM 0
Note
The SL_INTERRUPT_MANAGER_S2_INTERRUPTS_IN_RAM configuration is only available on series 2. Enabling the S2_INTERRUPTS_IN_RAM configuration will tell the Interrupt Manager to copy the interrupt vector table from ROM to RAM and select it as the interrupt table. On newer series this feature is always enabled.
The API#
This section contains brief descriptions of the functions in the API. For more information on input and output parameters and return values, click on the hyperlinked function names.
sl_interrupt_manager_disable_interrupts and sl_interrupt_manager_enable_interrupts() are used to prevent interrupts from executing during a certain timelapse.
sl_interrupt_manager_is_irq_disabled, sl_interrupt_manager_is_irq_blocked are used to know the status of an interrupt, either if it's disabled or blocked by one of the following reasons: priority masking, disabling or an active interrupt of higher priority is executing.
sl_interrupt_manager_is_irq_pending, sl_interrupt_manager_set_irq_pending and sl_interrupt_manager_clear_irq_pending are used for control and query of external interrupt source pending status.
sl_interrupt_manager_get_irq_priority and sl_interrupt_manager_set_irq_priority are used to get or set the priority for a specific interrupt.
Priority Stratification#
With the Interrupt Manager service and more generally in the Simplicity SDK, there are multiple distinct levels of priority stratification.
Each of these has their own characteristics and purposes. For example, the higher priority group is considered to not be able to call kernel, power manager or protocol stacks functions. They will only be impacted by critical sections (general interrupt disable) but will be above atomic base interrupt priority level for execution. The higher level is considered to be between 0 and 2 and the base interrupt priority level is 3.
In the normal priority group you will find most application interrupts and such interrupts will be the ones that will make calls to more features such as kernel, power manager and protocol stacks API. It is this way because they are less deterministic than the "higher priority interrupts".
Priority | Purpose |
---|---|
0 - 2 (Highest) |
|
3 - 7 (Normal) |
|
7 (Lowest) |
|
Typedefs#
sl_interrupt_manager interrupt handler function.
Functions#
Initialize interrupt controller hardware and initialise vector table in RAM.
Reset the cpu core.
Disable interrupts.
Enable interrupts.
Disable interrupt for an interrupt source.
Enable interrupt for an interrupt source.
Check if an interrupt is disabled.
Check if a specific interrupt is blocked.
Get Pending Interrupt.
Set interrupt status to pending.
Clear Pending Interrupt.
Set the interrupt handler of an interrupt source.
Get the interrupt preemption priority of an interrupt source.
Set the interrupt preemption priority of an interrupt source.
Increase the interrupt preemption priority of an interrupt source.
Decrease the interrupt preemption priority of an interrupt source relative to the default priority.
Get the default interrupt preemption priority value.
Get the highest interrupt preemption priority value.
Get the lowest interrupt preemption priority value.
Get the interrupt active status.
Get the current ISR table.
Typedef Documentation#
sl_interrupt_manager_irq_handler_t#
typedef void(* sl_interrupt_manager_irq_handler_t) (void) )(void)
sl_interrupt_manager interrupt handler function.
131
of file platform/service/interrupt_manager/inc/sl_interrupt_manager.h
Function Documentation#
sl_interrupt_manager_init#
void sl_interrupt_manager_init (void )
Initialize interrupt controller hardware and initialise vector table in RAM.
N/A |
Note
The interrupt manager init function will perform the initialization only once even if it's called multiple times.
142
of file platform/service/interrupt_manager/inc/sl_interrupt_manager.h
sl_interrupt_manager_reset_system#
void sl_interrupt_manager_reset_system (void )
Reset the cpu core.
N/A |
148
of file platform/service/interrupt_manager/inc/sl_interrupt_manager.h
sl_interrupt_manager_disable_interrupts#
void sl_interrupt_manager_disable_interrupts (void )
Disable interrupts.
N/A |
154
of file platform/service/interrupt_manager/inc/sl_interrupt_manager.h
sl_interrupt_manager_enable_interrupts#
void sl_interrupt_manager_enable_interrupts (void )
Enable interrupts.
N/A |
160
of file platform/service/interrupt_manager/inc/sl_interrupt_manager.h
sl_interrupt_manager_disable_irq#
void sl_interrupt_manager_disable_irq (int32_t irqn)
Disable interrupt for an interrupt source.
[in] | irqn | The interrupt number of the interrupt source. |
169
of file platform/service/interrupt_manager/inc/sl_interrupt_manager.h
sl_interrupt_manager_enable_irq#
void sl_interrupt_manager_enable_irq (int32_t irqn)
Enable interrupt for an interrupt source.
[in] | irqn | The interrupt number of the interrupt source. |
178
of file platform/service/interrupt_manager/inc/sl_interrupt_manager.h
sl_interrupt_manager_is_irq_disabled#
bool sl_interrupt_manager_is_irq_disabled (int32_t irqn)
Check if an interrupt is disabled.
[in] | irqn | The interrupt number of the interrupt source. |
Returns
True if the interrupt is disabled.
190
of file platform/service/interrupt_manager/inc/sl_interrupt_manager.h
sl_interrupt_manager_is_irq_blocked#
bool sl_interrupt_manager_is_irq_blocked (int32_t irqn)
Check if a specific interrupt is blocked.
[in] | irqn | The interrupt number of the interrupt source. |
Note
The function return true if the IRQ is disabled.
Returns
True if the interrupt is disabled or blocked.
205
of file platform/service/interrupt_manager/inc/sl_interrupt_manager.h
sl_interrupt_manager_is_irq_pending#
bool sl_interrupt_manager_is_irq_pending (int32_t irqn)
Get Pending Interrupt.
[in] | irqn | The interrupt number of the interrupt source. |
Note
Read the pending status of a specified interrupt and returns it status.
Returns
false Interrupt status is not pending. true Interrupt status is pending.
221
of file platform/service/interrupt_manager/inc/sl_interrupt_manager.h
sl_interrupt_manager_set_irq_pending#
void sl_interrupt_manager_set_irq_pending (int32_t irqn)
Set interrupt status to pending.
[in] | irqn | The interrupt number of the interrupt source. |
Note
Sets an interrupt pending status to true.
233
of file platform/service/interrupt_manager/inc/sl_interrupt_manager.h
sl_interrupt_manager_clear_irq_pending#
void sl_interrupt_manager_clear_irq_pending (int32_t irqn)
Clear Pending Interrupt.
[in] | irqn | The interrupt number of the interrupt source. |
Clear an interrupt pending status
Note
irqn must not be negative.
248
of file platform/service/interrupt_manager/inc/sl_interrupt_manager.h
sl_interrupt_manager_set_irq_handler#
sl_status_t sl_interrupt_manager_set_irq_handler (int32_t irqn, sl_interrupt_manager_irq_handler_t handler)
Set the interrupt handler of an interrupt source.
[in] | irqn | The interrupt number of the interrupt source. |
[in] | handler | The new interrupt handler for the interrupt source. |
Note
This function depends on a RAM based interrupt vector table, i.e. SL_INTERRUPT_MANAGER_S2_INTERRUPTS_IN_RAM must be true. Or the device must be Series 3.
Returns
The prior interrupt handler for the interrupt source.
268
of file platform/service/interrupt_manager/inc/sl_interrupt_manager.h
sl_interrupt_manager_get_irq_priority#
uint32_t sl_interrupt_manager_get_irq_priority (int32_t irqn)
Get the interrupt preemption priority of an interrupt source.
[in] | irqn | The interrupt number of the interrupt source. |
Note
The number of priority levels is platform dependent.
Returns
The interrupt priority for the interrupt source. Value 0 denotes the highest priority.
285
of file platform/service/interrupt_manager/inc/sl_interrupt_manager.h
sl_interrupt_manager_set_irq_priority#
void sl_interrupt_manager_set_irq_priority (int32_t irqn, uint32_t priority)
Set the interrupt preemption priority of an interrupt source.
[in] | irqn | The interrupt number of the interrupt source. |
[in] | priority | The new interrupt priority for the interrupt source. Value 0 denotes the highest priority. |
Note
The number of priority levels is platform dependent.
301
of file platform/service/interrupt_manager/inc/sl_interrupt_manager.h
sl_interrupt_manager_increase_irq_priority_from_default#
void sl_interrupt_manager_increase_irq_priority_from_default (int32_t irqn, uint32_t diff)
Increase the interrupt preemption priority of an interrupt source.
[in] | irqn | The irq to change the priority. |
[in] | diff | The relative difference. |
relative to the default priority.
This function is useful to be architecture agnostic with priority values.
Usage: new_prio = sl_interrupt_manager_increase_irq_priority_from_default(IRQn, 1);
This will increase the priority of IRQn by 1.
322
of file platform/service/interrupt_manager/inc/sl_interrupt_manager.h
sl_interrupt_manager_decrease_irq_priority_from_default#
void sl_interrupt_manager_decrease_irq_priority_from_default (int32_t irqn, uint32_t diff)
Decrease the interrupt preemption priority of an interrupt source relative to the default priority.
[in] | irqn | The irq to change the priority. |
[in] | diff | The relative difference. |
This function is useful to be architecture agnostic with priority values.
Usage: new_prio = sl_interrupt_manager_decrease_irq_priority_from_default(IRQn, 1);
This will decrease the priority of IRQn by 1.
343
of file platform/service/interrupt_manager/inc/sl_interrupt_manager.h
sl_interrupt_manager_get_default_priority#
uint32_t sl_interrupt_manager_get_default_priority (void )
Get the default interrupt preemption priority value.
N/A |
Returns
The default priority.
352
of file platform/service/interrupt_manager/inc/sl_interrupt_manager.h
sl_interrupt_manager_get_highest_priority#
uint32_t sl_interrupt_manager_get_highest_priority (void )
Get the highest interrupt preemption priority value.
N/A |
Returns
The highest priority value.
361
of file platform/service/interrupt_manager/inc/sl_interrupt_manager.h
sl_interrupt_manager_get_lowest_priority#
uint32_t sl_interrupt_manager_get_lowest_priority (void )
Get the lowest interrupt preemption priority value.
N/A |
Returns
The lowest priority value.
370
of file platform/service/interrupt_manager/inc/sl_interrupt_manager.h
sl_interrupt_manager_get_active_irq#
uint32_t sl_interrupt_manager_get_active_irq (int32_t irqn)
Get the interrupt active status.
[in] | irqn | The interrupt number of the interrupt source. |
Returns
The interrupt active status.
382
of file platform/service/interrupt_manager/inc/sl_interrupt_manager.h
sl_interrupt_manager_get_isr_table#
sl_interrupt_manager_irq_handler_t * sl_interrupt_manager_get_isr_table (void )
Get the current ISR table.
N/A |
Depending on the configuration of the Interrupt Manager, this table of ISRs may be in RAM or in FLASH, and each ISR may or may not be wrapped by enter/exit hooks.
Returns
The current ISR table.
396
of file platform/service/interrupt_manager/inc/sl_interrupt_manager.h