]> Joshua Wise's Git repositories - netwatch.git/blame - cs410/keyb.c
First pass of 410watch UI code.
[netwatch.git] / cs410 / keyb.c
CommitLineData
6093edb5
JW
1#include <io.h>
2#include "keyhelp.h"
3#include "../net/net.h"
4#include <output.h>
5
6/* Takes over the i8042... oh well. If we ever fully emulate the i8042,
7 * then we'll patch into that.
8 */
9
10#define KEYBOARD_PORT 0x60
11#define KEYB_STATUS_PORT 0x64
12#define KEYB_OBF 0x1
13
14int getchar()
15{
16 kh_type key;
17 unsigned char scancode;
18
19 /* Ignore accesses -- XXX hack */
20 outl(0x840, 0x0);
21 outl(0x848, 0x0);
22
23 do
24 {
25 while (!(inb(KEYB_STATUS_PORT) & KEYB_OBF))
26 eth_poll();
27
28 scancode = inb(KEYBOARD_PORT);
29 outputf("scancode: %02x", scancode);
30 key = process_scancode(scancode);
31 } while (!KH_HASDATA(key) || !KH_ISMAKE(key));
32
33 /* XXX */
34 outl(0x840, 0x0);
35 outl(0x844, 0x1000);
36 outl(0x848, 0x1000);
37
38 return KH_GETCHAR(key);
39}
This page took 0.026079 seconds and 4 git commands to generate.