42 LOG_ERR(
"HPET reported an invalid counter period %llu fs\n",
period);
111 if (nanoseconds == 0)
120 asm volatile(
"pause");
#define ACPI_SDT_HANDLER_REGISTER(sig, initHandler)
Macro to register an ACPI SDT handler.
void hpet_write(uint64_t reg, uint64_t value)
Write a value to an HPET register.
#define HPET_CONF_ENABLE_CNF_BIT
The bit to set to enable the HPET in the configuration register.
void hpet_wait(clock_t nanoseconds)
Wait for a specified number of nanoseconds using the HPET.
#define HPET_FEMTOSECONDS_PER_SECOND
The number of femtoseconds in one second.
#define HPET_CAP_COUNTER_CLK_PERIOD_SHIFT
The bit offset of the clock period in the capabilities register.
clock_t hpet_nanoseconds_per_tick(void)
Retrieve the number of nanoseconds per HPET tick.
void hpet_reset_counter(void)
Reset the HPET main counter to 0 and enable the HPET.
uint64_t hpet_read(uint64_t reg)
Read a value from an HPET register.
#define HPET_ADDRESS_SPACE_MEMORY
If hpet_t::addressSpaceId is equal to this, the address is in system memory space.
uint64_t hpet_read_counter(void)
Read the current value of the HPET main counter.
@ HPET_REG_GENERAL_CONFIG
@ HPET_REG_GENERAL_CAPABILITIES_ID
@ HPET_REG_MAIN_COUNTER_VALUE
NORETURN void panic(const interrupt_frame_t *frame, const char *format,...)
Panic the kernel, printing a message and halting.
#define LOG_ERR(format,...)
#define LOG_INFO(format,...)
#define PML_LOWER_TO_HIGHER(addr)
Converts an address from the lower half to the higher half.
void * vmm_map(space_t *space, void *virtAddr, void *physAddr, uint64_t length, pml_flags_t flags, space_callback_func_t func, void *private)
Maps physical memory to virtual memory in a given address space.
#define PAGE_SIZE
Memory page size.
#define NULL
Pointer error value.
#define ERR
Integer error value.
__UINT64_TYPE__ clock_t
A nanosecond time.
static bool isInitialized
static uint64_t hpet_init(sdt_header_t *table)
__UINTPTR_TYPE__ uintptr_t
High Precision Event Timer structure.
#define WRITE_64(address, value)