|
SuperTinyKernel™ RTOS 1.08.x
Lightweight, high-performance, deterministic, bare-metal C++ RTOS for resource-constrained embedded systems. MIT Open Source License.
|
Pure C interface for stk::time::TimerHost and stk::time::Timer. More...
Topics | |
| STK C PeriodicTrigger API | |
| Pure C interface for stk::time::PeriodicTrigger. | |
| STK C Timer Synchronous API | |
| Blocking variants of the timer control functions. | |
Namespaces | |
| namespace | stk |
| Namespace of STK package. | |
Classes | |
| struct | stk_timerhost_config_t |
| Optional configuration of the timer host tasks, see stk_timerhost_init_ex(). More... | |
| struct | stk_timer_mem_t |
| Opaque memory container for a stk_timer_t instance. More... | |
| struct | stk_timer_info_t |
| Consistent snapshot of a timer, see stk_timer_query_sync(). More... | |
Macros | |
| #define | STK_C_TIMER_COMMAND_QUEUE_MAX (32U) |
| #define | STK_C_TIMER_HANDLER_STACK_SIZE (256U) |
| Stack size of the timer handler, increase if your timers consume more (default: 256). | |
| #define | STK_C_TIMER_THREADS_COUNT (1U) |
Number of handler tasks serving expired timers in task mode (default: 1). Sizes stk_timerhost_config_t::handler_stack and is forwarded to STK_TIMER_THREADS_COUNT of the C++ implementation. | |
| #define | STK_TIMER_IMPL_SIZE (14U) |
| A memory size (multiples of uint64_t) required for the stk_timer_t instance. | |
| #define | STK_TIMER_COMMAND_QUEUE_SIZE (STK_C_TIMER_COMMAND_QUEUE_MAX) |
| #define | STK_TIMER_THREADS_COUNT (STK_C_TIMER_THREADS_COUNT) |
| #define | STK_TIMER_HANDLER_STACK_SIZE (STK_C_TIMER_HANDLER_STACK_SIZE) |
Typedefs | |
| typedef struct stk_timerhost_config_t | stk_timerhost_config_t |
| Optional configuration of the timer host tasks, see stk_timerhost_init_ex(). | |
| typedef struct stk_timerhost_t | stk_timerhost_t |
Opaque handle to a TimerHost instance (one per CPU core). | |
| typedef struct stk_timer_mem_t | stk_timer_mem_t |
| Opaque memory container for a stk_timer_t instance. | |
| typedef struct stk_timer_t | stk_timer_t |
| Opaque handle to a concrete timer managed by stk_timerhost_t. | |
| typedef enum stk_timer_result_t | stk_timer_result_t |
| Outcome of a timer or host command, mirrors stk::time::TimerHost::EResult. | |
| typedef void(* | stk_timer_callback_t) (stk_timerhost_t *host, stk_timer_t *timer, void *user_data) |
| Timer expiration callback invoked from within the TimerHost handler task (task mode) or inline from stk_timerhost_process() (polled mode). | |
| typedef struct stk_timer_info_t | stk_timer_info_t |
| Consistent snapshot of a timer, see stk_timer_query_sync(). | |
Enumerations | |
| enum | stk_timer_result_t { STK_TIMER_RES_CANCELLED = -5 , STK_TIMER_RES_INVALID_PARAM = -4 , STK_TIMER_RES_QUEUE_FULL = -3 , STK_TIMER_RES_NOT_READY = -2 , STK_TIMER_RES_FAIL = -1 , STK_TIMER_RES_OK = 0 , STK_TIMER_RES_ACTIVE = 1 , STK_TIMER_RES_INACTIVE = 2 , STK_TIMER_RES_NOT_PERIODIC = 3 , STK_TIMER_RES_QUEUED = 4 } |
| Outcome of a timer or host command, mirrors stk::time::TimerHost::EResult. More... | |
Functions | |
| stk_timerhost_t * | stk_timerhost_get (uint8_t core_nr) |
| Obtain the pre-allocated TimerHost for the given CPU core. | |
| void | stk_timerhost_init (stk_timerhost_t *host, stk_kernel_t *kernel, bool privileged) |
| Initialize the TimerHost and register its internal tasks with the kernel. | |
| void | stk_timerhost_config_init (stk_timerhost_config_t *cfg) |
| Fill a configuration with defaults (default weights, internal stack buffers). | |
| stk_add_result_t | stk_timerhost_init_ex (stk_timerhost_t *host, stk_kernel_t *kernel, bool privileged, const stk_timerhost_config_t *cfg) |
| Initialize the TimerHost in task mode with explicit weights / stacks and report failures. | |
| void | stk_timerhost_init_polled (stk_timerhost_t *host) |
| Initialize the TimerHost in polled mode (no kernel tasks are created). | |
| stk_timeout_t | stk_timerhost_process (stk_timerhost_t *host) |
| Run the host once (polled mode only): execute pending commands, evaluate deadlines and invoke the callback of every expired timer inline. | |
| stk_timer_result_t | stk_timerhost_shutdown (stk_timerhost_t *host) |
| Gracefully shut down the TimerHost. | |
| bool | stk_timerhost_is_empty (const stk_timerhost_t *host) |
Return true when no timers are currently active on this host. | |
| size_t | stk_timerhost_get_size (const stk_timerhost_t *host) |
| Return the number of currently active timers on this host. | |
| int64_t | stk_timerhost_get_time_now (const stk_timerhost_t *host) |
| Return the last tick count snapshot maintained by the host's tick task. | |
| stk_timer_t * | stk_timer_create (stk_timer_mem_t *const membuf, stk_timer_callback_t callback, void *user_data) |
| Construct a timer in the supplied memory buffer. | |
| void | stk_timer_destroy (stk_timer_t *tmr) |
| Destroy a timer (calls the C++ destructor in-place). | |
| stk_timer_result_t | stk_timer_start (stk_timerhost_t *host, stk_timer_t *tmr, uint32_t delay, uint32_t period) |
| Start a timer. | |
| stk_timer_result_t | stk_timer_stop (stk_timerhost_t *host, stk_timer_t *tmr) |
| Stop a running timer. | |
| stk_timer_result_t | stk_timer_reset (stk_timerhost_t *host, stk_timer_t *tmr) |
| Reset a periodic timer's deadline (re-arm from now). | |
| stk_timer_result_t | stk_timer_restart (stk_timerhost_t *host, stk_timer_t *tmr, uint32_t delay, uint32_t period) |
| Atomically stop and re-start a timer. | |
| stk_timer_result_t | stk_timer_start_or_reset (stk_timerhost_t *host, stk_timer_t *tmr, uint32_t delay, uint32_t period_ticks) |
| Start the timer if inactive, or reset its deadline if already active and periodic. | |
| stk_timer_result_t | stk_timer_set_period (stk_timerhost_t *host, stk_timer_t *tmr, uint32_t period_ticks) |
| Change the period of a running periodic timer without affecting the current deadline. | |
| bool | stk_timer_is_active (const stk_timer_t *tmr) |
| Check whether a timer is currently active (started and not yet expired/stopped). | |
| uint32_t | stk_timer_get_period (const stk_timer_t *tmr) |
| Get the timer's reload period. | |
| int64_t | stk_timer_get_deadline (const stk_timer_t *tmr) |
| Get the absolute expiration tick count of the timer's next deadline. | |
| int64_t | stk_timer_get_timestamp (const stk_timer_t *tmr) |
| Get the tick count at which the timer last expired. | |
| uint32_t | stk_timer_get_remaining_ticks (const stk_timer_t *tmr) |
| Get remaining ticks until next expiration. | |
| stk::time::TimerHost * | stk_timerhost_get_instance (stk_timerhost_t *host) |
Get the underlying C++ stk::time::TimerHost object wrapped by a stk_timerhost_t handle. | |
| stk::time::Timer * | stk_timer_get_instance (stk_timer_t *tmr) |
Get the underlying C++ stk::time::Timer object wrapped by a stk_timer_t handle. | |
| stk::time::PeriodicTrigger * | stk_periodic_trigger_get_instance (stk_periodic_trigger_t *trig) |
Get the underlying C++ stk::time::PeriodicTrigger object wrapped by a stk_periodic_trigger_t handle. | |
Pure C interface for stk::time::TimerHost and stk::time::Timer.
| #define STK_C_TIMER_COMMAND_QUEUE_MAX (32U) |
Definition at line 73 of file stk_c_time.h.
| #define STK_C_TIMER_HANDLER_STACK_SIZE (256U) |
Stack size of the timer handler, increase if your timers consume more (default: 256).
Definition at line 81 of file stk_c_time.h.
| #define STK_C_TIMER_THREADS_COUNT (1U) |
Number of handler tasks serving expired timers in task mode (default: 1). Sizes stk_timerhost_config_t::handler_stack and is forwarded to STK_TIMER_THREADS_COUNT of the C++ implementation.
Definition at line 91 of file stk_c_time.h.
Referenced by stk_timerhost_config_init(), and stk_timerhost_init_ex().
| #define STK_TIMER_COMMAND_QUEUE_SIZE (STK_C_TIMER_COMMAND_QUEUE_MAX) |
Definition at line 680 of file stk_c_time.h.
| #define STK_TIMER_HANDLER_STACK_SIZE (STK_C_TIMER_HANDLER_STACK_SIZE) |
Definition at line 684 of file stk_c_time.h.
| #define STK_TIMER_IMPL_SIZE (14U) |
A memory size (multiples of uint64_t) required for the stk_timer_t instance.
Definition at line 124 of file stk_c_time.h.
| #define STK_TIMER_THREADS_COUNT (STK_C_TIMER_THREADS_COUNT) |
Definition at line 682 of file stk_c_time.h.
| typedef void(* stk_timer_callback_t) (stk_timerhost_t *host, stk_timer_t *timer, void *user_data) |
Timer expiration callback invoked from within the TimerHost handler task (task mode) or inline from stk_timerhost_process() (polled mode).
| [in] | host | TimerHost that fired the timer. |
| [in] | timer | The timer that expired. |
| [in] | user_data | Opaque pointer supplied at timer creation time. |
Definition at line 169 of file stk_c_time.h.
| typedef struct stk_timer_info_t stk_timer_info_t |
Consistent snapshot of a timer, see stk_timer_query_sync().
| typedef struct stk_timer_mem_t stk_timer_mem_t |
Opaque memory container for a stk_timer_t instance.
static or on the stack (not on the heap), it must outlive the timer. | typedef enum stk_timer_result_t stk_timer_result_t |
Outcome of a timer or host command, mirrors stk::time::TimerHost::EResult.
if(stk_timer_start(...)) means "failed", compare with STK_TIMER_RES_OK explicitly. | typedef struct stk_timer_t stk_timer_t |
Opaque handle to a concrete timer managed by stk_timerhost_t.
Definition at line 136 of file stk_c_time.h.
| typedef struct stk_timerhost_config_t stk_timerhost_config_t |
Optional configuration of the timer host tasks, see stk_timerhost_init_ex().
| typedef struct stk_timerhost_t stk_timerhost_t |
Opaque handle to a TimerHost instance (one per CPU core).
Definition at line 117 of file stk_c_time.h.
| enum stk_timer_result_t |
Outcome of a timer or host command, mirrors stk::time::TimerHost::EResult.
if(stk_timer_start(...)) means "failed", compare with STK_TIMER_RES_OK explicitly. | Enumerator | |
|---|---|
| STK_TIMER_RES_CANCELLED | The wait for a free command queue slot was cancelled, nothing is queued. |
| STK_TIMER_RES_INVALID_PARAM | An argument is out of range (e.g. zero period for stk_timer_set_period()). |
| STK_TIMER_RES_QUEUE_FULL | Command queue is full and the caller can not wait (ISR, kernel not started, polled mode, tick task). |
| STK_TIMER_RES_NOT_READY | Host is not initialized (or its initialization failed), or it has been shut down. |
| STK_TIMER_RES_FAIL | Unspecified failure. |
| STK_TIMER_RES_OK | The command was accepted into the command queue. |
| STK_TIMER_RES_ACTIVE | The timer is active, but the command requires it to be inactive. |
| STK_TIMER_RES_INACTIVE | The timer is not active, but the command requires it to be active. |
| STK_TIMER_RES_NOT_PERIODIC | The timer is not periodic, but the command requires it to be. |
| STK_TIMER_RES_QUEUED | Synchronous API only: the calling context can not wait, the command was queued asynchronously, its outcome is unknown. |
Definition at line 148 of file stk_c_time.h.
| stk::time::PeriodicTrigger * stk_periodic_trigger_get_instance | ( | stk_periodic_trigger_t * | trig | ) |
Get the underlying C++ stk::time::PeriodicTrigger object wrapped by a stk_periodic_trigger_t handle.
| [in] | trig | Trigger handle obtained via stk_periodic_trigger_create(). |
stk::time::PeriodicTrigger instance. Never NULL for a valid handle. __cplusplus); not part of the C ABI. Definition at line 548 of file stk_c_time.cpp.
References stk_periodic_trigger_t::handle, and STK_ASSERT.
| stk_timer_t * stk_timer_create | ( | stk_timer_mem_t *const | membuf, |
| stk_timer_callback_t | callback, | ||
| void * | user_data ) |
Construct a timer in the supplied memory buffer.
| [in] | membuf | Pointer to the caller-supplied memory container, must not be NULL. |
| [in] | callback | Function to call when the timer expires (must not be NULL). |
| [in] | user_data | Opaque pointer forwarded to callback on expiration. |
Definition at line 239 of file stk_c_time.cpp.
References stk::ConstructIn(), and STK_ASSERT.
Referenced by RunExample().
| void stk_timer_destroy | ( | stk_timer_t * | tmr | ) |
Destroy a timer (calls the C++ destructor in-place).
| [in] | tmr | Timer handle. May be NULL (no-op). |
Definition at line 255 of file stk_c_time.cpp.
References stk::time::Timer::IsActive(), and STK_ASSERT.
| int64_t stk_timer_get_deadline | ( | const stk_timer_t * | tmr | ) |
Get the absolute expiration tick count of the timer's next deadline.
| [in] | tmr | Timer handle. |
Definition at line 446 of file stk_c_time.cpp.
References stk::time::Timer::GetDeadline(), and STK_ASSERT.
| stk::time::Timer * stk_timer_get_instance | ( | stk_timer_t * | tmr | ) |
Get the underlying C++ stk::time::Timer object wrapped by a stk_timer_t handle.
| [in] | tmr | Timer handle obtained via stk_timer_create(). |
stk::time::Timer instance. Never NULL for a valid handle. __cplusplus); not part of the C ABI. static_cast or delete it - treat it strictly as a stk::time::Timer base pointer. Definition at line 541 of file stk_c_time.cpp.
References STK_ASSERT.
| uint32_t stk_timer_get_period | ( | const stk_timer_t * | tmr | ) |
Get the timer's reload period.
| [in] | tmr | Timer handle. |
Definition at line 439 of file stk_c_time.cpp.
References stk::time::Timer::GetPeriod(), and STK_ASSERT.
| uint32_t stk_timer_get_remaining_ticks | ( | const stk_timer_t * | tmr | ) |
Get remaining ticks until next expiration.
| [in] | tmr | Timer handle. |
Definition at line 460 of file stk_c_time.cpp.
References stk::time::Timer::GetRemainingTicks(), and STK_ASSERT.
| int64_t stk_timer_get_timestamp | ( | const stk_timer_t * | tmr | ) |
Get the tick count at which the timer last expired.
| [in] | tmr | Timer handle. |
Definition at line 453 of file stk_c_time.cpp.
References stk::time::Timer::GetTimestamp(), and STK_ASSERT.
| bool stk_timer_is_active | ( | const stk_timer_t * | tmr | ) |
Check whether a timer is currently active (started and not yet expired/stopped).
| [in] | tmr | Timer handle. |
true if the timer is active. Definition at line 432 of file stk_c_time.cpp.
References stk::time::Timer::IsActive(), and STK_ASSERT.
| stk_timer_result_t stk_timer_reset | ( | stk_timerhost_t * | host, |
| stk_timer_t * | tmr ) |
Reset a periodic timer's deadline (re-arm from now).
| [in] | host | TimerHost managing the timer. |
| [in] | tmr | Timer handle. Must be active and periodic (period != 0). |
Definition at line 295 of file stk_c_time.cpp.
References stk_timerhost_t::handle, stk::time::TimerHost::Reset(), and STK_ASSERT.
| stk_timer_result_t stk_timer_restart | ( | stk_timerhost_t * | host, |
| stk_timer_t * | tmr, | ||
| uint32_t | delay, | ||
| uint32_t | period ) |
Atomically stop and re-start a timer.
Unlike calling stk_timer_stop() + stk_timer_start(), this operation is atomic with respect to the tick task: the timer cannot fire between the implicit stop and re-start. Consumes only one command queue slot.
| [in] | host | TimerHost managing the timer. |
| [in] | tmr | Timer handle (active or inactive). |
| [in] | delay | Initial delay in ticks before the first expiration. |
| [in] | period | Reload period in ticks (0 = one-shot). |
Definition at line 303 of file stk_c_time.cpp.
References stk_timerhost_t::handle, stk::time::TimerHost::Restart(), stk_timer_t::SetHostHandle(), and STK_ASSERT.
| stk_timer_result_t stk_timer_set_period | ( | stk_timerhost_t * | host, |
| stk_timer_t * | tmr, | ||
| uint32_t | period_ticks ) |
Change the period of a running periodic timer without affecting the current deadline.
The new period takes effect on the next reload after the current deadline fires. To apply immediately, follow with stk_timer_reset().
| [in] | host | TimerHost managing the timer. |
| [in] | tmr | Timer handle. Must be active and periodic. |
| [in] | period_ticks | New reload period in ticks. Must be non-zero. |
Definition at line 325 of file stk_c_time.cpp.
References stk_timerhost_t::handle, stk::time::TimerHost::SetPeriod(), and STK_ASSERT.
| stk_timer_result_t stk_timer_start | ( | stk_timerhost_t * | host, |
| stk_timer_t * | tmr, | ||
| uint32_t | delay, | ||
| uint32_t | period ) |
Start a timer.
| [in] | host | TimerHost that will manage this timer. |
| [in] | tmr | Timer handle. Must not already be active. |
| [in] | delay | Initial delay in ticks before the first expiration. |
| [in] | period | Reload period in ticks. Pass 0 for a one-shot timer. |
Definition at line 273 of file stk_c_time.cpp.
References stk_timerhost_t::handle, stk_timer_t::SetHostHandle(), stk::time::TimerHost::Start(), and STK_ASSERT.
Referenced by RunExample().
| stk_timer_result_t stk_timer_start_or_reset | ( | stk_timerhost_t * | host, |
| stk_timer_t * | tmr, | ||
| uint32_t | delay, | ||
| uint32_t | period_ticks ) |
Start the timer if inactive, or reset its deadline if already active and periodic.
Collapses the common pattern:
into a single atomic operation, eliminating the TOCTOU race. If the timer is active but one-shot, no action is taken.
| [in] | host | TimerHost managing the timer. |
| [in] | tmr | Timer handle (active or inactive). |
| [in] | delay | Initial delay in ticks (used only when starting). |
| [in] | period_ticks | Reload period in ticks (used only when starting, 0 = one-shot). |
Definition at line 314 of file stk_c_time.cpp.
References stk_timerhost_t::handle, stk_timer_t::SetHostHandle(), stk::time::TimerHost::StartOrReset(), and STK_ASSERT.
| stk_timer_result_t stk_timer_stop | ( | stk_timerhost_t * | host, |
| stk_timer_t * | tmr ) |
Stop a running timer.
| [in] | host | TimerHost managing the timer. |
| [in] | tmr | Timer handle. Must be currently active. |
Definition at line 287 of file stk_c_time.cpp.
References stk_timerhost_t::handle, STK_ASSERT, and stk::time::TimerHost::Stop().
| void stk_timerhost_config_init | ( | stk_timerhost_config_t * | cfg | ) |
Fill a configuration with defaults (default weights, internal stack buffers).
| [out] | cfg | Configuration to initialize. |
Definition at line 143 of file stk_c_time.cpp.
References stk::DEFAULT_WEIGHT, stk_timerhost_config_t::handler_stack, stk_timerhost_config_t::handler_stack_size, stk_timerhost_config_t::handler_weight, STK_ASSERT, STK_C_TIMER_THREADS_COUNT, stk_timerhost_config_t::tick_stack, stk_timerhost_config_t::tick_stack_size, and stk_timerhost_config_t::tick_weight.
| stk_timerhost_t * stk_timerhost_get | ( | uint8_t | core_nr | ) |
Obtain the pre-allocated TimerHost for the given CPU core.
| [in] | core_nr | CPU core index (0 … STK_C_CPU_COUNT-1). |
Definition at line 120 of file stk_c_time.cpp.
References STK_C_CPU_COUNT.
Referenced by RunExample().
| stk::time::TimerHost * stk_timerhost_get_instance | ( | stk_timerhost_t * | host | ) |
Get the underlying C++ stk::time::TimerHost object wrapped by a stk_timerhost_t handle.
| [in] | host | TimerHost handle obtained via stk_timerhost_get(). |
stk::time::TimerHost instance. Never NULL for a valid handle. __cplusplus); not part of the C ABI. Definition at line 534 of file stk_c_time.cpp.
References stk_timerhost_t::handle, and STK_ASSERT.
| size_t stk_timerhost_get_size | ( | const stk_timerhost_t * | host | ) |
Return the number of currently active timers on this host.
| [in] | host | TimerHost handle. |
Definition at line 221 of file stk_c_time.cpp.
References stk::time::TimerHost::GetSize(), stk_timerhost_t::handle, and STK_ASSERT.
| int64_t stk_timerhost_get_time_now | ( | const stk_timerhost_t * | host | ) |
Return the last tick count snapshot maintained by the host's tick task.
| [in] | host | TimerHost handle. |
Definition at line 228 of file stk_c_time.cpp.
References stk::time::TimerHost::GetTimeNow(), stk_timerhost_t::handle, and STK_ASSERT.
| void stk_timerhost_init | ( | stk_timerhost_t * | host, |
| stk_kernel_t * | kernel, | ||
| bool | privileged ) |
Initialize the TimerHost and register its internal tasks with the kernel.
| [in] | host | TimerHost handle obtained via stk_timerhost_get(). |
| [in] | kernel | Kernel instance the timer tasks will be added to. |
| [in] | privileged | If true the internal handler tasks run in privileged mode, otherwise they run in user mode. |
Definition at line 132 of file stk_c_time.cpp.
References stk::ACCESS_PRIVILEGED, stk::ACCESS_USER, stk_timerhost_t::handle, stk::interop_c_helper::InitializeTimerHost(), and STK_ASSERT.
Referenced by RunExample().
| stk_add_result_t stk_timerhost_init_ex | ( | stk_timerhost_t * | host, |
| stk_kernel_t * | kernel, | ||
| bool | privileged, | ||
| const stk_timerhost_config_t * | cfg ) |
Initialize the TimerHost in task mode with explicit weights / stacks and report failures.
Same as stk_timerhost_init() but applies cfg and returns the result of adding the internal tasks to the kernel.
| [in] | host | TimerHost handle obtained via stk_timerhost_get(). |
| [in] | kernel | Kernel instance the timer tasks will be added to. |
| [in] | privileged | If true the handler tasks run in privileged mode, otherwise in user mode (the tick task always runs in user mode). |
| [in] | cfg | Weights and stacks, or NULL for defaults (equivalent to stk_timerhost_config_init()). |
Definition at line 159 of file stk_c_time.cpp.
References stk::ACCESS_PRIVILEGED, stk::ACCESS_USER, stk::ADD_FAIL_DUPLICATE, stk::ADD_FAIL_INVALID, stk::ADD_FAIL_POOL_FULL, stk::ADD_OK, stk_timerhost_t::handle, stk::time::TimerHost::Config::handler_stack, stk_timerhost_config_t::handler_stack, stk::time::TimerHost::Config::handler_stack_size, stk_timerhost_config_t::handler_stack_size, stk::time::TimerHost::Config::handler_weight, stk_timerhost_config_t::handler_weight, stk::interop_c_helper::InitializeTimerHostEx(), STK_ADD_FAIL_DUPLICATE, STK_ADD_FAIL_INVALID, STK_ADD_FAIL_POOL_FULL, STK_ADD_OK, STK_ASSERT, STK_C_TIMER_THREADS_COUNT, STK_STATIC_ASSERT_DESC, stk::time::TimerHost::Config::tick_stack, stk_timerhost_config_t::tick_stack, stk::time::TimerHost::Config::tick_stack_size, stk_timerhost_config_t::tick_stack_size, stk::time::TimerHost::Config::tick_weight, and stk_timerhost_config_t::tick_weight.
| void stk_timerhost_init_polled | ( | stk_timerhost_t * | host | ) |
Initialize the TimerHost in polled mode (no kernel tasks are created).
The application drives the host by calling stk_timerhost_process() periodically; expired timer callbacks run inline from that call. This is the mode to use with an HRT kernel, where Initialize/stk_timerhost_init() is rejected.
| [in] | host | TimerHost handle. |
Definition at line 193 of file stk_c_time.cpp.
References stk_timerhost_t::handle, stk::time::TimerHost::InitializePolled(), and STK_ASSERT.
| bool stk_timerhost_is_empty | ( | const stk_timerhost_t * | host | ) |
Return true when no timers are currently active on this host.
| [in] | host | TimerHost handle. |
Definition at line 214 of file stk_c_time.cpp.
References stk_timerhost_t::handle, stk::time::TimerHost::IsEmpty(), and STK_ASSERT.
| stk_timeout_t stk_timerhost_process | ( | stk_timerhost_t * | host | ) |
Run the host once (polled mode only): execute pending commands, evaluate deadlines and invoke the callback of every expired timer inline.
| [in] | host | TimerHost handle initialized with stk_timerhost_init_polled(). |
STK_NO_WAIT if a timer is already overdue (call again without delay), STK_WAIT_INFINITE if no timer is active. Definition at line 200 of file stk_c_time.cpp.
References stk_timerhost_t::handle, stk::time::TimerHost::Process(), and STK_ASSERT.
| stk_timer_result_t stk_timerhost_shutdown | ( | stk_timerhost_t * | host | ) |
Gracefully shut down the TimerHost.
| [in] | host | TimerHost handle. |
Definition at line 207 of file stk_c_time.cpp.
References stk_timerhost_t::handle, stk::time::TimerHost::Shutdown(), and STK_ASSERT.
Referenced by on_shutdown_timer_expired().