feat: add fadt based lapic timer calibration
This commit is contained in:
parent
54d48e7d91
commit
61dfda6a70
7 changed files with 257 additions and 28 deletions
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "acpi/madt.h"
|
||||
#include "acpi/discovery.h"
|
||||
|
||||
namespace apic {
|
||||
|
||||
|
|
@ -12,6 +12,11 @@ struct timestamp_t {
|
|||
uint64_t timer_count;
|
||||
};
|
||||
|
||||
struct seconds_nanoseconds_t {
|
||||
uint64_t seconds;
|
||||
uint64_t nanoseconds;
|
||||
};
|
||||
|
||||
constexpr duration_t operator+(duration_t left, duration_t right) {
|
||||
return duration_t{left.timer_count + right.timer_count};
|
||||
}
|
||||
|
|
@ -44,13 +49,17 @@ constexpr duration_t operator-(timestamp_t left, timestamp_t right) {
|
|||
return duration_t{left.timer_count - right.timer_count};
|
||||
}
|
||||
|
||||
bool calibrateTimer(const acpi::Madt& madt);
|
||||
bool calibrateTimer(const acpi::discovery_result_t& discovery);
|
||||
|
||||
duration_t seconds(uint64_t count);
|
||||
duration_t milliseconds(uint64_t count);
|
||||
duration_t microseconds(uint64_t count);
|
||||
duration_t nanoseconds(uint64_t count);
|
||||
|
||||
seconds_nanoseconds_t toSecondsAndNanoseconds(duration_t duration);
|
||||
|
||||
void busyWait(duration_t duration);
|
||||
|
||||
timestamp_t now();
|
||||
|
||||
// TODO: when dynamic allocation and lists are available
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue