blob: 7eb419c1d6972efced819cf4680f1bc058db645a [file] [log] [blame]
wdenk2d39b712000-12-14 10:04:19 +00001/* keyboard/mouse not implemented yet */
2
3extern int cma_kbm_not_implemented;
4
5/**************** DEFINES for H8542B Keyboard/Mouse Controller ***************/
6
7/*
8 * note the auxillary port is used to control the mouse
9 */
10
11/* 8542B Commands (Sent to the Command Port) */
12#define HT8542_CMD_SET_BYTE 0x60 /* Set the command byte */
13#define HT8542_CMD_GET_BYTE 0x20 /* Get the command byte */
14#define HT8542_CMD_KBD_OBUFF 0xD2 /* Write to HT8542 Kbd Output Buffer */
15#define HT8542_CMD_AUX_OBUFF 0xD3 /* Write to HT8542 Mse Output Buffer */
16#define HT8542_CMD_AUX_WRITE 0xD4 /* Write to Mouse Port */
17#define HT8542_CMD_AUX_OFF 0xA7 /* Disable Mouse Port */
18#define HT8542_CMD_AUX_ON 0xA8 /* Re-Enable Mouse Port */
19#define HT8542_CMD_AUX_TEST 0xA9 /* Test for the presence of a Mouse */
20#define HT8542_CMD_DIAG 0xAA /* Start Diagnostics */
21#define HT8542_CMD_KBD_TEST 0xAB /* Test for presence of a keyboard */
22#define HT8542_CMD_KBD_OFF 0xAD /* Disable Kbd Port (use KBD_DAT_ON) */
23#define HT8542_CMD_KBD_ON 0xAE /* Enable Kbd Port (use KBD_DAT_OFF) */
24
25/* HT8542B cmd byte set by KBD_CMD_SET_BYTE and retrieved by KBD_CMD_GET_BYTE */
26#define HT8542_CMD_BYTE_TRANS 0x40
27#define HT8542_CMD_BYTE_AUX_OFF 0x20 /* 1 = mse port disabled, 0 = enabled */
28#define HT8542_CMD_BYTE_KBD_OFF 0x10 /* 1 = kbd port disabled, 0 = enabled */
29#define HT8542_CMD_BYTE_OVER 0x08 /* 1 = override keyboard lock */
30#define HT8542_CMD_BYTE_RES 0x04 /* reserved */
31#define HT8542_CMD_BYTE_AUX_INT 0x02 /* 1 = enable mouse interrupt */
32#define HT8542_CMD_BYTE_KBD_INT 0x01 /* 1 = enable keyboard interrupt */
33
34/* Keyboard Commands (Sent to the Data Port) */
35#define KBD_CMD_LED 0xED /* Set Keyboard LEDS with next byte */
36#define KBD_CMD_ECHO 0xEE /* Echo - we get 0xFA, 0xEE back */
37#define KBD_CMD_MODE 0xF0 /* set scan code mode with next byte */
38#define KBD_CMD_ID 0xF2 /* get keyboard/mouse ID */
39#define KBD_CMD_RPT 0xF3 /* Set Repeat Rate and Delay 2nd Byte */
40#define KBD_CMD_ON 0xF4 /* Enable keyboard */
41#define KBD_CMD_OFF 0xF5 /* Disables Scanning, Resets to Def */
42#define KBD_CMD_DEF 0xF6 /* Reverts kbd to default settings */
43#define KBD_CMD_RST 0xFF /* Reset - should get 0xFA, 0xAA back */
44
45/* Set LED second bit defines */
46#define KBD_CMD_LED_SCROLL 0x01 /* Set SCROLL LOCK LED on */
47#define KBD_CMD_LED_NUM 0x02 /* Set NUM LOCK LED on */
48#define KBD_CMD_LED_CAPS 0x04 /* Set CAPS LOCK LED on */
49
50/* Set Mode second byte defines */
51#define KBD_CMD_MODE_STAT 0x00 /* get current scan code mode */
52#define KBD_CMD_MODE_SCAN1 0x01 /* set mode to scan code 1 */
53#define KBD_CMD_MODE_SCAN2 0x02 /* set mode to scan code 2 */
54#define KBD_CMD_MODE_SCAN3 0x03 /* set mode to scan code 3 */
55
56/* Keyboard/Mouse ID Codes */
57#define KBD_CMD_ID_1ST 0xAB /* 1st byte is 0xAB, 2nd is actual ID */
58#define KBD_CMD_ID_KBD 0x83 /* Keyboard */
59#define KBD_CMD_ID_MOUSE 0x00 /* Mouse */
60
61/* Keyboard Data Return Defines */
62#define KBD_STAT_OVER 0x00 /* Buffer Overrun */
63#define KBD_STAT_DIAG_OK 0x55 /* Internal Self Test OK */
64#define KBD_STAT_RST_OK 0xAA /* Reset Complete */
65#define KBD_STAT_ECHO 0xEE /* Echo Command Return */
66#define KBD_STAT_BRK 0xF0 /* Prefix for Break Key Code */
67#define KBD_STAT_ACK 0xFA /* Received after all commands */
68#define KBD_STAT_DIAG_FAIL 0xFD /* Internal Self Test Failed */
69#define KBD_STAT_RESEND 0xFE /* Resend Last Command */
70
71/* HT8542B Status Register Bit Defines */
72#define HT8542_STAT_OBF 0x01 /* 1 = output buffer is full */
73#define HT8542_STAT_IBF 0x02 /* 1 = input buffer is full */
74#define HT8542_STAT_SYS 0x04 /* system flag - unused */
75#define HT8542_STAT_CMD 0x08 /* 1 = cmd in input buffer, 0 = data */
76#define HT8542_STAT_INH 0x10 /* 1 = Inhibit - unused */
77#define HT8542_STAT_TX 0x20 /* 1 = Transmit Timeout has occured */
78#define HT8542_STAT_RX 0x40 /* 1 = Receive Timeout has occured */
79#define HT8542_STAT_PERR 0x80 /* 1 = Parity Error from Keyboard */