1 /* $NetBSD: kbdmap.h,v 1.11 2002/01/26 13:40:58 aymeric 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 #define NUL 0 33 #define SOH 1 34 #define STX 2 35 #define ETX 3 36 #define EOT 4 37 #define ENQ 5 38 #define ACK 6 39 #define BEL 7 40 #define BS 8 41 #define HT 9 42 #define LF 10 43 #define VT 11 44 #define FF 12 45 #define CR 13 46 #define SO 14 47 #define SI 15 48 #define DLE 16 49 #define DC1 17 50 #define DC2 18 51 #define DC3 19 52 #define DC4 20 53 #define NAK 21 54 #define SYN 22 55 #define ETB 23 56 #define CAN 24 57 #define EM 25 58 #define SUB 26 59 #define ESC 27 60 #define FS 28 61 #define GS 29 62 #define RS 30 63 #define US 31 64 #define DEL 127 65 #define IND 132 66 #define NEL 133 67 #define SSA 134 68 #define ESA 135 69 #define HTS 136 70 #define HTJ 137 71 #define VTS 138 72 #define PLD 139 73 #define PLU 140 74 #define RI 141 75 #define SS2 142 76 #define SS3 143 77 #define DCS 144 78 #define PU1 145 79 #define PU2 146 80 #define STS 147 81 #define CCH 148 82 #define MW 149 83 #define SPA 150 84 #define EPA 151 85 #define CSI 155 86 #define ST 156 87 #define OSC 157 88 #define PM 158 89 #define APC 159 90 91 92 /* a normal Amiga keyboard has 0x60 `normal' keys, plus modifier keys that 93 don't appear in the keymap */ 94 #define KBD_NUM_KEYS 0x60 95 96 /* size of string table */ 97 #define KBD_STRTAB_SIZE 255 98 99 /* for dead keys, index into acctable (plus 1!) */ 100 #define KBD_ACC_GRAVE 1 101 #define KBD_ACC_ACUTE 2 102 #define KBD_ACC_CIRC 3 103 #define KBD_ACC_TILDE 4 104 #define KBD_ACC_DIER 5 105 #define KBD_NUM_ACC 6 106 107 108 struct key { 109 unsigned char mode; /* see possible values below */ 110 unsigned char code; 111 }; 112 113 #define KBD_MODE_STRING (1<<0) /* code is index into strings[] */ 114 #define KBD_MODE_DEAD (1<<1) /* acc-index in upper nibble, code = plain acc */ 115 #define KBD_MODE_CAPS (1<<2) /* key is capsable. Only used in non-shifted maps */ 116 #define KBD_MODE_KPAD (1<<3) /* key is on keypad */ 117 #define KBD_MODE_GRAVE (KBD_ACC_GRAVE << 4) 118 #define KBD_MODE_ACUTE (KBD_ACC_ACUTE << 4) 119 #define KBD_MODE_CIRC (KBD_ACC_CIRC << 4) 120 #define KBD_MODE_TILDE (KBD_ACC_TILDE << 4) 121 #define KBD_MODE_DIER (KBD_ACC_DIER << 4) 122 #define KBD_MODE_ACCENT(m) (((m) >> 4) - 1) /* get accent from mode */ 123 #define KBD_MODE_ACCMASK (0xf0) 124 125 struct kbdmap { 126 struct key keys[KBD_NUM_KEYS], 127 shift_keys[KBD_NUM_KEYS], 128 alt_keys[KBD_NUM_KEYS], 129 alt_shift_keys[KBD_NUM_KEYS]; 130 unsigned char strings[KBD_STRTAB_SIZE]; 131 }; 132 133 134 #ifdef _KERNEL 135 /* XXX: ITE interface */ 136 extern struct kbdmap kbdmap, ascii_kbdmap; 137 extern unsigned char acctable[KBD_NUM_ACC][64]; 138 #include <sys/cdefs.h> 139 void kbdenable(void); 140 int kbdgetcn(void); 141 #endif 142