summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/hil/Makefile9
-rw-r--r--sys/dev/hil/devlist2h.awk79
-rw-r--r--sys/dev/hil/files.hil16
-rw-r--r--sys/dev/hil/hildevs49
-rw-r--r--sys/dev/hil/hildevs.h53
-rw-r--r--sys/dev/hil/hilkbd.c300
-rw-r--r--sys/dev/hil/hilkbdmap.c252
-rw-r--r--sys/dev/hil/hilkbdmap.h33
-rw-r--r--sys/dev/hil/hilreg.h149
-rw-r--r--sys/dev/hil/hilvar.h111
10 files changed, 1051 insertions, 0 deletions
diff --git a/sys/dev/hil/Makefile b/sys/dev/hil/Makefile
new file mode 100644
index 00000000000..0b98640b3a7
--- /dev/null
+++ b/sys/dev/hil/Makefile
@@ -0,0 +1,9 @@
+# $OpenBSD: Makefile,v 1.1 2003/02/11 19:39:30 miod Exp $
+
+AWK= awk
+PROG= devlist2h.awk
+SOURCE= hildevs
+
+${SOURCE}_data.h: ${SOURCE} ${PROG}
+ /bin/rm -f $@
+ ${AWK} -f ${PROG} ${SOURCE} > $@
diff --git a/sys/dev/hil/devlist2h.awk b/sys/dev/hil/devlist2h.awk
new file mode 100644
index 00000000000..374485c92ea
--- /dev/null
+++ b/sys/dev/hil/devlist2h.awk
@@ -0,0 +1,79 @@
+#! /usr/bin/awk -f
+# $OpenBSD: devlist2h.awk,v 1.1 2003/02/11 19:39:30 miod Exp $
+#
+# Copyright (c) 2003, Miodrag Vallat.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+BEGIN {
+ header = 0
+}
+NR == 1 {
+ VERSION = $0
+ gsub("\\$", "", VERSION)
+
+ printf("/*\t\$OpenBSD\$\t*/\n\n")
+ printf("/*\n")
+ printf(" * THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT.\n")
+ printf(" *\n")
+ printf(" * generated from:\n")
+ printf(" *\t%s\n", VERSION)
+ printf(" */\n")
+
+ next
+}
+$1 == "keyboard" || $1 == "mouse" || $1 == "idmodule" {
+
+ if (header == 0) {
+ printf("const struct hildevice hildevs[] = {\n")
+ header = 1
+ }
+
+ printf("\t{ 0x%s, 0x%s, HIL_DEVICE_%s, \"",
+ $2, $3, toupper($1))
+
+ # description, with optional ``#''-prefixed comments
+ i = 4
+ f = i
+ while (f <= NF) {
+ if ($f == "#") {
+ break
+ }
+ if (f > i)
+ printf(" ")
+ printf("%s", $f)
+ f++
+ }
+ printf("\" },\n")
+
+ next
+}
+{
+ if ($0 == "")
+ blanklines++
+ if (blanklines < 2)
+ print $0
+}
+END {
+ printf("\t{ -1, -1, -1, NULL }")
+ printf("};\n")
+}
diff --git a/sys/dev/hil/files.hil b/sys/dev/hil/files.hil
new file mode 100644
index 00000000000..82dba23b5c7
--- /dev/null
+++ b/sys/dev/hil/files.hil
@@ -0,0 +1,16 @@
+# $OpenBSD: files.hil,v 1.1 2003/02/11 19:39:30 miod Exp $
+#
+# Configuration file for machine-independent HIL code.
+#
+
+device hil { }
+file dev/hil/hil.c hil needs-flag
+
+device hilkbd: wskbddev
+attach hilkbd at hil
+file dev/hil/hilkbd.c hilkbd needs-flag
+file dev/hil/hilkbdmap.c hilkbd
+
+#device hilms: wsmousedev
+#attach hilms at hil
+#file dev/hil/hilms.c hilms needs-flag
diff --git a/sys/dev/hil/hildevs b/sys/dev/hil/hildevs
new file mode 100644
index 00000000000..2a6a2a2efa8
--- /dev/null
+++ b/sys/dev/hil/hildevs
@@ -0,0 +1,49 @@
+$OpenBSD: hildevs,v 1.1 2003/02/11 19:39:30 miod Exp $
+/*
+ * Copyright (c) 2003, Miodrag Vallat.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+keyboard 00 1f Keypad
+keyboard 2f 2f LPFK Button box
+keyboard 30 33 Button box # 31-33 rumored not to exist
+idmodule 34 34 ID module
+keyboard 35 3f Button box
+keyboard 5c 5f Barcode reader
+mouse 60 60 Single knob
+mouse 61 61 Nine knob
+mouse 62 67 Quadrature
+mouse 68 6b Mouse
+mouse 6c 6f Trackball
+mouse 70 70 Knob box
+mouse 71 71 Spaceball
+mouse 88 8b Touchpad
+mouse 8c 8f Touchscreen
+mouse 90 97 Tablet
+mouse 98 98 MMII 1812 Tablet
+mouse 99 99 MMII 1201 Tablet
+keyboard a0 bf 93-key keyboard
+keyboard c0 df 109-key keyboard
+keyboard e0 ff 87-key keyboard
diff --git a/sys/dev/hil/hildevs.h b/sys/dev/hil/hildevs.h
new file mode 100644
index 00000000000..c093fb10a7a
--- /dev/null
+++ b/sys/dev/hil/hildevs.h
@@ -0,0 +1,53 @@
+/* $OpenBSD: hildevs.h,v 1.1 2003/02/11 19:39:30 miod Exp $ */
+/*
+ * Copyright (c) 2003, Miodrag Vallat.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+/* Entries in hildevs_data.h for device probe */
+struct hildevice {
+ int minid;
+ int maxid;
+ int type;
+ const char *descr;
+};
+
+/* Arguments passed to attach routines */
+struct hil_attach_args {
+ struct confargs ha_ca;
+ int ha_code; /* hil code */
+ int ha_type; /* hil device type */
+ int ha_infolen; /* identify info length */
+ u_int8_t ha_info[HILBUFSIZE]; /* identify info bits */
+#define ha_id ha_info[0] /* hil probe id */
+
+ const char *ha_descr; /* device description */
+ int ha_flags; /* extra information */
+};
+
+/* ha_type values */
+#define HIL_DEVICE_KEYBOARD 1
+#define HIL_DEVICE_IDMODULE 2
+#define HIL_DEVICE_MOUSE 3
diff --git a/sys/dev/hil/hilkbd.c b/sys/dev/hil/hilkbd.c
new file mode 100644
index 00000000000..8a58fe7a9fd
--- /dev/null
+++ b/sys/dev/hil/hilkbd.c
@@ -0,0 +1,300 @@
+/* $OpenBSD: hilkbd.c,v 1.1 2003/02/11 19:39:30 miod Exp $ */
+/*
+ * Copyright (c) 2003, Miodrag Vallat.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/device.h>
+#include <sys/ioctl.h>
+
+#include <machine/autoconf.h>
+#include <machine/bus.h>
+#include <machine/cpu.h>
+
+#include <dev/hil/hilreg.h>
+#include <dev/hil/hilvar.h>
+#include <dev/hil/hildevs.h>
+
+#include <dev/wscons/wsconsio.h>
+#include <dev/wscons/wskbdvar.h>
+#include <dev/wscons/wsksymdef.h>
+#include <dev/wscons/wsksymvar.h>
+
+#include <dev/hil/hilkbdmap.h>
+
+struct hilkbd_softc {
+ struct device sc_dev;
+
+ int sc_code;
+ int sc_numleds;
+ int sc_ledstate;
+
+ struct device *sc_wskbddev;
+};
+
+#define HILKBD_LEDS 0xf0 /* keyboard has leds */
+#define HILKBD_NLEDS 0x70 /* keyboard led mask */
+
+int hilkbdprobe(struct device *, void *, void *);
+void hilkbdattach(struct device *, struct device *, void *);
+
+struct cfdriver hilkbd_cd = {
+ NULL, "hilkbd", DV_DULL
+};
+
+struct cfattach hilkbd_ca = {
+ sizeof(struct hilkbd_softc), hilkbdprobe, hilkbdattach
+};
+
+int hilkbd_enable(void *, int);
+void hilkbd_set_leds(void *, int);
+int hilkbd_ioctl(void *, u_long, caddr_t, int, struct proc *);
+
+const struct wskbd_accessops hilkbd_accessops = {
+ hilkbd_enable,
+ hilkbd_set_leds,
+ hilkbd_ioctl,
+};
+
+void hilkbd_cngetc(void *, u_int *, int *);
+void hilkbd_cnpollc(void *, int);
+void hilkbd_cnbell(void *, u_int, u_int, u_int);
+
+const struct wskbd_consops hilkbd_consops = {
+ hilkbd_cngetc,
+ hilkbd_cnpollc,
+ hilkbd_cnbell,
+};
+
+struct wskbd_mapdata hilkbd_keymapdata = {
+ hilkbd_keydesctab,
+#ifdef HILKBD_LAYOUT
+ HILKBD_LAYOUT,
+#else
+ KB_US,
+#endif
+};
+
+void hilkbd_bell(struct hil_softc *, u_int, u_int, u_int);
+void hilkbd_callback(void *, u_int, u_int8_t *);
+void hilkbd_decode(u_int8_t, u_int8_t, u_int *, int *);
+
+int
+hilkbdprobe(struct device *parent, void *match, void *aux)
+{
+ struct hil_attach_args *ha = aux;
+
+ if (ha->ha_type != HIL_DEVICE_KEYBOARD)
+ return (0);
+
+ return (1);
+}
+
+void
+hilkbdattach(struct device *parent, struct device *self, void *aux)
+{
+ struct hilkbd_softc *sc = (void *)self;
+ struct hil_attach_args *ha = aux;
+ struct wskbddev_attach_args a;
+ u_int8_t db, layoutcode;
+
+ sc->sc_code = ha->ha_code;
+
+ /*
+ * Put the keyboard in raw mode
+ */
+ db = 0;
+ send_hil_cmd((struct hil_softc *)parent, HIL_WRITEKBDSADR, &db, 1, NULL);
+
+ /*
+ * Determine the keyboard language configuration, but don't
+ * override a user-specified setting.
+ */
+ layoutcode = ha->ha_id & (MAXHILKBDLAYOUT - 1);
+#ifndef HILKBD_LAYOUT
+ if (layoutcode < MAXHILKBDLAYOUT &&
+ hilkbd_layouts[layoutcode] != -1)
+ hilkbd_keymapdata.layout = hilkbd_layouts[layoutcode];
+#endif
+
+ printf(", layout %x", layoutcode);
+
+ /*
+ * Interpret the extended id information, if any
+ */
+ if (ha->ha_infolen > 2) {
+ if (ha->ha_info[2] & HILKBD_LEDS) {
+ sc->sc_numleds = (ha->ha_info[2] & HILKBD_NLEDS) >> 4;
+ printf(", %d leds", sc->sc_numleds);
+ }
+ }
+
+ hil_callback_register((struct hil_softc *)parent, ha->ha_code,
+ hilkbd_callback, sc);
+
+ printf("\n");
+
+ a.console = ha->ha_flags;
+ a.keymap = &hilkbd_keymapdata;
+ a.accessops = &hilkbd_accessops;
+ a.accesscookie = sc;
+
+ if (a.console) {
+ wskbd_cnattach(&hilkbd_consops, sc, &hilkbd_keymapdata);
+ }
+
+ sc->sc_wskbddev = config_found(self, &a, wskbddevprint);
+}
+
+int
+hilkbd_enable(void *v, int on)
+{
+ return (0);
+}
+
+void
+hilkbd_set_leds(void *v, int leds)
+{
+ struct hilkbd_softc *sc = v;
+ int changemask;
+
+ if (sc->sc_numleds == 0)
+ return;
+
+ changemask = leds ^ sc->sc_ledstate;
+ if (changemask == 0)
+ return;
+
+ /* We do not handle more than 3 leds here */
+ if (changemask & WSKBD_LED_SCROLL)
+ send_hildev_cmd((struct hil_softc *)sc->sc_dev.dv_parent,
+ sc->sc_code,
+ (leds & WSKBD_LED_SCROLL) ? HIL_PROMPT1 : HIL_ACK1);
+ if (changemask & WSKBD_LED_NUM)
+ send_hildev_cmd((struct hil_softc *)sc->sc_dev.dv_parent,
+ sc->sc_code,
+ (leds & WSKBD_LED_NUM) ? HIL_PROMPT2 : HIL_ACK2);
+ if (changemask & WSKBD_LED_CAPS)
+ send_hildev_cmd((struct hil_softc *)sc->sc_dev.dv_parent,
+ sc->sc_code,
+ (leds & WSKBD_LED_CAPS) ? HIL_PROMPT3 : HIL_ACK3);
+
+ sc->sc_ledstate = leds;
+}
+
+int
+hilkbd_ioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p)
+{
+ struct hilkbd_softc *sc = v;
+
+ switch (cmd) {
+ case WSKBDIO_GTYPE:
+ *(int *)data = WSKBD_TYPE_HIL;
+ return 0;
+ case WSKBDIO_SETLEDS:
+ hilkbd_set_leds(v, *(int *)data);
+ return 0;
+ case WSKBDIO_GETLEDS:
+ *(int *)data = sc->sc_ledstate;
+ return 0;
+ case WSKBDIO_COMPLEXBELL:
+#define d ((struct wskbd_bell_data *)data)
+ hilkbd_bell((struct hil_softc *)sc->sc_dev.dv_parent,
+ d->pitch, d->period, d->volume);
+#undef d
+ return 0;
+ }
+
+ return -1;
+}
+
+void
+hilkbd_cngetc(void *v, u_int *type, int *data)
+{
+ struct hil_softc *sc = v;
+ u_int8_t c, stat;
+
+ /* XXX This should really filter on keyboard events only */
+ for (;;) {
+ if (hil_poll_data(sc, &stat, &c) != -1)
+ break;
+ }
+ hilkbd_decode(stat, c, type, data);
+}
+
+void
+hilkbd_cnpollc(void *v, int on)
+{
+ struct hil_softc *sc = v;
+
+ hil_set_poll(sc, on);
+}
+
+void
+hilkbd_cnbell(void *v, u_int pitch, u_int period, u_int volume)
+{
+ struct hil_softc *sc = v;
+
+ hilkbd_bell(sc, pitch, period, volume);
+}
+
+void
+hilkbd_bell(struct hil_softc *sc, u_int pitch, u_int period, u_int volume)
+{
+ u_int8_t buf[2];
+
+ /* XXX there could be at least a pitch -> HIL pitch conversion here */
+#define BELLDUR 80 /* tone duration in msec (10-2560) */
+#define BELLFREQ 8 /* tone frequency (0-63) */
+ buf[0] = ar_format(period - 10);
+ buf[1] = BELLFREQ;
+ send_hil_cmd(sc, HIL_SETTONE, buf, 2, NULL);
+}
+
+void
+hilkbd_callback(void *v, u_int buflen, u_int8_t *buf)
+{
+ struct hilkbd_softc *sc = v;
+ u_int type;
+ int key;
+ int i;
+
+ if (buflen > 1 && *buf == HIL_KBDDATA) {
+ for (i = 1, buf++; i < buflen; i++) {
+ hilkbd_decode(0, *buf++, &type, &key);
+ if (sc->sc_wskbddev != NULL)
+ wskbd_input(sc->sc_wskbddev, type, key);
+ }
+ }
+}
+
+void
+hilkbd_decode(u_int8_t stat, u_int8_t data, u_int *type, int *key)
+{
+ *type = (data & 1) ? WSCONS_EVENT_KEY_UP : WSCONS_EVENT_KEY_DOWN;
+ *key = data >> 1;
+}
diff --git a/sys/dev/hil/hilkbdmap.c b/sys/dev/hil/hilkbdmap.c
new file mode 100644
index 00000000000..46271f14e6e
--- /dev/null
+++ b/sys/dev/hil/hilkbdmap.c
@@ -0,0 +1,252 @@
+/* $OpenBSD: hilkbdmap.c,v 1.1 2003/02/11 19:39:30 miod Exp $ */
+/*
+ * Copyright (c) 2003, Miodrag Vallat.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#include <sys/types.h>
+#include <dev/wscons/wsksymdef.h>
+#include <dev/wscons/wsksymvar.h>
+#include <dev/hil/hilkbdmap.h>
+
+#define KC(n) KS_KEYCODE(n)
+
+/*
+ * 1f. US ASCII
+ */
+
+const keysym_t hilkbd_keydesc_us[] = {
+/* pos command normal shifted */
+ KC(2), KS_Cmd2, KS_Alt_R, KS_Multi_key,
+ KC(3), KS_Cmd2, KS_Alt_L,
+ KC(4), KS_Shift_R,
+ KC(5), KS_Shift_L,
+ KC(6), KS_Cmd1, KS_Control_L,
+ KC(7), KS_Cmd_KbdReset, /* Break/Reset */
+ KC(8), KS_KP_4,
+ KC(9), KS_KP_8,
+ KC(10), KS_KP_5,
+ KC(11), KS_KP_9,
+ KC(12), KS_KP_6,
+ KC(13), KS_KP_7,
+ KC(14), KS_comma, /* numeric pad */
+ KC(15), KS_KP_Enter,
+ KC(16), KS_KP_1,
+ KC(17), KS_KP_Divide,
+ KC(18), KS_KP_2,
+ KC(19), KS_KP_Add,
+ KC(20), KS_KP_3,
+ KC(21), KS_KP_Multiply,
+ KC(22), KS_KP_0,
+ KC(23), KS_KP_Subtract,
+ KC(24), KS_b,
+ KC(25), KS_v,
+ KC(26), KS_c,
+ KC(27), KS_x,
+ KC(28), KS_z,
+
+ KC(31), KS_Cmd_Debugger, KS_Escape,
+ /* 33 numeric pad unlabeled key #2 */
+ /* 35 numeric pad unlabeled key #3 */
+ KC(36), KS_KP_Decimal,
+ /* 37 numeric pad unlabeled key #1 */
+ KC(38), KS_Tab, /* numeric pad */
+ /* 39 numeric pad unlabeled key #4 */
+ KC(40), KS_h,
+ KC(41), KS_g,
+ KC(42), KS_f,
+ KC(43), KS_d,
+ KC(44), KS_s,
+ KC(45), KS_a,
+
+ KC(47), KS_Caps_Lock,
+ KC(48), KS_u,
+ KC(49), KS_y,
+ KC(50), KS_t,
+ KC(51), KS_r,
+ KC(52), KS_e,
+ KC(53), KS_w,
+ KC(54), KS_q,
+ KC(55), KS_Tab,
+ KC(56), KS_7, KS_ampersand,
+ KC(57), KS_6, KS_asciicircum,
+ KC(58), KS_5, KS_percent,
+ KC(59), KS_4, KS_dollar,
+ KC(60), KS_3, KS_numbersign,
+ KC(61), KS_2, KS_at,
+ KC(62), KS_1, KS_exclam,
+ KC(63), KS_grave, KS_asciitilde,
+
+ /* 72 Menu */
+ KC(73), KS_Cmd_Screen3, KS_f4,
+ KC(74), KS_Cmd_Screen2, KS_f3,
+ KC(75), KS_Cmd_Screen1, KS_f2,
+ KC(76), KS_Cmd_Screen0, KS_f1,
+
+ /* 78 Stop */
+ KC(79), KS_Return, KS_Print_Screen,
+ /* 80 System/User */
+ KC(81), KS_Cmd_Screen4, KS_f5,
+ KC(82), KS_Cmd_Screen7, KS_f8,
+ KC(83), KS_Cmd_Screen6, KS_f7,
+ KC(84), KS_Cmd_Screen5, KS_f6,
+
+ /* 86 Clear line */
+ /* 87 Clear display */
+ KC(88), KS_8, KS_asterisk,
+ KC(89), KS_9, KS_parenleft,
+ KC(90), KS_0, KS_parenright,
+ KC(91), KS_minus, KS_underscore,
+ KC(92), KS_equal, KS_plus,
+ KC(93), KS_Cmd_ResetEmul, KS_Delete, /* Backspace */
+ /* 94 Insert line */
+ /* 95 Delete line */
+ KC(96), KS_i,
+ KC(97), KS_o,
+ KC(98), KS_p,
+ KC(99), KS_bracketleft, KS_braceleft,
+ KC(100), KS_bracketright,KS_braceright,
+ KC(101), KS_backslash, KS_bar,
+ KC(102), KS_Insert,
+ KC(103), KS_Delete,
+ KC(104), KS_j,
+ KC(105), KS_k,
+ KC(106), KS_l,
+ KC(107), KS_semicolon, KS_colon,
+ KC(108), KS_apostrophe, KS_quotedbl,
+ KC(109), KS_Return,
+ KC(110), KS_Home,
+ KC(111), KS_Cmd_ScrollBack, KS_Prior,
+
+ KC(112), KS_m,
+ KC(113), KS_comma, KS_less,
+ KC(114), KS_period, KS_greater,
+ KC(115), KS_slash, KS_question,
+
+ /* 117 Select */
+
+ KC(119), KS_Cmd_ScrollFwd, KS_Next,
+ KC(120), KS_n,
+ KC(121), KS_space,
+
+ KC(124), KS_Left,
+ KC(125), KS_Down,
+ KC(126), KS_Up,
+ KC(127), KS_Right,
+};
+
+/*
+ * 0e. Swedish
+ */
+
+const keysym_t hilkbd_keydesc_sv[] = {
+ KC(56), KS_7, KS_slash,
+ KC(57), KS_6, KS_ampersand,
+ KC(61), KS_2, KS_quotedbl,
+ KC(63), KS_less, KS_greater,
+ KC(88), KS_8, KS_parenleft,
+ KC(89), KS_9, KS_parenright,
+ KC(90), KS_0, KS_equal,
+ KC(91), KS_plus, KS_question,
+ KC(92), KS_grave, KS_at,
+ KC(99), KS_braceright, KS_bracketright,
+ KC(100), KS_asciitilde, KS_asciicircum,
+ KC(101), KS_apostrophe, KS_asterisk,
+ KC(107), KS_bar, KS_backslash,
+ KC(108), KS_braceleft, KS_bracketleft,
+ KC(113), KS_comma, KS_semicolon,
+ KC(114), KS_period, KS_colon,
+ KC(115), KS_minus, KS_underscore,
+};
+
+/*
+ * 17. English
+ */
+
+const keysym_t hilkbd_keydesc_uk[] = {
+ KC(56), KS_7, KS_asciicircum,
+ KC(57), KS_6, KS_ampersand,
+ KC(61), KS_2, KS_quotedbl,
+ KC(88), KS_8, KS_parenleft,
+ KC(89), KS_9, KS_parenright,
+ KC(90), KS_0, KS_equal,
+ KC(91), KS_plus, KS_question,
+ KC(92), KS_apostrophe, KS_slash,
+ KC(101), KS_less, KS_greater,
+ KC(107), KS_asterisk, KS_at,
+ KC(108), KS_backslash, KS_bar,
+ KC(113), KS_comma, KS_semicolon,
+ KC(114), KS_period, KS_colon,
+ KC(115), KS_slash, KS_underscore,
+ KC(115), KS_minus, KS_question,
+};
+
+#define KBD_MAP(name, base, map) \
+ { name, base, sizeof(map)/sizeof(keysym_t), map }
+
+const struct wscons_keydesc hilkbd_keydesctab[] = {
+ KBD_MAP(KB_US, 0, hilkbd_keydesc_us),
+ KBD_MAP(KB_UK, KB_US, hilkbd_keydesc_uk),
+ KBD_MAP(KB_SV, KB_US, hilkbd_keydesc_sv),
+ {0, 0, 0, 0},
+};
+
+/*
+ * Keyboard ID to layout table
+ */
+const kbd_t hilkbd_layouts[MAXHILKBDLAYOUT] = {
+ -1, /* 00 Undefined or custom layout */
+ -1, /* 01 Undefined */
+ -1, /* 02 Japanese */
+ -1, /* 03 Swiss french */
+ -1, /* 04 Portuguese */
+ -1, /* 05 Arabic */
+ -1, /* 06 Hebrew */
+ -1, /* 07 Canada English */
+ -1, /* 08 Turkish */
+ -1, /* 09 Greek */
+ -1, /* 0a Thai */
+ -1, /* 0b Italian */
+ -1, /* 0c Korean */
+ -1, /* 0d Dutch */
+ KB_SV, /* 0e Swedish */
+ -1, /* 0f German */
+ -1, /* 10 Simplified Chinese */
+ -1, /* 11 Traditional Chinese */
+ -1, /* 12 Swiss French 2 */
+ -1, /* 13 Euro Spanish */
+ -1, /* 14 Swiss German 2*/
+ -1, /* 15 Belgian */
+ -1, /* 16 Finnish */
+ KB_UK, /* 17 UK English */
+ -1, /* 18 Canada French */
+ -1, /* 19 Swiss German */
+ -1, /* 1a Norwegian */
+ -1, /* 1b French */
+ -1, /* 1c Danish */
+ -1, /* 1d Katakana */
+ -1, /* 1e Latin Spanish */
+ KB_US, /* 1f US ASCII */
+};
diff --git a/sys/dev/hil/hilkbdmap.h b/sys/dev/hil/hilkbdmap.h
new file mode 100644
index 00000000000..8e1edbecb9e
--- /dev/null
+++ b/sys/dev/hil/hilkbdmap.h
@@ -0,0 +1,33 @@
+/* $OpenBSD: hilkbdmap.h,v 1.1 2003/02/11 19:39:30 miod Exp $ */
+/*
+ * Copyright (c) 2003, Miodrag Vallat.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+extern const struct wscons_keydesc hilkbd_keydesctab[];
+
+#define MAXHILKBDLAYOUT 0x20
+
+extern const kbd_t hilkbd_layouts[MAXHILKBDLAYOUT];
diff --git a/sys/dev/hil/hilreg.h b/sys/dev/hil/hilreg.h
new file mode 100644
index 00000000000..2eff975ac6a
--- /dev/null
+++ b/sys/dev/hil/hilreg.h
@@ -0,0 +1,149 @@
+/* $OpenBSD: hilreg.h,v 1.1 2003/02/11 19:39:30 miod Exp $ */
+/* $NetBSD: hilreg.h,v 1.6 1997/02/02 09:39:21 thorpej Exp $ */
+
+/*
+ * Copyright (c) 1988 University of Utah.
+ * Copyright (c) 1990, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * the Systems Programming Group of the University of Utah Computer
+ * Science Department.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * from: Utah $Hdr: hilreg.h 1.10 92/01/21$
+ *
+ * @(#)hilreg.h 8.1 (Berkeley) 6/10/93
+ */
+
+#include <machine/hil_machdep.h>
+
+#define HIL_BUSY 0x02
+#define HIL_DATA_RDY 0x01
+
+/* HIL status bits */
+#define HIL_POLLDATA 0x10 /* HIL poll data follows */
+#define HIL_COMMAND 0x08 /* Start of original command */
+#define HIL_ERROR 0x80 /* HIL error */
+#define HIL_RECONFIG 0x80 /* HIL has reconfigured */
+#define HIL_STATMASK (HIL_DATA | HIL_COMMAND)
+
+#define HIL_SSHIFT 4 /* Bits to shift status over */
+#define HIL_SMASK 0x0f /* Service request status mask */
+#define HIL_DEVMASK 0x07
+
+/* HIL status types */
+#define HIL_68K 0x04 /* Data from the 68k is ready */
+#define HIL_STATUS 0x05 /* HIL status in data register */
+#define HIL_DATA 0x06 /* HIL data in data register */
+#define HIL_CTRLSHIFT 0x08 /* key + CTRL + SHIFT */
+#define HIL_CTRL 0x09 /* key + CTRL */
+#define HIL_SHIFT 0x0a /* key + SHIFT */
+#define HIL_KEY 0x0b /* key only */
+
+/* HIL commands */
+#define HIL_IDENTIFY 0x03 /* Get device information */
+#define HIL_READTIME 0x13 /* Read real time register */
+#define HIL_RNAME 0x30 /* Report name */
+#define HIL_RSTATUS 0x31 /* Report status */
+#define HIL_DESCRIBE 0x32 /* Extended describe */
+#define HIL_SECURITY 0x33 /* Read security bits */
+#define HIL_DKR 0x3d /* Disable auto repeat */
+#define HIL_ER1 0x3e /* Enable auto repeat 1/30 */
+#define HIL_ER2 0x3f /* Enable auto repeat 1/60 */
+#define HIL_PROMPT1 0x40 /* Prompt #1 */
+#define HIL_PROMPT2 0x41 /* Prompt #2 */
+#define HIL_PROMPT3 0x42 /* Prompt #3 */
+#define HIL_PROMPT4 0x43 /* Prompt #4 */
+#define HIL_PROMPT5 0x44 /* Prompt #5 */
+#define HIL_PROMPT6 0x45 /* Prompt #6 */
+#define HIL_PROMPT7 0x46 /* Prompt #7 */
+#define HIL_PROMPT 0x47 /* Prompt */
+#define HIL_ACK1 0x48 /* Acknowledge #1 */
+#define HIL_ACK2 0x49 /* Acknowledge #2 */
+#define HIL_ACK3 0x4a /* Acknowledge #3 */
+#define HIL_ACK4 0x4b /* Acknowledge #4 */
+#define HIL_ACK5 0x4c /* Acknowledge #5 */
+#define HIL_ACK6 0x4d /* Acknowledge #6 */
+#define HIL_ACK7 0x4e /* Acknowledge #7 */
+#define HIL_ACK 0x4f /* Acknowledge */
+#define HIL_INTON 0x5c /* Turn on interrupts. */
+#define HIL_INTOFF 0x5d /* Turn off interrupts. */
+#define HIL_SETARD 0xa0 /* Set auto-repeat delay */
+#define HIL_SETARR 0xa2 /* Set auto-repeat rate */
+#define HIL_SETTONE 0xa3 /* Set tone generator */
+#define HIL_CNMT 0xb2 /* Clear nmi */
+#define HIL_TRIGGER 0xc5 /* Trigger command */
+#define HIL_STARTCMD 0xe0 /* Start loop command */
+#define HIL_TIMEOUT 0xfe /* Timeout */
+
+/* Read/write various registers on the 8042. */
+#define HIL_READBUSY 0x02 /* internal "busy" register */
+#define HIL_READKBDLANG 0x12 /* read keyboard language code */
+#define HIL_WRITEKBDSADR 0xe9
+#define HIL_WRITELPSTAT 0xea
+#define HIL_WRITELPCTRL 0xeb
+#define HIL_READKBDSADR 0xf9
+#define HIL_READLPSTAT 0xfa
+#define HIL_READLPCTRL 0xfb
+
+/* BUSY bits */
+#define BSY_LOOPBUSY 0x04
+
+/* LPCTRL bits */
+#define LPC_AUTOPOLL 0x01 /* enable auto-polling */
+#define LPC_NOERROR 0x02 /* don't report errors */
+#define LPC_NORECONF 0x04 /* don't report reconfigure */
+#define LPC_KBDCOOK 0x10 /* cook all keyboards */
+#define LPC_RECONF 0x80 /* reconfigure the loop */
+
+/* LPSTAT bits */
+#define LPS_DEVMASK 0x07 /* number of loop devices */
+#define LPS_CONFGOOD 0x08 /* reconfiguration worked */
+#define LPS_CONFFAIL 0x80 /* reconfiguration failed */
+
+/* HIL packet headers */
+#define HIL_MOUSEDATA 0x02
+#define HIL_KBDDATA 0x40
+
+#define HIL_MOUSEMOTION 0x02 /* mouse movement event */
+#define HIL_TABLET 0x02 /* tablet motion event */
+#define HIL_KNOBBOX 0x03 /* knob box motion data */
+#define HIL_KBDBUTTON 0x40 /* keyboard button event */
+#define HIL_MOUSEBUTTON 0x40 /* mouse button event */
+#define HIL_BUTTONBOX 0x60 /* button box event */
+
+/* ID module defines */
+#define HILSCBIT 0x04
+
+/* For setting auto repeat on the keyboard */
+#define ar_format(x) ~((x - 10) / 10)
+#define KBD_ARD 400 /* initial delay in msec (10 - 2560) */
+#define KBD_ARR 60 /* rate (10 - 2550 msec, 2551 == off) */
diff --git a/sys/dev/hil/hilvar.h b/sys/dev/hil/hilvar.h
new file mode 100644
index 00000000000..4611629afb5
--- /dev/null
+++ b/sys/dev/hil/hilvar.h
@@ -0,0 +1,111 @@
+/* $OpenBSD: hilvar.h,v 1.1 2003/02/11 19:39:30 miod Exp $ */
+/*
+ * Copyright (c) 2003, Miodrag Vallat.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+/*
+ * Copyright (c) 1988 University of Utah.
+ * Copyright (c) 1990, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * the Systems Programming Group of the University of Utah Computer
+ * Science Department.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * from: Utah $Hdr: hilvar.h 1.3 92/01/21$
+ *
+ * @(#)hilvar.h 8.1 (Berkeley) 6/10/93
+ */
+
+#define NHILD 8 /* 7 actual + loop pseudo (dev 0) */
+
+struct hil_cb {
+ void (*cb_fn)(void *, u_int, u_char *);
+ void *cb_arg;
+};
+
+struct hil_softc {
+ struct device sc_dev;
+ bus_space_handle_t sc_bsh;
+ bus_space_tag_t sc_bst;
+
+ u_char sc_cmddone;
+ u_char sc_cmdending;
+ u_char sc_actdev; /* current input device */
+ u_char sc_cmddev; /* device to perform command on */
+ u_char sc_pollbuf[HILBUFSIZE]; /* interrupt time input buffer */
+ u_char sc_cmdbuf[HILBUFSIZE];
+ u_char *sc_pollbp; /* pointer into sc_pollbuf */
+ u_char *sc_cmdbp; /* pointer into sc_cmdbuf */
+
+ u_char sc_maxdev; /* number of devices on loop */
+ u_char sc_kbddev; /* keyboard device id */
+ struct hil_cb sc_cb[NHILD]; /* interrupt dispatcher */
+};
+
+#ifdef _KERNEL
+
+void send_hil_cmd(struct hil_softc *, u_char, u_char *, u_char, u_char *);
+void send_hildev_cmd(struct hil_softc *, char, char);
+void hil_set_poll(struct hil_softc *, int);
+int hil_poll_data(struct hil_softc *, u_char *, u_char *);
+
+void hil_attach(struct hil_softc *);
+void hil_attach_deferred(void *);
+void hil_callback_register(struct hil_softc *, int,
+ void (*)(void *, u_int, u_char *), void *);
+int hil_intr(void *);
+int hildevprint(void *, const char *);
+
+#endif /* _KERNEL */