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