|
VSF Documented
|
#include "kernel/vsf_kernel_cfg.h"#include "hal/arch/vsf_arch.h"#include "service/vsf_service.h"#include "./vsf_kernel_common.h"#include "utilities/ooc_class.h"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_t * | vsf_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. | |
| #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
| #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.
| [in] | sem | a pointer to structure vsf_sem_t |
| [in] | init_cnt | initial count, 0 by default |
| [in] | max_cnt | maximum count, VSF_SYNC_MAX by default |
| #define vsf_eda_sem_post | ( | __psem | ) |
Post (increase) a semaphore, waking up one pending task if any.
| [in] | sem | a pointer to structure vsf_sem_t |
| #define __vsf_eda_sem_pend1 | ( | __psem, | |
| __timeout ) |
| #define __vsf_eda_sem_pend0 | ( | __psem | ) |
| #define vsf_eda_sem_pend | ( | __psem, | |
| ... ) |
Pend (decrease) on a semaphore.
| [in] | sem | a pointer to structure vsf_sem_t |
| [in] | timeout | timeout 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) |
| #define vsf_eda_sem_post_isr | ( | __psem | ) |
Post (increase) a semaphore from interrupt context.
| [in] | sem | a pointer to structure vsf_sem_t |
| #define vsf_eda_mutex_init | ( | __pmtx | ) |
Initialize a mutex.
| [in] | mutex | a pointer to structure vsf_mutex_t |
| #define __vsf_eda_mutex_enter1 | ( | __pmtx, | |
| __timeout ) |
| #define __vsf_eda_mutex_enter0 | ( | __pmtx | ) |
| #define vsf_eda_mutex_enter | ( | __pmtx, | |
| ... ) |
Enter (lock) a mutex.
| [in] | mutex | a pointer to structure vsf_mutex_t |
| [in] | timeout | timeout 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) |
| #define vsf_eda_mutex_leave | ( | __pmtx | ) |
Leave (unlock) a mutex, waking up one pending task if any.
| [in] | mutex | a pointer to structure vsf_mutex_t |
| #define vsf_eda_mutex_leave_isr | ( | __pmtx | ) |
Leave (unlock) a mutex from interrupt context.
| [in] | mutex | a pointer to structure vsf_mutex_t |
| #define vsf_eda_crit_init | ( | __pcrit | ) |
Initialize a critical section.
| [in] | crit | a pointer to structure vsf_crit_t |
| #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()
| [in] | crit | a pointer to structure vsf_crit_t |
| [in] | timeout | timeout 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) |
| #define vsf_eda_crit_leave | ( | __pcrit | ) |
Leave a critical section, same semantics as vsf_eda_mutex_leave()
| [in] | crit | a pointer to structure vsf_crit_t |
| #define vsf_eda_trig_init | ( | __pevt, | |
| __set, | |||
| __auto_rst ) |
Initialize a trigger (a sync object with maximum count 1)
| [in] | trig | a pointer to structure vsf_trig_t |
| [in] | is_set | initial state, non-zero for set(triggered), 0 for reset |
| [in] | is_auto_rst | non-zero for auto-reset mode, 0 for manual-reset mode |
| #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.
| [in] | trig | a pointer to structure vsf_trig_t |
| [in] | manual | optional; 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 |
| #define vsf_eda_trig_reset | ( | __pevt | ) |
Reset a trigger to the untriggered state.
| [in] | trig | a pointer to structure vsf_trig_t |
| #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.
| [in] | trig | a pointer to structure vsf_trig_t |
| [in] | timeout | timeout 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) |
| #define vsf_eda_trig_set_isr | ( | __pevt | ) |
Set (trigger) a trigger from interrupt context.
| [in] | trig | a pointer to structure vsf_trig_t |
| #define __vsf_eda_crit_npb_init | ( | __pcrit | ) |
Initialize a critical section without priority boost.
| [in] | crit_npb | a pointer to structure __vsf_crit_npb_t |
| #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.
| [in] | crit_npb | a pointer to structure __vsf_crit_npb_t |
| [in] | timeout | timeout 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) |
| #define __vsf_eda_crit_npb_leave | ( | __pcrit | ) |
Leave a critical section without priority boost.
| [in] | crit_npb | a pointer to structure __vsf_crit_npb_t |
| #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.
| [in] | eda | a pointer to structure vsf_eda_t |
| [in] | prio | priority of the task, vsf_prio_inherit (inherit the current priority) by default |
| [in] | feature | task feature vsf_eda_feature_t, 0 by default |
| #define vsf_teda_init | ( | __teda, | |
| ... ) |
Initialize a teda (eda with timer support), same arguments as vsf_eda_init()
| [in] | teda | a pointer to structure vsf_teda_t |
| [in] | prio | priority of the task, vsf_prio_inherit by default |
| [in] | feature | task feature vsf_eda_feature_t, 0 by default |
| #define vsf_eda_return | ( | ... | ) |
Return from the current (sub-called) eda with an optional return value.
| [in] | return_value | optional return value passed back to the caller, 0 by default |
| #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.
| [in] | evthandler | event handler vsf_eda_evthandler_t of the sub-called task |
| [in] | local_size | optional size of the local variable storage, 0 by default |
| #define vsf_eda_call_param_eda | ( | __param_evthandler, | |
| __param, | |||
| ... ) |
Sub-call a parameterized eda event handler from the current task.
| [in] | param_evthandler | parameterized event handler vsf_param_eda_evthandler_t |
| [in] | param | target parameter passed to the handler |
| [in] | local_size | optional size of the local variable storage, 0 by default |
| #define vsf_eda_get_local | ( | ... | ) |
Get the local variable storage of a frame-based (sub-called) eda.
| [in] | eda | optional pointer to structure vsf_eda_t, the current task by default |
| #define __vsf_peda_local | ( | __name | ) |
| #define vsf_peda_local | ( | __name | ) |
Generate the local type name of a peda task.
| [in] | name | name of the peda task |
| #define vsf_peda_arg | ( | __name | ) |
Generate the argument type name of a peda task.
| [in] | name | name of the peda task |
| #define vsf_peda_func | ( | __name | ) |
Generate the event handler function name of a peda task.
| [in] | name | name of the peda task |
| #define vsf_peda_param | ( | __name | ) |
Generate the parameter type name of a peda task.
| [in] | name | name of the 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.
| [in] | name | name of the peda task |
| #define dcl_vsf_peda_ctx | ( | __name | ) |
Alias of declare_vsf_peda_ctx()
| [in] | name | name of the peda task |
| #define __declare_vsf_peda | ( | __name | ) |
| #define declare_vsf_peda | ( | __name | ) |
Declare a peda task type and its context types.
| [in] | name | name of the peda task |
| #define dcl_vsf_peda | ( | __name | ) |
Alias of declare_vsf_peda()
| [in] | name | name of the peda task |
| #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.
| [in] | decoration | declaration decoration (e.g. extern, static) |
| [in] | name | name of the peda task, followed by up to 7 additional handler names |
| #define dcl_vsf_peda_methods | ( | __decoration, | |
| ... ) |
Alias of declare_vsf_peda_methods()
| [in] | decoration | declaration decoration (e.g. extern, static) |
| [in] | name | name of the peda task, followed by up to 7 additional handler names |
| #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.
| [in] | name | name of the peda task, optionally followed by param, arg and local member definitions (use def_args(), def_locals() etc. as the sections) |
| #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.
| [in] | name | name of the peda task, optionally followed by param, arg and local member definitions |
| #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()
| [in] | name | name of the peda task, optionally followed by param, arg and local member definitions |
| #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()
| [in] | peda | a pointer to the peda task structure |
| [in] | cfg | a pointer to structure vsf_eda_cfg_t |
| #define __init_vsf_peda | ( | __name, | |
| __param_eda, | |||
| __pri, | |||
| ... ) |
| #define init_vsf_peda | ( | __name, | |
| __param_eda, | |||
| __pri, | |||
| ... ) |
Initialize and start a peda (parameterized eda) task.
| [in] | name | name of the peda task |
| [in] | param_eda | a pointer to the peda task instance |
| [in] | pri | priority of the task |
| [in] | ... | optional extra initializers of vsf_eda_cfg_t |
| #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.
| [in] | name | name of the peda task, optionally followed by a custom function name |
| #define imp_vsf_peda | ( | ... | ) |
Alias of implement_vsf_peda()
| [in] | name | name of the peda task, optionally followed by a custom function name |
| #define vsf_eda_call_peda | ( | __name, | |
| __param ) |
Sub-call a peda task with its parameter from the current task.
| [in] | name | name of the peda task |
| [in] | param | a pointer to the parameter (control block) of the peda 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
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.
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)
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.
define alias for vsf_eda_queue_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 |
| 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 |
| enum vsf_sync_reason_t |
| enum vsf_kernel_error_t |
Kernel error codes reported to vsf_kernel_err_report()
|
extern |
System timer tick handler; called by the user on every system tick to drive the kernel timers.
|
extern |
Get the current system timer tick count.
|
extern |
Get the tick duration between two tick counts, handling wrap-around.
| [in] | from_time | the start tick count |
| [in] | to_time | the end tick count |
|
extern |
Get the ticks elapsed from the given tick count to now.
| [in] | from_time | the start tick count |
Switch the current task to a new event handler and post VSF_EVT_INIT to it.
| [in] | evthandler | address of the new event handler vsf_eda_evthandler_t |
| 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.
| [in] | pthis | a pointer to structure vsf_eda_t |
| [in] | cfg | a pointer to structure vsf_eda_cfg_t holding the task configuration |
override the is_use_frame flag
|
extern |
|
extern |
Get the event currently being processed by the current task.
|
extern |
Get the pointer message carried by the current event (e.g. VSF_EVT_MESSAGE)
Check whether an eda owns a dedicated stack.
| [in] | pthis | a pointer to structure vsf_eda_t |
Return from the current (sub-called) eda with the given return value.
| [in] | return_value | return value passed back to the caller |
< top frame
< not force frame
|
extern |
Get the return value passed back by the sub-called task.
|
extern |
Yield the current task by posting VSF_EVT_YIELD to itself, so that it is dispatched again later.
|
extern |
Start measuring the CPU usage of an eda task.
| [in] | pthis | a pointer to structure vsf_eda_t |
| [in] | ctx | a pointer to user-provided structure vsf_cpu_usage_ctx_t, which must be kept valid until vsf_eda_cpu_usage_stop() is called |
|
extern |
Stop measuring the CPU usage of an eda task.
| [in] | pthis | a pointer to structure vsf_eda_t |
|
extern |
Set the user-defined bits in the feature of the current eda.
| [in] | value | the user value to set, up to VSF_KERNEL_CFG_EDA_USER_BITLEN bits |
|
extern |
Get the user-defined bits in the feature of the current eda.
Prepare a sub-call frame without dispatching VSF_EVT_INIT.
| [in] | evthandler | address of the event handler to call |
| [in] | param | target parameter of the new frame |
| [in] | local_size | size of the local variable storage |
Sub-call an event handler: prepare a frame and dispatch VSF_EVT_INIT.
| [in] | evthandler | address of the event handler to call |
| [in] | param | target parameter of the new frame |
| [in] | local_size | size of the local variable storage |
Switch the current frame to a new event handler with a target parameter and dispatch VSF_EVT_INIT.
| [in] | evthandler | address of the new event handler |
| [in] | param | target parameter |
|
extern |
Prepare an extended sub-call frame without dispatching VSF_EVT_INIT.
| [in] | func | address of the handler function to call |
| [in] | param | target parameter of the new frame |
| [in] | state | frame state __vsf_eda_frame_state_t (feature and local size) |
| [in] | is_sub_call | true for a sub-call (new frame), false to reuse the current frame |
if (NULL == param) { frame->param = pthis; //!< point to the current eda } else { frame->param = param; }
|
extern |
Extended sub-call: prepare a frame and dispatch VSF_EVT_INIT.
| [in] | func | address of the handler function to call |
| [in] | param | target parameter of the new frame |
| [in] | state | frame state __vsf_eda_frame_state_t (feature and local size) |
| [in] | is_sub_call | true for a sub-call (new frame), false to reuse the current frame |
Get the local variable storage of a frame-based eda.
| [in] | pthis | a pointer to structure vsf_eda_t |
Set the target parameter of the current frame of the current task.
| [in] | param | the target parameter to set |
|
extern |
Get the target parameter of the current frame of the current task.
|
extern |
Start a teda (eda with timer support) task with the given configuration and post VSF_EVT_INIT to it.
| [in] | pthis | a pointer to structure vsf_teda_t |
| [in] | cfg | a pointer to structure vsf_eda_cfg_t holding the task configuration |
|
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.
| [in] | tick | timer interval in ticks, must not be 0 |
|
extern |
Set a one-shot timer with an absolute due tick for the given teda task.
| [in] | this_ptr | a pointer to structure vsf_teda_t |
| [in] | due | absolute due tick count |
|
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.
| [in] | pthis | a pointer to structure vsf_teda_t |
| [in] | tick | timer interval in ticks, must not be 0 |
|
extern |
Cancel the pending timer of the current teda task.
|
extern |
Cancel the pending timer of the given teda task.
| [in] | pthis | a pointer to structure vsf_teda_t, the current task if NULL |
|
extern |
Initialize a task-independent callback timer; set the on_timer callback before adding the timer.
| [in] | timer | a pointer to structure vsf_callback_timer_t |
|
extern |
Add a callback timer with an absolute due tick.
| [in] | timer | a pointer to structure vsf_callback_timer_t |
| [in] | due | absolute due tick count, must not be 0 |
|
extern |
Add a callback timer with a relative interval in ticks.
| [in] | timer | a pointer to structure vsf_callback_timer_t |
| [in] | tick | timer interval in ticks |
|
extern |
Remove a callback timer before it expires.
| [in] | timer | a pointer to structure vsf_callback_timer_t |
|
extern |
Add a callback timer with an absolute due tick from interrupt context.
| [in] | timer | a pointer to structure vsf_callback_timer_t |
| [in] | due | absolute due tick count, must not be 0 |
|
extern |
Add a callback timer with a relative interval in ticks from interrupt context.
| [in] | timer | a pointer to structure vsf_callback_timer_t |
| [in] | tick | timer interval in ticks |
|
extern |
Remove a callback timer from interrupt context.
| [in] | timer | a pointer to structure vsf_callback_timer_t |
|
extern |
Notify the kernel of entering interrupt context.
|
extern |
Notify the kernel of leaving interrupt context.
| [in] | ctx | the context value returned by vsf_irq_enter() |
Post an event to an eda task.
| [in] | pthis | a pointer to structure vsf_eda_t |
| [in] | evt | the event to post |
Post a pointer message to an eda task; the task receives VSF_EVT_MESSAGE and retrieves the pointer with vsf_eda_get_cur_msg()
| [in] | pthis | a pointer to structure vsf_eda_t |
| [in] | msg | the message pointer to post, must be aligned (LSB must be 0) |
Post an event carrying a pointer message to an eda task; the pointer is retrieved with vsf_eda_get_cur_msg()
| [in] | pthis | a pointer to structure vsf_eda_t |
| [in] | evt | the event to post |
| [in] | msg | the message pointer carried with the event |
|
extern |
Initialize a sync object, the base of semaphore, mutex, trigger etc.
| [in] | pthis | a pointer to structure vsf_sync_t |
| [in] | cur_value | initial count, optionally OR-ed with VSF_SYNC_HAS_OWNER |
| [in] | max_value | maximum count (up to VSF_SYNC_MAX), optionally OR-ed with VSF_SYNC_AUTO_RST or VSF_SYNC_MANUAL_RST |
|
extern |
Increase a sync object from interrupt context.
| [in] | pthis | a pointer to structure vsf_sync_t |
|
extern |
Increase a sync object, waking up the pending tasks if any.
| [in] | pthis | a pointer to structure vsf_sync_t |
|
extern |
Increase a sync object on behalf of the given eda (e.g. the owner of a mutex)
| [in] | pthis | a pointer to structure vsf_sync_t |
| [in] | eda | a pointer to structure vsf_eda_t, the current task if NULL |
|
extern |
Increase a sync object with an explicit manual-reset flag.
| [in] | pthis | a pointer to structure vsf_sync_t |
| [in] | eda | a pointer to structure vsf_eda_t, the current task if NULL |
| [in] | manual | true to keep the count set (manual-reset behavior for this increase) |
|
extern |
Decrease a sync object with an explicit manual-reset flag.
| [in] | pthis | a pointer to structure vsf_sync_t |
| [in] | timeout | timeout in ticks; negative waits forever, 0 is a non-blocking try, a positive value waits up to the given ticks (requires timer support) |
| [in] | eda | a pointer to structure vsf_eda_t, the current task if NULL |
| [in] | manual | true to keep the count set when the resource is obtained |
|
extern |
Force the count of a sync object to 0.
| [in] | pthis | a pointer to structure vsf_sync_t |
|
extern |
Decrease a sync object, pending if the resource is not available.
| [in] | pthis | a pointer to structure vsf_sync_t |
| [in] | timeout | timeout 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) |
|
extern |
Decrease a sync object on behalf of the given eda.
| [in] | pthis | a pointer to structure vsf_sync_t |
| [in] | timeout | timeout in ticks; negative waits forever, 0 is a non-blocking try, a positive value waits up to the given ticks (requires timer support) |
| [in] | eda | a pointer to structure vsf_eda_t, the current task if NULL |
|
extern |
Cancel all pending tasks on a sync object; they are woken with VSF_EVT_SYNC_CANCEL.
| [in] | pthis | a pointer to structure vsf_sync_t |
|
extern |
Retrieve the result of a sync operation from the wakeup event.
| [in] | pthis | a pointer to structure vsf_sync_t |
| [in] | evt | the wakeup event (VSF_EVT_SYNC, VSF_EVT_TIMER or VSF_EVT_SYNC_CANCEL) |
|
extern |
Initialize a bitmap event, initializing the bound adapters as well.
| [in] | pthis | a pointer to structure vsf_bmpevt_t |
| [in] | adapter_count | number of adapters bound in the adapters member, up to 32 |
|
extern |
Set event bits of a bitmap event, polling the pending tasks.
| [in] | pthis | a pointer to structure vsf_bmpevt_t |
| [in] | mask | bitmask of the event bits to set |
|
extern |
Reset (clear) event bits of a bitmap event, resetting the bound adapters whose bits are cleared.
| [in] | pthis | a pointer to structure vsf_bmpevt_t |
| [in] | mask | bitmask of the event bits to clear |
|
extern |
Cancel the pending tasks on a bitmap event whose mask intersects the given mask; they are woken with VSF_EVT_SYNC_CANCEL.
| [in] | pthis | a pointer to structure vsf_bmpevt_t |
| [in] | mask | bitmask of the event bits to cancel |
|
extern |
Pend on a bitmap event until the masked bits are set (in OR or AND mode according to the pender configuration)
| [in] | pthis | a pointer to structure vsf_bmpevt_t |
| [in] | pender | a pointer to structure vsf_bmpevt_pender_t holding the mask and the match mode (VSF_BMPEVT_OR or VSF_BMPEVT_AND) |
| [in] | timeout | timeout 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) |
|
extern |
Retrieve the result of a bitmap event pend from the wakeup event.
| [in] | pthis | a pointer to structure vsf_bmpevt_t |
| [in] | pender | a pointer to structure vsf_bmpevt_pender_t used in vsf_eda_bmpevt_pend() |
| [in] | evt | the wakeup event (VSF_EVT_SYNC_POLL, VSF_EVT_TIMER or VSF_EVT_SYNC_CANCEL) |
|
extern |
Initialize an OS-aware queue whose enqueue/dequeue operations are provided by the user in the op member (vsf_eda_queue_op_t)
| [in] | pthis | a pointer to structure vsf_eda_queue_t |
| [in] | max | maximum number of nodes the queue can hold, must be greater than 0 |
|
extern |
Send a node to a queue, pending while the queue is full.
| [in] | pthis | a pointer to structure vsf_eda_queue_t |
| [in] | node | the node to enqueue |
| [in] | timeout | timeout 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) |
|
extern |
Send a node to a queue on behalf of the given eda.
| [in] | pthis | a pointer to structure vsf_eda_queue_t |
| [in] | node | the node to enqueue |
| [in] | timeout | timeout in ticks; negative waits forever, 0 is a non-blocking try, a positive value waits up to the given ticks (requires timer support) |
| [in] | eda | a pointer to structure vsf_eda_t, the current task if NULL |
|
extern |
Retrieve the result of a queue send from the wakeup event, retrying the enqueue if the resource is obtained.
| [in] | pthis | a pointer to structure vsf_eda_queue_t |
| [in] | evt | the wakeup event (VSF_EVT_SYNC, VSF_EVT_TIMER or VSF_EVT_SYNC_CANCEL) |
| [in] | node | the node passed to vsf_eda_queue_send() |
|
extern |
Receive a node from a queue, pending while the queue is empty.
| [in] | pthis | a pointer to structure vsf_eda_queue_t |
| [out] | node | a pointer to receive the dequeued node |
| [in] | timeout | timeout 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) |
|
extern |
Receive a node from a queue on behalf of the given eda.
| [in] | pthis | a pointer to structure vsf_eda_queue_t |
| [out] | node | a pointer to receive the dequeued node |
| [in] | timeout | timeout in ticks; negative waits forever, 0 is a non-blocking try, a positive value waits up to the given ticks (requires timer support) |
| [in] | eda | a pointer to structure vsf_eda_t, the current task if NULL |
|
extern |
Retrieve the result of a queue receive from the wakeup event, retrying the dequeue if the resource is obtained.
| [in] | pthis | a pointer to structure vsf_eda_queue_t |
| [in] | evt | the wakeup event (VSF_EVT_SYNC, VSF_EVT_TIMER or VSF_EVT_SYNC_CANCEL) |
| [out] | node | a pointer to receive the dequeued node |
|
extern |
Get the number of nodes currently held in a queue.
| [in] | pthis | a pointer to structure vsf_eda_queue_t |
|
extern |
Cancel all pending senders and the pending receiver on a queue; they are woken with VSF_EVT_SYNC_CANCEL.
| [in] | pthis | a pointer to structure vsf_eda_queue_t |
|
extern |
Send a node to a queue from interrupt context.
| [in] | pthis | a pointer to structure vsf_eda_queue_t |
| [in] | node | the node to enqueue |
|
extern |
Receive a node from a queue from interrupt context.
| [in] | pthis | a pointer to structure vsf_eda_queue_t |
| [out] | node | a pointer to receive the dequeued node |
|
extern |
Adapter operation table vsf_bmpevt_adapter_op_t used to bind a sync object to a bitmap event.
|
extern |
Adapter operation table vsf_bmpevt_adapter_op_t used to bind another bitmap event to a bitmap event.