PMSIS API
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Event_Task management

Event_Task management. More...

Functions

static pi_task_t * pi_task_block (pi_task_t *task)
 Prepare a notification event. More...
 
static pi_task_t * pi_task_callback (pi_task_t *task, pi_callback_func_t function, void *arg)
 Prepare a notification callback. More...
 
static void pi_task_wait_on (pi_task_t *task)
 Wait until a notification event is triggered. More...
 
static void pi_task_push (pi_task_t *task)
 Trigger a notification. More...
 
void pi_task_push_delayed_us (pi_task_t *task, uint32_t delay)
 Trigger a notification. More...
 
static pi_callback_t * pi_callback_init (pi_callback_t *callback, pi_callback_func_t function, void *arg)
 Init callback. More...
 
static void pi_task_timeout_set (pi_task_t *task, uint32_t timeout_us)
 Init timeout feature for transfers. More...
 
static int32_t pi_task_transfer_end_result_get (pi_task_t *task)
 Query result end of transfer. More...
 

Description

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.

Function Documentation

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
callbackPointer to callback to initialize.
functionCallback function.
argCallback 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
taskPointer 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
taskPointer to notification event.
functionCallback function to execute when the notification is triggered.
argCallback 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
taskPointer 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
taskPointer to notification event.
delayThe 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
taskPointer to event task.
timeout_usTimeout 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
taskPointer 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.