diff --git a/sys/arch/hp300/stand/ite.c b/sys/arch/hp300/stand/ite.c index b8390e4c0f56..f48d88584271 100644 --- a/sys/arch/hp300/stand/ite.c +++ b/sys/arch/hp300/stand/ite.c @@ -1,4 +1,4 @@ -/* $NetBSD: ite.c,v 1.10 1995/10/04 06:54:47 thorpej Exp $ */ +/* $NetBSD: ite.c,v 1.11 1996/03/03 04:23:33 thorpej Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -51,57 +51,51 @@ #include #include #include -#include +#include #include #include #include -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(); +void ite_deinit_noop __P((struct ite_data *)); struct itesw itesw[] = { - 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, + { GID_TOPCAT, + topcat_init, ite_deinit_noop, topcat_clear, topcat_putc, + topcat_cursor, topcat_scroll, ite_readbyte, ite_writeglyph }, + + { GID_GATORBOX, + gbox_init, ite_deinit_noop, gbox_clear, gbox_putc, + gbox_cursor, gbox_scroll, ite_readbyte, ite_writeglyph }, + + { GID_RENAISSANCE, + rbox_init, ite_deinit_noop, rbox_clear, rbox_putc, + rbox_cursor, rbox_scroll, ite_readbyte, ite_writeglyph }, + + { GID_LRCATSEYE, + topcat_init, ite_deinit_noop, topcat_clear, topcat_putc, + topcat_cursor, topcat_scroll, ite_readbyte, ite_writeglyph }, + + { GID_HRCCATSEYE, + topcat_init, ite_deinit_noop, topcat_clear, topcat_putc, + topcat_cursor, topcat_scroll, ite_readbyte, ite_writeglyph }, + + { GID_HRMCATSEYE, + topcat_init, ite_deinit_noop, topcat_clear, topcat_putc, + topcat_cursor, topcat_scroll, ite_readbyte, ite_writeglyph }, + + { GID_DAVINCI, + dvbox_init, ite_deinit_noop, dvbox_clear, dvbox_putc, + dvbox_cursor, dvbox_scroll, ite_readbyte, ite_writeglyph }, + + { GID_HYPERION, + hyper_init, ite_deinit_noop, 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; -struct ite_softc ite_softc[NITE] = { 0 }; +struct ite_data ite_data[NITE] = { 0 }; int ite_scode[NITE] = { 0 }; /* @@ -113,7 +107,7 @@ iteconfig() int dtype, fboff, i; struct hp_hw *hw; struct grfreg *gr; - struct ite_softc *ip; + struct ite_data *ip; i = 0; for (hw = sc_table; hw < &sc_table[MAXCTLRS]; hw++) { @@ -131,7 +125,7 @@ iteconfig() if (i >= NITE) break; ite_scode[i] = hw->hw_sc; - ip = &ite_softc[i]; + ip = &ite_data[i]; ip->isw = &itesw[dtype]; ip->regbase = (caddr_t) gr; fboff = (gr->gr_fbomsb << 8) | gr->gr_fbolsb; @@ -172,7 +166,7 @@ iteprobe(cp) struct consdev *cp; { register int ite; - register struct ite_softc *ip; + register struct ite_data *ip; int unit, pri; #ifdef CONSDEBUG @@ -190,7 +184,7 @@ iteprobe(cp) if (ite < whichconsole) continue; #endif - ip = &ite_softc[ite]; + ip = &ite_data[ite]; if ((ip->flags & (ITE_ALIVE|ITE_CONSOLE)) != (ITE_ALIVE|ITE_CONSOLE)) continue; @@ -212,12 +206,12 @@ iteinit(cp) struct consdev *cp; { int ite = cp->cn_dev; - struct ite_softc *ip; + struct ite_data *ip; if (itecons != -1) return; - ip = &ite_softc[ite]; + ip = &ite_data[ite]; ip->curx = 0; ip->cury = 0; @@ -237,7 +231,7 @@ iteputchar(dev, c) dev_t dev; register int c; { - register struct ite_softc *ip = &ite_softc[itecons]; + register struct ite_data *ip = &ite_data[itecons]; register struct itesw *sp = ip->isw; c &= 0x7F; @@ -276,7 +270,7 @@ iteputchar(dev, c) } itecheckwrap(ip, sp) - register struct ite_softc *ip; + register struct ite_data *ip; register struct itesw *sp; { if (++ip->curx == ip->cols) { @@ -292,7 +286,7 @@ itecheckwrap(ip, sp) } ite_clrtoeol(ip, sp, y, x) - register struct ite_softc *ip; + register struct ite_data *ip; register struct itesw *sp; register int y, x; { @@ -312,3 +306,10 @@ itegetchar(dev) #endif } #endif + +/* ARGSUSED */ +void +ite_deinit_noop(ip) + struct ite_data *ip; +{ +} diff --git a/sys/arch/hp300/stand/ite_dv.c b/sys/arch/hp300/stand/ite_dv.c index b636a2e7549c..c7116eba1a4f 100644 --- a/sys/arch/hp300/stand/ite_dv.c +++ b/sys/arch/hp300/stand/ite_dv.c @@ -1,4 +1,4 @@ -/* $NetBSD: ite_dv.c,v 1.7 1994/10/26 07:27:31 cgd Exp $ */ +/* $NetBSD: ite_dv.c,v 1.8 1996/03/03 04:23:35 thorpej Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -47,15 +47,19 @@ #ifdef ITECONSOLE #include -#include +#include #include #include #define REGBASE ((struct dvboxfb *)(ip->regbase)) #define WINDOWMOVER dvbox_windowmove +void dvbox_windowmove __P((struct ite_data *, int, int, int, int, + int, int, int)); + +void dvbox_init(ip) - struct ite_softc *ip; + struct ite_data *ip; { int i; @@ -129,8 +133,9 @@ dvbox_init(ip) db_waitbusy(ip->regbase); } +void dvbox_putc(ip, c, dy, dx, mode) - register struct ite_softc *ip; + register struct ite_data *ip; register int dy, dx; int c, mode; { @@ -139,8 +144,9 @@ dvbox_putc(ip, c, dy, dx, mode) ip->ftheight, ip->ftwidth, RR_COPY); } +void dvbox_cursor(ip, flag) - register struct ite_softc *ip; + register struct ite_data *ip; register int flag; { if (flag == DRAW_CURSOR) @@ -153,8 +159,9 @@ dvbox_cursor(ip, flag) erase_cursor(ip) } +void dvbox_clear(ip, sy, sx, h, w) - struct ite_softc *ip; + struct ite_data *ip; register int sy, sx, h, w; { dvbox_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth, @@ -163,8 +170,9 @@ dvbox_clear(ip, sy, sx, h, w) RR_CLEAR); } +void dvbox_scroll(ip, sy, sx, count, dir) - register struct ite_softc *ip; + register struct ite_data *ip; register int sy, count; int dir, sx; { @@ -179,8 +187,9 @@ dvbox_scroll(ip, sy, sx, count, dir) ip->cols * ip->ftwidth, RR_COPY); } +void dvbox_windowmove(ip, sy, sx, dy, dx, h, w, func) - struct ite_softc *ip; + struct ite_data *ip; int sy, sx, dy, dx, h, w, func; { register struct dvboxfb *dp = REGBASE; diff --git a/sys/arch/hp300/stand/ite_gb.c b/sys/arch/hp300/stand/ite_gb.c index 9a4f7dcce2ed..ac89d3845aaf 100644 --- a/sys/arch/hp300/stand/ite_gb.c +++ b/sys/arch/hp300/stand/ite_gb.c @@ -1,4 +1,4 @@ -/* $NetBSD: ite_gb.c,v 1.7 1994/10/26 07:27:33 cgd Exp $ */ +/* $NetBSD: ite_gb.c,v 1.8 1996/03/03 04:23:36 thorpej Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -48,15 +48,19 @@ #include -#include +#include #include #include #define REGBASE ((struct gboxfb *)(ip->regbase)) #define WINDOWMOVER gbox_windowmove +void gbox_windowmove __P((struct ite_data *, int, int, int, int, + int, int, int)); + +void gbox_init(ip) - register struct ite_softc *ip; + register struct ite_data *ip; { REGBASE->write_protect = 0x0; REGBASE->interrupt = 0x4; @@ -109,8 +113,9 @@ gbox_init(ip) ip->ftwidth, RR_COPYINVERTED); } +void gbox_putc(ip, c, dy, dx, mode) - register struct ite_softc *ip; + register struct ite_data *ip; register int dy, dx; int c, mode; { @@ -119,8 +124,9 @@ gbox_putc(ip, c, dy, dx, mode) ip->ftheight, ip->ftwidth, RR_COPY); } +void gbox_cursor(ip, flag) - register struct ite_softc *ip; + register struct ite_data *ip; register int flag; { if (flag == DRAW_CURSOR) @@ -133,8 +139,9 @@ gbox_cursor(ip, flag) erase_cursor(ip) } +void gbox_clear(ip, sy, sx, h, w) - struct ite_softc *ip; + struct ite_data *ip; register int sy, sx, h, w; { gbox_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth, @@ -153,8 +160,9 @@ gbox_clear(ip, sy, sx, h, w) (w) * ip->ftwidth, \ RR_COPY) +void gbox_scroll(ip, sy, sx, count, dir) - register struct ite_softc *ip; + register struct ite_data *ip; register int sy; int dir, sx, count; { @@ -171,8 +179,9 @@ gbox_scroll(ip, sy, sx, count, dir) gbox_blockmove(ip, sy + i, sx, dy + i, 0, 1, ip->cols); } +void gbox_windowmove(ip, sy, sx, dy, dx, h, w, mask) - register struct ite_softc *ip; + register struct ite_data *ip; int sy, sx, dy, dx, mask; register int h, w; { diff --git a/sys/arch/hp300/stand/ite_hy.c b/sys/arch/hp300/stand/ite_hy.c index 5823df0296b5..f907cdd50851 100644 --- a/sys/arch/hp300/stand/ite_hy.c +++ b/sys/arch/hp300/stand/ite_hy.c @@ -1,4 +1,4 @@ -/* $NetBSD: ite_hy.c,v 1.2 1994/10/26 07:27:34 cgd Exp $ */ +/* $NetBSD: ite_hy.c,v 1.3 1996/03/03 04:23:37 thorpej Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -48,7 +48,7 @@ #ifdef ITECONSOLE #include -#include +#include #include #include @@ -59,8 +59,13 @@ #define charX(ip,c) \ (((c) % (ip)->cpl) * ((((ip)->ftwidth + 7) / 8) * 8) + (ip)->fontx) +void hyper_ite_fontinit __P((struct ite_data *)); +void hyper_windowmove __P((struct ite_data *, int, int, int, int, + int, int, int)); + +void hyper_init(ip) - register struct ite_softc *ip; + register struct ite_data *ip; { int width; @@ -86,8 +91,9 @@ hyper_init(ip) ip->ftwidth, RR_COPYINVERTED); } +void hyper_ite_fontinit(ip) - register struct ite_softc *ip; + register struct ite_data *ip; { register u_char *fbmem, *dp; int c, l, b; @@ -114,8 +120,9 @@ hyper_ite_fontinit(ip) } } +void hyper_putc(ip, c, dy, dx, mode) - register struct ite_softc *ip; + register struct ite_data *ip; register int dy, dx; int c, mode; { @@ -124,8 +131,9 @@ hyper_putc(ip, c, dy, dx, mode) ip->ftheight, ip->ftwidth, RR_COPY); } +void hyper_cursor(ip, flag) - register struct ite_softc *ip; + register struct ite_data *ip; int flag; { switch (flag) { @@ -141,8 +149,9 @@ hyper_cursor(ip, flag) } } +void hyper_clear(ip, sy, sx, h, w) - struct ite_softc *ip; + struct ite_data *ip; register int sy, sx, h, w; { hyper_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth, @@ -151,8 +160,9 @@ hyper_clear(ip, sy, sx, h, w) RR_CLEAR); } +void hyper_scroll(ip, sy, sx, count, dir) - register struct ite_softc *ip; + register struct ite_data *ip; register int sy, count; int dir, sx; { @@ -247,8 +257,9 @@ int endtab[32] = 0xFFFFFFFE }; +void hyper_windowmove(ip, sy, sx, dy, dx, h, w, func) - struct ite_softc *ip; + struct ite_data *ip; int sy, sx, dy, dx, h, w, func; { unsigned int *psrcBase, *pdstBase; diff --git a/sys/arch/hp300/stand/ite_rb.c b/sys/arch/hp300/stand/ite_rb.c index a2390cc54a0b..f2053da77f66 100644 --- a/sys/arch/hp300/stand/ite_rb.c +++ b/sys/arch/hp300/stand/ite_rb.c @@ -1,4 +1,4 @@ -/* $NetBSD: ite_rb.c,v 1.7 1994/10/26 07:27:37 cgd Exp $ */ +/* $NetBSD: ite_rb.c,v 1.8 1996/03/03 04:23:38 thorpej Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -47,7 +47,7 @@ #ifdef ITECONSOLE #include -#include +#include #include #include @@ -55,8 +55,12 @@ #define REGBASE ((struct rboxfb *)(ip->regbase)) #define WINDOWMOVER rbox_windowmove +void rbox_windowmove __P((struct ite_data *, int, int, int, int, + int, int, int)); + +void rbox_init(ip) - struct ite_softc *ip; + struct ite_data *ip; { int i; @@ -125,8 +129,9 @@ rbox_init(ip) ip->ftwidth, RR_COPYINVERTED); } +void rbox_putc(ip, c, dy, dx, mode) - register struct ite_softc *ip; + register struct ite_data *ip; register int dy, dx; int c, mode; { @@ -135,8 +140,9 @@ rbox_putc(ip, c, dy, dx, mode) ip->ftheight, ip->ftwidth, RR_COPY); } +void rbox_cursor(ip, flag) - register struct ite_softc *ip; + register struct ite_data *ip; register int flag; { if (flag == DRAW_CURSOR) @@ -149,8 +155,9 @@ rbox_cursor(ip, flag) erase_cursor(ip) } +void rbox_clear(ip, sy, sx, h, w) - struct ite_softc *ip; + struct ite_data *ip; register int sy, sx, h, w; { rbox_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth, @@ -159,8 +166,9 @@ rbox_clear(ip, sy, sx, h, w) RR_CLEAR); } +void rbox_scroll(ip, sy, sx, count, dir) - register struct ite_softc *ip; + register struct ite_data *ip; register int sy, count; int dir, sx; { @@ -175,8 +183,9 @@ rbox_scroll(ip, sy, sx, count, dir) ip->cols * ip->ftwidth, RR_COPY); } +void rbox_windowmove(ip, sy, sx, dy, dx, h, w, func) - struct ite_softc *ip; + struct ite_data *ip; int sy, sx, dy, dx, h, w, func; { register struct rboxfb *rp = REGBASE; diff --git a/sys/arch/hp300/stand/ite_subr.c b/sys/arch/hp300/stand/ite_subr.c index 4a7ceca585ed..5be4068b1a30 100644 --- a/sys/arch/hp300/stand/ite_subr.c +++ b/sys/arch/hp300/stand/ite_subr.c @@ -1,4 +1,4 @@ -/* $NetBSD: ite_subr.c,v 1.7 1994/10/26 07:27:39 cgd Exp $ */ +/* $NetBSD: ite_subr.c,v 1.8 1996/03/03 04:23:40 thorpej Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -47,11 +47,11 @@ #ifdef ITECONSOLE #include -#include +#include #include ite_fontinfo(ip) - struct ite_softc *ip; + struct ite_data *ip; { u_long fontaddr = getword(ip, getword(ip, FONTROM) + FONTADDR); @@ -83,7 +83,7 @@ ite_fontinfo(ip) } ite_fontinit(ip) - register struct ite_softc *ip; + register struct ite_data *ip; { int bytewidth = (((ip->ftwidth - 1) / 8) + 1); int glyphsize = bytewidth * ip->ftheight; @@ -111,14 +111,15 @@ ite_fontinit(ip) */ u_char ite_readbyte(ip, disp) - struct ite_softc *ip; + struct ite_data *ip; int disp; { return((u_char) *(((u_char *)ip->regbase) + disp)); } +void ite_writeglyph(ip, fbmem, glyphp) - register struct ite_softc *ip; + register struct ite_data *ip; register u_char *fbmem, *glyphp; { register int bn; diff --git a/sys/arch/hp300/stand/ite_tc.c b/sys/arch/hp300/stand/ite_tc.c index cf0ea58df44c..2f0d52a48ffa 100644 --- a/sys/arch/hp300/stand/ite_tc.c +++ b/sys/arch/hp300/stand/ite_tc.c @@ -1,4 +1,4 @@ -/* $NetBSD: ite_tc.c,v 1.7 1994/10/26 07:27:41 cgd Exp $ */ +/* $NetBSD: ite_tc.c,v 1.8 1996/03/03 04:23:41 thorpej Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -47,7 +47,7 @@ #ifdef ITECONSOLE #include -#include +#include #include #include #include @@ -55,8 +55,12 @@ #define REGBASE ((struct tcboxfb *)(ip->regbase)) #define WINDOWMOVER topcat_windowmove +void topcat_windowmove __P((struct ite_data *, int, int, int, int, + int, int, int)); + +void topcat_init(ip) - register struct ite_softc *ip; + register struct ite_data *ip; { /* @@ -110,8 +114,9 @@ topcat_init(ip) ip->ftwidth, RR_COPYINVERTED); } +void topcat_putc(ip, c, dy, dx, mode) - register struct ite_softc *ip; + register struct ite_data *ip; register int dy, dx; int c, mode; { @@ -120,8 +125,9 @@ topcat_putc(ip, c, dy, dx, mode) ip->ftheight, ip->ftwidth, RR_COPY); } +void topcat_cursor(ip, flag) - register struct ite_softc *ip; + register struct ite_data *ip; register int flag; { if (flag == DRAW_CURSOR) @@ -134,8 +140,9 @@ topcat_cursor(ip, flag) erase_cursor(ip) } +void topcat_clear(ip, sy, sx, h, w) - struct ite_softc *ip; + struct ite_data *ip; register int sy, sx, h, w; { topcat_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth, @@ -144,8 +151,9 @@ topcat_clear(ip, sy, sx, h, w) RR_CLEAR); } +void topcat_scroll(ip, sy, sx, count, dir) - register struct ite_softc *ip; + register struct ite_data *ip; register int sy, count; int dir, sx; { @@ -160,8 +168,9 @@ topcat_scroll(ip, sy, sx, count, dir) ip->cols * ip->ftwidth, RR_COPY); } +void topcat_windowmove(ip, sy, sx, dy, dx, h, w, func) - struct ite_softc *ip; + struct ite_data *ip; int sy, sx, dy, dx, h, w, func; { register struct tcboxfb *rp = REGBASE; diff --git a/sys/arch/hp300/stand/itevar.h b/sys/arch/hp300/stand/itevar.h new file mode 100644 index 000000000000..1d6fbb4c2054 --- /dev/null +++ b/sys/arch/hp300/stand/itevar.h @@ -0,0 +1,231 @@ +/* $NetBSD: itevar.h,v 1.1 1996/03/03 04:23:42 thorpej Exp $ */ + +/* + * Copyright (c) 1988 University of Utah. + * 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. + * + * 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. + * + * 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. + * + * from: Utah $Hdr: itevar.h 1.15 92/12/20$ + * + * @(#)itevar.h 8.1 (Berkeley) 6/10/93 + */ + +/* + * Standalone version of hp300 ITE. + */ + +#define ITEUNIT(dev) minor(dev) + +#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_data { + int flags; + struct tty *tty; + struct itesw *isw; + struct grf_data *grf; + caddr_t regbase, fbbase; + short curx, cury; + short cursorx, cursory; + short cblankx, cblanky; + short rows, cols; + short cpl; + short dheight, dwidth; + short fbheight, fbwidth; + short ftheight, ftwidth; + short fontx, fonty; + short attribute; + u_char *attrbuf; + short planemask; + short pos; + char imode, escape, fpd, hold; + caddr_t devdata; /* display dependent data */ +}; + +struct itesw { + int ite_hwid; + void (*ite_init) __P((struct ite_data *)); + void (*ite_deinit) __P((struct ite_data *)); + void (*ite_clear) __P((struct ite_data *, int, int, int, int)); + void (*ite_putc) __P((struct ite_data *, int, int, int, int)); + void (*ite_cursor) __P((struct ite_data *, int)); + void (*ite_scroll) __P((struct ite_data *, int, int, int, int)); + u_char (*ite_readbyte) __P((struct ite_data *, int)); + void (*ite_writeglyph) __P((struct ite_data *, u_char *, u_char *)); +}; + +/* Flags */ +#define ITE_ALIVE 0x01 /* hardware exists */ +#define ITE_INITED 0x02 /* device has been initialized */ +#define ITE_CONSOLE 0x04 /* device can be console */ +#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_CURSORON 0x40 /* cursor being tracked */ + +#define attrloc(ip, y, x) \ + (ip->attrbuf + ((y) * ip->cols) + (x)) + +#define attrclr(ip, sy, sx, h, w) \ + bzero(ip->attrbuf + ((sy) * ip->cols) + (sx), (h) * (w)) + +#define attrmov(ip, sy, sx, dy, dx, h, w) \ + bcopy(ip->attrbuf + ((sy) * ip->cols) + (sx), \ + ip->attrbuf + ((dy) * ip->cols) + (dx), \ + (h) * (w)) + +#define attrtest(ip, attr) \ + ((* (u_char *) attrloc(ip, ip->cury, ip->curx)) & attr) + +#define attrset(ip, attr) \ + ((* (u_char *) attrloc(ip, ip->cury, ip->curx)) = attr) + +/* + * X and Y location of character 'c' in the framebuffer, in pixels. + */ +#define charX(ip,c) \ + (((c) % (ip)->cpl) * (ip)->ftwidth + (ip)->fontx) + +#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 */ +#define ATTR_UL 0x2 /* underline */ +#define ATTR_ALL (ATTR_INV | ATTR_UL) + +/* Keyboard attributes */ +#define ATTR_KPAD 0x4 /* keypad transmit */ + +/* Replacement Rules */ +#define RR_CLEAR 0x0 +#define RR_COPY 0x3 +#define RR_XOR 0x6 +#define RR_COPYINVERTED 0xc + +#define SCROLL_UP 0x01 +#define SCROLL_DOWN 0x02 +#define SCROLL_LEFT 0x03 +#define SCROLL_RIGHT 0x04 +#define DRAW_CURSOR 0x05 +#define ERASE_CURSOR 0x06 +#define MOVE_CURSOR 0x07 + +#define KBD_SSHIFT 4 /* bits to shift status */ +#define KBD_CHARMASK 0x7F + +/* keyboard status */ +#define KBD_SMASK 0xF /* service request status mask */ +#define KBD_CTRLSHIFT 0x8 /* key + CTRL + SHIFT */ +#define KBD_CTRL 0x9 /* key + CTRL */ +#define KBD_SHIFT 0xA /* key + SHIFT */ +#define KBD_KEY 0xB /* key only */ + +#define KBD_CAPSLOCK 0x18 + +#define KBD_EXT_LEFT_DOWN 0x12 +#define KBD_EXT_LEFT_UP 0x92 +#define KBD_EXT_RIGHT_DOWN 0x13 +#define KBD_EXT_RIGHT_UP 0x93 + +#define TABSIZE 8 +#define TABEND(ip) ((ip)->tty->t_winsize.ws_col - TABSIZE) + +extern struct ite_data ite_data[]; +extern struct itesw itesw[]; +extern int nitesw; + +/* + * Prototypes. + */ +u_char ite_readbyte __P((struct ite_data *, int)); +void ite_writeglyph __P((struct ite_data *, u_char *, u_char *)); + +/* + * Framebuffer-specific ITE prototypes. + */ +void topcat_init __P((struct ite_data *)); +void topcat_clear __P((struct ite_data *, int, int, int, int)); +void topcat_putc __P((struct ite_data *, int, int, int, int)); +void topcat_cursor __P((struct ite_data *, int)); +void topcat_scroll __P((struct ite_data *, int, int, int, int)); + +void gbox_init __P((struct ite_data *)); +void gbox_clear __P((struct ite_data *, int, int, int, int)); +void gbox_putc __P((struct ite_data *, int, int, int, int)); +void gbox_cursor __P((struct ite_data *, int)); +void gbox_scroll __P((struct ite_data *, int, int, int, int)); + +void rbox_init __P((struct ite_data *)); +void rbox_clear __P((struct ite_data *, int, int, int, int)); +void rbox_putc __P((struct ite_data *, int, int, int, int)); +void rbox_cursor __P((struct ite_data *, int)); +void rbox_scroll __P((struct ite_data *, int, int, int, int)); + +void dvbox_init __P((struct ite_data *)); +void dvbox_clear __P((struct ite_data *, int, int, int, int)); +void dvbox_putc __P((struct ite_data *, int, int, int, int)); +void dvbox_cursor __P((struct ite_data *, int)); +void dvbox_scroll __P((struct ite_data *, int, int, int, int)); + +void hyper_init __P((struct ite_data *)); +void hyper_clear __P((struct ite_data *, int, int, int, int)); +void hyper_putc __P((struct ite_data *, int, int, int, int)); +void hyper_cursor __P((struct ite_data *, int)); +void hyper_scroll __P((struct ite_data *, int, int, int, int));