[BACK]Return to hil.c CVS log [TXT][DIR] Up to [local] / sys / arch / hp300 / stand / common

Annotation of sys/arch/hp300/stand/common/hil.c, Revision 1.1

1.1     ! nbrk        1: /*     $OpenBSD: hil.c,v 1.6 2006/08/17 06:31:10 miod Exp $    */
        !             2: /*     $NetBSD: hil.c,v 1.2 1997/04/14 19:00:10 thorpej Exp $  */
        !             3:
        !             4: /*
        !             5:  * Copyright (c) 1997 Jason R. Thorpe.  All rights reserved.
        !             6:  * Copyright (c) 1988 University of Utah.
        !             7:  * Copyright (c) 1990, 1993
        !             8:  *     The Regents of the University of California.  All rights reserved.
        !             9:  *
        !            10:  * This code is derived from software contributed to Berkeley by
        !            11:  * the Systems Programming Group of the University of Utah Computer
        !            12:  * Science Department.
        !            13:  *
        !            14:  * Redistribution and use in source and binary forms, with or without
        !            15:  * modification, are permitted provided that the following conditions
        !            16:  * are met:
        !            17:  * 1. Redistributions of source code must retain the above copyright
        !            18:  *    notice, this list of conditions and the following disclaimer.
        !            19:  * 2. Redistributions in binary form must reproduce the above copyright
        !            20:  *    notice, this list of conditions and the following disclaimer in the
        !            21:  *    documentation and/or other materials provided with the distribution.
        !            22:  * 3. Neither the name of the University nor the names of its contributors
        !            23:  *    may be used to endorse or promote products derived from this software
        !            24:  *    without specific prior written permission.
        !            25:  *
        !            26:  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
        !            27:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
        !            28:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
        !            29:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
        !            30:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
        !            31:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
        !            32:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
        !            33:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
        !            34:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
        !            35:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
        !            36:  * SUCH DAMAGE.
        !            37:  *
        !            38:  * from: Utah Hdr: hil.c 1.1 89/08/22
        !            39:  *
        !            40:  *     @(#)hil.c       8.1 (Berkeley) 6/10/93
        !            41:  */
        !            42:
        !            43: /*
        !            44:  * HIL keyboard routines for the standalone ITE.
        !            45:  */
        !            46:
        !            47: #if defined(ITECONSOLE) && defined(HIL_KEYBOARD)
        !            48:
        !            49: #include <lib/libsa/stand.h>
        !            50:
        !            51: #include "samachdep.h"
        !            52: #include "hilreg.h"
        !            53: #include "itevar.h"
        !            54: #include "kbdvar.h"
        !            55:
        !            56: #ifndef SMALL
        !            57:
        !            58: #define        ESC     '\033'
        !            59: #define        DEL     '\177'
        !            60:
        !            61: /*
        !            62:  * HIL cooked keyboard keymaps.
        !            63:  * Supports only unshifted, shifted and control keys.
        !            64:  */
        !            65: char   hilkbd_keymap[] = {
        !            66:        NULL,   '`',    '\\',   ESC,    NULL,   DEL,    NULL,   NULL,
        !            67:        '\n',   '\t',   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,
        !            68:        NULL,   '\n',   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,
        !            69:        NULL,   '\t',   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,
        !            70:        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,
        !            71:        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   '\b',   NULL,
        !            72:        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,
        !            73:        ESC,    '\r',   NULL,   '\n',   '0',    '.',    ',',    '+',
        !            74:        '1',    '2',    '3',    '-',    '4',    '5',    '6',    '*',
        !            75:        '7',    '8',    '9',    '/',    'E',    '(',    ')',    '^',
        !            76:        '1',    '2',    '3',    '4',    '5',    '6',    '7',    '8',
        !            77:        '9',    '0',    '-',    '=',    '[',    ']',    ';',    '\'',
        !            78:        ',',    '.',    '/',    '\040', 'o',    'p',    'k',    'l',
        !            79:        'q',    'w',    'e',    'r',    't',    'y',    'u',    'i',
        !            80:        'a',    's',    'd',    'f',    'g',    'h',    'j',    'm',
        !            81:        'z',    'x',    'c',    'v',    'b',    'n',    NULL,   NULL
        !            82: };
        !            83:
        !            84: char   hilkbd_shiftmap[] = {
        !            85:        NULL,   '~',    '|',    DEL,    NULL,   DEL,    NULL,   NULL,
        !            86:        '\n',   '\t',   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,
        !            87:        NULL,   '\n',   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,
        !            88:        NULL,   '\t',   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,
        !            89:        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,
        !            90:        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   DEL,    NULL,
        !            91:        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,
        !            92:        ESC,    '\r',   NULL,   '\n',   '0',    '.',    ',',    '+',
        !            93:        '1',    '2',    '3',    '-',    '4',    '5',    '6',    '*',
        !            94:        '7',    '8',    '9',    '/',    '`',    '|',    '\\',   '~',
        !            95:        '!',    '@',    '#',    '$',    '%',    '^',    '&',    '*',
        !            96:        '(',    ')',    '_',    '+',    '{',    '}',    ':',    '\"',
        !            97:        '<',    '>',    '?',    '\040', 'O',    'P',    'K',    'L',
        !            98:        'Q',    'W',    'E',    'R',    'T',    'Y',    'U',    'I',
        !            99:        'A',    'S',    'D',    'F',    'G',    'H',    'J',    'M',
        !           100:        'Z',    'X',    'C',    'V',    'B',    'N',    NULL,   NULL
        !           101: };
        !           102:
        !           103: char   hilkbd_ctrlmap[] = {
        !           104:        NULL,   '`',    '\034', ESC,    NULL,   DEL,    NULL,   NULL,
        !           105:        '\n',   '\t',   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,
        !           106:        NULL,   '\n',   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,
        !           107:        NULL,   '\t',   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,
        !           108:        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,
        !           109:        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   '\b',   NULL,
        !           110:        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,
        !           111:        ESC,    '\r',   NULL,   '\n',   '0',    '.',    ',',    '+',
        !           112:        '1',    '2',    '3',    '-',    '4',    '5',    '6',    '*',
        !           113:        '7',    '8',    '9',    '/',    'E',    '(',    ')',    '\036',
        !           114:        '1',    '2',    '3',    '4',    '5',    '6',    '7',    '8',
        !           115:        '9',    '0',    '-',    '=',    '\033', '\035', ';',    '\'',
        !           116:        ',',    '.',    '/',    '\040', '\017', '\020', '\013', '\014',
        !           117:        '\021', '\027', '\005', '\022', '\024', '\031', '\025', '\011',
        !           118:        '\001', '\023', '\004', '\006', '\007', '\010', '\012', '\015',
        !           119:        '\032', '\030', '\003', '\026', '\002', '\016', NULL,   NULL
        !           120: };
        !           121:
        !           122: int
        !           123: hilkbd_getc()
        !           124: {
        !           125:        int status, c;
        !           126:        struct hil_dev *hiladdr = HILADDR;
        !           127:
        !           128:        status = hiladdr->hil_stat;
        !           129:        if ((status & HIL_DATA_RDY) == 0)
        !           130:                return(0);
        !           131:        c = hiladdr->hil_data;
        !           132:        switch ((status >> HIL_SSHIFT) & HIL_SMASK) {
        !           133:        case KBD_SHIFT:
        !           134:                c = hilkbd_shiftmap[c & KBD_CHARMASK];
        !           135:                break;
        !           136:        case KBD_CTRL:
        !           137:                c = hilkbd_ctrlmap[c & KBD_CHARMASK];
        !           138:                break;
        !           139:        case KBD_KEY:
        !           140:                c = hilkbd_keymap[c & KBD_CHARMASK];
        !           141:                break;
        !           142:        default:
        !           143:                c = 0;
        !           144:                break;
        !           145:        }
        !           146:        return(c);
        !           147: }
        !           148: #endif /* SMALL */
        !           149:
        !           150: void
        !           151: hilkbd_nmi()
        !           152: {
        !           153:        struct hil_dev *hiladdr = HILADDR;
        !           154:
        !           155:        HILWAIT(hiladdr);
        !           156:        hiladdr->hil_cmd = HIL_CNMT;
        !           157:        HILWAIT(hiladdr);
        !           158:        hiladdr->hil_cmd = HIL_CNMT;
        !           159:        HILWAIT(hiladdr);
        !           160:        printf("\nboot interrupted\n");
        !           161: }
        !           162:
        !           163: int
        !           164: hilkbd_init()
        !           165: {
        !           166:        struct hil_dev *hiladdr = HILADDR;
        !           167:
        !           168:        /*
        !           169:         * Determine the existence of a HIL keyboard.
        !           170:         */
        !           171:        HILWAIT(hiladdr);
        !           172:        hiladdr->hil_cmd = HIL_READKBDSADR;
        !           173:        HILDATAWAIT(hiladdr);
        !           174:        if (hiladdr->hil_data == 0)
        !           175:                return (0);
        !           176:
        !           177:        HILWAIT(hiladdr);
        !           178:        hiladdr->hil_cmd = HIL_SETARR;
        !           179:        HILWAIT(hiladdr);
        !           180:        hiladdr->hil_data = ar_format(KBD_ARR);
        !           181:        HILWAIT(hiladdr);
        !           182:        hiladdr->hil_cmd = HIL_INTON;
        !           183:
        !           184:        return (1);
        !           185: }
        !           186: #endif /* ITECONSOLE && HIL_KEYBOARD */

CVSweb