mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-22 13:58:47 +00:00
Fixed PIT
I am not sure it is how it should work but it works
This commit is contained in:
parent
14bf74389c
commit
558de4a4d2
2 changed files with 9 additions and 3 deletions
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue