Home | History | Annotate | Line # | Download | only in sun
kbd_tables.h revision 1.4
      1  1.4  gwr /*	$NetBSD: kbd_tables.h,v 1.4 1996/12/17 20:46:14 gwr Exp $	*/
      2  1.1  gwr 
      3  1.1  gwr /*
      4  1.1  gwr  * Copyright (c) 1996 Gordon W. Ross
      5  1.1  gwr  * All rights reserved.
      6  1.1  gwr  *
      7  1.1  gwr  * Redistribution and use in source and binary forms, with or without
      8  1.1  gwr  * modification, are permitted provided that the following conditions
      9  1.1  gwr  * are met:
     10  1.1  gwr  * 1. Redistributions of source code must retain the above copyright
     11  1.1  gwr  *    notice, this list of conditions and the following disclaimer.
     12  1.1  gwr  * 2. Redistributions in binary form must reproduce the above copyright
     13  1.1  gwr  *    notice, this list of conditions and the following disclaimer in the
     14  1.1  gwr  *    documentation and/or other materials provided with the distribution.
     15  1.1  gwr  * 3. The name of the author may not be used to endorse or promote products
     16  1.1  gwr  *    derived from this software without specific prior written permission.
     17  1.1  gwr  * 4. All advertising materials mentioning features or use of this software
     18  1.1  gwr  *    must display the following acknowledgement:
     19  1.1  gwr  *      This product includes software developed by Gordon Ross
     20  1.1  gwr  *
     21  1.1  gwr  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     22  1.1  gwr  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     23  1.1  gwr  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     24  1.1  gwr  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     25  1.1  gwr  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     26  1.1  gwr  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     27  1.1  gwr  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     28  1.1  gwr  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     29  1.1  gwr  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     30  1.1  gwr  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     31  1.1  gwr  */
     32  1.1  gwr 
     33  1.1  gwr /*
     34  1.1  gwr  * Keyboard translation tables.  These tables contain
     35  1.1  gwr  * "Key symbols" (or "keysyms", to use X terminology).
     36  1.1  gwr  * The key symbol space is divided into "classes" where
     37  1.1  gwr  * the high 8 bits determine the symbol class, and the
     38  1.1  gwr  * low 8 bits are interpreted in a way specific to each
     39  1.1  gwr  * class.  The simplest class is ASCII, which is defined
     40  1.1  gwr  * as class zero in order to simplify table definition.
     41  1.1  gwr  *
     42  1.1  gwr  * For convenience in the driver, all keysyms that
     43  1.1  gwr  * deserve autorepeat are below 0x8000.  The driver
     44  1.1  gwr  * uses the following macro to determine if a keysym
     45  1.1  gwr  * should NOT get autorepeat.
     46  1.1  gwr  */
     47  1.1  gwr #define KEYSYM_NOREPEAT(sym) ((sym) & 0x8000)
     48  1.1  gwr 
     49  1.1  gwr #define KEYSYM_CLASS(sym) ((sym) & 0xFF00)
     50  1.1  gwr #define KEYSYM_DATA(sym)  ((sym) & 0x00FF)
     51  1.1  gwr 
     52  1.1  gwr /*
     53  1.1  gwr  * The ACSII class.  Low 8 bits are the character.
     54  1.1  gwr  */
     55  1.1  gwr #define KEYSYM_ASCII 0
     56  1.1  gwr 
     57  1.1  gwr /*
     58  1.1  gwr  * The "special" class.
     59  1.1  gwr  * We don't expect to receive any of these often,
     60  1.1  gwr  * except for KEYSYM_NOP.  All can be ignored,
     61  1.1  gwr  * because HW_ERR, LAYOUT, RESET, are all handled
     62  1.1  gwr  * at a lower layer, before the translation code.
     63  1.1  gwr  */
     64  1.1  gwr #define KEYSYM_SPECIAL	0x8300
     65  1.1  gwr #define KEYSYM_NOP  	0x8300
     66  1.1  gwr #define KEYSYM_OOPS 	0x8301
     67  1.1  gwr #define KEYSYM_HOLE 	0x8302
     68  1.1  gwr #define KEYSYM_HW_ERR	0x8307	/* kbd sent 0x7e */
     69  1.1  gwr #define KEYSYM_LAYOUT	0x830e	/* kbd sent 0xfe */
     70  1.1  gwr #define KEYSYM_RESET	0x830f	/* kbd sent 0xff */
     71  1.1  gwr 
     72  1.1  gwr 
     73  1.1  gwr /*
     74  1.1  gwr  * Floating accents class:  (not implemented)
     75  1.1  gwr  * umlaut, circumflex, tilde, cedilla, acute, grave,...
     76  1.1  gwr  */
     77  1.1  gwr #define	KEYSYM_ACCENT 0x0400
     78  1.1  gwr 
     79  1.1  gwr /*
     80  1.1  gwr  * The string entry class.
     81  1.1  gwr  * The low 4 bits select one of the entries from
     82  1.1  gwr  * the string table.  (see kbd_stringtab[])
     83  1.1  gwr  * By default, the string table has ANSI movement
     84  1.1  gwr  * sequences for the arrow keys.
     85  1.1  gwr  */
     86  1.1  gwr #define	KEYSYM_STRING 0x0500
     87  1.1  gwr 
     88  1.1  gwr /*
     89  1.1  gwr  * Function keys (compatible with SunOS 4.1)
     90  1.1  gwr  * L:left, R:right, F:func(top), N:numeric
     91  1.1  gwr  */
     92  1.1  gwr #define	KEYSYM_FUNC   0x0600
     93  1.1  gwr #define	KEYSYM_FUNC_L(x) (KEYSYM_FUNC | ((x) - 1))
     94  1.1  gwr #define	KEYSYM_FUNC_R(x) (KEYSYM_FUNC | ((x) - 1 + 0x10))
     95  1.1  gwr #define	KEYSYM_FUNC_F(x) (KEYSYM_FUNC | ((x) - 1 + 0x20))
     96  1.1  gwr #define	KEYSYM_FUNC_N(x) (KEYSYM_FUNC | ((x) - 1 + 0x30))
     97  1.1  gwr 
     98  1.1  gwr /*
     99  1.1  gwr  * Modifier symbols, to set/clear/toggle a modifier
    100  1.1  gwr  * The low 5 bits define the position of a modifier
    101  1.1  gwr  * bit to be cleared, set, or inverted.  The meanings
    102  1.1  gwr  * of the modifier bit positions are defined below.
    103  1.1  gwr  */
    104  1.1  gwr #define KEYSYM_CLRMOD 0x9000
    105  1.1  gwr #define KEYSYM_SETMOD 0x9100
    106  1.1  gwr #define KEYSYM_INVMOD 0x9200
    107  1.1  gwr #define KEYSYM_ALL_UP 0x9300
    108  1.1  gwr 
    109  1.1  gwr /*
    110  1.1  gwr  * Modifier indices.
    111  1.1  gwr  * (logical OR with {CLR,SET,TOG}MOD above)
    112  1.1  gwr  */
    113  1.1  gwr #define	KBMOD_CTRL_L	0
    114  1.1  gwr #define	KBMOD_CTRL_R	1
    115  1.1  gwr #define	KBMOD_SHIFT_L	2
    116  1.1  gwr #define	KBMOD_SHIFT_R	3
    117  1.1  gwr #define	KBMOD_META_L	4
    118  1.1  gwr #define	KBMOD_META_R	5
    119  1.1  gwr #define KBMOD_ALT_L 	6
    120  1.1  gwr #define KBMOD_ALT_R 	7
    121  1.1  gwr /* Note 0-15 are cleared by ALL_UP */
    122  1.1  gwr #define KBMOD_CAPSLOCK  16
    123  1.1  gwr #define KBMOD_NUMLOCK	17
    124  1.1  gwr 
    125  1.1  gwr #define	KBMOD_ALTGRAPH	KBMOD_ALT_R
    126  1.1  gwr 
    127  1.1  gwr 
    128  1.1  gwr #ifdef	_KERNEL
    129  1.1  gwr 
    130  1.1  gwr #define KEYMAP_SIZE 128
    131  1.1  gwr 
    132  1.1  gwr struct keyboard {
    133  1.4  gwr 	u_short	*k_release; 	/* Key released */
    134  1.4  gwr 	u_short	*k_control; 	/* Ctrl is down */
    135  1.4  gwr 	u_short	*k_normal;  	/* No shifts */
    136  1.4  gwr 	u_short	*k_shifted; 	/* Shift is down */
    137  1.1  gwr };
    138  1.1  gwr 
    139  1.1  gwr extern char kbd_stringtab[16][10];
    140  1.2  gwr extern unsigned short kbd_numlock_map[64];
    141  1.2  gwr 
    142  1.1  gwr extern struct keyboard * keyboards[];
    143  1.1  gwr extern int kbd_max_type;
    144  1.1  gwr #define	KBD_MIN_TYPE 2
    145  1.1  gwr 
    146  1.1  gwr #endif	/* _KERNEL */
    147