|
VSF Documented
|
#include "kernel/vsf_kernel_cfg.h"#include "../vsf_eda.h"#include "./vsf_task.h"#include "utilities/ooc_class.h"Go to the source code of this file.
Macros | |
| #define | VSF_KERNEL_CFG_THREAD_STACK_PAGE_SIZE 1 |
| #define | VSF_KERNEL_CFG_THREAD_STACK_GUARDIAN_SIZE 0 |
| #define | VSF_KERNEL_CFG_THREAD_STACK_ALIGN_BIT 3 |
| #define | __VSF_THREAD_STACK_SAFE_SIZE(__stack) |
| #define | __declare_vsf_thread(__name) |
| #define | declare_vsf_thread(__name) |
| Declare a thread type with embedded stack. | |
| #define | declare_vsf_thread_ex(__name) |
| Declare a thread type using an external stack, same as declare_vsf_thread. | |
| #define | dcl_vsf_thread(__name) |
| Alias of declare_vsf_thread. | |
| #define | dcl_vsf_thread_ex(__name) |
| Alias of declare_vsf_thread_ex. | |
| #define | __vsf_thread_set_stack_canery(__thread, __task) |
| #define | __vsf_thread_set_stack(__thread, __task, __stack_ptr, __stack_bytesize) |
| #define | __vsf_thread_def_stack(__name, __bytesize) |
| #define | __vsf_thread_def_stack_member(__name, __bytesize) |
| #define | __vsf_thread_imp_stack(__name, __thread, __task) |
| #define | __vsf_eda_call_thread_prepare_stack(__name, __thread) |
| #define | __def_vsf_thread(__name, __stack_bytesize, ...) |
| #define | __implement_vsf_thread(__name) |
| #define | __vsf_eda_call_thread_prepare(__name, __thread_cb) |
| #define | vsf_eda_call_thread_prepare(__name, __thread_cb) |
| Prepare a thread control block before the current eda calls a thread. | |
| #define | vsf_eda_call_thread(__thread_cb) |
| Call a prepared thread from the current eda and wait for its completion. | |
| #define | __def_vsf_thread_ex(__name, ...) |
| #define | __implement_vsf_thread_ex(__name) |
| #define | __vsf_eda_call_thread_prepare_ex__( __name, __thread_cb, __stack, __stack_bytesize) |
| #define | vsf_eda_call_thread_prepare_ex( __name, __thread_cb, __stack, __stack_bytesize) |
| Prepare a thread control block with an external stack before the current eda calls a thread. | |
| #define | vsf_eda_call_thread_ex(__thread_cb) |
| Call a prepared thread (defined by def_vsf_thread_ex) from the current eda and wait for its completion. | |
| #define | def_vsf_thread(__name, __stack_bytesize, ...) |
| Define a thread type with embedded stack. | |
| #define | define_vsf_thread(__name, __stack_bytesize, ...) |
| Alias of def_vsf_thread. | |
| #define | def_vsf_thread_ex(__name, ...) |
| Define a thread type using an external stack. | |
| #define | define_vsf_thread_ex(__name, ...) |
| Alias of def_vsf_thread_ex. | |
| #define | end_def_vsf_thread(...) |
| Mark the end of a thread definition, no-op, for readability only. | |
| #define | end_define_vsf_thread(...) |
| Alias of end_def_vsf_thread. | |
| #define | implement_vsf_thread(__name) |
| Implement the entry body of a thread type. | |
| #define | implement_vsf_thread_ex(__name) |
| Implement the entry body of a thread type using an external stack. | |
| #define | imp_vsf_thread(__name) |
| Alias of implement_vsf_thread. | |
| #define | imp_vsf_thread_ex(__name) |
| Alias of implement_vsf_thread_ex. | |
| #define | __init_vsf_thread(__name, __task, __pri) |
| #define | __init_vsf_thread_ex(__name, __task, __pri, __stack, __stack_bytesize) |
| #define | init_vsf_thread(__name, __task, __pri) |
| Initialize and start an instance of a thread type with embedded stack. | |
| #define | init_vsf_thread_ex(__name, __task, __pri, __stack, __stack_bytesize) |
| Initialize and start an instance of a thread type with an external stack. | |
| #define | __vsf_thread(__name) |
| #define | vsf_thread(__name) |
| Get the thread control block type of a thread type. | |
| #define | vsf_thread_wfm vsf_thread_wait_for_msg |
| Short alias of vsf_thread_wait_for_msg. | |
| #define | vsf_thread_wfe vsf_thread_wait_for_evt |
| Short alias of vsf_thread_wait_for_evt. | |
| #define | vsf_thread_wfem vsf_thread_wait_for_evt_msg |
| Short alias of vsf_thread_wait_for_evt_msg. | |
| #define | __vsf_thread_call_sub(__name, __target, ...) |
| #define | vsf_thread_call_sub(__name, __target, ...) |
| Call an eda (event-driven task) sub-routine from a thread and wait for its completion. | |
| #define | vsf_thread_call_pt(__name, __target, ...) |
| Call a pt (protothread) from a thread and wait for its completion. | |
| #define | vsf_thread_call_task(__name, __target, ...) |
| Call a task from a thread and wait for its completion. | |
| #define | vsf_thread_delay_ms(__ms) |
| Delay (sleep) the current thread for the given milliseconds. | |
| #define | vsf_thread_delay_us(__us) |
| Delay (sleep) the current thread for the given microseconds. | |
| #define | vsf_thread_sem_post(__sem) |
| Post a semaphore inside a thread, non-blocking alias of vsf_eda_sem_post. | |
| #define | vsf_thread_sem_pend(__sem, timeout) |
| Pend on a semaphore inside a thread. | |
| #define | vsf_thread_trig_set(__trig, ...) |
| Set a trigger inside a thread, non-blocking alias of vsf_eda_trig_set. | |
| #define | vsf_thread_trig_reset(__trig) |
| Reset a trigger inside a thread, alias of vsf_eda_trig_reset. | |
| #define | vsf_thread_trig_pend(__trig, timeout) |
| Pend on a trigger inside a thread. | |
| #define | vsf_thread_mutex_enter(__mtx, timeout) |
| Enter (acquire) a mutex inside a thread. | |
Functions | |
| declare_class (vsf_thread_t) typedef void vsf_thread_sighandler_t(vsf_thread_t *thread | |
| POSIX-like thread signal handler, invoked when a signal is delivered to the thread. | |
| declare_class (vsf_thread_cb_t) typedef void vsf_thread_entry_t(vsf_thread_cb_t *thread) | |
| Thread entry function, called on the thread's own stack. | |
Variables | |
| int | sig |
| #define VSF_KERNEL_CFG_THREAD_STACK_PAGE_SIZE 1 |
| #define VSF_KERNEL_CFG_THREAD_STACK_GUARDIAN_SIZE 0 |
| #define VSF_KERNEL_CFG_THREAD_STACK_ALIGN_BIT 3 |
| #define __VSF_THREAD_STACK_SAFE_SIZE | ( | __stack | ) |
| #define __declare_vsf_thread | ( | __name | ) |
| #define declare_vsf_thread | ( | __name | ) |
Declare a thread type with embedded stack.
| [in] | __name | name of the thread type to declare |
| #define declare_vsf_thread_ex | ( | __name | ) |
Declare a thread type using an external stack, same as declare_vsf_thread.
| [in] | __name | name of the thread type to declare |
| #define dcl_vsf_thread | ( | __name | ) |
Alias of declare_vsf_thread.
| [in] | __name | name of the thread type to declare |
| #define dcl_vsf_thread_ex | ( | __name | ) |
Alias of declare_vsf_thread_ex.
| [in] | __name | name of the thread type to declare |
| #define __vsf_thread_set_stack_canery | ( | __thread, | |
| __task ) |
| #define __vsf_thread_set_stack | ( | __thread, | |
| __task, | |||
| __stack_ptr, | |||
| __stack_bytesize ) |
| #define __vsf_thread_def_stack | ( | __name, | |
| __bytesize ) |
| #define __vsf_thread_def_stack_member | ( | __name, | |
| __bytesize ) |
| #define __vsf_thread_imp_stack | ( | __name, | |
| __thread, | |||
| __task ) |
| #define __vsf_eda_call_thread_prepare_stack | ( | __name, | |
| __thread ) |
| #define __def_vsf_thread | ( | __name, | |
| __stack_bytesize, | |||
| ... ) |
| #define __implement_vsf_thread | ( | __name | ) |
| #define __vsf_eda_call_thread_prepare | ( | __name, | |
| __thread_cb ) |
| #define vsf_eda_call_thread_prepare | ( | __name, | |
| __thread_cb ) |
Prepare a thread control block before the current eda calls a thread.
| [in] | __name | name of the thread type defined by def_vsf_thread |
| [in] | __thread_cb | a pointer to the thread control block instance, of type vsf_thread(__name) |
| #define vsf_eda_call_thread | ( | __thread_cb | ) |
Call a prepared thread from the current eda and wait for its completion.
| [in] | __thread_cb | a pointer to the thread control block prepared by vsf_eda_call_thread_prepare |
| #define __def_vsf_thread_ex | ( | __name, | |
| ... ) |
| #define __implement_vsf_thread_ex | ( | __name | ) |
| #define __vsf_eda_call_thread_prepare_ex__ | ( | __name, | |
| __thread_cb, | |||
| __stack, | |||
| __stack_bytesize ) |
| #define vsf_eda_call_thread_prepare_ex | ( | __name, | |
| __thread_cb, | |||
| __stack, | |||
| __stack_bytesize ) |
Prepare a thread control block with an external stack before the current eda calls a thread.
| [in] | __name | name of the thread type defined by def_vsf_thread_ex |
| [in] | __thread_cb | a pointer to the thread control block instance, of type vsf_thread(__name) |
| [in] | __stack | a pointer to the external stack |
| [in] | __stack_bytesize | size of the external stack in bytes |
| #define vsf_eda_call_thread_ex | ( | __thread_cb | ) |
Call a prepared thread (defined by def_vsf_thread_ex) from the current eda and wait for its completion.
| [in] | __thread_cb | a pointer to the thread control block prepared by vsf_eda_call_thread_prepare_ex |
| #define def_vsf_thread | ( | __name, | |
| __stack_bytesize, | |||
| ... ) |
Define a thread type with embedded stack.
| [in] | __name | name of the thread type, declared by declare_vsf_thread |
| [in] | __stack_bytesize | size of the embedded stack in bytes |
| [in] | ... | additional member variables bound to the thread, accessible via vsf_this/vsf_pthis in the thread entry |
| #define define_vsf_thread | ( | __name, | |
| __stack_bytesize, | |||
| ... ) |
Alias of def_vsf_thread.
| [in] | __name | name of the thread type, declared by declare_vsf_thread |
| [in] | __stack_bytesize | size of the embedded stack in bytes |
| [in] | ... | additional member variables bound to the thread |
| #define def_vsf_thread_ex | ( | __name, | |
| ... ) |
Define a thread type using an external stack.
| [in] | __name | name of the thread type, declared by declare_vsf_thread_ex |
| [in] | ... | additional member variables bound to the thread, accessible via vsf_this/vsf_pthis in the thread entry |
| #define define_vsf_thread_ex | ( | __name, | |
| ... ) |
Alias of def_vsf_thread_ex.
| [in] | __name | name of the thread type, declared by declare_vsf_thread_ex |
| [in] | ... | additional member variables bound to the thread |
| #define end_def_vsf_thread | ( | ... | ) |
Mark the end of a thread definition, no-op, for readability only.
| #define end_define_vsf_thread | ( | ... | ) |
Alias of end_def_vsf_thread.
| #define implement_vsf_thread | ( | __name | ) |
Implement the entry body of a thread type.
| [in] | __name | name of the thread type defined by def_vsf_thread |
| #define implement_vsf_thread_ex | ( | __name | ) |
Implement the entry body of a thread type using an external stack.
| [in] | __name | name of the thread type defined by def_vsf_thread_ex |
| #define imp_vsf_thread | ( | __name | ) |
Alias of implement_vsf_thread.
| [in] | __name | name of the thread type defined by def_vsf_thread |
| #define imp_vsf_thread_ex | ( | __name | ) |
Alias of implement_vsf_thread_ex.
| [in] | __name | name of the thread type defined by def_vsf_thread_ex |
| #define __init_vsf_thread | ( | __name, | |
| __task, | |||
| __pri ) |
| #define __init_vsf_thread_ex | ( | __name, | |
| __task, | |||
| __pri, | |||
| __stack, | |||
| __stack_bytesize ) |
| #define init_vsf_thread | ( | __name, | |
| __task, | |||
| __pri ) |
Initialize and start an instance of a thread type with embedded stack.
| [in] | __name | name of the thread type defined by def_vsf_thread |
| [in] | __task | a pointer to the thread instance of type __name |
| [in] | __pri | priority of the thread: vsf_prio_0, vsf_prio_1, ... (in increasing priority order), or vsf_prio_inherit (inherit the current event queue's priority) |
| #define init_vsf_thread_ex | ( | __name, | |
| __task, | |||
| __pri, | |||
| __stack, | |||
| __stack_bytesize ) |
Initialize and start an instance of a thread type with an external stack.
| [in] | __name | name of the thread type defined by def_vsf_thread_ex |
| [in] | __task | a pointer to the thread instance of type __name |
| [in] | __pri | priority of the thread: vsf_prio_0, vsf_prio_1, ... (in increasing priority order), or vsf_prio_inherit (inherit the current event queue's priority) |
| [in] | __stack | a pointer to the external stack |
| [in] | __stack_bytesize | size of the external stack in bytes |
| #define vsf_thread | ( | __name | ) |
Get the thread control block type of a thread type.
| [in] | __name | name of the thread type defined by def_vsf_thread |
| #define vsf_thread_wfm vsf_thread_wait_for_msg |
Short alias of vsf_thread_wait_for_msg.
| #define vsf_thread_wfe vsf_thread_wait_for_evt |
Short alias of vsf_thread_wait_for_evt.
| #define vsf_thread_wfem vsf_thread_wait_for_evt_msg |
Short alias of vsf_thread_wait_for_evt_msg.
| #define __vsf_thread_call_sub | ( | __name, | |
| __target, | |||
| ... ) |
| #define vsf_thread_call_sub | ( | __name, | |
| __target, | |||
| ... ) |
Call an eda (event-driven task) sub-routine from a thread and wait for its completion.
| [in] | __name | entry function of the target eda |
| [in] | __target | a pointer to the target eda instance |
| [in] | ... | optional size of the local variables of the target eda |
| #define vsf_thread_call_pt | ( | __name, | |
| __target, | |||
| ... ) |
Call a pt (protothread) from a thread and wait for its completion.
| [in] | __name | name of the target protothread defined by def_vsf_pt() |
| [in] | __target | a pointer to the target pt instance |
| [in] | ... | optional size of the local variables of the target pt |
| #define vsf_thread_call_task | ( | __name, | |
| __target, | |||
| ... ) |
Call a task from a thread and wait for its completion.
| [in] | __name | entry function of the target task |
| [in] | __target | a pointer to the target task instance |
| [in] | ... | optional size of the local variables of the target task |
| #define vsf_thread_delay_ms | ( | __ms | ) |
Delay (sleep) the current thread for the given milliseconds.
| [in] | __ms | delay time in milliseconds |
| #define vsf_thread_delay_us | ( | __us | ) |
Delay (sleep) the current thread for the given microseconds.
| [in] | __us | delay time in microseconds |
| #define vsf_thread_sem_post | ( | __sem | ) |
Post a semaphore inside a thread, non-blocking alias of vsf_eda_sem_post.
| [in] | __sem | a pointer to structure vsf_sem_t |
| #define vsf_thread_sem_pend | ( | __sem, | |
| timeout ) |
Pend on a semaphore inside a thread.
| [in] | __sem | a pointer to structure vsf_sem_t |
| [in] | timeout | timeout in ticks; negative to wait forever, 0 to try once, a positive value to wait up to the given ticks |
| #define vsf_thread_trig_set | ( | __trig, | |
| ... ) |
Set a trigger inside a thread, non-blocking alias of vsf_eda_trig_set.
| [in] | __trig | a pointer to structure vsf_trig_t |
| [in] | ... | optional bool, true to set the trigger as manual-reset |
| #define vsf_thread_trig_reset | ( | __trig | ) |
Reset a trigger inside a thread, alias of vsf_eda_trig_reset.
| [in] | __trig | a pointer to structure vsf_trig_t |
| #define vsf_thread_trig_pend | ( | __trig, | |
| timeout ) |
Pend on a trigger inside a thread.
| [in] | __trig | a pointer to structure vsf_trig_t |
| [in] | timeout | timeout in ticks; negative to wait forever, 0 to try once, a positive value to wait up to the given ticks |
| #define vsf_thread_mutex_enter | ( | __mtx, | |
| timeout ) |
Enter (acquire) a mutex inside a thread.
| [in] | __mtx | a pointer to structure vsf_mutex_t |
| [in] | timeout | timeout in ticks; negative to wait forever, 0 to try once, a positive value to wait up to the given ticks |
| declare_class | ( | vsf_thread_t | ) |
POSIX-like thread signal handler, invoked when a signal is delivered to the thread.
| [in] | thread | the thread that receives the signal |
| [in] | sig | the signal number |
| declare_class | ( | vsf_thread_cb_t | ) |
Thread entry function, called on the thread's own stack.
| [in] | thread | the thread control block vsf_thread_cb_t (when VSF_KERNEL_CFG_EDA_SUPPORT_SUB_CALL is ENABLED) |
| int sig |