aboutsummaryrefslogtreecommitdiffstats
path: root/os
diff options
context:
space:
mode:
authorGiovanni Di Sirio <gdisirio@gmail.com>2017-11-05 08:50:54 +0000
committerGiovanni Di Sirio <gdisirio@gmail.com>2017-11-05 08:50:54 +0000
commite2365fc47b34c954f99dd466b6253629d7a31a1d (patch)
tree4e2b588019244fabd113fa98c353a6f9277af958 /os
parent66905f3fb2a92d770d643c4e70ef04e42477701b (diff)
downloadChibiOS-e2365fc47b34c954f99dd466b6253629d7a31a1d.tar.gz
ChibiOS-e2365fc47b34c954f99dd466b6253629d7a31a1d.tar.bz2
ChibiOS-e2365fc47b34c954f99dd466b6253629d7a31a1d.zip
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
Diffstat (limited to 'os')
-rw-r--r--os/rt/src/chvt.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/os/rt/src/chvt.c b/os/rt/src/chvt.c
index 0667bf7c3..ebf528f94 100644
--- a/os/rt/src/chvt.c
+++ b/os/rt/src/chvt.c
@@ -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;
- /* Special case when the timer is in last position in the list, the
- value in the header must be restored.*/;
+ /* 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.*/
ch.vtlist.delta = (sysinterval_t)-1;
}