root / lab3 / kbc.h @ 33
History | View | Annotate | Download (1.75 KB)
1 | 30 | up20180655 | #ifndef _KBC_H_
|
---|---|---|---|
2 | #define _KBC_H_
|
||
3 | |||
4 | /* KBC IRQ Line */
|
||
5 | |||
6 | #define KBC_IRQ 1 /* @brief KBC Controller IRQ Line */ |
||
7 | |||
8 | 31 | up20180655 | /* Delay for KBC */
|
9 | #define DELAY 20000 /* @brief KBC Response Delay */ |
||
10 | |||
11 | 30 | up20180655 | /* I/O Ports Addresses */
|
12 | |||
13 | #define KBC_CMD 0x64 /* @brief Address to send commands to KBC */ |
||
14 | #define KBC_CMD_ARG 0x60 /* @brief Address to write KBC Command Arguments */ |
||
15 | #define STATUS_REG 0x64 /* @brief KBC Status Register address */ |
||
16 | |||
17 | #define OUTPUT_BUF 0x60 /* @brief Address of Output Buffer of KBC */ |
||
18 | |||
19 | /* KBC Commands */
|
||
20 | #define READ_KBC_CMD 0x20 /* @brief Read KBC Command Byte */ |
||
21 | #define WRITE_KBC_CMD 0x60 /* @brief Write KBC Command Byte */ |
||
22 | #define KBC_SELF_TEST 0xAA /* @brief KBC Diagnostic Tests */ |
||
23 | #define KBC_INT_TEST 0xAB /* @brief Tests Keyboard Clock and Data lines */ |
||
24 | #define KBC_INT_DISABLE 0xAD /* @brief Disable KBC Interface */ |
||
25 | #define KBC_INT_ENABLE 0xAE /* @brief Enable KBC Interface */ |
||
26 | |||
27 | /* Status Byte Masking */
|
||
28 | |||
29 | #define OUT_BUF_FUL BIT(0) /* @brief Output Buffer State */ |
||
30 | #define IN_BUF_FULL BIT(1) /* @brief Input Buffer State */ |
||
31 | #define SYS_FLAG BIT(2) /* @brief System Flag */ |
||
32 | #define DATA_CMD_WRITE BIT(3) /* @brief Identifier of type of byte in input buffer */ |
||
33 | #define INH_FLAG BIT(4) /* @brief Keyboard inihibited */ |
||
34 | #define AUX_MOUSE BIT(5) /* @brief Mouse Data */ |
||
35 | #define TIME_OUT_REC BIT(6) /* @brief Time Out Error - Invalid Data */ |
||
36 | #define PARITY_ERROR BIT(7) /* @brief Parity Error - Invalid Data */ |
||
37 | |||
38 | /* Scancode Constants */
|
||
39 | |||
40 | #define ESC_BREAK_CODE 0x81 /* @brief ESC Break Code */ |
||
41 | #define TWO_BYTE_CODE 0xE0 /* @brief First byte of a two byte Scancode */ |
||
42 | #define BREAK_CODE_BIT BIT(7) /* @brief Bit to distinguish between Make code and Break code */ |
||
43 | |||
44 | #endif |