diff options
author | Giovanni Di Sirio <gdisirio@gmail.com> | 2015-03-23 10:28:44 +0000 |
---|---|---|
committer | Giovanni Di Sirio <gdisirio@gmail.com> | 2015-03-23 10:28:44 +0000 |
commit | 775ab02a91ab162685b34018357e6b3b9480b5c2 (patch) | |
tree | feb1683266538765e31e1abe6151db6b81c6a249 /os/rt/include | |
parent | ac82171cfe9a05f6f8902bb77341cff94fd2450a (diff) | |
download | ChibiOS-775ab02a91ab162685b34018357e6b3b9480b5c2.tar.gz ChibiOS-775ab02a91ab162685b34018357e6b3b9480b5c2.tar.bz2 ChibiOS-775ab02a91ab162685b34018357e6b3b9480b5c2.zip |
Tentative fix for tickless mode.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@7797 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/rt/include')
-rw-r--r-- | os/rt/include/chvt.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/os/rt/include/chvt.h b/os/rt/include/chvt.h index 1bc83d908..736d572b4 100644 --- a/os/rt/include/chvt.h +++ b/os/rt/include/chvt.h @@ -494,6 +494,15 @@ static inline void chVTDoTickI(void) { ch.vtlist.vt_next = vtp->vt_next;
fn = vtp->vt_func;
vtp->vt_func = NULL;
+
+ /* If the list is empty then the timer is stopped.*/
+ if (&ch.vtlist == (virtual_timers_list_t *)ch.vtlist.vt_next) {
+ port_timer_stop_alarm();
+ }
+
+ /* Leaving the system critical zone in order to execute the callback
+ and in order to give a preemption chance to higher priority
+ interrupts.*/
chSysUnlockFromISR();
/* The callback is invoked outside the kernel critical zone.*/
@@ -503,10 +512,11 @@ static inline void chVTDoTickI(void) { of the list.*/
chSysLockFromISR();
- /* Next element in the list, if the list is empty then ending the loop.*/
+ /* If the list is empty then ending the loop, the list has to be
+ re-checked because new timers could have been added from within
+ the callback.*/
vtp = ch.vtlist.vt_next;
if (&ch.vtlist == (virtual_timers_list_t *)vtp) {
- port_timer_stop_alarm();
return;
}
|