The Timer Class. This class provides kernel-managed timers, used to provide high-precision delays. Functionality is useful to both user-code, and is used extensively within the kernel and its blocking objects to implement round-robin scheduling, thread sleep, and timeouts. Provides one-shot and periodic timers for use by application code. This object relies on a target-defined hardware timer implementation, which is multiplexed by the kernel's timer scheduler.
More...
#include <timer.h>
|
void * | operator new (size_t sz, void *pv) |
|
| ~Timer () |
|
| Timer () |
| Timer Default Constructor - Do nothing. Allow the init call to perform the necessary object initialization prior to use. More...
|
|
void | Init () |
| Init Re-initialize the Timer to default values. More...
|
|
void | Start (bool bRepeat_, uint32_t u32IntervalMs_, TimerCallback pfCallback_, void *pvData_) |
| Start Start a timer using default ownership, using repeats as an option, and millisecond resolution. More...
|
|
void | Start () |
| Start Start or restart a timer using parameters previously configured via calls to Start(<with args>), or via the a-la-carte parameter setter methods. This is especially useful for retriggering one-shot timers that have previously expired, using the timer's previous configuration. More...
|
|
void | Stop () |
| Stop Stop a timer already in progress. Has no effect on timers that have already been stopped. More...
|
|
Timer * | GetNext () |
|
Timer * | GetPrev () |
|
LinkListNode * | GetNext (void) |
| GetNext. More...
|
|
LinkListNode * | GetPrev (void) |
| GetPrev. More...
|
|
The Timer Class. This class provides kernel-managed timers, used to provide high-precision delays. Functionality is useful to both user-code, and is used extensively within the kernel and its blocking objects to implement round-robin scheduling, thread sleep, and timeouts. Provides one-shot and periodic timers for use by application code. This object relies on a target-defined hardware timer implementation, which is multiplexed by the kernel's timer scheduler.
- Examples:
- lab6_timers/main.cpp.
Definition at line 68 of file timer.h.
◆ ~Timer()
◆ Timer()
Timer Default Constructor - Do nothing. Allow the init call to perform the necessary object initialization prior to use.
Definition at line 29 of file timer.cpp.
◆ Init()
void Mark3::Timer::Init |
( |
void |
| ) |
|
Init Re-initialize the Timer to default values.
Definition at line 36 of file timer.cpp.
◆ IsInitialized()
bool Mark3::Timer::IsInitialized |
( |
void |
| ) |
|
|
inlineprivate |
IsInitialized.
- Returns
- true if initialized, false if not initialized.
Definition at line 127 of file timer.h.
◆ MSecondsToTicks()
static uint32_t Mark3::Timer::MSecondsToTicks |
( |
uint32_t |
x | ) |
|
|
inlinestaticprivate |
◆ operator new()
void* Mark3::Timer::operator new |
( |
size_t |
sz, |
|
|
void * |
pv |
|
) |
| |
|
inline |
◆ SecondsToTicks()
static uint32_t Mark3::Timer::SecondsToTicks |
( |
uint32_t |
x | ) |
|
|
inlinestaticprivate |
◆ SetInitialized()
void Mark3::Timer::SetInitialized |
( |
void |
| ) |
|
|
inlineprivate |
SetInitialized.
Definition at line 121 of file timer.h.
◆ Start() [1/2]
void Mark3::Timer::Start |
( |
bool |
bRepeat_, |
|
|
uint32_t |
u32IntervalMs_, |
|
|
TimerCallback |
pfCallback_, |
|
|
void * |
pvData_ |
|
) |
| |
Start Start a timer using default ownership, using repeats as an option, and millisecond resolution.
- Parameters
-
bRepeat_ | 0 - timer is one-shot. 1 - timer is repeating. |
u32IntervalMs_ | - Interval of the timer in miliseconds |
pfCallback_ | - Function to call on timer expiry |
pvData_ | - Data to pass into the callback function |
- Examples:
- lab6_timers/main.cpp.
Definition at line 51 of file timer.cpp.
◆ Start() [2/2]
void Mark3::Timer::Start |
( |
void |
| ) |
|
Start Start or restart a timer using parameters previously configured via calls to Start(<with args>), or via the a-la-carte parameter setter methods. This is especially useful for retriggering one-shot timers that have previously expired, using the timer's previous configuration.
Definition at line 73 of file timer.cpp.
◆ Stop()
void Mark3::Timer::Stop |
( |
void |
| ) |
|
Stop Stop a timer already in progress. Has no effect on timers that have already been stopped.
Definition at line 86 of file timer.cpp.
◆ USecondsToTicks()
static uint32_t Mark3::Timer::USecondsToTicks |
( |
uint32_t |
x | ) |
|
|
inlinestaticprivate |
◆ TimerList
◆ m_pclOwner
Thread* Mark3::Timer::m_pclOwner |
|
private |
Pointer to the owner thread.
Definition at line 152 of file timer.h.
◆ m_pfCallback
Pointer to the callback function.
Definition at line 143 of file timer.h.
◆ m_pvData
void* Mark3::Timer::m_pvData |
|
private |
Pointer to the callback data.
Definition at line 155 of file timer.h.
◆ m_u32Interval
uint32_t Mark3::Timer::m_u32Interval |
|
private |
Interval of the timer in timer ticks.
Definition at line 146 of file timer.h.
◆ m_u32TimeLeft
uint32_t Mark3::Timer::m_u32TimeLeft |
|
private |
Time remaining on the timer.
Definition at line 149 of file timer.h.
◆ m_u8Flags
uint8_t Mark3::Timer::m_u8Flags |
|
private |
Flags for the timer, defining if the timer is one-shot or repeated.
Definition at line 140 of file timer.h.
◆ m_u8Initialized
uint8_t Mark3::Timer::m_u8Initialized |
|
private |
Cookie used to determine whether or not the timer is initialized.
Definition at line 137 of file timer.h.
◆ m_uTimerInitCookie
constexpr auto Mark3::Timer::m_uTimerInitCookie = uint8_t { 0xC3 } |
|
staticprivate |
◆ m_uTimerInvalidCookie
constexpr auto Mark3::Timer::m_uTimerInvalidCookie = uint8_t { 0x3C } |
|
staticprivate |
The documentation for this class was generated from the following files:
- /mnt/c/Users/moslevin/m3-repo2/kernel/src/public/timer.h
- /mnt/c/Users/moslevin/m3-repo2/kernel/src/timer.cpp