Created
October 12, 2019 12:05
-
-
Save marmarek/304f40890bda76fa96f168c2255ac2e7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void __init kbd_init(void) | |
{ | |
uint8_t conf; | |
#pragma GCC diagnostic ignored "-Wmisleading-indentation" | |
while (inb(0x64) & 2); outb(0xAD, 0x64); | |
while (inb(0x64) & 2); outb(0xA7, 0x64); | |
while (inb(0x64) & 1) inb(0x60); | |
while (inb(0x64) & 2); outb(0x20, 0x64); | |
while (!(inb(0x64) & 1)); conf=inb(0x60); | |
while (inb(0x64) & 2); outb(0x60, 0x64); | |
while (inb(0x64) & 2); outb(conf & ~0x43, 0x60); | |
while (inb(0x64) & 2); outb(0xAA, 0x64); | |
while (!(inb(0x64) & 1)); conf=inb(0x60); | |
if (conf != 0x55) | |
{ | |
PrintStr(L"PS/2 self test failed\n\r"); | |
return; | |
} | |
while (inb(0x64) & 2); outb(0xAE, 0x64); | |
while (inb(0x64) & 2); outb(0xA8, 0x64); | |
while (inb(0x64) & 2); outb(0xFF, 0x60); | |
while (!(inb(0x64) & 1)); conf=inb(0x60); | |
} | |
void __init blink(int times) | |
{ | |
int delay; | |
while (times--) | |
{ | |
while (inb(0x64) & 2); outb(0xED, 0x60); | |
while (inb(0x64) & 2); outb(7, 0x60); | |
while (inb(0x64) & 1) inb(0x60); | |
for (delay=20000000; delay; delay--) wmb(); | |
while (inb(0x64) & 2); outb(0xED, 0x60); | |
while (inb(0x64) & 2); outb(0, 0x60); | |
while (inb(0x64) & 1) inb(0x60); | |
for (delay=20000000; delay; delay--) wmb(); | |
} | |
for (delay=60000000; delay; delay--) wmb(); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment