Voxia OS v0.0.1
Hobby Project Operating System Targeting x86-64
Loading...
Searching...
No Matches
hpet.c File Reference
#include "hal/acpi/acpi.h"
#include "hal/cpu/cpuid.h"
#include "libk/io.h"
#include "libk/serial.h"
#include <type.h>
#include <hal/acpi/hpet.h>
#include <str.h>

Go to the source code of this file.

Functions

boolean_t vxHPETIsAvailable ()
 
static void hpet_write (uint32_t reg, uint64_t value)
 
static uint64_t hpet_read (uint32_t reg)
 
void hpet_enable ()
 
void hpet_disable ()
 
uint64_t vxHPETMinTickNs (void)
 
void hpet_level_timer_setup (uint32_t n, uint64_t tick_count, int irq)
 
void vxHPETInitialize (uintptr_t addr)
 
uint64_t vxHPETGetMainCount ()
 
void vxHPETSleep (uint64_t ns)
 

Variables

static volatile uintptr_t hpet_address = 0
 
static uint64_t min_tick_ns = 0
 
boolean_t hpet_available = 0
 

Function Documentation

◆ hpet_disable()

void hpet_disable ( )

Definition at line 32 of file hpet.c.

References HPET_GENERAL_CONFIG, and hpet_write().

Referenced by vxAPICTimerCalibrationUsingHPET(), and vxHPETInitialize().

◆ hpet_enable()

void hpet_enable ( )

Definition at line 26 of file hpet.c.

References HPET_GENERAL_CONFIG, hpet_read(), and hpet_write().

Referenced by vxAPICTimerCalibrationUsingHPET(), and vxHPETInitialize().

◆ hpet_level_timer_setup()

void hpet_level_timer_setup ( uint32_t n,
uint64_t tick_count,
int irq )

Definition at line 42 of file hpet.c.

References cap, hpet_read(), HPET_TIMER_COMPARATOR, HPET_TIMER_CONFIG, hpet_write(), and LOG2_ERROR.

◆ hpet_read()

static uint64_t hpet_read ( uint32_t reg)
static

◆ hpet_write()

static void hpet_write ( uint32_t reg,
uint64_t value )
static

Definition at line 18 of file hpet.c.

References hpet_address, mmio_outll(), reg, and value.

Referenced by hpet_disable(), hpet_enable(), hpet_level_timer_setup(), and vxHPETInitialize().

◆ vxHPETGetMainCount()

uint64_t vxHPETGetMainCount ( )

◆ vxHPETInitialize()

◆ vxHPETIsAvailable()

boolean_t vxHPETIsAvailable ( )

Definition at line 14 of file hpet.c.

References hpet_available.

Referenced by usleep(), and vxRand().

◆ vxHPETMinTickNs()

uint64_t vxHPETMinTickNs ( void )

Definition at line 36 of file hpet.c.

References HPET_GENERAL_CAP_ID, and hpet_read().

Referenced by get_timer_counter_count_ms(), and get_timer_counter_count_ns().

◆ vxHPETSleep()

void vxHPETSleep ( uint64_t ns)

Definition at line 86 of file hpet.c.

References hpet_available, min_tick_ns, and vxHPETGetMainCount().

Referenced by INIT(), sipi_sequential(), and usleep().

Variable Documentation

◆ hpet_address

volatile uintptr_t hpet_address = 0
static

Definition at line 10 of file hpet.c.

Referenced by hpet_read(), hpet_write(), and vxHPETInitialize().

◆ hpet_available

boolean_t hpet_available = 0

Definition at line 12 of file hpet.c.

Referenced by vxHPETInitialize(), vxHPETIsAvailable(), and vxHPETSleep().

◆ min_tick_ns

uint64_t min_tick_ns = 0
static

Definition at line 11 of file hpet.c.

Referenced by vxHPETInitialize(), and vxHPETSleep().