aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsigsegv7 <ian@vegaa.systems>2023-09-20 02:28:15 -0400
committersigsegv7 <ian@vegaa.systems>2023-09-20 02:28:15 -0400
commit808baf43a580596f1677663bafd6844118680c5a (patch)
tree16023c91d3546ff82910f3ea24453a81f6859a93
parent68e83a466a56ab7a446285fc110a4d27aea2702a (diff)
kernel: dev: Setup timer descriptor for HPET
Signed-off-by: sigsegv7 <ian@vegaa.systems>
-rw-r--r--sys/dev/timer/hpet.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/sys/dev/timer/hpet.c b/sys/dev/timer/hpet.c
index 9e9180f..f5b1621 100644
--- a/sys/dev/timer/hpet.c
+++ b/sys/dev/timer/hpet.c
@@ -31,6 +31,7 @@
#include <firmware/acpi/acpi.h>
#include <sys/panic.h>
#include <sys/cdefs.h>
+#include <sys/timer.h>
#include <sys/syslog.h>
#include <sys/mmio.h>
@@ -62,6 +63,7 @@ __KERNEL_META("$Vega$: hpet.c, Ian Marco Moffett, "
#define spinwait_hint() __nothing
#endif /* defined(__x86_64__) */
+static struct timer timer = { 0 };
static struct hpet *acpi_hpet = NULL;
static void *hpet_base = NULL;
static bool is_faulty = false;
@@ -177,6 +179,12 @@ hpet_init(void)
hpet_write(HPET_REG_MAIN_COUNTER, 0);
hpet_write(HPET_GENERAL_CONFIG, 1);
+ /* Setup the timer descriptor */
+ timer.name = "HIGH_PRECISION_EVENT_TIMER";
+ timer.msleep = hpet_msleep;
+ timer.usleep = hpet_usleep;
+ timer.nsleep = hpet_nsleep;
+
/* Not faulty */
is_faulty = false;
return 0;