hw: fix 'Kernel::time()' deviation in ARM generic timer

Issue #4360
This commit is contained in:
Christian Prochaska 2022-11-10 04:20:20 +01:00 committed by Christian Helmuth
parent 866df56131
commit 345c01677d
2 changed files with 2 additions and 5 deletions

View File

@ -5,7 +5,7 @@
*/
/*
* Copyright (C) 2019 Genode Labs GmbH
* Copyright (C) 2019-2022 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU Affero General Public License version 3.
@ -34,7 +34,6 @@ Board::Timer::Timer(unsigned) : ticks_per_ms((unsigned)(_freq() / 1000))
void Timer::_start_one_shot(time_t const ticks)
{
_device.last_time = Cpu::Cntpct::read();
Cpu::Cntp_tval::write((Cpu::Cntp_tval::access_t)ticks);
Cpu::Cntp_ctl::access_t ctl = Cpu::Cntp_ctl::read();
Cpu::Cntp_ctl::Istatus::set(ctl, 0);
@ -44,7 +43,7 @@ void Timer::_start_one_shot(time_t const ticks)
time_t Timer::_duration() const
{
return Cpu::Cntpct::read() - _device.last_time;
return Cpu::Cntpct::read() - _time;
}

View File

@ -26,8 +26,6 @@ struct Board::Timer
unsigned const ticks_per_ms;
Kernel::time_t last_time { 0 };
Timer(unsigned);
};