Home | History | Annotate | Line # | Download | only in common
hil.c revision 1.10.8.1
      1  1.10.8.1     yamt /*	$NetBSD: hil.c,v 1.10.8.1 2006/09/03 15:22:57 yamt Exp $	*/
      2       1.3  thorpej 
      3       1.3  thorpej /*-
      4       1.3  thorpej  * Copyright (c) 1997 The NetBSD Foundation, Inc.
      5       1.3  thorpej  * All rights reserved.
      6       1.3  thorpej  *
      7       1.3  thorpej  * This code is derived from software contributed to The NetBSD Foundation
      8       1.3  thorpej  * by Jason R. Thorpe.
      9       1.3  thorpej  *
     10       1.3  thorpej  * Redistribution and use in source and binary forms, with or without
     11       1.3  thorpej  * modification, are permitted provided that the following conditions
     12       1.3  thorpej  * are met:
     13       1.3  thorpej  * 1. Redistributions of source code must retain the above copyright
     14       1.3  thorpej  *    notice, this list of conditions and the following disclaimer.
     15       1.3  thorpej  * 2. Redistributions in binary form must reproduce the above copyright
     16       1.3  thorpej  *    notice, this list of conditions and the following disclaimer in the
     17       1.3  thorpej  *    documentation and/or other materials provided with the distribution.
     18       1.3  thorpej  * 3. All advertising materials mentioning features or use of this software
     19       1.3  thorpej  *    must display the following acknowledgement:
     20       1.3  thorpej  *	This product includes software developed by the NetBSD
     21       1.3  thorpej  *	Foundation, Inc. and its contributors.
     22       1.3  thorpej  * 4. Neither the name of The NetBSD Foundation nor the names of its
     23       1.3  thorpej  *    contributors may be used to endorse or promote products derived
     24       1.3  thorpej  *    from this software without specific prior written permission.
     25       1.3  thorpej  *
     26       1.3  thorpej  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     27       1.3  thorpej  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     28       1.3  thorpej  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     29       1.3  thorpej  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     30       1.3  thorpej  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     31       1.3  thorpej  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     32       1.3  thorpej  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     33       1.3  thorpej  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     34       1.3  thorpej  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     35       1.3  thorpej  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     36       1.3  thorpej  * POSSIBILITY OF SUCH DAMAGE.
     37       1.3  thorpej  */
     38       1.1  thorpej 
     39       1.1  thorpej /*
     40       1.1  thorpej  * Copyright (c) 1990, 1993
     41       1.1  thorpej  *	The Regents of the University of California.  All rights reserved.
     42       1.4      agc  *
     43       1.4      agc  * This code is derived from software contributed to Berkeley by
     44       1.4      agc  * the Systems Programming Group of the University of Utah Computer
     45       1.4      agc  * Science Department.
     46       1.4      agc  *
     47       1.4      agc  * Redistribution and use in source and binary forms, with or without
     48       1.4      agc  * modification, are permitted provided that the following conditions
     49       1.4      agc  * are met:
     50       1.4      agc  * 1. Redistributions of source code must retain the above copyright
     51       1.4      agc  *    notice, this list of conditions and the following disclaimer.
     52       1.4      agc  * 2. Redistributions in binary form must reproduce the above copyright
     53       1.4      agc  *    notice, this list of conditions and the following disclaimer in the
     54       1.4      agc  *    documentation and/or other materials provided with the distribution.
     55       1.4      agc  * 3. Neither the name of the University nor the names of its contributors
     56       1.4      agc  *    may be used to endorse or promote products derived from this software
     57       1.4      agc  *    without specific prior written permission.
     58       1.4      agc  *
     59       1.4      agc  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     60       1.4      agc  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     61       1.4      agc  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     62       1.4      agc  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     63       1.4      agc  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     64       1.4      agc  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     65       1.4      agc  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     66       1.4      agc  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     67       1.4      agc  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     68       1.4      agc  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     69       1.4      agc  * SUCH DAMAGE.
     70       1.4      agc  *
     71       1.4      agc  * from: Utah Hdr: hil.c 1.1 89/08/22
     72       1.4      agc  *
     73       1.4      agc  *	@(#)hil.c	8.1 (Berkeley) 6/10/93
     74       1.4      agc  */
     75       1.4      agc /*
     76       1.4      agc  * Copyright (c) 1988 University of Utah.
     77       1.1  thorpej  *
     78       1.1  thorpej  * This code is derived from software contributed to Berkeley by
     79       1.1  thorpej  * the Systems Programming Group of the University of Utah Computer
     80       1.1  thorpej  * Science Department.
     81       1.1  thorpej  *
     82       1.1  thorpej  * Redistribution and use in source and binary forms, with or without
     83       1.1  thorpej  * modification, are permitted provided that the following conditions
     84       1.1  thorpej  * are met:
     85       1.1  thorpej  * 1. Redistributions of source code must retain the above copyright
     86       1.1  thorpej  *    notice, this list of conditions and the following disclaimer.
     87       1.1  thorpej  * 2. Redistributions in binary form must reproduce the above copyright
     88       1.1  thorpej  *    notice, this list of conditions and the following disclaimer in the
     89       1.1  thorpej  *    documentation and/or other materials provided with the distribution.
     90       1.1  thorpej  * 3. All advertising materials mentioning features or use of this software
     91       1.1  thorpej  *    must display the following acknowledgement:
     92       1.1  thorpej  *	This product includes software developed by the University of
     93       1.1  thorpej  *	California, Berkeley and its contributors.
     94       1.1  thorpej  * 4. Neither the name of the University nor the names of its contributors
     95       1.1  thorpej  *    may be used to endorse or promote products derived from this software
     96       1.1  thorpej  *    without specific prior written permission.
     97       1.1  thorpej  *
     98       1.1  thorpej  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     99       1.1  thorpej  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    100       1.1  thorpej  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    101       1.1  thorpej  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
    102       1.1  thorpej  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    103       1.1  thorpej  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
    104       1.1  thorpej  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    105       1.1  thorpej  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
    106       1.1  thorpej  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
    107       1.1  thorpej  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    108       1.1  thorpej  * SUCH DAMAGE.
    109       1.1  thorpej  *
    110       1.1  thorpej  * from: Utah Hdr: hil.c 1.1 89/08/22
    111       1.1  thorpej  *
    112       1.1  thorpej  *	@(#)hil.c	8.1 (Berkeley) 6/10/93
    113       1.1  thorpej  */
    114       1.1  thorpej 
    115       1.1  thorpej /*
    116       1.2  thorpej  * HIL keyboard routines for the standalone ITE.
    117       1.1  thorpej  */
    118       1.1  thorpej 
    119       1.2  thorpej #if defined(ITECONSOLE) && defined(HIL_KEYBOARD)
    120       1.1  thorpej 
    121       1.1  thorpej #include <sys/param.h>
    122       1.1  thorpej 
    123       1.1  thorpej #include <hp300/dev/hilreg.h>
    124       1.1  thorpej #include <hp300/dev/kbdmap.h>
    125       1.1  thorpej #include <hp300/dev/itevar.h>
    126       1.1  thorpej 
    127       1.1  thorpej #include <hp300/stand/common/samachdep.h>
    128       1.2  thorpej #include <hp300/stand/common/kbdvar.h>
    129       1.1  thorpej 
    130       1.1  thorpej #ifndef SMALL
    131       1.1  thorpej 
    132       1.1  thorpej /*
    133       1.1  thorpej  * HIL cooked keyboard keymaps.
    134       1.1  thorpej  * Supports only unshifted, shifted and control keys.
    135       1.1  thorpej  */
    136       1.2  thorpej char hil_us_keymap[] = {
    137       1.5  tsutsui 	'\0',	'`',	'\\',	ESC,	'\0',	DEL,	'\0',	'\0',
    138       1.5  tsutsui 	'\n',	'\t',	'\0',	'\0',	'\0',	'\0',	'\0',	'\0',
    139       1.5  tsutsui 	'\0',	'\n',	'\0',	'\0',	'\0',	'\0',	'\0',	'\0',
    140       1.5  tsutsui 	'\0',	'\t',	'\0',	'\0',	'\0',	'\0',	'\0',	'\0',
    141       1.5  tsutsui 	'\0',	'\0',	'\0',	'\0',	'\0',	'\0',	'\0',	'\0',
    142       1.5  tsutsui 	'\0',	'\0',	'\0',	'\0',	'\0',	'\0',	'\b',	'\0',
    143       1.5  tsutsui 	'\0',	'\0',	'\0',	'\0',	'\0',	'\0',	'\0',	'\0',
    144       1.5  tsutsui 	ESC,	'\r',	'\0',	'\n',	'0',	'.',	',',	'+',
    145       1.1  thorpej 	'1',	'2',	'3',	'-',	'4',	'5',	'6',	'*',
    146       1.1  thorpej 	'7',	'8',	'9',	'/',	'E',	'(',	')',	'^',
    147       1.1  thorpej 	'1',	'2',	'3',	'4',	'5',	'6',	'7',	'8',
    148       1.1  thorpej 	'9',	'0',	'-',	'=',	'[',	']',	';',	'\'',
    149       1.1  thorpej 	',',	'.',	'/',	'\040',	'o',	'p',	'k',	'l',
    150       1.1  thorpej 	'q',	'w',	'e',	'r',	't',	'y',	'u',	'i',
    151       1.1  thorpej 	'a',	's',	'd',	'f',	'g',	'h',	'j',	'm',
    152       1.5  tsutsui 	'z',	'x',	'c',	'v',	'b',	'n',	'\0',	'\0'
    153       1.1  thorpej };
    154       1.1  thorpej 
    155       1.2  thorpej char hil_us_shiftmap[] = {
    156       1.5  tsutsui 	'\0',	'~',	'|',	DEL,	'\0',	DEL,	'\0',	'\0',
    157       1.5  tsutsui 	'\n',	'\t',	'\0',	'\0',	'\0',	'\0',	'\0',	'\0',
    158       1.5  tsutsui 	'\0',	'\n',	'\0',	'\0',	'\0',	'\0',	'\0',	'\0',
    159       1.5  tsutsui 	'\0',	'\t',	'\0',	'\0',	'\0',	'\0',	'\0',	'\0',
    160       1.5  tsutsui 	'\0',	'\0',	'\0',	'\0',	'\0',	'\0',	'\0',	'\0',
    161       1.5  tsutsui 	'\0',	'\0',	'\0',	'\0',	'\0',	'\0',	DEL,	'\0',
    162       1.5  tsutsui 	'\0',	'\0',	'\0',	'\0',	'\0',	'\0',	'\0',	'\0',
    163       1.5  tsutsui 	ESC,	'\r',	'\0',	'\n',	'0',	'.',	',',	'+',
    164       1.1  thorpej 	'1',	'2',	'3',	'-',	'4',	'5',	'6',	'*',
    165       1.1  thorpej 	'7',	'8',	'9',	'/',	'`',	'|',	'\\',	'~',
    166       1.1  thorpej 	'!',	'@',	'#',	'$',	'%',	'^',	'&',	'*',
    167       1.1  thorpej 	'(',	')',	'_',	'+',	'{',	'}',	':',	'\"',
    168       1.1  thorpej 	'<',	'>',	'?',	'\040',	'O',	'P',	'K',	'L',
    169       1.1  thorpej 	'Q',	'W',	'E',	'R',	'T',	'Y',	'U',	'I',
    170       1.1  thorpej 	'A',	'S',	'D',	'F',	'G',	'H',	'J',	'M',
    171       1.5  tsutsui 	'Z',	'X',	'C',	'V',	'B',	'N',	'\0',	'\0'
    172       1.1  thorpej };
    173       1.1  thorpej 
    174       1.2  thorpej char hil_us_ctrlmap[] = {
    175       1.5  tsutsui 	'\0',	'`',	'\034',	ESC,	'\0',	DEL,	'\0',	'\0',
    176       1.5  tsutsui 	'\n',	'\t',	'\0',	'\0',	'\0',	'\0',	'\0',	'\0',
    177       1.5  tsutsui 	'\0',	'\n',	'\0',	'\0',	'\0',	'\0',	'\0',	'\0',
    178       1.5  tsutsui 	'\0',	'\t',	'\0',	'\0',	'\0',	'\0',	'\0',	'\0',
    179       1.5  tsutsui 	'\0',	'\0',	'\0',	'\0',	'\0',	'\0',	'\0',	'\0',
    180       1.5  tsutsui 	'\0',	'\0',	'\0',	'\0',	'\0',	'\0',	'\b',	'\0',
    181       1.5  tsutsui 	'\0',	'\0',	'\0',	'\0',	'\0',	'\0',	'\0',	'\0',
    182       1.5  tsutsui 	ESC,	'\r',	'\0',	'\n',	'0',	'.',	',',	'+',
    183       1.1  thorpej 	'1',	'2',	'3',	'-',	'4',	'5',	'6',	'*',
    184       1.1  thorpej 	'7',	'8',	'9',	'/',	'E',	'(',	')',	'\036',
    185       1.1  thorpej 	'1',	'2',	'3',	'4',	'5',	'6',	'7',	'8',
    186       1.1  thorpej 	'9',	'0',	'-',	'=',	'\033',	'\035',	';',	'\'',
    187       1.1  thorpej 	',',	'.',	'/',	'\040',	'\017',	'\020',	'\013',	'\014',
    188       1.1  thorpej 	'\021',	'\027',	'\005',	'\022',	'\024',	'\031',	'\025',	'\011',
    189       1.1  thorpej 	'\001',	'\023',	'\004',	'\006',	'\007',	'\010',	'\012',	'\015',
    190       1.5  tsutsui 	'\032',	'\030',	'\003',	'\026',	'\002',	'\016',	'\0',	'\0'
    191       1.1  thorpej };
    192       1.1  thorpej 
    193       1.1  thorpej #ifdef UK_KEYBOARD
    194       1.2  thorpej char hil_uk_keymap[] = {
    195       1.5  tsutsui 	'\0',	'`',	'<',	ESC,	'\0',	DEL,	'\0',	'\0',
    196       1.5  tsutsui 	'\n',	'\t',	'\0',	'\0',	'\0',	'\0',	'\0',	'\0',
    197       1.5  tsutsui 	'\0',	'\n',	'\0',	'\0',	'\0',	'\0',	'\0',	'\0',
    198       1.5  tsutsui 	'\0',	'\t',	'\0',	'\0',	'\0',	'\0',	'\0',	'\0',
    199       1.5  tsutsui 	'\0',	'\0',	'\0',	'\0',	'\0',	'\0',	'\0',	'\0',
    200       1.5  tsutsui 	'\0',	'\0',	'\0',	'\0',	'\0',	'\0',	'\b',	'\0',
    201       1.5  tsutsui 	'\0',	'\0',	'\0',	'\0',	'\0',	'\0',	'\0',	'\0',
    202       1.5  tsutsui 	ESC,	'\r',	'\0',	'\n',	'0',	'.',	',',	'+',
    203       1.1  thorpej 	'1',	'2',	'3',	'-',	'4',	'5',	'6',	'*',
    204       1.1  thorpej 	'7',	'8',	'9',	'/',	'E',	'(',	')',	'^',
    205       1.1  thorpej 	'1',	'2',	'3',	'4',	'5',	'6',	'7',	'8',
    206       1.1  thorpej 	'9',	'0',	'+',	'\'',	'[',	']',	'*',	'\\',
    207       1.1  thorpej 	',',	'.',	'-',	'\040',	'o',	'p',	'k',	'l',
    208       1.1  thorpej 	'q',	'w',	'e',	'r',	't',	'y',	'u',	'i',
    209       1.1  thorpej 	'a',	's',	'd',	'f',	'g',	'h',	'j',	'm',
    210       1.5  tsutsui 	'z',	'x',	'c',	'v',	'b',	'n',	'\0',	'\0'
    211       1.1  thorpej };
    212       1.1  thorpej 
    213       1.2  thorpej char hil_uk_shiftmap[] = {
    214       1.5  tsutsui 	'\0',	'~',	'>',	DEL,	'\0',	DEL,	'\0',	'\0',
    215       1.5  tsutsui 	'\n',	'\t',	'\0',	'\0',	'\0',	'\0',	'\0',	'\0',
    216       1.5  tsutsui 	'\0',	'\n',	'\0',	'\0',	'\0',	'\0',	'\0',	'\0',
    217       1.5  tsutsui 	'\0',	'\t',	'\0',	'\0',	'\0',	'\0',	'\0',	'\0',
    218       1.5  tsutsui 	'\0',	'\0',	'\0',	'\0',	'\0',	'\0',	'\0',	'\0',
    219       1.5  tsutsui 	'\0',	'\0',	'\0',	'\0',	'\0',	'\0',	DEL,	'\0',
    220       1.5  tsutsui 	'\0',	'\0',	'\0',	'\0',	'\0',	'\0',	'\0',	'\0',
    221       1.5  tsutsui 	ESC,	'\r',	'\0',	'\n',	'0',	'.',	',',	'+',
    222       1.1  thorpej 	'1',	'2',	'3',	'-',	'4',	'5',	'6',	'*',
    223       1.1  thorpej 	'7',	'8',	'9',	'/',	'`',	'|',	'\\',	'~',
    224       1.1  thorpej 	'!',	'\"',	'#',	'$',	'%',	'&',	'^',	'(',
    225       1.1  thorpej 	')',	'=',	'?',	'/',	'{',	'}',	'@',	'|',
    226       1.1  thorpej 	';',	':',	'_',	'\040',	'O',	'P',	'K',	'L',
    227       1.1  thorpej 	'Q',	'W',	'E',	'R',	'T',	'Y',	'U',	'I',
    228       1.1  thorpej 	'A',	'S',	'D',	'F',	'G',	'H',	'J',	'M',
    229       1.5  tsutsui 	'Z',	'X',	'C',	'V',	'B',	'N',	'\0',	'\0'
    230       1.1  thorpej };
    231       1.1  thorpej 
    232       1.2  thorpej char hil_uk_ctrlmap[] = {
    233       1.5  tsutsui 	'\0',	'`',	'<',	ESC,	'\0',	DEL,	'\0',	'\0',
    234       1.5  tsutsui 	'\n',	'\t',	'\0',	'\0',	'\0',	'\0',	'\0',	'\0',
    235       1.5  tsutsui 	'\0',	'\n',	'\0',	'\0',	'\0',	'\0',	'\0',	'\0',
    236       1.5  tsutsui 	'\0',	'\t',	'\0',	'\0',	'\0',	'\0',	'\0',	'\0',
    237       1.5  tsutsui 	'\0',	'\0',	'\0',	'\0',	'\0',	'\0',	'\0',	'\0',
    238       1.5  tsutsui 	'\0',	'\0',	'\0',	'\0',	'\0',	'\0',	'\b',	'\0',
    239       1.5  tsutsui 	'\0',	'\0',	'\0',	'\0',	'\0',	'\0',	'\0',	'\0',
    240       1.5  tsutsui 	ESC,	'\r',	'\0',	'\n',	'0',	'.',	',',	'+',
    241       1.1  thorpej 	'1',	'2',	'3',	'-',	'4',	'5',	'6',	'*',
    242       1.1  thorpej 	'7',	'8',	'9',	'/',	'E',	'(',	')',	'\036',
    243       1.1  thorpej 	'1',	'2',	'3',	'4',	'5',	'6',	'7',	'8',
    244       1.1  thorpej 	'9',	'0',	'+',	'\'',	'\033',	'\035',	'*',	'\034',
    245       1.1  thorpej 	',',	'.',	'/',	'\040',	'\017',	'\020',	'\013',	'\014',
    246       1.1  thorpej 	'\021',	'\027',	'\005',	'\022',	'\024',	'\031',	'\025',	'\011',
    247       1.1  thorpej 	'\001',	'\023',	'\004',	'\006',	'\007',	'\010',	'\012',	'\015',
    248       1.5  tsutsui 	'\032',	'\030',	'\003',	'\026',	'\002',	'\016',	'\0',	'\0'
    249       1.1  thorpej };
    250       1.1  thorpej #endif
    251       1.1  thorpej 
    252       1.1  thorpej /*
    253       1.1  thorpej  * The keyboard map table.
    254       1.1  thorpej  * Lookup is by hardware returned language code.
    255       1.1  thorpej  */
    256       1.2  thorpej struct kbdmap hilkbd_map[] = {
    257       1.8  tsutsui 	{ KBD_US, "",
    258       1.8  tsutsui 	    hil_us_keymap, hil_us_shiftmap, hil_us_ctrlmap, NULL, NULL},
    259       1.1  thorpej 
    260       1.1  thorpej #ifdef UK_KEYBOARD
    261       1.8  tsutsui 	{ KBD_UK, "",
    262       1.8  tsutsui 	    hil_uk_keymap, hil_uk_shiftmap, hil_uk_ctrlmap, NULL, NULL},
    263       1.1  thorpej #endif
    264       1.1  thorpej 
    265       1.8  tsutsui 	{ 0, "",
    266       1.8  tsutsui 	    NULL, NULL, NULL, NULL, NULL},
    267       1.1  thorpej };
    268       1.1  thorpej 
    269       1.2  thorpej char	*hilkbd_keymap = hil_us_keymap;
    270       1.2  thorpej char	*hilkbd_shiftmap = hil_us_shiftmap;
    271       1.2  thorpej char	*hilkbd_ctrlmap = hil_us_ctrlmap;
    272       1.1  thorpej 
    273       1.2  thorpej int
    274       1.9  tsutsui hilkbd_getc(void)
    275       1.1  thorpej {
    276       1.2  thorpej 	int status, c;
    277       1.2  thorpej 	struct hil_dev *hiladdr = HILADDR;
    278       1.1  thorpej 
    279       1.1  thorpej 	status = hiladdr->hil_stat;
    280       1.1  thorpej 	if ((status & HIL_DATA_RDY) == 0)
    281       1.8  tsutsui 		return 0;
    282       1.1  thorpej 	c = hiladdr->hil_data;
    283       1.1  thorpej 	switch ((status>>KBD_SSHIFT) & KBD_SMASK) {
    284       1.1  thorpej 	case KBD_SHIFT:
    285       1.2  thorpej 		c = hilkbd_shiftmap[c & KBD_CHARMASK];
    286       1.1  thorpej 		break;
    287       1.1  thorpej 	case KBD_CTRL:
    288       1.2  thorpej 		c = hilkbd_ctrlmap[c & KBD_CHARMASK];
    289       1.1  thorpej 		break;
    290       1.1  thorpej 	case KBD_KEY:
    291       1.2  thorpej 		c = hilkbd_keymap[c & KBD_CHARMASK];
    292       1.1  thorpej 		break;
    293       1.1  thorpej 	default:
    294       1.1  thorpej 		c = 0;
    295       1.1  thorpej 		break;
    296       1.1  thorpej 	}
    297       1.8  tsutsui 	return c;
    298       1.1  thorpej }
    299       1.2  thorpej #endif /* SMALL */
    300       1.1  thorpej 
    301       1.2  thorpej void
    302       1.9  tsutsui hilkbd_nmi(void)
    303       1.1  thorpej {
    304       1.2  thorpej 	struct hil_dev *hiladdr = HILADDR;
    305       1.1  thorpej 
    306       1.1  thorpej 	HILWAIT(hiladdr);
    307       1.1  thorpej 	hiladdr->hil_cmd = HIL_CNMT;
    308       1.1  thorpej 	HILWAIT(hiladdr);
    309       1.1  thorpej 	hiladdr->hil_cmd = HIL_CNMT;
    310       1.1  thorpej 	HILWAIT(hiladdr);
    311       1.1  thorpej }
    312       1.1  thorpej 
    313       1.2  thorpej int
    314       1.9  tsutsui hilkbd_init(void)
    315       1.1  thorpej {
    316       1.2  thorpej 	struct hil_dev *hiladdr = HILADDR;
    317       1.2  thorpej 	struct kbdmap *km;
    318       1.1  thorpej 	u_char lang;
    319       1.1  thorpej 
    320       1.2  thorpej 	/*
    321       1.2  thorpej 	 * Determine the existence of a HIL keyboard.
    322       1.2  thorpej 	 */
    323       1.2  thorpej 	HILWAIT(hiladdr);
    324       1.2  thorpej 	hiladdr->hil_cmd = HIL_READKBDSADR;
    325       1.2  thorpej 	HILDATAWAIT(hiladdr);
    326       1.2  thorpej 	lang = hiladdr->hil_data;
    327       1.2  thorpej 	if (lang == 0)
    328       1.8  tsutsui 		return 0;
    329       1.2  thorpej 
    330       1.1  thorpej 	HILWAIT(hiladdr);
    331       1.1  thorpej 	hiladdr->hil_cmd = HIL_SETARR;
    332       1.1  thorpej 	HILWAIT(hiladdr);
    333       1.1  thorpej 	hiladdr->hil_data = ar_format(KBD_ARR);
    334       1.1  thorpej 	HILWAIT(hiladdr);
    335       1.1  thorpej 	hiladdr->hil_cmd = HIL_READKBDLANG;
    336       1.1  thorpej 	HILDATAWAIT(hiladdr);
    337       1.1  thorpej 	lang = hiladdr->hil_data;
    338       1.2  thorpej 	for (km = hilkbd_map; km->kbd_code; km++) {
    339       1.1  thorpej 		if (km->kbd_code == lang) {
    340       1.2  thorpej 			hilkbd_keymap = km->kbd_keymap;
    341       1.2  thorpej 			hilkbd_shiftmap = km->kbd_shiftmap;
    342       1.2  thorpej 			hilkbd_ctrlmap = km->kbd_ctrlmap;
    343       1.1  thorpej 		}
    344       1.2  thorpej 	}
    345       1.1  thorpej 	HILWAIT(hiladdr);
    346       1.1  thorpej 	hiladdr->hil_cmd = HIL_INTON;
    347       1.8  tsutsui 	return 1;
    348       1.1  thorpej }
    349       1.2  thorpej #endif /* ITECONSOLE && HIL_KEYBOARD */
    350