From 6c5efc60446475f8ba8f6d768b8388cb2cfa862f Mon Sep 17 00:00:00 2001 From: Adrien Bourmault Date: Tue, 7 May 2019 15:48:09 +0200 Subject: [PATCH] Correcting spkr init --- kaleid/kernel/io/spkr.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kaleid/kernel/io/spkr.c b/kaleid/kernel/io/spkr.c index 7834ffb..b4d87b2 100644 --- a/kaleid/kernel/io/spkr.c +++ b/kaleid/kernel/io/spkr.c @@ -31,6 +31,7 @@ void IoStartSpeaker(int freq) char temp; int pitf = 1193180 / freq; + ulong flags = KePauseIRQs(); IoWriteByteOnPort(0x43, 0xB6); IoWriteByteOnPort(0x42, (char)pitf); IoWriteByteOnPort(0x42, (char)(pitf >> 8)); @@ -39,6 +40,7 @@ void IoStartSpeaker(int freq) if (temp != (temp | 3)) { IoWriteByteOnPort(0x61, temp | 3); } + KeRestoreIRQs(flags); } void IoQuietSpeaker(void) @@ -48,9 +50,8 @@ void IoQuietSpeaker(void) void IoDoBeep(void) { - ulong flags = KePauseIRQs(); + IoStartSpeaker(1000); - KeRestoreIRQs(flags); // Worst possible way of waiting // We need actual timers