Event_Task management.
More...
The asynchronous interactions between the fabric controller, the cluster and the peripherals are managed with events on the fabric controller side.
A task is either a function callback which can be pushed for a deferred execution when it is triggered, or notification event, which can used to block the caller execution until it is triggered.
static pi_callback_t* pi_callback_init |
( |
pi_callback_t * |
callback, |
|
|
pi_callback_func_t |
function, |
|
|
void * |
arg |
|
) |
| |
|
inlinestatic |
Intialize a simple callback with the function to call and its arg.
- Parameters
-
callback | Pointer to callback to initialize. |
function | Callback function. |
arg | Callback function arg. |
static pi_task_t* pi_task_block |
( |
pi_task_t * |
task | ) |
|
|
inlinestatic |
This initializes a notification event so that it is ready to be triggered. A notification event can be used to block the execution of the caller (using pi_task_wait_on) until a certain action occurs, e.g. an end of transfer.
- Parameters
-
task | Pointer to notification event. |
- Returns
- task The notification event initialized.
- Note
- This structure is allocated by the caller and must be kept alive until the pi_task_wait_on returns.
-
If the same notification is re-used several times, it must be reinitialized everytime by calling this function or another variant.
static pi_task_t* pi_task_callback |
( |
pi_task_t * |
task, |
|
|
pi_callback_func_t |
function, |
|
|
void * |
arg |
|
) |
| |
|
inlinestatic |
This initializes a notification callback so that it is ready to be triggered. A notification callback can be used to trigger a function execution when a certain action occurs, e.g. an end of transfer.
- Parameters
-
task | Pointer to notification event. |
function | Callback function to execute when the notification is triggered. |
arg | Callback function argument. |
- Returns
- task The notification event initialized.
- Note
- This structure is allocated by the caller and must be kept alive until the pi_task_wait_on returns.
-
If the same notification is re-used several times, it must be reinitialized everytime by calling this function or another variant.
-
A notification callback can not be used to block the caller execution with pi_task_wait_on.
static void pi_task_push |
( |
pi_task_t * |
task | ) |
|
|
inlinestatic |
This can be used to trigger the specified notification. If the notification is a callback, this will schedule the callback execution. If the notification is an event, this will trigger the event.
- Parameters
-
task | Pointer to notification event. |
void pi_task_push_delayed_us |
( |
pi_task_t * |
task, |
|
|
uint32_t |
delay |
|
) |
| |
This can be used to trigger the specified notification after the specified delay, given in micro-seconds. If the notification is a callback, this will schedule the callback execution. If the notification is an event, this will trigger the event.
- Parameters
-
task | Pointer to notification event. |
delay | The number of micro-seconds after which the notification must be triggered. |
static void pi_task_timeout_set |
( |
pi_task_t * |
task, |
|
|
uint32_t |
timeout_us |
|
) |
| |
|
inlinestatic |
Initialize timeout value of the event task before starting transfers.
- Parameters
-
task | Pointer to event task. |
timeout_us | Timeout value in us. |
- Note
- This event task will hold transfer result.
static int32_t pi_task_transfer_end_result_get |
( |
pi_task_t * |
task | ) |
|
|
inlinestatic |
This function can be used to check the end result of a transfer.
- Returns
- ERRNO Value corresponding to end of transfer.
static void pi_task_wait_on |
( |
pi_task_t * |
task | ) |
|
|
inlinestatic |
This can be called to block the caller until the specified notification event (created with pi_task_block) has been triggered.
- Parameters
-
task | Pointer to notification event. |
- Note
- The notification event is released just before returning from this call and must be reinitialized before it can be re-used.