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