Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/tc - Fix TX 66Hz interrupt handling. Verified ok wi...



details:   https://anonhg.NetBSD.org/src/rev/b997f579fdf9
branches:  trunk
changeset: 475058:b997f579fdf9
user:      nisimura <nisimura%NetBSD.org@localhost>
date:      Fri Jul 30 16:23:43 1999 +0000

description:
- Fix TX 66Hz interrupt handling.  Verified ok with PMAG-JA as an 8bpp
console.  XXX troubles in cursor color.
- Typo in comments of MX.

diffstat:

 sys/dev/tc/mfb.c |   22 +++++------
 sys/dev/tc/tfb.c |  104 ++++++++++++++++++++++++++++++------------------------
 2 files changed, 67 insertions(+), 59 deletions(-)

diffs (truncated from 308 to 300 lines):

diff -r 407981843dd3 -r b997f579fdf9 sys/dev/tc/mfb.c
--- a/sys/dev/tc/mfb.c  Fri Jul 30 16:08:59 1999 +0000
+++ b/sys/dev/tc/mfb.c  Fri Jul 30 16:23:43 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mfb.c,v 1.15 1999/06/25 03:33:20 nisimura Exp $ */
+/* $NetBSD: mfb.c,v 1.16 1999/07/30 16:23:43 nisimura Exp $ */
 
 /*
  * Copyright (c) 1998, 1999 Tohru Nishimura.  All rights reserved.
@@ -32,7 +32,7 @@
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: mfb.c,v 1.15 1999/06/25 03:33:20 nisimura Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mfb.c,v 1.16 1999/07/30 16:23:43 nisimura Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -62,13 +62,13 @@
 #define        BYTE(base, index)       *((u_int8_t *)(base) + ((index)<<2))
 #define        HALF(base, index)       *((u_int16_t *)(base) + ((index)<<1))
 
-/* Bt431 hardware registers */
+/* Bt455 hardware registers */
 #define        bt_reg  0
 #define        bt_cmap 1
 #define        bt_clr  2
 #define        bt_ovly 3
 
-/* Bt455 hardware registers */
+/* Bt431 hardware registers */
 #define        bt_lo   0
 #define        bt_hi   1
 #define        bt_ram  2
@@ -129,8 +129,8 @@
        int nscreens;
 };
 
-#define        MX_MAGIC_X 360
-#define        MX_MAGIC_Y 36
+#define        MX_MAGIC_X      360
+#define        MX_MAGIC_Y      36
 
 #define        MX_FB_OFFSET    0x200000
 #define        MX_FB_SIZE       0x40000
@@ -324,10 +324,9 @@
        sc->sc_cursor.cc_magic.x = MX_MAGIC_X;
        sc->sc_cursor.cc_magic.y = MX_MAGIC_Y;
 
-        tc_intr_establish(parent, ta->ta_cookie, TC_IPL_TTY, mfbintr, sc);
+       tc_intr_establish(parent, ta->ta_cookie, TC_IPL_TTY, mfbintr, sc);
 
        mfbbase = (caddr_t)sc->sc_dc->dc_vaddr;
-       *(u_int8_t *)(mfbbase + MX_IREQ_OFFSET) = 0;
        junk = *(u_int8_t *)(mfbbase + MX_IREQ_OFFSET);
        *(u_int8_t *)(mfbbase + MX_IREQ_OFFSET) = 1;
 
@@ -489,13 +488,12 @@
 {
        struct mfb_softc *sc = arg;
        caddr_t mfbbase = (caddr_t)sc->sc_dc->dc_vaddr;
-       void *vdac;
-       void *curs;
+       void *vdac, *curs;
        int v;
        volatile register int junk;
        
        junk = *(u_int8_t *)(mfbbase + MX_IREQ_OFFSET);
-       /* *(u_int8_t *)(mfbbase + MX_IREQ_OFFSET) = 1; */
+       /* *(u_int8_t *)(mfbbase + MX_IREQ_OFFSET) = 0; */
 
        if (sc->sc_changed == 0)
                return (1);
@@ -566,8 +564,8 @@
        struct fb_devconfig *dc;
 {
        caddr_t mfbbase = (caddr_t)dc->dc_vaddr;
+       void *vdac = (void *)(mfbbase + MX_BT455_OFFSET);
        void *curs = (void *)(mfbbase + MX_BT431_OFFSET);
-       void *vdac = (void *)(mfbbase + MX_BT455_OFFSET);
        int i;
 
        SELECT431(curs, BT431_REG_COMMAND);
diff -r 407981843dd3 -r b997f579fdf9 sys/dev/tc/tfb.c
--- a/sys/dev/tc/tfb.c  Fri Jul 30 16:08:59 1999 +0000
+++ b/sys/dev/tc/tfb.c  Fri Jul 30 16:23:43 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tfb.c,v 1.13 1999/06/25 03:33:21 nisimura Exp $ */
+/* $NetBSD: tfb.c,v 1.14 1999/07/30 16:23:43 nisimura Exp $ */
 
 /*
  * Copyright (c) 1998, 1999 Tohru Nishimura.  All rights reserved.
@@ -32,7 +32,7 @@
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: tfb.c,v 1.13 1999/06/25 03:33:21 nisimura Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tfb.c,v 1.14 1999/07/30 16:23:43 nisimura Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -125,13 +125,13 @@
 /* Bt463 hardware registers */
 #define        bt_lo   0
 #define        bt_hi   1
+#define        bt_reg  2
+#define        bt_cmap 3
+
+/* Bt431 hardware registers */
 #define        bt_ram  2
 #define        bt_ctl  3
 
-/* Bt431 hardware registers */
-#define        bt_reg  2
-#define        bt_cmap 3
-
 #define        SELECT463(vdac, regno) do {                     \
        BYTE(vdac, bt_lo) = (regno) & 0x00ff;           \
        BYTE(vdac, bt_hi) = ((regno)& 0xff00) >> 8;     \
@@ -194,8 +194,8 @@
        int nscreens;
 };
 
-#define        TX_MAGIC_X      220
-#define        TX_MAGIC_Y      35
+#define        TX_MAGIC_X      360
+#define        TX_MAGIC_Y      36
 
 #define        TX_BT463_OFFSET 0x040000
 #define        TX_BT431_OFFSET 0x040010
@@ -209,11 +209,11 @@
 #define        TX_24FB_SIZE    0x400000
 #define        TX_VIDEO_ENABLE 0xa00000
 
-#define TX_CTL_VIDEO_ON        0x80
-#define TX_CTL_INT_ENA 0x40
-#define TX_CTL_INT_PEND        0x20
-#define TX_CTL_SEG_ENA 0x10
-#define TX_CTL_SEG     0x0f
+#define        TX_CTL_VIDEO_ON 0x80
+#define        TX_CTL_INT_ENA  0x40
+#define        TX_CTL_INT_PEND 0x20
+#define        TX_CTL_SEG_ENA  0x10
+#define        TX_CTL_SEG      0x0f
 
 int  tfbmatch __P((struct device *, struct cfdata *, void *));
 void tfbattach __P((struct device *, struct device *, void *));
@@ -408,7 +408,7 @@
        sc->sc_cursor.cc_magic.x = TX_MAGIC_X;
        sc->sc_cursor.cc_magic.y = TX_MAGIC_Y;
 
-        tc_intr_establish(parent, ta->ta_cookie, TC_IPL_TTY, tfbintr, sc);
+       tc_intr_establish(parent, ta->ta_cookie, TC_IPL_TTY, tfbintr, sc);
 
        *(u_int8_t *)(sc->sc_dc->dc_vaddr + TX_CONTROL) &= ~0x40;
        *(u_int8_t *)(sc->sc_dc->dc_vaddr + TX_CONTROL) |= 0x40;
@@ -571,17 +571,16 @@
        void *arg;
 {
        struct tfb_softc *sc = arg;
-       caddr_t tfbbase;
+       caddr_t tfbbase = (caddr_t)sc->sc_dc->dc_vaddr;
        void *vdac, *curs;
        int v;
        
+       *(u_int8_t *)(tfbbase + TX_CONTROL) &= ~0x40;
        if (sc->sc_changed == 0)
-               return (1);
+               goto done;
 
-       tfbbase = (caddr_t)sc->sc_dc->dc_vaddr;
        vdac = (void *)(tfbbase + TX_BT463_OFFSET);
        curs = (void *)(tfbbase + TX_BT431_OFFSET);
-       *(u_int8_t *)(tfbbase + TX_CONTROL) &= ~0x40;
        v = sc->sc_changed;
        sc->sc_changed = 0;
        if (v & DATA_ENB_CHANGED) {
@@ -592,6 +591,7 @@
                u_int8_t *cp = sc->sc_cursor.cc_color;
 
                SELECT463(vdac, BT463_IREG_CURSOR_COLOR_0);
+#if 0
                BYTE(vdac, bt_reg) = cp[1]; tc_wmb();
                BYTE(vdac, bt_reg) = cp[3]; tc_wmb();
                BYTE(vdac, bt_reg) = cp[5]; tc_wmb();
@@ -607,6 +607,23 @@
                BYTE(vdac, bt_reg) = cp[1]; tc_wmb();
                BYTE(vdac, bt_reg) = cp[3]; tc_wmb();
                BYTE(vdac, bt_reg) = cp[5]; tc_wmb();
+#else
+               BYTE(vdac, bt_reg) = cp[0]; tc_wmb();
+               BYTE(vdac, bt_reg) = cp[2]; tc_wmb();
+               BYTE(vdac, bt_reg) = cp[4]; tc_wmb();
+
+               BYTE(vdac, bt_reg) = cp[1]; tc_wmb();
+               BYTE(vdac, bt_reg) = cp[3]; tc_wmb();
+               BYTE(vdac, bt_reg) = cp[5]; tc_wmb();
+
+               BYTE(vdac, bt_reg) = cp[0]; tc_wmb();
+               BYTE(vdac, bt_reg) = cp[2]; tc_wmb();
+               BYTE(vdac, bt_reg) = cp[4]; tc_wmb();
+
+               BYTE(vdac, bt_reg) = cp[0]; tc_wmb();
+               BYTE(vdac, bt_reg) = cp[2]; tc_wmb();
+               BYTE(vdac, bt_reg) = cp[4]; tc_wmb();
+#endif
        }
        if (v & DATA_CURSHAPE_CHANGED) {
                u_int8_t *ip, *mp, img, msk;
@@ -614,9 +631,9 @@
 
                ip = (u_int8_t *)sc->sc_cursor.cc_image;
                mp = (u_int8_t *)(sc->sc_cursor.cc_image + CURSOR_MAX_SIZE);
+               bcnt = 0;
+               SELECT431(curs, BT431_REG_CRAM_BASE);
 
-               bcnt = 0;
-               SELECT431(curs, BT431_REG_CRAM_BASE+0);
                /* 64 pixel scan line is consisted with 16 byte cursor ram */
                while (bcnt < sc->sc_cursor.cc_size.y * 16) {
                        /* pad right half 32 pixel when smaller than 33 */
@@ -628,7 +645,8 @@
                                img = *ip++;
                                msk = *mp++;
                                img &= msk;     /* cookie off image */
-                               HALF(curs, bt_ram) = (flip[msk] << 8) | flip[img];
+                               HALF(curs, bt_ram)
+                                   = (flip[msk] << 8) | flip[img];
                                tc_wmb();
                        }
                        bcnt += 2;
@@ -651,6 +669,8 @@
                        BYTE(vdac, bt_cmap) = cm->b[index];
                }
        }
+done:
+       *(u_int8_t *)(tfbbase + TX_CONTROL) &= ~0x40;   /* !? Eeeh !? */
        *(u_int8_t *)(tfbbase + TX_CONTROL) |= 0x40;
        return (1);
 }
@@ -665,10 +685,10 @@
        int i;
 
        SELECT463(vdac, BT463_IREG_COMMAND_0);
-       BYTE(vdac, bt_reg) = 0x40;      tc_wmb();
-       BYTE(vdac, bt_reg) = 0x46;      tc_wmb();
-       BYTE(vdac, bt_reg) = 0xc0;      tc_wmb();
-       BYTE(vdac, bt_reg) = 0; tc_wmb();       /* !? 204 !? */
+       BYTE(vdac, bt_reg) = 0x40;      tc_wmb();       /* CMD 0 */
+       BYTE(vdac, bt_reg) = 0x46;      tc_wmb();       /* CMD 1 */
+       BYTE(vdac, bt_reg) = 0xc0;      tc_wmb();       /* CMD 2 */
+       BYTE(vdac, bt_reg) = 0;         tc_wmb();       /* !? 204 !? */
        BYTE(vdac, bt_reg) = 0xff;      tc_wmb();       /* plane  0:7  */
        BYTE(vdac, bt_reg) = 0xff;      tc_wmb();       /* plane  8:15 */
        BYTE(vdac, bt_reg) = 0xff;      tc_wmb();       /* plane 16:23 */
@@ -679,22 +699,17 @@
        BYTE(vdac, bt_reg) = 0x00;      tc_wmb();       /* blink 24:27 */
        BYTE(vdac, bt_reg) = 0x00;      tc_wmb();
 
-#if 0 /* XXX WHAT'S TX REALLY DOING HERE? XXX */
+#if 0 /* XXX ULTRIX does initialize 16 entry window type here XXX */
   {
-       static struct {
-               u_int8_t x, y, z, u;
-       } windowtype[BT463_IREG_WINDOW_TYPE_TABLE] = {
-               { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 },
-               { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 },
-               { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 },
-               { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 },
+       static u_int32_t windowtype[BT463_IREG_WINDOW_TYPE_TABLE] = {
+               0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        };
 
        SELECT463(vdac, BT463_IREG_WINDOW_TYPE_TABLE);
        for (i = 0; i < BT463_NWTYPE_ENTRIES; i++) {
-               BYTE(vdac, bt_reg) = windowtype[i].x;
-               BYTE(vdac, bt_reg) = windowtype[i].y;
-               BYTE(vdac, bt_reg) = windowtype[i].z;
+               BYTE(vdac, bt_reg) = windowtype[i];       /*   0:7  */
+               BYTE(vdac, bt_reg) = windowtype[i] >> 8;  /*   8:15 */
+               BYTE(vdac, bt_reg) = windowtype[i] >> 16; /*  16:23 */
        }
   }
 #endif
@@ -709,17 +724,12 @@
                BYTE(vdac, bt_cmap) = 0xff;     tc_wmb();
        }
 
-       SELECT463(vdac, BT463_IREG_CURSOR_COLOR_0);
-       BYTE(vdac, bt_reg) = 0;         tc_wmb();
-       BYTE(vdac, bt_reg) = 0;         tc_wmb();
-       BYTE(vdac, bt_reg) = 0;         tc_wmb();
-       BYTE(vdac, bt_reg) = 0xff;              tc_wmb();
-       BYTE(vdac, bt_reg) = 0xff;              tc_wmb();
-       BYTE(vdac, bt_reg) = 0xff;              tc_wmb();
-       for (i = 2; i < 256; i++) {
-               BYTE(vdac, bt_cmap) = 0;        tc_wmb();
-               BYTE(vdac, bt_cmap) = 0;        tc_wmb();
-               BYTE(vdac, bt_cmap) = 0;        tc_wmb();
+       /* !? Eeeh !? */



Home | Main Index | Thread Index | Old Index