1 /* 2 * This file contains definitions from two files in NetBSD, lk201.h and lk201.c. 3 * 4 * Technical information can be found here: 5 * 6 * https://www.netbsd.org/docs/Hardware/Machines/DEC/lk201.html 7 * 8 * The header file (lk201.h) in NetBSD did not have a separate copyright 9 * notice on it. Possible sources for lk201.h and lk201.c are the old files 10 * http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/pmax/dev/Attic/fb.c?rev=1.1&content-type=text/x-cvsweb-markup 11 * for the scan codes, and 12 * http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/pmax/dev/Attic/fbreg.h?rev=1.1&content-type=text/x-cvsweb-markup 13 * for other control codes, in which case the copyright is/was: 14 * 15 * 16 * Copyright (c) 1992 The Regents of the University of California. 17 * All rights reserved. 18 * 19 * This code is derived from software contributed to Berkeley by 20 * Ralph Campbell and Rick Macklem. 21 * 22 * Redistribution and use in source and binary forms, with or without 23 * modification, are permitted provided that the following conditions 24 * are met: 25 * 1. Redistributions of source code must retain the above copyright 26 * notice, this list of conditions and the following disclaimer. 27 * 2. Redistributions in binary form must reproduce the above copyright 28 * notice, this list of conditions and the following disclaimer in the 29 * documentation and/or other materials provided with the distribution. 30 * 3. All advertising materials mentioning features or use of this software 31 * must display the following acknowledgement: 32 * This product includes software developed by the University of 33 * California, Berkeley and its contributors. 34 * 4. Neither the name of the University nor the names of its contributors 35 * may be used to endorse or promote products derived from this software 36 * without specific prior written permission. 37 * 38 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 39 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 40 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 41 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 42 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 43 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 44 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 45 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 46 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 47 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 48 * SUCH DAMAGE. 49 * 50 * 51 * 52 * @(#)fb.c 7.2 (Berkeley) 12/20/92 53 * and 54 * @(#)fbreg.h 7.1 (Berkeley) 11/15/92 55 */ 56 57 #ifndef LK201_H 58 #define LK201_H 59 60 /* $NetBSD: lk201.h,v 1.7 1999/03/19 18:34:01 ad Exp $ */ 61 62 63 /* 64 * Ascii values of command keys. 65 */ 66 #define KBD_TAB '\t' 67 #define KBD_DEL 127 68 #define KBD_RET '\r' 69 70 /* 71 * Define "hardware-independent" codes for the control, shift, meta and 72 * function keys. Codes start after the last 7-bit ASCII code (127) 73 * and are assigned in an arbitrary order. 74 */ 75 #define KBD_NOKEY 128 76 77 #define KBD_F1 201 78 #define KBD_F2 202 79 #define KBD_F3 203 80 #define KBD_F4 204 81 #define KBD_F5 205 82 #define KBD_F6 206 83 #define KBD_F7 207 84 #define KBD_F8 208 85 #define KBD_F9 209 86 #define KBD_F10 210 87 #define KBD_F11 211 88 #define KBD_F12 212 89 #define KBD_F13 213 90 #define KBD_F14 214 91 #define KBD_HELP 215 92 #define KBD_DO 216 93 #define KBD_F17 217 94 #define KBD_F18 218 95 #define KBD_F19 219 96 #define KBD_F20 220 97 98 #define KBD_FIND 221 99 #define KBD_INSERT 222 100 #define KBD_REMOVE 223 101 #define KBD_SELECT 224 102 #define KBD_PREVIOUS 225 103 #define KBD_NEXT 226 104 105 #define KBD_KP_ENTER 227 106 #define KBD_KP_F1 228 107 #define KBD_KP_F2 229 108 #define KBD_KP_F3 230 109 #define KBD_KP_F4 231 110 #define KBD_LEFT 232 111 #define KBD_RIGHT 233 112 #define KBD_DOWN 234 113 #define KBD_UP 235 114 115 #define KBD_CONTROL 236 116 #define KBD_SHIFT 237 117 #define KBD_CAPSLOCK 238 118 #define KBD_ALTERNATE 239 119 120 121 122 /* 123 * Definitions for the Keyboard and mouse. 124 */ 125 /* 126 * Special key values. 127 */ 128 #define KEY_R_SHIFT 0xab 129 #define KEY_SHIFT 0xae 130 #define KEY_CONTROL 0xaf 131 #define KEY_CAPSLOCK 0xb0 132 #define KEY_R_ALT 0xb2 133 #define KEY_UP 0xb3 134 #define KEY_REPEAT 0xb4 135 #define KEY_F1 0x56 136 #define KEY_COMMAND KEY_F1 137 138 /* 139 * Lk201/301 keyboard 140 */ 141 #define LK_UPDOWN 0x86 /* bits for setting lk201 modes */ 142 #define LK_AUTODOWN 0x82 143 #define LK_DOWN 0x80 144 #define LK_DEFAULTS 0xd3 /* reset mode settings */ 145 #define LK_AR_ENABLE 0xe3 /* global auto repeat enable */ 146 #define LK_CL_ENABLE 0x1b /* keyclick enable */ 147 #define LK_KBD_ENABLE 0x8b /* keyboard enable */ 148 #define LK_BELL_ENABLE 0x23 /* the bell */ 149 #define LK_LED_ENABLE 0x13 /* light led */ 150 #define LK_LED_DISABLE 0x11 /* turn off led */ 151 #define LK_RING_BELL 0xa7 /* ring keyboard bell */ 152 #define LED_1 0x81 /* led bits */ 153 #define LED_2 0x82 154 #define LED_3 0x84 155 #define LED_4 0x88 156 #define LED_ALL 0x8f 157 #define LK_HELP 0x7c /* help key */ 158 #define LK_DO 0x7d /* do key */ 159 #define LK_KDOWN_ERROR 0x3d /* key down on powerup error */ 160 #define LK_POWER_ERROR 0x3e /* keyboard failure on pwrup tst*/ 161 #define LK_OUTPUT_ERROR 0xb5 /* keystrokes lost during inhbt */ 162 #define LK_INPUT_ERROR 0xb6 /* garbage command to keyboard */ 163 #define LK_LOWEST 0x56 /* lowest significant keycode */ 164 165 /* max volume is 0, lowest is 0x7 */ 166 #define LK_PARAM_VOLUME(v) (0x80|((v)&0x7)) 167 168 /* mode command details */ 169 #define LK_CMD_MODE(m,div) ((m)|((div)<<3)) 170 171 172 /* 173 * Command characters for the mouse. 174 */ 175 #define MOUSE_SELF_TEST 'T' 176 #define MOUSE_INCREMENTAL 'R' 177 178 /* 179 * Mouse output bits. 180 * 181 * MOUSE_START_FRAME Start of report frame bit. 182 * MOUSE_X_SIGN Sign bit for X. 183 * MOUSE_Y_SIGN Sign bit for Y. 184 * MOUSE_X_OFFSET X offset to start cursor at. 185 * MOUSE_Y_OFFSET Y offset to start cursor at. 186 */ 187 #define MOUSE_START_FRAME 0x80 188 #define MOUSE_X_SIGN 0x10 189 #define MOUSE_Y_SIGN 0x08 190 191 /* 192 * Definitions for mouse buttons 193 */ 194 #define EVENT_LEFT_BUTTON 0x01 195 #define EVENT_MIDDLE_BUTTON 0x02 196 #define EVENT_RIGHT_BUTTON 0x03 197 #define RIGHT_BUTTON 0x01 198 #define MIDDLE_BUTTON 0x02 199 #define LEFT_BUTTON 0x04 200 201 #ifdef _KERNEL 202 extern int LKgetc __P((dev_t dev)); 203 extern void lkdivert __P ((int (*getc_fn)(dev_t dev), dev_t dev)); 204 #endif 205 206 207 /* This is also from netbsd, pmax/dev/lk201.c: */ 208 209 /* 210 * Keyboard to ASCII, unshifted. 211 */ 212 static u_char unshiftedAscii[] = { 213 /* 0 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, 214 /* 4 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, 215 /* 8 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, 216 /* c */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, 217 /* 10 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, 218 /* 14 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, 219 /* 18 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, 220 /* 1c */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, 221 /* 20 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, 222 /* 24 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, 223 /* 28 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, 224 /* 2c */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, 225 /* 30 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, 226 /* 34 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, 227 /* 38 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, 228 /* 3c */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, 229 /* 40 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, 230 /* 44 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, 231 /* 48 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, 232 /* 4c */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, 233 /* 50 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, 234 /* 54 */ KBD_NOKEY, KBD_NOKEY, KBD_F1, KBD_F2, 235 /* 58 */ KBD_F3, KBD_F4, KBD_F5, KBD_NOKEY, 236 /* 5c */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, 237 /* 60 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, 238 /* 64 */ KBD_F6, KBD_F7, KBD_F8, KBD_F9, 239 /* 68 */ KBD_F10, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, 240 /* 6c */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, 241 /* 70 */ KBD_NOKEY, '\033', KBD_F12, KBD_F13, 242 /* 74 */ KBD_F14, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, 243 /* 78 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, 244 /* 7c */ KBD_HELP, KBD_DO, KBD_NOKEY, KBD_NOKEY, 245 /* 80 */ KBD_F17, KBD_F18, KBD_F19, KBD_F20, 246 /* 84 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, 247 /* 88 */ KBD_NOKEY, KBD_NOKEY, KBD_FIND, KBD_INSERT, 248 /* 8c */ KBD_REMOVE, KBD_SELECT, KBD_PREVIOUS, KBD_NEXT, 249 /* 90 */ KBD_NOKEY, KBD_NOKEY, '0', KBD_NOKEY, 250 /* 94 */ '.', KBD_KP_ENTER, '1', '2', 251 /* 98 */ '3', '4', '5', '6', 252 /* 9c */ ',', '7', '8', '9', 253 /* a0 */ '-', KBD_KP_F1, KBD_KP_F2, KBD_KP_F3, 254 /* a4 */ KBD_KP_F4, KBD_NOKEY, KBD_NOKEY, KBD_LEFT, 255 /* a8 */ KBD_RIGHT, KBD_DOWN, KBD_UP, KBD_NOKEY, 256 /* ac */ KBD_NOKEY, KBD_NOKEY, KBD_SHIFT, KBD_CONTROL, 257 /* b0 */ KBD_CAPSLOCK, KBD_ALTERNATE, KBD_NOKEY, KBD_NOKEY, 258 /* b4 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, 259 /* b8 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, 260 /* bc */ KBD_DEL, KBD_RET, KBD_TAB, '`', 261 /* c0 */ '1', 'q', 'a', 'z', 262 /* c4 */ KBD_NOKEY, '2', 'w', 's', 263 /* c8 */ 'x', '<', KBD_NOKEY, '3', 264 /* cc */ 'e', 'd', 'c', KBD_NOKEY, 265 /* d0 */ '4', 'r', 'f', 'v', 266 /* d4 */ ' ', KBD_NOKEY, '5', 't', 267 /* d8 */ 'g', 'b', KBD_NOKEY, '6', 268 /* dc */ 'y', 'h', 'n', KBD_NOKEY, 269 /* e0 */ '7', 'u', 'j', 'm', 270 /* e4 */ KBD_NOKEY, '8', 'i', 'k', 271 /* e8 */ ',', KBD_NOKEY, '9', 'o', 272 /* ec */ 'l', '.', KBD_NOKEY, '0', 273 /* f0 */ 'p', KBD_NOKEY, ';', '/', 274 /* f4 */ KBD_NOKEY, '=', ']', '\\', 275 /* f8 */ KBD_NOKEY, '-', '[', '\'', 276 /* fc */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, 277 }; 278 279 /* 280 * Keyboard to Ascii, shifted. 281 */ 282 static u_char shiftedAscii[] = { 283 /* 0 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, 284 /* 4 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, 285 /* 8 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, 286 /* c */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, 287 /* 10 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, 288 /* 14 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, 289 /* 18 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, 290 /* 1c */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, 291 /* 20 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, 292 /* 24 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, 293 /* 28 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, 294 /* 2c */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, 295 /* 30 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, 296 /* 34 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, 297 /* 38 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, 298 /* 3c */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, 299 /* 40 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, 300 /* 44 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, 301 /* 48 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, 302 /* 4c */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, 303 /* 50 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, 304 /* 54 */ KBD_NOKEY, KBD_NOKEY, KBD_F1, KBD_F2, 305 /* 58 */ KBD_F3, KBD_F4, KBD_F5, KBD_NOKEY, 306 /* 5c */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, 307 /* 60 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, 308 /* 64 */ KBD_F6, KBD_F7, KBD_F8, KBD_F9, 309 /* 68 */ KBD_F10, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, 310 /* 6c */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, 311 /* 70 */ KBD_NOKEY, KBD_F11, KBD_F12, KBD_F13, 312 /* 74 */ KBD_F14, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, 313 /* 78 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, 314 /* 7c */ KBD_HELP, KBD_DO, KBD_NOKEY, KBD_NOKEY, 315 /* 80 */ KBD_F17, KBD_F18, KBD_F19, KBD_F20, 316 /* 84 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, 317 /* 88 */ KBD_NOKEY, KBD_NOKEY, KBD_FIND, KBD_INSERT, 318 /* 8c */ KBD_REMOVE, KBD_SELECT, KBD_PREVIOUS, KBD_NEXT, 319 /* 90 */ KBD_NOKEY, KBD_NOKEY, '0', KBD_NOKEY, 320 /* 94 */ '.', KBD_KP_ENTER, '1', '2', 321 /* 98 */ '3', '4', '5', '6', 322 /* 9c */ ',', '7', '8', '9', 323 /* a0 */ '-', KBD_KP_F1, KBD_KP_F2, KBD_KP_F3, 324 /* a4 */ KBD_KP_F4, KBD_NOKEY, KBD_NOKEY, KBD_LEFT, 325 /* a8 */ KBD_RIGHT, KBD_DOWN, KBD_UP, KBD_NOKEY, 326 /* ac */ KBD_NOKEY, KBD_NOKEY, KBD_SHIFT, KBD_CONTROL, 327 /* b0 */ KBD_CAPSLOCK, KBD_ALTERNATE, KBD_NOKEY, KBD_NOKEY, 328 /* b4 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, 329 /* b8 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, 330 /* bc */ KBD_DEL, KBD_RET, KBD_TAB, '~', 331 /* c0 */ '!', 'q', 'a', 'z', 332 /* c4 */ KBD_NOKEY, '@', 'w', 's', 333 /* c8 */ 'x', '>', KBD_NOKEY, '#', 334 /* cc */ 'e', 'd', 'c', KBD_NOKEY, 335 /* d0 */ '$', 'r', 'f', 'v', 336 /* d4 */ ' ', KBD_NOKEY, '%', 't', 337 /* d8 */ 'g', 'b', KBD_NOKEY, '^', 338 /* dc */ 'y', 'h', 'n', KBD_NOKEY, 339 /* e0 */ '&', 'u', 'j', 'm', 340 /* e4 */ KBD_NOKEY, '*', 'i', 'k', 341 /* e8 */ '<', KBD_NOKEY, '(', 'o', 342 /* ec */ 'l', '>', KBD_NOKEY, ')', 343 /* f0 */ 'p', KBD_NOKEY, ':', '?', 344 /* f4 */ KBD_NOKEY, '+', '}', '|', 345 /* f8 */ KBD_NOKEY, '_', '{', '"', 346 /* fc */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, 347 }; 348 349 #endif /* LK201_H */ 350