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.
This commit is contained in:
Maciej Pasternacki 2019-11-18 16:03:15 +01:00
parent 725d5e1aa9
commit fef738e832

View file

@ -68,6 +68,13 @@ where
.map(|x| x / ratio.denominator) .map(|x| x / ratio.denominator)
}) { }) {
None => MAX, 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), Some(x) => cmp::min(MAX, x),
}; };
mem::transmute::<_, SYST>(()).set_reload(dur); mem::transmute::<_, SYST>(()).set_reload(dur);