SuperTinyKernel™ RTOS 1.08.x
Lightweight, high-performance, deterministic, bare-metal C++ RTOS for resource-constrained embedded systems. MIT Open Source License.
Loading...
Searching...
No Matches
stk_time_timer.h File Reference

Implementation of stk::time::TimerHost, a software timer multiplexer that manages multiple stk::time::Timer instances. More...

Include dependency graph for stk_time_timer.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  stk::time::Timer
 Abstract base class for a timer managed by TimerHost. More...
struct  stk::time::Timer::ReadyNode
 Hook of a Timer in the ready list (expired timers waiting for a handler task). More...
class  stk::time::TimerHost
 Software timer multiplexer that manages multiple Timer instances on top of a small fixed set of kernel tasks. More...
struct  stk::time::TimerHost::TimerInfo
 Consistent snapshot of a timer, see QuerySync(). More...
struct  stk::time::TimerHost::Config
 Optional configuration of the timer tasks, see Initialize(). More...
class  stk::time::TimerHost::TimerWorkerTask
 Internal kernel task used by TimerHost for both the tick task and handler tasks. More...
struct  stk::time::TimerHost::Completion
 Completion point of a synchronous command, lives on the stack of the waiting caller. More...
struct  stk::time::TimerHost::TimerCommand
 POD command record passed from the public API methods to the tick task via the command queue. More...

Namespaces

namespace  stk
 Namespace of STK package.
namespace  stk::time
 Time-related primitives: periodic polling, elapsed-cycle measurement and software timers.

Macros

#define STK_TIMER_THREADS_COUNT   1U
 Number of threads handling timers in TimerHost (default: 1).
#define STK_TIMER_HANDLER_STACK_SIZE   256U
 Stack size of the timer handler, increase if your timers consume more (default: 256).
#define STK_TIMER_COMMAND_QUEUE_SIZE   32U
 Capacity of the command queue of TimerHost: the number of commands (Start(), Stop(), StartSync(), ...) which can wait for the tick task at once (default: 32).
#define STK_TIMER_COUNT_MAX   STK_TIMER_COMMAND_QUEUE_SIZE

Detailed Description

Implementation of stk::time::TimerHost, a software timer multiplexer that manages multiple stk::time::Timer instances.

Definition in file stk_time_timer.h.

Macro Definition Documentation

◆ STK_TIMER_COMMAND_QUEUE_SIZE

#define STK_TIMER_COMMAND_QUEUE_SIZE   32U

Capacity of the command queue of TimerHost: the number of commands (Start(), Stop(), StartSync(), ...) which can wait for the tick task at once (default: 32).

Note
It does not limit the number of timers: Timer instances are intrusive and owned by the application. When the queue is full a caller which can wait blocks until a slot is free, otherwise it gets TimerHost::RES_QUEUE_FULL, see "Command queue" in TimerHost.
For backward compatibility, if this macro is not defined but the deprecated STK_TIMER_COUNT_MAX is, the value of STK_TIMER_COUNT_MAX is used.

Definition at line 51 of file stk_time_timer.h.

◆ STK_TIMER_COUNT_MAX

#define STK_TIMER_COUNT_MAX   STK_TIMER_COMMAND_QUEUE_SIZE
Deprecated
Use STK_TIMER_COMMAND_QUEUE_SIZE instead. The old name suggested a limit on the number of timers, but it has always been the capacity of the command queue only (timers are intrusive and not limited by TimerHost). It is kept so existing build configurations keep compiling: defining it (without defining STK_TIMER_COMMAND_QUEUE_SIZE) sets the queue capacity, and when not defined it reads as STK_TIMER_COMMAND_QUEUE_SIZE. TimerHost itself does not use it.

Definition at line 63 of file stk_time_timer.h.

◆ STK_TIMER_HANDLER_STACK_SIZE

#define STK_TIMER_HANDLER_STACK_SIZE   256U

Stack size of the timer handler, increase if your timers consume more (default: 256).

Definition at line 35 of file stk_time_timer.h.

◆ STK_TIMER_THREADS_COUNT

#define STK_TIMER_THREADS_COUNT   1U

Number of threads handling timers in TimerHost (default: 1).

Definition at line 28 of file stk_time_timer.h.

Referenced by stk::time::TimerHost::Initialize(), stk::time::TimerHost::IsHostTid(), stk::time::TimerHost::ProcessTimers(), and stk::time::TimerHost::WaitCallbackDone().