Driver for software interrupts (SWI).
More...
|
#define | NRF_SWI_UNALLOCATED ((nrf_swi_t) 0xFFFFFFFFuL) |
| Unallocated channel value.
|
|
#define | SWI_MAX 6 |
| Maximum numbers of SWIs. This number is fixed for a specific chip.
|
|
#define | SWI_MAX_FLAGS 16 |
| Number of flags per SWI (fixed number).
|
|
#define | SWI_COUNT 4 |
| Number of software interrupts available. This number can be set in the range from 1 to SWI_MAX.
|
|
#define | SWI_DEFAULT_PRIORITY APP_IRQ_PRIORITY_LOW |
| Default SWI priority.
|
|
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.
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. |
Function for freeing a previously allocated SWI.
- Parameters
-
Function for initializing the SWI module.
- Return values
-
NRF_SUCCESS | If the module was successfully initialized. |
MODULE_ALREADY_INITIALIZED | If the module has already been initialized. |
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.
- Return values
-
NRF_SUCCESS | If the module was successfully uninitialized. |
NRF_ERROR_INVALID_STATE | If the module has not been initialized yet. |