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 stratification inside SDK

Priority

Purpose

0 - 2 (Highest)

  • No Kernel calls

  • No Power Manager calls

  • Not maskable by atomic sections

3 - 7 (Normal)

  • kernel calls

  • power manager

  • protocol stacks API

7 (Lowest)

  • PendSV level of priority

Typedefs#

typedef void(*

sl_interrupt_manager interrupt handler function.

Functions#

void

Initialize interrupt controller hardware and initialise vector table in RAM.

void

Reset the cpu core.

void

Disable interrupts.

void
void

Disable interrupt for an interrupt source.

void

Enable interrupt for an interrupt source.

bool

Check if an interrupt is disabled.

bool

Check if a specific interrupt is blocked.

bool

Get Pending Interrupt.

void

Set interrupt status to pending.

void

Clear Pending Interrupt.

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.

uint32_t

Get the interrupt preemption priority of an interrupt source.

void
sl_interrupt_manager_set_irq_priority(int32_t irqn, uint32_t priority)

Set the interrupt preemption priority of an interrupt source.

void

Increase the interrupt preemption priority of an interrupt source.

void

Decrease the interrupt preemption priority of an interrupt source relative to the default priority.

uint32_t

Get the default interrupt preemption priority value.

uint32_t

Get the highest interrupt preemption priority value.

uint32_t

Get the lowest interrupt preemption priority value.

uint32_t

Get the interrupt active status.

Typedef Documentation#

sl_interrupt_manager_irq_handler_t#

typedef void(* sl_interrupt_manager_irq_handler_t) (void) )(void)

sl_interrupt_manager interrupt handler function.


Definition at line 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.

Parameters
N/A

Note

  • The interrupt manager init function will perform the initialization only once even if it's called multiple times.


Definition at line 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.

Parameters
N/A

Definition at line 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.

Parameters
N/A

Definition at line 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.

Parameters
N/A

Definition at line 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.

Parameters
[in]irqn

The interrupt number of the interrupt source.


Definition at line 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.

Parameters
[in]irqn

The interrupt number of the interrupt source.


Definition at line 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.

Parameters
[in]irqn

The interrupt number of the interrupt source.

Returns

  • True if the interrupt is disabled.


Definition at line 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.

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


Definition at line 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.

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


Definition at line 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.

Parameters
[in]irqn

The interrupt number of the interrupt source.

Note

  • Sets an interrupt pending status to true.


Definition at line 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.

Parameters
[in]irqn

The interrupt number of the interrupt source.

Clear an interrupt pending status

Note

  • irqn must not be negative.


Definition at line 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.

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


Definition at line 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.

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


Definition at line 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.

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


Definition at line 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.

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


Definition at line 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.

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


Definition at line 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.

Parameters
N/A

Returns

  • The default priority.


Definition at line 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.

Parameters
N/A

Returns

  • The highest priority value.


Definition at line 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.

Parameters
N/A

Returns

  • The lowest priority value.


Definition at line 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.

Parameters
[in]irqn

The interrupt number of the interrupt source.

Returns

  • The interrupt active status.


Definition at line 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.

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


Definition at line 396 of file platform/service/interrupt_manager/inc/sl_interrupt_manager.h