axle OS
x86_32 UNIX-like hobby OS
kb.h
1 #ifndef KB_DRIVER_H
2 #define KB_DRIVER_H
3 
4 #include <std/std.h>
5 #include "keymap.h"
6 
7 __BEGIN_DECLS
8 
9 #define CONTROL 0x1
10 #define ALT 0x2
11 #define ALTGR 0x4
12 #define LSHIFT 0x8
13 #define RSHIFT 0x10
14 #define CAPSLOCK 0x20
15 #define SCROLLLOCK 0x40
16 #define NUMLOCK 0x80
17 
18 #define RELEASED_MASK 0x80
19 
20 //non-blocking getchar()
21 //returns NULL if no pending keys
22 char kgetch();
23 //blocks until character is recieved
24 char getchar();
25 //check if there is a pending keypress
26 bool haskey();
27 //return mask of modifier keys
28 key_status_t kb_modifiers();
29 
30 //install PS/2 keyboard driver
31 void kb_install();
32 //swap layout to interpret incoming scancodes
33 void switch_layout(keymap_t* layout);
34 //get current layout
35 keymap_t* kb_layout();
36 
37 __END_DECLS
38 
39 #endif
Definition: keymap.h:8