mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-11 15:33:04 +00:00
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:
parent
6dfb903bd0
commit
31af206a8c
@ -35,11 +35,11 @@ void Timer::_start_one_shot(time_t const ticks)
|
|||||||
|
|
||||||
|
|
||||||
time_t Timer::_ticks_to_us(time_t const ticks) const {
|
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 {
|
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 {
|
time_t Timer::_max_value() const {
|
||||||
|
@ -29,7 +29,7 @@ namespace Kernel { class Timer_driver; }
|
|||||||
*/
|
*/
|
||||||
struct Kernel::Timer_driver : Genode::Mmio
|
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 Cs : Register<0x0, 32> { struct M1 : Bitfield<1, 1> { }; };
|
||||||
struct Clo : Register<0x4, 32> { };
|
struct Clo : Register<0x4, 32> { };
|
||||||
|
Loading…
Reference in New Issue
Block a user