Voxia OS v0.0.1
Hobby Project Operating System Targeting x86-64
Loading...
Searching...
No Matches
hpet.h File Reference
#include <type.h>

Go to the source code of this file.

Data Structures

struct  address_structure
 
struct  description_table_header
 
struct  hpet
 

Macros

#define HPET_GENERAL_CAP_ID   0x0
 
#define HPET_GENERAL_CONFIG   0x10
 
#define HPET_ENABLE_CNF   0x1
 
#define HPET_MAIN_COUNT   0x0F0
 
#define HPET_TIMER_CONFIG(N)
 
#define HPET_TIMER_COMPARATOR(N)
 
#define ms2ns(ms)
 
#define us2ns(us)
 
#define ns2ms(x)
 

Functions

struct address_structure __attribute__ ((packed))
 
void vxHPETInitialize (uintptr_t addr)
 
void hpet_level_timer_setup (uint32_t n, uint64_t tick_count, int irq)
 
uint64_t vxHPETMinTickNs (void)
 
void hpet_enable ()
 
void hpet_disable ()
 
uint64_t vxHPETGetMainCount ()
 
void vxHPETSleep (uint64_t ns)
 
boolean_t vxHPETIsAvailable ()
 

Variables

uint8_t address_space_id
 
uint8_t register_bit_width
 
uint8_t register_bit_offset
 
uint8_t reserved
 
uint64_t address
 
char signature [4]
 
uint32_t length
 
uint8_t revision
 
uint8_t checksum
 
char oemid [6]
 
uint64_t oem_tableid
 
uint32_t oem_revision
 
uint32_t creator_id
 
uint32_t creator_revision
 
struct description_table_header header
 
uint8_t hardware_rev_id
 
uint8_t comparator_count
 
uint8_t counter_size
 
uint8_t legacy_replacement
 
uint16_t pci_vendor_id
 
uint8_t hpet_number
 
uint16_t minimum_tick
 
uint8_t page_protection
 

Macro Definition Documentation

◆ HPET_ENABLE_CNF

#define HPET_ENABLE_CNF   0x1

Definition at line 8 of file hpet.h.

◆ HPET_GENERAL_CAP_ID

#define HPET_GENERAL_CAP_ID   0x0

Definition at line 6 of file hpet.h.

Referenced by vxHPETInitialize(), and vxHPETMinTickNs().

◆ HPET_GENERAL_CONFIG

#define HPET_GENERAL_CONFIG   0x10

Definition at line 7 of file hpet.h.

Referenced by hpet_disable(), and hpet_enable().

◆ HPET_MAIN_COUNT

#define HPET_MAIN_COUNT   0x0F0

Definition at line 9 of file hpet.h.

Referenced by vxHPETGetMainCount(), and vxHPETInitialize().

◆ HPET_TIMER_COMPARATOR

#define HPET_TIMER_COMPARATOR ( N)
Value:
0x108 + N * 0x20

Definition at line 11 of file hpet.h.

Referenced by hpet_level_timer_setup().

◆ HPET_TIMER_CONFIG

#define HPET_TIMER_CONFIG ( N)
Value:
0x100 + N * 0x20

Definition at line 10 of file hpet.h.

Referenced by hpet_level_timer_setup().

◆ ms2ns

#define ms2ns ( ms)
Value:
((uint64_t) (ms) * 1000000ULL)
unsigned long uint64_t
Definition type.h:25

Definition at line 12 of file hpet.h.

Referenced by sipi_sequential(), and wait_until_receive_notify().

◆ ns2ms

#define ns2ms ( x)
Value:
(x) / 1000000
uint32_t x
Definition virtio-gpu.hpp:0

Definition at line 14 of file hpet.h.

Referenced by get_timer_counter_count_ms(), and vxSchedulerTick().

◆ us2ns

#define us2ns ( us)
Value:
((uint64_t) (us) * 1000ULL)

Definition at line 13 of file hpet.h.

Referenced by INIT().

Function Documentation

◆ __attribute__()

struct address_structure __attribute__ ( (packed) )

Definition at line 1 of file tcp.h.

◆ 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.

◆ 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

◆ address

struct address_structure address

Definition at line 4 of file hpet.h.

Referenced by EHCIModule::assign_address(), pci_readl(), pci_writel(), and EHCIModule::unload().

◆ address_space_id

uint8_t address_space_id

Definition at line 0 of file hpet.h.

◆ checksum

uint16_t checksum

Definition at line 3 of file hpet.h.

Referenced by __attribute__().

◆ comparator_count

uint8_t comparator_count

Definition at line 2 of file hpet.h.

◆ counter_size

uint8_t counter_size

Definition at line 3 of file hpet.h.

◆ creator_id

uint32_t creator_id

Definition at line 7 of file hpet.h.

◆ creator_revision

uint32_t creator_revision

Definition at line 8 of file hpet.h.

◆ hardware_rev_id

uint8_t hardware_rev_id

Definition at line 1 of file hpet.h.

◆ header

struct description_table_header header

Definition at line 0 of file hpet.h.

◆ hpet_number

uint8_t hpet_number

Definition at line 8 of file hpet.h.

◆ legacy_replacement

uint8_t legacy_replacement

Definition at line 5 of file hpet.h.

◆ length

uint32_t length

Definition at line 1 of file hpet.h.

◆ minimum_tick

uint16_t minimum_tick

Definition at line 9 of file hpet.h.

◆ oem_revision

uint32_t oem_revision

Definition at line 6 of file hpet.h.

◆ oem_tableid

uint64_t oem_tableid

Definition at line 5 of file hpet.h.

◆ oemid

char oemid[6]

Definition at line 4 of file hpet.h.

◆ page_protection

uint8_t page_protection

Definition at line 10 of file hpet.h.

◆ pci_vendor_id

uint16_t pci_vendor_id

Definition at line 6 of file hpet.h.

◆ register_bit_offset

uint8_t register_bit_offset

Definition at line 2 of file hpet.h.

◆ register_bit_width

uint8_t register_bit_width

Definition at line 1 of file hpet.h.

◆ reserved

uint8_t reserved

Definition at line 3 of file hpet.h.

◆ revision

uint8_t revision

Definition at line 2 of file hpet.h.

◆ signature

char signature[4]

Definition at line 0 of file hpet.h.