SuperTinyKernel™ RTOS 1.06.0
Lightweight, high-performance, deterministic, bare-metal C++ RTOS for resource-constrained embedded systems. MIT Open Source License.
Loading...
Searching...
No Matches
CTimerWrapper Class Reference
Inheritance diagram for CTimerWrapper:
Collaboration diagram for CTimerWrapper:

Public Member Functions

 CTimerWrapper ()
void Initialize (stk_timer_callback_t callback, void *user_data)
void SetHostHandle (stk_timerhost_t *host_handle)
void Reset ()
stk_timer_callback_t GetCallback () const
void * GetUserData () const
stk_timerhost_tGetHostHandle () const
void OnExpired (TimerHost *)
bool IsActive () const
Ticks GetDeadline () const
Ticks GetTimestamp () const
uint32_t GetPeriod () const
uint32_t GetRemainingTime () const
 Get remaining ticks until the timer next expires.

Private Types

typedef DListEntry< Timer, _ClosedLoop > DLEntryType
 Convenience alias for this entry type. Used to avoid repeating the full template spelling.
typedef DListHead< Timer, _ClosedLoop > DLHeadType
 Convenience alias for the corresponding list head type.

Private Member Functions

 STK_NONCOPYABLE_CLASS (Timer)
DLHeadTypeGetHead () const
 Get the list head this entry currently belongs to.
DLEntryTypeGetNext () const
 Get the next entry in the list.
DLEntryTypeGetPrev () const
 Get the previous entry in the list.
bool IsLinked () const
 Check whether this entry is currently a member of any list.
 operator Timer * ()
 Implicit conversion to a mutable pointer to the host object (T).
 operator const Timer * () const
 Implicit conversion to a const pointer to the host object (T).
void Link (DLHeadType *head, DLEntryType *next, DLEntryType *prev)
 Wire this entry into a list between prev and next.
void Unlink ()
 Remove this entry from its current list.

Private Attributes

stk_timerhost_tm_host_handle
 C-level host, forwarded to the callback.
stk_timer_callback_t m_callback
void * m_user_data
Ticks m_deadline
 absolute expiration time (ticks)
Ticks m_timestamp
 time at which timer expired (ticks), updated by TimerHost
uint32_t m_period
 reload period in ticks (0 = one-shot)
volatile bool m_active
 true if active
volatile bool m_pending
 true if pending to be handled
DLHeadTypem_head
 Owning list head, or NULL when the entry is not linked.
DLEntryTypem_next
 Next entry in the list, or NULL (open list boundary) / first entry (closed loop).
DLEntryTypem_prev
 Previous entry in the list, or NULL (open list boundary) / last entry (closed loop).

Detailed Description

Definition at line 40 of file stk_c_time.cpp.

Member Typedef Documentation

◆ DLEntryType

typedef DListEntry<Timer, _ClosedLoop> stk::util::DListEntry< Timer, _ClosedLoop >::DLEntryType
inherited

Convenience alias for this entry type. Used to avoid repeating the full template spelling.

Definition at line 70 of file stk_linked_list.h.

◆ DLHeadType

typedef DListHead<Timer, _ClosedLoop> stk::util::DListEntry< Timer, _ClosedLoop >::DLHeadType
inherited

Convenience alias for the corresponding list head type.

Definition at line 75 of file stk_linked_list.h.

Constructor & Destructor Documentation

◆ CTimerWrapper()

CTimerWrapper::CTimerWrapper ( )
inline

Definition at line 43 of file stk_c_time.cpp.

References m_callback, m_host_handle, and m_user_data.

Member Function Documentation

◆ GetCallback()

stk_timer_callback_t CTimerWrapper::GetCallback ( ) const
inline

Definition at line 67 of file stk_c_time.cpp.

References m_callback.

◆ GetDeadline()

Ticks stk::time::TimerHost::Timer::GetDeadline ( ) const
inlineinherited

Definition at line 154 of file stk_time_timer.h.

References m_deadline.

Referenced by stk_timer_get_deadline().

Here is the caller graph for this function:

◆ GetHead()

DLHeadType * stk::util::DListEntry< Timer, _ClosedLoop >::GetHead ( ) const
inlineinherited

Get the list head this entry currently belongs to.

Returns
Pointer to the owning DListHead, or NULL if the entry is not linked.

Definition at line 80 of file stk_linked_list.h.

◆ GetHostHandle()

stk_timerhost_t * CTimerWrapper::GetHostHandle ( ) const
inline

Definition at line 69 of file stk_c_time.cpp.

References m_host_handle.

◆ GetNext()

DLEntryType * stk::util::DListEntry< Timer, _ClosedLoop >::GetNext ( ) const
inlineinherited

Get the next entry in the list.

Returns
Pointer to the next DListEntry, or NULL if this is the last entry (open list) or the first entry (closed loop, where next wraps to first).
Note
In a closed loop (_ClosedLoop == true) this pointer is never NULL when the entry is linked.

Definition at line 88 of file stk_linked_list.h.

◆ GetPeriod()

uint32_t stk::time::TimerHost::Timer::GetPeriod ( ) const
inlineinherited

Definition at line 156 of file stk_time_timer.h.

References m_period.

Referenced by stk_timer_get_period().

Here is the caller graph for this function:

◆ GetPrev()

DLEntryType * stk::util::DListEntry< Timer, _ClosedLoop >::GetPrev ( ) const
inlineinherited

Get the previous entry in the list.

Returns
Pointer to the previous DListEntry, or NULL if this is the first entry (open list) or the last entry (closed loop, where prev wraps to last).
Note
In a closed loop (_ClosedLoop == true) this pointer is never NULL when the entry is linked.

Definition at line 96 of file stk_linked_list.h.

◆ GetRemainingTime()

uint32_t stk::time::TimerHost::Timer::GetRemainingTime ( ) const
inlineinherited

Get remaining ticks until the timer next expires.

Returns
Ticks remaining, or 0 if already expired / not active.
Note
The value is advisory: it is computed from m_now (the last value written by the tick task) and may be up to one tick task wake cycle stale. If the deadline has already passed but not yet been processed, 0 is returned.

Definition at line 371 of file stk_time_timer.h.

References stk::GetTicks(), m_active, and m_deadline.

Referenced by stk_timer_get_remaining_time().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetTimestamp()

Ticks stk::time::TimerHost::Timer::GetTimestamp ( ) const
inlineinherited

Definition at line 155 of file stk_time_timer.h.

References m_timestamp.

Referenced by stk_timer_get_timestamp().

Here is the caller graph for this function:

◆ GetUserData()

void * CTimerWrapper::GetUserData ( ) const
inline

Definition at line 68 of file stk_c_time.cpp.

References m_user_data.

◆ Initialize()

void CTimerWrapper::Initialize ( stk_timer_callback_t callback,
void * user_data )
inline

Definition at line 46 of file stk_c_time.cpp.

References m_callback, m_user_data, and STK_ASSERT.

◆ IsActive()

bool stk::time::TimerHost::Timer::IsActive ( ) const
inlineinherited

Definition at line 153 of file stk_time_timer.h.

References m_active.

Referenced by osTimerDelete(), osTimerStop(), stk_timer_destroy(), and stk_timer_is_active().

Here is the caller graph for this function:

◆ IsLinked()

bool stk::util::DListEntry< Timer, _ClosedLoop >::IsLinked ( ) const
inlineinherited

Check whether this entry is currently a member of any list.

Returns
true if linked (m_head != NULL); false otherwise.

Definition at line 101 of file stk_linked_list.h.

◆ Link()

void stk::util::DListEntry< Timer, _ClosedLoop >::Link ( DLHeadType * head,
DLEntryType * next,
DLEntryType * prev )
inlineprivateinherited

Wire this entry into a list between prev and next.

Parameters
[in]headThe owning DListHead. Stored as a back-pointer for IsLinked() and ownership checks.
[in]nextThe entry that will follow this one, or NULL if this becomes the last entry.
[in]prevThe entry that will precede this one, or NULL if this becomes the first entry.
Note
Called exclusively by DListHead::Link(). Assumes the entry is not currently linked. Updates the neighbours' forward/back pointers to splice this entry in.

Definition at line 137 of file stk_linked_list.h.

◆ OnExpired()

void CTimerWrapper::OnExpired ( TimerHost * )
inlinevirtual

Implements stk::time::TimerHost::Timer.

Definition at line 71 of file stk_c_time.cpp.

References m_callback, m_host_handle, m_user_data, and stk::time::TimerHost::Timer::TimerHost.

Here is the call graph for this function:

◆ operator const Timer *()

stk::util::DListEntry< Timer, _ClosedLoop >::operator const Timer * ( ) const
inlineinherited

Implicit conversion to a const pointer to the host object (T).

Note
Safe because T must derive from DListEntry<T, _ClosedLoop>. Eliminates the need for explicit static_cast at call sites.
MISRA deviation: [STK-DEV-004] Rule 5-2-x.

Definition at line 115 of file stk_linked_list.h.

◆ operator Timer *()

stk::util::DListEntry< Timer, _ClosedLoop >::operator Timer* ( )
inlineinherited

Implicit conversion to a mutable pointer to the host object (T).

Note
Safe because T must derive from DListEntry<T, _ClosedLoop>. Eliminates the need for explicit static_cast at call sites.
MISRA deviation: [STK-DEV-004] Rule 5-2-x.

Definition at line 108 of file stk_linked_list.h.

◆ Reset()

void CTimerWrapper::Reset ( )
inline

Definition at line 60 of file stk_c_time.cpp.

References m_callback, m_host_handle, and m_user_data.

Referenced by stk_timer_destroy().

Here is the caller graph for this function:

◆ SetHostHandle()

void CTimerWrapper::SetHostHandle ( stk_timerhost_t * host_handle)
inline

Definition at line 57 of file stk_c_time.cpp.

References m_host_handle.

Referenced by stk_timer_restart(), stk_timer_start(), and stk_timer_start_or_reset().

Here is the caller graph for this function:

◆ STK_NONCOPYABLE_CLASS()

stk::time::TimerHost::Timer::STK_NONCOPYABLE_CLASS ( Timer )
privateinherited

References Timer().

Here is the call graph for this function:

◆ Unlink()

void stk::util::DListEntry< Timer, _ClosedLoop >::Unlink ( )
inlineprivateinherited

Remove this entry from its current list.

Note
Called exclusively by DListHead::Unlink(). Patches the neighbours' pointers to bridge over this entry, then clears m_head, m_next, and m_prev to NULL so the entry is in a clean unlinked state.
Does not update DListHead::m_count or m_first / m_last — those are the responsibility of the calling DListHead::Unlink().

Definition at line 157 of file stk_linked_list.h.

Member Data Documentation

◆ m_active

◆ m_callback

stk_timer_callback_t CTimerWrapper::m_callback
private

Definition at line 79 of file stk_c_time.cpp.

Referenced by CTimerWrapper(), GetCallback(), Initialize(), OnExpired(), and Reset().

◆ m_deadline

Ticks stk::time::TimerHost::Timer::m_deadline
privateinherited

absolute expiration time (ticks)

Definition at line 169 of file stk_time_timer.h.

Referenced by GetDeadline(), GetRemainingTime(), stk::time::TimerHost::ProcessCommands(), Timer(), and stk::time::TimerHost::UpdateTime().

◆ m_head

DLHeadType* stk::util::DListEntry< Timer, _ClosedLoop >::m_head
privateinherited

Owning list head, or NULL when the entry is not linked.

Definition at line 170 of file stk_linked_list.h.

◆ m_host_handle

stk_timerhost_t* CTimerWrapper::m_host_handle
private

C-level host, forwarded to the callback.

Definition at line 78 of file stk_c_time.cpp.

Referenced by CTimerWrapper(), GetHostHandle(), OnExpired(), Reset(), and SetHostHandle().

◆ m_next

DLEntryType* stk::util::DListEntry< Timer, _ClosedLoop >::m_next
privateinherited

Next entry in the list, or NULL (open list boundary) / first entry (closed loop).

Definition at line 171 of file stk_linked_list.h.

◆ m_pending

volatile bool stk::time::TimerHost::Timer::m_pending
privateinherited

◆ m_period

uint32_t stk::time::TimerHost::Timer::m_period
privateinherited

◆ m_prev

DLEntryType* stk::util::DListEntry< Timer, _ClosedLoop >::m_prev
privateinherited

Previous entry in the list, or NULL (open list boundary) / last entry (closed loop).

Definition at line 172 of file stk_linked_list.h.

◆ m_timestamp

Ticks stk::time::TimerHost::Timer::m_timestamp
privateinherited

time at which timer expired (ticks), updated by TimerHost

Definition at line 170 of file stk_time_timer.h.

Referenced by GetTimestamp(), Timer(), and stk::time::TimerHost::UpdateTime().

◆ m_user_data

void* CTimerWrapper::m_user_data
private

Definition at line 80 of file stk_c_time.cpp.

Referenced by CTimerWrapper(), GetUserData(), Initialize(), OnExpired(), and Reset().


The documentation for this class was generated from the following file: