hw rpi: fix bug that caused bad timer precision

The kernel timer on RPI is able to measure time microseconds-precise.
Howeer, due to a bug, we dropped precision during the ticks-to-time
translation and return only milliseconds-precise time.

Ref #2400
This commit is contained in:
Martin Stein 2017-08-07 14:27:55 +02:00 committed by Christian Helmuth
parent 6dfb903bd0
commit 31af206a8c
2 changed files with 3 additions and 3 deletions

View File

@ -35,11 +35,11 @@ void Timer::_start_one_shot(time_t const ticks)
time_t Timer::_ticks_to_us(time_t const ticks) const {
return (ticks / Driver::TICS_PER_MS) * 1000; }
return ticks / Driver::TICS_PER_US; }
time_t Timer::us_to_ticks(time_t const us) const {
return (us / 1000) * Driver::TICS_PER_MS; }
return us * Driver::TICS_PER_US; }
time_t Timer::_max_value() const {

View File

@ -29,7 +29,7 @@ namespace Kernel { class Timer_driver; }
*/
struct Kernel::Timer_driver : Genode::Mmio
{
enum { TICS_PER_MS = Board::SYSTEM_TIMER_CLOCK / 1000 };
enum { TICS_PER_US = Board::SYSTEM_TIMER_CLOCK / 1000 / 1000 };
struct Cs : Register<0x0, 32> { struct M1 : Bitfield<1, 1> { }; };
struct Clo : Register<0x4, 32> { };