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.

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.


Function Documentation#

sl_interrupt_manager_init#

void sl_interrupt_manager_init (void )

Initialize interrupt controller hardware and initialise vector table in RAM.

Parameters
TypeDirectionArgument NameDescription
voidN/A

Note

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


sl_interrupt_manager_reset_system#

void sl_interrupt_manager_reset_system (void )

Reset the cpu core.

Parameters
TypeDirectionArgument NameDescription
voidN/A

sl_interrupt_manager_disable_interrupts#

void sl_interrupt_manager_disable_interrupts (void )

Disable interrupts.

Parameters
TypeDirectionArgument NameDescription
voidN/A

sl_interrupt_manager_enable_interrupts#

void sl_interrupt_manager_enable_interrupts (void )

Enable interrupts.

Parameters
TypeDirectionArgument NameDescription
voidN/A

sl_interrupt_manager_disable_irq#

void sl_interrupt_manager_disable_irq (int32_t irqn)

Disable interrupt for an interrupt source.

Parameters
TypeDirectionArgument NameDescription
int32_t[in]irqn

The interrupt number of the interrupt source.


sl_interrupt_manager_enable_irq#

void sl_interrupt_manager_enable_irq (int32_t irqn)

Enable interrupt for an interrupt source.

Parameters
TypeDirectionArgument NameDescription
int32_t[in]irqn

The interrupt number of the interrupt source.


sl_interrupt_manager_is_irq_disabled#

bool sl_interrupt_manager_is_irq_disabled (int32_t irqn)

Check if an interrupt is disabled.

Parameters
TypeDirectionArgument NameDescription
int32_t[in]irqn

The interrupt number of the interrupt source.

Returns

  • True if the interrupt is disabled.


sl_interrupt_manager_is_irq_blocked#

bool sl_interrupt_manager_is_irq_blocked (int32_t irqn)

Check if a specific interrupt is blocked.

Parameters
TypeDirectionArgument NameDescription
int32_t[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.


sl_interrupt_manager_is_irq_pending#

bool sl_interrupt_manager_is_irq_pending (int32_t irqn)

Get Pending Interrupt.

Parameters
TypeDirectionArgument NameDescription
int32_t[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.


sl_interrupt_manager_set_irq_pending#

void sl_interrupt_manager_set_irq_pending (int32_t irqn)

Set interrupt status to pending.

Parameters
TypeDirectionArgument NameDescription
int32_t[in]irqn

The interrupt number of the interrupt source.

Note

  • Sets an interrupt pending status to true.


sl_interrupt_manager_clear_irq_pending#

void sl_interrupt_manager_clear_irq_pending (int32_t irqn)

Clear Pending Interrupt.

Parameters
TypeDirectionArgument NameDescription
int32_t[in]irqn

The interrupt number of the interrupt source.

Clear an interrupt pending status

Note

  • irqn must not be negative.


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
TypeDirectionArgument NameDescription
int32_t[in]irqn

The interrupt number of the interrupt source.

sl_interrupt_manager_irq_handler_t[in]handler

The new interrupt handler for the interrupt source.

Note

  • This function depends on a RAM based interrupt vector table, i.e. interrupt_manager_vector_table_in_ram component must be added. Or the device must be Series 3.

Returns

  • The prior interrupt handler for the interrupt source.


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
TypeDirectionArgument NameDescription
int32_t[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.


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
TypeDirectionArgument NameDescription
int32_t[in]irqn

The interrupt number of the interrupt source.

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


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
TypeDirectionArgument NameDescription
int32_t[in]irqn

The irq to change the priority.

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


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
TypeDirectionArgument NameDescription
int32_t[in]irqn

The irq to change the priority.

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


sl_interrupt_manager_get_default_priority#

uint32_t sl_interrupt_manager_get_default_priority (void )

Get the default interrupt preemption priority value.

Parameters
TypeDirectionArgument NameDescription
voidN/A

Returns

  • The default priority.


sl_interrupt_manager_get_highest_priority#

uint32_t sl_interrupt_manager_get_highest_priority (void )

Get the highest interrupt preemption priority value.

Parameters
TypeDirectionArgument NameDescription
voidN/A

Returns

  • The highest priority value.


sl_interrupt_manager_get_lowest_priority#

uint32_t sl_interrupt_manager_get_lowest_priority (void )

Get the lowest interrupt preemption priority value.

Parameters
TypeDirectionArgument NameDescription
voidN/A

Returns

  • The lowest priority value.


sl_interrupt_manager_get_active_irq#

uint32_t sl_interrupt_manager_get_active_irq (int32_t irqn)

Get the interrupt active status.

Parameters
TypeDirectionArgument NameDescription
int32_t[in]irqn

The interrupt number of the interrupt source.

Returns

  • The interrupt active status.


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
TypeDirectionArgument NameDescription
voidN/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.