kernel: initial hpet support

This commit is contained in:
Matheus
2023-04-22 19:21:30 -03:00
parent a597f6d951
commit a3969eea54
5 changed files with 98 additions and 0 deletions
+11
View File
@@ -0,0 +1,11 @@
#ifndef _TIME_H
#define _TIME_H
typedef long time_t;
typedef struct {
time_t s;
time_t ns;
} timespec_t;
#endif
+18
View File
@@ -45,6 +45,24 @@ typedef struct {
uint32_t flags;
} __attribute__((packed)) madt_t;
typedef struct {
sdtheader_t header;
uint8_t hwrev;
uint8_t comparatorcount:5;
uint8_t countersize:1;
uint8_t reserved:1;
uint8_t legacy_replacement:1;
uint16_t pcivendor;
uint8_t addrid;
uint8_t bitwidth;
uint8_t bitoffset;
uint8_t reserved2;
uint64_t addr;
uint8_t hpetnum;
uint16_t mintick;
uint8_t pageprot;
} __attribute__((packed)) hpet_t;
#define ACPI_MADT_TYPE_LAPIC 0
#define ACPI_MADT_TYPE_IOAPIC 1
#define ACPI_MADT_TYPE_OVERRIDE 2
+12
View File
@@ -0,0 +1,12 @@
#ifndef _HPET_H
#define _HPET_h
#include <stdbool.h>
#include <time.h>
void arch_hpet_waitticks(time_t ticks);
void arch_hpet_waitus(time_t us);
bool arch_hpet_exists();
void arch_hpet_init();
#endif