Annotation of 43BSDReno/sys/hpstand/hil.c, revision 1.1

1.1     ! root        1: /*
        !             2:  * Copyright (c) 1988 University of Utah.
        !             3:  * Copyright (c) 1990 The Regents of the University of California.
        !             4:  * All rights reserved.
        !             5:  *
        !             6:  * This code is derived from software contributed to Berkeley by
        !             7:  * the Systems Programming Group of the University of Utah Computer
        !             8:  * Science Department.
        !             9:  *
        !            10:  * Redistribution is only permitted until one year after the first shipment
        !            11:  * of 4.4BSD by the Regents.  Otherwise, redistribution and use in source and
        !            12:  * binary forms are permitted provided that: (1) source distributions retain
        !            13:  * this entire copyright notice and comment, and (2) distributions including
        !            14:  * binaries display the following acknowledgement:  This product includes
        !            15:  * software developed by the University of California, Berkeley and its
        !            16:  * contributors'' in the documentation or other materials provided with the
        !            17:  * distribution and in all advertising materials mentioning features or use
        !            18:  * of this software.  Neither the name of the University nor the names of
        !            19:  * its contributors may be used to endorse or promote products derived from
        !            20:  * this software without specific prior written permission.
        !            21:  * THIS SOFTWARE IS PROVIDED AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
        !            22:  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
        !            23:  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
        !            24:  *
        !            25:  * from: Utah $Hdr: hil.c 1.1 89/08/22$
        !            26:  *
        !            27:  *     @(#)hil.c       7.1 (Berkeley) 5/8/90
        !            28:  */
        !            29: 
        !            30: /*
        !            31:  * Keyboard routines for the standalone ITE.
        !            32:  */
        !            33: #include "samachdep.h"
        !            34: 
        !            35: #ifdef ITECONSOLE
        !            36: 
        !            37: #include "param.h"
        !            38: #include "../hpdev/hilreg.h"
        !            39: #include "../hpdev/kbdmap.h"
        !            40: #include "../hpdev/itevar.h"
        !            41: 
        !            42: #ifndef SMALL
        !            43: 
        !            44: /*
        !            45:  * HIL cooked keyboard keymaps.
        !            46:  * Supports only unshifted, shifted and control keys.
        !            47:  */
        !            48: char   us_keymap[] = {
        !            49:        NULL,   '`',    '\\',   ESC,    NULL,   DEL,    NULL,   NULL,  
        !            50:        '\n',   '\t',   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,  
        !            51:        NULL,   '\n',   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,  
        !            52:        NULL,   '\t',   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,
        !            53:        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,
        !            54:        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   '\b',   NULL,
        !            55:        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,
        !            56:        ESC,    '\r',   NULL,   '\n',   '0',    '.',    ',',    '+',
        !            57:        '1',    '2',    '3',    '-',    '4',    '5',    '6',    '*',
        !            58:        '7',    '8',    '9',    '/',    'E',    '(',    ')',    '^',
        !            59:        '1',    '2',    '3',    '4',    '5',    '6',    '7',    '8',
        !            60:        '9',    '0',    '-',    '=',    '[',    ']',    ';',    '\'',
        !            61:        ',',    '.',    '/',    '\040', 'o',    'p',    'k',    'l',
        !            62:        'q',    'w',    'e',    'r',    't',    'y',    'u',    'i',
        !            63:        'a',    's',    'd',    'f',    'g',    'h',    'j',    'm',
        !            64:        'z',    'x',    'c',    'v',    'b',    'n',    NULL,   NULL
        !            65: };
        !            66: 
        !            67: char   us_shiftmap[] = {
        !            68:        NULL,   '~',    '|',    DEL,    NULL,   DEL,    NULL,   NULL,
        !            69:        '\n',   '\t',   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,
        !            70:        NULL,   '\n',   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,
        !            71:        NULL,   '\t',   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,
        !            72:        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,
        !            73:        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   DEL,    NULL,
        !            74:        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,
        !            75:        ESC,    '\r',   NULL,   '\n',   '0',    '.',    ',',    '+',
        !            76:        '1',    '2',    '3',    '-',    '4',    '5',    '6',    '*',
        !            77:        '7',    '8',    '9',    '/',    '`',    '|',    '\\',   '~',
        !            78:        '!',    '@',    '#',    '$',    '%',    '^',    '&',    '*',
        !            79:        '(',    ')',    '_',    '+',    '{',    '}',    ':',    '\"',
        !            80:        '<',    '>',    '?',    '\040', 'O',    'P',    'K',    'L',
        !            81:        'Q',    'W',    'E',    'R',    'T',    'Y',    'U',    'I',
        !            82:        'A',    'S',    'D',    'F',    'G',    'H',    'J',    'M',
        !            83:        'Z',    'X',    'C',    'V',    'B',    'N',    NULL,   NULL
        !            84: };
        !            85: 
        !            86: char   us_ctrlmap[] = {
        !            87:        NULL,   '`',    '\034', ESC,    NULL,   DEL,    NULL,   NULL,
        !            88:        '\n',   '\t',   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,
        !            89:        NULL,   '\n',   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,
        !            90:        NULL,   '\t',   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,
        !            91:        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,
        !            92:        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   '\b',   NULL,
        !            93:        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,
        !            94:        ESC,    '\r',   NULL,   '\n',   '0',    '.',    ',',    '+',
        !            95:        '1',    '2',    '3',    '-',    '4',    '5',    '6',    '*',
        !            96:        '7',    '8',    '9',    '/',    'E',    '(',    ')',    '\036',
        !            97:        '1',    '2',    '3',    '4',    '5',    '6',    '7',    '8',
        !            98:        '9',    '0',    '-',    '=',    '\033', '\035', ';',    '\'',
        !            99:        ',',    '.',    '/',    '\040', '\017', '\020', '\013', '\014',
        !           100:        '\021', '\027', '\005', '\022', '\024', '\031', '\025', '\011',
        !           101:        '\001', '\023', '\004', '\006', '\007', '\010', '\012', '\015',
        !           102:        '\032', '\030', '\003', '\026', '\002', '\016', NULL,   NULL
        !           103: };
        !           104: 
        !           105: #ifdef UK_KEYBOARD
        !           106: char   uk_keymap[] = {
        !           107:        NULL,   '`',    '<',    ESC,    NULL,   DEL,    NULL,   NULL,  
        !           108:        '\n',   '\t',   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,  
        !           109:        NULL,   '\n',   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,  
        !           110:        NULL,   '\t',   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,
        !           111:        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,
        !           112:        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   '\b',   NULL,
        !           113:        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,
        !           114:        ESC,    '\r',   NULL,   '\n',   '0',    '.',    ',',    '+',
        !           115:        '1',    '2',    '3',    '-',    '4',    '5',    '6',    '*',
        !           116:        '7',    '8',    '9',    '/',    'E',    '(',    ')',    '^',
        !           117:        '1',    '2',    '3',    '4',    '5',    '6',    '7',    '8',
        !           118:        '9',    '0',    '+',    '\'',   '[',    ']',    '*',    '\\',
        !           119:        ',',    '.',    '-',    '\040', 'o',    'p',    'k',    'l',
        !           120:        'q',    'w',    'e',    'r',    't',    'y',    'u',    'i',
        !           121:        'a',    's',    'd',    'f',    'g',    'h',    'j',    'm',
        !           122:        'z',    'x',    'c',    'v',    'b',    'n',    NULL,   NULL
        !           123: };
        !           124: 
        !           125: char   uk_shiftmap[] = {
        !           126:        NULL,   '~',    '>',    DEL,    NULL,   DEL,    NULL,   NULL,
        !           127:        '\n',   '\t',   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,
        !           128:        NULL,   '\n',   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,
        !           129:        NULL,   '\t',   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,
        !           130:        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,
        !           131:        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   DEL,    NULL,
        !           132:        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,
        !           133:        ESC,    '\r',   NULL,   '\n',   '0',    '.',    ',',    '+',
        !           134:        '1',    '2',    '3',    '-',    '4',    '5',    '6',    '*',
        !           135:        '7',    '8',    '9',    '/',    '`',    '|',    '\\',   '~',
        !           136:        '!',    '\"',   '#',    '$',    '%',    '&',    '^',    '(',
        !           137:        ')',    '=',    '?',    '/',    '{',    '}',    '@',    '|',
        !           138:        ';',    ':',    '_',    '\040', 'O',    'P',    'K',    'L',
        !           139:        'Q',    'W',    'E',    'R',    'T',    'Y',    'U',    'I',
        !           140:        'A',    'S',    'D',    'F',    'G',    'H',    'J',    'M',
        !           141:        'Z',    'X',    'C',    'V',    'B',    'N',    NULL,   NULL
        !           142: };
        !           143: 
        !           144: char   uk_ctrlmap[] = {
        !           145:        NULL,   '`',    '<',    ESC,    NULL,   DEL,    NULL,   NULL,
        !           146:        '\n',   '\t',   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,
        !           147:        NULL,   '\n',   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,
        !           148:        NULL,   '\t',   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,
        !           149:        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,
        !           150:        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   '\b',   NULL,
        !           151:        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,
        !           152:        ESC,    '\r',   NULL,   '\n',   '0',    '.',    ',',    '+',
        !           153:        '1',    '2',    '3',    '-',    '4',    '5',    '6',    '*',
        !           154:        '7',    '8',    '9',    '/',    'E',    '(',    ')',    '\036',
        !           155:        '1',    '2',    '3',    '4',    '5',    '6',    '7',    '8',
        !           156:        '9',    '0',    '+',    '\'',   '\033', '\035', '*',    '\034',
        !           157:        ',',    '.',    '/',    '\040', '\017', '\020', '\013', '\014',
        !           158:        '\021', '\027', '\005', '\022', '\024', '\031', '\025', '\011',
        !           159:        '\001', '\023', '\004', '\006', '\007', '\010', '\012', '\015',
        !           160:        '\032', '\030', '\003', '\026', '\002', '\016', NULL,   NULL
        !           161: };
        !           162: #endif
        !           163: 
        !           164: /*
        !           165:  * The keyboard map table.
        !           166:  * Lookup is by hardware returned language code.
        !           167:  */
        !           168: struct kbdmap kbd_map[] = {
        !           169:        KBD_US,         NULL,
        !           170:        us_keymap,      us_shiftmap,    us_ctrlmap,     NULL,   NULL,
        !           171: 
        !           172: #ifdef UK_KEYBOARD
        !           173:        KBD_UK,         NULL,
        !           174:        uk_keymap,      uk_shiftmap,    uk_ctrlmap,     NULL,   NULL,
        !           175: #endif
        !           176: 
        !           177:        0,              NULL,
        !           178:        NULL,           NULL,           NULL,           NULL,   NULL,
        !           179: };
        !           180: 
        !           181: char   *kbd_keymap = us_keymap;
        !           182: char   *kbd_shiftmap = us_shiftmap;
        !           183: char   *kbd_ctrlmap = us_ctrlmap;
        !           184: 
        !           185: kbdgetc()
        !           186: {
        !           187:        register int status, c;
        !           188:        register struct hil_dev *hiladdr = HILADDR;
        !           189: 
        !           190:        status = hiladdr->hil_stat;
        !           191:        if ((status & HIL_DATA_RDY) == 0)
        !           192:                return(0);
        !           193:        c = hiladdr->hil_data;
        !           194:        switch ((status>>KBD_SSHIFT) & KBD_SMASK) {
        !           195:        case KBD_SHIFT:
        !           196:                c = kbd_shiftmap[c & KBD_CHARMASK];
        !           197:                break;
        !           198:        case KBD_CTRL:
        !           199:                c = kbd_ctrlmap[c & KBD_CHARMASK];
        !           200:                break;
        !           201:        case KBD_KEY:
        !           202:                c = kbd_keymap[c & KBD_CHARMASK];
        !           203:                break;
        !           204:        default:
        !           205:                c = 0;
        !           206:                break;
        !           207:        }
        !           208:        return(c);
        !           209: }
        !           210: #endif
        !           211: 
        !           212: kbdnmi()
        !           213: {
        !           214:        register struct hil_dev *hiladdr = HILADDR;
        !           215: 
        !           216:        HILWAIT(hiladdr);
        !           217:        hiladdr->hil_cmd = HIL_CNMT;
        !           218:        HILWAIT(hiladdr);
        !           219:        hiladdr->hil_cmd = HIL_CNMT;
        !           220:        HILWAIT(hiladdr);
        !           221:        printf("\nboot interrupted\n");
        !           222: }
        !           223: 
        !           224: kbdinit()
        !           225: {
        !           226:        register struct hil_dev *hiladdr = HILADDR;
        !           227:        register struct kbdmap *km;
        !           228:        u_char lang;
        !           229: 
        !           230:        HILWAIT(hiladdr);
        !           231:        hiladdr->hil_cmd = HIL_SETARR;
        !           232:        HILWAIT(hiladdr);
        !           233:        hiladdr->hil_data = ar_format(KBD_ARR);
        !           234:        HILWAIT(hiladdr);
        !           235:        hiladdr->hil_cmd = HIL_READKBDLANG;
        !           236:        HILDATAWAIT(hiladdr);
        !           237:        lang = hiladdr->hil_data;
        !           238:        for (km = kbd_map; km->kbd_code; km++)
        !           239:                if (km->kbd_code == lang) {
        !           240:                        kbd_keymap = km->kbd_keymap;
        !           241:                        kbd_shiftmap = km->kbd_shiftmap;
        !           242:                        kbd_ctrlmap = km->kbd_ctrlmap;
        !           243:                }
        !           244:        HILWAIT(hiladdr);
        !           245:        hiladdr->hil_cmd = HIL_INTON;
        !           246: }
        !           247: #endif

unix.superglobalmegacorp.com

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