From 889db34cc38f687a468711c74062d3a39f065305 Mon Sep 17 00:00:00 2001 From: Martin Stein Date: Tue, 20 Jun 2017 12:16:59 +0200 Subject: [PATCH] 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 --- repos/base-hw/src/core/spec/cortex_a9/timer.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/repos/base-hw/src/core/spec/cortex_a9/timer.cc b/repos/base-hw/src/core/spec/cortex_a9/timer.cc index 4a20750f1..fb4a9d167 100644 --- a/repos/base-hw/src/core/spec/cortex_a9/timer.cc +++ b/repos/base-hw/src/core/spec/cortex_a9/timer.cc @@ -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; }