aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--os/hal/src/st.c2
-rw-r--r--os/rt/include/chvt.h11
2 files changed, 9 insertions, 4 deletions
diff --git a/os/hal/src/st.c b/os/hal/src/st.c
index 17abecd71..9f067cfeb 100644
--- a/os/hal/src/st.c
+++ b/os/hal/src/st.c
@@ -94,8 +94,6 @@ void stStartAlarm(systime_t time) {
*/
void stStopAlarm(void) {
- osalDbgAssert(stIsAlarmActive() != false, "not active");
-
st_lld_stop_alarm();
}
diff --git a/os/rt/include/chvt.h b/os/rt/include/chvt.h
index 754483649..9538474c9 100644
--- a/os/rt/include/chvt.h
+++ b/os/rt/include/chvt.h
@@ -468,12 +468,19 @@ static inline void chVTDoTickI(void) {
systime_t delta = now - ch.vtlist.vt_lasttime;
while ((vtp = ch.vtlist.vt_next)->vt_delta <= delta) {
+ vtfunc_t fn;
+
+ /* The "last time" becomes this timer's expiration time.*/
delta -= vtp->vt_delta;
ch.vtlist.vt_lasttime += vtp->vt_delta;
- vtfunc_t fn = vtp->vt_func;
- vtp->vt_func = (vtfunc_t)NULL;
+
+ /* The timer is removed from the list and marked as non-armed.*/
vtp->vt_next->vt_prev = (virtual_timer_t *)&ch.vtlist;
ch.vtlist.vt_next = vtp->vt_next;
+ fn = vtp->vt_func;
+ vtp->vt_func = (vtfunc_t)NULL;
+
+ /* The callback is invoked outside the kernel critical zone.*/
chSysUnlockFromISR();
fn(vtp->vt_par);
chSysLockFromISR();