|
VSF Documented
|
#include "kernel/vsf_kernel_cfg.h"#include "../../vsf_eda.h"#include "./vsf_simple_bmpevt.h"#include "../../task/vsf_task.h"Go to the source code of this file.
Macros | |
| #define | static_task_instance(...) |
| Declare the per-invocation static task-local control block and fetch the current event. | |
| #define | features_used(...) |
| Non-IAR variant; shares the documentation of the first variant above. | |
| #define | mem_sharable(...) |
| Non-IAR variant; shares the documentation of the first variant above. | |
| #define | mem_nonsharable(...) |
| Non-IAR variant; shares the documentation of the first variant above. | |
| #define | vsf_yield() |
| Yield the CPU cooperatively so that other tasks of the same event queue can run before this task continues. | |
| #define | vsf_delay(__tick) |
| Delay for a given number of system timer ticks (cooperative, non-blocking for other tasks). | |
| #define | vsf_delay_ms(__ms) |
| Delay for a given number of milliseconds (cooperative, non-blocking for other tasks). | |
| #define | vsf_delay_us(__us) |
| Delay for a given number of microseconds (cooperative, non-blocking for other tasks). | |
| #define | on_timeout() |
| Catch the timeout case of a preceding *_timeout wait macro. | |
| #define | vsf_mutex_init(__mutex_addr) |
| Initialize a mutex. | |
| #define | vsf_mutex_leave(__mutex_addr) |
| Leave (release) a mutex previously entered by the current task. | |
| #define | vsf_mutex_enter(__mutex_addr) |
| Enter (lock) a mutex, waiting forever until it is obtained (cooperative, non-blocking for other tasks). | |
| #define | vsf_mutex_try_enter_timeout(__mutex_addr, __timeout) |
| Try to enter (lock) a mutex with a timeout in system timer ticks (cooperative, non-blocking for other tasks). | |
| #define | vsf_mutex_try_enter_timeout_ms(__mutex_addr, __timeout) |
| Try to enter (lock) a mutex with a timeout in milliseconds (cooperative, non-blocking for other tasks). | |
| #define | vsf_mutex_try_enter_timeout_us(__mutex_addr, __timeout) |
| Try to enter (lock) a mutex with a timeout in microseconds (cooperative, non-blocking for other tasks). | |
| #define | vsf_crit_init(__crit_addr) |
| Initialize a critical section object. | |
| #define | vsf_crit_leave(__crit_addr) |
| Leave a critical section previously entered by the current task. | |
| #define | vsf_crit_enter(__crit_addr) |
| Enter a critical section, waiting forever until it is obtained (cooperative, non-blocking for other tasks). | |
| #define | vsf_crit_try_enter_timeout(__crit_addr, __timeout) |
| Try to enter a critical section with a timeout in system timer ticks (cooperative, non-blocking for other tasks). | |
| #define | vsf_crit_try_enter_timeout_ms(__crit_addr, __timeout) |
| Try to enter a critical section with a timeout in milliseconds (cooperative, non-blocking for other tasks). | |
| #define | vsf_crit_try_enter_timeout_us(__crit_addr, __timeout) |
| Try to enter a critical section with a timeout in microseconds (cooperative, non-blocking for other tasks). | |
| #define | vsf_sem_init(__psem, __cnt) |
| Initialize a semaphore with an initial count; the count is auto-reset and limited by VSF_SYNC_MAX. | |
| #define | vsf_sem_post(__psem) |
| Post (increase) a semaphore, waking up one pending task if any. | |
| #define | vsf_sem_pend(__psem) |
| Wait for (pend on) a semaphore, waiting forever until it is obtained (cooperative, non-blocking for other tasks). | |
| #define | vsf_sem_pend_timeout(__psem, __timeout) |
| Wait for (pend on) a semaphore with a timeout in system timer ticks (cooperative, non-blocking for other tasks). | |
| #define | vsf_sem_pend_timeout_ms(__psem, __timeout) |
| Wait for (pend on) a semaphore with a timeout in milliseconds (cooperative, non-blocking for other tasks). | |
| #define | vsf_sem_pend_timeout_us(__psem, __timeout) |
| Wait for (pend on) a semaphore with a timeout in microseconds (cooperative, non-blocking for other tasks). | |
| #define | vsf_trig_init(__ptrig, __set, __auto_rst) |
| Initialize a trigger. | |
| #define | vsf_trig_set(__ptrig) |
| Set a trigger, waking up the tasks waiting for it (all waiters for a manual-reset trigger, one waiter otherwise). | |
| #define | vsf_trig_reset(__ptrig) |
| Reset a trigger. | |
| #define | vsf_trig_wait(__ptrig) |
| Wait for a trigger to be set, waiting forever (cooperative, non-blocking for other tasks). | |
| #define | vsf_trig_wait_timeout(__ptrig, __timeout) |
| Wait for a trigger to be set with a timeout in system timer ticks (cooperative, non-blocking for other tasks). | |
| #define | vsf_trig_wait_timeout_ms(__ptrig, __timeout) |
| Wait for a trigger to be set with a timeout in milliseconds (cooperative, non-blocking for other tasks). | |
| #define | vsf_trig_wait_timeout_us(__ptrig, __timeout) |
| Wait for a trigger to be set with a timeout in microseconds (cooperative, non-blocking for other tasks). | |
| #define | vsf_call_eda(__entry, __param_addr) |
| Call a sub eda task (event handler) from the current task. | |
| #define | vsf_call_fsm(__entry, __param_addr, ...) |
| Call a sub fsm task from the current task, and wait until it finishes. Internally mapped to __vsf_call_task(); an fsm is a vsf task in this codebase. | |
| #define | vsf_call_peda4(__peda_name, __entry, __private_local_size, __peda_param_addr, __buff) |
| Call a sub peda task (eda task with private local variables and argument buffer) from the current task. | |
| #define | vsf_call_peda3(__peda_name, __entry, __private_local_size, __peda_param_addr) |
| Helper of vsf_call_peda() with explicit entry and private local size, without the argument buffer; shares the documentation of vsf_call_peda4. | |
| #define | vsf_call_peda2(__peda_name, __peda_param_addr, __buff) |
| Helper of vsf_call_peda() with an explicit argument buffer, using the peda's own entry; shares the documentation of vsf_call_peda4. | |
| #define | vsf_call_peda1(__peda_name, __peda_param_addr) |
| Helper of vsf_call_peda() using the peda's own entry without the argument buffer; shares the documentation of vsf_call_peda4. | |
| #define | vsf_call_peda(__peda_name, ...) |
Functions | |
| vsf_evt_t | __vsf_delay (vsf_systimer_tick_t tick) |
| Low-level delay helper backing the vsf_delay() statement macros. | |
| vsf_sync_reason_t | __vsf_sem_pend (vsf_sem_t *sem_ptr, vsf_timeout_tick_t time_out) |
| Low-level semaphore-pend helper backing the vsf_sem_pend() and vsf_trig_wait() statement macros. | |
| vsf_sync_reason_t | __vsf_mutex_enter (vsf_mutex_t *mtx_ptr, vsf_timeout_tick_t time_out) |
| Low-level mutex-enter helper backing the vsf_mutex_enter() and vsf_crit_enter() statement macros. | |
| vsf_evt_t | __vsf_yield (void) |
| Low-level yield helper backing the vsf_yield() statement macro. | |
| vsf_err_t | __vsf_call_eda (uintptr_t evthandler, uintptr_t param, size_t local_size, size_t local_buff_size, uintptr_t local_buff) |
| Low-level sub-task-call helper backing the vsf_call_eda() and vsf_call_peda() macros. | |
| fsm_rt_t | __vsf_call_task (vsf_task_entry_t entry, uintptr_t param, size_t local_size) |
| Low-level helper for calling a sub task with a return value. | |
| #define static_task_instance | ( | ... | ) |
Declare the per-invocation static task-local control block and fetch the current event.
| [in] | ... | user local variable declarations appended to the control block |
this_ptr to it; the first member fsm_state is reserved for the simple-shell state machine. Also defines a local variable evt holding the current event (vsf_eda_get_cur_evt()). | #define features_used | ( | ... | ) |
Non-IAR variant; shares the documentation of the first variant above.
| #define mem_sharable | ( | ... | ) |
Non-IAR variant; shares the documentation of the first variant above.
| #define mem_nonsharable | ( | ... | ) |
Non-IAR variant; shares the documentation of the first variant above.
| #define vsf_yield | ( | ) |
Yield the CPU cooperatively so that other tasks of the same event queue can run before this task continues.
| #define vsf_delay | ( | __tick | ) |
Delay for a given number of system timer ticks (cooperative, non-blocking for other tasks).
| [in] | __tick | delay time in system timer ticks |
| #define vsf_delay_ms | ( | __ms | ) |
Delay for a given number of milliseconds (cooperative, non-blocking for other tasks).
| [in] | __ms | delay time in milliseconds, converted to ticks via vsf_systimer_ms_to_tick() |
| #define vsf_delay_us | ( | __us | ) |
Delay for a given number of microseconds (cooperative, non-blocking for other tasks).
| [in] | __us | delay time in microseconds, converted to ticks via vsf_systimer_us_to_tick() |
| #define on_timeout | ( | ) |
Catch the timeout case of a preceding *_timeout wait macro.
| #define vsf_mutex_init | ( | __mutex_addr | ) |
Initialize a mutex.
| [in] | __mutex_addr | pointer to the mutex vsf_mutex_t |
| #define vsf_mutex_leave | ( | __mutex_addr | ) |
Leave (release) a mutex previously entered by the current task.
| [in] | __mutex_addr | pointer to the mutex vsf_mutex_t |
| #define vsf_mutex_enter | ( | __mutex_addr | ) |
Enter (lock) a mutex, waiting forever until it is obtained (cooperative, non-blocking for other tasks).
| [in] | __mutex_addr | pointer to the mutex vsf_mutex_t |
| #define vsf_mutex_try_enter_timeout | ( | __mutex_addr, | |
| __timeout ) |
Try to enter (lock) a mutex with a timeout in system timer ticks (cooperative, non-blocking for other tasks).
| [in] | __mutex_addr | pointer to the mutex vsf_mutex_t |
| [in] | __timeout | timeout in system timer ticks; a negative value waits forever |
| #define vsf_mutex_try_enter_timeout_ms | ( | __mutex_addr, | |
| __timeout ) |
Try to enter (lock) a mutex with a timeout in milliseconds (cooperative, non-blocking for other tasks).
| [in] | __mutex_addr | pointer to the mutex vsf_mutex_t |
| [in] | __timeout | timeout in milliseconds, converted to ticks via vsf_systimer_ms_to_tick() |
| #define vsf_mutex_try_enter_timeout_us | ( | __mutex_addr, | |
| __timeout ) |
Try to enter (lock) a mutex with a timeout in microseconds (cooperative, non-blocking for other tasks).
| [in] | __mutex_addr | pointer to the mutex vsf_mutex_t |
| [in] | __timeout | timeout in microseconds, converted to ticks via vsf_systimer_us_to_tick() |
| #define vsf_crit_init | ( | __crit_addr | ) |
Initialize a critical section object.
| [in] | __crit_addr | pointer to the critical section object vsf_crit_t |
| #define vsf_crit_leave | ( | __crit_addr | ) |
Leave a critical section previously entered by the current task.
| [in] | __crit_addr | pointer to the critical section object vsf_crit_t |
| #define vsf_crit_enter | ( | __crit_addr | ) |
Enter a critical section, waiting forever until it is obtained (cooperative, non-blocking for other tasks).
| [in] | __crit_addr | pointer to the critical section object vsf_crit_t |
| #define vsf_crit_try_enter_timeout | ( | __crit_addr, | |
| __timeout ) |
Try to enter a critical section with a timeout in system timer ticks (cooperative, non-blocking for other tasks).
| [in] | __crit_addr | pointer to the critical section object vsf_crit_t |
| [in] | __timeout | timeout in system timer ticks; a negative value waits forever |
| #define vsf_crit_try_enter_timeout_ms | ( | __crit_addr, | |
| __timeout ) |
Try to enter a critical section with a timeout in milliseconds (cooperative, non-blocking for other tasks).
| [in] | __crit_addr | pointer to the critical section object vsf_crit_t |
| [in] | __timeout | timeout in milliseconds, converted to ticks via vsf_systimer_ms_to_tick() |
| #define vsf_crit_try_enter_timeout_us | ( | __crit_addr, | |
| __timeout ) |
Try to enter a critical section with a timeout in microseconds (cooperative, non-blocking for other tasks).
| [in] | __crit_addr | pointer to the critical section object vsf_crit_t |
| [in] | __timeout | timeout in microseconds, converted to ticks via vsf_systimer_us_to_tick() |
| #define vsf_sem_init | ( | __psem, | |
| __cnt ) |
Initialize a semaphore with an initial count; the count is auto-reset and limited by VSF_SYNC_MAX.
| [in] | __psem | pointer to the semaphore vsf_sem_t |
| [in] | __cnt | initial count of the semaphore |
| #define vsf_sem_post | ( | __psem | ) |
Post (increase) a semaphore, waking up one pending task if any.
| [in] | __psem | pointer to the semaphore vsf_sem_t |
| #define vsf_sem_pend | ( | __psem | ) |
Wait for (pend on) a semaphore, waiting forever until it is obtained (cooperative, non-blocking for other tasks).
| [in] | __psem | pointer to the semaphore vsf_sem_t |
| #define vsf_sem_pend_timeout | ( | __psem, | |
| __timeout ) |
Wait for (pend on) a semaphore with a timeout in system timer ticks (cooperative, non-blocking for other tasks).
| [in] | __psem | pointer to the semaphore vsf_sem_t |
| [in] | __timeout | timeout in system timer ticks; a negative value waits forever |
| #define vsf_sem_pend_timeout_ms | ( | __psem, | |
| __timeout ) |
Wait for (pend on) a semaphore with a timeout in milliseconds (cooperative, non-blocking for other tasks).
| [in] | __psem | pointer to the semaphore vsf_sem_t |
| [in] | __timeout | timeout in milliseconds, converted to ticks via vsf_systimer_ms_to_tick() |
| #define vsf_sem_pend_timeout_us | ( | __psem, | |
| __timeout ) |
Wait for (pend on) a semaphore with a timeout in microseconds (cooperative, non-blocking for other tasks).
| [in] | __psem | pointer to the semaphore vsf_sem_t |
| [in] | __timeout | timeout in microseconds, converted to ticks via vsf_systimer_us_to_tick() |
| #define vsf_trig_init | ( | __ptrig, | |
| __set, | |||
| __auto_rst ) |
Initialize a trigger.
| [in] | __ptrig | pointer to the trigger vsf_trig_t |
| [in] | __set | initial state, non-zero for set, zero for reset |
| [in] | __auto_rst | non-zero to reset the trigger automatically after it is obtained, zero to reset it manually with vsf_trig_reset() |
| #define vsf_trig_set | ( | __ptrig | ) |
Set a trigger, waking up the tasks waiting for it (all waiters for a manual-reset trigger, one waiter otherwise).
| [in] | __ptrig | pointer to the trigger vsf_trig_t |
| #define vsf_trig_reset | ( | __ptrig | ) |
Reset a trigger.
| [in] | __ptrig | pointer to the trigger vsf_trig_t |
| #define vsf_trig_wait | ( | __ptrig | ) |
Wait for a trigger to be set, waiting forever (cooperative, non-blocking for other tasks).
| [in] | __ptrig | pointer to the trigger vsf_trig_t |
| #define vsf_trig_wait_timeout | ( | __ptrig, | |
| __timeout ) |
Wait for a trigger to be set with a timeout in system timer ticks (cooperative, non-blocking for other tasks).
| [in] | __ptrig | pointer to the trigger vsf_trig_t |
| [in] | __timeout | timeout in system timer ticks; a negative value waits forever |
| #define vsf_trig_wait_timeout_ms | ( | __ptrig, | |
| __timeout ) |
Wait for a trigger to be set with a timeout in milliseconds (cooperative, non-blocking for other tasks).
| [in] | __ptrig | pointer to the trigger vsf_trig_t |
| [in] | __timeout | timeout in milliseconds, converted to ticks via vsf_systimer_ms_to_tick() |
| #define vsf_trig_wait_timeout_us | ( | __ptrig, | |
| __timeout ) |
Wait for a trigger to be set with a timeout in microseconds (cooperative, non-blocking for other tasks).
| [in] | __ptrig | pointer to the trigger vsf_trig_t |
| [in] | __timeout | timeout in microseconds, converted to ticks via vsf_systimer_us_to_tick() |
| #define vsf_call_eda | ( | __entry, | |
| __param_addr ) |
Call a sub eda task (event handler) from the current task.
| [in] | __entry | entry function of the sub task |
| [in] | __param_addr | parameter passed to the sub task |
| #define vsf_call_fsm | ( | __entry, | |
| __param_addr, | |||
| ... ) |
Call a sub fsm task from the current task, and wait until it finishes. Internally mapped to __vsf_call_task(); an fsm is a vsf task in this codebase.
| [in] | __entry | entry function of the sub task |
| [in] | __param_addr | parameter passed to the sub task |
| [in] | ... | optional size of the local variables of the sub-task frame |
| #define vsf_call_peda4 | ( | __peda_name, | |
| __entry, | |||
| __private_local_size, | |||
| __peda_param_addr, | |||
| __buff ) |
Call a sub peda task (eda task with private local variables and argument buffer) from the current task.
| [in] | __peda_name | name of the peda task declared with the peda macros |
| [in] | __entry | (vsf_call_peda4/3 only) entry function of the sub task |
| [in] | __private_local_size | (vsf_call_peda4/3 only) extra private local size appended to the peda local variables |
| [in] | __peda_param_addr | parameter passed to the sub task |
| [in] | __buff | (vsf_call_peda4/2 only) buffer used to initialize the argument area of the sub task |
| #define vsf_call_peda3 | ( | __peda_name, | |
| __entry, | |||
| __private_local_size, | |||
| __peda_param_addr ) |
Helper of vsf_call_peda() with explicit entry and private local size, without the argument buffer; shares the documentation of vsf_call_peda4.
| #define vsf_call_peda2 | ( | __peda_name, | |
| __peda_param_addr, | |||
| __buff ) |
Helper of vsf_call_peda() with an explicit argument buffer, using the peda's own entry; shares the documentation of vsf_call_peda4.
| #define vsf_call_peda1 | ( | __peda_name, | |
| __peda_param_addr ) |
Helper of vsf_call_peda() using the peda's own entry without the argument buffer; shares the documentation of vsf_call_peda4.
| #define vsf_call_peda | ( | __peda_name, | |
| ... ) |
|
extern |
Low-level delay helper backing the vsf_delay() statement macros.
| [in] | tick | delay time in system timer ticks |
|
extern |
Low-level semaphore-pend helper backing the vsf_sem_pend() and vsf_trig_wait() statement macros.
| [in] | sem_ptr | pointer to the semaphore vsf_sem_t |
| [in] | time_out | timeout in system timer ticks; a negative value waits forever |
|
extern |
Low-level mutex-enter helper backing the vsf_mutex_enter() and vsf_crit_enter() statement macros.
| [in] | mtx_ptr | pointer to the mutex vsf_mutex_t |
| [in] | time_out | timeout in system timer ticks; a negative value waits forever |
|
extern |
Low-level yield helper backing the vsf_yield() statement macro.
|
extern |
Low-level sub-task-call helper backing the vsf_call_eda() and vsf_call_peda() macros.
| [in] | evthandler | entry function of the sub task |
| [in] | param | parameter passed to the sub task |
| [in] | local_size | size of the local variable area of the sub task |
| [in] | local_buff_size | size of the buffer pointed by local_buff |
| [in] | local_buff | buffer used to initialize the local variable area of the sub task, NULL if not used |
|
extern |
Low-level helper for calling a sub task with a return value.
| [in] | entry | entry function of the sub task vsf_task_entry_t |
| [in] | param | parameter passed to the sub task |
| [in] | local_size | size of the local variable area of the sub task |