Home | History | Annotate | Line # | Download | only in dev
kbdmap.h revision 1.4
      1  1.4  leo /*	$NetBSD: kbdmap.h,v 1.4 1997/01/10 21:24:27 leo Exp $	*/
      2  1.1  leo 
      3  1.1  leo /*
      4  1.1  leo  * Copyright (c) 1993 Markus Wild
      5  1.1  leo  * All rights reserved.
      6  1.1  leo  *
      7  1.1  leo  * Redistribution and use in source and binary forms, with or without
      8  1.1  leo  * modification, are permitted provided that the following conditions
      9  1.1  leo  * are met:
     10  1.1  leo  * 1. Redistributions of source code must retain the above copyright
     11  1.1  leo  *    notice, this list of conditions and the following disclaimer.
     12  1.1  leo  * 2. Redistributions in binary form must reproduce the above copyright
     13  1.1  leo  *    notice, this list of conditions and the following disclaimer in the
     14  1.1  leo  *    documentation and/or other materials provided with the distribution.
     15  1.1  leo  * 3. All advertising materials mentioning features or use of this software
     16  1.1  leo  *    must display the following acknowledgement:
     17  1.1  leo  *      This product includes software developed by Markus Wild.
     18  1.1  leo  * 4. The name of the author may not be used to endorse or promote products
     19  1.1  leo  *    derived from this software without specific prior written permission
     20  1.1  leo  *
     21  1.1  leo  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     22  1.1  leo  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     23  1.1  leo  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     24  1.1  leo  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     25  1.1  leo  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     26  1.1  leo  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     27  1.1  leo  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     28  1.1  leo  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     29  1.1  leo  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     30  1.1  leo  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     31  1.1  leo  */
     32  1.1  leo 
     33  1.1  leo #define NUL	0
     34  1.1  leo #define SOH	1
     35  1.1  leo #define STX	2
     36  1.1  leo #define ETX	3
     37  1.1  leo #define EOT	4
     38  1.1  leo #define ENQ	5
     39  1.1  leo #define ACK	6
     40  1.1  leo #define	BEL	7
     41  1.1  leo #define BS	8
     42  1.1  leo #define HT	9
     43  1.1  leo #define LF	10
     44  1.1  leo #define VT	11
     45  1.1  leo #define FF	12
     46  1.1  leo #define CR	13
     47  1.1  leo #define SO	14
     48  1.1  leo #define SI	15
     49  1.1  leo #define DLE	16
     50  1.1  leo #define DC1	17
     51  1.1  leo #define DC2	18
     52  1.1  leo #define DC3	19
     53  1.1  leo #define DC4	20
     54  1.1  leo #define NAK	21
     55  1.1  leo #define SYN	22
     56  1.1  leo #define ETB	23
     57  1.1  leo #define CAN	24
     58  1.1  leo #define EM	25
     59  1.1  leo #define SUB	26
     60  1.1  leo #define ESC	27
     61  1.1  leo #define FS	28
     62  1.1  leo #define GS	29
     63  1.1  leo #define RS	30
     64  1.1  leo #define US	31
     65  1.1  leo #define	DEL	127
     66  1.1  leo #define IND	132
     67  1.1  leo #define NEL	133
     68  1.1  leo #define SSA	134
     69  1.1  leo #define ESA	135
     70  1.1  leo #define HTS	136
     71  1.1  leo #define HTJ	137
     72  1.1  leo #define VTS	138
     73  1.1  leo #define PLD	139
     74  1.1  leo #define PLU	140
     75  1.1  leo #define RI	141
     76  1.1  leo #define SS2	142
     77  1.1  leo #define SS3	143
     78  1.1  leo #define DCS	144
     79  1.1  leo #define PU1	145
     80  1.1  leo #define PU2	146
     81  1.1  leo #define STS	147
     82  1.1  leo #define CCH	148
     83  1.1  leo #define MW	149
     84  1.1  leo #define SPA	150
     85  1.1  leo #define EPA	151
     86  1.1  leo #define CSI	155
     87  1.1  leo #define ST	156
     88  1.1  leo #define OSC	157
     89  1.1  leo #define PM	158
     90  1.1  leo #define APC	159
     91  1.1  leo 
     92  1.1  leo 
     93  1.1  leo /*
     94  1.1  leo  * A total of 0x80 scancode are defined for the atari keyboard.
     95  1.1  leo  */
     96  1.1  leo #define KBD_NUM_KEYS	0x80
     97  1.1  leo 
     98  1.1  leo /* size of string table */
     99  1.1  leo #define KBD_STRTAB_SIZE	255
    100  1.1  leo 
    101  1.1  leo /* for dead keys, index into acctable */
    102  1.1  leo /* FIXME: What the hell are dead keys?? */
    103  1.1  leo #define	KBD_ACC_GRAVE	0
    104  1.1  leo #define KBD_ACC_ACUTE	1
    105  1.1  leo #define KBD_ACC_CIRC	2
    106  1.1  leo #define KBD_ACC_TILDE	3
    107  1.1  leo #define KBD_ACC_DIER	4
    108  1.1  leo #define KBD_NUM_ACC		5
    109  1.1  leo 
    110  1.1  leo 
    111  1.1  leo struct key {
    112  1.1  leo 	unsigned char	mode;	/* see possible values below */
    113  1.1  leo 	unsigned char	code;
    114  1.1  leo };
    115  1.1  leo 
    116  1.1  leo #define KBD_MODE_STRING	(0x01)	/* code is index into strings[] */
    117  1.1  leo #define KBD_MODE_DEAD	(0x02)	/* acc-index in upper nibble, code = plain acc */
    118  1.1  leo #define KBD_MODE_CAPS	(0x04)	/* key is capsable. Only in non-shifted maps  */
    119  1.1  leo #define KBD_MODE_KPAD	(0x08)	/* key is on keypad */
    120  1.1  leo #define KBD_MODE_GRAVE	(KBD_ACC_GRAVE << 4)
    121  1.1  leo #define KBD_MODE_ACUTE	(KBD_ACC_ACUTE << 4)
    122  1.1  leo #define KBD_MODE_CIRC	(KBD_ACC_CIRC  << 4)
    123  1.1  leo #define KBD_MODE_TILDE	(KBD_ACC_TILDE << 4)
    124  1.1  leo #define KBD_MODE_DIER	(KBD_ACC_DIER  << 4)
    125  1.1  leo #define KBD_MODE_ACCENT(m) ((m) >> 4)	/* get accent from mode */
    126  1.1  leo #define KBD_MODE_ACCMASK  (0xf0)
    127  1.1  leo 
    128  1.1  leo #define	KBD_SCANCODE(code)	(code & 0x7f)
    129  1.1  leo #define	KBD_RELEASED(code)	(code & 0x80 ? 1 : 0)
    130  1.4  leo #define	KBD_IS_KEY(code)	((u_char)(code) < 0xf6)
    131  1.1  leo 
    132  1.1  leo struct kbdmap {
    133  1.1  leo 	struct key	keys[KBD_NUM_KEYS],
    134  1.1  leo 			shift_keys[KBD_NUM_KEYS],
    135  1.1  leo 			alt_keys[KBD_NUM_KEYS],
    136  1.1  leo 			alt_shift_keys[KBD_NUM_KEYS];
    137  1.1  leo 	unsigned char	strings[KBD_STRTAB_SIZE];
    138  1.1  leo };
    139  1.1  leo 
    140  1.1  leo 
    141  1.2  leo #ifdef _KERNEL
    142  1.1  leo /* XXX: ITE interface */
    143  1.3  leo extern struct kbdmap	ascii_kbdmap;
    144  1.1  leo extern unsigned char	acctable[KBD_NUM_ACC][64];
    145  1.1  leo #endif
    146