:pserver:cvsanon@mok.lvcm.com:/CVS/ReactOS reactos
[reactos.git] / drivers / input / keyboard / keyboard.h
1 #ifndef _KEYBOARD_H_
2 #define _KEYBOARD_H_
3 #include <ddk/ntddkbd.h>
4 #include <ddk/ntdd8042.h>
5
6
7 /*-----------------------------------------------------
8  *  DeviceExtension
9  * --------------------------------------------------*/
10 typedef struct _DEVICE_EXTENSION
11 {
12     
13         PI8042_KEYBOARD_INITIALIZATION_ROUTINE InitializationHookCallback;
14     PI8042_KEYBOARD_ISR IsrHookCallback;
15     PVOID HookContext;
16
17 } DEVICE_EXTENSION, *PDEVICE_EXTENSION;
18
19 /*
20  * Some defines
21  */
22
23 #define KEYBOARD_IRQ       1
24 #define KBD_BUFFER_SIZE    32
25 #define KBD_WRAP_MASK      0x1F
26
27 #define disable()          __asm__("cli\n\t")
28 #define enable()           __asm__("sti\n\t")
29
30 #define ALT_PRESSED                     (LEFT_ALT_PRESSED | RIGHT_ALT_PRESSED)
31 #define CTRL_PRESSED                    (LEFT_CTRL_PRESSED | RIGHT_CTRL_PRESSED)
32
33
34 /*
35  * Keyboard controller ports
36  */
37
38 #define KBD_DATA_PORT      0x60
39 #define KBD_CTRL_PORT      0x64
40
41
42 /*
43  * Controller commands
44  */
45
46 #define KBD_READ_MODE      0x20
47 #define KBD_WRITE_MODE     0x60
48 #define KBD_SELF_TEST      0xAA
49 #define KBD_LINE_TEST      0xAB
50 #define KBD_CTRL_ENABLE    0xAE
51
52 /*
53  * Keyboard commands
54  */
55
56 #define KBD_ENABLE         0xF4
57 #define KBD_DISABLE        0xF5
58 #define KBD_RESET          0xFF
59
60
61 /*
62  * Keyboard responces
63  */
64
65 #define KBD_ACK            0xFA
66 #define KBD_BATCC          0xAA
67
68
69 /*
70  * Controller status register bits
71  */
72
73 #define KBD_OBF            0x01
74 #define KBD_IBF            0x02
75 #define KBD_GTO            0x40
76 #define KBD_PERR           0x80
77
78
79 /*
80  * LED bits
81  */
82
83 #define KBD_LED_SCROLL     0x01
84 #define KBD_LED_NUM        0x02
85 #define KBD_LED_CAPS       0x04
86
87 #endif // _KEYBOARD_H_