|
VSF Documented
|
Go to the source code of this file.
Macros | |
| #define | VSF_KERNEL_CFG_EDA_SUPPORT_SIMPLE_FSM DISABLED |
| #define | vsf_this (*vsf_pthis) |
| #define | def_states(...) |
| Define the states of a simple fsm as an anonymous enum. | |
| #define | def_params(...) |
| Expand to the parameter declarations of the fsm initialiser. | |
| #define | vsf_args(...) |
| Expand to extra arguments with a leading comma, used to append arguments to the fsm initialiser call. | |
| #define | vsf_fsm(__name) |
| Expand to the type name of the fsm control block. | |
| #define | __def_fsm(__fsm_type, ...) |
| #define | def_fsm(__name, ...) |
| Define an fsm as a vsf task: define the fsm control block and declare its entry function. | |
| #define | def_simple_fsm(__name, ...) |
| Declare and define a simple fsm. | |
| #define | end_def_simple_fsm(...) |
| End a simple fsm definition started by def_simple_fsm(). It is empty and only used for coding style symmetry. | |
| #define | __declare_fsm(__name) |
| #define | declare_vsf_fsm(__name) |
| Declare an fsm (the fsm class and its control block type) before it is defined by def_simple_fsm(). | |
| #define | __extern_fsm_initialiser(__name, ...) |
| extern fsm initialisation function and provide function prototype as <__name>_fn, E.g extern_vsf_fsm_initialiser( demo_fsm ); we extern a function called: extern fsm_demo_fsm_t *demo_fsm_init( fsm_demo_fsm_t *fsm_ptr ); and a prototype definition: typedef fsm_demo_fsm_t *demo_fsm_init_fn( fsm_demo_fsm_t *fsm_ptr ); We can then use demo_fsm_init_fn to define function pointer | |
| #define | extern_vsf_fsm_initialiser(__name, ...) |
| Declare the initialiser function of an fsm and provide the corresponding function prototype. | |
| #define | call_vsf_fsm(__name, __fsm) |
| Call a sub-fsm from the current fsm, and wait until it finishes. | |
| #define | ____state(__state, ...) |
| #define | vsf_state(__state, ...) |
| Define a state of the fsm inside vsf_fsm_body() (or between vsf_fsm_begin() and vsf_fsm_end()). | |
| #define | on_start(...) |
| Define the code executed once when the fsm starts (state START). | |
| #define | reset_vsf_fsm() |
| Reset the fsm to its initial state. | |
| #define | vsf_fsm_cpl() |
| Reset the fsm and return fsm_rt_cpl to report completion. | |
| #define | vsf_fsm_report(__ERROR) |
| Reset the fsm and return the given value to report an error (or a user-defined result). | |
| #define | vsf_fsm_wait_for_obj() |
| Return fsm_rt_wait_for_obj, so the fsm waits for an object (e.g. a semaphore or a mutex). | |
| #define | vsf_fsm_on_going() |
| Return fsm_rt_on_going, so the fsm keeps running and resumes at the current state next time. | |
| #define | update_state_to(__state) |
| fsm_continue is deprecated, should not be used anymore | |
| #define | transfer_to(__state) |
| Set the fsm to the given state and return fsm_rt_on_going, so the target state is executed the next time the fsm runs. | |
| #define | __fsm_initialiser(__name, ...) |
| #define | vsf_fsm_initialiser(__name, ...) |
| Start the implementation of the fsm initialiser function <__name>_init(). | |
| #define | abort_vsf_fsm_init() |
| Abort the fsm initialiser by returning NULL. | |
| #define | vsf_fsm_init_body(...) |
| The body of the fsm initialiser, closed with returning the fsm control block pointer. | |
| #define | init_vsf_fsm(__name, __fsm, ...) |
| Initialize an fsm by calling its initialiser <__name>_init(). | |
| #define | init_simple_fsm(__name, __fsm, ...) |
| Initialize a simple fsm, mapped to init_vsf_fsm(). | |
| #define | start_vsf_fsm(__name, __fsm, __pri, ...) |
| Prepare and start an fsm as a vsf task. | |
| #define | start_simple_fsm(__name, __fsm, __pri, ...) |
| Alias of start_vsf_fsm(). | |
| #define | __implement_fsm_ex(__name, __type) |
| #define | __body(...) |
| #define | vsf_fsm_body(...) |
| The state-switch body of the fsm, containing all the states. | |
| #define | vsf_fsm_begin() |
| Begin the state-switch of the fsm, used together with vsf_fsm_end() instead of vsf_fsm_body(). | |
| #define | vsf_fsm_end() |
| End the state-switch started by vsf_fsm_begin(). | |
| #define | implement_fsm_ex(__name, __type) |
| Start the implementation of the fsm entry function, with a dedicated fsm type. | |
| #define | __implement_fsm(__name) |
| #define | implement_vsf_fsm(__name, ...) |
| Start the implementation of the fsm entry function. | |
| #define | __privilege_state(__state, ...) |
| #define | privilege_state(__state, ...) |
| Define a privilege state of the fsm: the state code is executed repeatedly within the current call until the state is changed (e.g. by update_state_to() or transfer_to()). | |
| #define | privilege_group(...) |
| Define a group of privilege states. | |
| #define | privilege_body(...) |
| The privilege state-switch body of the fsm: the states are executed in a loop within the current call, until a state returns (e.g. by transfer_to() or vsf_fsm_cpl()). | |
| #define | __FSM_RT_TYPE__ |
| #define | __extern_fsm_implementation_ex(__name, __type) |
| extern fsm task function and provide function prototype as <__name>_fn, E.g extern_vsf_fsm_implementation( demo_fsm ); we extern a function called: fsm_rt_t demo_fsm( fsm_demo_fsm_t *fsm_ptr ) and a prototype definition: typedef fsm_rt_t demo_fsm_fn (fsm_demo_fsm_t *fsm_ptr); We can then use demo_fsm_fn to define function pointer | |
| #define | declare_vsf_fsm_implementation_ex(__name, __type) |
| Declare the entry function of an fsm implementation and provide the corresponding function prototype, with a dedicated fsm type. | |
| #define | extern_vsf_fsm_implementation_ex(__name, __type) |
| Alias of declare_vsf_fsm_implementation_ex(). | |
| #define | extern_vsf_fsm_implementation(__name) |
| Declare the entry function of an fsm implementation and provide the corresponding function prototype. | |
| #define | declare_vsf_fsm_implementation(__name) |
| Alias of extern_vsf_fsm_implementation(). | |
Enumerations | |
finit vsf_state machine vsf_state | |
| enum | fsm_rt_t { fsm_rt_err = -1 , fsm_rt_cpl = 0 , fsm_rt_on_going = 1 , fsm_rt_wait_for_obj = 2 , fsm_rt_asyn = 3 } |
| #define VSF_KERNEL_CFG_EDA_SUPPORT_SIMPLE_FSM DISABLED |
| #define vsf_this (*vsf_pthis) |
| #define def_states | ( | ... | ) |
Define the states of a simple fsm as an anonymous enum.
| [in] | ... | the state names |
| #define def_params | ( | ... | ) |
Expand to the parameter declarations of the fsm initialiser.
| [in] | ... | the parameter declarations |
| #define vsf_args | ( | ... | ) |
Expand to extra arguments with a leading comma, used to append arguments to the fsm initialiser call.
| [in] | ... | the extra arguments |
| #define vsf_fsm | ( | __name | ) |
| #define __def_fsm | ( | __fsm_type, | |
| ... ) |
| #define def_fsm | ( | __name, | |
| ... ) |
Define an fsm as a vsf task: define the fsm control block and declare its entry function.
| [in] | __name | name of the fsm |
| [in] | ... | member variables of the fsm control block |
| #define def_simple_fsm | ( | __name, | |
| ... ) |
Declare and define a simple fsm.
| [in] | __name | name of the fsm |
| [in] | ... | member variables of the fsm control block |
| #define end_def_simple_fsm | ( | ... | ) |
End a simple fsm definition started by def_simple_fsm(). It is empty and only used for coding style symmetry.
| #define __declare_fsm | ( | __name | ) |
| #define declare_vsf_fsm | ( | __name | ) |
Declare an fsm (the fsm class and its control block type) before it is defined by def_simple_fsm().
| [in] | __name | name of the fsm |
| #define __extern_fsm_initialiser | ( | __name, | |
| ... ) |
extern fsm initialisation function and provide function prototype as <__name>_fn, E.g extern_vsf_fsm_initialiser( demo_fsm ); we extern a function called: extern fsm_demo_fsm_t *demo_fsm_init( fsm_demo_fsm_t *fsm_ptr ); and a prototype definition: typedef fsm_demo_fsm_t *demo_fsm_init_fn( fsm_demo_fsm_t *fsm_ptr ); We can then use demo_fsm_init_fn to define function pointer
| #define extern_vsf_fsm_initialiser | ( | __name, | |
| ... ) |
Declare the initialiser function of an fsm and provide the corresponding function prototype.
| [in] | __name | name of the fsm |
| [in] | ... | optional extra parameters of the initialiser, declared with def_params() |
extern fsm task function and provide function prototype as <__name>_fn, E.g extern_vsf_fsm_implementation( demo_fsm ); we extern a function called: fsm_rt_t demo_fsm( fsm_demo_fsm_t *fsm_ptr ) and a prototype definition: typedef fsm_rt_t demo_fsm_fn (fsm_demo_fsm_t *fsm_ptr); We can then use demo_fsm_fn to define function pointer
Declare the entry function of an fsm implementation and provide the corresponding function prototype, with a dedicated fsm type.
| [in] | __name | name of the fsm entry function |
| [in] | __type | name of the fsm type |
Alias of declare_vsf_fsm_implementation_ex().
| [in] | __name | name of the fsm entry function |
| [in] | __type | name of the fsm type |
| #define extern_vsf_fsm_implementation | ( | __name | ) |
Declare the entry function of an fsm implementation and provide the corresponding function prototype.
| [in] | __name | name of the fsm |
| #define declare_vsf_fsm_implementation | ( | __name | ) |
Alias of extern_vsf_fsm_implementation().
| [in] | __name | name of the fsm |
| #define call_vsf_fsm | ( | __name, | |
| __fsm ) |
Call a sub-fsm from the current fsm, and wait until it finishes.
| [in] | __name | name of the sub-fsm |
| [in] | __fsm | pointer to the control block of the sub-fsm |
| #define ____state | ( | __state, | |
| ... ) |
| #define vsf_state | ( | __state, | |
| ... ) |
Define a state of the fsm inside vsf_fsm_body() (or between vsf_fsm_begin() and vsf_fsm_end()).
| [in] | __state | name of the state, defined by def_states() |
| [in] | ... | the code executed in this state |
| #define on_start | ( | ... | ) |
Define the code executed once when the fsm starts (state START).
| [in] | ... | the code executed on start |
| #define reset_vsf_fsm | ( | ) |
| #define vsf_fsm_cpl | ( | ) |
Reset the fsm and return fsm_rt_cpl to report completion.
| #define vsf_fsm_report | ( | __ERROR | ) |
Reset the fsm and return the given value to report an error (or a user-defined result).
| [in] | __ERROR | the value returned as fsm_rt_t |
| #define vsf_fsm_wait_for_obj | ( | ) |
Return fsm_rt_wait_for_obj, so the fsm waits for an object (e.g. a semaphore or a mutex).
| #define vsf_fsm_on_going | ( | ) |
Return fsm_rt_on_going, so the fsm keeps running and resumes at the current state next time.
| #define update_state_to | ( | __state | ) |
fsm_continue is deprecated, should not be used anymore
Set the fsm to the given state and jump to its entry within the current call.
| [in] | __state | name of the target state, defined by def_states() |
| #define transfer_to | ( | __state | ) |
Set the fsm to the given state and return fsm_rt_on_going, so the target state is executed the next time the fsm runs.
| [in] | __state | name of the target state, defined by def_states() |
| #define __fsm_initialiser | ( | __name, | |
| ... ) |
| #define vsf_fsm_initialiser | ( | __name, | |
| ... ) |
Start the implementation of the fsm initialiser function <__name>_init().
| [in] | __name | name of the fsm |
| [in] | ... | optional extra parameters of the initialiser, declared with def_params() |
| #define abort_vsf_fsm_init | ( | ) |
Abort the fsm initialiser by returning NULL.
| #define vsf_fsm_init_body | ( | ... | ) |
The body of the fsm initialiser, closed with returning the fsm control block pointer.
| [in] | ... | the initialisation code |
| #define init_vsf_fsm | ( | __name, | |
| __fsm, | |||
| ... ) |
| #define init_simple_fsm | ( | __name, | |
| __fsm, | |||
| ... ) |
Initialize a simple fsm, mapped to init_vsf_fsm().
| [in] | __name | name of the fsm |
| [in] | __fsm | pointer to the fsm control block |
| [in] | ... | optional extra arguments of the initialiser |
| #define start_vsf_fsm | ( | __name, | |
| __fsm, | |||
| __pri, | |||
| ... ) |
Prepare and start an fsm as a vsf task.
| [in] | __name | name of the fsm |
| [in] | __fsm | pointer to the fsm instance |
| [in] | __pri | priority of the fsm task, of type vsf_prio_t |
| [in] | ... | optional extra initializers for vsf_eda_cfg_t |
| #define start_simple_fsm | ( | __name, | |
| __fsm, | |||
| __pri, | |||
| ... ) |
Alias of start_vsf_fsm().
| [in] | __name | name of the fsm |
| [in] | __fsm | pointer to the fsm instance |
| [in] | __pri | priority of the fsm task, of type vsf_prio_t |
| [in] | ... | optional extra initializers for vsf_eda_cfg_t |
| #define __body | ( | ... | ) |
| #define vsf_fsm_body | ( | ... | ) |
The state-switch body of the fsm, containing all the states.
| [in] | ... | the states defined by vsf_state() |
| #define vsf_fsm_begin | ( | ) |
Begin the state-switch of the fsm, used together with vsf_fsm_end() instead of vsf_fsm_body().
| #define vsf_fsm_end | ( | ) |
End the state-switch started by vsf_fsm_begin().
Start the implementation of the fsm entry function, with a dedicated fsm type.
vsf_fsm_begin()
vsf_state(xxxxx,
the range no debug is allowed )vsf_state(xxxxx){ the range you can debug with }
| [in] | __name | name of the fsm entry function |
| [in] | __type | name of the fsm type |
| #define __implement_fsm | ( | __name | ) |
| #define implement_vsf_fsm | ( | __name, | |
| ... ) |
Start the implementation of the fsm entry function.
| [in] | __name | name of the fsm |
| [in] | ... | unused, kept for symmetry |
| #define __privilege_state | ( | __state, | |
| ... ) |
| #define privilege_state | ( | __state, | |
| ... ) |
Define a privilege state of the fsm: the state code is executed repeatedly within the current call until the state is changed (e.g. by update_state_to() or transfer_to()).
| [in] | __state | name of the state, defined by def_states() |
| [in] | ... | the code executed in this state |
| #define privilege_group | ( | ... | ) |
Define a group of privilege states.
| [in] | ... | the privilege states defined by privilege_state() |
| #define privilege_body | ( | ... | ) |
The privilege state-switch body of the fsm: the states are executed in a loop within the current call, until a state returns (e.g. by transfer_to() or vsf_fsm_cpl()).
| [in] | ... | the states defined by vsf_state() or privilege_state() |
| #define __FSM_RT_TYPE__ |
| enum fsm_rt_t |