Fixed PIT

I am not sure it is how it should work but it works
This commit is contained in:
ewoudje 2018-01-16 22:29:57 +01:00
parent 14bf74389c
commit 558de4a4d2
2 changed files with 9 additions and 3 deletions

View file

@ -9,7 +9,7 @@ namespace Cosmos.HAL
{
public static readonly Debugger mDebugger = new Debugger("HAL", "Global");
//static public PIT PIT = new PIT();
static public PIT PIT = new PIT();
// Must be static init, other static inits rely on it not being null
public static TextScreenBase TextScreen = new TextScreen();

View file

@ -30,19 +30,21 @@ namespace Cosmos.HAL {
this.NSRemaining = this.NanosecondsTimeout;
this.Recuring = Recuring;
}
public PITTimer(dOnTrigger HandleOnTrigger, int NanosecondsTimeout, int NanosecondsLeft) {
this.HandleTrigger = HandleOnTrigger;
this.NanosecondsTimeout = NanosecondsTimeout;
this.NSRemaining = NanosecondsLeft;
this.Recuring = true;
}
~PITTimer() {
Dispose();
}
public void Dispose() {
if (ID != -1) {
//Global.PIT.UnregisterTimer(ID);
Global.PIT.UnregisterTimer(ID);
}
}
}
@ -154,9 +156,13 @@ namespace Cosmos.HAL {
RegisterTimer(new PITTimer(SignalWait, (int)(TimeoutMS * 1000000), false));
while (!WaitSignaled) {
Core.Global.CPU.Halt();
var bytes = new byte[1];
IO.Data0.Read8(bytes);
if (bytes[0] == 0) HandleInterrupt();
//Core.Global.CPU.Halt();
}
}
public void WaitNS(int TimeoutNS) {
WaitSignaled = false;