37#if CH_CFG_INTERVALS_SIZE > CH_CFG_ST_RESOLUTION
39 (((sysinterval_t)TIME_MAX_SYSTIME) & \
40 ~(sysinterval_t)(((sysinterval_t)1 << (CH_CFG_ST_RESOLUTION / 2)) - (sysinterval_t)1))
59#if (CH_CFG_ST_TIMEDELTA > 0) || defined(__DOXYGEN__)
75 if (delay < currdelta) {
80#if CH_CFG_INTERVALS_SIZE > CH_CFG_ST_RESOLUTION
81 else if (delay > VT_MAX_DELAY) {
104 if (
likely(nowdelta < delay)) {
116#if !defined(CH_VT_RFCU_DISABLED)
147 if (delay < currdelta) {
152#if CH_CFG_INTERVALS_SIZE > CH_CFG_ST_RESOLUTION
153 else if (delay > VT_MAX_DELAY) {
156 delay = VT_MAX_DELAY;
183 port_timer_set_alarm(
chTimeAddX(now, currdelta));
190#if !defined(CH_VT_RFCU_DISABLED)
210#if CH_CFG_ST_TIMEDELTA > 0
226 delta = nowdelta + delay;
231 if (delta < nowdelta) {
237 if (delta < vtlp->dlist.next->delta) {
345#if CH_CFG_ST_TIMEDELTA == 0
389 port_timer_stop_alarm();
435 if (dlp == &vtp->
dlist) {
436#if CH_CFG_ST_TIMEDELTA > 0
439 if (nowdelta > delta) {
442 return delta - nowdelta;
448 }
while (dlp != &vtlp->
dlist);
469#if CH_CFG_ST_TIMEDELTA == 0
515 if (nowdelta < vtp->dlist.delta) {
529 port_timer_stop_alarm();
550#if !defined(CH_VT_RFCU_DISABLED)
552 if (nowdelta > vtp->
reload) {
563 delay = vtp->
reload - nowdelta;
567 chDbgAssert(nowdelta <= vtp->reload,
"skipped deadline");
570 delay = vtp->
reload - nowdelta;
585 delta = nowdelta + delay;
586 if (delta < nowdelta) {
610#if (CH_CFG_USE_TIMESTAMP == TRUE) || defined(__DOXYGEN__)
#define chSysLockFromISR()
Enters the kernel lock state from within an interrupt handler.
#define chTimeAddX(systime, interval)
Adds an interval to a system time returning a system time.
#define chVTGetSystemTimeX()
Current system time.
#define chTimeDiffX(start, end)
Subtracts two system times returning an interval.
#define chSysUnlockFromISR()
Leaves the kernel lock state from within an interrupt handler.
#define chDbgAssert(c, r)
Condition assertion.
#define chDbgCheck(c)
Function parameters check.
#define chDbgCheckClassI()
static ch_delta_list_t * ch_dlist_remove_first(ch_delta_list_t *dlhp)
Dequeues an element from the delta list.
static void ch_dlist_insert_after(ch_delta_list_t *dlhp, ch_delta_list_t *dlp, sysinterval_t delta)
Inserts an element after another header element.
static bool ch_dlist_notempty(ch_delta_list_t *dlhp)
Evaluates to true if the specified queue is not empty.
static bool ch_dlist_isfirst(ch_delta_list_t *dlhp, ch_delta_list_t *dlp)
Fist element in the delta list check.
static ch_delta_list_t * ch_dlist_dequeue(ch_delta_list_t *dlp)
Dequeues an element from the delta list.
struct ch_delta_list ch_delta_list_t
Type of a generic bidirectional linked delta list header and element.
static bool ch_dlist_isempty(ch_delta_list_t *dlhp)
Evaluates to true if the specified delta list is empty.
static void ch_dlist_insert(ch_delta_list_t *dlhp, ch_delta_list_t *dlep, sysinterval_t delta)
Inserts an element in a delta list.
#define likely(x)
Marks a boolean expression as likely true.
struct ch_virtual_timers_list virtual_timers_list_t
Type of virtual timers list header.
struct ch_virtual_timer virtual_timer_t
Type of a Virtual Timer.
struct ch_os_instance os_instance_t
Type of an OS instance structure.
#define unlikely(x)
Marks a boolean expression as likely false.
void(* vtfunc_t)(virtual_timer_t *vtp, void *p)
Type of a Virtual Timer callback function.
void chRFCUCollectFaultsI(rfcu_mask_t mask)
Adds fault flags to the current mask.
#define CH_RFCU_VT_INSUFFICIENT_DELTA
#define CH_RFCU_VT_SKIPPED_DEADLINE
#define CH_CFG_ST_TIMEDELTA
#define currcore
Access to current core's instance structure.
uint64_t systime_t
Type of system time.
#define TIME_IMMEDIATE
Zero interval specification for some functions with a timeout specification.
uint64_t sysinterval_t
Type of time interval.
uint64_t systimestamp_t
Type of a time stamp.
void chVTDoTickI(void)
Virtual timers ticker.
void chVTDoSetI(virtual_timer_t *vtp, sysinterval_t delay, vtfunc_t vtfunc, void *par)
Enables a one-shot virtual timer.
void chVTResetTimeStampI(void)
Resets and re-synchronizes the time stamps monotonic counter.
static bool chVTIsArmedI(const virtual_timer_t *vtp)
Returns true if the specified timer is armed.
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.
sysinterval_t chVTGetRemainingIntervalI(virtual_timer_t *vtp)
Returns the remaining time interval before next timer trigger.
systimestamp_t chVTGetTimeStampI(void)
Generates a monotonic time stamp.
static void vt_set_alarm(systime_t now, sysinterval_t delay)
Alarm time setup.
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.
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.
ch_delta_list_t * next
Next in the delta list.
sysinterval_t delta
Time interval from previous.
virtual_timers_list_t vtlist
Virtual timers delta list header.
ch_delta_list_t dlist
Delta list element.
void * par
Timer callback function parameter.
sysinterval_t reload
Current reload interval.
vtfunc_t func
Timer callback function pointer.
volatile uint64_t laststamp
Last generated time stamp.
ch_delta_list_t dlist
Delta list header.
volatile systime_t systime
System Time counter.
systime_t lasttime
System time of the last tick event.