| 
    ChibiOS 21.11.4
    
   | 
 
Time and Virtual Timers related APIs and services.

Functions | |
| static void | vt_set_alarm (systime_t now, sysinterval_t delay) | 
| Alarm time setup.   | |
| static void | vt_insert_first (virtual_timers_list_t *vtlp, virtual_timer_t *vtp, systime_t now, sysinterval_t delay) | 
| Inserts a timer as first element in a delta list.   | |
| static void | vt_enqueue (virtual_timers_list_t *vtlp, virtual_timer_t *vtp, sysinterval_t delay) | 
| Enqueues a virtual timer in a virtual timers list.   | |
| void | chVTDoSetI (virtual_timer_t *vtp, sysinterval_t delay, vtfunc_t vtfunc, void *par) | 
| Enables a one-shot virtual timer.   | |
| void | chVTDoSetContinuousI (virtual_timer_t *vtp, sysinterval_t delay, vtfunc_t vtfunc, void *par) | 
| Enables a continuous virtual timer.   | |
| void | chVTDoResetI (virtual_timer_t *vtp) | 
| Disables a Virtual Timer.   | |
| sysinterval_t | chVTGetRemainingIntervalI (virtual_timer_t *vtp) | 
| Returns the remaining time interval before next timer trigger.   | |
| void | chVTDoTickI (void) | 
| Virtual timers ticker.   | |
| systimestamp_t | chVTGetTimeStampI (void) | 
| Generates a monotonic time stamp.   | |
| void | chVTResetTimeStampI (void) | 
| Resets and re-synchronizes the time stamps monotonic counter.   | |
| static void | chVTObjectInit (virtual_timer_t *vtp) | 
Initializes a virtual_timer_t object.   | |
| static systime_t | chVTGetSystemTimeX (void) | 
| Current system time.   | |
| static systime_t | chVTGetSystemTime (void) | 
| Current system time.   | |
| static sysinterval_t | chVTTimeElapsedSinceX (systime_t start) | 
| Returns the elapsed time since the specified start time.   | |
| static bool | chVTIsSystemTimeWithinX (systime_t start, systime_t end) | 
| Checks if the current system time is within the specified time window.   | |
| static bool | chVTIsSystemTimeWithin (systime_t start, systime_t end) | 
| Checks if the current system time is within the specified time window.   | |
| static bool | chVTGetTimersStateI (sysinterval_t *timep) | 
| Returns the time interval until the next timer event.   | |
| static bool | chVTIsArmedI (const virtual_timer_t *vtp) | 
Returns true if the specified timer is armed.   | |
| static bool | chVTIsArmed (const virtual_timer_t *vtp) | 
Returns true if the specified timer is armed.   | |
| static void | chVTResetI (virtual_timer_t *vtp) | 
| Disables a Virtual Timer.   | |
| static void | chVTReset (virtual_timer_t *vtp) | 
| Disables a Virtual Timer.   | |
| static void | chVTSetI (virtual_timer_t *vtp, sysinterval_t delay, vtfunc_t vtfunc, void *par) | 
| Enables a one-shot virtual timer.   | |
| static void | chVTSet (virtual_timer_t *vtp, sysinterval_t delay, vtfunc_t vtfunc, void *par) | 
| Enables a one-shot virtual timer.   | |
| static void | chVTSetContinuousI (virtual_timer_t *vtp, sysinterval_t delay, vtfunc_t vtfunc, void *par) | 
| Enables a continuous virtual timer.   | |
| static void | chVTSetContinuous (virtual_timer_t *vtp, sysinterval_t delay, vtfunc_t vtfunc, void *par) | 
| Enables a continuous virtual timer.   | |
| static sysinterval_t | chVTGetReloadIntervalX (virtual_timer_t *vtp) | 
| Returns the current reload value.   | |
| static void | chVTSetReloadIntervalX (virtual_timer_t *vtp, sysinterval_t reload) | 
| Changes a timer reload time interval.   | |
| static systimestamp_t | chVTGetTimeStamp (void) | 
| Generates a monotonic time stamp.   | |
| static void | chVTResetTimeStamp (void) | 
| Resets and re-synchronizes the time stamps monotonic counter.   | |
| static void | __vt_object_init (virtual_timers_list_t *vtlp) | 
| Virtual Timers instance initialization.   | |
      
  | 
  static | 
Alarm time setup.
| [in] | now | last known system time | 
| [in] | delay | delay over now  | 
Definition at line 69 of file chvt.c.
References CH_CFG_ST_TIMEDELTA, CH_RFCU_VT_INSUFFICIENT_DELTA, chDbgAssert, chRFCUCollectFaultsI(), chTimeAddX, chTimeDiffX, chVTGetSystemTimeX, and likely.
Referenced by chVTDoResetI(), chVTDoTickI(), and vt_enqueue().

      
  | 
  static | 
Inserts a timer as first element in a delta list.
Definition at line 131 of file chvt.c.
References CH_CFG_ST_TIMEDELTA, ch_dlist_insert_after(), CH_RFCU_VT_INSUFFICIENT_DELTA, chDbgAssert, chRFCUCollectFaultsI(), chTimeAddX, chTimeDiffX, chVTGetSystemTimeX, ch_virtual_timer::dlist, ch_virtual_timers_list::dlist, ch_virtual_timers_list::lasttime, and likely.
Referenced by chVTDoTickI(), and vt_enqueue().

      
  | 
  static | 
Enqueues a virtual timer in a virtual timers list.
Definition at line 205 of file chvt.c.
References ch_dlist_insert(), ch_dlist_isempty(), chTimeDiffX, chVTGetSystemTimeX, ch_virtual_timer::dlist, ch_virtual_timers_list::dlist, ch_virtual_timers_list::lasttime, vt_insert_first(), and vt_set_alarm().
Referenced by chVTDoSetContinuousI(), and chVTDoSetI().

| void chVTDoSetI | ( | virtual_timer_t * | vtp, | 
| sysinterval_t | delay, | ||
| vtfunc_t | vtfunc, | ||
| void * | par ) | 
Enables a one-shot virtual timer.
The timer is enabled and programmed to trigger after the delay specified as parameter.
| [out] | vtp | pointer to a virtual_timer_t structure  | 
| [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 277 of file chvt.c.
References chDbgCheck, chDbgCheckClassI, currcore, ch_virtual_timer::func, ch_virtual_timer::par, ch_virtual_timer::reload, TIME_IMMEDIATE, and vt_enqueue().
Referenced by chSchGoSleepTimeoutS(), and chVTSetI().

| void chVTDoSetContinuousI | ( | virtual_timer_t * | vtp, | 
| sysinterval_t | delay, | ||
| vtfunc_t | vtfunc, | ||
| void * | par ) | 
Enables a continuous virtual timer.
The timer is enabled and programmed to trigger after the delay specified as parameter.
| [out] | vtp | pointer to a virtual_timer_t structure  | 
| [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 restarted. | 
| [in] | par | a parameter that will be passed to the callback function | 
Definition at line 314 of file chvt.c.
References chDbgCheck, chDbgCheckClassI, currcore, ch_virtual_timer::func, ch_virtual_timer::par, ch_virtual_timer::reload, TIME_IMMEDIATE, and vt_enqueue().
Referenced by chVTSetContinuousI().

| void chVTDoResetI | ( | virtual_timer_t * | vtp | ) | 
Disables a Virtual Timer.
| [in] | vtp | pointer to a virtual_timer_t structure | 
Definition at line 338 of file chvt.c.
References ch_dlist_dequeue(), ch_dlist_isempty(), ch_dlist_isfirst(), ch_dlist_remove_first(), chDbgAssert, chDbgCheck, chDbgCheckClassI, chTimeDiffX, chVTGetSystemTimeX, chVTIsArmedI(), currcore, ch_delta_list::delta, ch_virtual_timer::dlist, ch_virtual_timers_list::dlist, ch_virtual_timers_list::lasttime, ch_delta_list::next, and vt_set_alarm().
Referenced by chSchGoSleepTimeoutS(), and chVTResetI().

| sysinterval_t chVTGetRemainingIntervalI | ( | virtual_timer_t * | vtp | ) | 
Returns the remaining time interval before next timer trigger.
| [in] | vtp | pointer to a virtual_timer_t structure  | 
Definition at line 424 of file chvt.c.
References chDbgAssert, chDbgCheckClassI, chTimeDiffX, chVTGetSystemTimeX, currcore, ch_delta_list::delta, ch_virtual_timer::dlist, ch_virtual_timers_list::dlist, ch_virtual_timers_list::lasttime, and ch_delta_list::next.
| void chVTDoTickI | ( | void | ) | 
Virtual timers ticker.
Definition at line 464 of file chvt.c.
References ch_dlist_dequeue(), ch_dlist_insert(), ch_dlist_isempty(), ch_dlist_notempty(), CH_RFCU_VT_SKIPPED_DEADLINE, chDbgAssert, chDbgCheckClassI, chRFCUCollectFaultsI(), chSysLockFromISR, chSysUnlockFromISR, chTimeAddX, chTimeDiffX, chVTGetSystemTimeX, currcore, ch_delta_list::delta, ch_virtual_timer::dlist, ch_virtual_timers_list::dlist, ch_virtual_timer::func, ch_virtual_timers_list::lasttime, ch_delta_list::next, ch_virtual_timer::par, ch_virtual_timer::reload, ch_virtual_timers_list::systime, unlikely, vt_insert_first(), and vt_set_alarm().
Referenced by chSysTimerHandlerI().

| systimestamp_t chVTGetTimeStampI | ( | void | ) | 
Generates a monotonic time stamp.
This function generates a monotonic time stamp synchronized with the system time. The time stamp has the same resolution of system time.
Definition at line 626 of file chvt.c.
References chDbgAssert, chDbgCheckClassI, chTimeDiffX, chVTGetSystemTimeX, currcore, ch_virtual_timers_list::laststamp, and ch_os_instance::vtlist.
Referenced by chVTGetTimeStamp().
| void chVTResetTimeStampI | ( | void | ) | 
Resets and re-synchronizes the time stamps monotonic counter.
Definition at line 657 of file chvt.c.
References chDbgCheckClassI, chVTGetSystemTimeX, and currcore.
Referenced by chVTResetTimeStamp().
      
  | 
  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 104 of file chvt.h.
References ch_virtual_timer::dlist, and ch_delta_list::next.
      
  | 
  inlinestatic | 
Current system time.
Returns the number of system ticks since the chSysInit() invocation. 
systime_t size.Definition at line 122 of file chvt.h.
References currcore.
Referenced by __vt_object_init(), chVTGetSystemTime(), chVTIsSystemTimeWithinX(), and chVTTimeElapsedSinceX().
      
  | 
  inlinestatic | 
Current system time.
Returns the number of system ticks since the chSysInit() invocation. 
Definition at line 141 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 159 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 177 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 195 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 216 of file chvt.h.
References CH_CFG_ST_TIMEDELTA, chDbgCheckClassI, chTimeDiffX, chVTGetSystemTimeX, currcore, ch_delta_list::delta, ch_virtual_timers_list::dlist, ch_virtual_timers_list::lasttime, and ch_delta_list::next.
      
  | 
  inlinestatic | 
Returns true if the specified timer is armed. 
chVTObjectInit() or chVTDoSetI().| [in] | vtp | the virtual_timer_t structure pointer  | 
Definition at line 248 of file chvt.h.
References chDbgCheckClassI, ch_virtual_timer::dlist, and ch_delta_list::next.
Referenced by chSchGoSleepTimeoutS(), chVTDoResetI(), 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 265 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 285 of file chvt.h.
References chVTDoResetI(), and chVTIsArmedI().
Referenced by chVTReset(), chVTSetContinuousI(), and chVTSetI().

      
  | 
  inlinestatic | 
Disables a Virtual Timer.
chVTObjectInit() or chVTDoSetI().| [in] | vtp | the virtual_timer_t structure pointer | 
Definition at line 302 of file chvt.h.
References chSysLock, chSysUnlock, and chVTResetI().

      
  | 
  inlinestatic | 
Enables a one-shot 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 331 of file chvt.h.
References chVTDoSetI(), and chVTResetI().
Referenced by chVTSet().

      
  | 
  inlinestatic | 
Enables a one-shot 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 360 of file chvt.h.
References chSysLock, chSysUnlock, and chVTSetI().

      
  | 
  inlinestatic | 
Enables a continuous 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 390 of file chvt.h.
References chVTDoSetContinuousI(), and chVTResetI().
Referenced by chVTSetContinuous().

      
  | 
  inlinestatic | 
Enables a continuous 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 419 of file chvt.h.
References chSysLock, chSysUnlock, and chVTSetContinuousI().

      
  | 
  inlinestatic | 
Returns the current reload value.
| [in] | vtp | the virtual_timer_t structure pointer  | 
Definition at line 435 of file chvt.h.
References ch_virtual_timer::reload.
      
  | 
  inlinestatic | 
Changes a timer reload time interval.
| [in] | vtp | the virtual_timer_t structure pointer  | 
| [in] | reload | the new reload value, zero means no reload | 
Definition at line 452 of file chvt.h.
References ch_virtual_timer::reload.
      
  | 
  inlinestatic | 
Generates a monotonic time stamp.
This function generates a monotonic time stamp synchronized with the system time. The time stamp has the same resolution of system time.
Definition at line 474 of file chvt.h.
References chSysLock, chSysUnlock, and chVTGetTimeStampI().

      
  | 
  inlinestatic | 
Resets and re-synchronizes the time stamps monotonic counter.
Definition at line 491 of file chvt.h.
References chSysLock, chSysUnlock, and chVTResetTimeStampI().

      
  | 
  inlinestatic | 
Virtual Timers instance initialization.
| [out] | vtlp | pointer to the virtual_timers_list_t structure | 
Definition at line 509 of file chvt.h.
References ch_dlist_init(), chVTGetSystemTimeX(), ch_virtual_timers_list::dlist, ch_virtual_timers_list::laststamp, ch_virtual_timers_list::lasttime, and ch_virtual_timers_list::systime.
Referenced by chInstanceObjectInit().
