remove duplicate const
[AROS.git] / rom / hidds / i8042 / kbd_common.h
blob81fdfc20086e65c4f0771f2fef436e7382b55d70
1 /*
2 Copyright © 2013, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Low-level definitions for i8042 controller.
6 Lang: English.
7 */
9 #include <asm/io.h>
11 #define KBD_NO_DATA (-1)
12 #define KBD_BAD_DATA (-2)
14 /****************************************************************************************/
16 #define KBD_STATUS_REG 0x64
17 #define KBD_CONTROL_REG 0x64
18 #define KBD_DATA_REG 0x60
20 #define KBD_STATUS_OBF 0x01 /* keyboard output buffer full */
21 #define KBD_STATUS_IBF 0x02 /* keyboard input buffer full */
22 #define KBD_STATUS_MOUSE_OBF 0x20 /* Mouse output buffer full */
23 #define KBD_STATUS_GTO 0x40 /* General receive/xmit timeout */
24 #define KBD_STATUS_PERR 0x80 /* Parity error */
26 #define KBD_CTRLCMD_READ_MODE 0x20
27 #define KBD_CTRLCMD_WRITE_MODE 0x60
28 #define KBD_CTRLCMD_GET_VERSION 0xA1
29 #define KBD_CTRLCMD_MOUSE_DISABLE 0xA7
30 #define KBD_CTRLCMD_MOUSE_ENABLE 0xA8
31 #define KBD_CTRLCMD_TEST_MOUSE 0xA9
32 #define KBD_CTRLCMD_SELF_TEST 0xAA
33 #define KBD_CTRLCMD_KBD_TEST 0xAB
34 #define KBD_CTRLCMD_KBD_DISABLE 0xAD
35 #define KBD_CTRLCMD_KBD_ENABLE 0xAE
36 #define KBD_CTRLCMD_WRITE_AUX_OBUF 0xD3
37 #define KBD_CTRLCMD_WRITE_MOUSE 0xD4
39 #define KBD_REPLY_POR 0xAA /* Power on reset */
40 #define KBD_REPLY_ACK 0xFA /* Command ACK */
41 #define KBD_REPLY_RESEND 0xFE /* Command NACK, send the cmd again */
43 #define KBD_MODE_KBD_INT 0x01 /* Keyboard data generate IRQ1 */
44 #define KBD_MODE_MOUSE_INT 0x02 /* Mouse data generate IRQ12 */
45 #define KBD_MODE_SYS 0x04 /* The system flag (?) */
46 #define KBD_MODE_NO_KEYLOCK 0x08 /* The keylock doesn't affect the keyboard if set */
47 #define KBD_MODE_DISABLE_KBD 0x10 /* Disable keyboard interface */
48 #define KBD_MODE_DISABLE_MOUSE 0x20 /* Disable mouse interface */
49 #define KBD_MODE_KCC 0x40 /* Scan code conversion to PC format */
50 #define KBD_MODE_RFU 0x80
52 #define kbd_read_input() inb(KBD_DATA_REG)
53 #define kbd_read_status() inb(KBD_STATUS_REG)
54 #define kbd_write_output(val) outb(val, KBD_DATA_REG)
55 #define kbd_write_command(val) outb(val, KBD_CONTROL_REG)
57 /****************************************************************************************/
59 int kbd_read_data(void);
60 void kb_wait(ULONG timeout);
61 void kbd_write_cmd(int cmd);
62 void aux_write_ack(int val);
63 void aux_write_noack(int val);
64 void kbd_write_output_w(int data);
65 int kbd_clear_input(void);
66 int kbd_wait_for_input(void);
67 int aux_wait_for_input(void);
68 void kbd_write_command_w(int data);
69 void kbd_usleep(LONG usec);