Revision 257
deleting kbc_macros.h
proj/include/kbc.h | ||
---|---|---|
6 | 6 |
#ifndef KBC_H_INCLUDED |
7 | 7 |
#define KBC_H_INCLUDED |
8 | 8 |
|
9 |
/* KBC IRQ Line */ |
|
10 |
|
|
11 |
#define KBC_IRQ 1 /* @brief KBC Controller IRQ Line */ |
|
12 |
#define MOUSE_IRQ 12 /* @brief Mouse IRQ Line */ |
|
13 |
|
|
14 |
/* Delay for KBC */ |
|
15 |
#define DELAY 20000 /* @brief KBC Response Delay */ |
|
16 |
#define KBC_NUM_TRIES 20 /* @brief Number of tries to issue command before timeout */ |
|
17 |
|
|
18 |
/* I/O Ports Addresses */ |
|
19 |
|
|
20 |
#define KBC_CMD 0x64 /* @brief Address to send commands to KBC */ |
|
21 |
#define KBC_CMD_ARG 0x60 /* @brief Address to write KBC Command Arguments */ |
|
22 |
#define STATUS_REG 0x64 /* @brief KBC Status Register address */ |
|
23 |
|
|
24 |
#define OUTPUT_BUF 0x60 /* @brief Address of Output Buffer of KBC */ |
|
25 |
|
|
26 |
/* KBC Commands */ |
|
27 |
#define READ_KBC_CMD 0x20 /* @brief Read KBC Command Byte */ |
|
28 |
#define WRITE_KBC_CMD 0x60 /* @brief Write KBC Command Byte */ |
|
29 |
#define KBC_SELF_TEST 0xAA /* @brief KBC Diagnostic Tests */ |
|
30 |
#define KBC_INT_TEST 0xAB /* @brief Tests Keyboard Clock and Data lines */ |
|
31 |
#define KBC_INT_DISABLE 0xAD /* @brief Disable KBC Interface */ |
|
32 |
#define KBC_INT_ENABLE 0xAE /* @brief Enable KBC Interface */ |
|
33 |
#define MOUSE_DISABLE 0xA7 /* @brief Disable Mouse */ |
|
34 |
#define MOUSE_ENABLE 0xA8 /* @brief Enable Mouse */ |
|
35 |
#define MOUSE_INT_TEST 0xA9 /* @brief Tests Mouse data line */ |
|
36 |
#define MOUSE_WRITE_B 0xD4 /* @brief Write a byte directly to the mouse */ |
|
37 |
|
|
38 |
/* Status Byte Masking */ |
|
39 |
|
|
40 |
#define OUT_BUF_FUL BIT(0) /* @brief Output Buffer State */ |
|
41 |
#define IN_BUF_FULL BIT(1) /* @brief Input Buffer State */ |
|
42 |
#define SYS_FLAG BIT(2) /* @brief System Flag */ |
|
43 |
#define DATA_CMD_WRITE BIT(3) /* @brief Identifier of type of byte in input buffer */ |
|
44 |
#define INH_FLAG BIT(4) /* @brief Keyboard inihibited */ |
|
45 |
#define AUX_MOUSE BIT(5) /* @brief Mouse Data */ |
|
46 |
#define TIME_OUT_REC BIT(6) /* @brief Time Out Error - Invalid Data */ |
|
47 |
#define PARITY_ERROR BIT(7) /* @brief Parity Error - Invalid Data */ |
|
48 |
|
|
49 |
/* Scancode Constants */ |
|
50 |
|
|
51 |
#define ESC_BREAK_CODE 0x81 /* @brief ESC Break Code */ |
|
52 |
#define TWO_BYTE_CODE 0xE0 /* @brief First byte of a two byte Scancode */ |
|
53 |
#define BREAK_CODE_BIT BIT(7) /* @brief Bit to distinguish between Make code and Break code */ |
|
54 |
|
|
55 |
/* Command byte masks */ |
|
56 |
#define INT_KBD BIT(0) /* @brief Enable Keyboard Interrupts */ |
|
57 |
#define INT_MOU BIT(1) /* @brief Enable Mouse Interrupts */ |
|
58 |
#define DIS_KBD BIT(4) /* @brief Disable Keyboard */ |
|
59 |
#define DIS_MOU BIT(5) /* @brief Disable Mouse */ |
|
60 |
|
|
9 | 61 |
/** |
10 | 62 |
* @brief High-level function that reads the command byte of the KBC |
11 | 63 |
* @param cmd Pointer to variable where command byte read from KBC will be stored |
proj/include/kbc_macros.h | ||
---|---|---|
1 | 1 |
#ifndef KBC_MACROS_H_INCLUDED |
2 | 2 |
#define KBC_MACROS_H_INCLUDED |
3 | 3 |
|
4 |
/* KBC IRQ Line */ |
|
5 | 4 |
|
6 |
#define KBC_IRQ 1 /* @brief KBC Controller IRQ Line */ |
|
7 |
#define MOUSE_IRQ 12 /* @brief Mouse IRQ Line */ |
|
8 | 5 |
|
9 |
/* Delay for KBC */ |
|
10 |
#define DELAY 20000 /* @brief KBC Response Delay */ |
|
11 |
#define KBC_NUM_TRIES 20 /* @brief Number of tries to issue command before timeout */ |
|
12 |
|
|
13 |
/* I/O Ports Addresses */ |
|
14 |
|
|
15 |
#define KBC_CMD 0x64 /* @brief Address to send commands to KBC */ |
|
16 |
#define KBC_CMD_ARG 0x60 /* @brief Address to write KBC Command Arguments */ |
|
17 |
#define STATUS_REG 0x64 /* @brief KBC Status Register address */ |
|
18 |
|
|
19 |
#define OUTPUT_BUF 0x60 /* @brief Address of Output Buffer of KBC */ |
|
20 |
|
|
21 |
/* KBC Commands */ |
|
22 |
#define READ_KBC_CMD 0x20 /* @brief Read KBC Command Byte */ |
|
23 |
#define WRITE_KBC_CMD 0x60 /* @brief Write KBC Command Byte */ |
|
24 |
#define KBC_SELF_TEST 0xAA /* @brief KBC Diagnostic Tests */ |
|
25 |
#define KBC_INT_TEST 0xAB /* @brief Tests Keyboard Clock and Data lines */ |
|
26 |
#define KBC_INT_DISABLE 0xAD /* @brief Disable KBC Interface */ |
|
27 |
#define KBC_INT_ENABLE 0xAE /* @brief Enable KBC Interface */ |
|
28 |
#define MOUSE_DISABLE 0xA7 /* @brief Disable Mouse */ |
|
29 |
#define MOUSE_ENABLE 0xA8 /* @brief Enable Mouse */ |
|
30 |
#define MOUSE_INT_TEST 0xA9 /* @brief Tests Mouse data line */ |
|
31 |
#define MOUSE_WRITE_B 0xD4 /* @brief Write a byte directly to the mouse */ |
|
32 |
|
|
33 |
/* Status Byte Masking */ |
|
34 |
|
|
35 |
#define OUT_BUF_FUL BIT(0) /* @brief Output Buffer State */ |
|
36 |
#define IN_BUF_FULL BIT(1) /* @brief Input Buffer State */ |
|
37 |
#define SYS_FLAG BIT(2) /* @brief System Flag */ |
|
38 |
#define DATA_CMD_WRITE BIT(3) /* @brief Identifier of type of byte in input buffer */ |
|
39 |
#define INH_FLAG BIT(4) /* @brief Keyboard inihibited */ |
|
40 |
#define AUX_MOUSE BIT(5) /* @brief Mouse Data */ |
|
41 |
#define TIME_OUT_REC BIT(6) /* @brief Time Out Error - Invalid Data */ |
|
42 |
#define PARITY_ERROR BIT(7) /* @brief Parity Error - Invalid Data */ |
|
43 |
|
|
44 |
/* Scancode Constants */ |
|
45 |
|
|
46 |
#define ESC_BREAK_CODE 0x81 /* @brief ESC Break Code */ |
|
47 |
#define TWO_BYTE_CODE 0xE0 /* @brief First byte of a two byte Scancode */ |
|
48 |
#define BREAK_CODE_BIT BIT(7) /* @brief Bit to distinguish between Make code and Break code */ |
|
49 |
|
|
50 |
/* Command byte masks */ |
|
51 |
#define INT_KBD BIT(0) /* @brief Enable Keyboard Interrupts */ |
|
52 |
#define INT_MOU BIT(1) /* @brief Enable Mouse Interrupts */ |
|
53 |
#define DIS_KBD BIT(4) /* @brief Disable Keyboard */ |
|
54 |
#define DIS_MOU BIT(5) /* @brief Disable Mouse */ |
|
55 |
|
|
56 | 6 |
#endif //KBC_MACROS_H_INCLUDED |
proj/include/keyboard.h | ||
---|---|---|
5 | 5 |
#ifndef KEYBOARD_H_INCLUDED |
6 | 6 |
#define KEYBOARD_H_INCLUDED |
7 | 7 |
|
8 |
#include "kbc.h" |
|
9 |
|
|
8 | 10 |
/** |
9 | 11 |
* @brief Subscribes Keyboard Interrupts and disables Minix Default IH |
10 | 12 |
* @param interrupt_bit Bit of Interrupt Vector that will be set when Keyboard Interrupt is pending |
Also available in: Unified diff