|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. ! 3: * ! 4: * @APPLE_LICENSE_HEADER_START@ ! 5: * ! 6: * The contents of this file constitute Original Code as defined in and ! 7: * are subject to the Apple Public Source License Version 1.1 (the ! 8: * "License"). You may not use this file except in compliance with the ! 9: * License. Please obtain a copy of the License at ! 10: * http://www.apple.com/publicsource and read it before using this file. ! 11: * ! 12: * This Original Code and all software distributed under the License are ! 13: * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER ! 14: * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, ! 15: * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, ! 16: * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the ! 17: * License for the specific language governing rights and limitations ! 18: * under the License. ! 19: * ! 20: * @APPLE_LICENSE_HEADER_END@ ! 21: */ ! 22: /* ! 23: * @OSF_COPYRIGHT@ ! 24: */ ! 25: /* ! 26: * HISTORY ! 27: * ! 28: * Revision 1.1.1.1.12.1 1998/10/06 20:27:13 ehewitt ! 29: * Updated for framebuffer support. Added pexpert calls. ! 30: * ! 31: * Revision 1.1.1.1 1998/09/22 21:05:39 wsanchez ! 32: * Import of Mac OS X kernel (~semeria) ! 33: * ! 34: * Revision 1.1.1.1 1998/03/07 02:25:38 wsanchez ! 35: * Import of OSF Mach kernel (~mburg) ! 36: * ! 37: * Revision 1.1.22.1 1996/11/29 16:56:42 stephen ! 38: * nmklinux_1.0b3_shared into pmk1.1 ! 39: * Include mach/mach_ioctl.h instead of sys/ioctl.h and use the ! 40: * "MACH"-prefixed ioctl definitions. ! 41: * Include mach/time_value.h instead of sys/time.h and use the ! 42: * new time types. ! 43: * Replaced u_char, u_short and u_int types with real ones. ! 44: * [96/09/18 barbou] ! 45: * ! 46: * Revision 1.1.18.1 1996/09/17 16:33:38 bruel ! 47: * use standalone includes only ! 48: * [1996/09/17 15:27:38 bruel] ! 49: * ! 50: * Revision 1.1.6.5 1996/07/31 20:49:24 paire ! 51: * Merged with changes from 1.1.6.4 ! 52: * [1996/07/31 20:38:47 paire] ! 53: * ! 54: * Merged with changes from 1.1.6.4 ! 55: * [1996/07/31 14:58:21 paire] ! 56: * ! 57: * Revision 1.1.6.4 1996/07/31 13:23:35 paire ! 58: * Merged with nmk20b7_shared (1.1.11.1) ! 59: * [96/06/07 paire] ! 60: * ! 61: * Revision 1.1.11.1 1996/03/04 16:11:12 bernadat ! 62: * Changed mouse_rawbuf struct to keep same kd_event struct size. ! 63: * [96/02/22 bernadat] ! 64: * ! 65: * Revision 1.1.6.2 1996/02/19 13:35:33 bernadat ! 66: * Adapted to be exported to users (added some #ifdef MACH_KERNEL). ! 67: * Modified kd_event structure to allow raw (unprocessed) mouse events. ! 68: * [96/01/29 barbou] ! 69: * ! 70: * Revision 1.1.6.1 1994/09/23 01:42:33 ezf ! 71: * change marker to not FREE ! 72: * [1994/09/22 21:18:52 ezf] ! 73: * ! 74: * Revision 1.1.2.4 1993/08/09 19:38:22 dswartz ! 75: * Add ANSI prototypes - CR#9523 ! 76: * [1993/08/06 17:50:44 dswartz] ! 77: * ! 78: * Revision 1.1.2.3 1993/08/03 18:29:12 gm ! 79: * CR9596: Change KERNEL to MACH_KERNEL. ! 80: * [1993/08/02 16:04:31 gm] ! 81: * ! 82: * Revision 1.1.2.2 1993/06/02 23:20:30 jeffc ! 83: * Added to OSF/1 R1.3 from NMK15.0. ! 84: * [1993/06/02 21:02:41 jeffc] ! 85: * ! 86: * Revision 1.1 1992/09/30 02:27:08 robert ! 87: * Initial revision ! 88: * ! 89: * $EndLog$ ! 90: */ ! 91: /* CMU_HIST */ ! 92: /* ! 93: * Revision 2.7.9.1 92/02/18 18:55:07 jeffreyh ! 94: * Added two defines to detect if a PC Keyboard is present ! 95: * [91/06/25 bernadat] ! 96: * ! 97: * Revision 2.7 91/05/14 16:26:55 mrt ! 98: * Correcting copyright ! 99: * ! 100: * Revision 2.6 91/03/16 14:46:53 rpd ! 101: * Fixed ioctl definitions for ANSI C. ! 102: * [91/02/20 rpd] ! 103: * ! 104: * Revision 2.5 91/02/05 17:19:03 mrt ! 105: * Changed to new Mach copyright ! 106: * [91/02/01 17:45:28 mrt] ! 107: * ! 108: * Revision 2.4 90/11/26 14:50:27 rvb ! 109: * jsb bet me to XMK34, sigh ... ! 110: * [90/11/26 rvb] ! 111: * Synched 2.5 & 3.0 at I386q (r1.5.1.5) & XMK35 (r2.4) ! 112: * [90/11/15 rvb] ! 113: * ! 114: * Revision 1.5.1.4 90/06/07 08:05:44 rvb ! 115: * Move CURRENT_COLUMN here. ! 116: * [90/06/06 rvb] ! 117: * ! 118: * Revision 2.3 90/08/09 16:32:09 rpd ! 119: * Added kdb/X support from rvb. ! 120: * [90/08/09 rpd] ! 121: * ! 122: * Revision 1.5.1.3 90/05/14 13:21:26 rvb ! 123: * Support for entering kdb from X; ! 124: * [90/04/30 rvb] ! 125: * ! 126: * Revision 2.2 90/05/03 15:44:47 dbg ! 127: * First checkin. ! 128: * ! 129: * Revision 1.5.1.2 90/02/28 15:50:17 rvb ! 130: * Fix numerous typo's in Olivetti disclaimer. ! 131: * [90/02/28 rvb] ! 132: * ! 133: * Revision 1.5.1.1 90/01/08 13:30:59 rvb ! 134: * Add Olivetti copyright. ! 135: * [90/01/08 rvb] ! 136: * ! 137: * Revision 1.5 89/07/17 10:41:10 rvb ! 138: * Olivetti Changes to X79 upto 5/9/89: ! 139: * [89/07/11 rvb] ! 140: * ! 141: * Revision 1.6 89/07/07 16:24:24 kupfer ! 142: * X79 merge, 2nd attempt ! 143: * ! 144: * Revision 1.4.1.1 89/04/27 12:20:58 kupfer ! 145: * Merge X79 with our latest and greatest. ! 146: * ! 147: * Revision 1.1.1.1 89/04/27 11:53:41 kupfer ! 148: * X79 from CMU. ! 149: * ! 150: * Revision 1.4 89/03/09 20:06:33 rpd ! 151: * More cleanup. ! 152: * ! 153: * Revision 1.3 89/02/26 12:37:13 gm0w ! 154: * Changes for cleanup. ! 155: * ! 156: */ ! 157: /* CMU_ENDHIST */ ! 158: /* ! 159: * Mach Operating System ! 160: * Copyright (c) 1991,1990,1989 Carnegie Mellon University ! 161: * All Rights Reserved. ! 162: * ! 163: * Permission to use, copy, modify and distribute this software and its ! 164: * documentation is hereby granted, provided that both the copyright ! 165: * notice and this permission notice appear in all copies of the ! 166: * software, derivative works or modified versions, and any portions ! 167: * thereof, and that both notices appear in supporting documentation. ! 168: * ! 169: * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" ! 170: * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR ! 171: * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. ! 172: * ! 173: * Carnegie Mellon requests users of this software to return to ! 174: * ! 175: * Software Distribution Coordinator or [email protected] ! 176: * School of Computer Science ! 177: * Carnegie Mellon University ! 178: * Pittsburgh PA 15213-3890 ! 179: * ! 180: * any improvements or extensions that they make and grant Carnegie Mellon ! 181: * the rights to redistribute these changes. ! 182: */ ! 183: /* ! 184: */ ! 185: ! 186: /* ! 187: * File: kd.h ! 188: * Description: definitions for AT keyboard/display driver ! 189: * Authors: Eugene Kuerner, Adrienne Jardetzky, Mike Kupfer ! 190: * ! 191: * $ Header: $ ! 192: * ! 193: * Copyright Ing. C. Olivetti & C. S.p.A. 1988, 1989. ! 194: * All rights reserved. ! 195: * ! 196: * Copyright 1988, 1989 by Olivetti Advanced Technology Center, Inc., ! 197: * Cupertino, California. ! 198: * ! 199: * All Rights Reserved ! 200: * ! 201: * Permission to use, copy, modify, and distribute this software and ! 202: * its documentation for any purpose and without fee is hereby ! 203: * granted, provided that the above copyright notice appears in all ! 204: * copies and that both the copyright notice and this permission notice ! 205: * appear in supporting documentation, and that the name of Olivetti ! 206: * not be used in advertising or publicity pertaining to distribution ! 207: * of the software without specific, written prior permission. ! 208: * ! 209: * OLIVETTI DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE ! 210: * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, ! 211: * IN NO EVENT SHALL OLIVETTI BE LIABLE FOR ANY SPECIAL, INDIRECT, OR ! 212: * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM ! 213: * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, ! 214: * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUR OF OR IN CONNECTION ! 215: * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ! 216: */ ! 217: ! 218: /* ! 219: * This file contains defines and structures that implement hardware ! 220: * keyboard mapping into ansi defined output codes. Note that this ! 221: * is structured so that "re-mapping" of actual keys is allowed at ! 222: * anytime during execution of the console driver. And each scan code ! 223: * is potentially expanded into NUMKEYS characters. Which is programmable ! 224: * at runtime or whenever. ! 225: * ! 226: * 02 Nov 1988 orc!eugene ! 227: * ! 228: */ ! 229: ! 230: #ifndef _MACHINE_KD_H_ ! 231: #define _MACHINE_KD_H_ ! 232: ! 233: #include <mach/boolean.h> ! 234: #include <mach/time_value.h> ! 235: ! 236: ! 237: /* ! 238: * Where memory for various graphics adapters starts. ! 239: */ ! 240: #define EGA_START 0x0b8000 ! 241: #define CGA_START 0x0b8000 ! 242: #define MONO_START 0x0b0000 ! 243: ! 244: /* ! 245: * Common I/O ports. ! 246: */ ! 247: #define K_TMR0 0x40 /* timer 0, 1, or 2 value (r/w) */ ! 248: #define K_TMR1 0x41 ! 249: #define K_TMR2 0x42 ! 250: #define K_TMRCTL 0x43 /* timer control (write-only) */ ! 251: #define K_RDWR 0x60 /* keyboard data & cmds (read/write) */ ! 252: #define K_PORTB 0x61 /* r/w. speaker & status lines */ ! 253: #define K_STATUS 0x64 /* keybd status (read-only) */ ! 254: #define K_CMD 0x64 /* keybd ctlr command (write-only) */ ! 255: ! 256: /* ! 257: * I/O ports for various graphics adapters. ! 258: */ ! 259: #define EGA_IDX_REG 0x3d4 ! 260: #define EGA_IO_REG 0x3d5 ! 261: #define CGA_IDX_REG 0x3d4 ! 262: #define CGA_IO_REG 0x3d5 ! 263: #define MONO_IDX_REG 0x3b4 ! 264: #define MONO_IO_REG 0x3b5 ! 265: ! 266: /* ! 267: * Commands sent to graphics adapter. ! 268: */ ! 269: #define C_LOW 0x0f /* return low byte of cursor addr */ ! 270: #define C_HIGH 0x0e /* high byte */ ! 271: ! 272: /* ! 273: * Bit definitions for K_STATUS port. ! 274: */ ! 275: #define K_OBUF_FUL 0x01 /* output (from keybd) buffer full */ ! 276: #define K_IBUF_FUL 0x02 /* input (to keybd) buffer full */ ! 277: #define K_SYSFLAG 0x04 /* "System Flag" */ ! 278: #define K_CMD_DATA 0x08 /* 1 = input buf has cmd, 0 = data */ ! 279: #define K_KBD_INHBT 0x10 /* 0 if keyboard inhibited */ ! 280: #define K_XMT_TIMEOUT 0x20 /* Transmit time out */ ! 281: #define K_RCV_TIMEOUT 0x40 /* Receive time out */ ! 282: ! 283: /* ! 284: * Keyboard controller commands (sent to K_CMD port). ! 285: */ ! 286: #define KC_CMD_READ 0x20 /* read controller command byte */ ! 287: #define KC_CMD_WRITE 0x60 /* write controller command byte */ ! 288: #define KC_CMD_TEST 0xab /* test interface */ ! 289: #define KC_CMD_DUMP 0xac /* diagnostic dump */ ! 290: #define KC_CMD_DISBLE 0xad /* disable keyboard */ ! 291: #define KC_CMD_ENBLE 0xae /* enable keyboard */ ! 292: #define KC_CMD_RDKBD 0xc4 /* read keyboard ID */ ! 293: #define KC_CMD_ECHO 0xee /* used for diagnostic testing */ ! 294: ! 295: /* ! 296: * Keyboard commands (send to K_RDWR). ! 297: */ ! 298: #define K_CMD_LEDS 0xed /* set status LEDs (caps lock, etc.) */ ! 299: ! 300: /* ! 301: * Bit definitions for controller command byte (sent following ! 302: * K_CMD_WRITE command). ! 303: */ ! 304: #define K_CB_ENBLIRQ 0x01 /* enable data-ready intrpt */ ! 305: #define K_CB_SETSYSF 0x04 /* Set System Flag */ ! 306: #define K_CB_INHBOVR 0x08 /* Inhibit Override */ ! 307: #define K_CB_DISBLE 0x10 /* disable keyboard */ ! 308: ! 309: /* ! 310: * Bit definitions for "Indicator Status Byte" (sent after a ! 311: * K_CMD_LEDS command). If the bit is on, the LED is on. Undefined ! 312: * bit positions must be 0. ! 313: */ ! 314: #define K_LED_SCRLLK 0x1 /* scroll lock */ ! 315: #define K_LED_NUMLK 0x2 /* num lock */ ! 316: #define K_LED_CAPSLK 0x4 /* caps lock */ ! 317: ! 318: /* ! 319: * Bit definitions for "Miscellaneous port B" (K_PORTB). ! 320: */ ! 321: /* read/write */ ! 322: #define K_ENABLETMR2 0x01 /* enable output from timer 2 */ ! 323: #define K_SPKRDATA 0x02 /* direct input to speaker */ ! 324: #define K_ENABLEPRTB 0x04 /* "enable" port B */ ! 325: #define K_EIOPRTB 0x08 /* enable NMI on parity error */ ! 326: /* read-only */ ! 327: #define K_REFRESHB 0x10 /* refresh flag from INLTCONT PAL */ ! 328: #define K_OUT2B 0x20 /* timer 2 output */ ! 329: #define K_ICKB 0x40 /* I/O channel check (parity error) */ ! 330: ! 331: /* ! 332: * Bit definitions for timer control port (K_TMRCTL). ! 333: */ ! 334: /* select timer 0, 1, or 2. Don't mess with 0 or 1. */ ! 335: #define K_SELTMRMASK 0xc0 ! 336: #define K_SELTMR0 0x00 ! 337: #define K_SELTMR1 0x40 ! 338: #define K_SELTMR2 0x80 ! 339: ! 340: /* read/load control */ ! 341: #define K_RDLDTMRMASK 0x30 ! 342: #define K_HOLDTMR 0x00 /* freeze timer until read */ ! 343: #define K_RDLDTLSB 0x10 /* read/load LSB */ ! 344: #define K_RDLDTMSB 0x20 /* read/load MSB */ ! 345: #define K_RDLDTWORD 0x30 /* read/load LSB then MSB */ ! 346: ! 347: /* mode control */ ! 348: #define K_TMDCTLMASK 0x0e ! 349: #define K_TCOUNTINTR 0x00 /* "Term Count Intr" */ ! 350: #define K_TONESHOT 0x02 /* "Progr One-Shot" */ ! 351: #define K_TRATEGEN 0x04 /* "Rate Gen (/n)" */ ! 352: #define K_TSQRWAVE 0x06 /* "Sqr Wave Gen" */ ! 353: #define K_TSOFTSTRB 0x08 /* "Softw Trig Strob" */ ! 354: #define K_THARDSTRB 0x0a /* "Hardw Trig Strob" */ ! 355: ! 356: /* count mode */ ! 357: #define K_TCNTMDMASK 0x01 ! 358: #define K_TBINARY 0x00 /* 16-bit binary counter */ ! 359: #define K_TBCD 0x01 /* 4-decade BCD counter */ ! 360: ! 361: ! 362: ! 363: /* ! 364: * Fun definitions for displayed characters and characters read from ! 365: * the keyboard. ! 366: */ ! 367: ! 368: /* ! 369: * Attributes for character sent to display. ! 370: */ ! 371: #define KA_NORMAL 0x07 ! 372: #define KA_REVERSE 0x70 ! 373: ! 374: /* ! 375: * For an EGA-like display, each character takes two bytes, one for the ! 376: * actual character, followed by one for its attributes. ! 377: * Be very careful if you change ONE_SPACE, as these constants are also used ! 378: * to define the device-independent display implemented by kd.c. ! 379: * (See kdsoft.h for more details on the device-independent display.) ! 380: */ ! 381: #define ONE_SPACE 2 /* bytes in 1 char, EGA-like display */ ! 382: #define ONE_LINE (kd_cols * ONE_SPACE) /* 160 number of bytes in line */ ! 383: #define ONE_PAGE (kd_lines * ONE_LINE) /* 4000 number of bytes in page */ ! 384: #define BOTTOM_LINE ((kd_lines - 1) * ONE_LINE) /* 3840 1st byte in last line of display */ ! 385: ! 386: #define BEG_OF_LINE(pos) ((pos) - (pos)%ONE_LINE) ! 387: #define CURRENT_COLUMN(pos) (((pos) % ONE_LINE) / ONE_SPACE) ! 388: ! 389: #define NUMKEYS 89 ! 390: #define NUMSTATES 5 /* NORMAL_STATE, ... */ ! 391: #define NUMOUTPUT 3 /* max size of byte seq from key */ ! 392: #define WIDTH_KMAP (NUMSTATES * NUMOUTPUT) ! 393: ! 394: /* ! 395: * Keyboard states. Used for KDGKBENT, KDSKBENT ioctl's. If you ! 396: * change these values, you should also rearrange the entries in ! 397: * key_map. ! 398: */ ! 399: /* "state indices" (for computing key_map index) */ ! 400: #define NORM_STATE 0 ! 401: #define SHIFT_STATE 1 ! 402: #define CTRL_STATE 2 ! 403: #define ALT_STATE 3 ! 404: #define SHIFT_ALT 4 ! 405: /* macro to convert from state index to actual key_map index */ ! 406: #define CHARIDX(sidx) ((sidx) * NUMOUTPUT) ! 407: /* where sidx is in [NORM_STATE ... SHIFT_ALT] */ ! 408: ! 409: /* "state bits" for kd_state vector */ ! 410: #define KS_NORMAL 0x00 ! 411: #define KS_SLKED 0x01 ! 412: #define KS_NLKED 0x02 ! 413: #define KS_CLKED 0x04 ! 414: #define KS_ALTED 0x08 ! 415: #define KS_SHIFTED 0x10 ! 416: #define KS_CTLED 0x20 ! 417: ! 418: ! 419: /* ! 420: * Scancode values, not to be confused with Ascii values. ! 421: */ ! 422: typedef unsigned char Scancode; ! 423: ! 424: /* special codes */ ! 425: #define K_UP 0x80 /* OR'd in if key below is released */ ! 426: #define K_EXTEND 0xe0 /* marker for "extended" sequence */ ! 427: #define K_ACKSC 0xfa /* ack for keyboard command */ ! 428: #define K_RESEND 0xfe /* request to resend keybd cmd */ ! 429: ! 430: /* modifier keys */ ! 431: #define K_CTLSC 0x1d /* control down */ ! 432: #define K_LSHSC 0x2a /* left shift down */ ! 433: #define K_RSHSC 0x36 /* right shift down */ ! 434: #define K_ALTSC 0x38 /* alt key down */ ! 435: #define K_CLCKSC 0x3a /* caps lock */ ! 436: #define K_NLCKSC 0x45 /* num lock down */ ! 437: ! 438: /* "special keys" */ ! 439: #define K_BSSC 0x0e /* backspace */ ! 440: #define K_TABSC 0x0f /* tab */ ! 441: #define K_RETSC 0x1c /* return */ ! 442: #define K_SPSC 0x39 /* space */ ! 443: #define K_ESCSC 0x01 /* ESC */ ! 444: ! 445: /* alphabetic keys */ ! 446: #define K_qSC 0x10 ! 447: #define K_wSC 0x11 ! 448: #define K_eSC 0x12 ! 449: #define K_rSC 0x13 ! 450: #define K_tSC 0x14 ! 451: #define K_ySC 0x15 ! 452: #define K_uSC 0x16 ! 453: #define K_iSC 0x17 ! 454: #define K_oSC 0x18 ! 455: #define K_pSC 0x19 ! 456: ! 457: #define K_aSC 0x1e ! 458: #define K_sSC 0x1f ! 459: #define K_dSC 0x20 ! 460: #define K_fSC 0x21 ! 461: #define K_gSC 0x22 ! 462: #define K_hSC 0x23 ! 463: #define K_jSC 0x24 ! 464: #define K_kSC 0x25 ! 465: #define K_lSC 0x26 ! 466: ! 467: #define K_zSC 0x2c ! 468: #define K_xSC 0x2d ! 469: #define K_cSC 0x2e ! 470: #define K_vSC 0x2f ! 471: #define K_bSC 0x30 ! 472: #define K_nSC 0x31 ! 473: #define K_mSC 0x32 ! 474: ! 475: /* numbers and punctuation */ ! 476: #define K_ONESC 0x02 /* 1 */ ! 477: #define K_TWOSC 0x03 /* 2 */ ! 478: #define K_THREESC 0x04 /* 3 */ ! 479: #define K_FOURSC 0x05 /* 4 */ ! 480: #define K_FIVESC 0x06 /* 5 */ ! 481: #define K_SIXSC 0x07 /* 6 */ ! 482: #define K_SEVENSC 0x08 /* 7 */ ! 483: #define K_EIGHTSC 0x09 /* 8 */ ! 484: #define K_NINESC 0x0a /* 9 */ ! 485: #define K_ZEROSC 0x0b /* 0 */ ! 486: ! 487: #define K_MINUSSC 0x0c /* - */ ! 488: #define K_EQLSC 0x0d /* = */ ! 489: #define K_LBRKTSC 0x1a /* [ */ ! 490: #define K_RBRKTSC 0x1b /* ] */ ! 491: #define K_SEMISC 0x27 /* ; */ ! 492: #define K_SQUOTESC 0x28 /* ' */ ! 493: #define K_GRAVSC 0x29 /* ` */ ! 494: #define K_BSLSHSC 0x2b /* \ */ ! 495: #define K_COMMASC 0x33 /* , */ ! 496: #define K_PERIODSC 0x34 /* . */ ! 497: #define K_SLASHSC 0x35 /* / */ ! 498: ! 499: /* keypad keys */ ! 500: #define K_HOMESC 0x47 /* scancode for home */ ! 501: #define K_DELSC 0x53 /* scancode for del */ ! 502: ! 503: /* ! 504: * Ascii values and flag characters for key map. ! 505: * A function key is represented by the 3-byte char sequence that it ! 506: * corresponds to. ! 507: * Other mappable non-Ascii keys (e.g., "ctrl") are represented by a ! 508: * two-byte sequence: K_SCAN, followed by the key's scan code. ! 509: */ ! 510: #define K_DONE 0xff /* must be same as NC */ ! 511: #define NC 0xff /* No character defined */ ! 512: ! 513: #define K_SCAN 0xfe /* followed by scan code */ ! 514: ! 515: /* ascii char set */ ! 516: #define K_NUL 0x00 /* Null character */ ! 517: #define K_SOH 0x01 ! 518: #define K_STX 0x02 ! 519: #define K_ETX 0x03 ! 520: #define K_EOT 0x04 ! 521: #define K_ENQ 0x05 ! 522: #define K_ACK 0x06 ! 523: #define K_BEL 0x07 /* bell character */ ! 524: #define K_BS 0x08 /* back space */ ! 525: #define K_HT 0x09 ! 526: #define K_LF 0x0a /* line feed */ ! 527: #define K_VT 0x0b ! 528: #define K_FF 0x0c ! 529: #define K_CR 0x0d /* carriage return */ ! 530: #define K_SO 0x0e ! 531: #define K_SI 0x0f ! 532: #define K_DLE 0x10 ! 533: #define K_DC1 0x11 ! 534: #define K_DC2 0x12 ! 535: #define K_DC3 0x13 ! 536: #define K_DC4 0x14 ! 537: #define K_NAK 0x15 ! 538: #define K_SYN 0x16 ! 539: #define K_ETB 0x17 ! 540: #define K_CAN 0x18 ! 541: #define K_EM 0x19 ! 542: #define K_SUB 0x1a ! 543: #define K_ESC 0x1b /* escape character */ ! 544: #define K_FS 0x1c ! 545: #define K_GS 0x1d ! 546: #define K_RS 0x1e ! 547: #define K_US 0x1f ! 548: #define K_SPACE 0x20 /* space character */ ! 549: #define K_BANG 0x21 /* ! */ ! 550: #define K_DQUOTE 0x22 /* " */ ! 551: #define K_POUND 0x23 /* # */ ! 552: #define K_DOLLAR 0x24 /* $ */ ! 553: #define K_PERC 0x25 /* % */ ! 554: #define K_AMPER 0x26 /* & */ ! 555: #define K_SQUOTE 0x27 /* ' */ ! 556: #define K_LPAREN 0x28 /* ( */ ! 557: #define K_RPAREN 0x29 /* ) */ ! 558: #define K_ASTER 0x2a /* * */ ! 559: #define K_PLUS 0x2b /* + */ ! 560: #define K_COMMA 0x2c /* , */ ! 561: #define K_MINUS 0x2d /* - */ ! 562: #define K_PERIOD 0x2e /* . */ ! 563: #define K_SLASH 0x2f /* / */ ! 564: #define K_ZERO 0x30 /* 0 */ ! 565: #define K_ONE 0x31 /* 1 */ ! 566: #define K_TWO 0x32 /* 2 */ ! 567: #define K_THREE 0x33 /* 3 */ ! 568: #define K_FOUR 0x34 /* 4 */ ! 569: #define K_FIVE 0x35 /* 5 */ ! 570: #define K_SIX 0x36 /* 6 */ ! 571: #define K_SEVEN 0x37 /* 7 */ ! 572: #define K_EIGHT 0x38 /* 8 */ ! 573: #define K_NINE 0x39 /* 9 */ ! 574: #define K_COLON 0x3a /* : */ ! 575: #define K_SEMI 0x3b /* ; */ ! 576: #define K_LTHN 0x3c /* < */ ! 577: #define K_EQL 0x3d /* = */ ! 578: #define K_GTHN 0x3e /* > */ ! 579: #define K_QUES 0x3f /* ? */ ! 580: #define K_ATSN 0x40 /* @ */ ! 581: #define K_A 0x41 /* A */ ! 582: #define K_B 0x42 /* B */ ! 583: #define K_C 0x43 /* C */ ! 584: #define K_D 0x44 /* D */ ! 585: #define K_E 0x45 /* E */ ! 586: #define K_F 0x46 /* F */ ! 587: #define K_G 0x47 /* G */ ! 588: #define K_H 0x48 /* H */ ! 589: #define K_I 0x49 /* I */ ! 590: #define K_J 0x4a /* J */ ! 591: #define K_K 0x4b /* K */ ! 592: #define K_L 0x4c /* L */ ! 593: #define K_M 0x4d /* M */ ! 594: #define K_N 0x4e /* N */ ! 595: #define K_O 0x4f /* O */ ! 596: #define K_P 0x50 /* P */ ! 597: #define K_Q 0x51 /* Q */ ! 598: #define K_R 0x52 /* R */ ! 599: #define K_S 0x53 /* S */ ! 600: #define K_T 0x54 /* T */ ! 601: #define K_U 0x55 /* U */ ! 602: #define K_V 0x56 /* V */ ! 603: #define K_W 0x57 /* W */ ! 604: #define K_X 0x58 /* X */ ! 605: #define K_Y 0x59 /* Y */ ! 606: #define K_Z 0x5a /* Z */ ! 607: #define K_LBRKT 0x5b /* [ */ ! 608: #define K_BSLSH 0x5c /* \ */ ! 609: #define K_RBRKT 0x5d /* ] */ ! 610: #define K_CARET 0x5e /* ^ */ ! 611: #define K_UNDSC 0x5f /* _ */ ! 612: #define K_GRAV 0x60 /* ` */ ! 613: #define K_a 0x61 /* a */ ! 614: #define K_b 0x62 /* b */ ! 615: #define K_c 0x63 /* c */ ! 616: #define K_d 0x64 /* d */ ! 617: #define K_e 0x65 /* e */ ! 618: #define K_f 0x66 /* f */ ! 619: #define K_g 0x67 /* g */ ! 620: #define K_h 0x68 /* h */ ! 621: #define K_i 0x69 /* i */ ! 622: #define K_j 0x6a /* j */ ! 623: #define K_k 0x6b /* k */ ! 624: #define K_l 0x6c /* l */ ! 625: #define K_m 0x6d /* m */ ! 626: #define K_n 0x6e /* n */ ! 627: #define K_o 0x6f /* o */ ! 628: #define K_p 0x70 /* p */ ! 629: #define K_q 0x71 /* q */ ! 630: #define K_r 0x72 /* r */ ! 631: #define K_s 0x73 /* s */ ! 632: #define K_t 0x74 /* t */ ! 633: #define K_u 0x75 /* u */ ! 634: #define K_v 0x76 /* v */ ! 635: #define K_w 0x77 /* w */ ! 636: #define K_x 0x78 /* x */ ! 637: #define K_y 0x79 /* y */ ! 638: #define K_z 0x7a /* z */ ! 639: #define K_LBRACE 0x7b /* { */ ! 640: #define K_PIPE 0x7c /* | */ ! 641: #define K_RBRACE 0x7d /* } */ ! 642: #define K_TILDE 0x7e /* ~ */ ! 643: #define K_DEL 0x7f /* delete */ ! 644: ! 645: /* Ascii sequences to be generated by the named key */ ! 646: #define K_F1 0x1b,0x4f,0x50 ! 647: #define K_F1S 0x1b,0x4f,0x70 ! 648: #define K_F2 0x1b,0x4f,0x51 ! 649: #define K_F2S 0x1b,0x4f,0x71 ! 650: #define K_F3 0x1b,0x4f,0x52 ! 651: #define K_F3S 0x1b,0x4f,0x72 ! 652: #define K_F4 0x1b,0x4f,0x53 ! 653: #define K_F4S 0x1b,0x4f,0x73 ! 654: #define K_F5 0x1b,0x4f,0x54 ! 655: #define K_F5S 0x1b,0x4f,0x74 ! 656: #define K_F6 0x1b,0x4f,0x55 ! 657: #define K_F6S 0x1b,0x4f,0x75 ! 658: #define K_F7 0x1b,0x4f,0x56 ! 659: #define K_F7S 0x1b,0x4f,0x76 ! 660: #define K_F8 0x1b,0x4f,0x57 ! 661: #define K_F8S 0x1b,0x4f,0x77 ! 662: #define K_F9 0x1b,0x4f,0x58 ! 663: #define K_F9S 0x1b,0x4f,0x78 ! 664: #define K_F10 0x1b,0x4f,0x59 ! 665: #define K_F10S 0x1b,0x4f,0x79 ! 666: #define K_F11 0x1b,0x4f,0x5a ! 667: #define K_F11S 0x1b,0x4f,0x7a ! 668: #define K_F12 0x1b,0x4f,0x41 ! 669: #define K_F12S 0x1b,0x4f,0x61 ! 670: ! 671: #define K_SCRL 0x1b,0x5b,0x4d ! 672: #define K_HOME 0x1b,0x5b,0x48 ! 673: #define K_UA 0x1b,0x5b,0x41 ! 674: #define K_PUP 0x1b,0x5b,0x56 ! 675: #define K_LA 0x1b,0x5b,0x44 ! 676: #define K_RA 0x1b,0x5b,0x43 ! 677: #define K_END 0x1b,0x5b,0x59 ! 678: #define K_DA 0x1b,0x5b,0x42 ! 679: #define K_PDN 0x1b,0x5b,0x55 ! 680: #define K_INS 0x1b,0x5b,0x40 ! 681: ! 682: ! 683: /* ! 684: * This array maps scancodes to Ascii characters (or character ! 685: * sequences). ! 686: * The first index is the scancode. The first NUMOUTPUT characters ! 687: * (accessed using the second index) correspond to the key's char ! 688: * sequence for the Normal state. The next NUMOUTPUT characters ! 689: * are for the Shift state, then Ctrl, then Alt, then Shift/Alt. ! 690: */ ! 691: extern unsigned char key_map[NUMKEYS][WIDTH_KMAP]; ! 692: ! 693: ! 694: ! 695: /* ! 696: * These routines are declared here so that all the modules making ! 697: * up the kd driver agree on how to do locking. ! 698: */ ! 699: ! 700: #define SPLKD spltty ! 701: ! 702: ! 703: /* ! 704: * Ioctl's on /dev/console. ! 705: */ ! 706: ! 707: /* ! 708: * KDGKBENT, KDSKBENT - Get and set keyboard table entry. Useful for ! 709: * remapping keys. ! 710: * ! 711: * KDGSTATE - Get the keyboard state variable, which flags the ! 712: * modifier keys (shift, ctrl, etc.) that are down. See ! 713: * KS_NORMAL et al above. Used for debugging. ! 714: * ! 715: * KDSETBELL - Turns the bell on or off. ! 716: */ ! 717: ! 718: #define KDGKBENT _MACH_IOWR('k', 1, struct kbentry) /* get keybd entry */ ! 719: ! 720: #define KDSKBENT _MACH_IOW('k', 2, struct kbentry) /* set keybd entry */ ! 721: ! 722: #define KDGSTATE _MACH_IOR('k', 3, int) /* get keybd state */ ! 723: ! 724: #define KDSETBELL _MACH_IOW('k', 4, int) /* turn bell on or off */ ! 725: # define KD_BELLON 1 ! 726: # define KD_BELLOFF 0 ! 727: ! 728: /* ! 729: * This struct is used for getting and setting key definitions. The ! 730: * values for kb_index are obtainable from the man page for ! 731: * keyboard(7) (though they should really be defined here!). ! 732: */ ! 733: struct kbentry { ! 734: unsigned char kb_state; /* which state to use */ ! 735: unsigned char kb_index; /* which keycode */ ! 736: unsigned char kb_value[NUMOUTPUT]; /* value to get/set */ ! 737: }; ! 738: ! 739: ! 740: /* ! 741: * Ioctl's on /dev/kbd. ! 742: */ ! 743: ! 744: /* ! 745: * KDSKBDMODE - When the console is in "ascii" mode, keyboard events are ! 746: * converted to Ascii characters that are readable from /dev/console. ! 747: * When the console is in "event" mode, keyboard events are ! 748: * timestamped and queued up on /dev/kbd as kd_events. When the last ! 749: * close is done on /dev/kbd, the console automatically reverts to ascii ! 750: * mode. ! 751: * When /dev/mouse is opened, mouse events are timestamped and queued ! 752: * on /dev/mouse, again as kd_events. ! 753: * ! 754: * KDGKBDTYPE - Returns the type of keyboard installed. Currently ! 755: * there is only one type, KB_VANILLAKB, which is your standard PC-AT ! 756: * keyboard. ! 757: */ ! 758: ! 759: extern int kb_mode; ! 760: ! 761: #define KDSKBDMODE _MACH_IOW('K', 1, int) /* set keyboard mode */ ! 762: #define KB_EVENT 1 ! 763: #define KB_ASCII 2 ! 764: ! 765: #define KDGKBDTYPE _MACH_IOR('K', 2, int) /* get keyboard type */ ! 766: #define KB_VANILLAKB 0 ! 767: ! 768: struct X_kdb { ! 769: unsigned int *ptr; ! 770: unsigned int size; ! 771: }; ! 772: ! 773: #define K_X_KDB_ENTER _MACH_IOW('K', 16, struct X_kdb) ! 774: #define K_X_KDB_EXIT _MACH_IOW('K', 17, struct X_kdb) ! 775: ! 776: #define K_X_IN 0x01000000 ! 777: #define K_X_OUT 0x02000000 ! 778: #define K_X_BYTE 0x00010000 ! 779: #define K_X_WORD 0x00020000 ! 780: #define K_X_LONG 0x00040000 ! 781: #define K_X_TYPE 0x03070000 ! 782: #define K_X_PORT 0x0000ffff ! 783: ! 784: ! 785: typedef unsigned short kev_type; /* kd event type */ ! 786: ! 787: /* (used for event records) */ ! 788: struct mouse_motion { ! 789: short mm_deltaX; /* units? */ ! 790: short mm_deltaY; ! 791: }; ! 792: ! 793: #define MOUSEBUFSIZE 5 /* num bytes def'd by protocol */ ! 794: ! 795: struct mouse_rawbuf { ! 796: unsigned char mr_bufsize; ! 797: unsigned char mr_buf[1]; ! 798: }; ! 799: ! 800: typedef struct { ! 801: kev_type type; /* see below */ ! 802: struct time_value time; /* timestamp */ ! 803: union { /* value associated with event */ ! 804: boolean_t up; /* MOUSE_LEFT .. MOUSE_RIGHT */ ! 805: Scancode sc; /* KEYBD_EVENT */ ! 806: struct mouse_motion mmotion; /* MOUSE_MOTION */ ! 807: struct mouse_rawbuf mrawbuf; /* MOUSE_RAW */ ! 808: } value; ! 809: } kd_event; ! 810: ! 811: #define m_deltaX mmotion.mm_deltaX ! 812: #define m_deltaY mmotion.mm_deltaY ! 813: #define r_buf mrawbuf.mr_buf ! 814: #define r_bufsize mrawbuf.mr_bufsize ! 815: ! 816: /* ! 817: * kd_event ID's. ! 818: */ ! 819: #define MOUSE_LEFT 1 /* mouse left button up/down */ ! 820: #define MOUSE_MIDDLE 2 ! 821: #define MOUSE_RIGHT 3 ! 822: #define MOUSE_MOTION 4 /* mouse motion */ ! 823: #define KEYBD_EVENT 5 /* key up/down */ ! 824: ! 825: /* CMOS Info */ ! 826: ! 827: #define CMOS_ADDR 0x70 /* port for CMOS ram address */ ! 828: #define CMOS_DATA 0x71 /* port for CMOS ram data */ ! 829: ! 830: ! 831: /* Addresses, related masks, and potential results */ ! 832: ! 833: #define CMOS_EB 0x14 /* read Equipment Byte */ ! 834: #define CM_SCRMSK 0x30 /* mask for EB query to get screen */ ! 835: #define CM_EGA_VGA 0x00 /* "not CGA or MONO" */ ! 836: #define CM_CGA_40 0x10 ! 837: #define CM_CGA_80 0x20 ! 838: #define CM_MONO_80 0x30 ! 839: ! 840: ! 841: #endif /* _MACHINE_KD_H_ */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.