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