menu: quiet warnings in drain_keyboard()
[syslinux.git] / com32 / menu / drain.c
blob428d9709d71e8a060876a2617c5b16f4fc80877d
1 #include <stdio.h>
2 #include <unistd.h>
3 #include <errno.h>
4 #include <string.h>
5 #include <sys/cpu.h>
7 void drain_keyboard(void)
9 /* Prevent "ghost typing" and keyboard buffer snooping */
10 volatile char junk;
11 int rv;
13 do {
14 rv = read(0, (char *)&junk, 1);
15 } while (rv > 0);
17 junk = 0;
19 cli();
20 *(volatile uint8_t *)0x419 = 0; /* Alt-XXX keyboard area */
21 *(volatile uint16_t *)0x41a = 0x1e; /* Keyboard buffer empty */
22 *(volatile uint16_t *)0x41c = 0x1e;
23 memset((void *)0x41e, 0, 32); /* Clear the actual keyboard buffer */
24 sti();