Driver for managing software interrupts (SWI). More...
Modules | |
SWI/EGU peripheral allocator configuration | |
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_int_disable (nrfx_swi_t swi) |
Function for disabling an allocated SWI interrupt. More... | |
void | nrfx_swi_int_enable (nrfx_swi_t swi) |
Function for enabling an allocated SWI interrupt. 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) |
Driver for managing software interrupts (SWI).
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.
swi | SWI instance. |
flags | User flags. |
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.
If provided handler is not NULL, an allocated SWI has its interrupt enabled by default. The interrupt can be disabled by nrfx_swi_int_disable.
[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. |
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.
[in] | swi | SWI instance. |
__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.
[in] | swi | SWI instance. |
[in] | channel | Number of the EGU channel. |
void nrfx_swi_free | ( | nrfx_swi_t * | p_swi | ) |
Function for freeing a previously allocated SWI.
[in,out] | p_swi | SWI instance to free. The value is changed to NRFX_SWI_UNALLOCATED on success. |
void nrfx_swi_int_disable | ( | nrfx_swi_t | swi | ) |
Function for disabling an allocated SWI interrupt.
Use nrfx_swi_int_enable to re-enable the interrupt.
[in] | swi | SWI instance. |
void nrfx_swi_int_enable | ( | nrfx_swi_t | swi | ) |
Function for enabling an allocated SWI interrupt.
[in] | swi | SWI instance. |
bool nrfx_swi_is_allocated | ( | nrfx_swi_t | swi | ) |
Function for checking if the specified SWI is currently allocated.
[in] | swi | SWI instance. |
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.
[in] | swi | SWI instance. |
[in] | channel | Number of the EGU channel. |
void nrfx_swi_trigger | ( | nrfx_swi_t | swi, |
uint8_t | flag_number | ||
) |
Function for triggering the SWI.
[in] | swi | SWI to trigger. |
[in] | flag_number | Number of user flag to trigger. |