SWI driver

nRF5 SDK v15.0.0

Driver for managing software interrupts (SWI). More...

Macros

#define NRFX_SWI_UNALLOCATED (( nrfx_swi_t )0xFFuL)
Unallocated instance value.
#define NRFX_SWI_DEFAULT_PRIORITY APP_IRQ_PRIORITY_LOWEST
Default SWI priority.

Typedefs

typedef uint8_t nrfx_swi_t
SWI instance.
typedef uint16_t nrfx_swi_flags_t
SWI user flags. More...
typedef void(* nrfx_swi_handler_t )( nrfx_swi_t swi, nrfx_swi_flags_t flags)
SWI handler function. More...

Functions

nrfx_err_t nrfx_swi_alloc ( nrfx_swi_t *p_swi, nrfx_swi_handler_t event_handler, uint32_t irq_priority)
Function for allocating the first unused SWI instance and setting a handler. More...
void nrfx_swi_free ( nrfx_swi_t *p_swi)
Function for freeing a previously allocated SWI. More...
void nrfx_swi_all_free (void)
Function for freeing all allocated SWIs.
void nrfx_swi_trigger ( nrfx_swi_t swi, uint8_t flag_number)
Function for triggering the SWI. More...
bool nrfx_swi_is_allocated ( nrfx_swi_t swi)
Function for checking if the specified SWI is currently allocated. More...
__STATIC_INLINE NRF_EGU_Type * nrfx_swi_egu_instance_get ( nrfx_swi_t swi)
Function for returning the base address of the EGU peripheral associated with the specified SWI instance. More...
__STATIC_INLINE uint32_t nrfx_swi_task_trigger_address_get ( nrfx_swi_t swi, uint8_t channel)
Function for returning the EGU trigger task address. More...
__STATIC_INLINE uint32_t nrfx_swi_event_triggered_address_get ( nrfx_swi_t swi, uint8_t channel)
Function for returning the EGU triggered event address. More...
void nrfx_swi_0_irq_handler (void)
void nrfx_swi_1_irq_handler (void)
void nrfx_swi_2_irq_handler (void)
void nrfx_swi_3_irq_handler (void)
void nrfx_swi_4_irq_handler (void)
void nrfx_swi_5_irq_handler (void)

Detailed Description

Driver for managing software interrupts (SWI).

Typedef Documentation

typedef uint16_t nrfx_swi_flags_t

SWI user flags.

User flags are set during the SWI trigger and passed to the callback function as an argument.

typedef void(* nrfx_swi_handler_t)( nrfx_swi_t swi, nrfx_swi_flags_t flags)

SWI handler function.

Parameters
swi SWI instance.
flags User flags.

Function Documentation

nrfx_err_t nrfx_swi_alloc ( nrfx_swi_t * p_swi ,
nrfx_swi_handler_t event_handler ,
uint32_t irq_priority
)

Function for allocating the first unused SWI instance and setting a handler.

Parameters
[out] p_swi Points to a place where the allocated SWI instance number is to be stored.
[in] event_handler Event handler function. If NULL, no interrupt will be enabled. It can be NULL only if the EGU driver is enabled. For classic SWI, it must be a valid handler pointer.
[in] irq_priority Interrupt priority.
Return values
NRFX_SUCCESS If the SWI was successfully allocated.
NRFX_ERROR_NO_MEM If there is no available SWI to be used.
__STATIC_INLINE NRF_EGU_Type* nrfx_swi_egu_instance_get ( nrfx_swi_t swi )

Function for returning the base address of the EGU peripheral associated with the specified SWI instance.

Parameters
[in] swi SWI instance.
Returns
EGU base address or NULL if the specified SWI instance number is too high.
__STATIC_INLINE uint32_t nrfx_swi_event_triggered_address_get ( nrfx_swi_t swi ,
uint8_t channel
)

Function for returning the EGU triggered event address.

Parameters
[in] swi SWI instance.
[in] channel Number of the EGU channel.
Returns
Address of EGU triggered event.
void nrfx_swi_free ( nrfx_swi_t * p_swi )

Function for freeing a previously allocated SWI.

Parameters
[in,out] p_swi SWI instance to free. The value is changed to NRFX_SWI_UNALLOCATED on success.
bool nrfx_swi_is_allocated ( nrfx_swi_t swi )

Function for checking if the specified SWI is currently allocated.

Parameters
[in] swi SWI instance.
Return values
true If the SWI instance is allocated.
false Otherwise.
__STATIC_INLINE uint32_t nrfx_swi_task_trigger_address_get ( nrfx_swi_t swi ,
uint8_t channel
)

Function for returning the EGU trigger task address.

Parameters
[in] swi SWI instance.
[in] channel Number of the EGU channel.
Returns
Address of EGU trigger task.
void nrfx_swi_trigger ( nrfx_swi_t swi ,
uint8_t flag_number
)

Function for triggering the SWI.

Parameters
[in] swi SWI to trigger.
[in] flag_number Number of user flag to trigger.