Annotation of Gnu-Mach/i386/i386at/kd.h, revision 1.1.1.3

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

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.