PatchworkOS
Loading...
Searching...
No Matches
hpet.c File Reference
#include <kernel/drivers/hpet.h>
#include <kernel/acpi/tables.h>
#include <kernel/log/log.h>
#include <kernel/log/panic.h>
#include <kernel/mem/vmm.h>
#include <kernel/utils/utils.h>
#include <assert.h>

Go to the source code of this file.

Functions

static uint64_t hpet_init (sdt_header_t *table)
 
 ACPI_SDT_HANDLER_REGISTER ("HPET", hpet_init)
 
clock_t hpet_nanoseconds_per_tick (void)
 Retrieve the number of nanoseconds per HPET tick.
 
uint64_t hpet_read_counter (void)
 Read the current value of the HPET main counter.
 
void hpet_reset_counter (void)
 Reset the HPET main counter to 0 and enable the HPET.
 
void hpet_write (uint64_t reg, uint64_t value)
 Write a value to an HPET register.
 
uint64_t hpet_read (uint64_t reg)
 Read a value from an HPET register.
 
void hpet_wait (clock_t nanoseconds)
 Wait for a specified number of nanoseconds using the HPET.
 

Variables

static hpet_thpet
 
static uintptr_t address
 
static uint64_t period
 
static bool isInitialized = false
 

Function Documentation

◆ ACPI_SDT_HANDLER_REGISTER()

ACPI_SDT_HANDLER_REGISTER ( "HPET"  ,
hpet_init   
)

◆ hpet_init()

Variable Documentation

◆ address

◆ hpet

hpet_t* hpet
static

Definition at line 11 of file hpet.c.

Referenced by hpet_init().

◆ isInitialized

bool isInitialized = false
static

◆ period

uint64_t period
static

Definition at line 13 of file hpet.c.

Referenced by hpet_init(), hpet_nanoseconds_per_tick(), and hpet_wait().