X-Git-Url: https://git.karo-electronics.de/?a=blobdiff_plain;f=include%2Fi8042.h;h=e0afce174abf0c0d3b9af95aa7ea3049539ada57;hb=2d30ac33d3215c10495d75fe3b094a8a0997ed6a;hp=c48c0573749637830c2b601982df83b903c4423d;hpb=f04821a8ca714459481bd9fd315af2b5f92d99a6;p=karo-tx-uboot.git diff --git a/include/i8042.h b/include/i8042.h index c48c057374..e0afce174a 100644 --- a/include/i8042.h +++ b/include/i8042.h @@ -2,23 +2,7 @@ * (C) Copyright 2002 ELTEC Elektronik AG * Frank Gottschling * - * See file CREDITS for list of people who contributed to this - * project. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA + * SPDX-License-Identifier: GPL-2.0+ */ /* i8042.h - Intel 8042 keyboard driver header */ @@ -26,52 +10,67 @@ #ifndef _I8042_H_ #define _I8042_H_ -#ifdef __I386__ -#include -#include -#define in8(p) inb(p) -#define out8(p,v) outb(v,p) -#endif - /* defines */ -#define I8042_DATA_REG (CONFIG_SYS_ISA_IO + 0x0060) /* keyboard i/o buffer */ -#define I8042_STATUS_REG (CONFIG_SYS_ISA_IO + 0x0064) /* keyboard status read */ -#define I8042_COMMAND_REG (CONFIG_SYS_ISA_IO + 0x0064) /* keyboard ctrl write */ - -enum { - /* Output register (I8042_DATA_REG) has data for system */ - I8042_STATUS_OUT_DATA = 1 << 0, - I8042_STATUS_IN_DATA = 1 << 1, -}; - -#define KBD_US 0 /* default US layout */ -#define KBD_GER 1 /* german layout */ - -#define KBD_TIMEOUT 1000 /* 1 sec */ -#define KBD_RESET_TRIES 3 - -#define AS 0 /* normal character index */ -#define SH 1 /* shift index */ -#define CN 2 /* control index */ -#define NM 3 /* numeric lock index */ -#define AK 4 /* right alt key */ -#define CP 5 /* capslock index */ -#define ST 6 /* stop output index */ -#define EX 7 /* extended code index */ -#define ES 8 /* escape and extended code index */ - -#define NORMAL 0x0000 /* normal key */ -#define STP 0x0001 /* scroll lock stop output*/ -#define NUM 0x0002 /* numeric lock */ -#define CAPS 0x0004 /* capslock */ -#define SHIFT 0x0008 /* shift */ -#define CTRL 0x0010 /* control*/ -#define EXT 0x0020 /* extended scan code 0xe0 */ -#define ESC 0x0040 /* escape key press */ -#define E1 0x0080 /* extended scan code 0xe1 */ -#define BRK 0x0100 /* make break flag for keyboard */ -#define ALT 0x0200 /* right alt */ +#define I8042_DATA_REG 0x60 /* keyboard i/o buffer */ +#define I8042_STS_REG 0x64 /* keyboard status read */ +#define I8042_CMD_REG 0x64 /* keyboard ctrl write */ + +/* Status register bit defines */ +#define STATUS_OBF (1 << 0) +#define STATUS_IBF (1 << 1) + +/* Configuration byte bit defines */ +#define CONFIG_KIRQ_EN (1 << 0) +#define CONFIG_MIRQ_EN (1 << 1) +#define CONFIG_SET_BIST (1 << 2) +#define CONFIG_KCLK_DIS (1 << 4) +#define CONFIG_MCLK_DIS (1 << 5) +#define CONFIG_AT_TRANS (1 << 6) + +/* i8042 commands */ +#define CMD_RD_CONFIG 0x20 /* read configuration byte */ +#define CMD_WR_CONFIG 0x60 /* write configuration byte */ +#define CMD_SELF_TEST 0xaa /* controller self-test */ +#define CMD_KBD_DIS 0xad /* keyboard disable */ +#define CMD_KBD_EN 0xae /* keyboard enable */ +#define CMD_SET_KBD_LED 0xed /* set keyboard led */ +#define CMD_RESET_KBD 0xff /* reset keyboard */ + +/* i8042 command result */ +#define KBC_TEST_OK 0x55 +#define KBD_ACK 0xfa +#define KBD_POR 0xaa + +/* keyboard scan codes */ + +#define KBD_US 0 /* default US layout */ +#define KBD_GER 1 /* german layout */ + +#define KBD_TIMEOUT 1000 /* 1 sec */ +#define KBD_RESET_TRIES 3 + +#define AS 0 /* normal character index */ +#define SH 1 /* shift index */ +#define CN 2 /* control index */ +#define NM 3 /* numeric lock index */ +#define AK 4 /* right alt key */ +#define CP 5 /* capslock index */ +#define ST 6 /* stop output index */ +#define EX 7 /* extended code index */ +#define ES 8 /* escape and extended code index */ + +#define NORMAL 0x0000 /* normal key */ +#define STP 0x0001 /* scroll lock stop output*/ +#define NUM 0x0002 /* numeric lock */ +#define CAPS 0x0004 /* capslock */ +#define SHIFT 0x0008 /* shift */ +#define CTRL 0x0010 /* control*/ +#define EXT 0x0020 /* extended scan code 0xe0 */ +#define ESC 0x0040 /* escape key press */ +#define E1 0x0080 /* extended scan code 0xe1 */ +#define BRK 0x0100 /* make break flag for keyboard */ +#define ALT 0x0200 /* right alt */ /* exports */ @@ -88,8 +87,10 @@ void i8042_flush(void); */ int i8042_disable(void); +struct stdio_dev; + int i8042_kbd_init(void); -int i8042_tstc(void); -int i8042_getc(void); +int i8042_tstc(struct stdio_dev *dev); +int i8042_getc(struct stdio_dev *dev); #endif /* _I8042_H_ */