hw cortex_a9: fix bug in kernel timer

A bug in the timer-ticks-to-microseconds translation of the kernel timer
caused the user time to periodically get stuck for about 32 milliseconds
and then jump forward to the normal level again.

Ref #2400
This commit is contained in:
Martin Stein 2017-06-20 12:16:59 +02:00 committed by Norman Feske
parent 9b1c26ab7f
commit 889db34cc3
1 changed files with 3 additions and 3 deletions

View File

@ -63,11 +63,11 @@ time_t Timer::_ticks_to_us(time_t const ticks) const
MSB_RSHIFT = 10,
LSB_LSHIFT = HALF_WIDTH - MSB_RSHIFT,
};
time_t const msb = (((ticks >> MSB_RSHIFT)
time_t const msb = ((((ticks & MSB_MASK) >> MSB_RSHIFT)
* 1000) / Driver::TICS_PER_MS) << MSB_RSHIFT;
time_t const lsb = ((((ticks & LSB_MASK) << LSB_LSHIFT)
* 1000) / Driver::TICS_PER_MS) >> LSB_LSHIFT;
return (msb & MSB_MASK) | lsb;
* 1000) / Driver::TICS_PER_MS) >> LSB_LSHIFT;
return msb + lsb;
}