mirror of
https://github.com/genodelabs/genode.git
synced 2025-02-20 01:36:22 +00:00
parent
ffaf99ae86
commit
d9073a1848
@ -26,7 +26,8 @@ using namespace Kernel;
|
||||
Timer_driver::Timer_driver(unsigned)
|
||||
: Mmio(Platform::mmio_to_virt(Board::Cpu_mmio::PRIVATE_TIMER_MMIO_BASE))
|
||||
{
|
||||
static_assert(TICS_PER_MS >= 1000, "Bad TICS_PER_MS value");
|
||||
static_assert(TICS_PER_MS >= (unsigned)TIMER_MIN_TICKS_PER_MS,
|
||||
"Bad TICS_PER_MS value");
|
||||
write<Control::Timer_enable>(0);
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,7 @@ Timer_driver::Timer_driver(unsigned)
|
||||
|
||||
/* Calculate timer frequency */
|
||||
ticks_per_ms = pit_calc_timer_freq();
|
||||
assert(ticks_per_ms >= 1000);
|
||||
assert(ticks_per_ms >= TIMER_MIN_TICKS_PER_MS);
|
||||
}
|
||||
|
||||
|
||||
|
@ -16,6 +16,8 @@
|
||||
|
||||
namespace Genode {
|
||||
|
||||
enum { TIMER_MIN_TICKS_PER_MS = 1000ULL };
|
||||
|
||||
/*
|
||||
* Translate timer ticks to microseconds without losing precicision
|
||||
*
|
||||
@ -28,8 +30,9 @@ namespace Genode {
|
||||
* shifting the values to their optimal bit position. Afterwards, the
|
||||
* results are shifted back and merged together again.
|
||||
*
|
||||
* Please ensure that the assertion "ticks_per_ms >= 1000" is true
|
||||
* when calling this method!
|
||||
* Please ensure that the assertion
|
||||
* "ticks_per_ms >= TIMER_MIN_TICKS_PER_MS" is true when calling this
|
||||
* method!
|
||||
*/
|
||||
template <typename RESULT_T, typename TICS_PER_MS_T>
|
||||
RESULT_T timer_ticks_to_us(RESULT_T const ticks,
|
||||
|
@ -92,7 +92,8 @@ Duration Timer::Time_source::curr_time()
|
||||
ticks = PIT_MAX_COUNT + 1 - curr_counter;
|
||||
}
|
||||
|
||||
static_assert(PIT_TICKS_PER_MSEC >= 1000, "Bad TICS_PER_MS value");
|
||||
static_assert(PIT_TICKS_PER_MSEC >= (unsigned)TIMER_MIN_TICKS_PER_MS,
|
||||
"Bad TICS_PER_MS value");
|
||||
_curr_time_us += timer_ticks_to_us(ticks, PIT_TICKS_PER_MSEC);
|
||||
|
||||
/* use current counter as the reference for the next update */
|
||||
|
Loading…
x
Reference in New Issue
Block a user