Multiprotocol Service Layer library control

Methods in the Multiprotocol Service Layer (MPSL) library control library allow controlling the initialization and uninitialization of the Multiprotocol Service Layer library and all required interrupt handlers. When MPSL is uninitialized, the application has full control over the RADIO_IRQn, RTC0_IRQn, and TIMER0_IRQn interrupts.

The CONFIG_MPSL_DYNAMIC_INTERRUPTS Kconfig option enables dynamic interrupts for MPSL, and allows interrupts to be reconfigured.

API documentation

Header file: include/mpsl/mpsl_lib.h
group mpsl_lib

Methods for initializing MPSL and required interrupt handlers.

Functions

int32_t mpsl_lib_init(void)

Initialize MPSL and attach interrupt handlers.

This routine initializes MPSL (via mpsl_init) after it has been uninitialized via mpsl_lib_uninit, and attaches all required interrupt handlers.

Note

After successful execution of this method, any existing interrupt handlers will be detached from RADIO_IRQn, RTC0_IRQn, and TIMER0_IRQn.

Return values
  • 0 – MPSL enabled successfully.

  • -NRF_EPERM – Operation is not supported or MPSL is already initialized.

  • -NRF_EINVAL – Invalid parameters supplied to MPSL.

Pre

This method requires CONFIG_MPSL_DYNAMIC_INTERRUPTS to be enabled and MPSL to have been previously uninitialized via mpsl_lib_uninit.

int32_t mpsl_lib_uninit(void)

Uninitialize MPSL and disable interrupt handlers.

This routine uninitializes MPSL (via mpsl_uninit) and disables MPSL interrupts. Uninitializing MPSL stops clocks and scheduler. This will release all peripherals and reduce power usage, allowing the user to override any interrupt handlers used by MPSL.

Note

After successful execution of this method, user-supplied interrupt handlers can be attached to RADIO_IRQn, RTC0_IRQn, and TIMER0_IRQn using irq_connect_dynamic. Care must be taken when developing these handlers, as they will be executed as direct dynamic interrupts. See ARM_IRQ_DIRECT_DYNAMIC_CONNECT for additional documentation. These interrupts will trigger thread re-scheduling upon return.

Return values
  • 0 – MPSL disabled successfully.

  • -NRF_EPERM – Operation is not supported.

Pre

This method requires CONFIG_MPSL_DYNAMIC_INTERRUPTS to be enabled.