Last change
on this file since e16e8f2 was
e16e8f2,
checked in by Edwin Eefting <edwin@datux.nl>, 3 years ago
|
bootstuff
|
-
Property mode set to
100644
|
File size:
576 bytes
|
Line | |
---|
1 | #include <stdio.h> |
---|
2 | #include <unistd.h> |
---|
3 | #include <errno.h> |
---|
4 | #include <string.h> |
---|
5 | #include <sys/cpu.h> |
---|
6 | |
---|
7 | void drain_keyboard(void) |
---|
8 | { |
---|
9 | /* Prevent "ghost typing" and keyboard buffer snooping */ |
---|
10 | volatile char junk; |
---|
11 | int rv; |
---|
12 | |
---|
13 | do { |
---|
14 | rv = read(0, (char *)&junk, 1); |
---|
15 | } while (rv > 0); |
---|
16 | |
---|
17 | junk = 0; |
---|
18 | |
---|
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(); |
---|
25 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.