|
VSF Documented
|
#include "./kernel/vsf_kernel_cfg.h"#include "service/vsf_service.h"#include "../vsf_eda.h"#include "./vsf_pt.h"#include "./vsf_fsm.h"Go to the source code of this file.
Macros | |
| #define | __vsf_task_func(__name) |
| #define | vsf_task_func(__name) |
| Expand to the name of the task entry function. | |
| #define | __vsf_task(__name) |
| #define | vsf_task(__name) |
| Expand to the type name of the task control block. | |
| #define | __implement_vsf_task(__name) |
| #define | vsf_task_begin() |
| Begin the task entry function body. | |
| #define | vsf_task_end() |
| End the task entry function body started by implement_vsf_task(). | |
| #define | vsf_task_state (vsf_this.fsm_state) |
| Expand to the current state of the task control block. | |
| #define | implement_vsf_task(__name) |
| Start the implementation of the task entry function. | |
| #define | imp_vsf_task(__name) |
| Alias of implement_vsf_task(). | |
| #define | vsf_task_start vsf_teda_start |
| Start a task with the given configuration. In this variant (VSF_KERNEL_CFG_EDA_SUPPORT_TIMER is ENABLED) it is mapped to vsf_teda_start(), so timer services are available to the task. | |
| #define | __def_vsf_task(__name, ...) |
| #define | def_vsf_task(__name, ...) |
| Define a task control block and declare its entry function. | |
| #define | define_vsf_task(__name, ...) |
| Alias of def_vsf_task(). | |
| #define | end_def_vsf_task(...) |
| End a task definition started by def_vsf_task(). It is empty and only used for coding style symmetry. | |
| #define | end_define_vsf_task(...) |
| Alias of end_def_vsf_task(). | |
| #define | __declare_vsf_task(__name) |
| #define | declare_vsf_task(__name) |
| Declare a task (the task class and its control block type) before it is defined by def_vsf_task(). | |
| #define | dcl_vsf_task(__name) |
| Alias of declare_vsf_task(). | |
| #define | prepare_vsf_task(__name, __task) |
| Prepare a task control block before the task is started, i.e. reset the task state. | |
| #define | prp_vsf_task(__name, __task) |
| Alias of prepare_vsf_task(). | |
| #define | __init_vsf_task(__name, __task, __pri, ...) |
| #define | init_vsf_task(__name, __task, __pri, ...) |
| Prepare and start a task defined by def_vsf_task(). | |
| #define | vsf_task_call_task(__name, __target, ...) |
| Call another task as a sub-task from the current task, and wait until it finishes. | |
| #define | vsf_task_call_sub(__name, __target, ...) |
| Call an event-driven subroutine (sub-eda) from the current task. | |
| #define | vsf_eda_call_task vsf_task_call_task |
| Alias of vsf_task_call_task(). | |
| #define | vsf_task_call_pt(__name, __target) |
| Call a protothread (pt) as a subroutine from the current task. | |
| #define | on_vsf_task_init() |
| Condition helper checking whether the current event is VSF_EVT_INIT, i.e. the task is started. | |
| #define | on_vsf_task_fini() |
| Condition helper checking whether the current event is VSF_EVT_FINI, i.e. the task is about to terminate. | |
| #define | on_vsf_task_evt(__evt) |
| Condition helper checking whether the current event is the given event. | |
| #define | vsf_task_wait_until(...) |
| Wait cooperatively until the given condition is satisfied. | |
Typedefs | |
| typedef vsf_teda_t | vsf_task_t |
| Cooperative task type, alias of vsf_teda_t when VSF_KERNEL_CFG_EDA_SUPPORT_TIMER is ENABLED; the base type produced by def_vsf_task() | |
| typedef fsm_rt_t(* | vsf_task_entry_t) (uintptr_t target, vsf_evt_t evt) |
| Task entry function (the event handler of the task), returning fsm_rt_t when VSF_KERNEL_CFG_EDA_SUBCALL_HAS_RETURN_VALUE is ENABLED. | |
Functions | |
| fsm_rt_t | __vsf_eda_call_task (vsf_task_entry_t entry, uintptr_t param, size_t local_size) |
| Call a task as a sub-task and wait for its return value. | |
| #define __vsf_task_func | ( | __name | ) |
| #define vsf_task_func | ( | __name | ) |
Expand to the name of the task entry function.
| [in] | __name | name of the task |
| #define vsf_task | ( | __name | ) |
Expand to the type name of the task control block.
| [in] | __name | name of the task |
| #define __implement_vsf_task | ( | __name | ) |
| #define vsf_task_begin | ( | ) |
Begin the task entry function body.
| #define vsf_task_end | ( | ) |
End the task entry function body started by implement_vsf_task().
| #define vsf_task_state (vsf_this.fsm_state) |
Expand to the current state of the task control block.
| #define implement_vsf_task | ( | __name | ) |
Start the implementation of the task entry function.
| [in] | __name | name of the task |
| #define imp_vsf_task | ( | __name | ) |
Alias of implement_vsf_task().
| [in] | __name | name of the task |
| #define vsf_task_start vsf_teda_start |
Start a task with the given configuration. In this variant (VSF_KERNEL_CFG_EDA_SUPPORT_TIMER is ENABLED) it is mapped to vsf_teda_start(), so timer services are available to the task.
| [in] | __task | pointer to the task, of type vsf_task_t |
| [in] | __cfg | pointer to the task configuration, of type vsf_eda_cfg_t |
| #define __def_vsf_task | ( | __name, | |
| ... ) |
| #define def_vsf_task | ( | __name, | |
| ... ) |
Define a task control block and declare its entry function.
| [in] | __name | name of the task |
| [in] | ... | member variables of the task control block |
| #define define_vsf_task | ( | __name, | |
| ... ) |
Alias of def_vsf_task().
| [in] | __name | name of the task |
| [in] | ... | member variables of the task control block |
| #define end_def_vsf_task | ( | ... | ) |
End a task definition started by def_vsf_task(). It is empty and only used for coding style symmetry.
| #define end_define_vsf_task | ( | ... | ) |
Alias of end_def_vsf_task().
| #define __declare_vsf_task | ( | __name | ) |
| #define declare_vsf_task | ( | __name | ) |
Declare a task (the task class and its control block type) before it is defined by def_vsf_task().
| [in] | __name | name of the task |
| #define dcl_vsf_task | ( | __name | ) |
Alias of declare_vsf_task().
| [in] | __name | name of the task |
| #define prepare_vsf_task | ( | __name, | |
| __task ) |
Prepare a task control block before the task is started, i.e. reset the task state.
| [in] | __name | name of the task |
| [in] | __task | pointer to the task control block |
| #define prp_vsf_task | ( | __name, | |
| __task ) |
Alias of prepare_vsf_task().
| [in] | __name | name of the task |
| [in] | __task | pointer to the task control block |
| #define __init_vsf_task | ( | __name, | |
| __task, | |||
| __pri, | |||
| ... ) |
| #define init_vsf_task | ( | __name, | |
| __task, | |||
| __pri, | |||
| ... ) |
Prepare and start a task defined by def_vsf_task().
| [in] | __name | name of the task |
| [in] | __task | pointer to the task instance |
| [in] | __pri | priority of the task, of type vsf_prio_t |
| [in] | ... | optional extra initializers for vsf_eda_cfg_t |
| #define vsf_task_call_task | ( | __name, | |
| __target, | |||
| ... ) |
Call another task as a sub-task from the current task, and wait until it finishes.
| [in] | __name | name of the sub-task |
| [in] | __target | pointer to the control block of the sub-task |
| [in] | ... | optional size of the local variables of the sub-task frame |
| #define vsf_task_call_sub | ( | __name, | |
| __target, | |||
| ... ) |
Call an event-driven subroutine (sub-eda) from the current task.
| [in] | __name | entry function of the subroutine |
| [in] | __target | pointer to the target (parameter) of the subroutine |
| [in] | ... | optional size of the local variables of the sub-frame |
| #define vsf_eda_call_task vsf_task_call_task |
Alias of vsf_task_call_task().
| [in] | __name | name of the sub-task |
| [in] | __target | pointer to the control block of the sub-task |
| [in] | ... | optional size of the local variables of the sub-task frame |
| #define vsf_task_call_pt | ( | __name, | |
| __target ) |
Call a protothread (pt) as a subroutine from the current task.
| [in] | __name | name of the protothread |
| [in] | __target | pointer to the control block of the protothread |
| #define on_vsf_task_init | ( | ) |
Condition helper checking whether the current event is VSF_EVT_INIT, i.e. the task is started.
| #define on_vsf_task_fini | ( | ) |
Condition helper checking whether the current event is VSF_EVT_FINI, i.e. the task is about to terminate.
| #define on_vsf_task_evt | ( | __evt | ) |
Condition helper checking whether the current event is the given event.
| [in] | __evt | the event to check, of type vsf_evt_t |
| #define vsf_task_wait_until | ( | ... | ) |
Wait cooperatively until the given condition is satisfied.
For VSF_EVT_XXXX, please use: vsf_task_wait_until( on_vsf_task_evt(VSF_EVT_XXXXX) ) ;
For semaphore, please use: vsf_task_wait_until( vsf_sem_pend(...) ) ; For time, please use: vsf_task_wait_until( vsf_delay(...) ) ;
| [in] | ... | the condition to wait for, e.g. on_vsf_task_evt(XXX), vsf_sem_pend(...) or vsf_delay(...) |
| typedef vsf_teda_t vsf_task_t |
Cooperative task type, alias of vsf_teda_t when VSF_KERNEL_CFG_EDA_SUPPORT_TIMER is ENABLED; the base type produced by def_vsf_task()
Task entry function (the event handler of the task), returning fsm_rt_t when VSF_KERNEL_CFG_EDA_SUBCALL_HAS_RETURN_VALUE is ENABLED.
| [in] | target | target (parameter) passed to the task |
| [in] | evt | the event to be handled |
|
extern |
Call a task as a sub-task and wait for its return value.
| [in] | entry | entry function of the sub-task, of type vsf_task_entry_t |
| [in] | param | pointer to the target (parameter) of the sub-task |
| [in] | local_size | size of the local variables of the sub-task frame |
Since in either way, we will yield, no need to handle the return value of vsf_eda_call().