Add check that PIT ISR is firing

This commit is contained in:
Josh Holtrop 2023-11-01 14:45:43 -04:00
parent 7264a31ff3
commit 01c73f8474
2 changed files with 12 additions and 2 deletions

View File

@ -24,6 +24,7 @@ import hulk.rtc;
import hulk.serial; import hulk.serial;
import hulk.usb; import hulk.usb;
import hulk.pit; import hulk.pit;
import hulk.time;
extern extern(C) __gshared ubyte _hulk_bss_size; extern extern(C) __gshared ubyte _hulk_bss_size;
@ -87,6 +88,15 @@ void hulk_start()
Usb.initialize(); Usb.initialize();
sti(); sti();
/* Check that PIT millisecond interrupt is firing. */
size_t uptime = Time.uptime();
while (Time.uptime() <= uptime)
{
}
Klog.writefln("\a5HULK Initialization Complete!");
/* Idle loop. */
Time.msleep(1);
for (;;) for (;;)
{ {
hlt(); hlt();

View File

@ -23,7 +23,7 @@ struct Time
*/ */
public static @property ulong uptime() public static @property ulong uptime()
{ {
return s_uptime; return volatileLoad(&s_uptime);
} }
/** /**
@ -35,7 +35,7 @@ struct Time
public static void msleep(ulong count) public static void msleep(ulong count)
{ {
ulong wait_for = s_uptime + count + 1; ulong wait_for = s_uptime + count + 1;
while (volatileLoad(&s_uptime) < wait_for) while (uptime() < wait_for)
{ {
} }
} }