Correcting spkr init

This commit is contained in:
Adrien Bourmault 2019-05-07 15:48:09 +02:00
parent 050f795b39
commit 6c5efc6044
1 changed files with 3 additions and 2 deletions

View File

@ -31,6 +31,7 @@ void IoStartSpeaker(int freq)
char temp; char temp;
int pitf = 1193180 / freq; int pitf = 1193180 / freq;
ulong flags = KePauseIRQs();
IoWriteByteOnPort(0x43, 0xB6); IoWriteByteOnPort(0x43, 0xB6);
IoWriteByteOnPort(0x42, (char)pitf); IoWriteByteOnPort(0x42, (char)pitf);
IoWriteByteOnPort(0x42, (char)(pitf >> 8)); IoWriteByteOnPort(0x42, (char)(pitf >> 8));
@ -39,6 +40,7 @@ void IoStartSpeaker(int freq)
if (temp != (temp | 3)) { if (temp != (temp | 3)) {
IoWriteByteOnPort(0x61, temp | 3); IoWriteByteOnPort(0x61, temp | 3);
} }
KeRestoreIRQs(flags);
} }
void IoQuietSpeaker(void) void IoQuietSpeaker(void)
@ -48,9 +50,8 @@ void IoQuietSpeaker(void)
void IoDoBeep(void) void IoDoBeep(void)
{ {
ulong flags = KePauseIRQs();
IoStartSpeaker(1000); IoStartSpeaker(1000);
KeRestoreIRQs(flags);
// Worst possible way of waiting // Worst possible way of waiting
// We need actual timers // We need actual timers