aboutsummaryrefslogtreecommitdiff
path: root/src/tq.rs
diff options
context:
space:
mode:
authorGravatar Maciej Pasternacki <maciej@3ofcoins.net> 2019-11-18 16:03:15 +0100
committerGravatar Maciej Pasternacki <maciej@3ofcoins.net> 2019-11-19 00:07:14 +0100
commitfef738e832e3d16009ce9b33d1918e131ff9a8cf (patch)
tree6cf5bfce9855d6f2a5a694b53414aef2a27b23c4 /src/tq.rs
parent725d5e1aa9d0276783765dcabe5430f03ea13dd5 (diff)
downloadrtic-fef738e832e3d16009ce9b33d1918e131ff9a8cf.tar.gz
rtic-fef738e832e3d16009ce9b33d1918e131ff9a8cf.tar.zst
rtic-fef738e832e3d16009ce9b33d1918e131ff9a8cf.zip
TimerQueue.dequeue: don't set SYST reload to 0
ARM Architecture Reference Manual says: "Setting SYST_RVR to zero has the effect of disabling the SysTick counter independently of the counter enable bit." If Monotonic's ratio is less than one, the timeout calculations can compute zero if next task is scheduled after current instant, but before next timer tick. This results in disabling SYST and freezing the timer queue.
Diffstat (limited to 'src/tq.rs')
-rw-r--r--src/tq.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/tq.rs b/src/tq.rs
index 4edb40a7..21beeb9c 100644
--- a/src/tq.rs
+++ b/src/tq.rs
@@ -68,6 +68,13 @@ where
.map(|x| x / ratio.denominator)
}) {
None => MAX,
+
+ // ARM Architecture Reference Manual says:
+ // "Setting SYST_RVR to zero has the effect of
+ // disabling the SysTick counter independently
+ // of the counter enable bit."
+ Some(0) => 1,
+
Some(x) => cmp::min(MAX, x),
};
mem::transmute::<_, SYST>(()).set_reload(dur);