merge with latest Utah version
[unix-history] / usr / src / sys / hp300 / stand / ite.c
index 7e1927c..9019d80 100644 (file)
@@ -9,9 +9,9 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- * from: Utah $Hdr: ite.c 1.20 91/01/21$
+ * from: Utah $Hdr: ite.c 1.23 92/02/28$
  *
  *
- *     @(#)ite.c       7.3 (Berkeley) %G%
+ *     @(#)ite.c       7.4 (Berkeley) %G%
  */
 
 /*
  */
 
 /*
 #ifdef ITECONSOLE
 
 #include "sys/param.h"
 #ifdef ITECONSOLE
 
 #include "sys/param.h"
-#include "../hp300/cons.h"
-#include "../dev/device.h"
-#include "../dev/itevar.h"
-#include "../dev/grfvar.h"
-
-int nodev();
-
-int topcat_init(), topcat_putc();
-int topcat_clear(), topcat_cursor(), topcat_scroll();
-int gatorbox_init(), gatorbox_clear();
-int gatorbox_putc(), gatorbox_cursor(), gatorbox_scroll();
-int rbox_init(), rbox_clear();
-int rbox_putc(), rbox_cursor(), rbox_scroll();
-int dvbox_init(), dvbox_clear();
-int dvbox_putc(), dvbox_cursor(), dvbox_scroll();
+#include "hp/dev/cons.h"
+#include "hp/dev/device.h"
+#include "hp/dev/itevar.h"
+#include "hp/dev/grfreg.h"
+
+extern int nodev();
+extern u_char ite_readbyte();
+extern int ite_writeglyph();
+
+extern int topcat_init(), topcat_putc();
+extern int topcat_clear(), topcat_cursor(), topcat_scroll();
+extern int gbox_init(), gbox_clear();
+extern int gbox_putc(), gbox_cursor(), gbox_scroll();
+extern int rbox_init(), rbox_clear();
+extern int rbox_putc(), rbox_cursor(), rbox_scroll();
+extern int dvbox_init(), dvbox_clear();
+extern int dvbox_putc(), dvbox_cursor(), dvbox_scroll();
+extern int hyper_init(), hyper_clear();
+extern int hyper_putc(), hyper_cursor(), hyper_scroll();
 
 struct itesw itesw[] = {
 
 struct itesw itesw[] = {
-       topcat_init,            nodev,                  topcat_clear,
-       topcat_putc,            topcat_cursor,          topcat_scroll,
-
-       gatorbox_init,          nodev,                  gatorbox_clear,
-       gatorbox_putc,          gatorbox_cursor,        gatorbox_scroll,
-
-       rbox_init,              nodev,                  rbox_clear,
-       rbox_putc,              rbox_cursor,            rbox_scroll,
-
-       dvbox_init,             nodev,                  dvbox_clear,
-       dvbox_putc,             dvbox_cursor,           dvbox_scroll,
+       GID_TOPCAT,
+       topcat_init,    nodev,          topcat_clear,   topcat_putc,
+       topcat_cursor,  topcat_scroll,  ite_readbyte,   ite_writeglyph,
+       GID_GATORBOX,
+       gbox_init,      nodev,          gbox_clear,     gbox_putc,
+       gbox_cursor,    gbox_scroll,    ite_readbyte,   ite_writeglyph,
+       GID_RENAISSANCE,
+       rbox_init,      nodev,          rbox_clear,     rbox_putc,
+       rbox_cursor,    rbox_scroll,    ite_readbyte,   ite_writeglyph,
+       GID_LRCATSEYE,
+       topcat_init,    nodev,          topcat_clear,   topcat_putc,
+       topcat_cursor,  topcat_scroll,  ite_readbyte,   ite_writeglyph,
+       GID_HRCCATSEYE,
+       topcat_init,    nodev,          topcat_clear,   topcat_putc,
+       topcat_cursor,  topcat_scroll,  ite_readbyte,   ite_writeglyph,
+       GID_HRMCATSEYE,
+       topcat_init,    nodev,          topcat_clear,   topcat_putc,
+       topcat_cursor,  topcat_scroll,  ite_readbyte,   ite_writeglyph,
+       GID_DAVINCI,
+       dvbox_init,     nodev,          dvbox_clear,    dvbox_putc,
+       dvbox_cursor,   dvbox_scroll,   ite_readbyte,   ite_writeglyph,
+       GID_HYPERION,
+       hyper_init,     nodev,          hyper_clear,    hyper_putc,
+       hyper_cursor,   hyper_scroll,   ite_readbyte,   ite_writeglyph,
 };
 };
+int    nitesw = sizeof(itesw) / sizeof(itesw[0]);
 
 /* these guys need to be in initialized data */
 int itecons = -1;
 
 /* these guys need to be in initialized data */
 int itecons = -1;
@@ -75,36 +93,26 @@ iteconfig()
                /* XXX: redundent but safe */
                if (badaddr((caddr_t)gr) || gr->gr_id != GRFHWID)
                        continue;
                /* XXX: redundent but safe */
                if (badaddr((caddr_t)gr) || gr->gr_id != GRFHWID)
                        continue;
-               switch (gr->gr_id2) {
-               case GID_GATORBOX:
-                       dtype = ITE_GATORBOX;
-                       break;
-               case GID_TOPCAT:
-               case GID_LRCATSEYE:
-               case GID_HRCCATSEYE:
-               case GID_HRMCATSEYE:
-                       dtype = ITE_TOPCAT;
-                       break;
-               case GID_RENAISSANCE:
-                       dtype = ITE_RENAISSANCE;
-                       break;
-               case GID_DAVINCI:
-                       dtype = ITE_DAVINCI;
-                       break;
-               default:
+               for (dtype = 0; dtype < nitesw; dtype++)
+                       if (itesw[dtype].ite_hwid == gr->gr_id2)
+                               break;
+               if (dtype == nitesw)
                        continue;
                        continue;
-               }
                if (i >= NITE)
                        break;
                ip = &ite_softc[i];
                if (i >= NITE)
                        break;
                ip = &ite_softc[i];
+               ip->isw = &itesw[dtype];
                ip->regbase = (caddr_t) gr;
                fboff = (gr->gr_fbomsb << 8) | gr->gr_fbolsb;
                ip->fbbase = (caddr_t) (*((u_char *)ip->regbase+fboff) << 16);
                /* DIO II: FB offset is relative to select code space */
                if (ip->regbase >= (caddr_t)DIOIIBASE)
                        ip->fbbase += (int)ip->regbase;
                ip->regbase = (caddr_t) gr;
                fboff = (gr->gr_fbomsb << 8) | gr->gr_fbolsb;
                ip->fbbase = (caddr_t) (*((u_char *)ip->regbase+fboff) << 16);
                /* DIO II: FB offset is relative to select code space */
                if (ip->regbase >= (caddr_t)DIOIIBASE)
                        ip->fbbase += (int)ip->regbase;
+               ip->fbwidth  = gr->gr_fbwidth_h << 8 | gr->gr_fbwidth_l;
+               ip->fbheight = gr->gr_fbheight_h << 8 | gr->gr_fbheight_l;
+               ip->dwidth   = gr->gr_dwidth_h << 8 | gr->gr_dwidth_l;
+               ip->dheight  = gr->gr_dheight_h << 8 | gr->gr_dheight_l;
                ip->flags = ITE_ALIVE|ITE_CONSOLE;
                ip->flags = ITE_ALIVE|ITE_CONSOLE;
-               ip->type = dtype;
                i++;
        }
 }
                i++;
        }
 }
@@ -171,8 +179,8 @@ iteinit(cp)
        ip->cursorx = 0;
        ip->cursory = 0;
 
        ip->cursorx = 0;
        ip->cursory = 0;
 
-       (*itesw[ip->type].ite_init)(ip);
-       (*itesw[ip->type].ite_cursor)(ip, DRAW_CURSOR);
+       (*ip->isw->ite_init)(ip);
+       (*ip->isw->ite_cursor)(ip, DRAW_CURSOR);
 
        itecons = ite;
        kbdinit();
 
        itecons = ite;
        kbdinit();
@@ -182,7 +190,7 @@ iteputchar(c)
        register int c;
 {
        register struct ite_softc *ip = &ite_softc[itecons];
        register int c;
 {
        register struct ite_softc *ip = &ite_softc[itecons];
-       register struct itesw *sp = &itesw[ip->type];
+       register struct itesw *sp = ip->isw;
 
        c &= 0x7F;
        switch (c) {
 
        c &= 0x7F;
        switch (c) {