Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/hp300/stand/common Pull OpenBSD's standalone ITE dr...



details:   https://anonhg.NetBSD.org/src/rev/9b1c1a922b8c
branches:  trunk
changeset: 761897:9b1c1a922b8c
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Thu Feb 10 12:46:22 2011 +0000

description:
Pull OpenBSD's standalone ITE driver reorganization:
 - merge similar clear, putc, cursor, and scroll ops for all DIO framebuffers
 - rename and move hyper_windowmove() to ite_dio_windowmove1bpp()
   to use it among all dumb monochrome framebuffers
 - ditto hyper_putc() to ite_dio_putc1bpp()
 - remove unnecessary flags, macro, function args, and structure members
 - remove trailing spaces and tabs

Also misc cosmetics to reduce diffs from OpenBSD,
and some KNF that generates diffs from OpenBSD.

Tested on HP382 and HP425t.

diffstat:

 sys/arch/hp300/stand/common/ite.c      |   45 ++--
 sys/arch/hp300/stand/common/ite_dv.c   |   64 +-------
 sys/arch/hp300/stand/common/ite_gb.c   |   58 +------
 sys/arch/hp300/stand/common/ite_hy.c   |  255 +------------------------------
 sys/arch/hp300/stand/common/ite_rb.c   |   68 +-------
 sys/arch/hp300/stand/common/ite_subr.c |  263 +++++++++++++++++++++++++++++++-
 sys/arch/hp300/stand/common/ite_tc.c   |   60 +------
 sys/arch/hp300/stand/common/itevar.h   |  138 +++--------------
 8 files changed, 341 insertions(+), 610 deletions(-)

diffs (truncated from 1342 to 300 lines):

diff -r 22a145f71d5c -r 9b1c1a922b8c sys/arch/hp300/stand/common/ite.c
--- a/sys/arch/hp300/stand/common/ite.c Thu Feb 10 12:44:41 2011 +0000
+++ b/sys/arch/hp300/stand/common/ite.c Thu Feb 10 12:46:22 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ite.c,v 1.13 2011/02/10 11:17:21 tsutsui Exp $ */
+/*     $NetBSD: ite.c,v 1.14 2011/02/10 12:46:22 tsutsui Exp $ */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -62,36 +62,36 @@
 
 struct itesw itesw[] = {
        { GID_TOPCAT,
-       topcat_init,    topcat_clear,   topcat_putc,
-       topcat_cursor,  topcat_scroll },
+       topcat_init,    ite_dio_clear,  ite_dio_putc8bpp,
+       ite_dio_cursor, ite_dio_scroll },
 
        { GID_GATORBOX,
-       gbox_init,      gbox_clear,     gbox_putc,
-       gbox_cursor,    gbox_scroll },
+       gbox_init,      ite_dio_clear,  ite_dio_putc8bpp,
+       ite_dio_cursor, gbox_scroll },
 
        { GID_RENAISSANCE,
-       rbox_init,      rbox_clear,     rbox_putc,
-       rbox_cursor,    rbox_scroll },
+       rbox_init,      ite_dio_clear,  ite_dio_putc8bpp,
+       ite_dio_cursor, ite_dio_scroll },
 
        { GID_LRCATSEYE,
-       topcat_init,    topcat_clear,   topcat_putc,
-       topcat_cursor,  topcat_scroll },
+       topcat_init,    ite_dio_clear,  ite_dio_putc8bpp,
+       ite_dio_cursor, ite_dio_scroll },
 
        { GID_HRCCATSEYE,
-       topcat_init,    topcat_clear,   topcat_putc,
-       topcat_cursor,  topcat_scroll },
+       topcat_init,    ite_dio_clear,  ite_dio_putc8bpp,
+       ite_dio_cursor, ite_dio_scroll },
 
        { GID_HRMCATSEYE,
-       topcat_init,    topcat_clear,   topcat_putc,
-       topcat_cursor,  topcat_scroll },
+       topcat_init,    ite_dio_clear,  ite_dio_putc8bpp,
+       ite_dio_cursor, ite_dio_scroll },
 
        { GID_DAVINCI,
-       dvbox_init,     dvbox_clear,    dvbox_putc,
-       dvbox_cursor,   dvbox_scroll },
+       dvbox_init,     ite_dio_clear,  ite_dio_putc8bpp,
+       ite_dio_cursor, ite_dio_scroll },
 
        { GID_HYPERION,
-       hyper_init,     hyper_clear,    hyper_putc,
-       hyper_cursor,   hyper_scroll },
+       hyper_init,     ite_dio_clear,  ite_dio_putc1bpp,
+       ite_dio_cursor, ite_dio_scroll },
 };
 int    nitesw = sizeof(itesw) / sizeof(itesw[0]);
 
@@ -150,7 +150,7 @@
                        ip->dwidth = ip->fbwidth;
                if (ip->dheight > ip->fbheight)
                        ip->dheight = ip->fbheight;
-               ip->flags = ITE_ALIVE|ITE_CONSOLE;
+               ip->alive = 1;
                i++;
        }
 }
@@ -186,8 +186,7 @@
                        continue;
 #endif
                ip = &ite_data[ite];
-               if ((ip->flags & (ITE_ALIVE|ITE_CONSOLE))
-                   != (ITE_ALIVE|ITE_CONSOLE))
+               if (ip->alive == 0)
                        continue;
                if ((int)ip->regbase == INTIOBASE + FB_BASE) {
                        pri = CN_INTERNAL;
@@ -238,7 +237,7 @@
        case '\n':
                if (++ip->cury == ip->rows) {
                        ip->cury--;
-                       (*sp->ite_scroll)(ip, 1, 0, 1, SCROLL_UP);
+                       (*sp->ite_scroll)(ip);
                        ite_clrtoeol(ip, sp, ip->cury, 0);
                }
                else
@@ -260,7 +259,7 @@
        default:
                if (c < ' ' || c == 0177)
                        break;
-               (*sp->ite_putc)(ip, c, ip->cury, ip->curx, ATTR_NOR);
+               (*sp->ite_putc)(ip, c, ip->cury, ip->curx);
                (*sp->ite_cursor)(ip, DRAW_CURSOR);
                itecheckwrap(ip, sp);
                break;
@@ -274,7 +273,7 @@
                ip->curx = 0;
                if (++ip->cury == ip->rows) {
                        --ip->cury;
-                       (*sp->ite_scroll)(ip, 1, 0, 1, SCROLL_UP);
+                       (*sp->ite_scroll)(ip);
                        ite_clrtoeol(ip, sp, ip->cury, 0);
                        return;
                }
diff -r 22a145f71d5c -r 9b1c1a922b8c sys/arch/hp300/stand/common/ite_dv.c
--- a/sys/arch/hp300/stand/common/ite_dv.c      Thu Feb 10 12:44:41 2011 +0000
+++ b/sys/arch/hp300/stand/common/ite_dv.c      Thu Feb 10 12:46:22 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ite_dv.c,v 1.9 2011/02/10 11:08:23 tsutsui Exp $       */
+/*     $NetBSD: ite_dv.c,v 1.10 2011/02/10 12:46:22 tsutsui Exp $      */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -48,8 +48,6 @@
 #include <hp300/stand/common/samachdep.h>
 #include <hp300/stand/common/itevar.h>
 
-#define WINDOWMOVER    dvbox_windowmove
-
 static void dv_reset(struct dvboxfb *);
 static void dvbox_windowmove(struct ite_data *, int, int, int, int,
     int, int, int);
@@ -59,7 +57,8 @@
 {
        struct dvboxfb *regbase;
        int i;
-       
+
+       ip->bmv = dvbox_windowmove;
        regbase = (void *)ip->regbase;
        dv_reset(regbase);
        DELAY(4000);
@@ -71,7 +70,7 @@
         * Lastly, turn on the box.
         */
        regbase->interrupt = 0x04;
-       regbase->drive     = 0x10;              
+       regbase->drive     = 0x10;
        regbase->rep_rule  = RR_COPY << 4 | RR_COPY;
        regbase->opwen     = 0x01;
        regbase->fbwen     = 0x0;
@@ -111,7 +110,7 @@
        }
 
        regbase->cmapbank = 0;
-       
+
        db_waitbusy(regbase);
 
        ite_fontinfo(ip);
@@ -133,60 +132,14 @@
 }
 
 void
-dvbox_putc(struct ite_data *ip, int c, int dy, int dx, int mode)
-{
-
-       dvbox_windowmove(ip, charY(ip, c), charX(ip, c),
-                        dy * ip->ftheight, dx * ip->ftwidth,
-                        ip->ftheight, ip->ftwidth, RR_COPY);
-}
-
-void
-dvbox_cursor(struct ite_data *ip, int flag)
-{
-       if (flag == DRAW_CURSOR)
-               draw_cursor(ip)
-       else if (flag == MOVE_CURSOR) {
-               erase_cursor(ip)
-               draw_cursor(ip)
-       }
-       else
-               erase_cursor(ip)
-}
-
-void
-dvbox_clear(struct ite_data *ip, int sy, int sx, int h, int w)
-{
-
-       dvbox_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth,
-                        sy * ip->ftheight, sx * ip->ftwidth,
-                        h  * ip->ftheight, w  * ip->ftwidth,
-                        RR_CLEAR);
-}
-
-void
-dvbox_scroll(struct ite_data *ip, int sy, int sx, int count, int dir)
-{
-       int dy = sy - count;
-       int height = ip->rows - sy;
-
-       dvbox_cursor(ip, ERASE_CURSOR);
-
-       dvbox_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth,
-                        dy * ip->ftheight, sx * ip->ftwidth,
-                        height * ip->ftheight,
-                        ip->cols * ip->ftwidth, RR_COPY);
-}
-
-void
-dvbox_windowmove(struct ite_data *ip, int sy, int sx, int dy, int dx,
-    int h, int w, int func)
+dvbox_windowmove(struct ite_data *ip, int sy, int sx, int dy, int dx, int h,
+    int w, int func)
 {
        struct dvboxfb *dp = (void *)ip->regbase;
 
        if (h == 0 || w == 0)
                return;
-       
+
        db_waitbusy(dp);
        dp->rep_rule = func << 4 | func;
        dp->source_y = sy;
@@ -251,5 +204,4 @@
         * End of missing ROM code.
         */
 }
-
 #endif
diff -r 22a145f71d5c -r 9b1c1a922b8c sys/arch/hp300/stand/common/ite_gb.c
--- a/sys/arch/hp300/stand/common/ite_gb.c      Thu Feb 10 12:44:41 2011 +0000
+++ b/sys/arch/hp300/stand/common/ite_gb.c      Thu Feb 10 12:46:22 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ite_gb.c,v 1.9 2011/02/10 11:08:23 tsutsui Exp $       */
+/*     $NetBSD: ite_gb.c,v 1.10 2011/02/10 12:46:22 tsutsui Exp $      */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -48,8 +48,6 @@
 #include <hp300/stand/common/samachdep.h>
 #include <hp300/stand/common/itevar.h>
 
-#define WINDOWMOVER    gbox_windowmove
-
 void gbox_windowmove(struct ite_data *, int, int, int, int, int, int, int);
 
 void
@@ -57,6 +55,8 @@
 {
        struct gboxfb *regbase = (void *)ip->regbase;
 
+       ip->bmv = gbox_windowmove;
+
        regbase->write_protect = 0x0;
        regbase->interrupt = 0x4;
        regbase->rep_rule = RR_COPY;
@@ -109,62 +109,14 @@
 }
 
 void
-gbox_putc(struct ite_data *ip, int c, int dy, int dx, int mode)
-{
-
-       gbox_windowmove(ip, charY(ip, c), charX(ip, c),
-                       dy * ip->ftheight, dx * ip->ftwidth,
-                       ip->ftheight, ip->ftwidth, RR_COPY);
-}
-
-void
-gbox_cursor(struct ite_data *ip, int flag)
-{
-
-       if (flag == DRAW_CURSOR)
-               draw_cursor(ip)
-       else if (flag == MOVE_CURSOR) {
-               erase_cursor(ip)
-               draw_cursor(ip)
-       } else
-               erase_cursor(ip)
-}
-
-void
-gbox_clear(struct ite_data *ip, int sy, int sx, int h, int w)
-{
-
-       gbox_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth,
-                       sy * ip->ftheight, sx * ip->ftwidth,
-                       h  * ip->ftheight, w  * ip->ftwidth,
-                       RR_CLEAR);
-}
-
-#define        gbox_blockmove(ip, sy, sx, dy, dx, h, w) \
-       gbox_windowmove((ip), \
-                       (sy) * ip->ftheight, \
-                       (sx) * ip->ftwidth, \
-                       (dy) * ip->ftheight, \
-                       (dx) * ip->ftwidth, \
-                       (h)  * ip->ftheight, \
-                       (w)  * ip->ftwidth, \
-                       RR_COPY)
-
-void
-gbox_scroll(struct ite_data *ip, int sy, int sx, int count, int dir)
+gbox_scroll(struct ite_data *ip)
 {



Home | Main Index | Thread Index | Old Index