Project

General

Profile

Statistics
| Revision:

root / lab4 / i8042.h @ 16

History | View | Annotate | Download (1.29 KB)

1 15 up20180645
#ifndef _LCOM_I8042_H_
2
#define _LCOM_I8042_H_
3
4
#include <lcom/lcf.h>
5
6
/** @defgroup i8042 i8042
7
 * @{
8
 *
9
 * Constants for programming the i8042 Keyboard.
10
 */
11
12
//#define KEYBOARD_IRQ 0x09 /* Keyboard IRQ address */
13
14
//#define BIT(n) (0x01<<(n))
15
16
#define DELAY_US        20000
17
18
#define STAT_REG_PAR                  BIT(7)  /* Parity Error */
19
#define STAT_REG_TIMEOUT        BIT(6)  /* Timeout Error */
20
#define STAT_REG_AUX                  BIT(5)  /* Mouse Data */
21
#define STAT_REG_INH                  BIT(4)  /* Inhibit Flag */
22
#define STAT_REG_A2       BIT(3)  /* A2 Input Line */
23
#define STAT_REG_SYS                  BIT(2)  /* System Flag */
24
#define STAT_REG_IBF                   BIT(1)  /* Input Buffer Full */
25
#define STAT_REG_OBF                  BIT(0)  /* Output Buffer Full */
26
27
#define READ_COMMAND        0x20   /* Returns Command Byte */
28
29
#define OUTPUT_BUF         0x60    /* Output Buffer */
30
#define INPUT_BUF          0x60    /* Input Buffer */
31
#define STATUS_REG         0x64    /* Status Register */
32
#define KBC_CMD_REG        0x64    /* Command Register */
33
#define INT_ENABLE         BIT(0) /*enable interrupt on OBF, from keyboard*/
34
#define KBC_CMD_ARG        0x60    /* Command Arguments Adress */
35
36
#define ESC_BREAK           0x81
37
#define TWO_BYTE_SCANCODE   0xE0  /* Two-byte long scancodes use 0xE0 as their first byte */
38
#define MAKE_CODE           BIT(7)
39
40
#endif /* _LCOM_I8042_H */