Driver for software interrupts (SWI).
More...
Driver for software interrupts (SWI).
The SWI driver allows the user to allocate SWIs and pass extra flags to interrupt handler functions.
SWI user flags (unsigned integer).
User flags are set during the SWI trigger and passed to the callback function as an argument.
SWI handler function.
Takes two arguments: SWI number (nrf_swi_t) and flags (nrf_swi_flags_t).
Function for allocating a first unused SWI instance and setting a handler.
The event handler function returns void and takes one uint32_t argument (SWI number).
- Parameters
-
[out] | p_swi | Pointer to the SWI that has been allocated. |
[in] | event_handler | Event handler function (must not be NULL). |
[in] | priority | Interrupt priority. |
- Return values
-
NRF_SUCCESS | If the SWI was successfully allocated. |
NRF_ERROR_NO_MEM | If there is no available SWI to be used. |
uint32_t nrf_drv_swi_event_triggered_address_get |
( |
nrf_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
- EGU triggered event address.
Function for freeing a previously allocated SWI.
- Parameters
-
[in,out] | p_swi | SWI to free. The value is changed to NRF_SWI_UNALLOCATED on success. |
Function for initializing the SWI module.
- Return values
-
NRF_SUCCESS | If the module was successfully initialized. |
NRF_ERROR_MODULE_ALREADY_INITIALIZED | If the module has already been initialized. |
uint32_t nrf_drv_swi_task_trigger_address_get |
( |
nrf_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
- EGU trigger task address.
void nrf_drv_swi_trigger |
( |
nrf_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. |
void nrf_drv_swi_uninit |
( |
void |
| ) |
|
Function for uninitializing the SWI module.
This function also disables all SWIs.