1 // --------------------------------------------------------------------------
2 IMPLEMENTATION[arm && mptimer]:
5 #include "timer_sp804.h"
7 PRIVATE static Mword Timer::interval()
9 Timer_sp804 timer(Kmem::mmio_remap(Mem_layout::Timer0_phys_base));
10 Platform::system_control->modify<Mword>(Platform::System_control::Timer0_enable, 0, 0);
12 Mword frequency = 1000000;
13 Mword timer_start = ~0UL;
15 Mword sp_c = timer_start - frequency / 1000 * (1 << factor);
18 timer.counter_value(timer_start);
19 timer.reload_value(timer_start);
20 timer.enable(Timer_sp804::Ctrl_periodic);
22 Mword vc = start_as_counter();
23 while (sp_c < timer.counter())
25 Mword interval = (vc - stop_counter()) >> factor;