Event
- group Event
Event management.
This part details OS events management.
Functions
-
static inline pi_evt_t *pi_evt_sig_init(pi_evt_t *evt)
Prepare a notification event.
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_evt_wait) until a certain action occurs, e.g. an end of transfer.
Note
This structure is allocated by the caller and must be kept alive until the pi_evt_wait returns.
Note
If the same notification is re-used several times, it must be reinitialized everytime by calling this function or another variant.
- Parameters:
event – Pointer to notification event.
- Returns:
event The notification event initialized.
-
static inline pi_evt_t *pi_evt_sig_init_no_mutex(pi_evt_t *evt)
-
static inline pi_evt_t *pi_evt_callback_no_irq_init(pi_evt_t *evt, os_evt_cb_fct_t fct, void *arg)
Prepare a notification callback.
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.
Note
This structure is allocated by the caller and must be kept alive until the callback is executed.
Note
If the same notification is re-used several times, it must be reinitialized everytime by calling this function or another variant.
Note
A notification callback can not be used to block the caller execution with pi_evt_wait.
- Parameters:
event – Pointer to notification event.
function – Callback function to execute when the notification is triggered.
arg – Callback function argument.
- Returns:
event The notification event initialized.
-
static inline pi_evt_t *pi_evt_callback_irq_init(pi_evt_t *evt, os_evt_cb_fct_t fct, void *arg)
Prepare an IRQ notification callback.
This initializes an IRQ notification callback so that it is ready to be triggered. An IRQ notification callback can be used to trigger a function execution when a certain action occurs, e.g. an end of transfer. Compared to a normal callback, an IRQ callback will be called directly from the interrupt handler and will not go through the scheduler.
Note
This structure is allocated by the caller and must be kept alive until the callback is executed.
Note
If the same notification is re-used several times, it must be reinitialized everytime by calling this function or another variant.
Note
A notification callback can not be used to block the caller execution with pi_evt_wait.
Warning
When the event arrives, the callback is executed inside IRQ so it must be quick. Otherwise it will block the system.
- Parameters:
event – Pointer to notification event.
function – Callback function to execute when the notification is triggered.
arg – Callback function argument.
- Returns:
event The notification event initialized.
-
static inline void pi_evt_wait(pi_evt_t *evt)
Wait until a notification event is triggered.
This can be called to block the caller until the specified notification event (created with pi_evt_sig_init) has been triggered.
Note
The notification event is released just before returning from this call and must be reinitialized before it can be re-used.
- Parameters:
event – Pointer to notification event.
-
static inline void pi_evt_push(pi_evt_t *evt)
Trigger a notification.
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:
event – Pointer to notification event.
-
static inline void pi_evt_push_from_irq(pi_evt_t *evt)
Trigger a notification.
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:
event – Pointer to notification event.
-
static inline void pi_evt_push_delayed_us(pi_evt_t *evt, uint32_t delay)
Trigger a notification.
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:
event – Pointer to notification event.
delay – The number of micro-seconds after which the notification must be triggered.
-
static inline void pi_evt_cancel_delayed_us(pi_evt_t *evt)
Cancel a scheduled notification.
This can be cancel a scheduled notification. If the notification has already been canceled, this has no effect.
- Parameters:
event – Pointer to notification event.
-
static inline void pi_evt_timeout_set(pi_evt_t *evt, uint32_t timeout_us)
Init timeout feature for transfers.
Initialize timeout value of the event before starting transfers.
Note
This event will hold transfer result.
- Parameters:
event – Pointer to event.
timeout_us – Timeout value in us.
-
static inline int32_t pi_evt_status_get(pi_evt_t *evt)
Get event status.
This function can be used to check if an event completed successfully.
- Returns:
ERRNO Value corresponding to event status.
-
static inline pi_evt_t *pi_evt_sig_init(pi_evt_t *evt)