ChibiOS/RT
6.0.3
|
Time and Virtual Timers related APIs and services.
Functions | |
void | _vt_init (void) |
Virtual Timers initialization. More... | |
void | chVTDoSetI (virtual_timer_t *vtp, sysinterval_t delay, vtfunc_t vtfunc, void *par) |
Enables a virtual timer. More... | |
void | chVTDoResetI (virtual_timer_t *vtp) |
Disables a Virtual Timer. More... | |
static void | chVTObjectInit (virtual_timer_t *vtp) |
Initializes a virtual_timer_t object. More... | |
static systime_t | chVTGetSystemTimeX (void) |
Current system time. More... | |
static systime_t | chVTGetSystemTime (void) |
Current system time. More... | |
static sysinterval_t | chVTTimeElapsedSinceX (systime_t start) |
Returns the elapsed time since the specified start time. More... | |
static bool | chVTIsSystemTimeWithinX (systime_t start, systime_t end) |
Checks if the current system time is within the specified time window. More... | |
static bool | chVTIsSystemTimeWithin (systime_t start, systime_t end) |
Checks if the current system time is within the specified time window. More... | |
static bool | chVTGetTimersStateI (sysinterval_t *timep) |
Returns the time interval until the next timer event. More... | |
static bool | chVTIsArmedI (const virtual_timer_t *vtp) |
Returns true if the specified timer is armed. More... | |
static bool | chVTIsArmed (const virtual_timer_t *vtp) |
Returns true if the specified timer is armed. More... | |
static void | chVTResetI (virtual_timer_t *vtp) |
Disables a Virtual Timer. More... | |
static void | chVTReset (virtual_timer_t *vtp) |
Disables a Virtual Timer. More... | |
static void | chVTSetI (virtual_timer_t *vtp, sysinterval_t delay, vtfunc_t vtfunc, void *par) |
Enables a virtual timer. More... | |
static void | chVTSet (virtual_timer_t *vtp, sysinterval_t delay, vtfunc_t vtfunc, void *par) |
Enables a virtual timer. More... | |
static void | chVTDoTickI (void) |
Virtual timers ticker. More... | |
void _vt_init | ( | void | ) |
Virtual Timers initialization.
Definition at line 61 of file chvt.c.
References ch, ch_virtual_timers_list::delta, ch_virtual_timers_list::lasttime, ch_virtual_timers_list::next, ch_virtual_timers_list::prev, ch_virtual_timers_list::systime, and ch_system::vtlist.
Referenced by chSysInit().
void chVTDoSetI | ( | virtual_timer_t * | vtp, |
sysinterval_t | delay, | ||
vtfunc_t | vtfunc, | ||
void * | par | ||
) |
Enables a virtual timer.
The timer is enabled and programmed to trigger after the delay specified as parameter.
[out] | vtp | the virtual_timer_t structure pointer |
[in] | delay | the number of ticks before the operation timeouts, the special values are handled as follow:
|
[in] | vtfunc | the timer callback function. After invoking the callback the timer is disabled and the structure can be disposed or reused. |
[in] | par | a parameter that will be passed to the callback function |
Definition at line 95 of file chvt.c.
References ch, CH_CFG_ST_TIMEDELTA, chDbgAssert, chDbgCheck, chDbgCheckClassI(), chTimeAddX(), chTimeDiffX(), chVTGetSystemTimeX(), ch_virtual_timer::delta, ch_virtual_timers_list::delta, ch_virtual_timer::func, ch_virtual_timers_list::lasttime, ch_virtual_timer::next, ch_virtual_timers_list::next, ch_virtual_timer::par, ch_virtual_timer::prev, ch_virtual_timers_list::prev, TIME_IMMEDIATE, TIME_MAX_SYSTIME, and ch_system::vtlist.
Referenced by chSchGoSleepTimeoutS(), and chVTSetI().
void chVTDoResetI | ( | virtual_timer_t * | vtp | ) |
Disables a Virtual Timer.
[in] | vtp | the virtual_timer_t structure pointer |
Definition at line 211 of file chvt.c.
References ch, CH_CFG_ST_TIMEDELTA, chDbgAssert, chDbgCheck, chDbgCheckClassI(), chTimeAddX(), chTimeDiffX(), chVTGetSystemTimeX(), ch_virtual_timer::delta, ch_virtual_timers_list::delta, ch_virtual_timer::func, ch_virtual_timers_list::lasttime, ch_virtual_timer::next, ch_virtual_timers_list::next, ch_virtual_timer::prev, TIME_MAX_SYSTIME, and ch_system::vtlist.
Referenced by chSchGoSleepTimeoutS(), and chVTResetI().
|
inlinestatic |
Initializes a virtual_timer_t
object.
chVTSetI()
initializes the object too. This function is only useful if you need to perform a chVTIsArmed()
check before calling chVTSetI()
.[out] | vtp | the virtual_timer_t structure pointer |
Definition at line 97 of file chvt.h.
References ch_virtual_timer::func.
|
inlinestatic |
Current system time.
Returns the number of system ticks since the chSysInit()
invocation.
systime_t
size.Definition at line 115 of file chvt.h.
References ch, ch_virtual_timers_list::systime, and ch_system::vtlist.
Referenced by chThdSleepUntil(), chThdSleepUntilWindowed(), chVTDoResetI(), chVTDoSetI(), chVTDoTickI(), chVTGetSystemTime(), chVTGetTimersStateI(), chVTIsSystemTimeWithinX(), chVTTimeElapsedSinceX(), and trace_next().
|
inlinestatic |
Current system time.
Returns the number of system ticks since the chSysInit()
invocation.
Definition at line 134 of file chvt.h.
References chSysLock(), chSysUnlock(), and chVTGetSystemTimeX().
Referenced by chVTIsSystemTimeWithin().
|
inlinestatic |
Returns the elapsed time since the specified start time.
[in] | start | start time |
Definition at line 152 of file chvt.h.
References chTimeDiffX(), and chVTGetSystemTimeX().
Checks if the current system time is within the specified time window.
[in] | start | the start of the time window (inclusive) |
[in] | end | the end of the time window (non inclusive) |
true | current time within the specified time window. |
false | current time not within the specified time window. |
Definition at line 170 of file chvt.h.
References chTimeIsInRangeX(), and chVTGetSystemTimeX().
Checks if the current system time is within the specified time window.
[in] | start | the start of the time window (inclusive) |
[in] | end | the end of the time window (non inclusive) |
true | current time within the specified time window. |
false | current time not within the specified time window. |
Definition at line 188 of file chvt.h.
References chTimeIsInRangeX(), and chVTGetSystemTime().
|
inlinestatic |
Returns the time interval until the next timer event.
CH_CFG_ST_TIMEDELTA
ticks. [out] | timep | pointer to a variable that will contain the time interval until the next timer elapses. This pointer can be NULL if the information is not required. |
false | if the timers list is empty. |
true | if the timers list contains at least one timer. |
Definition at line 209 of file chvt.h.
References ch, CH_CFG_ST_TIMEDELTA, chDbgCheckClassI(), chTimeDiffX(), chVTGetSystemTimeX(), ch_virtual_timer::delta, ch_virtual_timers_list::lasttime, ch_virtual_timers_list::next, and ch_system::vtlist.
|
inlinestatic |
Returns true
if the specified timer is armed.
chVTObjectInit()
or chVTDoSetI()
.[in] | vtp | the virtual_timer_t structure pointer |
Definition at line 239 of file chvt.h.
References chDbgCheckClassI(), and ch_virtual_timer::func.
Referenced by chSchGoSleepTimeoutS(), chVTIsArmed(), and chVTResetI().
|
inlinestatic |
Returns true
if the specified timer is armed.
chVTObjectInit()
or chVTDoSetI()
.[in] | vtp | the virtual_timer_t structure pointer |
Definition at line 256 of file chvt.h.
References chSysLock(), chSysUnlock(), and chVTIsArmedI().
|
inlinestatic |
Disables a Virtual Timer.
chVTObjectInit()
or chVTDoSetI()
.[in] | vtp | the virtual_timer_t structure pointer |
Definition at line 276 of file chvt.h.
References chVTDoResetI(), and chVTIsArmedI().
Referenced by chVTReset(), and chVTSetI().
|
inlinestatic |
Disables a Virtual Timer.
chVTObjectInit()
or chVTDoSetI()
.[in] | vtp | the virtual_timer_t structure pointer |
Definition at line 293 of file chvt.h.
References chSysLock(), chSysUnlock(), and chVTResetI().
|
inlinestatic |
Enables a virtual timer.
If the virtual timer was already enabled then it is re-enabled using the new parameters.
chVTObjectInit()
or chVTDoSetI()
.[in] | vtp | the virtual_timer_t structure pointer |
[in] | delay | the number of ticks before the operation timeouts, the special values are handled as follow:
|
[in] | vtfunc | the timer callback function. After invoking the callback the timer is disabled and the structure can be disposed or reused. |
[in] | par | a parameter that will be passed to the callback function |
Definition at line 322 of file chvt.h.
References chVTDoSetI(), and chVTResetI().
Referenced by chVTSet().
|
inlinestatic |
Enables a virtual timer.
If the virtual timer was already enabled then it is re-enabled using the new parameters.
chVTObjectInit()
or chVTDoSetI()
.[in] | vtp | the virtual_timer_t structure pointer |
[in] | delay | the number of ticks before the operation timeouts, the special values are handled as follow:
|
[in] | vtfunc | the timer callback function. After invoking the callback the timer is disabled and the structure can be disposed or reused. |
[in] | par | a parameter that will be passed to the callback function |
Definition at line 351 of file chvt.h.
References chSysLock(), chSysUnlock(), and chVTSetI().
|
inlinestatic |
Virtual timers ticker.
Definition at line 368 of file chvt.h.
References ch, CH_CFG_ST_TIMEDELTA, chDbgAssert, chDbgCheckClassI(), chSysLockFromISR(), chSysUnlockFromISR(), chTimeAddX(), chTimeDiffX(), chVTGetSystemTimeX(), ch_virtual_timer::delta, ch_virtual_timer::func, ch_virtual_timers_list::lasttime, ch_virtual_timer::next, ch_virtual_timers_list::next, ch_virtual_timer::par, ch_virtual_timer::prev, ch_virtual_timers_list::systime, TIME_MAX_SYSTIME, and ch_system::vtlist.
Referenced by chSysTimerHandlerI().