VSF Documented
vsf_eda.h File Reference

Go to the source code of this file.

Data Structures

struct  vsf_cpu_usage_ctx_t
 Context for per-task CPU usage sampling; the user provides the ctx storage and must keep it valid until vsf_eda_cpu_usage_stop() is called. More...
 
struct  vsf_cpu_usage_t
 Per-task CPU usage sampling data; points to the user-provided sampling context vsf_cpu_usage_ctx_t. More...
 
union  vsf_eda_feature_t
 Task feature flags passed in vsf_eda_cfg_t. More...
 
union  __vsf_eda_state_t
 
union  __vsf_eda_flag_t
 
union  __vsf_eda_fn_t
 
struct  __vsf_eda_frame_state_t
 
class  __vsf_eda_frame_t
 
struct  vsf_eda_cfg_t
 Configuration for starting an eda/teda task (vsf_eda_start(), vsf_teda_start(), init_vsf_peda(), etc.) More...
 
class  vsf_eda_t
 The event-driven task (TCB); every VSF task is an eda at the bottom. Tasks share stacks and only occupy a stack while handling events; driven by events from its event queue. More...
 
class  vsf_teda_t
 eda with timer support (can use vsf_teda_set_timer() etc.); derived classes (task/pt/thread) inherit from it when VSF_KERNEL_CFG_EDA_SUPPORT_TIMER is ENABLED More...
 
class  vsf_callback_timer_t
 Task-independent timer; when it expires the kernel task invokes the user callback. More...
 
class  vsf_sync_t
 Base sync IPC object; sem/mutex/trig/crit are built on it. More...
 
class  vsf_sync_owner_t
 Sync object with an owner (mutex base); supports priority inheritance; the owner must leave it itself. More...
 
struct  vsf_bmpevt_adapter_op_t
 Adapter init/reset operations, mapping an IPC object (e.g. a semaphore) onto bitmap-event bits so one task can wait on multiple IPC objects at once. More...
 
class  vsf_bmpevt_adapter_t
 Adapter mapping an IPC object (e.g. a semaphore) onto bitmap-event bits, so one task can wait on multiple IPC objects at once. More...
 
class  vsf_bmpevt_adapter_eda_t
 bmpevt adapter with an internal eda More...
 
class  vsf_bmpevt_pender_t
 Wait condition of a bitmap-event wait. More...
 
class  vsf_bmpevt_t
 Bitmap-event group. More...
 
struct  vsf_eda_queue_op_t
 User-provided queue backend operations for vsf_eda_queue_t; enqueue/dequeue return bool success, dequeue outputs the node pointer. More...
 
class  vsf_eda_queue_t
 OS-aware queue; send pends while full, recv pends while empty; backend ops are supplied by the user (e.g. the slist queue vsf_eda_slist_queue_t) More...
 
struct  vsf_bmpevt_adapter_sync_t
 Adapter mapping a vsf_sync_t onto bitmap-event bits. More...
 
struct  vsf_bmpevt_adapter_bmpevt_t
 Adapter mapping a nested vsf_bmpevt_t onto bitmap-event bits. More...
 
struct  vsf_kernel_cfg_t
 

Macros

#define VSF_SYNC_AUTO_RST   0x0000
 Auto-reset flag, OR-ed into max_value of vsf_eda_sync_init(): the count is decreased automatically each time a pending task gets the sync object.
 
#define VSF_SYNC_MANUAL_RST   0x8000
 Manual-reset flag, OR-ed into max_value of vsf_eda_sync_init(): the count stays set until it is cleared by vsf_eda_sync_force_reset().
 
#define VSF_SYNC_HAS_OWNER   0x8000
 Has-owner flag, OR-ed into cur_value of vsf_eda_sync_init(): the sync object has an owner (e.g. a mutex) and supports priority inheritance.
 
#define VSF_SYNC_MAX   0x7FFF
 Maximum count value of a sync object vsf_sync_t.
 
#define VSF_KERNEL_CFG_EDA_USER_BITLEN   5
 
#define __vsf_eda_sem_init2(__psem, __init_cnt, __max_cnt)
 
#define __vsf_eda_sem_init1(__psem, __init_cnt)
 
#define __vsf_eda_sem_init0(__psem)
 
#define vsf_eda_sem_init(__psem, ...)
 Initialize a semaphore.
 
#define vsf_eda_sem_post(__psem)
 Post (increase) a semaphore, waking up one pending task if any.
 
#define __vsf_eda_sem_pend1(__psem, __timeout)
 
#define __vsf_eda_sem_pend0(__psem)
 
#define vsf_eda_sem_pend(__psem, ...)
 Pend (decrease) on a semaphore.
 
#define vsf_eda_sem_post_isr(__psem)
 Post (increase) a semaphore from interrupt context.
 
#define vsf_eda_mutex_init(__pmtx)
 Initialize a mutex.
 
#define __vsf_eda_mutex_enter1(__pmtx, __timeout)
 
#define __vsf_eda_mutex_enter0(__pmtx)
 
#define vsf_eda_mutex_enter(__pmtx, ...)
 Enter (lock) a mutex.
 
#define vsf_eda_mutex_leave(__pmtx)
 Leave (unlock) a mutex, waking up one pending task if any.
 
#define vsf_eda_mutex_leave_isr(__pmtx)
 Leave (unlock) a mutex from interrupt context.
 
#define vsf_eda_crit_init(__pcrit)
 Initialize a critical section.
 
#define __vsf_eda_crit_enter1(__pcrit, __timeout)
 
#define __vsf_eda_crit_enter0(__pcrit)
 
#define vsf_eda_crit_enter(__pcrit, ...)
 Enter a critical section, same semantics as vsf_eda_mutex_enter()
 
#define vsf_eda_crit_leave(__pcrit)
 Leave a critical section, same semantics as vsf_eda_mutex_leave()
 
#define vsf_eda_trig_init(__pevt, __set, __auto_rst)
 Initialize a trigger (a sync object with maximum count 1)
 
#define vsf_eda_trig_set0(__pevt)
 
#define vsf_eda_trig_set1(__pevt, __manual)
 
#define vsf_eda_trig_set(__pevt, ...)
 Set (trigger) a trigger, waking up the pending tasks.
 
#define vsf_eda_trig_reset(__pevt)
 Reset a trigger to the untriggered state.
 
#define __vsf_eda_trig_wait1(__pevt, __timeout)
 
#define __vsf_eda_trig_wait0(__pevt)
 
#define vsf_eda_trig_wait(__pevt, ...)
 Wait for a trigger to be set.
 
#define vsf_eda_trig_set_isr(__pevt)
 Set (trigger) a trigger from interrupt context.
 
#define __vsf_eda_crit_npb_init(__pcrit)
 Initialize a critical section without priority boost.
 
#define __vsf_eda_crit_npb_enter1(__pcrit, __timeout)
 
#define __vsf_eda_crit_npb_enter0(__pcrit)
 
#define __vsf_eda_crit_npb_enter(__pcrit, ...)
 Enter a critical section without priority boost.
 
#define __vsf_eda_crit_npb_leave(__pcrit)
 Leave a critical section without priority boost.
 
#define __vsf_eda_init2(__eda, __priority, __feature)
 
#define __vsf_eda_init1(__eda, __priority)
 
#define __vsf_eda_init0(__eda)
 
#define vsf_eda_init(__eda, ...)
 Initialize an eda (event-driven task) and post VSF_EVT_INIT to it.
 
#define vsf_teda_init(__teda, ...)
 Initialize a teda (eda with timer support), same arguments as vsf_eda_init()
 
#define vsf_eda_return(...)
 Return from the current (sub-called) eda with an optional return value.
 
#define vsf_systimer_get_ms()
 Get the current system tick converted to milliseconds.
 
#define vsf_systimer_get_us()
 Get the current system tick converted to microseconds.
 
#define vsf_eda_call_eda(__evthandler, ...)
 Sub-call an eda event handler from the current task.
 
#define vsf_eda_call_param_eda(__param_evthandler, __param, ...)
 Sub-call a parameterized eda event handler from the current task.
 
#define vsf_eda_get_local(...)
 Get the local variable storage of a frame-based (sub-called) eda.
 
#define __vsf_peda_local(__name)
 
#define vsf_peda_local(__name)
 Generate the local type name of a peda task.
 
#define __vsf_peda_arg(__name)
 
#define vsf_peda_arg(__name)
 Generate the argument type name of a peda task.
 
#define __vsf_peda_func(__name)
 
#define vsf_peda_func(__name)
 Generate the event handler function name of a peda task.
 
#define __vsf_peda_param(__name)
 
#define vsf_peda_param(__name)
 Generate the parameter type name of a peda task.
 
#define __declare_vsf_peda_ctx(__name)
 
#define declare_vsf_peda_ctx(__name)
 Declare the context types (param, arg, local) of a peda task.
 
#define dcl_vsf_peda_ctx(__name)
 Alias of declare_vsf_peda_ctx()
 
#define __declare_vsf_peda(__name)
 
#define declare_vsf_peda(__name)
 Declare a peda task type and its context types.
 
#define dcl_vsf_peda(__name)
 Alias of declare_vsf_peda()
 
#define declare_vsf_peda_methods1(__decoration, __name)
 
#define declare_vsf_peda_methods2(__decoration, __name, __func1)
 
#define declare_vsf_peda_methods3(__decoration, __name, __func1, __func2)
 
#define declare_vsf_peda_methods4(__name, __func1, __func2, __func3)
 
#define declare_vsf_peda_methods5( __decoration, __name, __func1, __func2, __func3, __func4)
 
#define declare_vsf_peda_methods6( __decoration, __name, __func1, __func2, __func3, __func4, __func5)
 
#define declare_vsf_peda_methods7( __decoration, __name, __func1, __func2, __func3, __func4, __func5, __func6)
 
#define declare_vsf_peda_methods8( __decoration, __name, __func1, __func2, __func3, __func4, __func5, __func6, __func7)
 
#define declare_vsf_peda_methods(__decoration, ...)
 Declare the context types and the event handler prototypes of a peda task.
 
#define dcl_vsf_peda_methods(__decoration, ...)
 Alias of declare_vsf_peda_methods()
 
#define __def_vsf_peda_ctx4(__name, __param, __arg, __local)
 
#define __def_vsf_peda4(__name, __param, __arg, __local)
 
#define __def_vsf_peda_ctx3(__name, __param, __arg)
 
#define __def_vsf_peda3(__name, __param, __arg)
 
#define __def_vsf_peda_ctx2(__name, __param)
 
#define __def_vsf_peda_ctx1(__name)
 
#define __def_vsf_peda2(__name, __param)
 
#define __def_vsf_peda1(__name)
 
#define def_vsf_peda(...)
 Define a peda task structure and its context structures.
 
#define end_def_vsf_peda(...)
 Terminator of def_vsf_peda(), expands to nothing.
 
#define def_vsf_peda_ctx(...)
 Define only the context structures (param, arg, local) of a peda task.
 
#define end_def_vsf_peda_ctx(...)
 Terminator of def_vsf_peda_ctx(), expands to nothing.
 
#define define_vsf_peda_ctx(__name, ...)
 Alias of def_vsf_peda_ctx()
 
#define end_define_vsf_peda_ctx(...)
 Terminator of define_vsf_peda_ctx(), expands to nothing.
 
#define def_locals(...)
 Local member section used inside def_vsf_peda()/def_vsf_peda_ctx()
 
#define end_def_locals(...)
 Terminator of def_locals(), expands to nothing.
 
#define define_locals(...)
 Alias of def_locals()
 
#define end_define_locals(...)
 Terminator of define_locals(), expands to nothing.
 
#define def_args(...)
 Argument member section used inside def_vsf_peda()/def_vsf_peda_ctx()
 
#define end_def_args(...)
 Terminator of def_args(), expands to nothing.
 
#define define_args(...)
 Alias of def_args()
 
#define end_define_args(...)
 Terminator of define_args(), expands to nothing.
 
#define define_arguments(...)
 Alias of def_args()
 
#define end_define_arguments(...)
 Terminator of define_arguments(), expands to nothing.
 
#define define_parameters(...)
 Parameter member section used inside def_vsf_peda()/def_vsf_peda_ctx()
 
#define end_define_parameters(...)
 Terminator of define_parameters(), expands to nothing.
 
#define vsf_peda_start   vsf_teda_start
 Start a peda task, alias of vsf_teda_start() when VSF_KERNEL_CFG_EDA_SUPPORT_TIMER is ENABLED, otherwise alias of vsf_eda_start()
 
#define __init_vsf_peda(__name, __param_eda, __pri, ...)
 
#define init_vsf_peda(__name, __param_eda, __pri, ...)
 Initialize and start a peda (parameterized eda) task.
 
#define __implement_vsf_peda2(__name, __func_name)
 
#define __implement_vsf_peda1(__name)
 
#define vsf_peda_begin()
 Beginning helper of a peda implementation, expands to nothing; pair with vsf_peda_end() to keep brackets balanced for editors.
 
#define vsf_peda_end()
 Ending helper of a peda implementation, expands to the closing brace of the event handler; pair with implement_vsf_peda()/vsf_peda_begin()
 
#define implement_vsf_peda(...)
 Start implementing the event handler of a peda task.
 
#define imp_vsf_peda(...)
 Alias of implement_vsf_peda()
 
#define vsf_eda_call_peda(__name, __param)
 Sub-call a peda task with its parameter from the current task.
 
#define vsf_local   (*vsf_plocal)
 Access the local variables inside a peda implementation.
 
#define vsf_this   (*vsf_pthis)
 Access the parameters (control block) inside a peda implementation.
 
#define vsf_eda_mutex_try_enter   vsf_eda_mutex_enter
 Alias of vsf_eda_mutex_enter(), kept for backward compatibility; do not use in new designs (use vsf_eda_mutex_enter() with timeout 0 instead)
 
#define vsf_eda_crit_try_enter   vsf_eda_crit_enter
 Alias of vsf_eda_crit_enter(), kept for backward compatibility; do not use in new designs (use vsf_eda_crit_enter() with timeout 0 instead)
 
#define VSF_KERNEL_TIMEOUT_TICK_T   int_fast64_t
 Underlying integer type of vsf_timeout_tick_t; redefine it before including this header to change the timeout tick width.
 
#define __VSF_BITMAP_EVT_DEFINED__
 
#define VSF_BMPEVT_OR   0
 bmpevt pender op value: the wait completes when any bit of the mask is set
 
#define VSF_BMPEVT_AND   1
 bmpevt pender op value: the wait completes when all bits of the mask are set
 

Typedefs

typedef VSF_KERNEL_TIMEOUT_TICK_T vsf_timeout_tick_t
 Timeout type in system timer ticks: negative means wait forever, 0 means non-blocking try, positive means the maximum ticks to wait.
 
typedef struct vsf_cpu_usage_ctx_t vsf_cpu_usage_ctx_t
 Context for per-task CPU usage sampling; the user provides the ctx storage and must keep it valid until vsf_eda_cpu_usage_stop() is called.
 
typedef struct vsf_cpu_usage_t vsf_cpu_usage_t
 Per-task CPU usage sampling data; points to the user-provided sampling context vsf_cpu_usage_ctx_t.
 
typedef int16_t vsf_evt_t
 Kernel event type.
 
typedef void(* vsf_eda_evthandler_t) (vsf_eda_t *eda, vsf_evt_t evt)
 eda event handler; invoked with the task (eda) and the event (evt)
 
typedef void(* vsf_eda_on_terminate_t) (vsf_eda_t *eda)
 On-terminate callback; invoked with the terminating task (eda)
 
typedef void(* vsf_param_eda_evthandler_t) (uintptr_t target, vsf_evt_t evt)
 Parameterized event handler; invoked with the user parameter (target) and the event (evt)
 
typedef uint8_t __vsf_eda_feature_word
 
typedef uint16_t __vsf_eda_flag_word
 
typedef union vsf_eda_feature_t vsf_eda_feature_t
 Task feature flags passed in vsf_eda_cfg_t.
 
typedef union __vsf_eda_state_t __vsf_eda_state_t
 
typedef union __vsf_eda_flag_t __vsf_eda_flag_t
 
typedef union __vsf_eda_fn_t __vsf_eda_fn_t
 
typedef struct __vsf_eda_frame_state_t __vsf_eda_frame_state_t
 
typedef struct vsf_eda_cfg_t vsf_eda_cfg_t
 Configuration for starting an eda/teda task (vsf_eda_start(), vsf_teda_start(), init_vsf_peda(), etc.)
 
typedef struct vsf_bmpevt_adapter_op_t vsf_bmpevt_adapter_op_t
 Adapter init/reset operations, mapping an IPC object (e.g. a semaphore) onto bitmap-event bits so one task can wait on multiple IPC objects at once.
 
typedef struct vsf_eda_queue_op_t vsf_eda_queue_op_t
 User-provided queue backend operations for vsf_eda_queue_t; enqueue/dequeue return bool success, dequeue outputs the node pointer.
 
typedef struct vsf_eda_queue_t vsf_osa_queue_t
 Aliases of vsf_eda_queue_t / vsf_eda_queue_op_t; osa means os-aware.
 
typedef struct vsf_eda_queue_op_t vsf_osa_queue_op_t
 
typedef vsf_teda_t vsf_peda_t
 
typedef enum vsf_sync_reason_t vsf_sync_reason_t
 Result of a sync wait, returned by the *_get_reason() APIs and thread IPC.
 
typedef vsf_sync_t vsf_sem_t
 Counting semaphore (vsf_sync_t with auto-reset)
 
typedef vsf_sync_t vsf_trig_t
 Trigger/event flag (sync with max 1, auto or manual reset)
 
typedef vsf_sync_t __vsf_crit_npb_t
 
typedef vsf_sync_owner_t vsf_mutex_t
 Mutex (vsf_sync_owner_t with priority inheritance); the owner must leave it itself.
 
typedef vsf_mutex_t vsf_crit_t
 Critical section (alias of mutex semantics)
 
typedef struct vsf_bmpevt_adapter_sync_t vsf_bmpevt_adapter_sync_t
 Adapter mapping a vsf_sync_t onto bitmap-event bits.
 
typedef struct vsf_bmpevt_adapter_bmpevt_t vsf_bmpevt_adapter_bmpevt_t
 Adapter mapping a nested vsf_bmpevt_t onto bitmap-event bits.
 
typedef enum vsf_kernel_error_t vsf_kernel_error_t
 Kernel error codes reported to vsf_kernel_err_report()
 
typedef struct vsf_kernel_cfg_t vsf_kernel_cfg_t
 

Enumerations

enum  {
  VSF_EVT_INVALID = -1 ,
  VSF_EVT_NONE = 0 ,
  VSF_EVT_YIELD = 1 ,
  VSF_EVT_SIGNAL = 2 ,
  VSF_EVT_SYSTEM = 0x100 ,
  VSF_EVT_DUMMY = VSF_EVT_SYSTEM + 0 ,
  VSF_EVT_INIT = VSF_EVT_SYSTEM + 1 ,
  VSF_EVT_FINI = VSF_EVT_SYSTEM + 2 ,
  VSF_EVT_ENTER = VSF_EVT_SYSTEM + 3 ,
  VSF_EVT_EXIT = VSF_EVT_SYSTEM + 4 ,
  VSF_EVT_RETURN = VSF_EVT_EXIT ,
  VSF_EVT_TIMER = VSF_EVT_SYSTEM + 5 ,
  VSF_EVT_SYNC = VSF_EVT_SYSTEM + 6 ,
  VSF_EVT_SYNC_CANCEL = VSF_EVT_SYSTEM + 7 ,
  VSF_EVT_SYNC_POLL = VSF_EVT_SYSTEM + 8 ,
  VSF_EVT_MESSAGE = VSF_EVT_SYSTEM + 9 ,
  VSF_EVT_USER = VSF_EVT_SYSTEM + 10
}
 VSF kernel event types, carried by vsf_evt_t; every eda event handler is driven by these events. More...
 
enum  {
  VSF_KERNEL_EVT_CALLBACK_TIMER = VSF_EVT_USER + 0 ,
  VSF_KERNEL_EVT_CALLBACK_TIMER_ADD = VSF_EVT_USER + 1 ,
  VSF_KERNEL_EVT_QUEUE_SEND_NOTIFY = VSF_EVT_USER + 2 ,
  VSF_KERNEL_EVT_QUEUE_RECV_NOTIFY = VSF_EVT_USER + 3
}
 
enum  vsf_sync_reason_t {
  VSF_SYNC_FAIL ,
  VSF_SYNC_TIMEOUT ,
  VSF_SYNC_PENDING ,
  VSF_SYNC_GET ,
  VSF_SYNC_CANCEL
}
 Result of a sync wait, returned by the *_get_reason() APIs and thread IPC. More...
 
enum  vsf_kernel_error_t {
  VSF_KERNEL_ERR_NONE = 0 ,
  VSF_KERNEL_ERR_INVALID_CONTEXT ,
  VSF_KERNEL_ERR_INVALID_USAGE ,
  VSF_KERNEL_ERR_EDA_DOES_NOT_SUPPORT_TIMER ,
  VSF_KERNEL_ERR_SHOULD_NOT_USE_PRIO_INHERIT_IN_IDLE_OR_ISR
}
 Kernel error codes reported to vsf_kernel_err_report() More...
 

Functions

void vsf_systimer_on_tick (void)
 System timer tick handler; called by the user on every system tick to drive the kernel timers.
 
vsf_systimer_tick_t vsf_systimer_get_tick (void)
 Get the current system timer tick count.
 
vsf_systimer_tick_t vsf_systimer_get_duration (vsf_systimer_tick_t from_time, vsf_systimer_tick_t to_time)
 Get the tick duration between two tick counts, handling wrap-around.
 
vsf_systimer_tick_t vsf_systimer_get_elapsed (vsf_systimer_tick_t from_time)
 Get the ticks elapsed from the given tick count to now.
 
vsf_err_t vsf_eda_go_to (uintptr_t evthandler)
 Switch the current task to a new event handler and post VSF_EVT_INIT to it.
 
vsf_err_t vsf_eda_start (vsf_eda_t *pthis, vsf_eda_cfg_t *cfg)
 Start an eda task with the given configuration and post VSF_EVT_INIT to it.
 
vsf_eda_tvsf_eda_get_cur (void)
 Get the eda task currently being dispatched.
 
vsf_evt_t vsf_eda_get_cur_evt (void)
 Get the event currently being processed by the current task.
 
void * vsf_eda_get_cur_msg (void)
 Get the pointer message carried by the current event (e.g. VSF_EVT_MESSAGE)
 
bool vsf_eda_is_stack_owner (vsf_eda_t *pthis)
 Check whether an eda owns a dedicated stack.
 
bool __vsf_eda_return (uintptr_t return_value)
 Return from the current (sub-called) eda with the given return value.
 
uintptr_t vsf_eda_get_return_value (void)
 Get the return value passed back by the sub-called task.
 
void __vsf_eda_yield (void)
 Yield the current task by posting VSF_EVT_YIELD to itself, so that it is dispatched again later.
 
void vsf_eda_cpu_usage_start (vsf_eda_t *pthis, vsf_cpu_usage_ctx_t *ctx)
 Start measuring the CPU usage of an eda task.
 
void vsf_eda_cpu_usage_stop (vsf_eda_t *pthis)
 Stop measuring the CPU usage of an eda task.
 
void vsf_eda_set_user_value (uint8_t value)
 Set the user-defined bits in the feature of the current eda.
 
uint8_t vsf_eda_get_user_value (void)
 Get the user-defined bits in the feature of the current eda.
 
vsf_err_t __vsf_eda_call_eda_prepare (uintptr_t evthandler, uintptr_t param, size_t local_size)
 Prepare a sub-call frame without dispatching VSF_EVT_INIT.
 
vsf_err_t __vsf_eda_call_eda (uintptr_t evthandler, uintptr_t param, size_t local_size)
 Sub-call an event handler: prepare a frame and dispatch VSF_EVT_INIT.
 
vsf_err_t __vsf_eda_go_to_ex (uintptr_t evthandler, uintptr_t param)
 Switch the current frame to a new event handler with a target parameter and dispatch VSF_EVT_INIT.
 
vsf_err_t __vsf_eda_call_eda_ex_prepare (uintptr_t func, uintptr_t param, __vsf_eda_frame_state_t state, bool is_sub_call)
 Prepare an extended sub-call frame without dispatching VSF_EVT_INIT.
 
vsf_err_t __vsf_eda_call_eda_ex (uintptr_t func, uintptr_t param, __vsf_eda_frame_state_t state, bool is_sub_call)
 Extended sub-call: prepare a frame and dispatch VSF_EVT_INIT.
 
uintptr_t __vsf_eda_get_local (vsf_eda_t *pthis)
 Get the local variable storage of a frame-based eda.
 
vsf_err_t vsf_eda_target_set (uintptr_t param)
 Set the target parameter of the current frame of the current task.
 
uintptr_t vsf_eda_target_get (void)
 Get the target parameter of the current frame of the current task.
 
vsf_err_t vsf_teda_start (vsf_teda_t *pthis, vsf_eda_cfg_t *cfg)
 Start a teda (eda with timer support) task with the given configuration and post VSF_EVT_INIT to it.
 
vsf_err_t vsf_teda_set_timer (vsf_systimer_tick_t tick)
 Set a one-shot timer of the given ticks for the current teda task; the task receives VSF_EVT_TIMER when the timer expires.
 
vsf_err_t vsf_teda_set_due_ex (vsf_teda_t *this_ptr, vsf_systimer_tick_t due)
 Set a one-shot timer with an absolute due tick for the given teda task.
 
vsf_err_t vsf_teda_set_timer_ex (vsf_teda_t *pthis, vsf_systimer_tick_t tick)
 Set a one-shot timer of the given ticks for the given teda task; the task receives VSF_EVT_TIMER when the timer expires.
 
vsf_err_t vsf_teda_cancel_timer (void)
 Cancel the pending timer of the current teda task.
 
vsf_err_t __vsf_teda_cancel_timer (vsf_teda_t *pthis)
 Cancel the pending timer of the given teda task.
 
void vsf_callback_timer_init (vsf_callback_timer_t *timer)
 Initialize a task-independent callback timer; set the on_timer callback before adding the timer.
 
vsf_err_t vsf_callback_timer_add_due (vsf_callback_timer_t *timer, vsf_systimer_tick_t due)
 Add a callback timer with an absolute due tick.
 
vsf_err_t vsf_callback_timer_add (vsf_callback_timer_t *timer, vsf_systimer_tick_t tick)
 Add a callback timer with a relative interval in ticks.
 
vsf_err_t vsf_callback_timer_remove (vsf_callback_timer_t *timer)
 Remove a callback timer before it expires.
 
vsf_err_t vsf_callback_timer_add_due_isr (vsf_callback_timer_t *timer, vsf_systimer_tick_t due)
 Add a callback timer with an absolute due tick from interrupt context.
 
vsf_err_t vsf_callback_timer_add_isr (vsf_callback_timer_t *timer, vsf_systimer_tick_t tick)
 Add a callback timer with a relative interval in ticks from interrupt context.
 
vsf_err_t vsf_callback_timer_remove_isr (vsf_callback_timer_t *timer)
 Remove a callback timer from interrupt context.
 
uintptr_t vsf_irq_enter (void)
 Notify the kernel of entering interrupt context.
 
void vsf_irq_leave (uintptr_t ctx)
 Notify the kernel of leaving interrupt context.
 
vsf_err_t vsf_eda_post_evt (vsf_eda_t *pthis, vsf_evt_t evt)
 Post an event to an eda task.
 
vsf_err_t vsf_eda_post_msg (vsf_eda_t *pthis, void *msg)
 Post a pointer message to an eda task; the task receives VSF_EVT_MESSAGE and retrieves the pointer with vsf_eda_get_cur_msg()
 
vsf_err_t vsf_eda_post_evt_msg (vsf_eda_t *pthis, vsf_evt_t evt, void *msg)
 Post an event carrying a pointer message to an eda task; the pointer is retrieved with vsf_eda_get_cur_msg()
 
vsf_err_t vsf_eda_sync_init (vsf_sync_t *pthis, uint_fast16_t cur_value, uint_fast16_t max_value)
 Initialize a sync object, the base of semaphore, mutex, trigger etc.
 
vsf_err_t vsf_eda_sync_increase_isr (vsf_sync_t *pthis)
 Increase a sync object from interrupt context.
 
vsf_err_t vsf_eda_sync_increase (vsf_sync_t *pthis)
 Increase a sync object, waking up the pending tasks if any.
 
vsf_err_t vsf_eda_sync_increase_ex (vsf_sync_t *pthis, vsf_eda_t *eda)
 Increase a sync object on behalf of the given eda (e.g. the owner of a mutex)
 
vsf_err_t __vsf_eda_sync_increase_ex (vsf_sync_t *pthis, vsf_eda_t *eda, bool manual)
 Increase a sync object with an explicit manual-reset flag.
 
vsf_err_t __vsf_eda_sync_decrease_ex (vsf_sync_t *pthis, vsf_timeout_tick_t timeout, vsf_eda_t *eda, bool manual)
 Decrease a sync object with an explicit manual-reset flag.
 
void vsf_eda_sync_force_reset (vsf_sync_t *pthis)
 Force the count of a sync object to 0.
 
vsf_err_t vsf_eda_sync_decrease (vsf_sync_t *pthis, vsf_timeout_tick_t timeout)
 Decrease a sync object, pending if the resource is not available.
 
vsf_err_t vsf_eda_sync_decrease_ex (vsf_sync_t *pthis, vsf_timeout_tick_t timeout, vsf_eda_t *eda)
 Decrease a sync object on behalf of the given eda.
 
void vsf_eda_sync_cancel (vsf_sync_t *pthis)
 Cancel all pending tasks on a sync object; they are woken with VSF_EVT_SYNC_CANCEL.
 
vsf_sync_reason_t vsf_eda_sync_get_reason (vsf_sync_t *pthis, vsf_evt_t evt)
 Retrieve the result of a sync operation from the wakeup event.
 
vsf_err_t vsf_eda_bmpevt_init (vsf_bmpevt_t *pthis, uint_fast8_t adapter_count)
 Initialize a bitmap event, initializing the bound adapters as well.
 
vsf_err_t vsf_eda_bmpevt_set (vsf_bmpevt_t *pthis, uint_fast32_t mask)
 Set event bits of a bitmap event, polling the pending tasks.
 
vsf_err_t vsf_eda_bmpevt_reset (vsf_bmpevt_t *pthis, uint_fast32_t mask)
 Reset (clear) event bits of a bitmap event, resetting the bound adapters whose bits are cleared.
 
vsf_err_t vsf_eda_bmpevt_cancel (vsf_bmpevt_t *pthis, uint_fast32_t mask)
 Cancel the pending tasks on a bitmap event whose mask intersects the given mask; they are woken with VSF_EVT_SYNC_CANCEL.
 
vsf_err_t vsf_eda_bmpevt_pend (vsf_bmpevt_t *pthis, vsf_bmpevt_pender_t *pender, vsf_timeout_tick_t timeout)
 Pend on a bitmap event until the masked bits are set (in OR or AND mode according to the pender configuration)
 
vsf_sync_reason_t vsf_eda_bmpevt_poll (vsf_bmpevt_t *pthis, vsf_bmpevt_pender_t *pender, vsf_evt_t evt)
 Retrieve the result of a bitmap event pend from the wakeup event.
 
vsf_err_t vsf_eda_queue_init (vsf_eda_queue_t *pthis, uint_fast16_t max)
 Initialize an OS-aware queue whose enqueue/dequeue operations are provided by the user in the op member (vsf_eda_queue_op_t)
 
vsf_err_t vsf_eda_queue_send (vsf_eda_queue_t *pthis, void *node, vsf_timeout_tick_t timeout)
 Send a node to a queue, pending while the queue is full.
 
vsf_err_t vsf_eda_queue_send_ex (vsf_eda_queue_t *pthis, void *node, vsf_timeout_tick_t timeout, vsf_eda_t *eda)
 Send a node to a queue on behalf of the given eda.
 
vsf_sync_reason_t vsf_eda_queue_send_get_reason (vsf_eda_queue_t *pthis, vsf_evt_t evt, void *node)
 Retrieve the result of a queue send from the wakeup event, retrying the enqueue if the resource is obtained.
 
vsf_err_t vsf_eda_queue_recv (vsf_eda_queue_t *pthis, void **node, vsf_timeout_tick_t timeout)
 Receive a node from a queue, pending while the queue is empty.
 
vsf_err_t vsf_eda_queue_recv_ex (vsf_eda_queue_t *pthis, void **node, vsf_timeout_tick_t timeout, vsf_eda_t *eda)
 Receive a node from a queue on behalf of the given eda.
 
vsf_sync_reason_t vsf_eda_queue_recv_get_reason (vsf_eda_queue_t *pthis, vsf_evt_t evt, void **node)
 Retrieve the result of a queue receive from the wakeup event, retrying the dequeue if the resource is obtained.
 
uint_fast16_t vsf_eda_queue_get_cnt (vsf_eda_queue_t *pthis)
 Get the number of nodes currently held in a queue.
 
void vsf_eda_queue_cancel (vsf_eda_queue_t *pthis)
 Cancel all pending senders and the pending receiver on a queue; they are woken with VSF_EVT_SYNC_CANCEL.
 
vsf_err_t vsf_eda_queue_send_isr (vsf_eda_queue_t *pthis, void *node)
 Send a node to a queue from interrupt context.
 
vsf_err_t vsf_eda_queue_recv_isr (vsf_eda_queue_t *pthis, void **node)
 Receive a node from a queue from interrupt context.
 

Variables

const vsf_bmpevt_adapter_op_t vsf_eda_bmpevt_adapter_sync_op
 Adapter operation table vsf_bmpevt_adapter_op_t used to bind a sync object to a bitmap event.
 
const vsf_bmpevt_adapter_op_t vsf_eda_bmpevt_adapter_bmpevt_op
 Adapter operation table vsf_bmpevt_adapter_op_t used to bind another bitmap event to a bitmap event.
 

Macro Definition Documentation

◆ VSF_SYNC_AUTO_RST

#define VSF_SYNC_AUTO_RST   0x0000

Auto-reset flag, OR-ed into max_value of vsf_eda_sync_init(): the count is decreased automatically each time a pending task gets the sync object.

\NOTE: Make sure #include "utilities/ooc_class.h" is close to the class ! definition and there is NO ANY OTHER module-interface-header file ! included in this file

◆ VSF_SYNC_MANUAL_RST

#define VSF_SYNC_MANUAL_RST   0x8000

Manual-reset flag, OR-ed into max_value of vsf_eda_sync_init(): the count stays set until it is cleared by vsf_eda_sync_force_reset().

◆ VSF_SYNC_HAS_OWNER

#define VSF_SYNC_HAS_OWNER   0x8000

Has-owner flag, OR-ed into cur_value of vsf_eda_sync_init(): the sync object has an owner (e.g. a mutex) and supports priority inheritance.

◆ VSF_SYNC_MAX

#define VSF_SYNC_MAX   0x7FFF

Maximum count value of a sync object vsf_sync_t.

◆ VSF_KERNEL_CFG_EDA_USER_BITLEN

#define VSF_KERNEL_CFG_EDA_USER_BITLEN   5

◆ __vsf_eda_sem_init2

#define __vsf_eda_sem_init2 ( __psem,
__init_cnt,
__max_cnt )
Value:
vsf_eda_sync_init((__psem), (__init_cnt), (__max_cnt) | VSF_SYNC_AUTO_RST)
vsf_err_t vsf_eda_sync_init(vsf_sync_t *pthis, uint_fast16_t cur_value, uint_fast16_t max_value)
Initialize a sync object, the base of semaphore, mutex, trigger etc.
#define VSF_SYNC_AUTO_RST
Auto-reset flag, OR-ed into max_value of vsf_eda_sync_init(): the count is decreased automatically ea...
Definition vsf_eda.h:59

◆ __vsf_eda_sem_init1

#define __vsf_eda_sem_init1 ( __psem,
__init_cnt )
Value:
__vsf_eda_sem_init2((__psem), (__init_cnt), VSF_SYNC_MAX)
#define VSF_SYNC_MAX
Maximum count value of a sync object vsf_sync_t.
Definition vsf_eda.h:85
#define __vsf_eda_sem_init2(__psem, __init_cnt, __max_cnt)
Definition vsf_eda.h:94

◆ __vsf_eda_sem_init0

#define __vsf_eda_sem_init0 ( __psem)
Value:
__vsf_eda_sem_init1((__psem), 0)
#define __vsf_eda_sem_init1(__psem, __init_cnt)
Definition vsf_eda.h:96

◆ vsf_eda_sem_init

#define vsf_eda_sem_init ( __psem,
... )
Value:
__PLOOC_EVAL(__vsf_eda_sem_init, __VA_ARGS__)((__psem), ##__VA_ARGS__)

Initialize a semaphore.

Parameters
[in]sema pointer to structure vsf_sem_t
[in]init_cntinitial count, 0 by default
[in]max_cntmaximum count, VSF_SYNC_MAX by default
Returns
vsf_err_t: always VSF_ERR_NONE (invalid parameters trigger an assertion)
Note
Must be called in task (or initialization) context, NOT in interrupt context.

◆ vsf_eda_sem_post

#define vsf_eda_sem_post ( __psem)
Value:
vsf_err_t vsf_eda_sync_increase(vsf_sync_t *pthis)
Increase a sync object, waking up the pending tasks if any.

Post (increase) a semaphore, waking up one pending task if any.

Parameters
[in]sema pointer to structure vsf_sem_t
Returns
vsf_err_t: VSF_ERR_NONE if successful, VSF_ERR_OVERRUN if the count has reached the maximum
Note
Must be called in task context, NOT in interrupt context (in interrupt context use the corresponding _isr API if available).

◆ __vsf_eda_sem_pend1

#define __vsf_eda_sem_pend1 ( __psem,
__timeout )
Value:
vsf_eda_sync_decrease((__psem), (__timeout))
vsf_err_t vsf_eda_sync_decrease(vsf_sync_t *pthis, vsf_timeout_tick_t timeout)
Decrease a sync object, pending if the resource is not available.

◆ __vsf_eda_sem_pend0

#define __vsf_eda_sem_pend0 ( __psem)
Value:
__vsf_eda_sem_pend1((__psem), -1)
#define __vsf_eda_sem_pend1(__psem, __timeout)
Definition vsf_eda.h:134

◆ vsf_eda_sem_pend

#define vsf_eda_sem_pend ( __psem,
... )
Value:
__PLOOC_EVAL(__vsf_eda_sem_pend, __VA_ARGS__)((__psem), ##__VA_ARGS__)

Pend (decrease) on a semaphore.

Parameters
[in]sema pointer to structure vsf_sem_t
[in]timeouttimeout in ticks, -1 (wait forever) by default; 0 means a non-blocking try; a positive value waits up to the given ticks and requires timer support (i.e. the caller must be a teda task)
Returns
vsf_err_t: VSF_ERR_NONE if the semaphore is obtained immediately; VSF_ERR_NOT_READY if the caller pends or the try failed
Note
If VSF_ERR_NOT_READY is returned with a non-zero timeout, the caller is woken later with VSF_EVT_SYNC, VSF_EVT_TIMER (timeout) or VSF_EVT_SYNC_CANCEL; call vsf_eda_sync_get_reason() to retrieve the result.
Must be called in an eda task context (i.e. inside an event handler); must NOT be called in interrupt context.

◆ vsf_eda_sem_post_isr

#define vsf_eda_sem_post_isr ( __psem)
Value:
vsf_err_t vsf_eda_sync_increase_isr(vsf_sync_t *pthis)
Increase a sync object from interrupt context.

Post (increase) a semaphore from interrupt context.

Parameters
[in]sema pointer to structure vsf_sem_t
Returns
vsf_err_t: VSF_ERR_NONE if the request is posted to the kernel task; VSF_ERR_NOT_ENOUGH_RESOURCES if no event node is available
Note
Only available when VSF_SYNC_CFG_SUPPORT_ISR is ENABLED. The actual increase is done by the kernel task.
May also be called in task context, but that is less efficient (the request is bounced to the kernel task instead of being executed directly) — prefer vsf_eda_sem_post() there.

◆ vsf_eda_mutex_init

#define vsf_eda_mutex_init ( __pmtx)
Value:
vsf_eda_sync_init( &((__pmtx)->use_as__vsf_sync_t), \
#define VSF_SYNC_HAS_OWNER
Has-owner flag, OR-ed into cur_value of vsf_eda_sync_init(): the sync object has an owner (e....
Definition vsf_eda.h:77

Initialize a mutex.

Parameters
[in]mutexa pointer to structure vsf_mutex_t
Returns
vsf_err_t: always VSF_ERR_NONE (invalid parameters trigger an assertion)
Note
vsf_mutex_t supports priority inheritance; the task which enters a mutex must leave it by itself.
Must be called in task (or initialization) context, NOT in interrupt context.

◆ __vsf_eda_mutex_enter1

#define __vsf_eda_mutex_enter1 ( __pmtx,
__timeout )
Value:
vsf_eda_sync_decrease(&((__pmtx)->use_as__vsf_sync_t), (__timeout))

◆ __vsf_eda_mutex_enter0

#define __vsf_eda_mutex_enter0 ( __pmtx)
Value:
#define __vsf_eda_mutex_enter1(__pmtx, __timeout)
Definition vsf_eda.h:214

◆ vsf_eda_mutex_enter

#define vsf_eda_mutex_enter ( __pmtx,
... )
Value:
__PLOOC_EVAL(__vsf_eda_mutex_enter, __VA_ARGS__)((__pmtx), ##__VA_ARGS__)

Enter (lock) a mutex.

Parameters
[in]mutexa pointer to structure vsf_mutex_t
[in]timeouttimeout in ticks, -1 (wait forever) by default; 0 means a non-blocking try; a positive value waits up to the given ticks and requires timer support (i.e. the caller must be a teda task)
Returns
vsf_err_t: VSF_ERR_NONE if the mutex is obtained immediately; VSF_ERR_NOT_READY if the caller pends or the try failed
Note
If VSF_ERR_NOT_READY is returned with a non-zero timeout, the caller is woken later with VSF_EVT_SYNC, VSF_EVT_TIMER (timeout) or VSF_EVT_SYNC_CANCEL; call vsf_eda_sync_get_reason() to retrieve the result.
Must be called in an eda task context (i.e. inside an event handler); must NOT be called in interrupt context.

◆ vsf_eda_mutex_leave

#define vsf_eda_mutex_leave ( __pmtx)
Value:
vsf_eda_sync_increase(&((__pmtx)->use_as__vsf_sync_t))

Leave (unlock) a mutex, waking up one pending task if any.

Parameters
[in]mutexa pointer to structure vsf_mutex_t
Returns
vsf_err_t: VSF_ERR_NONE if successful, VSF_ERR_OVERRUN if the mutex is not owned
Note
Must be called by the task which entered the mutex.
Must be called in task context, NOT in interrupt context (in interrupt context use the corresponding _isr API if available).

◆ vsf_eda_mutex_leave_isr

#define vsf_eda_mutex_leave_isr ( __pmtx)
Value:
vsf_eda_sync_increase_isr(&(__pmtx)->use_as__vsf_sync_t)

Leave (unlock) a mutex from interrupt context.

Parameters
[in]mutexa pointer to structure vsf_mutex_t
Returns
vsf_err_t: VSF_ERR_NONE if the request is posted to the kernel task; VSF_ERR_NOT_ENOUGH_RESOURCES if no event node is available
Note
Only available when VSF_SYNC_CFG_SUPPORT_ISR is ENABLED. The actual leave is done by the kernel task.
May also be called in task context, but that is less efficient (the request is bounced to the kernel task instead of being executed directly) — prefer vsf_eda_mutex_leave() there.

◆ vsf_eda_crit_init

#define vsf_eda_crit_init ( __pcrit)
Value:
vsf_eda_mutex_init((__pcrit))
#define vsf_eda_mutex_init(__pmtx)
Initialize a mutex.
Definition vsf_eda.h:209

Initialize a critical section.

Parameters
[in]crita pointer to structure vsf_crit_t
Returns
vsf_err_t: always VSF_ERR_NONE (invalid parameters trigger an assertion)
Note
vsf_crit_t has the same semantics as vsf_mutex_t.
Must be called in task (or initialization) context, NOT in interrupt context.

◆ __vsf_eda_crit_enter1

#define __vsf_eda_crit_enter1 ( __pcrit,
__timeout )
Value:
vsf_eda_mutex_enter((__pcrit), (__timeout))
#define vsf_eda_mutex_enter(__pmtx,...)
Enter (lock) a mutex.
Definition vsf_eda.h:245

◆ __vsf_eda_crit_enter0

#define __vsf_eda_crit_enter0 ( __pcrit)
Value:
__vsf_eda_crit_enter1((__pcrit), -1)
#define __vsf_eda_crit_enter1(__pcrit, __timeout)
Definition vsf_eda.h:310

◆ vsf_eda_crit_enter

#define vsf_eda_crit_enter ( __pcrit,
... )
Value:
__PLOOC_EVAL(__vsf_eda_crit_enter, __VA_ARGS__)((__pcrit), ##__VA_ARGS__)

Enter a critical section, same semantics as vsf_eda_mutex_enter()

Parameters
[in]crita pointer to structure vsf_crit_t
[in]timeouttimeout in ticks, -1 (wait forever) by default; 0 means a non-blocking try; a positive value waits up to the given ticks and requires timer support (i.e. the caller must be a teda task)
Returns
vsf_err_t: VSF_ERR_NONE if the critical section is obtained immediately; VSF_ERR_NOT_READY if the caller pends or the try failed
Note
If VSF_ERR_NOT_READY is returned with a non-zero timeout, the caller is woken later with VSF_EVT_SYNC, VSF_EVT_TIMER (timeout) or VSF_EVT_SYNC_CANCEL; call vsf_eda_sync_get_reason() to retrieve the result.
Must be called in an eda task context (i.e. inside an event handler); must NOT be called in interrupt context.

◆ vsf_eda_crit_leave

#define vsf_eda_crit_leave ( __pcrit)
Value:
#define vsf_eda_mutex_leave(__pmtx)
Leave (unlock) a mutex, waking up one pending task if any.
Definition vsf_eda.h:264

Leave a critical section, same semantics as vsf_eda_mutex_leave()

Parameters
[in]crita pointer to structure vsf_crit_t
Returns
vsf_err_t: VSF_ERR_NONE if successful, VSF_ERR_OVERRUN if the critical section is not owned
Note
Must be called in task context, NOT in interrupt context (in interrupt context use the corresponding _isr API if available).

◆ vsf_eda_trig_init

#define vsf_eda_trig_init ( __pevt,
__set,
__auto_rst )
Value:
vsf_eda_sync_init((__pevt), (__set), \
1 | ((__auto_rst) ? VSF_SYNC_AUTO_RST : VSF_SYNC_MANUAL_RST))
#define VSF_SYNC_MANUAL_RST
Manual-reset flag, OR-ed into max_value of vsf_eda_sync_init(): the count stays set until it is clear...
Definition vsf_eda.h:68

Initialize a trigger (a sync object with maximum count 1)

Parameters
[in]triga pointer to structure vsf_trig_t
[in]is_setinitial state, non-zero for set(triggered), 0 for reset
[in]is_auto_rstnon-zero for auto-reset mode, 0 for manual-reset mode
Returns
vsf_err_t: always VSF_ERR_NONE (invalid parameters trigger an assertion)
Note
Must be called in task (or initialization) context, NOT in interrupt context.

◆ vsf_eda_trig_set0

#define vsf_eda_trig_set0 ( __pevt)
Value:

◆ vsf_eda_trig_set1

#define vsf_eda_trig_set1 ( __pevt,
__manual )
Value:
__vsf_eda_sync_increase_ex((__pevt), NULL, (__manual))
#define NULL
Definition lvgl.h:26
vsf_err_t __vsf_eda_sync_increase_ex(vsf_sync_t *pthis, vsf_eda_t *eda, bool manual)
Increase a sync object with an explicit manual-reset flag.

◆ vsf_eda_trig_set

#define vsf_eda_trig_set ( __pevt,
... )
Value:
__PLOOC_EVAL(vsf_eda_trig_set, __VA_ARGS__)((__pevt), ##__VA_ARGS__)
#define vsf_eda_trig_set(__pevt,...)
Set (trigger) a trigger, waking up the pending tasks.
Definition vsf_eda.h:403

Set (trigger) a trigger, waking up the pending tasks.

Parameters
[in]triga pointer to structure vsf_trig_t
[in]manualoptional; non-zero to force manual-reset behavior for this set (the trigger stays set until vsf_eda_trig_reset()); if omitted, the reset mode configured by vsf_eda_trig_init() is used
Returns
vsf_err_t: VSF_ERR_NONE if successful, VSF_ERR_OVERRUN if the trigger is already set
Note
Must be called in task context, NOT in interrupt context (in interrupt context use the corresponding _isr API if available).

◆ vsf_eda_trig_reset

#define vsf_eda_trig_reset ( __pevt)
Value:
void vsf_eda_sync_force_reset(vsf_sync_t *pthis)
Force the count of a sync object to 0.

Reset a trigger to the untriggered state.

Parameters
[in]triga pointer to structure vsf_trig_t
Returns
none
Note
Must be called in task context, NOT in interrupt context (in interrupt context use the corresponding _isr API if available).

◆ __vsf_eda_trig_wait1

#define __vsf_eda_trig_wait1 ( __pevt,
__timeout )
Value:
vsf_eda_sync_decrease((__pevt), (__timeout))

◆ __vsf_eda_trig_wait0

#define __vsf_eda_trig_wait0 ( __pevt)
Value:
__vsf_eda_trig_wait1((__pevt), -1)
#define __vsf_eda_trig_wait1(__pevt, __timeout)
Definition vsf_eda.h:420

◆ vsf_eda_trig_wait

#define vsf_eda_trig_wait ( __pevt,
... )
Value:
__PLOOC_EVAL(__vsf_eda_trig_wait, __VA_ARGS__)((__pevt), ##__VA_ARGS__)

Wait for a trigger to be set.

Parameters
[in]triga pointer to structure vsf_trig_t
[in]timeouttimeout in ticks, -1 (wait forever) by default; 0 means a non-blocking try; a positive value waits up to the given ticks and requires timer support (i.e. the caller must be a teda task)
Returns
vsf_err_t: VSF_ERR_NONE if the trigger is set; VSF_ERR_NOT_READY if the caller pends or the try failed
Note
If VSF_ERR_NOT_READY is returned with a non-zero timeout, the caller is woken later with VSF_EVT_SYNC, VSF_EVT_TIMER (timeout) or VSF_EVT_SYNC_CANCEL; call vsf_eda_sync_get_reason() to retrieve the result.
Must be called in an eda task context (i.e. inside an event handler); must NOT be called in interrupt context.

◆ vsf_eda_trig_set_isr

#define vsf_eda_trig_set_isr ( __pevt)
Value:

Set (trigger) a trigger from interrupt context.

Parameters
[in]triga pointer to structure vsf_trig_t
Returns
vsf_err_t: VSF_ERR_NONE if the request is posted to the kernel task; VSF_ERR_NOT_ENOUGH_RESOURCES if no event node is available
Note
Only available when VSF_SYNC_CFG_SUPPORT_ISR is ENABLED. The actual set is done by the kernel task.
May also be called in task context, but that is less efficient (the request is bounced to the kernel task instead of being executed directly) — prefer vsf_eda_trig_set() there.

◆ __vsf_eda_crit_npb_init

#define __vsf_eda_crit_npb_init ( __pcrit)
Value:

Initialize a critical section without priority boost.

Parameters
[in]crit_npba pointer to structure __vsf_crit_npb_t
Returns
vsf_err_t: always VSF_ERR_NONE
Note
Internal use only. Only used for edas with the same priority.

◆ __vsf_eda_crit_npb_enter1

#define __vsf_eda_crit_npb_enter1 ( __pcrit,
__timeout )
Value:
vsf_eda_sync_decrease((__pcrit), (__timeout))

◆ __vsf_eda_crit_npb_enter0

#define __vsf_eda_crit_npb_enter0 ( __pcrit)
Value:
#define __vsf_eda_crit_npb_enter1(__pcrit, __timeout)
Definition vsf_eda.h:496

◆ __vsf_eda_crit_npb_enter

#define __vsf_eda_crit_npb_enter ( __pcrit,
... )
Value:
__PLOOC_EVAL(__vsf_eda_crit_npb_enter, __VA_ARGS__)((__pcrit), ##__VA_ARGS__)
#define __vsf_eda_crit_npb_enter(__pcrit,...)
Enter a critical section without priority boost.
Definition vsf_eda.h:523

Enter a critical section without priority boost.

Parameters
[in]crit_npba pointer to structure __vsf_crit_npb_t
[in]timeouttimeout in ticks, -1 (wait forever) by default; 0 means a non-blocking try; a positive value waits up to the given ticks and requires timer support (i.e. the caller must be a teda task)
Returns
vsf_err_t: VSF_ERR_NONE if the critical section is obtained immediately; VSF_ERR_NOT_READY if the caller pends or the try failed
Note
Internal use only.
Must be called in an eda task context (i.e. inside an event handler); must NOT be called in interrupt context.

◆ __vsf_eda_crit_npb_leave

#define __vsf_eda_crit_npb_leave ( __pcrit)
Value:

Leave a critical section without priority boost.

Parameters
[in]crit_npba pointer to structure __vsf_crit_npb_t
Returns
vsf_err_t: VSF_ERR_NONE if successful, VSF_ERR_OVERRUN if the critical section is not owned
Note
Internal use only.
Must be called in task context, NOT in interrupt context (in interrupt context use the corresponding _isr API if available).

◆ __vsf_eda_init2

#define __vsf_eda_init2 ( __eda,
__priority,
__feature )
Value:
__vsf_eda_init((__eda), (__priority), (__feature))
vsf_err_t __vsf_eda_init(vsf_eda_t *pthis, vsf_prio_t priority, vsf_eda_feature_t feature)
Definition vsf_eda.c:819

◆ __vsf_eda_init1

#define __vsf_eda_init1 ( __eda,
__priority )
Value:
__vsf_eda_init2((__eda), (__priority), (vsf_eda_feature_t){.value = 0})
Task feature flags passed in vsf_eda_cfg_t.
Definition vsf_eda.h:1702
#define __vsf_eda_init2(__eda, __priority, __feature)
Definition vsf_eda.h:545

◆ __vsf_eda_init0

#define __vsf_eda_init0 ( __eda)
Value:
#define __vsf_eda_init1(__eda, __priority)
Definition vsf_eda.h:547
@ vsf_prio_inherit
Inherit the priority of the current event queue.
Definition vsf_kernel_common.h:56

◆ vsf_eda_init

#define vsf_eda_init ( __eda,
... )
Value:
__PLOOC_EVAL(__vsf_eda_init, __VA_ARGS__)((__eda), ##__VA_ARGS__)

Initialize an eda (event-driven task) and post VSF_EVT_INIT to it.

Parameters
[in]edaa pointer to structure vsf_eda_t
[in]priopriority of the task, vsf_prio_inherit (inherit the current priority) by default
[in]featuretask feature vsf_eda_feature_t, 0 by default
Returns
vsf_err_t: VSF_ERR_NONE if the INIT event is posted; VSF_ERR_NOT_ENOUGH_RESOURCES if no event node is available
Note
The task receives VSF_EVT_INIT once when it is started.
Must be called in task (or initialization) context, NOT in interrupt context.

◆ vsf_teda_init

#define vsf_teda_init ( __teda,
... )
Value:
vsf_eda_init(&(__teda)->use_as__vsf_eda_t, ##__VA_ARGS__)
#define vsf_eda_init(__eda,...)
Initialize an eda (event-driven task) and post VSF_EVT_INIT to it.
Definition vsf_eda.h:573

Initialize a teda (eda with timer support), same arguments as vsf_eda_init()

Parameters
[in]tedaa pointer to structure vsf_teda_t
[in]priopriority of the task, vsf_prio_inherit by default
[in]featuretask feature vsf_eda_feature_t, 0 by default
Returns
vsf_err_t: VSF_ERR_NONE if the INIT event is posted; VSF_ERR_NOT_ENOUGH_RESOURCES if no event node is available
Note
Only available when VSF_KERNEL_CFG_EDA_SUPPORT_TIMER is ENABLED.
Must be called in task (or initialization) context, NOT in interrupt context.

◆ vsf_eda_return

#define vsf_eda_return ( ...)
Value:
__vsf_eda_return((uintptr_t)(0, ##__VA_ARGS__))
uint32_t uintptr_t
Definition stdint.h:38
bool __vsf_eda_return(uintptr_t return_value)
Return from the current (sub-called) eda with the given return value.
Definition vsf_eda.c:484

Return from the current (sub-called) eda with an optional return value.

Parameters
[in]return_valueoptional return value passed back to the caller, 0 by default
Returns
bool: true if the current task is terminated (no caller), false if control is returned to the caller
Note
The caller is woken with VSF_EVT_RETURN and can retrieve the value with vsf_eda_get_return_value().
Operates on the current task; must be called in the current eda/teda task's event handler context.

◆ vsf_systimer_get_ms

#define vsf_systimer_get_ms ( )
Value:
vsf_systimer_tick_t vsf_systimer_tick_to_ms(vsf_systimer_tick_t tick)
Definition linux_generic.c:450
vsf_systimer_tick_t vsf_systimer_get_tick(void)
Get the current system timer tick count.

Get the current system tick converted to milliseconds.

Returns
uint_fast32_t: current tick in milliseconds
Note
Only available when VSF_KERNEL_CFG_EDA_SUPPORT_TIMER is ENABLED.
Can be called in any context (task or interrupt).

◆ vsf_systimer_get_us

#define vsf_systimer_get_us ( )
Value:
vsf_systimer_tick_t vsf_systimer_tick_to_us(vsf_systimer_tick_t tick)
Definition linux_generic.c:445

Get the current system tick converted to microseconds.

Returns
uint_fast32_t: current tick in microseconds
Note
Only available when VSF_KERNEL_CFG_EDA_SUPPORT_TIMER is ENABLED.
Can be called in any context (task or interrupt).

◆ vsf_eda_call_eda

#define vsf_eda_call_eda ( __evthandler,
... )
Value:
__vsf_eda_call_eda((uintptr_t)__evthandler, NULL, (0, ##__VA_ARGS))
vsf_err_t __vsf_eda_call_eda(uintptr_t evthandler, uintptr_t param, size_t local_size)
Sub-call an event handler: prepare a frame and dispatch VSF_EVT_INIT.
Definition vsf_eda.c:730

Sub-call an eda event handler from the current task.

Parameters
[in]evthandlerevent handler vsf_eda_evthandler_t of the sub-called task
[in]local_sizeoptional size of the local variable storage, 0 by default
Returns
vsf_err_t: VSF_ERR_NONE if the sub-call is started, VSF_ERR_NOT_ENOUGH_RESOURCES if no frame is available
Note
Only available when VSF_KERNEL_CFG_EDA_SUPPORT_SUB_CALL is ENABLED. The sub-called handler receives VSF_EVT_INIT; when it calls vsf_eda_return(), the caller is woken with VSF_EVT_RETURN.
Operates on the current task; must be called in the current eda/teda task's event handler context.

◆ vsf_eda_call_param_eda

#define vsf_eda_call_param_eda ( __param_evthandler,
__param,
... )
Value:
__vsf_eda_call_eda( (uintptr_t)__param_evthandler, \
(uintptr_t)__param, \
(0, ##__VA_ARGS__))

Sub-call a parameterized eda event handler from the current task.

Parameters
[in]param_evthandlerparameterized event handler vsf_param_eda_evthandler_t
[in]paramtarget parameter passed to the handler
[in]local_sizeoptional size of the local variable storage, 0 by default
Returns
vsf_err_t: VSF_ERR_NONE if the sub-call is started, VSF_ERR_NOT_ENOUGH_RESOURCES if no frame is available
Note
Only available when VSF_KERNEL_CFG_EDA_SUPPORT_SUB_CALL is ENABLED.
Operates on the current task; must be called in the current eda/teda task's event handler context.

◆ vsf_eda_get_local

#define vsf_eda_get_local ( ...)
Value:
The event-driven task (TCB); every VSF task is an eda at the bottom. Tasks share stacks and only occu...
Definition vsf_eda.h:1838
uintptr_t __vsf_eda_get_local(vsf_eda_t *pthis)
Get the local variable storage of a frame-based eda.
Definition vsf_eda.c:589
vsf_eda_t * vsf_eda_get_cur(void)
Get the eda task currently being dispatched.
Definition vsf_eda.c:416

Get the local variable storage of a frame-based (sub-called) eda.

Parameters
[in]edaoptional pointer to structure vsf_eda_t, the current task by default
Returns
uintptr_t: address of the local storage, NULL if the task has no local storage
Note
Only available when VSF_KERNEL_CFG_EDA_SUPPORT_SUB_CALL is ENABLED.
Operates on the current task; must be called in the current eda/teda task's event handler context.

◆ __vsf_peda_local

#define __vsf_peda_local ( __name)
Value:
peda_local_##__name
#define __name
Definition hci_transport_aic8800.c:555

◆ vsf_peda_local

#define vsf_peda_local ( __name)
Value:
#define __vsf_peda_local(__name)
Definition vsf_eda.h:729

Generate the local type name of a peda task.

Parameters
[in]namename of the peda task

◆ __vsf_peda_arg

#define __vsf_peda_arg ( __name)
Value:
peda_arg_##__name

◆ vsf_peda_arg

#define vsf_peda_arg ( __name)
Value:
#define __vsf_peda_arg(__name)
Definition vsf_eda.h:740

Generate the argument type name of a peda task.

Parameters
[in]namename of the peda task

◆ __vsf_peda_func

#define __vsf_peda_func ( __name)
Value:
vsf_peda_func_##__name

◆ vsf_peda_func

#define vsf_peda_func ( __name)
Value:
#define __vsf_peda_func(__name)
Definition vsf_eda.h:751

Generate the event handler function name of a peda task.

Parameters
[in]namename of the peda task

◆ __vsf_peda_param

#define __vsf_peda_param ( __name)
Value:
peda_cb_##__name

◆ vsf_peda_param

#define vsf_peda_param ( __name)
Value:
#define __vsf_peda_param(__name)
Definition vsf_eda.h:763

Generate the parameter type name of a peda task.

Parameters
[in]namename of the peda task

◆ __declare_vsf_peda_ctx

#define __declare_vsf_peda_ctx ( __name)
Value:
typedef struct vsf_peda_param(__name) vsf_peda_param(__name); \
typedef struct vsf_peda_arg(__name) vsf_peda_arg(__name); \
typedef struct vsf_peda_local(__name) vsf_peda_local(__name);
#define vsf_peda_param(__name)
Generate the parameter type name of a peda task.
Definition vsf_eda.h:772
#define vsf_peda_arg(__name)
Generate the argument type name of a peda task.
Definition vsf_eda.h:749
#define vsf_peda_local(__name)
Generate the local type name of a peda task.
Definition vsf_eda.h:738

◆ declare_vsf_peda_ctx

#define declare_vsf_peda_ctx ( __name)
Value:
#define __declare_vsf_peda_ctx(__name)
Definition vsf_eda.h:775

Declare the context types (param, arg, local) of a peda task.

Parameters
[in]namename of the peda task

◆ dcl_vsf_peda_ctx

#define dcl_vsf_peda_ctx ( __name)
Value:
#define declare_vsf_peda_ctx(__name)
Declare the context types (param, arg, local) of a peda task.
Definition vsf_eda.h:787

Alias of declare_vsf_peda_ctx()

Parameters
[in]namename of the peda task

◆ __declare_vsf_peda

#define __declare_vsf_peda ( __name)
Value:
typedef struct __name __name; \
__declare_vsf_peda_ctx(__name)

◆ declare_vsf_peda

#define declare_vsf_peda ( __name)
Value:
#define __declare_vsf_peda(__name)
Definition vsf_eda.h:800

Declare a peda task type and its context types.

Parameters
[in]namename of the peda task

◆ dcl_vsf_peda

#define dcl_vsf_peda ( __name)
Value:
#define declare_vsf_peda(__name)
Declare a peda task type and its context types.
Definition vsf_eda.h:811

Alias of declare_vsf_peda()

Parameters
[in]namename of the peda task

◆ declare_vsf_peda_methods1

#define declare_vsf_peda_methods1 ( __decoration,
__name )
Value:
__decoration \
struct vsf_peda_local(__name) *vsf_pthis,\
vsf_evt_t evt);
int16_t vsf_evt_t
Kernel event type.
Definition vsf_eda.h:1658
#define vsf_peda_func(__name)
Generate the event handler function name of a peda task.
Definition vsf_eda.h:760

◆ declare_vsf_peda_methods2

#define declare_vsf_peda_methods2 ( __decoration,
__name,
__func1 )
Value:
__decoration \
struct vsf_peda_local(__name) *vsf_pthis,\
vsf_evt_t evt); \
__decoration \
void __func1( struct vsf_peda_local(__name) *vsf_pthis,\
vsf_evt_t evt);

◆ declare_vsf_peda_methods3

#define declare_vsf_peda_methods3 ( __decoration,
__name,
__func1,
__func2 )
Value:
__decoration \
struct vsf_peda_local(__name) *vsf_pthis,\
vsf_evt_t evt); \
__decoration \
void __func1( struct vsf_peda_local(__name) *vsf_pthis,\
vsf_evt_t evt); \
__decoration \
void __func2( struct vsf_peda_local(__name) *vsf_pthis,\
vsf_evt_t evt);

◆ declare_vsf_peda_methods4

#define declare_vsf_peda_methods4 ( __name,
__func1,
__func2,
__func3 )
Value:
__decoration \
struct vsf_peda_local(__name) *vsf_pthis,\
vsf_evt_t evt); \
__decoration \
void __func1( struct vsf_peda_local(__name) *vsf_pthis,\
vsf_evt_t evt); \
__decoration \
void __func2( struct vsf_peda_local(__name) *vsf_pthis,\
vsf_evt_t evt); \
__decoration \
void __func3( struct vsf_peda_local(__name) *vsf_pthis,\
vsf_evt_t evt);

◆ declare_vsf_peda_methods5

#define declare_vsf_peda_methods5 ( __decoration,
__name,
__func1,
__func2,
__func3,
__func4 )
Value:
__decoration \
struct vsf_peda_local(__name) *vsf_pthis,\
vsf_evt_t evt); \
__decoration \
void __func1( struct vsf_peda_local(__name) *vsf_pthis,\
vsf_evt_t evt); \
__decoration \
void __func2( struct vsf_peda_local(__name) *vsf_pthis,\
vsf_evt_t evt); \
__decoration \
void __func3( struct vsf_peda_local(__name) *vsf_pthis,\
vsf_evt_t evt); \
__decoration \
void __func4( struct vsf_peda_local(__name) *vsf_pthis,\
vsf_evt_t evt);

◆ declare_vsf_peda_methods6

#define declare_vsf_peda_methods6 ( __decoration,
__name,
__func1,
__func2,
__func3,
__func4,
__func5 )
Value:
__decoration \
struct vsf_peda_local(__name) *vsf_pthis,\
vsf_evt_t evt); \
__decoration \
void __func1( struct vsf_peda_local(__name) *vsf_pthis,\
vsf_evt_t evt); \
__decoration \
void __func2( struct vsf_peda_local(__name) *vsf_pthis,\
vsf_evt_t evt); \
__decoration \
void __func3( struct vsf_peda_local(__name) *vsf_pthis,\
vsf_evt_t evt); \
__decoration \
void __func4( struct vsf_peda_local(__name) *vsf_pthis,\
vsf_evt_t evt); \
__decoration \
void __func5( struct vsf_peda_local(__name) *vsf_pthis,\
vsf_evt_t evt);

◆ declare_vsf_peda_methods7

#define declare_vsf_peda_methods7 ( __decoration,
__name,
__func1,
__func2,
__func3,
__func4,
__func5,
__func6 )
Value:
__decoration \
struct vsf_peda_local(__name) *vsf_pthis,\
vsf_evt_t evt); \
__decoration \
void __func1( struct vsf_peda_local(__name) *vsf_pthis,\
vsf_evt_t evt); \
__decoration \
void __func2( struct vsf_peda_local(__name) *vsf_pthis,\
vsf_evt_t evt); \
__decoration \
void __func3( struct vsf_peda_local(__name) *vsf_pthis,\
vsf_evt_t evt); \
__decoration \
void __func4( struct vsf_peda_local(__name) *vsf_pthis,\
vsf_evt_t evt); \
__decoration \
void __func5( struct vsf_peda_local(__name) *vsf_pthis,\
vsf_evt_t evt); \
__decoration \
void __func6( struct vsf_peda_local(__name) *vsf_pthis,\
vsf_evt_t evt);

◆ declare_vsf_peda_methods8

#define declare_vsf_peda_methods8 ( __decoration,
__name,
__func1,
__func2,
__func3,
__func4,
__func5,
__func6,
__func7 )
Value:
__decoration \
struct vsf_peda_local(__name) *vsf_pthis,\
vsf_evt_t evt); \
__decoration \
void __func1( struct vsf_peda_local(__name) *vsf_pthis,\
vsf_evt_t evt); \
__decoration \
void __func2( struct vsf_peda_local(__name) *vsf_pthis,\
vsf_evt_t evt); \
__decoration \
void __func3( struct vsf_peda_local(__name) *vsf_pthis,\
vsf_evt_t evt); \
__decoration \
void __func4( struct vsf_peda_local(__name) *vsf_pthis,\
vsf_evt_t evt); \
__decoration \
void __func5( struct vsf_peda_local(__name) *vsf_pthis,\
vsf_evt_t evt); \
__decoration \
void __func6( struct vsf_peda_local(__name) *vsf_pthis,\
vsf_evt_t evt); \
__decoration \
void __func7( struct vsf_peda_local(__name) *vsf_pthis,\
vsf_evt_t evt);

◆ declare_vsf_peda_methods

#define declare_vsf_peda_methods ( __decoration,
... )
Value:
__PLOOC_EVAL(declare_vsf_peda_methods, __VA_ARGS__) \
(__decoration, __VA_ARGS__)
#define declare_vsf_peda_methods(__decoration,...)
Declare the context types and the event handler prototypes of a peda task.
Definition vsf_eda.h:986

Declare the context types and the event handler prototypes of a peda task.

Parameters
[in]decorationdeclaration decoration (e.g. extern, static)
[in]namename of the peda task, followed by up to 7 additional handler names
Note
Dispatches to the numbered declare_vsf_peda_methods1..8 variants according to the argument count; the numbered variants are internal helpers.

◆ dcl_vsf_peda_methods

#define dcl_vsf_peda_methods ( __decoration,
... )
Value:
declare_vsf_peda_methods(__decoration, __VA_ARGS__)

Alias of declare_vsf_peda_methods()

Parameters
[in]decorationdeclaration decoration (e.g. extern, static)
[in]namename of the peda task, followed by up to 7 additional handler names

◆ __def_vsf_peda_ctx4

#define __def_vsf_peda_ctx4 ( __name,
__param,
__arg,
__local )
Value:
struct vsf_peda_param(__name) { \
__param \
}; \
struct vsf_peda_arg(__name) { \
__arg \
}; \
struct vsf_peda_local(__name) { \
implement(vsf_peda_arg(__name)) \
__local \
};

◆ __def_vsf_peda4

#define __def_vsf_peda4 ( __name,
__param,
__arg,
__local )
Value:
__def_vsf_peda_ctx4(__name, __param, __arg, __local) \
struct __name { \
implement(vsf_peda_t) \
implement_ex(vsf_peda_param(__name), param) \
};
eda with timer support (can use vsf_teda_set_timer() etc.); derived classes (task/pt/thread) inherit ...
Definition vsf_eda.h:1916
#define __def_vsf_peda_ctx4(__name, __param, __arg, __local)
Definition vsf_eda.h:1018

◆ __def_vsf_peda_ctx3

#define __def_vsf_peda_ctx3 ( __name,
__param,
__arg )
Value:
struct vsf_peda_param(__name) { \
__param \
}; \
struct vsf_peda_arg(__name) { \
__arg \
}; \
struct vsf_peda_local(__name) { \
implement(vsf_peda_arg(__name)) \
};

◆ __def_vsf_peda3

#define __def_vsf_peda3 ( __name,
__param,
__arg )
Value:
__def_vsf_peda_ctx3(__name, __param, __arg) \
struct __name { \
implement(vsf_peda_t) \
implement_ex(vsf_peda_param(__name), param) \
};
#define __def_vsf_peda_ctx3(__name, __param, __arg)
Definition vsf_eda.h:1052

◆ __def_vsf_peda_ctx2

#define __def_vsf_peda_ctx2 ( __name,
__param )
Value:
struct vsf_peda_param(__name) { \
__param \
}; \
struct vsf_peda_arg(__name) { \
}; \
struct vsf_peda_local(__name) { \
implement(vsf_peda_arg(__name)) \
};

◆ __def_vsf_peda_ctx1

#define __def_vsf_peda_ctx1 ( __name)
Value:
#define __def_vsf_peda_ctx2(__name, __param)
Definition vsf_eda.h:1085

◆ __def_vsf_peda2

#define __def_vsf_peda2 ( __name,
__param )
Value:
struct __name { \
implement(vsf_peda_t) \
implement_ex(vsf_peda_param(__name), param) \
};

◆ __def_vsf_peda1

#define __def_vsf_peda1 ( __name)
Value:
struct __name { \
implement(vsf_peda_t) \
implement_ex(vsf_peda_param(__name), param) \
};
#define __def_vsf_peda_ctx1(__name)
Definition vsf_eda.h:1096

◆ def_vsf_peda

#define def_vsf_peda ( ...)
Value:
__PLOOC_EVAL(__def_vsf_peda, __VA_ARGS__) (__VA_ARGS__)

Define a peda task structure and its context structures.

Parameters
[in]namename of the peda task, optionally followed by param, arg and local member definitions (use def_args(), def_locals() etc. as the sections)
Note
Dispatches to the internal numbered __def_vsf_peda1..4 variants according to the argument count. Pair it with end_def_vsf_peda().

◆ end_def_vsf_peda

#define end_def_vsf_peda ( ...)

Terminator of def_vsf_peda(), expands to nothing.

◆ def_vsf_peda_ctx

#define def_vsf_peda_ctx ( ...)
Value:
__PLOOC_EVAL(__def_vsf_peda_ctx, __VA_ARGS__)(__VA_ARGS__)

Define only the context structures (param, arg, local) of a peda task.

Parameters
[in]namename of the peda task, optionally followed by param, arg and local member definitions
Note
Dispatches to the internal numbered __def_vsf_peda_ctx1..4 variants according to the argument count. Pair it with end_def_vsf_peda_ctx().

◆ end_def_vsf_peda_ctx

#define end_def_vsf_peda_ctx ( ...)

Terminator of def_vsf_peda_ctx(), expands to nothing.

◆ define_vsf_peda_ctx

#define define_vsf_peda_ctx ( __name,
... )
Value:
def_vsf_peda_ctx(__name, __VA_ARGS__)
#define def_vsf_peda_ctx(...)
Define only the context structures (param, arg, local) of a peda task.
Definition vsf_eda.h:1155

Alias of def_vsf_peda_ctx()

Parameters
[in]namename of the peda task, optionally followed by param, arg and local member definitions

◆ end_define_vsf_peda_ctx

#define end_define_vsf_peda_ctx ( ...)

Terminator of define_vsf_peda_ctx(), expands to nothing.

◆ def_locals

#define def_locals ( ...)
Value:
,##__VA_ARGS__

Local member section used inside def_vsf_peda()/def_vsf_peda_ctx()

◆ end_def_locals

#define end_def_locals ( ...)

Terminator of def_locals(), expands to nothing.

◆ define_locals

#define define_locals ( ...)
Value:
,##__VA_ARGS__

Alias of def_locals()

◆ end_define_locals

#define end_define_locals ( ...)

Terminator of define_locals(), expands to nothing.

◆ def_args

#define def_args ( ...)
Value:
,__VA_ARGS__

Argument member section used inside def_vsf_peda()/def_vsf_peda_ctx()

◆ end_def_args

#define end_def_args ( ...)

Terminator of def_args(), expands to nothing.

◆ define_args

#define define_args ( ...)
Value:
,__VA_ARGS__

Alias of def_args()

◆ end_define_args

#define end_define_args ( ...)

Terminator of define_args(), expands to nothing.

◆ define_arguments

#define define_arguments ( ...)
Value:
,__VA_ARGS__

Alias of def_args()

◆ end_define_arguments

#define end_define_arguments ( ...)

Terminator of define_arguments(), expands to nothing.

◆ define_parameters

#define define_parameters ( ...)
Value:
__VA_ARGS__

Parameter member section used inside def_vsf_peda()/def_vsf_peda_ctx()

◆ end_define_parameters

#define end_define_parameters ( ...)

Terminator of define_parameters(), expands to nothing.

◆ vsf_peda_start

#define vsf_peda_start   vsf_teda_start

Start a peda task, alias of vsf_teda_start() when VSF_KERNEL_CFG_EDA_SUPPORT_TIMER is ENABLED, otherwise alias of vsf_eda_start()

Parameters
[in]pedaa pointer to the peda task structure
[in]cfga pointer to structure vsf_eda_cfg_t
Returns
vsf_err_t: VSF_ERR_NONE if started successfully; VSF_ERR_NOT_ENOUGH_RESOURCES if no frame is available

◆ __init_vsf_peda

#define __init_vsf_peda ( __name,
__param_eda,
__pri,
... )
Value:
do { \
.fn.param_evthandler = \
.priority = (__pri), \
.target = (uintptr_t)&((__param_eda)->param), \
.local_size = sizeof(vsf_peda_local(__name)), \
__VA_ARGS__ \
}; \
vsf_peda_start((vsf_peda_t *)(__param_eda), \
} while(0)
Configuration for starting an eda/teda task (vsf_eda_start(), vsf_teda_start(), init_vsf_peda(),...
Definition vsf_eda.h:1804
void(* vsf_param_eda_evthandler_t)(uintptr_t target, vsf_evt_t evt)
Parameterized event handler; invoked with the user parameter (target) and the event (evt)
Definition vsf_eda.h:1681
#define VSF_MACRO_SAFE_NAME(__NAME)
Definition vsf_preprocessor.h:32

◆ init_vsf_peda

#define init_vsf_peda ( __name,
__param_eda,
__pri,
... )
Value:
__init_vsf_peda(__name, (__param_eda), (__pri), __VA_ARGS__)
#define __init_vsf_peda(__name, __param_eda, __pri,...)
Definition vsf_eda.h:1296

Initialize and start a peda (parameterized eda) task.

Parameters
[in]namename of the peda task
[in]param_edaa pointer to the peda task instance
[in]pripriority of the task
[in]...optional extra initializers of vsf_eda_cfg_t
Returns
none
Note
Only available when VSF_KERNEL_CFG_EDA_SUPPORT_SUB_CALL is ENABLED.
Operates on the current task; must be called in the current eda/teda task's event handler context.

◆ __implement_vsf_peda2

#define __implement_vsf_peda2 ( __name,
__func_name )
Value:
void __func_name( struct vsf_peda_local(__name) *vsf_plocal, \
vsf_evt_t evt) \
{ \
vsf_peda_param(__name) *vsf_pthis = \
((uintptr_t)vsf_plocal - sizeof(uintptr_t)); \
VSF_UNUSED_PARAM(vsf_pthis); \
VSF_KERNEL_ASSERT(NULL != vsf_pthis || NULL != vsf_plocal);

◆ __implement_vsf_peda1

#define __implement_vsf_peda1 ( __name)
Value:
void vsf_peda_func(__name)( struct vsf_peda_local(__name) *vsf_plocal, \
vsf_evt_t evt) \
{ \
vsf_peda_param(__name) *vsf_pthis = \
((uintptr_t)vsf_plocal - sizeof(uintptr_t)); \
VSF_UNUSED_PARAM(vsf_pthis); \
VSF_KERNEL_ASSERT(NULL != vsf_pthis || NULL != vsf_plocal);

◆ vsf_peda_begin

#define vsf_peda_begin ( )

Beginning helper of a peda implementation, expands to nothing; pair with vsf_peda_end() to keep brackets balanced for editors.

◆ vsf_peda_end

#define vsf_peda_end ( )
Value:
}

Ending helper of a peda implementation, expands to the closing brace of the event handler; pair with implement_vsf_peda()/vsf_peda_begin()

◆ implement_vsf_peda

#define implement_vsf_peda ( ...)
Value:
__PLOOC_EVAL(__implement_vsf_peda, __VA_ARGS__)(__VA_ARGS__)

Start implementing the event handler of a peda task.

Parameters
[in]namename of the peda task, optionally followed by a custom function name
Note
Inside the implementation, use vsf_local to access the local variables and vsf_this to access the parameters. Pair it with vsf_peda_end() or a closing brace.

◆ imp_vsf_peda

#define imp_vsf_peda ( ...)
Value:
implement_vsf_peda(__VA_ARGS__)
#define implement_vsf_peda(...)
Start implementing the event handler of a peda task.
Definition vsf_eda.h:1393

Alias of implement_vsf_peda()

Parameters
[in]namename of the peda task, optionally followed by a custom function name

◆ vsf_eda_call_peda

#define vsf_eda_call_peda ( __name,
__param )
Value:
(__param), \
#define vsf_eda_call_param_eda(__param_evthandler, __param,...)
Sub-call a parameterized eda event handler from the current task.
Definition vsf_eda.h:704

Sub-call a peda task with its parameter from the current task.

Parameters
[in]namename of the peda task
[in]parama pointer to the parameter (control block) of the peda task
Returns
vsf_err_t: VSF_ERR_NONE if the sub-call is started, VSF_ERR_NOT_ENOUGH_RESOURCES if no frame is available
Note
Only available when VSF_KERNEL_CFG_EDA_SUPPORT_SUB_CALL is ENABLED. The caller is woken with VSF_EVT_RETURN after the peda task calls vsf_eda_return().
Operates on the current task; must be called in the current eda/teda task's event handler context.

◆ vsf_local

#define vsf_local   (*vsf_plocal)

Access the local variables inside a peda implementation.

◆ vsf_this

#define vsf_this   (*vsf_pthis)

Access the parameters (control block) inside a peda implementation.

◆ vsf_eda_mutex_try_enter

#define vsf_eda_mutex_try_enter   vsf_eda_mutex_enter

Alias of vsf_eda_mutex_enter(), kept for backward compatibility; do not use in new designs (use vsf_eda_mutex_enter() with timeout 0 instead)

◆ vsf_eda_crit_try_enter

#define vsf_eda_crit_try_enter   vsf_eda_crit_enter

Alias of vsf_eda_crit_enter(), kept for backward compatibility; do not use in new designs (use vsf_eda_crit_enter() with timeout 0 instead)

◆ VSF_KERNEL_TIMEOUT_TICK_T

#define VSF_KERNEL_TIMEOUT_TICK_T   int_fast64_t

Underlying integer type of vsf_timeout_tick_t; redefine it before including this header to change the timeout tick width.

◆ __VSF_BITMAP_EVT_DEFINED__

#define __VSF_BITMAP_EVT_DEFINED__

◆ VSF_BMPEVT_OR

#define VSF_BMPEVT_OR   0

bmpevt pender op value: the wait completes when any bit of the mask is set

◆ VSF_BMPEVT_AND

#define VSF_BMPEVT_AND   1

bmpevt pender op value: the wait completes when all bits of the mask are set

Typedef Documentation

◆ vsf_timeout_tick_t

Timeout type in system timer ticks: negative means wait forever, 0 means non-blocking try, positive means the maximum ticks to wait.

◆ vsf_cpu_usage_ctx_t

typedef struct vsf_cpu_usage_ctx_t vsf_cpu_usage_ctx_t

Context for per-task CPU usage sampling; the user provides the ctx storage and must keep it valid until vsf_eda_cpu_usage_stop() is called.

Note
The measured ticks include higher-priority tasks and interrupts.

◆ vsf_cpu_usage_t

typedef struct vsf_cpu_usage_t vsf_cpu_usage_t

Per-task CPU usage sampling data; points to the user-provided sampling context vsf_cpu_usage_ctx_t.

◆ vsf_evt_t

typedef int16_t vsf_evt_t

Kernel event type.

◆ vsf_eda_evthandler_t

typedef void(* vsf_eda_evthandler_t) (vsf_eda_t *eda, vsf_evt_t evt)

eda event handler; invoked with the task (eda) and the event (evt)

◆ vsf_eda_on_terminate_t

typedef void(* vsf_eda_on_terminate_t) (vsf_eda_t *eda)

On-terminate callback; invoked with the terminating task (eda)

◆ vsf_param_eda_evthandler_t

typedef void(* vsf_param_eda_evthandler_t) (uintptr_t target, vsf_evt_t evt)

Parameterized event handler; invoked with the user parameter (target) and the event (evt)

◆ __vsf_eda_feature_word

◆ __vsf_eda_flag_word

◆ vsf_eda_feature_t

typedef union vsf_eda_feature_t vsf_eda_feature_t

Task feature flags passed in vsf_eda_cfg_t.

◆ __vsf_eda_state_t

typedef union __vsf_eda_state_t __vsf_eda_state_t

◆ __vsf_eda_flag_t

typedef union __vsf_eda_flag_t __vsf_eda_flag_t

◆ __vsf_eda_fn_t

typedef union __vsf_eda_fn_t __vsf_eda_fn_t

◆ __vsf_eda_frame_state_t

typedef struct __vsf_eda_frame_state_t __vsf_eda_frame_state_t

◆ vsf_eda_cfg_t

typedef struct vsf_eda_cfg_t vsf_eda_cfg_t

Configuration for starting an eda/teda task (vsf_eda_start(), vsf_teda_start(), init_vsf_peda(), etc.)

◆ vsf_bmpevt_adapter_op_t

typedef struct vsf_bmpevt_adapter_op_t vsf_bmpevt_adapter_op_t

Adapter init/reset operations, mapping an IPC object (e.g. a semaphore) onto bitmap-event bits so one task can wait on multiple IPC objects at once.

◆ vsf_eda_queue_op_t

typedef struct vsf_eda_queue_op_t vsf_eda_queue_op_t

User-provided queue backend operations for vsf_eda_queue_t; enqueue/dequeue return bool success, dequeue outputs the node pointer.

◆ vsf_osa_queue_t

Aliases of vsf_eda_queue_t / vsf_eda_queue_op_t; osa means os-aware.

define alias for vsf_eda_queue_t. osa means os-aware

◆ vsf_osa_queue_op_t

◆ vsf_peda_t

◆ vsf_sync_reason_t

Result of a sync wait, returned by the *_get_reason() APIs and thread IPC.

◆ vsf_sem_t

Counting semaphore (vsf_sync_t with auto-reset)

◆ vsf_trig_t

Trigger/event flag (sync with max 1, auto or manual reset)

◆ __vsf_crit_npb_t

◆ vsf_mutex_t

Mutex (vsf_sync_owner_t with priority inheritance); the owner must leave it itself.

◆ vsf_crit_t

Critical section (alias of mutex semantics)

◆ vsf_bmpevt_adapter_sync_t

typedef struct vsf_bmpevt_adapter_sync_t vsf_bmpevt_adapter_sync_t

Adapter mapping a vsf_sync_t onto bitmap-event bits.

◆ vsf_bmpevt_adapter_bmpevt_t

typedef struct vsf_bmpevt_adapter_bmpevt_t vsf_bmpevt_adapter_bmpevt_t

Adapter mapping a nested vsf_bmpevt_t onto bitmap-event bits.

◆ vsf_kernel_error_t

Kernel error codes reported to vsf_kernel_err_report()

◆ vsf_kernel_cfg_t

typedef struct vsf_kernel_cfg_t vsf_kernel_cfg_t

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

VSF kernel event types, carried by vsf_evt_t; every eda event handler is driven by these events.

Enumerator
VSF_EVT_INVALID 

Invalid event; waiting for it means waiting for any event; also compatible with fsm_rt_err.

\ note wait for invalid also means wait for any evt compatible with fsm_rt_err

VSF_EVT_NONE 

No event; compatible with fsm_rt_cpl.

compatible with fsm_rt_cpl

VSF_EVT_YIELD 

Cooperative yield event; compatible with fsm_rt_on_going.

compatible with fsm_rt_on_going

VSF_EVT_SIGNAL 

POSIX-like thread signal event (VSF_KERNEL_CFG_THREAD_SIGNAL)

VSF_EVT_SYSTEM 

Base of system events; system events start here, user events start at VSF_EVT_USER.

VSF_EVT_DUMMY 

Dummy system event.

VSF_EVT_INIT 

Received once when a task starts.

VSF_EVT_FINI 

Received once when a task terminates.

VSF_EVT_ENTER 

Received when entering a sub-call frame.

VSF_EVT_EXIT 

Received when a called sub task returns.

VSF_EVT_RETURN 

Same value as VSF_EVT_EXIT; received when a called sub task returns.

VSF_EVT_TIMER 

teda timer expired (only for teda tasks)

VSF_EVT_SYNC 

A pending sync IPC (semaphore/mutex/trigger/queue/bmpevt) was obtained.

VSF_EVT_SYNC_CANCEL 

The pending sync IPC was cancelled (e.g. by vsf_eda_sync_cancel())

VSF_EVT_SYNC_POLL 

Sync poll event (used by bmpevt polling)

VSF_EVT_MESSAGE 

A message event carrying a pointer, retrieved with vsf_eda_get_cur_msg()

VSF_EVT_USER 

Base of user-defined events; values from here on are user events.

◆ anonymous enum

anonymous enum
Enumerator
VSF_KERNEL_EVT_CALLBACK_TIMER 
VSF_KERNEL_EVT_CALLBACK_TIMER_ADD 
VSF_KERNEL_EVT_QUEUE_SEND_NOTIFY 
VSF_KERNEL_EVT_QUEUE_RECV_NOTIFY 

◆ vsf_sync_reason_t

Result of a sync wait, returned by the *_get_reason() APIs and thread IPC.

Enumerator
VSF_SYNC_FAIL 

Failed/error.

VSF_SYNC_TIMEOUT 

Timed out.

VSF_SYNC_PENDING 

Still waiting, retry.

VSF_SYNC_GET 

Obtained.

VSF_SYNC_CANCEL 

Cancelled.

◆ vsf_kernel_error_t

Kernel error codes reported to vsf_kernel_err_report()

Enumerator
VSF_KERNEL_ERR_NONE 

No error.

VSF_KERNEL_ERR_INVALID_CONTEXT 

API called from an invalid context.

VSF_KERNEL_ERR_INVALID_USAGE 

API used incorrectly.

VSF_KERNEL_ERR_EDA_DOES_NOT_SUPPORT_TIMER 

Timer service used on an eda without timer support.

VSF_KERNEL_ERR_SHOULD_NOT_USE_PRIO_INHERIT_IN_IDLE_OR_ISR 

vsf_prio_inherit used where there is no current event queue (idle or ISR)

Function Documentation

◆ vsf_systimer_on_tick()

void vsf_systimer_on_tick ( void )
extern

System timer tick handler; called by the user on every system tick to drive the kernel timers.

Returns
none
Note
Only used when VSF_KERNEL_CFG_TIMER_MODE is VSF_KERNEL_CFG_TIMER_MODE_TICK, called from the system timer interrupt.

◆ vsf_systimer_get_tick()

vsf_systimer_tick_t vsf_systimer_get_tick ( void )
extern

Get the current system timer tick count.

Returns
vsf_systimer_tick_t: current tick count
Note
Can be called in any context (task or interrupt).

◆ vsf_systimer_get_duration()

vsf_systimer_tick_t vsf_systimer_get_duration ( vsf_systimer_tick_t from_time,
vsf_systimer_tick_t to_time )
extern

Get the tick duration between two tick counts, handling wrap-around.

Parameters
[in]from_timethe start tick count
[in]to_timethe end tick count
Returns
vsf_systimer_tick_t: tick duration from from_time to to_time
Note
Can be called in any context (task or interrupt).

◆ vsf_systimer_get_elapsed()

vsf_systimer_tick_t vsf_systimer_get_elapsed ( vsf_systimer_tick_t from_time)
extern

Get the ticks elapsed from the given tick count to now.

Parameters
[in]from_timethe start tick count
Returns
vsf_systimer_tick_t: ticks elapsed since from_time
Note
Can be called in any context (task or interrupt).

◆ vsf_eda_go_to()

vsf_err_t vsf_eda_go_to ( uintptr_t evthandler)
extern

Switch the current task to a new event handler and post VSF_EVT_INIT to it.

Parameters
[in]evthandleraddress of the new event handler vsf_eda_evthandler_t
Returns
vsf_err_t: always VSF_ERR_NONE
Note
Operates on the current task; must be called in the current eda/teda task's event handler context.

◆ vsf_eda_start()

vsf_err_t vsf_eda_start ( vsf_eda_t * pthis,
vsf_eda_cfg_t * cfg )

Start an eda task with the given configuration and post VSF_EVT_INIT to it.

Parameters
[in]pthisa pointer to structure vsf_eda_t
[in]cfga pointer to structure vsf_eda_cfg_t holding the task configuration
Returns
vsf_err_t: VSF_ERR_NONE if successful, VSF_ERR_NOT_ENOUGH_RESOURCES if no frame is available for a frame-based task
Note
Must be called in task (or initialization) context, NOT in interrupt context.

override the is_use_frame flag

◆ vsf_eda_get_cur()

vsf_eda_t * vsf_eda_get_cur ( void )
extern

Get the eda task currently being dispatched.

Returns
vsf_eda_t *: pointer to the current vsf_eda_t, NULL if not in task context
Note
Can be called in any context; returns NULL when not in eda task context.

◆ vsf_eda_get_cur_evt()

vsf_evt_t vsf_eda_get_cur_evt ( void )
extern

Get the event currently being processed by the current task.

Returns
vsf_evt_t: the current event
Note
Operates on the current task; must be called in the current eda/teda task's event handler context.

◆ vsf_eda_get_cur_msg()

void * vsf_eda_get_cur_msg ( void )
extern

Get the pointer message carried by the current event (e.g. VSF_EVT_MESSAGE)

Returns
void *: the message pointer posted with the current event
Note
Operates on the current task; must be called in the current eda/teda task's event handler context.

◆ vsf_eda_is_stack_owner()

bool vsf_eda_is_stack_owner ( vsf_eda_t * pthis)
extern

Check whether an eda owns a dedicated stack.

Parameters
[in]pthisa pointer to structure vsf_eda_t
Returns
bool: true if the eda owns a dedicated stack
Note
Only available when VSF_KERNEL_USE_SIMPLE_SHELL is ENABLED.

◆ __vsf_eda_return()

bool __vsf_eda_return ( uintptr_t return_value)
extern

Return from the current (sub-called) eda with the given return value.

Parameters
[in]return_valuereturn value passed back to the caller
Returns
bool: true if the current task is terminated (no caller), false if control is returned to the caller
Note
Internal use only. Use the macro vsf_eda_return() instead.
Operates on the current task; must be called in the current eda/teda task's event handler context.
Note
automatically free a frame if the top eda doesn't set ! is_use_frame

< top frame

< not force frame

◆ vsf_eda_get_return_value()

uintptr_t vsf_eda_get_return_value ( void )
extern

Get the return value passed back by the sub-called task.

Returns
uintptr_t: the return value set by vsf_eda_return()
Note
Only available when VSF_KERNEL_CFG_EDA_SUPPORT_SUB_CALL is ENABLED.
Operates on the current task; must be called in the current eda/teda task's event handler context.

◆ __vsf_eda_yield()

void __vsf_eda_yield ( void )
extern

Yield the current task by posting VSF_EVT_YIELD to itself, so that it is dispatched again later.

Returns
none
Note
Internal use only.
Operates on the current task; must be called in the current eda/teda task's event handler context.

◆ vsf_eda_cpu_usage_start()

void vsf_eda_cpu_usage_start ( vsf_eda_t * pthis,
vsf_cpu_usage_ctx_t * ctx )
extern

Start measuring the CPU usage of an eda task.

Parameters
[in]pthisa pointer to structure vsf_eda_t
[in]ctxa pointer to user-provided structure vsf_cpu_usage_ctx_t, which must be kept valid until vsf_eda_cpu_usage_stop() is called
Returns
none
Note
Only available when VSF_KERNEL_CFG_EDA_CPU_USAGE is ENABLED. The measured ticks actually include ticks from all higher priority tasks and interrupts.

◆ vsf_eda_cpu_usage_stop()

void vsf_eda_cpu_usage_stop ( vsf_eda_t * pthis)
extern

Stop measuring the CPU usage of an eda task.

Parameters
[in]pthisa pointer to structure vsf_eda_t
Returns
none
Note
Only available when VSF_KERNEL_CFG_EDA_CPU_USAGE is ENABLED.

◆ vsf_eda_set_user_value()

void vsf_eda_set_user_value ( uint8_t value)
extern

Set the user-defined bits in the feature of the current eda.

Parameters
[in]valuethe user value to set, up to VSF_KERNEL_CFG_EDA_USER_BITLEN bits
Returns
none
Note
Operates on the current task; must be called in the current eda/teda task's event handler context.

◆ vsf_eda_get_user_value()

uint8_t vsf_eda_get_user_value ( void )
extern

Get the user-defined bits in the feature of the current eda.

Returns
uint8_t: the user value previously set by vsf_eda_set_user_value()
Note
Operates on the current task; must be called in the current eda/teda task's event handler context.

◆ __vsf_eda_call_eda_prepare()

vsf_err_t __vsf_eda_call_eda_prepare ( uintptr_t evthandler,
uintptr_t param,
size_t local_size )

Prepare a sub-call frame without dispatching VSF_EVT_INIT.

Parameters
[in]evthandleraddress of the event handler to call
[in]paramtarget parameter of the new frame
[in]local_sizesize of the local variable storage
Returns
vsf_err_t: VSF_ERR_NONE if the frame is prepared, VSF_ERR_NOT_ENOUGH_RESOURCES if no frame is available
Note
Internal use only. Only available when VSF_KERNEL_CFG_EDA_SUPPORT_SUB_CALL is ENABLED.
Operates on the current task; must be called in the current eda/teda task's event handler context.

◆ __vsf_eda_call_eda()

vsf_err_t __vsf_eda_call_eda ( uintptr_t evthandler,
uintptr_t param,
size_t local_size )
extern

Sub-call an event handler: prepare a frame and dispatch VSF_EVT_INIT.

Parameters
[in]evthandleraddress of the event handler to call
[in]paramtarget parameter of the new frame
[in]local_sizesize of the local variable storage
Returns
vsf_err_t: VSF_ERR_NONE if the sub-call is started, VSF_ERR_NOT_ENOUGH_RESOURCES if no frame is available
Note
Internal use only. Use the macros vsf_eda_call_eda() or vsf_eda_call_param_eda() instead. Only available when VSF_KERNEL_CFG_EDA_SUPPORT_SUB_CALL is ENABLED.
Operates on the current task; must be called in the current eda/teda task's event handler context.

◆ __vsf_eda_go_to_ex()

vsf_err_t __vsf_eda_go_to_ex ( uintptr_t evthandler,
uintptr_t param )
extern

Switch the current frame to a new event handler with a target parameter and dispatch VSF_EVT_INIT.

Parameters
[in]evthandleraddress of the new event handler
[in]paramtarget parameter
Returns
vsf_err_t: VSF_ERR_NONE if started successfully; VSF_ERR_NOT_ENOUGH_RESOURCES if no frame is available
Note
Internal use only. Only available when VSF_KERNEL_CFG_EDA_SUPPORT_SUB_CALL is ENABLED.
Operates on the current task; must be called in the current eda/teda task's event handler context.

◆ __vsf_eda_call_eda_ex_prepare()

vsf_err_t __vsf_eda_call_eda_ex_prepare ( uintptr_t func,
uintptr_t param,
__vsf_eda_frame_state_t state,
bool is_sub_call )
extern

Prepare an extended sub-call frame without dispatching VSF_EVT_INIT.

Parameters
[in]funcaddress of the handler function to call
[in]paramtarget parameter of the new frame
[in]stateframe state __vsf_eda_frame_state_t (feature and local size)
[in]is_sub_calltrue for a sub-call (new frame), false to reuse the current frame
Returns
vsf_err_t: VSF_ERR_NONE if the frame is prepared, VSF_ERR_NOT_ENOUGH_RESOURCES if no frame is available
Note
Internal use only. Only available when VSF_KERNEL_CFG_EDA_SUPPORT_SUB_CALL is ENABLED.
Operates on the current task; must be called in the current eda/teda task's event handler context.
Note
please NEVER do following things. If param is NULL, please let frame->param to be NULL

if (NULL == param) { frame->param = pthis; //!< point to the current eda } else { frame->param = param; }

◆ __vsf_eda_call_eda_ex()

vsf_err_t __vsf_eda_call_eda_ex ( uintptr_t func,
uintptr_t param,
__vsf_eda_frame_state_t state,
bool is_sub_call )
extern

Extended sub-call: prepare a frame and dispatch VSF_EVT_INIT.

Parameters
[in]funcaddress of the handler function to call
[in]paramtarget parameter of the new frame
[in]stateframe state __vsf_eda_frame_state_t (feature and local size)
[in]is_sub_calltrue for a sub-call (new frame), false to reuse the current frame
Returns
vsf_err_t: VSF_ERR_NONE if the call is started, VSF_ERR_NOT_ENOUGH_RESOURCES if no frame is available
Note
Internal use only. Only available when VSF_KERNEL_CFG_EDA_SUPPORT_SUB_CALL is ENABLED.
Operates on the current task; must be called in the current eda/teda task's event handler context.

◆ __vsf_eda_get_local()

uintptr_t __vsf_eda_get_local ( vsf_eda_t * pthis)
extern

Get the local variable storage of a frame-based eda.

Parameters
[in]pthisa pointer to structure vsf_eda_t
Returns
uintptr_t: address of the local storage, NULL if the task has no local storage
Note
Internal use only. Use the macro vsf_eda_get_local() instead. Only available when VSF_KERNEL_CFG_EDA_SUPPORT_SUB_CALL is ENABLED.
Operates on the current task; must be called in the current eda/teda task's event handler context.

◆ vsf_eda_target_set()

vsf_err_t vsf_eda_target_set ( uintptr_t param)
extern

Set the target parameter of the current frame of the current task.

Parameters
[in]paramthe target parameter to set
Returns
vsf_err_t: VSF_ERR_NONE if successful, VSF_ERR_NOT_ENOUGH_RESOURCES if no frame is available
Note
Only available when VSF_KERNEL_CFG_EDA_SUPPORT_SUB_CALL is ENABLED.
Operates on the current task; must be called in the current eda/teda task's event handler context.

◆ vsf_eda_target_get()

uintptr_t vsf_eda_target_get ( void )
extern

Get the target parameter of the current frame of the current task.

Returns
uintptr_t: the target parameter, NULL if the current task uses no frame
Note
Only available when VSF_KERNEL_CFG_EDA_SUPPORT_SUB_CALL is ENABLED.
Operates on the current task; must be called in the current eda/teda task's event handler context.

◆ vsf_teda_start()

vsf_err_t vsf_teda_start ( vsf_teda_t * pthis,
vsf_eda_cfg_t * cfg )
extern

Start a teda (eda with timer support) task with the given configuration and post VSF_EVT_INIT to it.

Parameters
[in]pthisa pointer to structure vsf_teda_t
[in]cfga pointer to structure vsf_eda_cfg_t holding the task configuration
Returns
vsf_err_t: VSF_ERR_NONE if started successfully; VSF_ERR_NOT_ENOUGH_RESOURCES if no frame is available
Note
Only available when VSF_KERNEL_CFG_EDA_SUPPORT_TIMER is ENABLED.
Must be called in task (or initialization) context, NOT in interrupt context.

◆ vsf_teda_set_timer()

vsf_err_t vsf_teda_set_timer ( vsf_systimer_tick_t tick)
extern

Set a one-shot timer of the given ticks for the current teda task; the task receives VSF_EVT_TIMER when the timer expires.

Parameters
[in]ticktimer interval in ticks, must not be 0
Returns
vsf_err_t: VSF_ERR_NONE if successful; VSF_ERR_NOT_AVAILABLE if tick is 0 (tick == 0 also triggers an assertion in debug builds)
Note
Only available when VSF_KERNEL_CFG_EDA_SUPPORT_TIMER is ENABLED.
Operates on the current task; must be called in the current eda/teda task's event handler context.

◆ vsf_teda_set_due_ex()

vsf_err_t vsf_teda_set_due_ex ( vsf_teda_t * this_ptr,
vsf_systimer_tick_t due )
extern

Set a one-shot timer with an absolute due tick for the given teda task.

Parameters
[in]this_ptra pointer to structure vsf_teda_t
[in]dueabsolute due tick count
Returns
vsf_err_t: always VSF_ERR_NONE
Note
Only available when VSF_KERNEL_CFG_EDA_SUPPORT_TIMER is ENABLED. The task receives VSF_EVT_TIMER when the timer expires.
Must be called in task context, NOT in interrupt context (in interrupt context use the corresponding _isr API if available).

◆ vsf_teda_set_timer_ex()

vsf_err_t vsf_teda_set_timer_ex ( vsf_teda_t * pthis,
vsf_systimer_tick_t tick )
extern

Set a one-shot timer of the given ticks for the given teda task; the task receives VSF_EVT_TIMER when the timer expires.

Parameters
[in]pthisa pointer to structure vsf_teda_t
[in]ticktimer interval in ticks, must not be 0
Returns
vsf_err_t: VSF_ERR_NONE if successful; VSF_ERR_NOT_AVAILABLE if tick is 0 (tick == 0 also triggers an assertion in debug builds)
Note
Only available when VSF_KERNEL_CFG_EDA_SUPPORT_TIMER is ENABLED.
Must be called in task context, NOT in interrupt context (in interrupt context use the corresponding _isr API if available).

◆ vsf_teda_cancel_timer()

vsf_err_t vsf_teda_cancel_timer ( void )
extern

Cancel the pending timer of the current teda task.

Returns
vsf_err_t: always VSF_ERR_NONE
Note
Only available when VSF_KERNEL_CFG_EDA_SUPPORT_TIMER is ENABLED.
Operates on the current task; must be called in the current eda/teda task's event handler context.

◆ __vsf_teda_cancel_timer()

vsf_err_t __vsf_teda_cancel_timer ( vsf_teda_t * pthis)
extern

Cancel the pending timer of the given teda task.

Parameters
[in]pthisa pointer to structure vsf_teda_t, the current task if NULL
Returns
vsf_err_t: always VSF_ERR_NONE
Note
Internal use only. Only available when VSF_KERNEL_CFG_EDA_SUPPORT_TIMER is ENABLED.
Must be called in task context, NOT in interrupt context (in interrupt context use the corresponding _isr API if available).

◆ vsf_callback_timer_init()

void vsf_callback_timer_init ( vsf_callback_timer_t * timer)
extern

Initialize a task-independent callback timer; set the on_timer callback before adding the timer.

Parameters
[in]timera pointer to structure vsf_callback_timer_t
Returns
none
Note
Only available when VSF_KERNEL_CFG_SUPPORT_CALLBACK_TIMER is ENABLED. When the timer expires, the on_timer callback of vsf_callback_timer_t is invoked by the kernel task.
Must be called in task context, NOT in interrupt context (in interrupt context use the corresponding _isr API if available).

◆ vsf_callback_timer_add_due()

vsf_err_t vsf_callback_timer_add_due ( vsf_callback_timer_t * timer,
vsf_systimer_tick_t due )
extern

Add a callback timer with an absolute due tick.

Parameters
[in]timera pointer to structure vsf_callback_timer_t
[in]dueabsolute due tick count, must not be 0
Returns
vsf_err_t: VSF_ERR_NONE if successful, VSF_ERR_FAIL if the timer is already added
Note
Only available when VSF_KERNEL_CFG_SUPPORT_CALLBACK_TIMER is ENABLED.
Must be called in task context, NOT in interrupt context (in interrupt context use the corresponding _isr API if available).

◆ vsf_callback_timer_add()

vsf_err_t vsf_callback_timer_add ( vsf_callback_timer_t * timer,
vsf_systimer_tick_t tick )
extern

Add a callback timer with a relative interval in ticks.

Parameters
[in]timera pointer to structure vsf_callback_timer_t
[in]ticktimer interval in ticks
Returns
vsf_err_t: VSF_ERR_NONE if successful, VSF_ERR_FAIL if the timer is already added
Note
Only available when VSF_KERNEL_CFG_SUPPORT_CALLBACK_TIMER is ENABLED.
Must be called in task context, NOT in interrupt context (in interrupt context use the corresponding _isr API if available).

◆ vsf_callback_timer_remove()

vsf_err_t vsf_callback_timer_remove ( vsf_callback_timer_t * timer)
extern

Remove a callback timer before it expires.

Parameters
[in]timera pointer to structure vsf_callback_timer_t
Returns
vsf_err_t: always VSF_ERR_NONE
Note
Only available when VSF_KERNEL_CFG_SUPPORT_CALLBACK_TIMER is ENABLED.
Must be called in task context, NOT in interrupt context (in interrupt context use the corresponding _isr API if available).

◆ vsf_callback_timer_add_due_isr()

vsf_err_t vsf_callback_timer_add_due_isr ( vsf_callback_timer_t * timer,
vsf_systimer_tick_t due )
extern

Add a callback timer with an absolute due tick from interrupt context.

Parameters
[in]timera pointer to structure vsf_callback_timer_t
[in]dueabsolute due tick count, must not be 0
Returns
vsf_err_t: VSF_ERR_NONE if the request is posted to the kernel task, VSF_ERR_FAIL if the timer is already added, VSF_ERR_NOT_ENOUGH_RESOURCES if no event node is available for the request
Note
Only available when VSF_CALLBACK_TIMER_CFG_SUPPORT_ISR is ENABLED. The actual add is done by the kernel task.
May also be called in task context, but that is less efficient (the request is bounced to the kernel task instead of being executed directly) — prefer vsf_callback_timer_add_due() there.

◆ vsf_callback_timer_add_isr()

vsf_err_t vsf_callback_timer_add_isr ( vsf_callback_timer_t * timer,
vsf_systimer_tick_t tick )
extern

Add a callback timer with a relative interval in ticks from interrupt context.

Parameters
[in]timera pointer to structure vsf_callback_timer_t
[in]ticktimer interval in ticks
Returns
vsf_err_t: VSF_ERR_NONE if the request is posted to the kernel task, VSF_ERR_FAIL if the timer is already added, VSF_ERR_NOT_ENOUGH_RESOURCES if no event node is available for the request
Note
Only available when VSF_CALLBACK_TIMER_CFG_SUPPORT_ISR is ENABLED. The actual add is done by the kernel task.
May also be called in task context, but that is less efficient (the request is bounced to the kernel task instead of being executed directly) — prefer vsf_callback_timer_add() there.

◆ vsf_callback_timer_remove_isr()

vsf_err_t vsf_callback_timer_remove_isr ( vsf_callback_timer_t * timer)
extern

Remove a callback timer from interrupt context.

Parameters
[in]timera pointer to structure vsf_callback_timer_t
Returns
vsf_err_t: always VSF_ERR_NONE
Note
Only available when VSF_CALLBACK_TIMER_CFG_SUPPORT_ISR is ENABLED.
Can be called in interrupt context; unlike the other _isr APIs, it is executed directly (same as vsf_callback_timer_remove()), not bounced to the kernel task.

◆ vsf_irq_enter()

uintptr_t vsf_irq_enter ( void )
extern

Notify the kernel of entering interrupt context.

Returns
uintptr_t: a context value which must be passed back to vsf_irq_leave()

◆ vsf_irq_leave()

void vsf_irq_leave ( uintptr_t ctx)
extern

Notify the kernel of leaving interrupt context.

Parameters
[in]ctxthe context value returned by vsf_irq_enter()
Returns
none

◆ vsf_eda_post_evt()

vsf_err_t vsf_eda_post_evt ( vsf_eda_t * pthis,
vsf_evt_t evt )
extern

Post an event to an eda task.

Parameters
[in]pthisa pointer to structure vsf_eda_t
[in]evtthe event to post
Returns
vsf_err_t: VSF_ERR_NONE if posted; VSF_ERR_FAIL if the eda is limited and already has a pending event; VSF_ERR_NOT_ENOUGH_RESOURCES if no event node is available
Note
Can be called in task or interrupt context.

◆ vsf_eda_post_msg()

vsf_err_t vsf_eda_post_msg ( vsf_eda_t * pthis,
void * msg )
extern

Post a pointer message to an eda task; the task receives VSF_EVT_MESSAGE and retrieves the pointer with vsf_eda_get_cur_msg()

Parameters
[in]pthisa pointer to structure vsf_eda_t
[in]msgthe message pointer to post, must be aligned (LSB must be 0)
Returns
vsf_err_t: VSF_ERR_NONE if posted; VSF_ERR_FAIL if the eda is limited and already has a pending event; VSF_ERR_NOT_ENOUGH_RESOURCES if no event node is available
Note
Can be called in task or interrupt context.

◆ vsf_eda_post_evt_msg()

vsf_err_t vsf_eda_post_evt_msg ( vsf_eda_t * pthis,
vsf_evt_t evt,
void * msg )
extern

Post an event carrying a pointer message to an eda task; the pointer is retrieved with vsf_eda_get_cur_msg()

Parameters
[in]pthisa pointer to structure vsf_eda_t
[in]evtthe event to post
[in]msgthe message pointer carried with the event
Returns
vsf_err_t: VSF_ERR_NONE if posted; VSF_ERR_FAIL if the eda is limited and already has a pending event; VSF_ERR_NOT_ENOUGH_RESOURCES if no event node is available
Note
Only available when VSF_KERNEL_CFG_SUPPORT_EVT_MESSAGE is ENABLED.
Can be called in task or interrupt context.

◆ vsf_eda_sync_init()

vsf_err_t vsf_eda_sync_init ( vsf_sync_t * pthis,
uint_fast16_t cur_value,
uint_fast16_t max_value )
extern

Initialize a sync object, the base of semaphore, mutex, trigger etc.

Parameters
[in]pthisa pointer to structure vsf_sync_t
[in]cur_valueinitial count, optionally OR-ed with VSF_SYNC_HAS_OWNER
[in]max_valuemaximum count (up to VSF_SYNC_MAX), optionally OR-ed with VSF_SYNC_AUTO_RST or VSF_SYNC_MANUAL_RST
Returns
vsf_err_t: always VSF_ERR_NONE (invalid parameters trigger an assertion)
Note
Only available when VSF_KERNEL_CFG_SUPPORT_SYNC is ENABLED.
Must be called in task (or initialization) context, NOT in interrupt context.

◆ vsf_eda_sync_increase_isr()

vsf_err_t vsf_eda_sync_increase_isr ( vsf_sync_t * pthis)
extern

Increase a sync object from interrupt context.

Parameters
[in]pthisa pointer to structure vsf_sync_t
Returns
vsf_err_t: VSF_ERR_NONE if the request is posted to the kernel task; VSF_ERR_NOT_ENOUGH_RESOURCES if no event node is available
Note
Only available when VSF_SYNC_CFG_SUPPORT_ISR is ENABLED. The actual increase is done by the kernel task.
May also be called in task context, but that is less efficient (the request is bounced to the kernel task instead of being executed directly) — prefer vsf_eda_sync_increase() there.

◆ vsf_eda_sync_increase()

vsf_err_t vsf_eda_sync_increase ( vsf_sync_t * pthis)
extern

Increase a sync object, waking up the pending tasks if any.

Parameters
[in]pthisa pointer to structure vsf_sync_t
Returns
vsf_err_t: VSF_ERR_NONE if successful, VSF_ERR_OVERRUN if the count has reached the maximum
Note
A pending task is woken with VSF_EVT_SYNC.
Must be called in task context, NOT in interrupt context (in interrupt context use the corresponding _isr API if available).

◆ vsf_eda_sync_increase_ex()

vsf_err_t vsf_eda_sync_increase_ex ( vsf_sync_t * pthis,
vsf_eda_t * eda )
extern

Increase a sync object on behalf of the given eda (e.g. the owner of a mutex)

Parameters
[in]pthisa pointer to structure vsf_sync_t
[in]edaa pointer to structure vsf_eda_t, the current task if NULL
Returns
vsf_err_t: VSF_ERR_NONE if successful, VSF_ERR_OVERRUN if the count has reached the maximum
Note
Must be called in task context, NOT in interrupt context (in interrupt context use the corresponding _isr API if available).

◆ __vsf_eda_sync_increase_ex()

vsf_err_t __vsf_eda_sync_increase_ex ( vsf_sync_t * pthis,
vsf_eda_t * eda,
bool manual )
extern

Increase a sync object with an explicit manual-reset flag.

Parameters
[in]pthisa pointer to structure vsf_sync_t
[in]edaa pointer to structure vsf_eda_t, the current task if NULL
[in]manualtrue to keep the count set (manual-reset behavior for this increase)
Returns
vsf_err_t: VSF_ERR_NONE if successful, VSF_ERR_OVERRUN if the count has reached the maximum
Note
Internal use only.
Must be called in task context, NOT in interrupt context (in interrupt context use the corresponding _isr API if available).

◆ __vsf_eda_sync_decrease_ex()

vsf_err_t __vsf_eda_sync_decrease_ex ( vsf_sync_t * pthis,
vsf_timeout_tick_t timeout,
vsf_eda_t * eda,
bool manual )
extern

Decrease a sync object with an explicit manual-reset flag.

Parameters
[in]pthisa pointer to structure vsf_sync_t
[in]timeouttimeout in ticks; negative waits forever, 0 is a non-blocking try, a positive value waits up to the given ticks (requires timer support)
[in]edaa pointer to structure vsf_eda_t, the current task if NULL
[in]manualtrue to keep the count set when the resource is obtained
Returns
vsf_err_t: VSF_ERR_NONE if the resource is obtained immediately; VSF_ERR_NOT_READY if the caller pends or the try failed
Note
Internal use only.
Must be called in an eda task context (i.e. inside an event handler); must NOT be called in interrupt context.

◆ vsf_eda_sync_force_reset()

void vsf_eda_sync_force_reset ( vsf_sync_t * pthis)
extern

Force the count of a sync object to 0.

Parameters
[in]pthisa pointer to structure vsf_sync_t
Returns
none
Note
Must be called in task context, NOT in interrupt context (in interrupt context use the corresponding _isr API if available).

◆ vsf_eda_sync_decrease()

vsf_err_t vsf_eda_sync_decrease ( vsf_sync_t * pthis,
vsf_timeout_tick_t timeout )
extern

Decrease a sync object, pending if the resource is not available.

Parameters
[in]pthisa pointer to structure vsf_sync_t
[in]timeouttimeout in ticks; negative waits forever, 0 is a non-blocking try, a positive value waits up to the given ticks (requires timer support, i.e. the caller must be a teda task)
Returns
vsf_err_t: VSF_ERR_NONE if the resource is obtained immediately; VSF_ERR_NOT_READY if the caller pends or the try failed
Note
If VSF_ERR_NOT_READY is returned with a non-zero timeout, the caller is woken later with VSF_EVT_SYNC, VSF_EVT_TIMER (timeout) or VSF_EVT_SYNC_CANCEL; call vsf_eda_sync_get_reason() to retrieve the result.
Must be called in an eda task context (i.e. inside an event handler); must NOT be called in interrupt context.

◆ vsf_eda_sync_decrease_ex()

vsf_err_t vsf_eda_sync_decrease_ex ( vsf_sync_t * pthis,
vsf_timeout_tick_t timeout,
vsf_eda_t * eda )
extern

Decrease a sync object on behalf of the given eda.

Parameters
[in]pthisa pointer to structure vsf_sync_t
[in]timeouttimeout in ticks; negative waits forever, 0 is a non-blocking try, a positive value waits up to the given ticks (requires timer support)
[in]edaa pointer to structure vsf_eda_t, the current task if NULL
Returns
vsf_err_t: VSF_ERR_NONE if the resource is obtained immediately; VSF_ERR_NOT_READY if the caller pends or the try failed
Note
Must be called in an eda task context (i.e. inside an event handler); must NOT be called in interrupt context.

◆ vsf_eda_sync_cancel()

void vsf_eda_sync_cancel ( vsf_sync_t * pthis)
extern

Cancel all pending tasks on a sync object; they are woken with VSF_EVT_SYNC_CANCEL.

Parameters
[in]pthisa pointer to structure vsf_sync_t
Returns
none
Note
Must be called in task context, NOT in interrupt context (in interrupt context use the corresponding _isr API if available).

◆ vsf_eda_sync_get_reason()

vsf_sync_reason_t vsf_eda_sync_get_reason ( vsf_sync_t * pthis,
vsf_evt_t evt )
extern

Retrieve the result of a sync operation from the wakeup event.

Parameters
[in]pthisa pointer to structure vsf_sync_t
[in]evtthe wakeup event (VSF_EVT_SYNC, VSF_EVT_TIMER or VSF_EVT_SYNC_CANCEL)
Returns
vsf_sync_reason_t: VSF_SYNC_GET if the resource is obtained, VSF_SYNC_TIMEOUT on timeout, VSF_SYNC_CANCEL if cancelled, VSF_SYNC_PENDING if the sync was obtained before the timeout event and the wait should continue
Note
Must be called in an eda task context (i.e. inside an event handler); must NOT be called in interrupt context.

◆ vsf_eda_bmpevt_init()

vsf_err_t vsf_eda_bmpevt_init ( vsf_bmpevt_t * pthis,
uint_fast8_t adapter_count )
extern

Initialize a bitmap event, initializing the bound adapters as well.

Parameters
[in]pthisa pointer to structure vsf_bmpevt_t
[in]adapter_countnumber of adapters bound in the adapters member, up to 32
Returns
vsf_err_t: always VSF_ERR_NONE
Note
Only available when VSF_KERNEL_CFG_SUPPORT_BITMAP_EVENT is ENABLED.
Must be called in task (or initialization) context, NOT in interrupt context.

◆ vsf_eda_bmpevt_set()

vsf_err_t vsf_eda_bmpevt_set ( vsf_bmpevt_t * pthis,
uint_fast32_t mask )
extern

Set event bits of a bitmap event, polling the pending tasks.

Parameters
[in]pthisa pointer to structure vsf_bmpevt_t
[in]maskbitmask of the event bits to set
Returns
vsf_err_t: always VSF_ERR_NONE
Note
Only available when VSF_KERNEL_CFG_SUPPORT_BITMAP_EVENT is ENABLED. A matching pending task is woken with VSF_EVT_SYNC_POLL.
Must be called in task context, NOT in interrupt context (in interrupt context use the corresponding _isr API if available).

◆ vsf_eda_bmpevt_reset()

vsf_err_t vsf_eda_bmpevt_reset ( vsf_bmpevt_t * pthis,
uint_fast32_t mask )
extern

Reset (clear) event bits of a bitmap event, resetting the bound adapters whose bits are cleared.

Parameters
[in]pthisa pointer to structure vsf_bmpevt_t
[in]maskbitmask of the event bits to clear
Returns
vsf_err_t: always VSF_ERR_NONE
Note
Only available when VSF_KERNEL_CFG_SUPPORT_BITMAP_EVENT is ENABLED.
Must be called in task context, NOT in interrupt context (in interrupt context use the corresponding _isr API if available).

◆ vsf_eda_bmpevt_cancel()

vsf_err_t vsf_eda_bmpevt_cancel ( vsf_bmpevt_t * pthis,
uint_fast32_t mask )
extern

Cancel the pending tasks on a bitmap event whose mask intersects the given mask; they are woken with VSF_EVT_SYNC_CANCEL.

Parameters
[in]pthisa pointer to structure vsf_bmpevt_t
[in]maskbitmask of the event bits to cancel
Returns
vsf_err_t: always VSF_ERR_NONE
Note
Only available when VSF_KERNEL_CFG_SUPPORT_BITMAP_EVENT is ENABLED.
Must be called in task context, NOT in interrupt context (in interrupt context use the corresponding _isr API if available).

◆ vsf_eda_bmpevt_pend()

vsf_err_t vsf_eda_bmpevt_pend ( vsf_bmpevt_t * pthis,
vsf_bmpevt_pender_t * pender,
vsf_timeout_tick_t timeout )
extern

Pend on a bitmap event until the masked bits are set (in OR or AND mode according to the pender configuration)

Parameters
[in]pthisa pointer to structure vsf_bmpevt_t
[in]pendera pointer to structure vsf_bmpevt_pender_t holding the mask and the match mode (VSF_BMPEVT_OR or VSF_BMPEVT_AND)
[in]timeouttimeout in ticks; negative waits forever, 0 polls once without pending, a positive value waits up to the given ticks (requires timer support, i.e. the caller must be a teda task)
Returns
vsf_err_t: VSF_ERR_NONE if the event bits match immediately; VSF_ERR_NOT_READY if the caller pends or the poll failed; VSF_ERR_FAIL if the masked bits are cancelled
Note
Only available when VSF_KERNEL_CFG_SUPPORT_BITMAP_EVENT is ENABLED. A pending caller is woken with VSF_EVT_SYNC_POLL, VSF_EVT_TIMER (timeout) or VSF_EVT_SYNC_CANCEL, and must call vsf_eda_bmpevt_poll() to retrieve the result.
Must be called in an eda task context (i.e. inside an event handler); must NOT be called in interrupt context.

◆ vsf_eda_bmpevt_poll()

vsf_sync_reason_t vsf_eda_bmpevt_poll ( vsf_bmpevt_t * pthis,
vsf_bmpevt_pender_t * pender,
vsf_evt_t evt )
extern

Retrieve the result of a bitmap event pend from the wakeup event.

Parameters
[in]pthisa pointer to structure vsf_bmpevt_t
[in]pendera pointer to structure vsf_bmpevt_pender_t used in vsf_eda_bmpevt_pend()
[in]evtthe wakeup event (VSF_EVT_SYNC_POLL, VSF_EVT_TIMER or VSF_EVT_SYNC_CANCEL)
Returns
vsf_sync_reason_t: VSF_SYNC_GET if the event bits match, VSF_SYNC_TIMEOUT on timeout, VSF_SYNC_CANCEL if cancelled, VSF_SYNC_PENDING if the wait should continue
Note
Only available when VSF_KERNEL_CFG_SUPPORT_BITMAP_EVENT is ENABLED.
Must be called in an eda task context (i.e. inside an event handler); must NOT be called in interrupt context.

◆ vsf_eda_queue_init()

vsf_err_t vsf_eda_queue_init ( vsf_eda_queue_t * pthis,
uint_fast16_t max )
extern

Initialize an OS-aware queue whose enqueue/dequeue operations are provided by the user in the op member (vsf_eda_queue_op_t)

Parameters
[in]pthisa pointer to structure vsf_eda_queue_t
[in]maxmaximum number of nodes the queue can hold, must be greater than 0
Returns
vsf_err_t: always VSF_ERR_NONE (invalid parameters trigger an assertion)
Note
Only available when VSF_KERNEL_CFG_SUPPORT_EDA_QUEUE is ENABLED. The op member must be set before initialization (e.g. with the slist queue operations in vsf_eda_slist_queue.h).
Must be called in task (or initialization) context, NOT in interrupt context.

◆ vsf_eda_queue_send()

vsf_err_t vsf_eda_queue_send ( vsf_eda_queue_t * pthis,
void * node,
vsf_timeout_tick_t timeout )
extern

Send a node to a queue, pending while the queue is full.

Parameters
[in]pthisa pointer to structure vsf_eda_queue_t
[in]nodethe node to enqueue
[in]timeouttimeout in ticks; negative waits forever, 0 is a non-blocking try, a positive value waits up to the given ticks (requires timer support, i.e. the caller must be a teda task)
Returns
vsf_err_t: VSF_ERR_NONE if the node is enqueued immediately; VSF_ERR_NOT_READY if the queue is full and the caller pends or the try failed
Note
Only available when VSF_KERNEL_CFG_SUPPORT_EDA_QUEUE is ENABLED. If VSF_ERR_NOT_READY is returned with a non-zero timeout, the caller is woken later with VSF_EVT_SYNC, VSF_EVT_TIMER (timeout) or VSF_EVT_SYNC_CANCEL, and must call vsf_eda_queue_send_get_reason() to retry and retrieve the result.
Must be called in an eda task context (i.e. inside an event handler); must NOT be called in interrupt context.

◆ vsf_eda_queue_send_ex()

vsf_err_t vsf_eda_queue_send_ex ( vsf_eda_queue_t * pthis,
void * node,
vsf_timeout_tick_t timeout,
vsf_eda_t * eda )
extern

Send a node to a queue on behalf of the given eda.

Parameters
[in]pthisa pointer to structure vsf_eda_queue_t
[in]nodethe node to enqueue
[in]timeouttimeout in ticks; negative waits forever, 0 is a non-blocking try, a positive value waits up to the given ticks (requires timer support)
[in]edaa pointer to structure vsf_eda_t, the current task if NULL
Returns
vsf_err_t: VSF_ERR_NONE if the node is enqueued immediately; VSF_ERR_NOT_READY if the queue is full and the caller pends or the try failed
Note
Only available when VSF_KERNEL_CFG_SUPPORT_EDA_QUEUE is ENABLED.
Must be called in an eda task context (i.e. inside an event handler); must NOT be called in interrupt context.

◆ vsf_eda_queue_send_get_reason()

vsf_sync_reason_t vsf_eda_queue_send_get_reason ( vsf_eda_queue_t * pthis,
vsf_evt_t evt,
void * node )
extern

Retrieve the result of a queue send from the wakeup event, retrying the enqueue if the resource is obtained.

Parameters
[in]pthisa pointer to structure vsf_eda_queue_t
[in]evtthe wakeup event (VSF_EVT_SYNC, VSF_EVT_TIMER or VSF_EVT_SYNC_CANCEL)
[in]nodethe node passed to vsf_eda_queue_send()
Returns
vsf_sync_reason_t: VSF_SYNC_GET if the node is enqueued, VSF_SYNC_TIMEOUT on timeout, VSF_SYNC_CANCEL if cancelled, VSF_SYNC_PENDING if the wait should continue
Note
Only available when VSF_KERNEL_CFG_SUPPORT_EDA_QUEUE is ENABLED.
Must be called in an eda task context (i.e. inside an event handler); must NOT be called in interrupt context.

◆ vsf_eda_queue_recv()

vsf_err_t vsf_eda_queue_recv ( vsf_eda_queue_t * pthis,
void ** node,
vsf_timeout_tick_t timeout )
extern

Receive a node from a queue, pending while the queue is empty.

Parameters
[in]pthisa pointer to structure vsf_eda_queue_t
[out]nodea pointer to receive the dequeued node
[in]timeouttimeout in ticks; negative waits forever, 0 is a non-blocking try, a positive value waits up to the given ticks (requires timer support, i.e. the caller must be a teda task)
Returns
vsf_err_t: VSF_ERR_NONE if a node is dequeued immediately; VSF_ERR_NOT_READY if the queue is empty and the caller pends or the try failed
Note
Only available when VSF_KERNEL_CFG_SUPPORT_EDA_QUEUE is ENABLED. If VSF_ERR_NOT_READY is returned with a non-zero timeout, the caller is woken later with VSF_EVT_SYNC, VSF_EVT_TIMER (timeout) or VSF_EVT_SYNC_CANCEL, and must call vsf_eda_queue_recv_get_reason() to retry and retrieve the result.
Must be called in an eda task context (i.e. inside an event handler); must NOT be called in interrupt context.

◆ vsf_eda_queue_recv_ex()

vsf_err_t vsf_eda_queue_recv_ex ( vsf_eda_queue_t * pthis,
void ** node,
vsf_timeout_tick_t timeout,
vsf_eda_t * eda )
extern

Receive a node from a queue on behalf of the given eda.

Parameters
[in]pthisa pointer to structure vsf_eda_queue_t
[out]nodea pointer to receive the dequeued node
[in]timeouttimeout in ticks; negative waits forever, 0 is a non-blocking try, a positive value waits up to the given ticks (requires timer support)
[in]edaa pointer to structure vsf_eda_t, the current task if NULL
Returns
vsf_err_t: VSF_ERR_NONE if a node is dequeued immediately; VSF_ERR_NOT_READY if the queue is empty and the caller pends or the try failed
Note
Only available when VSF_KERNEL_CFG_SUPPORT_EDA_QUEUE is ENABLED.
Must be called in an eda task context (i.e. inside an event handler); must NOT be called in interrupt context.

◆ vsf_eda_queue_recv_get_reason()

vsf_sync_reason_t vsf_eda_queue_recv_get_reason ( vsf_eda_queue_t * pthis,
vsf_evt_t evt,
void ** node )
extern

Retrieve the result of a queue receive from the wakeup event, retrying the dequeue if the resource is obtained.

Parameters
[in]pthisa pointer to structure vsf_eda_queue_t
[in]evtthe wakeup event (VSF_EVT_SYNC, VSF_EVT_TIMER or VSF_EVT_SYNC_CANCEL)
[out]nodea pointer to receive the dequeued node
Returns
vsf_sync_reason_t: VSF_SYNC_GET if a node is dequeued, VSF_SYNC_TIMEOUT on timeout, VSF_SYNC_CANCEL if cancelled, VSF_SYNC_PENDING if the wait should continue
Note
Only available when VSF_KERNEL_CFG_SUPPORT_EDA_QUEUE is ENABLED.
Must be called in an eda task context (i.e. inside an event handler); must NOT be called in interrupt context.

◆ vsf_eda_queue_get_cnt()

uint_fast16_t vsf_eda_queue_get_cnt ( vsf_eda_queue_t * pthis)
extern

Get the number of nodes currently held in a queue.

Parameters
[in]pthisa pointer to structure vsf_eda_queue_t
Returns
uint_fast16_t: number of nodes in the queue
Note
Only available when VSF_KERNEL_CFG_SUPPORT_EDA_QUEUE is ENABLED.
Must be called in task context, NOT in interrupt context (in interrupt context use the corresponding _isr API if available).

◆ vsf_eda_queue_cancel()

void vsf_eda_queue_cancel ( vsf_eda_queue_t * pthis)
extern

Cancel all pending senders and the pending receiver on a queue; they are woken with VSF_EVT_SYNC_CANCEL.

Parameters
[in]pthisa pointer to structure vsf_eda_queue_t
Returns
none
Note
Only available when VSF_KERNEL_CFG_SUPPORT_EDA_QUEUE is ENABLED.
Must be called in task context, NOT in interrupt context (in interrupt context use the corresponding _isr API if available).

◆ vsf_eda_queue_send_isr()

vsf_err_t vsf_eda_queue_send_isr ( vsf_eda_queue_t * pthis,
void * node )
extern

Send a node to a queue from interrupt context.

Parameters
[in]pthisa pointer to structure vsf_eda_queue_t
[in]nodethe node to enqueue
Returns
vsf_err_t: VSF_ERR_NONE if the node is enqueued, VSF_ERR_NOT_READY if the queue is full
Note
Only available when VSF_EDA_QUEUE_CFG_SUPPORT_ISR is ENABLED. The receiver notification is done by the kernel task.
Intended for interrupt context: the node is enqueued directly, and the receiver wakeup is bounced to the kernel task. May also be called in task context, but vsf_eda_queue_send() is more efficient there.

◆ vsf_eda_queue_recv_isr()

vsf_err_t vsf_eda_queue_recv_isr ( vsf_eda_queue_t * pthis,
void ** node )
extern

Receive a node from a queue from interrupt context.

Parameters
[in]pthisa pointer to structure vsf_eda_queue_t
[out]nodea pointer to receive the dequeued node
Returns
vsf_err_t: VSF_ERR_NONE if a node is dequeued, VSF_ERR_NOT_READY if the queue is empty
Note
Only available when VSF_EDA_QUEUE_CFG_SUPPORT_ISR is ENABLED. The sender notification is done by the kernel task.
Intended for interrupt context: the node is dequeued directly, and the sender wakeup is bounced to the kernel task. May also be called in task context, but vsf_eda_queue_recv() is more efficient there.

Variable Documentation

◆ vsf_eda_bmpevt_adapter_sync_op

const vsf_bmpevt_adapter_op_t vsf_eda_bmpevt_adapter_sync_op
extern

Adapter operation table vsf_bmpevt_adapter_op_t used to bind a sync object to a bitmap event.

Note
Only available when VSF_KERNEL_CFG_SUPPORT_BITMAP_EVENT is ENABLED.

◆ vsf_eda_bmpevt_adapter_bmpevt_op

const vsf_bmpevt_adapter_op_t vsf_eda_bmpevt_adapter_bmpevt_op
extern

Adapter operation table vsf_bmpevt_adapter_op_t used to bind another bitmap event to a bitmap event.

Note
Only available when VSF_KERNEL_CFG_SUPPORT_BITMAP_EVENT is ENABLED.
Generated from commit: vsfteam/vsf@a5104db