interrupts, timer, keyboard, segments, lots of kernel code
[bootcensus] / src / keyb.h
1 #ifndef KEYB_H_
2 #define KEYB_H_
3
4 #define KB_ANY          (-1)
5 #define KB_ALT          (-2)
6 #define KB_CTRL         (-3)
7 #define KB_SHIFT        (-4)
8
9 /* special keys */
10 enum {
11         KB_ESC = 27,
12         KB_INSERT, KB_DEL, KB_HOME, KB_END, KB_PGUP, KB_PGDN,
13         KB_LEFT, KB_RIGHT, KB_UP, KB_DOWN,
14         KB_NUM_DOT, KB_NUM_ENTER, KB_NUM_PLUS, KB_NUM_MINUS, KB_NUM_MUL, KB_NUM_DIV,
15         KB_NUM_0, KB_NUM_1, KB_NUM_2, KB_NUM_3, KB_NUM_4,
16         KB_NUM_5, KB_NUM_6, KB_NUM_7, KB_NUM_8, KB_NUM_9,
17         KB_BACKSP = 127,
18
19         KB_LALT, KB_RALT,
20         KB_LCTRL, KB_RCTRL,
21         KB_LSHIFT, KB_RSHIFT,
22         KB_F1, KB_F2, KB_F3, KB_F4, KB_F5, KB_F6,
23         KB_F7, KB_F8, KB_F9, KB_F10, KB_F11, KB_F12,
24         KB_CAPSLK, KB_NUMLK, KB_SCRLK, KB_SYSRQ
25 };
26
27 void kb_init(void);
28
29 /* Boolean predicate for testing the current state of a particular key.
30  * You may also pass KB_ANY to test if any key is held down.
31  */
32 int kb_isdown(int key);
33
34 /* waits for any keypress */
35 void kb_wait(void);
36
37 /* removes and returns a single key from the input buffer. */
38 int kb_getkey(void);
39
40 void kb_putback(int key);
41
42 #endif  /* KEYB_H_ */