Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/luna68k/dev - Fix an error in clearing entire screen.



details:   https://anonhg.NetBSD.org/src/rev/b85d8f7a98d0
branches:  trunk
changeset: 480412:b85d8f7a98d0
user:      nisimura <nisimura%NetBSD.org@localhost>
date:      Wed Jan 12 01:57:22 2000 +0000

description:
- Fix an error in clearing entire screen.
- Add 3 byte long mouse event parsing.
- Fix errors in comments.

diffstat:

 sys/arch/luna68k/dev/lunafb.c |  22 +++++++++-------
 sys/arch/luna68k/dev/lunaws.c |  55 ++++++++++++++++++++++++++++++++----------
 2 files changed, 53 insertions(+), 24 deletions(-)

diffs (198 lines):

diff -r 9cd3e1118d82 -r b85d8f7a98d0 sys/arch/luna68k/dev/lunafb.c
--- a/sys/arch/luna68k/dev/lunafb.c     Tue Jan 11 20:53:24 2000 +0000
+++ b/sys/arch/luna68k/dev/lunafb.c     Wed Jan 12 01:57:22 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lunafb.c,v 1.3 2000/01/08 04:40:25 nisimura Exp $ */
+/* $NetBSD: lunafb.c,v 1.4 2000/01/12 01:57:23 nisimura Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: lunafb.c,v 1.3 2000/01/08 04:40:25 nisimura Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lunafb.c,v 1.4 2000/01/12 01:57:23 nisimura Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -174,7 +174,7 @@
 
        if (strcmp(ma->ma_name, fb_cd.cd_name))
                return (0);
-#if 0  /* badaddr() bombs if no framebuffer is installed */
+#if 0  /* XXX badaddr() bombs if no framebuffer is installed */
        if (badaddr((caddr_t)ma->ma_addr, 4))
                return (0);
 #else
@@ -364,7 +364,10 @@
        int bpp, i;
        struct raster *rap;
        struct rcons *rcp;
-       struct { short h, v; } *rfcnt;
+       union {
+               struct { short h, v; } p;
+               u_int32_t u;
+       } rfcnt;
 
        switch (hwplanemask) {
        case 0xff:
@@ -385,7 +388,7 @@
        dc->dc_cmsize = (bpp == 1) ? 0 : 1 << bpp;
        dc->dc_videobase = paddr;
 
-#if 0 /* WHITE on BLACK */
+#if 0 /* WHITE on BLACK XXX experiment resulted in WHITE on SKYBLUE... */
        if (hwplanemask == 0x0f) {
                /* XXX Need Bt454 initialization */
                struct bt454 *odac = (struct bt454 *)OMFB_RAMDAC;
@@ -420,16 +423,15 @@
 #endif
 
        /* adjust h/v orgin on screen */
-       /* XXX not sure it's necessary XXX */
-       rfcnt = (void *)OMFB_RFCNT;
-       rfcnt->h = 0;
-       rfcnt->v = 0;
+       rfcnt.p.h = 7;
+       rfcnt.p.v = -27;
+       *(u_int32_t *)OMFB_RFCNT = rfcnt.u; /* single write of 0x007ffe6 */
 
        /* clear the screen */
        *(u_int32_t *)OMFB_PLANEMASK = 0xff;
        ((u_int32_t *)OMFB_ROPFUNC)[5] = ~0;    /* ROP copy */
        for (i = 0; i < dc->dc_ht * dc->dc_rowbytes/sizeof(u_int32_t); i++)
-               *(u_int32_t *)(dc->dc_videobase + i) = 0;
+               *((u_int32_t *)dc->dc_videobase + i) = 0;
        *(u_int32_t *)OMFB_PLANEMASK = 0x01;
 
        /* initialize the raster */
diff -r 9cd3e1118d82 -r b85d8f7a98d0 sys/arch/luna68k/dev/lunaws.c
--- a/sys/arch/luna68k/dev/lunaws.c     Tue Jan 11 20:53:24 2000 +0000
+++ b/sys/arch/luna68k/dev/lunaws.c     Wed Jan 12 01:57:22 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lunaws.c,v 1.2 2000/01/07 05:13:08 nisimura Exp $ */
+/* $NetBSD: lunaws.c,v 1.3 2000/01/12 01:57:22 nisimura Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: lunaws.c,v 1.2 2000/01/07 05:13:08 nisimura Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lunaws.c,v 1.3 2000/01/12 01:57:22 nisimura Exp $");
 
 #include "wsmouse.h"
 
@@ -67,10 +67,14 @@
 
 struct ws_softc {
        struct device   sc_dv;
-       struct device   *sc_wskbddev;
-       struct device   *sc_wsmousedev;
        struct sioreg   *sc_ctl;
        u_int8_t        sc_wr[6];
+       struct device   *sc_wskbddev;
+#if NWSMOUSE > 0
+       struct device   *sc_wsmousedev;
+       int             sc_msreport;
+       int             buttons, dx, dy;
+#endif
 };
 
 static void omkbd_input __P((void *, int));
@@ -181,6 +185,7 @@
        b.accesscookie = (void *)sc;    
        sc->sc_wsmousedev = config_found_sm(self, &b, wsmousedevprint,
                                        ws_submatch_mouse);
+       sc->sc_msreport = 0;
        }
 #endif
 }
@@ -229,23 +234,37 @@
                        code = sio->sio_data;
                        if (rr & (RR_FRAMING | RR_OVERRUN | RR_PARITY)) {
                                sio->sio_cmd = WR0_ERRRST;
-#if 0
-                               if (sio->sio_stat & RR_FRAMING)
-                                       code |= TTY_FE;
-                               else if (sio->sio_stat & RR_PARITY)
-                                       code |= TTY_PE;
-#endif
                                continue;
                        }
-#if 0
+#if NWSMOUSE > 0
                        /*
-                        * if (code >= 0x80 || code <= 0x87), then
+                        * if (code >= 0x80 && code <= 0x87), then
                         * it's the first byte of 3 byte long mouse report
                         *      code[0] & 07 -> LMR button condition
                         *      code[1], [2] -> x,y delta
+                        * otherwise, key press or release event.
                         */
+                       if (sc->sc_msreport == 0) {
+                               if (code < 0x80 || code > 0x87) {
+                                       omkbd_input(sc, code);
+                                       continue;
+                               }
+                               sc->buttons = code & 07;
+                               sc->sc_msreport = 1;
+                       }
+                       else if (sc->sc_msreport == 1) {
+                               sc->dx = (signed char)code;
+                               sc->sc_msreport = 2;
+                       }
+                       else if (sc->sc_msreport == 2) {
+                               sc->dy = (signed char)code;
+                               wsmouse_input(sc->sc_wsmousedev,
+                                       sc->buttons, sc->dx, sc->dy, 0);
+                               sc->sc_msreport = 0;
+                       }
+#else
+                       omkbd_input(sc, code);
 #endif
-                       omkbd_input(sc, code & 0xff);
                } while ((rr = getsiocsr(sio)) & RR_RXRDY);
        }
        if (rr && RR_TXRDY)
@@ -419,6 +438,8 @@
 {
        static int voidfill;
 
+       /* XXX need CH.B initialization XXX */
+
        wskbd_cnattach(&ws_consops, &voidfill, &omkbd_keymapdata);
 }
 
@@ -457,7 +478,7 @@
                return 0;
            case WSKBDIO_SETLEDS:
            case WSKBDIO_GETLEDS:
-           case WSKBDIO_COMPLEXBELL:
+           case WSKBDIO_COMPLEXBELL:   /* XXX capable of complex bell */
                return 0;
        }
        return -1;
@@ -469,7 +490,10 @@
 omms_enable(v)
        void *v;
 {
+       struct ws_softc *sc = v;
+
        syscnputc((dev_t)1, 0x60); /* enable 3 byte long mouse reporting */
+       sc->sc_msreport = 0;
        return 0;
 }
 
@@ -493,6 +517,9 @@
 omms_disable(v)
        void *v;
 {
+       struct ws_softc *sc = v;
+
        syscnputc((dev_t)1, 0x20); /* quiet mouse */
+       sc->sc_msreport = 0;
 }
 #endif



Home | Main Index | Thread Index | Old Index