2 * (C) Copyright 2002 ELTEC Elektronik AG
3 * Frank Gottschling <fgottschling@eltec.de>
5 * SPDX-License-Identifier: GPL-2.0+
8 /* i8042.h - Intel 8042 keyboard driver header */
17 #define out8(p,v) outb(v,p)
22 #define I8042_DATA_REG (CONFIG_SYS_ISA_IO + 0x0060) /* keyboard i/o buffer */
23 #define I8042_STATUS_REG (CONFIG_SYS_ISA_IO + 0x0064) /* keyboard status read */
24 #define I8042_COMMAND_REG (CONFIG_SYS_ISA_IO + 0x0064) /* keyboard ctrl write */
27 /* Output register (I8042_DATA_REG) has data for system */
28 I8042_STATUS_OUT_DATA = 1 << 0,
29 I8042_STATUS_IN_DATA = 1 << 1,
32 #define KBD_US 0 /* default US layout */
33 #define KBD_GER 1 /* german layout */
35 #define KBD_TIMEOUT 1000 /* 1 sec */
36 #define KBD_RESET_TRIES 3
38 #define AS 0 /* normal character index */
39 #define SH 1 /* shift index */
40 #define CN 2 /* control index */
41 #define NM 3 /* numeric lock index */
42 #define AK 4 /* right alt key */
43 #define CP 5 /* capslock index */
44 #define ST 6 /* stop output index */
45 #define EX 7 /* extended code index */
46 #define ES 8 /* escape and extended code index */
48 #define NORMAL 0x0000 /* normal key */
49 #define STP 0x0001 /* scroll lock stop output*/
50 #define NUM 0x0002 /* numeric lock */
51 #define CAPS 0x0004 /* capslock */
52 #define SHIFT 0x0008 /* shift */
53 #define CTRL 0x0010 /* control*/
54 #define EXT 0x0020 /* extended scan code 0xe0 */
55 #define ESC 0x0040 /* escape key press */
56 #define E1 0x0080 /* extended scan code 0xe1 */
57 #define BRK 0x0100 /* make break flag for keyboard */
58 #define ALT 0x0200 /* right alt */
63 * Flush all buffer from keyboard controller to host.
65 void i8042_flush(void);
68 * Disables the keyboard so that key strokes no longer generate scancodes to
71 * @return 0 if ok, -1 if keyboard input was found while disabling
73 int i8042_disable(void);
77 int i8042_kbd_init(void);
78 int i8042_tstc(struct stdio_dev *dev);
79 int i8042_getc(struct stdio_dev *dev);
81 #endif /* _I8042_H_ */