|
VSF Documented
|
#include "../vsf_kernel_cfg.h"#include "../vsf_kernel_common.h"#include "./vsf_thread.h"#include "../vsf_os.h"Macros | |
| #define | __VSF_THREAD_CLASS_IMPLEMENT |
| #define | __VSF_EDA_CLASS_INHERIT__ |
Functions | |
| vsf_evtq_t * | __vsf_os_evtq_get (vsf_prio_t priority) |
| vsf_thread_t * | vsf_thread_get_cur (void) |
| Get the currently running thread. | |
| VSF_CAL_NO_RETURN void | vsf_thread_exit (void) |
| Terminate the current thread. | |
| void | __vsf_eda_return_to_thread (vsf_eda_t *eda) |
| vsf_evt_t | vsf_thread_wait (void) |
| Wait for any event inside a thread. | |
| void | vsf_thread_wait_for_evt (vsf_evt_t evt) |
| Wait for a specific event inside a thread. | |
| uintptr_t | vsf_thread_wait_for_evt_msg (vsf_evt_t evt) |
| Wait for an event carrying a message inside a thread. | |
| uintptr_t | vsf_thread_wait_for_msg (void) |
| Wait for a message inside a thread. | |
| void | vsf_thread_sendevt (vsf_thread_t *thread_obj, vsf_evt_t evt) |
| Post an event to a thread. | |
| void | __vsf_thread_host_thread (void *arg) |
| void | vsf_thread_stack_check (void) |
| Check whether the current stack pointer is inside the stack range of the current thread. | |
| vsf_err_t | vsf_thread_start (vsf_thread_t *pthis, vsf_thread_cb_t *thread_cb, vsf_prio_t priority) |
| Start a thread. | |
| vsf_err_t | vk_eda_call_thread_prepare (vsf_thread_cb_t *pthis, vsf_thread_prepare_cfg_t *cfg) |
| Prepare a thread control block before an eda calls a thread. | |
| vsf_err_t | vk_eda_call_thread (vsf_thread_cb_t *thread_cb) |
| Call a prepared thread from the current eda and wait for its completion. | |
| vsf_err_t | vk_thread_call_eda (uintptr_t eda_handler, uintptr_t param, size_t local_size, size_t local_buff_size, uintptr_t local_buff) |
| Call an eda (event-driven task) from the current thread and wait for its completion. | |
| vsf_err_t | vk_thread_call_thread (vsf_thread_cb_t *pthis, vsf_thread_prepare_cfg_t *cfg) |
| Call a thread from the current thread and wait for its completion. | |
| fsm_rt_t | vk_thread_call_task (vsf_task_entry_t task_handler, uintptr_t param, size_t local_size) |
| Call a task from the current thread and wait for its completion. | |
| void | vsf_thread_delay (vsf_systimer_tick_t tick) |
| Delay (sleep) the current thread for the given ticks. | |
| void | vsf_thread_yield (void) |
| Yield the CPU voluntarily to other tasks of the same priority. | |
| vsf_prio_t | vsf_thread_set_priority (vsf_prio_t priority) |
| Set the priority of the current thread dynamically. | |
| void | vsf_thread_signal (vsf_thread_t *thread, int sig) |
| Send a POSIX-like signal to a thread. | |
| vsf_sync_reason_t | __vsf_thread_wait_for_sync (vsf_sync_t *sync, vsf_timeout_tick_t time_out) |
| Wait for a sync object (semaphore, trigger or mutex) inside a thread. | |
| vsf_err_t | vsf_thread_mutex_leave (vsf_mutex_t *mtx) |
| Leave (release) a mutex inside a thread. | |
| vsf_sync_reason_t | vsf_thread_queue_send (vsf_eda_queue_t *queue, void *node, vsf_timeout_tick_t timeout) |
| Send a node to a queue inside a thread. | |
| vsf_sync_reason_t | vsf_thread_queue_recv (vsf_eda_queue_t *queue, void **node, vsf_timeout_tick_t timeout) |
| Receive a node from a queue inside a thread. | |
| vsf_sync_reason_t | vsf_thread_bmpevt_pend (vsf_bmpevt_t *bmpevt, vsf_bmpevt_pender_t *pender, vsf_timeout_tick_t timeout) |
| Pend on a bitmap event inside a thread. | |
| #define __VSF_THREAD_CLASS_IMPLEMENT |
| #define __VSF_EDA_CLASS_INHERIT__ |
|
extern |
| vsf_thread_t * vsf_thread_get_cur | ( | void | ) |
Get the currently running thread.
| VSF_CAL_NO_RETURN void vsf_thread_exit | ( | void | ) |
Terminate the current thread.
| void __vsf_eda_return_to_thread | ( | vsf_eda_t * | eda | ) |
| vsf_evt_t vsf_thread_wait | ( | void | ) |
Wait for any event inside a thread.
| void vsf_thread_wait_for_evt | ( | vsf_evt_t | evt | ) |
Wait for a specific event inside a thread.
| [in] | evt | the event to wait for, of type vsf_evt_t |
Wait for an event carrying a message inside a thread.
| [in] | evt | the event to wait for, of type vsf_evt_t |
| uintptr_t vsf_thread_wait_for_msg | ( | void | ) |
Wait for a message inside a thread.
| void vsf_thread_sendevt | ( | vsf_thread_t * | thread, |
| vsf_evt_t | evt ) |
Post an event to a thread.
| [in] | thread | a pointer to structure vsf_thread_t |
| [in] | evt | the event to post, of type vsf_evt_t |
| void __vsf_thread_host_thread | ( | void * | arg | ) |
| void vsf_thread_stack_check | ( | void | ) |
Check whether the current stack pointer is inside the stack range of the current thread.
| vsf_err_t vsf_thread_start | ( | vsf_thread_t * | thread, |
| vsf_thread_cb_t * | thread_cb, | ||
| vsf_prio_t | priority ) |
Start a thread.
| [in] | thread | a pointer to structure vsf_thread_t |
| [in] | thread_cb | a pointer to the thread control block vsf_thread_cb_t, whose entry, stack and stack_size members must be initialized |
| [in] | priority | priority of the thread |
| vsf_err_t vk_eda_call_thread_prepare | ( | vsf_thread_cb_t * | thread_cb, |
| vsf_thread_prepare_cfg_t * | cfg ) |
Prepare a thread control block before an eda calls a thread.
| [in] | thread_cb | a pointer to the thread control block vsf_thread_cb_t |
| [in] | cfg | a pointer to the prepare configuration vsf_thread_prepare_cfg_t, including entry, stack and stack_size |
| vsf_err_t vk_eda_call_thread | ( | vsf_thread_cb_t * | 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 vsf_thread_cb_t, prepared by vk_eda_call_thread_prepare |
| vsf_err_t vk_thread_call_eda | ( | uintptr_t | eda_handler, |
| uintptr_t | param, | ||
| size_t | local_size, | ||
| size_t | local_buff_size, | ||
| uintptr_t | local_buff ) |
Call an eda (event-driven task) from the current thread and wait for its completion.
| [in] | eda_handler | entry handler of the target eda |
| [in] | param | parameter passed to the target eda |
| [in] | local_size | size of the local variables of the target eda |
| [in] | local_buff_size | size of the buffer used to initialize the local variables |
| [in] | local_buff | buffer used to initialize the local variables, NULL if not needed |
| vsf_err_t vk_thread_call_thread | ( | vsf_thread_cb_t * | thread_cb, |
| vsf_thread_prepare_cfg_t * | cfg ) |
Call a thread from the current thread and wait for its completion.
| [in] | thread_cb | a pointer to the thread control block vsf_thread_cb_t of the target thread |
| [in] | cfg | a pointer to the prepare configuration vsf_thread_prepare_cfg_t, including entry, stack and stack_size |
| fsm_rt_t vk_thread_call_task | ( | vsf_task_entry_t | task_handler, |
| uintptr_t | param, | ||
| size_t | local_size ) |
Call a task from the current thread and wait for its completion.
| [in] | task_handler | entry handler of the target task, of type vsf_task_entry_t |
| [in] | param | parameter passed to the target task |
| [in] | local_size | size of the local variables of the target task |
| void vsf_thread_delay | ( | vsf_systimer_tick_t | tick | ) |
Delay (sleep) the current thread for the given ticks.
| [in] | tick | delay time in system ticks |
| void vsf_thread_yield | ( | void | ) |
Yield the CPU voluntarily to other tasks of the same priority.
| vsf_prio_t vsf_thread_set_priority | ( | vsf_prio_t | priority | ) |
Set the priority of the current thread dynamically.
| [in] | priority | new priority of the current thread |
| void vsf_thread_signal | ( | vsf_thread_t * | thread, |
| int | sig ) |
Send a POSIX-like signal to a thread.
| [in] | thread | a pointer to structure vsf_thread_t |
| [in] | sig | signal number |
| vsf_sync_reason_t __vsf_thread_wait_for_sync | ( | vsf_sync_t * | sync, |
| vsf_timeout_tick_t | time_out ) |
Wait for a sync object (semaphore, trigger or mutex) inside a thread.
| [in] | sync | a pointer to structure vsf_sync_t |
| [in] | time_out | timeout in ticks, negative to wait forever, 0 to try once |
| vsf_err_t vsf_thread_mutex_leave | ( | vsf_mutex_t * | mtx | ) |
Leave (release) a mutex inside a thread.
| [in] | mtx | a pointer to structure vsf_mutex_t |
| vsf_sync_reason_t vsf_thread_queue_send | ( | vsf_eda_queue_t * | queue, |
| void * | node, | ||
| vsf_timeout_tick_t | timeout ) |
Send a node to a queue inside a thread.
| [in] | queue | a pointer to structure vsf_eda_queue_t |
| [in] | node | a pointer to the node to send |
| [in] | timeout | timeout in ticks; negative to wait forever, 0 to try once, a positive value to wait up to the given ticks |
| vsf_sync_reason_t vsf_thread_queue_recv | ( | vsf_eda_queue_t * | queue, |
| void ** | node, | ||
| vsf_timeout_tick_t | timeout ) |
Receive a node from a queue inside a thread.
| [in] | queue | a pointer to structure vsf_eda_queue_t |
| [out] | node | a pointer to receive the dequeued node |
| [in] | timeout | timeout in ticks; negative to wait forever, 0 to try once, a positive value to wait up to the given ticks |
| vsf_sync_reason_t vsf_thread_bmpevt_pend | ( | vsf_bmpevt_t * | bmpevt, |
| vsf_bmpevt_pender_t * | pender, | ||
| vsf_timeout_tick_t | timeout ) |
Pend on a bitmap event inside a thread.
| [in] | bmpevt | a pointer to structure vsf_bmpevt_t |
| [in] | pender | a pointer to structure vsf_bmpevt_pender_t describing the bits to wait for |
| [in] | timeout | timeout in ticks; negative to wait forever, 0 to try once, a positive value to wait up to the given ticks |