Kernel: Add basic HPET support to replace PIT if exists

This works same way as the PIT implementation; calls Scheduler every
milli second.
This commit is contained in:
Bananymous
2023-08-04 15:15:45 +03:00
parent ea4a70c3b3
commit 1fa7a1cac4
4 changed files with 151 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
#pragma once
#include <kernel/Timer/Timer.h>
namespace Kernel
{
class HPET final : public Timer
{
public:
static BAN::ErrorOr<BAN::UniqPtr<HPET>> create();
virtual uint64_t ms_since_boot() const override;
private:
HPET() = default;
BAN::ErrorOr<void> initialize();
void write_register(ptrdiff_t reg, uint64_t value) const;
uint64_t read_register(ptrdiff_t reg) const;
private:
uint64_t m_counter_tick_period_fs { 0 };
vaddr_t m_mmio_base { 0 };
};
}