1 1.5 andvar /* $NetBSD: kbdreg.h,v 1.5 2022/01/01 22:01:18 andvar Exp $ */ 2 1.4 soda /* $OpenBSD: kbdreg.h,v 1.3 1996/09/04 21:18:24 pefo Exp $ */ 3 1.2 thorpej 4 1.1 jonathan /* 5 1.4 soda * Copyright (c) 1996 Per Fogelstrom 6 1.4 soda * All rights reserved. 7 1.4 soda * 8 1.4 soda * Redistribution and use in source and binary forms, with or without 9 1.4 soda * modification, are permitted provided that the following conditions 10 1.4 soda * are met: 11 1.4 soda * 1. Redistributions of source code must retain the above copyright 12 1.4 soda * notice, this list of conditions and the following disclaimer. 13 1.4 soda * 2. Redistributions in binary form must reproduce the above copyright 14 1.4 soda * notice, this list of conditions and the following disclaimer in the 15 1.4 soda * documentation and/or other materials provided with the distribution. 16 1.4 soda * 3. All advertising materials mentioning features or use of this software 17 1.4 soda * must display the following acknowledgement: 18 1.4 soda * This product includes software developed by Per Fogelstrom. 19 1.4 soda * 4. The name of the author may not be used to endorse or promote products 20 1.4 soda * derived from this software without specific prior written permission 21 1.4 soda * 22 1.4 soda * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 23 1.4 soda * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 24 1.4 soda * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 25 1.4 soda * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 26 1.4 soda * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 27 1.4 soda * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 1.4 soda * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 1.4 soda * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 1.4 soda * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 31 1.4 soda * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 1.4 soda */ 33 1.4 soda /* 34 1.1 jonathan * Keyboard definitions 35 1.4 soda * 36 1.1 jonathan */ 37 1.1 jonathan 38 1.4 soda #define KBSTATP (0x61) /* controller status port (I) */ 39 1.1 jonathan #define KBS_DIB 0x01 /* data in buffer */ 40 1.1 jonathan #define KBS_IBF 0x02 /* input buffer low */ 41 1.1 jonathan #define KBS_WARM 0x04 /* input buffer low */ 42 1.1 jonathan #define KBS_OCMD 0x08 /* output buffer has command */ 43 1.1 jonathan #define KBS_NOSEC 0x10 /* security lock not engaged */ 44 1.1 jonathan #define KBS_TERR 0x20 /* transmission error */ 45 1.1 jonathan #define KBS_RERR 0x40 /* receive error */ 46 1.1 jonathan #define KBS_PERR 0x80 /* parity error */ 47 1.1 jonathan 48 1.4 soda #define KBCMDP (0x61) /* controller port (O) */ 49 1.4 soda #define KBDATAP (0x60) /* data port (I) */ 50 1.4 soda #define KBOUTP (0x60) /* data port (O) */ 51 1.1 jonathan 52 1.1 jonathan #define K_RDCMDBYTE 0x20 53 1.1 jonathan #define K_LDCMDBYTE 0x60 54 1.1 jonathan 55 1.1 jonathan #define KC8_TRANS 0x40 /* convert to old scan codes */ 56 1.1 jonathan #define KC8_MDISABLE 0x20 /* disable mouse */ 57 1.1 jonathan #define KC8_KDISABLE 0x10 /* disable keyboard */ 58 1.1 jonathan #define KC8_IGNSEC 0x08 /* ignore security lock */ 59 1.1 jonathan #define KC8_CPU 0x04 /* exit from protected mode reset */ 60 1.1 jonathan #define KC8_MENABLE 0x02 /* enable mouse interrupt */ 61 1.1 jonathan #define KC8_KENABLE 0x01 /* enable keyboard interrupt */ 62 1.1 jonathan #define CMDBYTE (KC8_TRANS|KC8_CPU|KC8_MENABLE|KC8_KENABLE) 63 1.1 jonathan 64 1.1 jonathan /* keyboard commands */ 65 1.1 jonathan #define KBC_RESET 0xFF /* reset the keyboard */ 66 1.1 jonathan #define KBC_RESEND 0xFE /* request the keyboard resend the last byte */ 67 1.1 jonathan #define KBC_SETDEFAULT 0xF6 /* resets keyboard to its power-on defaults */ 68 1.1 jonathan #define KBC_DISABLE 0xF5 /* as per KBC_SETDEFAULT, but also disable key scanning */ 69 1.1 jonathan #define KBC_ENABLE 0xF4 /* enable key scanning */ 70 1.1 jonathan #define KBC_TYPEMATIC 0xF3 /* set typematic rate and delay */ 71 1.1 jonathan #define KBC_SETTABLE 0xF0 /* set scancode translation table */ 72 1.1 jonathan #define KBC_MODEIND 0xED /* set mode indicators (i.e. LEDs) */ 73 1.1 jonathan #define KBC_ECHO 0xEE /* request an echo from the keyboard */ 74 1.1 jonathan 75 1.1 jonathan /* keyboard responses */ 76 1.1 jonathan #define KBR_EXTENDED 0xE0 /* extended key sequence */ 77 1.1 jonathan #define KBR_RESEND 0xFE /* needs resend of command */ 78 1.1 jonathan #define KBR_ACK 0xFA /* received a valid command */ 79 1.1 jonathan #define KBR_OVERRUN 0x00 /* flooded */ 80 1.5 andvar #define KBR_FAILURE 0xFD /* diagnostic failure */ 81 1.1 jonathan #define KBR_BREAK 0xF0 /* break code prefix - sent on key release */ 82 1.1 jonathan #define KBR_RSTDONE 0xAA /* reset complete */ 83 1.1 jonathan #define KBR_ECHO 0xEE /* echo response */ 84