Peripheral Resource Sharing (PRS)

group nrfx_prs

Peripheral Resource Sharing interface (PRS).


nrfx_err_t nrfx_prs_acquire(void const *p_base_addr, nrfx_irq_handler_t irq_handler)

Function for acquiring shared peripheral resources associated with the specified peripheral.

Certain resources and registers are shared among peripherals that have the same ID (for example: SPI0, SPIM0, SPIS0, TWI0, TWIM0, and TWIS0 in nRF52832). Only one of them can be utilized at a given time. This function reserves proper resources to be used by the specified peripheral. If NRFX_PRS_ENABLED is set to a non-zero value, IRQ handlers for peripherals that are sharing resources with others are implemented by the Peripheral Resource Sharing (PRS) module instead of individual drivers. The drivers must then specify their interrupt handling routines and register them by using this function.

  • p_base_addr[in] Requested peripheral base pointer.

  • irq_handler[in] Interrupt handler to register.

Return values:
  • NRFX_SUCCESS – If resources were acquired successfully or the specified peripheral is not handled by the PRS subsystem and there is no need to acquire resources for it.

  • NRFX_ERROR_BUSY – If resources were already acquired.

void nrfx_prs_release(void const *p_base_addr)

Function for releasing shared resources reserved previously by nrfx_prs_acquire() for the specified peripheral.

  • p_base_addr[in] Released peripheral base pointer.