aboutsummaryrefslogtreecommitdiffstats
path: root/os/rt/src/chvt.c
diff options
context:
space:
mode:
Diffstat (limited to 'os/rt/src/chvt.c')
-rw-r--r--os/rt/src/chvt.c102
1 files changed, 51 insertions, 51 deletions
diff --git a/os/rt/src/chvt.c b/os/rt/src/chvt.c
index 214e8a7b6..2231e002b 100644
--- a/os/rt/src/chvt.c
+++ b/os/rt/src/chvt.c
@@ -60,13 +60,13 @@
*/
void _vt_init(void) {
- ch.vtlist.vt_next = (virtual_timer_t *)&ch.vtlist;
- ch.vtlist.vt_prev = (virtual_timer_t *)&ch.vtlist;
- ch.vtlist.vt_delta = (systime_t)-1;
+ ch.vtlist.next = (virtual_timer_t *)&ch.vtlist;
+ ch.vtlist.prev = (virtual_timer_t *)&ch.vtlist;
+ ch.vtlist.delta = (systime_t)-1;
#if CH_CFG_ST_TIMEDELTA == 0
- ch.vtlist.vt_systime = (systime_t)0;
+ ch.vtlist.systime = (systime_t)0;
#else /* CH_CFG_ST_TIMEDELTA > 0 */
- ch.vtlist.vt_lasttime = (systime_t)0;
+ ch.vtlist.lasttime = (systime_t)0;
#endif /* CH_CFG_ST_TIMEDELTA > 0 */
}
@@ -100,8 +100,8 @@ void chVTDoSetI(virtual_timer_t *vtp, systime_t delay,
chDbgCheckClassI();
chDbgCheck((vtp != NULL) && (vtfunc != NULL) && (delay != TIME_IMMEDIATE));
- vtp->vt_par = par;
- vtp->vt_func = vtfunc;
+ vtp->par = par;
+ vtp->func = vtfunc;
#if CH_CFG_ST_TIMEDELTA > 0
{
@@ -114,30 +114,30 @@ void chVTDoSetI(virtual_timer_t *vtp, systime_t delay,
}
/* Special case where the timers list is empty.*/
- if (&ch.vtlist == (virtual_timers_list_t *)ch.vtlist.vt_next) {
+ if (&ch.vtlist == (virtual_timers_list_t *)ch.vtlist.next) {
/* The delta list is empty, the current time becomes the new
delta list base time, the timer is inserted.*/
- ch.vtlist.vt_lasttime = now;
- ch.vtlist.vt_next = vtp;
- ch.vtlist.vt_prev = vtp;
- vtp->vt_next = (virtual_timer_t *)&ch.vtlist;
- vtp->vt_prev = (virtual_timer_t *)&ch.vtlist;
- vtp->vt_delta = delay;
+ ch.vtlist.lasttime = now;
+ ch.vtlist.next = vtp;
+ ch.vtlist.prev = vtp;
+ vtp->next = (virtual_timer_t *)&ch.vtlist;
+ vtp->prev = (virtual_timer_t *)&ch.vtlist;
+ vtp->delta = delay;
/* Being the first element in the list the alarm timer is started.*/
- port_timer_start_alarm(ch.vtlist.vt_lasttime + delay);
+ port_timer_start_alarm(ch.vtlist.lasttime + delay);
return;
}
/* Special case where the timer will be placed as first element in a
non-empty list, the alarm needs to be recalculated.*/
- delta = now + delay - ch.vtlist.vt_lasttime;
- if (delta < ch.vtlist.vt_next->vt_delta) {
+ delta = now + delay - ch.vtlist.lasttime;
+ if (delta < ch.vtlist.next->delta) {
/* New alarm deadline.*/
- port_timer_set_alarm(ch.vtlist.vt_lasttime + delta);
+ port_timer_set_alarm(ch.vtlist.lasttime + delta);
}
}
#else /* CH_CFG_ST_TIMEDELTA == 0 */
@@ -147,23 +147,23 @@ void chVTDoSetI(virtual_timer_t *vtp, systime_t delay,
/* The delta list is scanned in order to find the correct position for
this timer. */
- p = ch.vtlist.vt_next;
- while (p->vt_delta < delta) {
- delta -= p->vt_delta;
- p = p->vt_next;
+ p = ch.vtlist.next;
+ while (p->delta < delta) {
+ delta -= p->delta;
+ p = p->next;
}
/* The timer is inserted in the delta list.*/
- vtp->vt_next = p;
- vtp->vt_prev = vtp->vt_next->vt_prev;
- vtp->vt_prev->vt_next = vtp;
- p->vt_prev = vtp;
- vtp->vt_delta = delta
+ vtp->next = p;
+ vtp->prev = vtp->next->prev;
+ vtp->prev->next = vtp;
+ p->prev = vtp;
+ vtp->delta = delta
/* Special case when the timer is in last position in the list, the
value in the header must be restored.*/;
- p->vt_delta -= delta;
- ch.vtlist.vt_delta = (systime_t)-1;
+ p->delta -= delta;
+ ch.vtlist.delta = (systime_t)-1;
}
/**
@@ -178,71 +178,71 @@ void chVTDoResetI(virtual_timer_t *vtp) {
chDbgCheckClassI();
chDbgCheck(vtp != NULL);
- chDbgAssert(vtp->vt_func != NULL, "timer not set or already triggered");
+ chDbgAssert(vtp->func != NULL, "timer not set or already triggered");
#if CH_CFG_ST_TIMEDELTA == 0
/* The delta of the timer is added to the next timer.*/
- vtp->vt_next->vt_delta += vtp->vt_delta;
+ vtp->next->delta += vtp->delta;
/* Removing the element from the delta list.*/
- vtp->vt_prev->vt_next = vtp->vt_next;
- vtp->vt_next->vt_prev = vtp->vt_prev;
- vtp->vt_func = NULL;
+ vtp->prev->next = vtp->next;
+ vtp->next->prev = vtp->prev;
+ vtp->func = NULL;
/* The above code changes the value in the header when the removed element
is the last of the list, restoring it.*/
- ch.vtlist.vt_delta = (systime_t)-1;
+ ch.vtlist.delta = (systime_t)-1;
#else /* CH_CFG_ST_TIMEDELTA > 0 */
systime_t nowdelta, delta;
/* If the timer is not the first of the list then it is simply unlinked
else the operation is more complex.*/
- if (ch.vtlist.vt_next != vtp) {
+ if (ch.vtlist.next != vtp) {
/* Removing the element from the delta list.*/
- vtp->vt_prev->vt_next = vtp->vt_next;
- vtp->vt_next->vt_prev = vtp->vt_prev;
- vtp->vt_func = NULL;
+ vtp->prev->next = vtp->next;
+ vtp->next->prev = vtp->prev;
+ vtp->func = NULL;
/* Adding delta to the next element, if it is not the last one.*/
- if (&ch.vtlist != (virtual_timers_list_t *)vtp->vt_next)
- vtp->vt_next->vt_delta += vtp->vt_delta;
+ if (&ch.vtlist != (virtual_timers_list_t *)vtp->next)
+ vtp->next->delta += vtp->delta;
return;
}
/* Removing the first timer from the list.*/
- ch.vtlist.vt_next = vtp->vt_next;
- ch.vtlist.vt_next->vt_prev = (virtual_timer_t *)&ch.vtlist;
- vtp->vt_func = NULL;
+ ch.vtlist.next = vtp->next;
+ ch.vtlist.next->prev = (virtual_timer_t *)&ch.vtlist;
+ vtp->func = NULL;
/* If the list become empty then the alarm timer is stopped and done.*/
- if (&ch.vtlist == (virtual_timers_list_t *)ch.vtlist.vt_next) {
+ if (&ch.vtlist == (virtual_timers_list_t *)ch.vtlist.next) {
port_timer_stop_alarm();
return;
}
/* The delta of the removed timer is added to the new first timer.*/
- ch.vtlist.vt_next->vt_delta += vtp->vt_delta;
+ ch.vtlist.next->delta += vtp->delta;
/* If the new first timer has a delta of zero then the alarm is not
modified, the already programmed alarm will serve it.*/
-/* if (ch.vtlist.vt_next->vt_delta == 0) {
+/* if (ch.vtlist.next->delta == 0) {
return;
}*/
/* Distance in ticks between the last alarm event and current time.*/
- nowdelta = chVTGetSystemTimeX() - ch.vtlist.vt_lasttime;
+ nowdelta = chVTGetSystemTimeX() - ch.vtlist.lasttime;
/* If the current time surpassed the time of the next element in list
then the event interrupt is already pending, just return.*/
- if (nowdelta >= ch.vtlist.vt_next->vt_delta) {
+ if (nowdelta >= ch.vtlist.next->delta) {
return;
}
/* Distance from the next scheduled event and now.*/
- delta = ch.vtlist.vt_next->vt_delta - nowdelta;
+ delta = ch.vtlist.next->delta - nowdelta;
/* Making sure to not schedule an event closer than CH_CFG_ST_TIMEDELTA
ticks from now.*/
@@ -250,7 +250,7 @@ void chVTDoResetI(virtual_timer_t *vtp) {
delta = (systime_t)CH_CFG_ST_TIMEDELTA;
}
- port_timer_set_alarm(ch.vtlist.vt_lasttime + nowdelta + delta);
+ port_timer_set_alarm(ch.vtlist.lasttime + nowdelta + delta);
#endif /* CH_CFG_ST_TIMEDELTA > 0 */
}