Kernel: Add HPET::read_main_counter()

This commit is contained in:
Maciej Zygmanowski 2021-01-23 20:23:00 +01:00 committed by Andreas Kling
parent 67e93745cb
commit ceb5682b54
Notes: sideshowbarker 2024-07-18 22:50:16 +09:00
2 changed files with 7 additions and 0 deletions

View File

@ -271,6 +271,12 @@ u64 HPET::update_time(u64& seconds_since_boot, u32& ticks_this_second, bool quer
return (delta_ticks * 1000000000ull) / ticks_per_second;
}
u64 HPET::read_main_counter() const
{
auto& main_counter = registers().main_counter_value;
return ((u64)main_counter.high << 32) | (u64)main_counter.low;
}
void HPET::enable_periodic_interrupt(const HPETComparator& comparator)
{
#if HPET_DEBUG

View File

@ -60,6 +60,7 @@ public:
void disable_periodic_interrupt(const HPETComparator& comparator);
u64 update_time(u64& seconds_since_boot, u32& ticks_this_second, bool query_only);
u64 read_main_counter() const;
Vector<unsigned> capable_interrupt_numbers(u8 comparator_number);
Vector<unsigned> capable_interrupt_numbers(const HPETComparator&);