BSD 4_4 release
[unix-history] / usr / src / sys / hp / dev / itevar.h
index 4a9dd46..d8e0e4b 100644 (file)
@@ -1,33 +1,72 @@
 /*
  * Copyright (c) 1988 University of Utah.
 /*
  * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1990, 1993
+ *     The Regents of the University of California.  All rights reserved.
  *
  * This code is derived from software contributed to Berkeley by
  * the Systems Programming Group of the University of Utah Computer
  * Science Department.
  *
  *
  * This code is derived from software contributed to Berkeley by
  * the Systems Programming Group of the University of Utah Computer
  * Science Department.
  *
- * %sccs.include.redist.c%
+ * 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.
  *
  *
- * from: Utah $Hdr: itevar.h 1.1 90/07/09$
+ * 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.
  *
  *
- *     @(#)itevar.h    7.2 (Berkeley) %G%
+ * from: Utah $Hdr: itevar.h 1.15 92/12/20$
+ *
+ *     @(#)itevar.h    8.1 (Berkeley) 6/10/93
  */
 
 #define UNIT(dev)       minor(dev)
 
 struct itesw {
  */
 
 #define UNIT(dev)       minor(dev)
 
 struct itesw {
+       int     ite_hwid;               /* Hardware id */
        int     (*ite_init)();
        int     (*ite_deinit)();
        int     (*ite_clear)();
        int     (*ite_putc)();
        int     (*ite_cursor)();
        int     (*ite_scroll)();
        int     (*ite_init)();
        int     (*ite_deinit)();
        int     (*ite_clear)();
        int     (*ite_putc)();
        int     (*ite_cursor)();
        int     (*ite_scroll)();
+       u_char  (*ite_readbyte)();
+       int     (*ite_writeglyph)();
 };
 
 };
 
+#define getbyte(ip, offset) \
+       ((*(ip)->isw->ite_readbyte)(ip, offset))
+
+#define getword(ip, offset) \
+       ((getbyte(ip, offset) << 8) | getbyte(ip, (offset) + 2))
+
+#define writeglyph(ip, offset, fontbuf) \
+       ((*(ip)->isw->ite_writeglyph)((ip), (offset), (fontbuf)))
+
 struct ite_softc {
        int     flags;
 struct ite_softc {
        int     flags;
-       int     type;
+       struct  itesw *isw;
+       struct  grf_softc *grf;
        caddr_t regbase, fbbase;
        short   curx, cury;
        short   cursorx, cursory;
        caddr_t regbase, fbbase;
        short   curx, cury;
        short   cursorx, cursory;
@@ -43,6 +82,7 @@ struct ite_softc {
        short   planemask;
        short   pos;
        char    imode, escape, fpd, hold;
        short   planemask;
        short   pos;
        char    imode, escape, fpd, hold;
+       caddr_t devdata;                        /* display dependent data */
 };
 
 /* Flags */
 };
 
 /* Flags */
@@ -52,12 +92,7 @@ struct ite_softc {
 #define ITE_ISCONS     0x08    /* device is console */
 #define ITE_ACTIVE     0x10    /* device is being used as ITE */
 #define ITE_INGRF      0x20    /* device in use as non-ITE */
 #define ITE_ISCONS     0x08    /* device is console */
 #define ITE_ACTIVE     0x10    /* device is being used as ITE */
 #define ITE_INGRF      0x20    /* device in use as non-ITE */
-
-/* Types - indices into itesw */
-#define        ITE_TOPCAT      0
-#define        ITE_GATORBOX    1
-#define        ITE_RENAISSANCE 2
-#define ITE_DAVINCI    3
+#define ITE_CURSORON   0x40    /* cursor being tracked */
 
 #define attrloc(ip, y, x) \
        (ip->attrbuf + ((y) * ip->cols) + (x))
 
 #define attrloc(ip, y, x) \
        (ip->attrbuf + ((y) * ip->cols) + (x))
@@ -85,6 +120,23 @@ struct ite_softc {
 #define        charY(ip,c)     \
        (((c) / (ip)->cpl) * (ip)->ftheight + (ip)->fonty)
 
 #define        charY(ip,c)     \
        (((c) / (ip)->cpl) * (ip)->ftheight + (ip)->fonty)
 
+/*
+ * The cursor is just an inverted space.
+ */
+#define draw_cursor(ip) { \
+       WINDOWMOVER(ip, ip->cblanky, ip->cblankx, \
+                   ip->cury * ip->ftheight, \
+                   ip->curx * ip->ftwidth, \
+                   ip->ftheight, ip->ftwidth, RR_XOR); \
+        ip->cursorx = ip->curx; \
+       ip->cursory = ip->cury; }
+
+#define erase_cursor(ip) \
+       WINDOWMOVER(ip, ip->cblanky, ip->cblankx, \
+                   ip->cursory * ip->ftheight, \
+                   ip->cursorx * ip->ftwidth, \
+                   ip->ftheight, ip->ftwidth, RR_XOR);
+
 /* Character attributes */
 #define ATTR_NOR        0x0             /* normal */
 #define        ATTR_INV        0x1             /* inverse */
 /* Character attributes */
 #define ATTR_NOR        0x0             /* normal */
 #define        ATTR_INV        0x1             /* inverse */
@@ -130,4 +182,6 @@ struct ite_softc {
 
 #ifdef KERNEL
 extern struct ite_softc ite_softc[];
 
 #ifdef KERNEL
 extern struct ite_softc ite_softc[];
+extern struct itesw itesw[];
+extern int nitesw;
 #endif
 #endif