diff options
author | Giovanni Di Sirio <gdisirio@gmail.com> | 2017-10-12 18:50:41 +0000 |
---|---|---|
committer | Giovanni Di Sirio <gdisirio@gmail.com> | 2017-10-12 18:50:41 +0000 |
commit | 750a8f14b696e51b8522cddcf0265775b610dfa1 (patch) | |
tree | 2ae9dd5af0b4faf718e1936fdcd05e5f0418364d /os/rt | |
parent | 4d0b8bdf6e8c27242b38f69c0831eb2a0ddb689f (diff) | |
download | ChibiOS-750a8f14b696e51b8522cddcf0265775b610dfa1.tar.gz ChibiOS-750a8f14b696e51b8522cddcf0265775b610dfa1.tar.bz2 ChibiOS-750a8f14b696e51b8522cddcf0265775b610dfa1.zip |
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/rt5_dev_point1@10815 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/rt')
-rw-r--r-- | os/rt/include/chvt.h | 2 | ||||
-rw-r--r-- | os/rt/src/chvt.c | 28 |
2 files changed, 15 insertions, 15 deletions
diff --git a/os/rt/include/chvt.h b/os/rt/include/chvt.h index 35bd947e0..3dc67f2a3 100644 --- a/os/rt/include/chvt.h +++ b/os/rt/include/chvt.h @@ -401,7 +401,7 @@ static inline void chVTDoTickI(void) { /* All timers within the time window are triggered and removed,
note that the loop is stopped by the timers header having
- "ch.vtlist.vt_delta == (systime_t)-1" which is greater than
+ "ch.vtlist.vt_delta == (sysinterval_t)-1" which is greater than
all deltas.*/
while (vtp->delta <= chTimeDiffX(ch.vtlist.lasttime, now)) {
vtfunc_t fn;
diff --git a/os/rt/src/chvt.c b/os/rt/src/chvt.c index f627436b4..1c5b2fea2 100644 --- a/os/rt/src/chvt.c +++ b/os/rt/src/chvt.c @@ -95,7 +95,7 @@ void _vt_init(void) { void chVTDoSetI(virtual_timer_t *vtp, sysinterval_t delay,
vtfunc_t vtfunc, void *par) {
virtual_timer_t *p;
- systime_t delta;
+ sysinterval_t delta;
chDbgCheckClassI();
chDbgCheck((vtp != NULL) && (vtfunc != NULL) && (delay != TIME_IMMEDIATE));
@@ -109,8 +109,8 @@ void chVTDoSetI(virtual_timer_t *vtp, sysinterval_t delay, /* If the requested delay is lower than the minimum safe delta then it
is raised to the minimum safe value.*/
- if (delay < (systime_t)CH_CFG_ST_TIMEDELTA) {
- delay = (systime_t)CH_CFG_ST_TIMEDELTA;
+ if (delay < (sysinterval_t)CH_CFG_ST_TIMEDELTA) {
+ delay = (sysinterval_t)CH_CFG_ST_TIMEDELTA;
}
/* Special case where the timers list is empty.*/
@@ -216,7 +216,7 @@ void chVTDoResetI(virtual_timer_t *vtp) { is the last of the list, restoring it.*/
ch.vtlist.delta = (sysinterval_t)-1;
#else /* CH_CFG_ST_TIMEDELTA > 0 */
- sysinterval_t nowdelta, delta, deadline_delta;
+ sysinterval_t nowdelta, delta;
/* If the timer is not the first of the list then it is simply unlinked
else the operation is more complex.*/
@@ -268,19 +268,19 @@ void chVTDoResetI(virtual_timer_t *vtp) { /* Making sure to not schedule an event closer than CH_CFG_ST_TIMEDELTA
ticks from now.*/
- if (delta < (systime_t)CH_CFG_ST_TIMEDELTA) {
- delta = (systime_t)CH_CFG_ST_TIMEDELTA;
+ if (delta < (sysinterval_t)CH_CFG_ST_TIMEDELTA) {
+ delta = nowdelta + (sysinterval_t)CH_CFG_ST_TIMEDELTA;
}
-
- /* Next deadline.*/
- deadline_delta = nowdelta + delta;
+ else {
+ delta = nowdelta + delta;
#if CH_CFG_INTERVALS_SIZE > CH_CFG_ST_RESOLUTION
- /* The delta could be too large for the physical timer to handle.*/
- if (deadline_delta > (sysinterval_t)TIME_MAX_SYSTIME) {
- deadline_delta = (sysinterval_t)TIME_MAX_SYSTIME;
- }
+ /* The delta could be too large for the physical timer to handle.*/
+ if (delta > (sysinterval_t)TIME_MAX_SYSTIME) {
+ delta = (sysinterval_t)TIME_MAX_SYSTIME;
+ }
#endif
- port_timer_set_alarm(chTimeAddX(ch.vtlist.lasttime, deadline_delta));
+ }
+ port_timer_set_alarm(chTimeAddX(ch.vtlist.lasttime, delta));
#endif /* CH_CFG_ST_TIMEDELTA > 0 */
}
|