diff options
author | Hugh Graham <hugh@cvs.openbsd.org> | 2001-05-16 22:15:20 +0000 |
---|---|---|
committer | Hugh Graham <hugh@cvs.openbsd.org> | 2001-05-16 22:15:20 +0000 |
commit | e8dd1b88bd968b7449a1c61238b069d768c2931c (patch) | |
tree | b32bd4a1892e3d1eaa590edab70abb6fabbd7c42 /sys | |
parent | cef3dbb0f27f1eb7a93933a18167f22264dc3383 (diff) |
Blind merge of wscons support from NetBSD/vax. Perhaps someone with a
supported framebuffer (simple monochrome) can finish this off.
If anyone has run across docs for LCG or SPGFX, please get in touch.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/vax/conf/files.vax | 30 | ||||
-rw-r--r-- | sys/arch/vax/dec/dzkbd.c | 325 | ||||
-rw-r--r-- | sys/arch/vax/dec/dzkbdvar.h | 18 | ||||
-rw-r--r-- | sys/arch/vax/dec/dzms.c | 269 | ||||
-rw-r--r-- | sys/arch/vax/dec/files.dec | 17 | ||||
-rw-r--r-- | sys/arch/vax/dec/lk201.h | 146 | ||||
-rw-r--r-- | sys/arch/vax/dec/lk201_ws.c | 179 | ||||
-rw-r--r-- | sys/arch/vax/dec/lk201reg.h | 64 | ||||
-rw-r--r-- | sys/arch/vax/dec/lk201var.h | 52 | ||||
-rw-r--r-- | sys/arch/vax/dec/wskbdmap_lk201.c | 137 | ||||
-rw-r--r-- | sys/arch/vax/dec/wskbdmap_lk201.h | 7 | ||||
-rw-r--r-- | sys/arch/vax/qbus/dz.c | 8 | ||||
-rw-r--r-- | sys/arch/vax/qbus/dzvar.h | 9 | ||||
-rw-r--r-- | sys/arch/vax/qbus/files.uba | 4 | ||||
-rw-r--r-- | sys/arch/vax/vax/conf.c | 25 | ||||
-rw-r--r-- | sys/arch/vax/vax/subr.s | 3 | ||||
-rw-r--r-- | sys/arch/vax/vsa/dz_ibus.c | 141 | ||||
-rw-r--r-- | sys/arch/vax/vsa/smg.c | 324 |
18 files changed, 1568 insertions, 190 deletions
diff --git a/sys/arch/vax/conf/files.vax b/sys/arch/vax/conf/files.vax index b74ad477580..3f42b577596 100644 --- a/sys/arch/vax/conf/files.vax +++ b/sys/arch/vax/conf/files.vax @@ -1,4 +1,4 @@ -# $OpenBSD: files.vax,v 1.23 2001/05/11 07:13:16 deraadt Exp $ +# $OpenBSD: files.vax,v 1.24 2001/05/16 22:15:18 hugh Exp $ # $NetBSD: files.vax,v 1.60 1999/08/27 20:04:32 ragge Exp $ # # new style config file for vax architecture @@ -126,6 +126,14 @@ device ry: disk attach ry at hdc major {ry = 24} +# +# Bus-independent support for DEC devices +# +include "arch/vax/dec/files.dec" + +# wscons files. +include "dev/wscons/files.wscons" + # RAM Disk for install floppy major {rd = 23} @@ -148,13 +156,21 @@ attach le at vsbus with le_vsbus file arch/vax/vsa/if_le_vsbus.c le_vsbus # Monochrome framebuffer on VS3100. -device smg: qfont +device smg: wsemuldisplaydev attach smg at vsbus file arch/vax/vsa/smg.c smg needs-flag -device lkc: qfont -attach lkc at dz -file arch/vax/vsa/lkc.c lkc needs-flag +device lkkbd: wskbddev +attach lkkbd at dz with dzkbd +file arch/vax/dec/dzkbd.c dzkbd needs-flag + +device lkms: wsmousedev +attach lkms at dz with dzms +file arch/vax/dec/dzms.c dzms needs-flag + +#device lkc: qfont +#attach lkc at dz +#file arch/vax/vsa/lkc.c lkc needs-flag # These devices aren't tested (or even compiled!) # They are just included here to make some files happy ;) @@ -364,7 +380,3 @@ include "compat/ultrix/files.ultrix" #arch/vax/if/if_pcl.c optional pcl device-driver #arch/vax/if/if_vv.c optional vv device-driver #arch/vax/if/raw_hy.c optional hy device-driver - -# wscons files. -include "dev/wscons/files.wscons" - diff --git a/sys/arch/vax/dec/dzkbd.c b/sys/arch/vax/dec/dzkbd.c new file mode 100644 index 00000000000..b96949d9848 --- /dev/null +++ b/sys/arch/vax/dec/dzkbd.c @@ -0,0 +1,325 @@ +/* $OpenBSD: dzkbd.c,v 1.1 2001/05/16 22:15:17 hugh Exp $ */ +/* $NetBSD: dzkbd.c,v 1.1 2000/12/02 17:03:55 ragge Exp $ */ + +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This software was developed by the Computer Systems Engineering group + * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and + * contributed to Berkeley. + * + * 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, Lawrence Berkeley Laboratory. + * + * 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. + * + * @(#)kbd.c 8.2 (Berkeley) 10/30/93 + */ + +/* + * LK200/LK400 keyboard attached to line 0 of the DZ*-11 + */ + +#include <sys/param.h> +#include <sys/systm.h> +#include <sys/device.h> +#include <sys/ioctl.h> +#include <sys/syslog.h> +#include <sys/malloc.h> + +#include <dev/wscons/wsconsio.h> +#include <dev/wscons/wskbdvar.h> +#include <dev/wscons/wsksymdef.h> +#include <dev/wscons/wsksymvar.h> +#include "../dec/wskbdmap_lk201.h" + +#include <machine/bus.h> + +#include "../qbus/dzreg.h" +#include "../qbus/dzvar.h" + +#include "../dec/dzkbdvar.h" +#include "../dec/lk201reg.h" +#include "../dec/lk201var.h" + +struct dzkbd_internal { + struct dz_linestate *dzi_ls; + struct lk201_state dzi_ks; +}; + +struct dzkbd_internal dzkbd_console_internal; + +struct dzkbd_softc { + struct device dzkbd_dev; /* required first: base device */ + + struct dzkbd_internal *sc_itl; + + int sc_enabled; + int kbd_type; + + struct device *sc_wskbddev; +}; + +static int dzkbd_input __P((void *, int)); + +static int dzkbd_match __P((struct device *, struct cfdata *, void *)); +static void dzkbd_attach __P((struct device *, struct device *, void *)); + +struct cfattach dzkbd_ca = { + sizeof(struct dzkbd_softc), (cfmatch_t)dzkbd_match, dzkbd_attach, +}; + +struct cfdriver lkkbd_cd = { + NULL, "lkkbd", DV_DULL +}; + +static int dzkbd_enable __P((void *, int)); +static void dzkbd_set_leds __P((void *, int)); +static int dzkbd_ioctl __P((void *, u_long, caddr_t, int, struct proc *)); + +const struct wskbd_accessops dzkbd_accessops = { + dzkbd_enable, + dzkbd_set_leds, + dzkbd_ioctl, +}; + +static void dzkbd_cngetc(void *, u_int *, int *); +static void dzkbd_cnpollc(void *, int); + +const struct wskbd_consops dzkbd_consops = { + dzkbd_cngetc, + dzkbd_cnpollc, +}; + +static int dzkbd_sendchar __P((void *, u_char)); + +const struct wskbd_mapdata dzkbd_keymapdata = { + zskbd_keydesctab, +#ifdef DZKBD_LAYOUT + DZKBD_LAYOUT, +#else + KB_US | KB_LK401, +#endif +}; + +/* + * kbd_match: how is this dz line configured? + */ +static int +dzkbd_match(struct device *parent, struct cfdata *cf, void *aux) +{ + struct dzkm_attach_args *daa = aux; + +#define DZCF_LINE 0 +#define DZCF_LINE_DEFAULT 0 + + /* Exact match is better than wildcard. */ + if (cf->cf_loc[DZCF_LINE] == daa->daa_line) + return 2; + + /* This driver accepts wildcard. */ + if (cf->cf_loc[DZCF_LINE] == DZCF_LINE_DEFAULT) + return 1; + + return 0; +} + +static void +dzkbd_attach(struct device *parent, struct device *self, void *aux) +{ + struct dz_softc *dz = (void *)parent; + struct dzkbd_softc *dzkbd = (void *)self; + struct dzkm_attach_args *daa = aux; + struct dz_linestate *ls; + struct dzkbd_internal *dzi; + struct wskbddev_attach_args a; + int isconsole; + + dz->sc_dz[daa->daa_line].dz_catch = dzkbd_input; + dz->sc_dz[daa->daa_line].dz_private = dzkbd; + ls = &dz->sc_dz[daa->daa_line]; + + isconsole = (daa->daa_flags & DZKBD_CONSOLE); + + if (isconsole) { + dzi = &dzkbd_console_internal; + } else { + dzi = malloc(sizeof(struct dzkbd_internal), + M_DEVBUF, M_NOWAIT); + dzi->dzi_ks.attmt.sendchar = dzkbd_sendchar; + dzi->dzi_ks.attmt.cookie = ls; + dzi->dzi_ls = ls; + } + dzkbd->sc_itl = dzi; + + printf("\n"); + + if (!isconsole) + lk201_init(&dzi->dzi_ks); + + /* XXX should identify keyboard ID here XXX */ + /* XXX layout and the number of LED is varying XXX */ + + dzkbd->kbd_type = WSKBD_TYPE_LK201; + + dzkbd->sc_enabled = 1; + + a.console = isconsole; + a.keymap = &dzkbd_keymapdata; + a.accessops = &dzkbd_accessops; + a.accesscookie = dzkbd; + + dzkbd->sc_wskbddev = config_found(self, &a, wskbddevprint); +} + +int +dzkbd_cnattach(ls) + struct dz_linestate *ls; +{ + + dzkbd_console_internal.dzi_ks.attmt.sendchar = dzkbd_sendchar; + dzkbd_console_internal.dzi_ks.attmt.cookie = ls; + lk201_init(&dzkbd_console_internal.dzi_ks); + dzkbd_console_internal.dzi_ls = ls; + + wskbd_cnattach(&dzkbd_consops, &dzkbd_console_internal, + &dzkbd_keymapdata); + + return 0; +} + +static int +dzkbd_enable(v, on) + void *v; + int on; +{ + struct dzkbd_softc *sc = v; + + sc->sc_enabled = on; + return 0; +} + +static int +dzkbd_sendchar(v, c) + void *v; + u_char c; +{ + struct dz_linestate *ls = v; + int s; + + s = spltty(); + dzputc(ls, c); + splx(s); + return (0); +} + +static void +dzkbd_cngetc(v, type, data) + void *v; + u_int *type; + int *data; +{ + struct dzkbd_internal *dzi = v; + int c; + + do { + c = dzgetc(dzi->dzi_ls); + } while (!lk201_decode(&dzi->dzi_ks, c, type, data)); +} + +static void +dzkbd_cnpollc(v, on) + void *v; + int on; +{ +#if 0 + struct dzkbd_internal *dzi = v; +#endif +} + +static void +dzkbd_set_leds(v, leds) + void *v; + int leds; +{ + struct dzkbd_softc *sc = (struct dzkbd_softc *)v; + +//printf("dzkbd_set_leds\n"); + lk201_set_leds(&sc->sc_itl->dzi_ks, leds); +} + +static int +dzkbd_ioctl(v, cmd, data, flag, p) + void *v; + u_long cmd; + caddr_t data; + int flag; + struct proc *p; +{ + struct dzkbd_softc *sc = (struct dzkbd_softc *)v; + + switch (cmd) { + case WSKBDIO_GTYPE: + *(int *)data = sc->kbd_type; + return 0; + case WSKBDIO_SETLEDS: + lk201_set_leds(&sc->sc_itl->dzi_ks, *(int *)data); + return 0; + case WSKBDIO_GETLEDS: + /* XXX don't dig in kbd internals */ + *(int *)data = sc->sc_itl->dzi_ks.leds_state; + return 0; + case WSKBDIO_COMPLEXBELL: + lk201_bell(&sc->sc_itl->dzi_ks, + (struct wskbd_bell_data *)data); + return 0; + } + return -1; +} + +static int +dzkbd_input(v, data) + void *v; + int data; +{ + struct dzkbd_softc *sc = (struct dzkbd_softc *)v; + u_int type; + int val; + + if (sc->sc_enabled == 0) + return(0); + + if (lk201_decode(&sc->sc_itl->dzi_ks, data, &type, &val)) + wskbd_input(sc->sc_wskbddev, type, val); + return(1); +} + diff --git a/sys/arch/vax/dec/dzkbdvar.h b/sys/arch/vax/dec/dzkbdvar.h new file mode 100644 index 00000000000..e0de4e9b7bf --- /dev/null +++ b/sys/arch/vax/dec/dzkbdvar.h @@ -0,0 +1,18 @@ +/* $OpenBSD: dzkbdvar.h,v 1.1 2001/05/16 22:15:17 hugh Exp $ */ +/* $NetBSD: dzkbdvar.h,v 1.2 2001/03/06 07:40:52 matt Exp $ */ + +struct dzkm_attach_args { + int daa_line; /* Line to search */ + int daa_flags; /* Console etc...*/ +#define DZKBD_CONSOLE 1 +}; + + + +/* These functions must be present for the keyboard/mouse to work */ +int dzgetc(struct dz_linestate *); +void dzputc(struct dz_linestate *, int); +void dzsetlpr(struct dz_linestate *, int); + +/* Exported functions */ +int dzkbd_cnattach(struct dz_linestate *); diff --git a/sys/arch/vax/dec/dzms.c b/sys/arch/vax/dec/dzms.c new file mode 100644 index 00000000000..60abd4f0901 --- /dev/null +++ b/sys/arch/vax/dec/dzms.c @@ -0,0 +1,269 @@ +/* $OpenBSD: dzms.c,v 1.1 2001/05/16 22:15:17 hugh Exp $ */ +/* $NetBSD: dzms.c,v 1.1 2000/12/02 17:03:55 ragge Exp $ */ + +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This software was developed by the Computer Systems Engineering group + * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and + * contributed to Berkeley. + * + * 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, Lawrence Berkeley Laboratory. + * + * 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. + * + * @(#)ms.c 8.1 (Berkeley) 6/11/93 + */ + +/* + * VSXXX mice attached to line 1 of the DZ* + */ + +#include <sys/param.h> +#include <sys/systm.h> +#include <sys/device.h> +#include <sys/ioctl.h> +#include <sys/syslog.h> + +#include <machine/bus.h> + +#include "../qbus/dzreg.h" +#include "../qbus/dzvar.h" + +#include "../dec/dzkbdvar.h" +#include "../dec/lk201.h" + +#include <dev/wscons/wsconsio.h> +#include <dev/wscons/wsmousevar.h> + +struct dzms_softc { /* driver status information */ + struct device dzms_dev; /* required first: base device */ + struct dz_linestate *dzms_ls; + + int sc_enabled; /* input enabled? */ + int self_test; + + int inputstate; + u_int buttons; + signed char dx; + signed char dy; + + struct device *sc_wsmousedev; +}; + +static int dzms_match __P((struct device *, struct cfdata *, void *)); +static void dzms_attach __P((struct device *, struct device *, void *)); +static int dzms_input __P((void *, int)); + +struct cfattach dzms_ca = { + sizeof(struct dzms_softc), (cfmatch_t)dzms_match, dzms_attach, +}; + +struct cfdriver lkms_cd = { + NULL, "lkms", DV_DULL +}; + +static int dzms_enable __P((void *)); +static int dzms_ioctl __P((void *, u_long, caddr_t, int, struct proc *)); +static void dzms_disable __P((void *)); + +const struct wsmouse_accessops dzms_accessops = { + dzms_enable, + dzms_ioctl, + dzms_disable, +}; + +static int +dzms_match(parent, cf, aux) + struct device *parent; + struct cfdata *cf; + void *aux; +{ + struct dzkm_attach_args *daa = aux; + +#define DZCF_LINE 0 +#define DZCF_LINE_DEFAULT 0 + + /* Exact match is better than wildcard. */ + if (cf->cf_loc[DZCF_LINE] == daa->daa_line) + return 2; + + /* This driver accepts wildcard. */ + if (cf->cf_loc[DZCF_LINE] == DZCF_LINE_DEFAULT) + return 1; + + return 0; +} + +static void +dzms_attach(parent, self, aux) + struct device *parent, *self; + void *aux; +{ + struct dz_softc *dz = (void *)parent; + struct dzms_softc *dzms = (void *)self; + struct dzkm_attach_args *daa = aux; + struct dz_linestate *ls; + struct wsmousedev_attach_args a; + + dz->sc_dz[daa->daa_line].dz_catch = dzms_input; + dz->sc_dz[daa->daa_line].dz_private = dzms; + ls = &dz->sc_dz[daa->daa_line]; + dzms->dzms_ls = ls; + + printf("\n"); + + a.accessops = &dzms_accessops; + a.accesscookie = dzms; + + dzms->sc_enabled = 0; + dzms->self_test = 0; + dzms->sc_wsmousedev = config_found(self, &a, wsmousedevprint); +} + +static int +dzms_enable(v) + void *v; +{ + struct dzms_softc *sc = v; + + if (sc->sc_enabled) + return EBUSY; + + /* XXX mice presence test should be done in match/attach context XXX */ + sc->self_test = 1; + dzputc(sc->dzms_ls, MOUSE_SELF_TEST); + DELAY(100000); + if (sc->self_test < 0) { + sc->self_test = 0; + return EBUSY; + } else if (sc->self_test == 5) { + sc->self_test = 0; + sc->sc_enabled = 1; + } + sc->inputstate = 0; + + dzputc(sc->dzms_ls, MOUSE_INCREMENTAL); + + return 0; +} + +static void +dzms_disable(v) + void *v; +{ + struct dzms_softc *sc = v; + + sc->sc_enabled = 0; +} + +static int +dzms_ioctl(v, cmd, data, flag, p) + void *v; + u_long cmd; + caddr_t data; + int flag; + struct proc *p; +{ + if (cmd == WSMOUSEIO_GTYPE) { + *(u_int *)data = WSMOUSE_TYPE_VSXXX; + return 0; + } + return -1; +} + +static int +dzms_input(vsc, data) + void *vsc; + int data; +{ + struct dzms_softc *sc = vsc; + + /* XXX mice presence test should be done in match/attach context XXX */ + if (!sc->sc_enabled) { + if (sc->self_test > 0) { + if (data < 0) { + printf("Timeout on 1st byte of mouse self-test report\n"); + sc->self_test = -1; + } else { + sc->self_test++; + } + } + if (sc->self_test == 3) { + if ((data & 0x0f) != 0x2) { + printf("We don't have a mouse!!!\n"); + sc->self_test = -1; + } + } + /* Interrupts are not expected. Discard the byte. */ + return(1); + } + +#define WSMS_BUTTON1 0x01 +#define WSMS_BUTTON2 0x02 +#define WSMS_BUTTON3 0x04 + + if ((data & MOUSE_START_FRAME) != 0) + sc->inputstate = 1; + else + sc->inputstate++; + + if (sc->inputstate == 1) { + sc->buttons = 0; + if ((data & LEFT_BUTTON) != 0) + sc->buttons |= WSMS_BUTTON1; + if ((data & MIDDLE_BUTTON) != 0) + sc->buttons |= WSMS_BUTTON2; + if ((data & RIGHT_BUTTON) != 0) + sc->buttons |= WSMS_BUTTON3; + + sc->dx = data & MOUSE_X_SIGN; + sc->dy = data & MOUSE_Y_SIGN; + } else if (sc->inputstate == 2) { + if (sc->dx == 0) + sc->dx = -data; + else + sc->dx = data; + } else if (sc->inputstate == 3) { + sc->inputstate = 0; + if (sc->dy == 0) + sc->dy = -data; + else + sc->dy = data; + wsmouse_input(sc->sc_wsmousedev, sc->buttons, + sc->dx, sc->dy, 0, WSMOUSE_INPUT_DELTA); + } + + return(1); +} + diff --git a/sys/arch/vax/dec/files.dec b/sys/arch/vax/dec/files.dec new file mode 100644 index 00000000000..921a5580518 --- /dev/null +++ b/sys/arch/vax/dec/files.dec @@ -0,0 +1,17 @@ +# $OpenBSD: files.dec,v 1.1 2001/05/16 22:15:17 hugh Exp $ +# $NetBSD: files.dec,v 1.4 1999/08/04 07:17:51 nisimura Exp $ +# +# Config file and device description for machine-independent +# code for devices for Digital Equipment Corp. systems. +# Included by ports that need it. + +# Attribute for DEC lance padded-DMA copy functions. Lance attachments +# which need it should specify the le_de_subr attribute. +define le_dec_subr + +# DMA copy functions. Lance attachments qhich Decices +file arch/vax/dec/if_le_dec.c le_dec_subr + +# LK201 keyboard +file arch/vax/dec/lk201_ws.c lkkbd +file arch/vax/dec/wskbdmap_lk201.c lkkbd diff --git a/sys/arch/vax/dec/lk201.h b/sys/arch/vax/dec/lk201.h new file mode 100644 index 00000000000..ce901212c8e --- /dev/null +++ b/sys/arch/vax/dec/lk201.h @@ -0,0 +1,146 @@ +/* $OpenBSD: lk201.h,v 1.1 2001/05/16 22:15:17 hugh Exp $ */ +/* $NetBSD: lk201.h,v 1.7 1999/03/19 18:34:01 ad Exp $ */ + + +/* + * Ascii values of command keys. + */ +#define KBD_TAB '\t' +#define KBD_DEL 127 +#define KBD_RET '\r' + +/* + * Define "hardware-independent" codes for the control, shift, meta and + * function keys. Codes start after the last 7-bit ASCII code (127) + * and are assigned in an arbitrary order. + */ +#define KBD_NOKEY 128 + +#define KBD_F1 201 +#define KBD_F2 202 +#define KBD_F3 203 +#define KBD_F4 204 +#define KBD_F5 205 +#define KBD_F6 206 +#define KBD_F7 207 +#define KBD_F8 208 +#define KBD_F9 209 +#define KBD_F10 210 +#define KBD_F11 211 +#define KBD_F12 212 +#define KBD_F13 213 +#define KBD_F14 214 +#define KBD_HELP 215 +#define KBD_DO 216 +#define KBD_F17 217 +#define KBD_F18 218 +#define KBD_F19 219 +#define KBD_F20 220 + +#define KBD_FIND 221 +#define KBD_INSERT 222 +#define KBD_REMOVE 223 +#define KBD_SELECT 224 +#define KBD_PREVIOUS 225 +#define KBD_NEXT 226 + +#define KBD_KP_ENTER 227 +#define KBD_KP_F1 228 +#define KBD_KP_F2 229 +#define KBD_KP_F3 230 +#define KBD_KP_F4 231 +#define KBD_LEFT 232 +#define KBD_RIGHT 233 +#define KBD_DOWN 234 +#define KBD_UP 235 + +#define KBD_CONTROL 236 +#define KBD_SHIFT 237 +#define KBD_CAPSLOCK 238 +#define KBD_ALTERNATE 239 + + + +/* + * Definitions for the Keyboard and mouse. + */ +/* + * Special key values. + */ +#define KEY_R_SHIFT 0xab +#define KEY_SHIFT 0xae +#define KEY_CONTROL 0xaf +#define KEY_CAPSLOCK 0xb0 +#define KEY_R_ALT 0xb2 +#define KEY_UP 0xb3 +#define KEY_REPEAT 0xb4 +#define KEY_F1 0x56 +#define KEY_COMMAND KEY_F1 + +/* + * Lk201/301 keyboard + */ +#define LK_UPDOWN 0x86 /* bits for setting lk201 modes */ +#define LK_AUTODOWN 0x82 +#define LK_DOWN 0x80 +#define LK_DEFAULTS 0xd3 /* reset mode settings */ +#define LK_AR_ENABLE 0xe3 /* global auto repeat enable */ +#define LK_CL_ENABLE 0x1b /* keyclick enable */ +#define LK_KBD_ENABLE 0x8b /* keyboard enable */ +#define LK_BELL_ENABLE 0x23 /* the bell */ +#define LK_LED_ENABLE 0x13 /* light led */ +#define LK_LED_DISABLE 0x11 /* turn off led */ +#define LK_RING_BELL 0xa7 /* ring keyboard bell */ +#define LED_1 0x81 /* led bits */ +#define LED_2 0x82 +#define LED_3 0x84 +#define LED_4 0x88 +#define LED_ALL 0x8f +#define LK_HELP 0x7c /* help key */ +#define LK_DO 0x7d /* do key */ +#define LK_KDOWN_ERROR 0x3d /* key down on powerup error */ +#define LK_POWER_ERROR 0x3e /* keyboard failure on pwrup tst*/ +#define LK_OUTPUT_ERROR 0xb5 /* keystrokes lost during inhbt */ +#define LK_INPUT_ERROR 0xb6 /* garbage command to keyboard */ +#define LK_LOWEST 0x56 /* lowest significant keycode */ + +/* max volume is 0, lowest is 0x7 */ +#define LK_PARAM_VOLUME(v) (0x80|((v)&0x7)) + +/* mode command details */ +#define LK_CMD_MODE(m,div) ((m)|((div)<<3)) + + +/* + * Command characters for the mouse. + */ +#define MOUSE_SELF_TEST 'T' +#define MOUSE_INCREMENTAL 'R' + +/* + * Mouse output bits. + * + * MOUSE_START_FRAME Start of report frame bit. + * MOUSE_X_SIGN Sign bit for X. + * MOUSE_Y_SIGN Sign bit for Y. + * MOUSE_X_OFFSET X offset to start cursor at. + * MOUSE_Y_OFFSET Y offset to start cursor at. + */ +#define MOUSE_START_FRAME 0x80 +#define MOUSE_X_SIGN 0x10 +#define MOUSE_Y_SIGN 0x08 + +/* + * Definitions for mouse buttons + */ +#define EVENT_LEFT_BUTTON 0x01 +#define EVENT_MIDDLE_BUTTON 0x02 +#define EVENT_RIGHT_BUTTON 0x03 +#define RIGHT_BUTTON 0x01 +#define MIDDLE_BUTTON 0x02 +#define LEFT_BUTTON 0x04 + +#ifdef _KERNEL +extern int LKgetc __P((dev_t dev)); +extern void lkdivert __P ((int (*getc_fn)(dev_t dev), dev_t dev)); +#endif diff --git a/sys/arch/vax/dec/lk201_ws.c b/sys/arch/vax/dec/lk201_ws.c new file mode 100644 index 00000000000..0d9cfb56a5e --- /dev/null +++ b/sys/arch/vax/dec/lk201_ws.c @@ -0,0 +1,179 @@ +/* $OpenBSD: lk201_ws.c,v 1.1 2001/05/16 22:15:17 hugh Exp $ */ +/* $NetBSD: lk201_ws.c,v 1.2 1998/10/22 17:55:20 drochner Exp $ */ + +/* + * Copyright (c) 1998 + * Matthias Drochner. 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed for the NetBSD Project + * by Matthias Drochner. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 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 <dev/wscons/wsconsio.h> + +#include "../dec/lk201reg.h" +#include "../dec/lk201var.h" +#include "../dec/wskbdmap_lk201.h" /* for {MIN,MAX}_LK201_KEY */ + +#define send(lks, c) ((*((lks)->attmt.sendchar))((lks)->attmt.cookie, c)) + +int +lk201_init(lks) + struct lk201_state *lks; +{ + int i; + + send(lks, LK_LED_ENABLE); + send(lks, LK_LED_ALL); + + /* + * set all keys to updown mode; autorepeat is + * done by wskbd software + */ + for (i = 1; i <= 14; i++) + send(lks, LK_CMD_MODE(LK_UPDOWN, i)); + + send(lks, LK_CL_ENABLE); + send(lks, LK_PARAM_VOLUME(3)); + + lks->bellvol = -1; /* not yet set */ + + for (i = 0; i < LK_KLL; i++) + lks->down_keys_list[i] = -1; + send(lks, LK_KBD_ENABLE); + + send(lks, LK_LED_DISABLE); + send(lks, LK_LED_ALL); + lks->leds_state = 0; + + return (0); +} + +int +lk201_decode(lks, datain, type, dataout) + struct lk201_state *lks; + int datain; + u_int *type; + int *dataout; +{ + int i, freeslot; + + switch (datain) { + case LK_KEY_UP: + for (i = 0; i < LK_KLL; i++) + lks->down_keys_list[i] = -1; + *type = WSCONS_EVENT_ALL_KEYS_UP; + return (1); + case LK_POWER_UP: + printf("lk201_decode: powerup detected\n"); + lk201_init(lks); + return (0); + case LK_KDOWN_ERROR: + case LK_POWER_ERROR: + case LK_OUTPUT_ERROR: + case LK_INPUT_ERROR: + printf("lk201_decode: error %x\n", datain); + /* FALLTHRU */ + case LK_KEY_REPEAT: /* autorepeat handled by wskbd */ + case LK_MODE_CHANGE: /* ignore silently */ + return (0); + } + + if (datain < MIN_LK201_KEY || datain > MAX_LK201_KEY) { + printf("lk201_decode: %x\n", datain); + return (0); + } + + *dataout = datain - MIN_LK201_KEY; + + freeslot = -1; + for (i = 0; i < LK_KLL; i++) { + if (lks->down_keys_list[i] == datain) { + *type = WSCONS_EVENT_KEY_UP; + lks->down_keys_list[i] = -1; + return (1); + } + if (lks->down_keys_list[i] == -1 && freeslot == -1) + freeslot = i; + } + + if (freeslot == -1) { + printf("lk201_decode: down(%d) no free slot\n", datain); + return (0); + } + + *type = WSCONS_EVENT_KEY_DOWN; + lks->down_keys_list[freeslot] = datain; + return (1); +} + +void +lk201_bell(lks, bell) + struct lk201_state *lks; + struct wskbd_bell_data *bell; +{ + unsigned int vol; + + if (bell->which & WSKBD_BELL_DOVOLUME) { + vol = 8 - bell->volume * 8 / 100; + if (vol > 7) + vol = 7; + } else + vol = 3; + + if (vol != lks->bellvol) { + send(lks, LK_BELL_ENABLE); + send(lks, LK_PARAM_VOLUME(vol)); + lks->bellvol = vol; + } + send(lks, LK_RING_BELL); +} + +void +lk201_set_leds(lks, leds) + struct lk201_state *lks; + int leds; +{ + int newleds; + + newleds = 0; + if (leds & WSKBD_LED_SCROLL) + newleds |= LK_LED_WAIT; + if (leds & WSKBD_LED_CAPS) + newleds |= LK_LED_LOCK; + + send(lks, LK_LED_DISABLE); + send(lks, (0x80 | (~newleds & 0x0f))); + + send(lks, LK_LED_ENABLE); + send(lks, (0x80 | (newleds & 0x0f))); + + lks->leds_state = leds; +} diff --git a/sys/arch/vax/dec/lk201reg.h b/sys/arch/vax/dec/lk201reg.h new file mode 100644 index 00000000000..5bfdde2dbf4 --- /dev/null +++ b/sys/arch/vax/dec/lk201reg.h @@ -0,0 +1,64 @@ +/* $OpenBSD: lk201reg.h,v 1.1 2001/05/16 22:15:17 hugh Exp $ */ +/* $NetBSD: lk201reg.h,v 1.1 1998/09/17 20:01:57 drochner Exp $ */ + +/* + * command keycodes for Digital LK200/LK400 series keyboards. + */ + +/* + * special keycodes + */ +#define LK_POWER_UP 0x01 +#define LK_KEY_R_SHIFT 0xab +#define LK_KEY_SHIFT 0xae +#define LK_KEY_LOCK 0xb0 +#define LK_KEY_CONTROL 0xaf +#define LK_KEY_R_ALT 0xb2 +#define LK_KEY_UP 0xb3 +#define LK_KEY_REPEAT 0xb4 +#define LK_KEY_HOLD 0x56 /* F1 */ +#define LK_KDOWN_ERROR 0x3d /* key down on powerup error */ +#define LK_POWER_ERROR 0x3e /* keyboard failure on pwrup tst*/ +#define LK_OUTPUT_ERROR 0xb5 /* keystrokes lost during inhbt */ +#define LK_INPUT_ERROR 0xb6 /* garbage command to keyboard */ +#define LK_LOWEST 0x56 /* lowest significant keycode */ + +/* + * keyboard commands + */ +#define LK_UPDOWN 0x86 /* bits for setting lk201 modes */ +#define LK_AUTODOWN 0x82 +#define LK_DOWN 0x80 +#define LK_DEFAULTS 0xd3 /* reset mode settings */ +#define LK_AR_ENABLE 0xe3 /* global auto repeat enable */ +#define LK_CL_ENABLE 0x1b /* keyclick enable */ +#define LK_CL_DISABLE 0x99 /* keyclick disable */ +#define LK_CCL_ENABLE 0xbb /* enable keyclick for CTRL */ +#define LK_CCL_DISABLE 0xb9 /* disable keyclick for CTRL */ +#define LK_KBD_ENABLE 0x8b /* keyboard enable */ +#define LK_BELL_ENABLE 0x23 /* enable the bell */ +#define LK_BELL_DISABLE 0xa1 /* disable the bell */ +#define LK_LED_ENABLE 0x13 /* light led */ +#define LK_LED_DISABLE 0x11 /* turn off led */ +#define LK_RING_BELL 0xa7 /* ring keyboard bell */ +#define LK_LED_1 0x81 /* led bits */ +#define LK_LED_2 0x82 +#define LK_LED_3 0x84 +#define LK_LED_4 0x88 +#define LK_LED_WAIT 0x81 +#define LK_LED_COMP 0x82 +#define LK_LED_LOCK 0x84 +#define LK_LED_HOLD 0x88 +#define LK_LED_ALL 0x8f +#define LK_HELP 0x7c /* help key */ +#define LK_DO 0x7d /* do key */ +#define LK_DIV6_START 0xad /* start of div 6 */ +#define LK_DIV5_END 0xb2 /* end of div 5 */ +#define LK_ENABLE_401 0xe9 /* turn on LK401 mode */ +#define LK_MODE_CHANGE 0xba /* mode change ack */ + +/* max volume is 0, lowest is 0x7 */ +#define LK_PARAM_VOLUME(v) (0x80|((v)&0x7)) + +/* mode command details */ +#define LK_CMD_MODE(m,div) ((m)|((div)<<3)) diff --git a/sys/arch/vax/dec/lk201var.h b/sys/arch/vax/dec/lk201var.h new file mode 100644 index 00000000000..1bb10ca2b09 --- /dev/null +++ b/sys/arch/vax/dec/lk201var.h @@ -0,0 +1,52 @@ +/* $OpenBSD: lk201var.h,v 1.1 2001/05/16 22:15:17 hugh Exp $ */ +/* $NetBSD: lk201var.h,v 1.2 1998/10/22 17:55:20 drochner Exp $ */ + +/* + * Copyright (c) 1998 + * Matthias Drochner. 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed for the NetBSD Project + * by Matthias Drochner. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 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. + * + */ + +struct lk201_attachment { + int (*sendchar) __P((void *, u_char)); + void *cookie; +}; + +struct lk201_state { + struct lk201_attachment attmt; +#define LK_KLL 8 + int down_keys_list[LK_KLL]; + int bellvol; + int leds_state; +}; + +int lk201_init __P((struct lk201_state *)); +int lk201_decode __P((struct lk201_state *, int, u_int *, int *)); +void lk201_bell __P((struct lk201_state *, struct wskbd_bell_data *)); +void lk201_set_leds __P((struct lk201_state *, int)); diff --git a/sys/arch/vax/dec/wskbdmap_lk201.c b/sys/arch/vax/dec/wskbdmap_lk201.c new file mode 100644 index 00000000000..779418bc35e --- /dev/null +++ b/sys/arch/vax/dec/wskbdmap_lk201.c @@ -0,0 +1,137 @@ +/* $OpenBSD: wskbdmap_lk201.c,v 1.1 2001/05/16 22:15:17 hugh Exp $ */ +/* $NetBSD: wskbdmap_lk201.c,v 1.4 2000/12/02 16:57:41 ragge Exp $ */ + +#include <sys/types.h> +#include <dev/wscons/wsksymdef.h> +#include <dev/wscons/wsksymvar.h> +#include "../dec/wskbdmap_lk201.h" + +#define KC(n) KS_KEYCODE((n) - MIN_LK201_KEY) + +static const keysym_t zskbd_keydesc_us[] = { +/* pos command normal shifted */ + KC(86), KS_Cmd_Screen0, KS_f1, + KC(87), KS_Cmd_Screen1, KS_f2, + KC(88), KS_Cmd_Screen2, KS_f3, + KC(89), KS_Cmd_Screen3, KS_f4, + KC(90), KS_Cmd_Screen4, KS_f5, + KC(100), KS_Cmd_Screen5, KS_f6, + KC(101), KS_Cmd_Screen6, KS_f7, + KC(102), KS_Cmd_Screen7, KS_f8, + KC(103), KS_Cmd_Screen8, KS_f9, + KC(104), KS_Cmd_Screen9, KS_f10, + KC(113), KS_Cmd_Debugger, KS_Escape, /* F11 */ + KC(114), KS_f12, + KC(115), KS_f13, + KC(116), KS_f14, + KC(124), KS_Help, + KC(125), KS_Cmd, KS_Execute, + KC(128), KS_f17, + KC(129), KS_f18, + KC(130), KS_f19, + KC(131), KS_f20, + KC(138), KS_Find, + KC(139), KS_Insert, + KC(140), KS_KP_Delete, + KC(141), KS_Select, + KC(142), KS_Prior, + KC(143), KS_Next, + KC(146), KS_KP_0, + KC(148), KS_KP_Decimal, + KC(149), KS_KP_Enter, + KC(150), KS_KP_1, + KC(151), KS_KP_2, + KC(152), KS_KP_3, + KC(153), KS_KP_4, + KC(154), KS_KP_5, + KC(155), KS_KP_6, + KC(156), KS_KP_Separator, + KC(157), KS_KP_7, + KC(158), KS_KP_8, + KC(159), KS_KP_9, + KC(160), KS_KP_Subtract, + KC(161), KS_KP_F1, + KC(162), KS_KP_F2, + KC(163), KS_KP_F3, + KC(164), KS_KP_F4, + KC(167), KS_Left, + KC(168), KS_Right, + KC(169), KS_Down, + KC(170), KS_Up, + KC(174), KS_Shift_L, + KC(175), KS_Cmd1, KS_Control_L, + KC(176), KS_Caps_Lock, + KC(177), KS_Cmd2, KS_Multi_key, /* (left) compose */ + KC(188), KS_Delete, + KC(189), KS_Return, + KC(190), KS_Tab, + KC(191), KS_grave, KS_asciitilde, + KC(192), KS_1, KS_exclam, + KC(193), KS_q, + KC(194), KS_a, + KC(195), KS_z, + KC(197), KS_2, KS_at, + KC(198), KS_w, + KC(199), KS_s, + KC(200), KS_x, + KC(201), KS_less, KS_greater, + KC(203), KS_3, KS_numbersign, + KC(204), KS_e, + KC(205), KS_d, + KC(206), KS_c, + KC(208), KS_4, KS_dollar, + KC(209), KS_r, + KC(210), KS_f, + KC(211), KS_v, + KC(212), KS_space, + KC(214), KS_5, KS_percent, + KC(215), KS_t, + KC(216), KS_g, + KC(217), KS_b, + KC(219), KS_6, KS_asciicircum, + KC(220), KS_y, + KC(221), KS_h, + KC(222), KS_n, + KC(224), KS_7, KS_ampersand, + KC(225), KS_u, + KC(226), KS_j, + KC(227), KS_m, + KC(229), KS_8, KS_asterisk, + KC(230), KS_i, + KC(231), KS_k, + KC(232), KS_comma, KS_less, + KC(234), KS_9, KS_parenleft, + KC(235), KS_o, + KC(236), KS_l, + KC(237), KS_period, KS_greater, + KC(239), KS_0, KS_parenright, + KC(240), KS_p, + KC(242), KS_semicolon, KS_colon, + KC(243), KS_slash, KS_question, + KC(245), KS_equal, KS_plus, + KC(246), KS_bracketright, KS_braceright, + KC(247), KS_backslash, KS_bar, + KC(249), KS_minus, KS_underscore, + KC(250), KS_bracketleft, KS_braceleft, + KC(251), KS_apostrophe, KS_quotedbl, +}; + +static const keysym_t zskbd_keydesc_us_lk401[] = { + KC(171), KS_Shift_R, + KC(172), KS_Cmd2, KS_Alt_L, + KC(173), KS_Multi_key, /* right compose */ + KC(177), KS_Multi_key, /* left compose, not "cmd" */ + KC(178), KS_Alt_R, +}; + +#define KBD_MAP(name, base, map) \ + { name, base, sizeof(map)/sizeof(keysym_t), map } + +const struct wscons_keydesc zskbd_keydesctab[] = { + KBD_MAP(KB_US, 0, zskbd_keydesc_us), + KBD_MAP(KB_US | KB_LK401, KB_US, zskbd_keydesc_us_lk401), + {0, 0, 0, 0} +}; + +#undef KBD_MAP +#undef KC diff --git a/sys/arch/vax/dec/wskbdmap_lk201.h b/sys/arch/vax/dec/wskbdmap_lk201.h new file mode 100644 index 00000000000..01b965b20a7 --- /dev/null +++ b/sys/arch/vax/dec/wskbdmap_lk201.h @@ -0,0 +1,7 @@ +/* $OpenBSD: wskbdmap_lk201.h,v 1.1 2001/05/16 22:15:18 hugh Exp $ */ +/* $NetBSD: wskbdmap_lk201.h,v 1.2 1998/09/17 19:59:30 drochner Exp $ */ + +#define MIN_LK201_KEY 86 +#define MAX_LK201_KEY 251 + +extern const struct wscons_keydesc zskbd_keydesctab[]; diff --git a/sys/arch/vax/qbus/dz.c b/sys/arch/vax/qbus/dz.c index e428e62165b..ac03501edf2 100644 --- a/sys/arch/vax/qbus/dz.c +++ b/sys/arch/vax/qbus/dz.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dz.c,v 1.2 2001/01/28 01:19:59 hugh Exp $ */ +/* $OpenBSD: dz.c,v 1.3 2001/05/16 22:15:18 hugh Exp $ */ /* $NetBSD: dz.c,v 1.19 2000/01/24 02:40:29 matt Exp $ */ /* * Copyright (c) 1996 Ken C. Wellsch. All rights reserved. @@ -177,7 +177,8 @@ dzrint(arg) tp = sc->sc_dz[line].dz_tty; /* Must be caught early */ - if (sc->sc_catch && (*sc->sc_catch)(line, cc)) + if (sc->sc_dz[line].dz_catch && + (*sc->sc_dz[line].dz_catch)(sc->sc_dz[line].dz_private, cc)) continue; if (!(tp->t_state & TS_ISOPEN)) { @@ -265,6 +266,9 @@ dzxint(arg) tcr &= ~(1 << line); DZ_WRITE_BYTE(dr_tcr, tcr); + if (sc->sc_dz[line].dz_catch) + continue; + if (tp->t_state & TS_FLUSH) tp->t_state &= ~TS_FLUSH; else diff --git a/sys/arch/vax/qbus/dzvar.h b/sys/arch/vax/qbus/dzvar.h index ae183c5f901..f429b085830 100644 --- a/sys/arch/vax/qbus/dzvar.h +++ b/sys/arch/vax/qbus/dzvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: dzvar.h,v 1.1 2000/04/27 03:14:47 bjc Exp $ */ +/* $OpenBSD: dzvar.h,v 1.2 2001/05/16 22:15:18 hugh Exp $ */ /* $NetBSD: dzvar.h,v 1.6 2000/01/24 02:40:29 matt Exp $ */ /* * Copyright (c) 1996 Ken C. Wellsch. All rights reserved. @@ -58,8 +58,11 @@ struct dz_softc { int sc_rxint; /* Receive interrupt count XXX */ u_char sc_brk; /* Break asserted on some lines */ u_char sc_dsr; /* DSR set bits if no mdm ctrl */ - int (*sc_catch) __P((int, int)); /* Fast catch recv */ - struct { + struct dz_linestate { + struct dz_softc *dz_sc; /* backpointer to softc */ + int dz_line; /* sub-driver unit number */ + void *dz_private; /* sub-driver data pointer */ + int (*dz_catch) __P((void *, int)); /* Fast catch recv */ struct tty * dz_tty; /* what we work on */ #ifdef notyet caddr_t dz_mem; /* pointers to clist output */ diff --git a/sys/arch/vax/qbus/files.uba b/sys/arch/vax/qbus/files.uba index 98761e6bf71..673fce57059 100644 --- a/sys/arch/vax/qbus/files.uba +++ b/sys/arch/vax/qbus/files.uba @@ -1,4 +1,4 @@ -# $OpenBSD: files.uba,v 1.1 2000/04/27 03:14:48 bjc Exp $ +# $OpenBSD: files.uba,v 1.2 2001/05/16 22:15:18 hugh Exp $ # $NetBSD: files.uba,v 1.6 1999/06/20 18:09:22 ragge Exp $ # # Config file and device description for machine-independent @@ -11,7 +11,7 @@ define qfont file arch/vax/qbus/uba.c uba # DZ-11 (-compatible) tty device driver. -device dz { }: tty +device dz { line = -1 }: tty attach dz at uba with dz_uba file arch/vax/qbus/dz.c dz needs-flag file arch/vax/qbus/dz_uba.c dz_uba diff --git a/sys/arch/vax/vax/conf.c b/sys/arch/vax/vax/conf.c index 9b3f5ed50ed..97a7f93d243 100644 --- a/sys/arch/vax/vax/conf.c +++ b/sys/arch/vax/vax/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.25 2001/04/18 16:15:20 hugh Exp $ */ +/* $OpenBSD: conf.c,v 1.26 2001/05/16 22:15:18 hugh Exp $ */ /* $NetBSD: conf.c,v 1.44 1999/10/27 16:38:54 ragge Exp $ */ /*- @@ -204,11 +204,15 @@ int bdevtomaj (bdev) */ #include <dev/cons.h> -#include "lkc.h" -#if NLKC -#define smgcngetc lkccngetc +#include "wskbd.h" +#if NWSKBD > 0 +#define smgcngetc wskbd_cngetc #else -#define smgcngetc nullcngetc +static int +smgcngetc(dev_t dev) +{ + return 0; +} #endif #define smgcnputc wsdisplay_cnputc @@ -666,6 +670,17 @@ iszerodev(dev) return (major(dev) == 3 && minor(dev) == 12); } +int +getmajor(void *ptr) +{ + int i; + + for (i = 0; i < nchrdev; i++) + if (cdevsw[i].d_open == ptr) + return i; + panic("getmajor"); +} + dev_t getnulldev() { diff --git a/sys/arch/vax/vax/subr.s b/sys/arch/vax/vax/subr.s index 278177289c0..cfb73bb404c 100644 --- a/sys/arch/vax/vax/subr.s +++ b/sys/arch/vax/vax/subr.s @@ -1,4 +1,4 @@ -/* $OpenBSD: subr.s,v 1.12 2001/03/16 03:11:00 bjc Exp $ */ +/* $OpenBSD: subr.s,v 1.13 2001/05/16 22:15:18 hugh Exp $ */ /* $NetBSD: subr.s,v 1.32 1999/03/25 00:41:48 mrg Exp $ */ /* @@ -472,6 +472,7 @@ ENTRY(suswintr,0) movl r1,r0 ret +ALTENTRY(fusword) ENTRY(fuswintr,0) movab 1f,*pcbtrap movl 4(ap),r0 diff --git a/sys/arch/vax/vsa/dz_ibus.c b/sys/arch/vax/vsa/dz_ibus.c index 242d8921311..510ce2c3a03 100644 --- a/sys/arch/vax/vsa/dz_ibus.c +++ b/sys/arch/vax/vsa/dz_ibus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dz_ibus.c,v 1.4 2001/02/11 06:34:38 hugh Exp $ */ +/* $OpenBSD: dz_ibus.c,v 1.5 2001/05/16 22:15:19 hugh Exp $ */ /* $NetBSD: dz_ibus.c,v 1.15 1999/08/27 17:50:42 ragge Exp $ */ /* * Copyright (c) 1998 Ludd, University of Lule}, Sweden. @@ -57,11 +57,13 @@ #include "../qbus/dzreg.h" #include "../qbus/dzvar.h" -#include "lkc.h" +#include "../dec/dzkbdvar.h" + +#include "dzkbd.h" +#include "dzms.h" static int dz_vsbus_match __P((struct device *, struct cfdata *, void *)); static void dz_vsbus_attach __P((struct device *, struct device *, void *)); -static int dz_print __P((void *, const char *)); static vaddr_t dz_regs; /* Used for console */ @@ -83,16 +85,30 @@ static volatile struct ss_dz {/* base address of DZ-controller: 0x200A0000 */ #undef REG cons_decl(dz); +cdev_decl(dz); -int -dz_print(aux, name) - void *aux; - const char *name; +#if NDZKBD > 0 || NDZMS > 0 +static int +dz_print(void *aux, const char *name) { +#if 0 +#if NDZKBD > 0 || NDZMS > 0 + struct dz_attach_args *dz_args = aux; + if (name == NULL) { + printf (" line %d", dz_args->line); + if (dz_args->hwflags & DZ_HWFLAG_CONSOLE) + printf (" (console)"); + } + return (QUIET); +#else if (name) printf ("lkc at %s", name); return (UNCONF); +#endif +#endif + return (UNCONF); } +#endif static int dz_vsbus_match(parent, cf, aux) @@ -129,8 +145,11 @@ dz_vsbus_attach(parent, self, aux) struct device *parent, *self; void *aux; { - struct dz_softc *sc = (void *)self; + struct dz_softc *sc = (void *)self; struct vsbus_attach_args *va = aux; +#if NDZKBD > 0 || NDZMS > 0 + struct dzkm_attach_args daa; +#endif /* * XXX - This is evil and ugly, but... @@ -160,10 +179,28 @@ dz_vsbus_attach(parent, self, aux) dzattach(sc); - if (((vax_confdata & 0x80) == 0) ||/* workstation, have lkc */ - (vax_boardtype == VAX_BTYP_48)) - if (cn_tab->cn_pri > CN_NORMAL) /* Passed cnsl detect */ - config_found(self, 0, dz_print); +#if NDZKBD > 0 + /* Don't change speed if this is the console */ + if (cn_tab->cn_dev != makedev(getmajor(dzopen), 0)) + dz->rbuf = DZ_LPR_RX_ENABLE | (DZ_LPR_B4800 << 8) + | DZ_LPR_8_BIT_CHAR; + daa.daa_line = 0; + daa.daa_flags = (cn_tab->cn_pri == CN_INTERNAL ? DZKBD_CONSOLE : 0); + config_found(self, &daa, dz_print); +#endif +#if NDZMS > 0 + dz->rbuf = DZ_LPR_RX_ENABLE | (DZ_LPR_B4800 << 8) | DZ_LPR_7_BIT_CHAR \ + | DZ_LPR_PARENB | DZ_LPR_OPAR | 1 /* line */; + daa.daa_line = 1; + daa.daa_flags = 0; + config_found(self, &daa, dz_print); +#endif +#if 0 + s = spltty(); + dzrint(sc); + dzxint(sc); + splx(s); +#endif } int @@ -189,8 +226,6 @@ dzcngetc(dev) return (c); } -#define DZMAJOR 1 - void dzcnprobe(cndev) struct consdev *cndev; @@ -225,8 +260,12 @@ dzcnprobe(cndev) cndev->cn_pri = CN_REMOTE; else cndev->cn_pri = CN_NORMAL; +#if 0 cndev->cn_dev = makedev(DZMAJOR, diagcons); dz_regs = iospace; +#endif + cndev->cn_dev = makedev(getmajor(dzopen), diagcons); + (vaddr_t)dz = dz_regs = iospace; ioaccess(iospace, ioaddr, 1); } @@ -288,47 +327,45 @@ dzcnpollc(dev, pollflag) vsbus_setmask(mask); } -#if NLKC -cons_decl(lkc); - -void -lkccninit(cndev) - struct consdev *cndev; +#if NDZKBD > 0 || NDZMS > 0 +int +dzgetc(ls) + struct dz_linestate *ls; { - dz = (void*)dz_regs; + int line = ls->dz_line; + u_short rbuf; - dz->csr = 0; /* Disable scanning until initting is done */ - dz->tcr = 1; /* Turn off all but line 0's xmitter */ - dz->rbuf = 0x1c18; /* XXX */ - dz->csr = 0x20; /* Turn scanning back on */ + for (;;) { + for(; (dz->csr & DZ_CSR_RX_DONE) == 0;) + ; + rbuf = dz->rbuf; + if (((rbuf >> 8) & 3) == line) + return (rbuf & 0xff); + } } -int -lkccngetc(dev) - dev_t dev; +void +dzputc(ls,ch) + struct dz_linestate *ls; + int ch; { - int lkc_decode(int); - int c; -#if 0 - u_char mask; - - - mask = vsbus_setmask(0); /* save old state */ -#endif - -loop: - while ((dz->csr & 0x80) == 0) - ; /* Wait for char */ - - c = lkc_decode(dz->rbuf & 255); - if (c < 1) - goto loop; - -#if 0 - vsbus_clrintr(0x80); /* XXX */ - vsbus_setmask(mask); -#endif - - return (c); + int line = 0; /* = ls->dz_line; */ + u_short tcr; + int s; + + /* if the dz has already been attached, the MI + driver will do the transmitting: */ + if (ls && ls->dz_sc) { + s = spltty(); + putc(ch, &ls->dz_sc->sc_dz[line].dz_tty->t_outq); + tcr = dz->tcr; + if (!(tcr & (1 << line))) + dz->tcr = tcr | (1 << line); + dzxint(ls->dz_sc); + splx(s); + return; + } + /* use dzcnputc to do the transmitting: */ + dzcnputc(makedev(getmajor(dzopen), line), ch); } -#endif +#endif /* NDZKBD > 0 || NDZMS > 0 */ diff --git a/sys/arch/vax/vsa/smg.c b/sys/arch/vax/vsa/smg.c index 00bf8b3378c..2b1ea710842 100644 --- a/sys/arch/vax/vsa/smg.c +++ b/sys/arch/vax/vsa/smg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: smg.c,v 1.2 2001/02/11 06:34:38 hugh Exp $ */ +/* $OpenBSD: smg.c,v 1.3 2001/05/16 22:15:19 hugh Exp $ */ /* $NetBSD: smg.c,v 1.21 2000/03/23 06:46:44 thorpej Exp $ */ /* * Copyright (c) 1998 Ludd, University of Lule}, Sweden. @@ -34,49 +34,103 @@ #include <sys/param.h> #include <sys/device.h> #include <sys/systm.h> -#include <sys/callout.h> #include <sys/time.h> #include <sys/malloc.h> #include <sys/conf.h> #include <sys/kernel.h> +#include <machine/vsbus.h> +#include <machine/sid.h> +#include <machine/cpu.h> +#include <machine/ka420.h> + #include <dev/cons.h> +#include "../qbus/dzreg.h" +#include "../qbus/dzvar.h" +#include "../dec/dzkbdvar.h" + #include <dev/wscons/wsdisplayvar.h> #include <dev/wscons/wsconsio.h> #include <dev/wscons/wscons_callbacks.h> -#include <machine/vsbus.h> -#include <machine/sid.h> -#include <machine/cpu.h> -#include <machine/ka420.h> +#include "dzkbd.h" -#include "lkc.h" +/* Safety guard */ +#ifndef FONT_QVSS8x15 +#include <dev/wsfont/qvss8x15.h> +#endif +/* Screen hardware defs */ #define SM_COLS 128 /* char width of screen */ #define SM_ROWS 57 /* rows of char on screen */ #define SM_CHEIGHT 15 /* lines a char consists of */ #define SM_NEXTROW (SM_COLS * SM_CHEIGHT) - -static int smg_match __P((struct device *, struct cfdata *, void *)); -static void smg_attach __P((struct device *, struct device *, void *)); +#define SM_YWIDTH 864 +#define SM_XWIDTH 1024 + +/* Cursor register definitions */ +#define CUR_CMD 0 +#define CUR_XPOS 4 +#define CUR_YPOS 8 +#define CUR_XMIN_1 12 +#define CUR_XMAX_1 16 +#define CUR_YMIN_1 20 +#define CUR_YMAX_1 24 +#define CUR_XMIN_2 28 +#define CUR_XMAX_2 32 +#define CUR_YMIN_2 36 +#define CUR_YMAX_2 40 +#define CUR_LOAD 44 + +#define CUR_CMD_TEST 0x8000 +#define CUR_CMD_HSHI 0x4000 +#define CUR_CMD_VBHI 0x2000 +#define CUR_CMD_LODSA 0x1000 +#define CUR_CMD_FORG2 0x0800 +#define CUR_CMD_ENRG2 0x0400 +#define CUR_CMD_FORG1 0x0200 +#define CUR_CMD_ENRG1 0x0100 +#define CUR_CMD_XHWID 0x0080 +#define CUR_CMD_XHCL1 0x0040 +#define CUR_CMD_XHCLP 0x0020 +#define CUR_CMD_XHAIR 0x0010 +#define CUR_CMD_FOPB 0x0008 +#define CUR_CMD_ENPB 0x0004 +#define CUR_CMD_FOPA 0x0002 +#define CUR_CMD_ENPA 0x0001 + +#define CUR_XBIAS 216 /* Add to cursor position */ +#define CUR_YBIAS 33 + +#define WRITECUR(addr, val) *(volatile short *)(curaddr + (addr)) = (val) +static caddr_t curaddr; +static short curcmd, curx, cury, hotX, hotY; +static int bgmask, fgmask; + +static int smg_match(struct device *, struct cfdata *, void *); +static void smg_attach(struct device *, struct device *, void *); struct smg_softc { struct device ss_dev; }; struct cfattach smg_ca = { - sizeof(struct smg_softc), smg_match, smg_attach, + sizeof(struct smg_softc), (cfmatch_t)smg_match, smg_attach, }; -static void smg_cursor __P((void *, int, int, int)); -static int smg_mapchar __P((void *, int, unsigned int *)); -static void smg_putchar __P((void *, int, int, u_int, long)); -static void smg_copycols __P((void *, int, int, int,int)); -static void smg_erasecols __P((void *, int, int, int, long)); -static void smg_copyrows __P((void *, int, int, int)); -static void smg_eraserows __P((void *, int, int, long)); -static int smg_alloc_attr __P((void *, int, int, int, long *)); +struct cfdriver smg_cd = { + NULL, "smg", DV_DULL +}; + +static void smg_cursor(void *, int, int, int); +static int smg_mapchar(void *, int, unsigned int *); +static void smg_putchar(void *, int, int, u_int, long); +static void smg_copycols(void *, int, int, int,int); +static void smg_erasecols(void *, int, int, int, long); +static void smg_copyrows(void *, int, int, int); +static void smg_eraserows(void *, int, int, long); +static int smg_alloc_attr(void *, int, int, int, long *); const struct wsdisplay_emulops smg_emulops = { smg_cursor, @@ -107,21 +161,23 @@ const struct wsscreen_list smg_screenlist = { static caddr_t sm_addr; -extern char q_font[]; +extern struct wsdisplay_font qvss8x15; +static u_char *qf; + #define QCHAR(c) (c < 32 ? 32 : (c > 127 ? c - 66 : c - 32)) -#define QFONT(c,line) q_font[QCHAR(c) * 15 + line] +#define QFONT(c,line) qf[QCHAR(c) * 15 + line] #define SM_ADDR(row, col, line) \ sm_addr[col + (row * SM_CHEIGHT * SM_COLS) + line * SM_COLS] -static int smg_ioctl __P((void *, u_long, caddr_t, int, struct proc *)); -static int smg_mmap __P((void *, off_t, int)); -static int smg_alloc_screen __P((void *, const struct wsscreen_descr *, - void **, int *, int *, long *)); -static void smg_free_screen __P((void *, void *)); -static int smg_show_screen __P((void *, void *, int, - void (*) (void *, int, int), void *)); -static void smg_crsr_blink __P((void *)); +static int smg_ioctl(void *, u_long, caddr_t, int, struct proc *); +static paddr_t smg_mmap(void *, off_t, int); +static int smg_alloc_screen(void *, const struct wsscreen_descr *, + void **, int *, int *, long *); +static void smg_free_screen(void *, void *); +static int smg_show_screen(void *, void *, int, + void (*) (void *, int, int), void *); +static void smg_crsr_blink(void *); const struct wsdisplay_accessops smg_accessops = { smg_ioctl, @@ -142,13 +198,8 @@ struct smg_screen { static struct smg_screen smg_conscreen; static struct smg_screen *curscr; -static struct callout smg_cursor_ch = CALLOUT_INITIALIZER; - int -smg_match(parent, match, aux) - struct device *parent; - struct cfdata *match; - void *aux; +smg_match(struct device *parent, struct cfdata *match, void *aux) { struct vsbus_attach_args *va = aux; volatile short *curcmd; @@ -164,10 +215,10 @@ smg_match(parent, match, aux) * Try to find the cursor chip by testing the flip-flop. * If nonexistent, no glass tty. */ - curcmd[0] = 0x7fff; + curcmd[0] = CUR_CMD_HSHI|CUR_CMD_FOPB; DELAY(300000); tmp = cfgtst[0]; - curcmd[0] = 0x8000; + curcmd[0] = CUR_CMD_TEST|CUR_CMD_HSHI; DELAY(300000); tmp2 = cfgtst[0]; vax_unmap_physmem((vaddr_t)cfgtst, 1); @@ -179,14 +230,13 @@ smg_match(parent, match, aux) } void -smg_attach(parent, self, aux) - struct device *parent, *self; - void *aux; +smg_attach(struct device *parent, struct device *self, void *aux) { struct wsemuldisplaydev_attach_args aa; printf("\n"); sm_addr = (caddr_t)vax_map_physmem(SMADDR, (SMSIZE/VAX_NBPG)); + curaddr = (caddr_t)vax_map_physmem(KA420_CUR_BASE, 1); if (sm_addr == 0) { printf("%s: Couldn't alloc graphics memory.\n", self->dv_xname); return; @@ -195,7 +245,10 @@ smg_attach(parent, self, aux) aa.console = !(vax_confdata & 0x20); aa.scrdata = &smg_screenlist; aa.accessops = &smg_accessops; - callout_reset(&smc_cursor_ch, hz / 2, smg_crsr_blink, NULL); + timeout(smg_crsr_blink, 0, hz/2); + curcmd = CUR_CMD_HSHI; + WRITECUR(CUR_CMD, curcmd); + qf = qvss8x15.data; config_found(self, &aa, wsemuldisplaydevprint); } @@ -204,18 +257,15 @@ static u_char *cursor; static int cur_on; static void -smg_crsr_blink(arg) - void *arg; +smg_crsr_blink(void *arg) { if (cur_on) *cursor ^= 255; - callout_reset(&smg_cursor_ch, hz / 2, smg_crsr_blink, NULL); + timeout(smg_crsr_blink, 0, hz/2); } void -smg_cursor(id, on, row, col) - void *id; - int on, row, col; +smg_cursor(void *id, int on, int row, int col) { struct smg_screen *ss = id; @@ -231,10 +281,7 @@ smg_cursor(id, on, row, col) } int -smg_mapchar(id, uni, index) - void *id; - int uni; - unsigned int *index; +smg_mapchar(void *id, int uni, unsigned int *index) { if (uni < 256) { *index = uni; @@ -245,11 +292,7 @@ smg_mapchar(id, uni, index) } static void -smg_putchar(id, row, col, c, attr) - void *id; - int row, col; - u_int c; - long attr; +smg_putchar(void *id, int row, int col, u_int c, long attr) { struct smg_screen *ss = id; int i; @@ -274,9 +317,7 @@ smg_putchar(id, row, col, c, attr) * copies columns inside a row. */ static void -smg_copycols(id, row, srccol, dstcol, ncols) - void *id; - int row, srccol, dstcol, ncols; +smg_copycols(void *id, int row, int srccol, int dstcol, int ncols) { struct smg_screen *ss = id; int i; @@ -293,10 +334,7 @@ smg_copycols(id, row, srccol, dstcol, ncols) * Erases a bunch of chars inside one row. */ static void -smg_erasecols(id, row, startcol, ncols, fillattr) - void *id; - int row, startcol, ncols; - long fillattr; +smg_erasecols(void *id, int row, int startcol, int ncols, long fillattr) { struct smg_screen *ss = id; int i; @@ -310,9 +348,7 @@ smg_erasecols(id, row, startcol, ncols, fillattr) } static void -smg_copyrows(id, srcrow, dstrow, nrows) - void *id; - int srcrow, dstrow, nrows; +smg_copyrows(void *id, int srcrow, int dstrow, int nrows) { struct smg_screen *ss = id; int frows; @@ -346,10 +382,7 @@ smg_copyrows(id, srcrow, dstrow, nrows) } static void -smg_eraserows(id, startrow, nrows, fillattr) - void *id; - int startrow, nrows; - long fillattr; +smg_eraserows(void *id, int startrow, int nrows, long fillattr) { struct smg_screen *ss = id; int frows; @@ -368,48 +401,116 @@ smg_eraserows(id, startrow, nrows, fillattr) } static int -smg_alloc_attr(id, fg, bg, flags, attrp) - void *id; - int fg, bg; - int flags; - long *attrp; +smg_alloc_attr(void *id, int fg, int bg, int flags, long *attrp) { *attrp = flags; return 0; } +static void +setcursor(struct wsdisplay_cursor *v) +{ + u_short red, green, blue, curfg[16], curmask[16]; + int i; + + /* Enable cursor */ + if (v->which & WSDISPLAY_CURSOR_DOCUR) { + if (v->enable) + curcmd |= CUR_CMD_ENPB|CUR_CMD_ENPA; + else + curcmd &= ~(CUR_CMD_ENPB|CUR_CMD_ENPA); + WRITECUR(CUR_CMD, curcmd); + } + if (v->which & WSDISPLAY_CURSOR_DOHOT) { + hotX = v->hot.x; + hotY = v->hot.y; + } + if (v->which & WSDISPLAY_CURSOR_DOCMAP) { + /* First background */ + red = fusword(v->cmap.red); + green = fusword(v->cmap.green); + blue = fusword(v->cmap.blue); + bgmask = (((30L * red + 59L * green + 11L * blue) >> 8) >= + (((1<<8)-1)*50)) ? ~0 : 0; + red = fusword(v->cmap.red+2); + green = fusword(v->cmap.green+2); + blue = fusword(v->cmap.blue+2); + fgmask = (((30L * red + 59L * green + 11L * blue) >> 8) >= + (((1<<8)-1)*50)) ? ~0 : 0; + } + if (v->which & WSDISPLAY_CURSOR_DOSHAPE) { + WRITECUR(CUR_CMD, curcmd | CUR_CMD_LODSA); + copyin(v->image, curfg, sizeof(curfg)); + copyin(v->mask, curmask, sizeof(curmask)); + for (i = 0; i < sizeof(curfg)/2; i++) { + WRITECUR(CUR_LOAD, (curfg[i] & fgmask) | + ((curmask[i] & ~curfg[i]) & bgmask)); + } + for (i = 0; i < sizeof(curmask)/2; i++) { + WRITECUR(CUR_LOAD, curmask[i]); + } + WRITECUR(CUR_CMD, curcmd); + } +} + int -smg_ioctl(v, cmd, data, flag, p) - void *v; - u_long cmd; - caddr_t data; - int flag; - struct proc *p; +smg_ioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p) { - struct wsdisplay_fbinfo fb; + struct wsdisplay_fbinfo *fb = (void *)data; + static short curc; switch (cmd) { case WSDISPLAYIO_GTYPE: - *(u_int *)data = WSDISPLAY_TYPE_PM_MONO; + *(u_int *)data = WSDISPLAY_TYPE_VAX_MONO; break; case WSDISPLAYIO_GINFO: - fb.height = 864; - fb.width = 1024; - return copyout(&fb, data, sizeof(struct wsdisplay_fbinfo)); + fb->height = SM_YWIDTH; + fb->width = SM_XWIDTH; + fb->depth = 1; + fb->cmsize = 2; + break; + + case WSDISPLAYIO_SVIDEO: + if (*(u_int *)data == WSDISPLAYIO_VIDEO_ON) { + curcmd = curc; + } else { + curc = curcmd; + curcmd &= ~(CUR_CMD_FOPA|CUR_CMD_ENPA); + curcmd |= CUR_CMD_FOPB; + } + WRITECUR(CUR_CMD, curcmd); + break; + + case WSDISPLAYIO_GVIDEO: + *(u_int *)data = (curcmd & CUR_CMD_FOPB ? + WSDISPLAYIO_VIDEO_OFF : WSDISPLAYIO_VIDEO_ON); + break; + + case WSDISPLAYIO_SCURSOR: + setcursor((struct wsdisplay_cursor *)data); + break; + + case WSDISPLAYIO_SCURPOS: + curx = ((struct wsdisplay_curpos *)data)->x; + cury = ((struct wsdisplay_curpos *)data)->y; + WRITECUR(CUR_XPOS, curx + CUR_XBIAS); + WRITECUR(CUR_YPOS, cury + CUR_YBIAS); + break; + + case WSDISPLAYIO_GCURPOS: + ((struct wsdisplay_curpos *)data)->x = curx; + ((struct wsdisplay_curpos *)data)->y = cury; + break; - default: - return -1; + return ENOTTY; } return 0; } -static int -smg_mmap(v, offset, prot) - void *v; - off_t offset; - int prot; +static paddr_t +smg_mmap(void *v, off_t offset, int prot) { if (offset >= SMSIZE || offset < 0) return -1; @@ -417,12 +518,8 @@ smg_mmap(v, offset, prot) } int -smg_alloc_screen(v, type, cookiep, curxp, curyp, defattrp) - void *v; - const struct wsscreen_descr *type; - void **cookiep; - int *curxp, *curyp; - long *defattrp; +smg_alloc_screen(void *v, const struct wsscreen_descr *type, void **cookiep, + int *curxp, int *curyp, long *defattrp) { *cookiep = malloc(sizeof(struct smg_screen), M_DEVBUF, M_WAITOK); bzero(*cookiep, sizeof(struct smg_screen)); @@ -431,19 +528,13 @@ smg_alloc_screen(v, type, cookiep, curxp, curyp, defattrp) } void -smg_free_screen(v, cookie) - void *v; - void *cookie; +smg_free_screen(void *v, void *cookie) { } int -smg_show_screen(v, cookie, waitok, cb, cbarg) - void *v; - void *cookie; - int waitok; - void (*cb) __P((void *, int, int)); - void *cbarg; +smg_show_screen(void *v, void *cookie, int waitok, + void (*cb)(void *, int, int), void *cbarg) { struct smg_screen *ss = cookie; int row, col, line; @@ -473,24 +564,25 @@ smg_show_screen(v, cookie, waitok, cb, cbarg) } cons_decl(smg); - -#define WSCONSOLEMAJOR 68 +cdev_decl(wsdisplay); void smgcninit(cndev) struct consdev *cndev; { - extern void lkccninit __P((struct consdev *)); - extern int lkccngetc __P((dev_t)); + extern void lkccninit(struct consdev *); + extern int lkccngetc(dev_t); + extern int dz_vsbus_lk201_cnattach __P((int)); /* Clear screen */ memset(sm_addr, 0, 128*864); curscr = &smg_conscreen; wsdisplay_cnattach(&smg_stdscreen, &smg_conscreen, 0, 0, 0); cn_tab->cn_pri = CN_INTERNAL; -#if 0 - lkccninit(cndev); - wsdisplay_set_cons_kbd(lkccngetc, nullcnpollc); + qf = qvss8x15.data; + +#if NDZKBD > 0 + dzkbd_cnattach(0); /* Connect keyboard and screen together */ #endif } @@ -516,7 +608,7 @@ smgcnprobe(cndev) virtual_avail += SMSIZE; ioaccess((vaddr_t)sm_addr, SMADDR, (SMSIZE/VAX_NBPG)); cndev->cn_pri = CN_INTERNAL; - cndev->cn_dev = makedev(WSCONSOLEMAJOR, 0); + cndev->cn_dev = makedev(getmajor(wsdisplayopen), 0); break; default: |