[kernel] Fix clock period vs frequency error

Calling `spinwait()` was hanging due to improper computation of the
clock rate because justin did a dumb at math. Also the period can be
greater than 1ns, so the clock's units were updated to microseconds.
This commit is contained in:
2020-07-12 17:43:37 -07:00
parent 794c86f9b4
commit f4cbb9498f
7 changed files with 41 additions and 23 deletions

View File

@@ -20,12 +20,8 @@ public:
/// Configure the timer and start it running.
void enable();
/// Wait in a tight loop while reading the HPET counter.
/// \arg ns Number of nanoseconds to wait
void spinwait(uint64_t ns) const;
/// Get the timer rate in ticks per ns
inline uint64_t rate() const { return m_period * 1000000ull; }
/// Get the timer rate in ticks per us
inline uint64_t rate() const { return 1000000000/m_period; }
/// Get the current timer value
uint64_t value() const;