Fixed a comments and added an extra check.

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@10953 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
Giovanni Di Sirio 2017-11-05 08:50:54 +00:00
parent 66905f3fb2
commit e2365fc47b
1 changed files with 8 additions and 3 deletions

View File

@ -178,6 +178,9 @@ void chVTDoSetI(virtual_timer_t *vtp, sysinterval_t delay,
/* The delta list is scanned in order to find the correct position for
this timer. */
while (p->delta < delta) {
/* Debug assert if the timer is already in the list.*/
chDbgAssert(p != vtp, "timer already armed");
delta -= p->delta;
p = p->next;
}
@ -187,11 +190,13 @@ void chVTDoSetI(virtual_timer_t *vtp, sysinterval_t delay,
vtp->prev = vtp->next->prev;
vtp->prev->next = vtp;
p->prev = vtp;
vtp->delta = delta
vtp->delta = delta;
/* Calculate new delta for the following entry.*/
p->delta -= delta;
/* Special case when the timer is in last position in the list, the
value in the header must be restored.*/;
p->delta -= delta;
value in the header must be restored.*/
ch.vtlist.delta = (sysinterval_t)-1;
}