Module Name:    src
Committed By:   tsutsui
Date:           Thu Feb 10 12:46:22 UTC 2011

Modified Files:
        src/sys/arch/hp300/stand/common: ite.c ite_dv.c ite_gb.c ite_hy.c
            ite_rb.c ite_subr.c ite_tc.c itevar.h

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/hp300/stand/common/ite.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/hp300/stand/common/ite_dv.c \
    src/sys/arch/hp300/stand/common/ite_gb.c \
    src/sys/arch/hp300/stand/common/ite_subr.c \
    src/sys/arch/hp300/stand/common/ite_tc.c
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/hp300/stand/common/ite_hy.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/hp300/stand/common/ite_rb.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/hp300/stand/common/itevar.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/hp300/stand/common/ite.c
diff -u src/sys/arch/hp300/stand/common/ite.c:1.13 src/sys/arch/hp300/stand/common/ite.c:1.14
--- src/sys/arch/hp300/stand/common/ite.c:1.13	Thu Feb 10 11:17:21 2011
+++ src/sys/arch/hp300/stand/common/ite.c	Thu Feb 10 12:46:22 2011
@@ -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;
 		}

Index: src/sys/arch/hp300/stand/common/ite_dv.c
diff -u src/sys/arch/hp300/stand/common/ite_dv.c:1.9 src/sys/arch/hp300/stand/common/ite_dv.c:1.10
--- src/sys/arch/hp300/stand/common/ite_dv.c:1.9	Thu Feb 10 11:08:23 2011
+++ src/sys/arch/hp300/stand/common/ite_dv.c	Thu Feb 10 12:46:22 2011
@@ -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
Index: src/sys/arch/hp300/stand/common/ite_gb.c
diff -u src/sys/arch/hp300/stand/common/ite_gb.c:1.9 src/sys/arch/hp300/stand/common/ite_gb.c:1.10
--- src/sys/arch/hp300/stand/common/ite_gb.c:1.9	Thu Feb 10 11:08:23 2011
+++ src/sys/arch/hp300/stand/common/ite_gb.c	Thu Feb 10 12:46:22 2011
@@ -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)
 {
 	struct gboxfb *regbase = (void *)ip->regbase;
-	int height, dy, i;
 
 	tile_mover_waitbusy(regbase);
 	regbase->write_protect = 0x0;
 
-	gbox_cursor(ip, ERASE_CURSOR);
-
-	dy = sy - count;
-	height = ip->rows - sy;
-	for (i = 0; i < height; i++)
-		gbox_blockmove(ip, sy + i, sx, dy + i, 0, 1, ip->cols);
+	ite_dio_scroll(ip);
 }
 
 void
Index: src/sys/arch/hp300/stand/common/ite_subr.c
diff -u src/sys/arch/hp300/stand/common/ite_subr.c:1.9 src/sys/arch/hp300/stand/common/ite_subr.c:1.10
--- src/sys/arch/hp300/stand/common/ite_subr.c:1.9	Thu Feb 10 11:08:23 2011
+++ src/sys/arch/hp300/stand/common/ite_subr.c	Thu Feb 10 12:46:22 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: ite_subr.c,v 1.9 2011/02/10 11:08:23 tsutsui Exp $	*/
+/*	$NetBSD: ite_subr.c,v 1.10 2011/02/10 12:46:22 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -47,6 +47,12 @@
 #include <hp300/stand/common/samachdep.h>
 #include <hp300/stand/common/itevar.h>
 
+#define getbyte(ip, offset) \
+	*(((u_char *)(ip)->regbase) + (offset))
+
+#define getword(ip, offset) \
+	((getbyte(ip, offset) << 8) | getbyte(ip, (offset) + 2))
+
 static void ite_writeglyph(struct ite_data *, u_char *, u_char *);
 
 void
@@ -68,8 +74,7 @@
 		ip->cpl      = (ip->fbwidth - ip->dwidth) / ip->ftwidth;
 		ip->cblankx  = ip->dwidth;
 		ip->cblanky  = ip->fonty + ((128 / ip->cpl) +1) * ip->ftheight;
-	}
-	else {
+	} else {
 		/*
 		 * Stuff goes below the display.
 		 */
@@ -94,9 +99,8 @@
 	width = (ip->ftwidth + 7) / 8;
 
 	for (c = 0; c < 128; c++) {
-		fbmem = (u_char *) FBBASE +
-			(ip->fonty + (c / ip->cpl) * ip->ftheight) *
-			stride;
+		fbmem = (u_char *)FBBASE +
+		    (ip->fonty + (c / ip->cpl) * ip->ftheight) * stride;
 		fbmem += (ip->fontx >> 3) + (c % ip->cpl) * width;
 		for (l = 0; l < ip->ftheight; l++) {
 			for (b = 0; b < width; b++) {
@@ -120,8 +124,7 @@
 
 	romp = getword(ip, getword(ip, FONTROM) + FONTADDR) + FONTDATA;
 	for (c = 0; c < 128; c++) {
-		fbmem = (u_char *)
-		    (FBBASE +
+		fbmem = (u_char *)(FBBASE +
 		     (ip->fonty + (c / ip->cpl) * ip->ftheight) * ip->fbwidth +
 		     (ip->fontx + (c % ip->cpl) * ip->ftwidth));
 		dp = fontbuf;
@@ -157,4 +160,248 @@
 		fbmem += ip->fbwidth;
 	}
 }
+
+/*
+ * The cursor is just an inverted space.
+ */
+#define flip_cursor(ip) \
+	(*ip->bmv)(ip, ip->cblanky, ip->cblankx, ip->cursory * ip->ftheight, \
+	    ip->cursorx * ip->ftwidth, ip->ftheight, ip->ftwidth, RR_XOR)
+
+void
+ite_dio_cursor(struct ite_data *ip, int flag)
+{
+
+	switch (flag) {
+	case MOVE_CURSOR:
+		flip_cursor(ip);
+		/* FALLTHROUGH */
+	case DRAW_CURSOR:
+		ip->cursorx = ip->curx;
+		ip->cursory = ip->cury;
+		/* FALLTHROUGH */
+	default:
+		flip_cursor(ip);
+		break;
+	}
+}
+
+void
+ite_dio_putc1bpp(struct ite_data *ip, int c, int dy, int dx)
+{
+
+	ite_dio_windowmove1bpp(ip, charY(ip, c), charX1bpp(ip, c),
+	    dy * ip->ftheight, dx * ip->ftwidth,
+	    ip->ftheight, ip->ftwidth, RR_COPY);
+}
+
+void
+ite_dio_putc8bpp(struct ite_data *ip, int c, int dy, int dx)
+{
+
+	(*ip->bmv)(ip, charY(ip, c), charX(ip, c),
+	    dy * ip->ftheight, dx * ip->ftwidth,
+	    ip->ftheight, ip->ftwidth, RR_COPY);
+}
+
+void
+ite_dio_clear(struct ite_data *ip, int sy, int sx, int h, int w)
+{
+
+	(*ip->bmv)(ip, sy * ip->ftheight, sx * ip->ftwidth,
+	    sy * ip->ftheight, sx * ip->ftwidth,
+	    h  * ip->ftheight, w  * ip->ftwidth, RR_CLEAR);
+}
+
+void
+ite_dio_scroll(struct ite_data *ip)
+{
+
+	flip_cursor(ip);
+
+	(*ip->bmv)(ip, ip->ftheight, 0, 0, 0, (ip->rows - 1) * ip->ftheight,
+	    ip->cols * ip->ftwidth, RR_COPY);
+}
+
+#include <hp300/stand/common/maskbits.h>
+
+/* NOTE:
+ * the first element in starttab could be 0xffffffff.  making it 0
+ * lets us deal with a full first word in the middle loop, rather
+ * than having to do the multiple reads and masks that we'd
+ * have to do if we thought it was partial.
+ */
+int starttab[32] = {
+	0x00000000,
+	0x7FFFFFFF,
+	0x3FFFFFFF,
+	0x1FFFFFFF,
+	0x0FFFFFFF,
+	0x07FFFFFF,
+	0x03FFFFFF,
+	0x01FFFFFF,
+	0x00FFFFFF,
+	0x007FFFFF,
+	0x003FFFFF,
+	0x001FFFFF,
+	0x000FFFFF,
+	0x0007FFFF,
+	0x0003FFFF,
+	0x0001FFFF,
+	0x0000FFFF,
+	0x00007FFF,
+	0x00003FFF,
+	0x00001FFF,
+	0x00000FFF,
+	0x000007FF,
+	0x000003FF,
+	0x000001FF,
+	0x000000FF,
+	0x0000007F,
+	0x0000003F,
+	0x0000001F,
+	0x0000000F,
+	0x00000007,
+	0x00000003,
+	0x00000001
+};
+
+int endtab[32] = {
+	0x00000000,
+	0x80000000,
+	0xC0000000,
+	0xE0000000,
+	0xF0000000,
+	0xF8000000,
+	0xFC000000,
+	0xFE000000,
+	0xFF000000,
+	0xFF800000,
+	0xFFC00000,
+	0xFFE00000,
+	0xFFF00000,
+	0xFFF80000,
+	0xFFFC0000,
+	0xFFFE0000,
+	0xFFFF0000,
+	0xFFFF8000,
+	0xFFFFC000,
+	0xFFFFE000,
+	0xFFFFF000,
+	0xFFFFF800,
+	0xFFFFFC00,
+	0xFFFFFE00,
+	0xFFFFFF00,
+	0xFFFFFF80,
+	0xFFFFFFC0,
+	0xFFFFFFE0,
+	0xFFFFFFF0,
+	0xFFFFFFF8,
+	0xFFFFFFFC,
+	0xFFFFFFFE
+};
+
+void
+ite_dio_windowmove1bpp(struct ite_data *ip, int sy, int sx, int dy, int dx,
+    int h, int w, int func)
+{
+	int width;		/* add to get to same position in next line */
+
+	unsigned int *psrcLine, *pdstLine;
+				/* pointers to line with current src and dst */
+	unsigned int *psrc;	/* pointer to current src longword */
+	unsigned int *pdst;	/* pointer to current dst longword */
+
+				/* following used for looping through a line */
+	unsigned int startmask, endmask;  /* masks for writing ends of dst */
+	int nlMiddle;		/* whole longwords in dst */
+	int nl;			/* temp copy of nlMiddle */
+	unsigned int tmpSrc;	/* place to store full source word */
+	int xoffSrc;		/* offset (>= 0, < 32) from which to
+				   fetch whole longwords fetched
+				   in src */
+	int nstart;		/* number of ragged bits at start of dst */
+	int nend;		/* number of ragged bits at end of dst */
+	int srcStartOver;	/* pulling nstart bits from src
+				   overflows into the next word? */
+
+	if (h == 0 || w == 0)
+		return;
+
+	width = ip->fbwidth >> 5;
+	psrcLine = ((unsigned int *) ip->fbbase) + (sy * width);
+	pdstLine = ((unsigned int *) ip->fbbase) + (dy * width);
+
+	/* x direction doesn't matter for < 1 longword */
+	if (w <= 32) {
+		int srcBit, dstBit;     /* bit offset of src and dst */
+
+		pdstLine += (dx >> 5);
+		psrcLine += (sx >> 5);
+		psrc = psrcLine;
+		pdst = pdstLine;
+
+		srcBit = sx & 0x1f;
+		dstBit = dx & 0x1f;
+
+		while (h--) {
+			getandputrop(psrc, srcBit, dstBit, w, pdst, func);
+			pdst += width;
+			psrc += width;
+		}
+	} else {
+		maskbits(dx, w, startmask, endmask, nlMiddle);
+		if (startmask)
+			nstart = 32 - (dx & 0x1f);
+		else
+			nstart = 0;
+		if (endmask)
+			nend = (dx + w) & 0x1f;
+		else
+			nend = 0;
+
+		xoffSrc = ((sx & 0x1f) + nstart) & 0x1f;
+		srcStartOver = ((sx & 0x1f) + nstart) > 31;
+
+		pdstLine += (dx >> 5);
+		psrcLine += (sx >> 5);
+
+		while (h--) {
+			psrc = psrcLine;
+			pdst = pdstLine;
+
+			if (startmask) {
+				getandputrop(psrc, (sx & 0x1f), (dx & 0x1f),
+				    nstart, pdst, func);
+				pdst++;
+				if (srcStartOver)
+					psrc++;
+			}
+
+			/* special case for aligned operations */
+			if (xoffSrc == 0) {
+				nl = nlMiddle;
+				while (nl--) {
+					DoRop(*pdst, func, *psrc++, *pdst);
+					pdst++;
+				}
+			} else {
+				nl = nlMiddle + 1;
+				while (--nl) {
+					getunalignedword(psrc, xoffSrc, tmpSrc);
+					DoRop(*pdst, func, tmpSrc, *pdst);
+					pdst++;
+					psrc++;
+				}
+			}
+
+			if (endmask) {
+				getandputrop0(psrc, xoffSrc, nend, pdst, func);
+			}
+
+			pdstLine += width;
+			psrcLine += width;
+		}
+	}
+}
 #endif
Index: src/sys/arch/hp300/stand/common/ite_tc.c
diff -u src/sys/arch/hp300/stand/common/ite_tc.c:1.9 src/sys/arch/hp300/stand/common/ite_tc.c:1.10
--- src/sys/arch/hp300/stand/common/ite_tc.c:1.9	Thu Feb 10 11:08:23 2011
+++ src/sys/arch/hp300/stand/common/ite_tc.c	Thu Feb 10 12:46:22 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: ite_tc.c,v 1.9 2011/02/10 11:08:23 tsutsui Exp $	*/
+/*	$NetBSD: ite_tc.c,v 1.10 2011/02/10 12:46:22 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -49,8 +49,6 @@
 #include <hp300/stand/common/samachdep.h>
 #include <hp300/stand/common/itevar.h>
 
-#define WINDOWMOVER 	topcat_windowmove
-
 void topcat_windowmove(struct ite_data *, int, int, int, int, int, int, int);
 
 void
@@ -58,6 +56,8 @@
 {
 	struct tcboxfb *regbase = (void *)ip->regbase;
 
+	ip->bmv = topcat_windowmove;
+
 	/*
 	 * Catseye looks a lot like a topcat, but not completely.
 	 * So, we set some bits to make it work.
@@ -75,7 +75,7 @@
 
 	/*
 	 * Determine the number of planes by writing to the first frame
-	 * buffer display location, then reading it back. 
+	 * buffer display location, then reading it back.
 	 */
 	regbase->wen = ~0;
 	regbase->fben = ~0;
@@ -110,57 +110,11 @@
 }
 
 void
-topcat_putc(struct ite_data *ip, int c, int dy, int dx, int mode)
-{
-
-	topcat_windowmove(ip, charY(ip, c), charX(ip, c),
-			  dy * ip->ftheight, dx * ip->ftwidth,
-			  ip->ftheight, ip->ftwidth, RR_COPY);
-}
-
-void
-topcat_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
-topcat_clear(struct ite_data *ip, int sy, int sx, int h, int w)
-{
-
-	topcat_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth,
-			  sy * ip->ftheight, sx * ip->ftwidth, 
-			  h  * ip->ftheight, w  * ip->ftwidth,
-			  RR_CLEAR);
-}
-
-void
-topcat_scroll(struct ite_data *ip, int sy, int sx, int count, int dir)
-{
-	int dy = sy - count;
-	int height = ip->rows - sy;
-
-	topcat_cursor(ip, ERASE_CURSOR);
-
-	topcat_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth,
-			  dy * ip->ftheight, sx * ip->ftwidth,
-			  height * ip->ftheight,
-			  ip->cols  * ip->ftwidth, RR_COPY);
-}
-
-void
-topcat_windowmove(struct ite_data *ip, int sy, int sx, int dy, int dx,
-    int h, int w, int func)
+topcat_windowmove(struct ite_data *ip, int sy, int sx, int dy, int dx, int h,
+    int w, int func)
 {
 	struct tcboxfb *rp = (void *)ip->regbase;
-	
+
 	if (h == 0 || w == 0)
 		return;
 	tc_waitbusy(rp, ip->planemask);

Index: src/sys/arch/hp300/stand/common/ite_hy.c
diff -u src/sys/arch/hp300/stand/common/ite_hy.c:1.11 src/sys/arch/hp300/stand/common/ite_hy.c:1.12
--- src/sys/arch/hp300/stand/common/ite_hy.c:1.11	Thu Feb 10 11:08:23 2011
+++ src/sys/arch/hp300/stand/common/ite_hy.c	Thu Feb 10 12:46:22 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: ite_hy.c,v 1.11 2011/02/10 11:08:23 tsutsui Exp $	*/
+/*	$NetBSD: ite_hy.c,v 1.12 2011/02/10 12:46:22 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -49,272 +49,33 @@
 #include <hp300/stand/common/samachdep.h>
 #include <hp300/stand/common/itevar.h>
 
-#define WINDOWMOVER     hyper_windowmove
-
-#undef charX
-#define	charX(ip,c)	\
-	(((c) % (ip)->cpl) * ((((ip)->ftwidth + 7) / 8) * 8) + (ip)->fontx)
-
-void hyper_windowmove(struct ite_data *, int, int, int, int, int, int, int);
-
 void
 hyper_init(struct ite_data *ip)
 {
 	struct hyboxfb *regbase = (void *)ip->regbase;
 	int width;
 
+	ip->bmv = ite_dio_windowmove1bpp;
 	ite_fontinfo(ip);
 	width = ((ip->ftwidth + 7) / 8) * 8;
 	ip->cpl      = (ip->fbwidth - ip->dwidth) / width;
 	ip->cblanky  = ip->fonty + ((128 / ip->cpl) +1) * ip->ftheight;
 
 	regbase->nblank = 0x05;
-	
+
 	/*
 	 * Clear the framebuffer on all planes.
 	 */
-	hyper_windowmove(ip, 0, 0, 0, 0, ip->fbheight, ip->fbwidth, RR_CLEAR);
+	ite_dio_windowmove1bpp(ip, 0, 0, 0, 0, ip->fbheight, ip->fbwidth,
+	    RR_CLEAR);
 
 	ite_fontinit1bpp(ip);
 
 	/*
 	 * Stash the inverted cursor.
 	 */
-	hyper_windowmove(ip, charY(ip, ' '), charX(ip, ' '),
-			 ip->cblanky, ip->cblankx, ip->ftheight,
-			 ip->ftwidth, RR_COPYINVERTED);
-}
-
-void
-hyper_putc(struct ite_data *ip, int c, int dy, int dx, int mode)
-{
-
-	hyper_windowmove(ip, charY(ip, c), charX(ip, c),
-			 dy * ip->ftheight, dx * ip->ftwidth,
-			 ip->ftheight, ip->ftwidth, RR_COPY);
-}
-
-void
-hyper_cursor(struct ite_data *ip, int flag)
-{
-
-	switch (flag) {
-	case MOVE_CURSOR:
-		erase_cursor(ip);
-		/* fall through ... */
-	case DRAW_CURSOR:
-		draw_cursor(ip);
-		break;
-	default:
-		erase_cursor(ip);
-		break;
-	}
-}
-
-void
-hyper_clear(struct ite_data *ip, int sy, int sx, int h, int w)
-{
-
-	hyper_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth,
-			 sy * ip->ftheight, sx * ip->ftwidth, 
-			 h  * ip->ftheight, w  * ip->ftwidth,
-			 RR_CLEAR);
-}
-
-void
-hyper_scroll(struct ite_data *ip, int sy, int sx, int count, int dir)
-{
-	int dy = sy - count;
-	int height = ip->rows - sy;
-
-	hyper_cursor(ip, ERASE_CURSOR);
-
-	hyper_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth,
-			 dy * ip->ftheight, sx * ip->ftwidth,
-			 height * ip->ftheight,
-			 ip->cols  * ip->ftwidth, RR_COPY);
-}
-
-#include <hp300/stand/common/maskbits.h>
-
-/* NOTE:
- * the first element in starttab could be 0xffffffff.  making it 0
- * lets us deal with a full first word in the middle loop, rather
- * than having to do the multiple reads and masks that we'd
- * have to do if we thought it was partial.
- */
-int starttab[32] = {
-	0x00000000,
-	0x7FFFFFFF,
-	0x3FFFFFFF,
-	0x1FFFFFFF,
-	0x0FFFFFFF,
-	0x07FFFFFF,
-	0x03FFFFFF,
-	0x01FFFFFF,
-	0x00FFFFFF,
-	0x007FFFFF,
-	0x003FFFFF,
-	0x001FFFFF,
-	0x000FFFFF,
-	0x0007FFFF,
-	0x0003FFFF,
-	0x0001FFFF,
-	0x0000FFFF,
-	0x00007FFF,
-	0x00003FFF,
-	0x00001FFF,
-	0x00000FFF,
-	0x000007FF,
-	0x000003FF,
-	0x000001FF,
-	0x000000FF,
-	0x0000007F,
-	0x0000003F,
-	0x0000001F,
-	0x0000000F,
-	0x00000007,
-	0x00000003,
-	0x00000001
-};
-
-int endtab[32] = {
-	0x00000000,
-	0x80000000,
-	0xC0000000,
-	0xE0000000,
-	0xF0000000,
-	0xF8000000,
-	0xFC000000,
-	0xFE000000,
-	0xFF000000,
-	0xFF800000,
-	0xFFC00000,
-	0xFFE00000,
-	0xFFF00000,
-	0xFFF80000,
-	0xFFFC0000,
-	0xFFFE0000,
-	0xFFFF0000,
-	0xFFFF8000,
-	0xFFFFC000,
-	0xFFFFE000,
-	0xFFFFF000,
-	0xFFFFF800,
-	0xFFFFFC00,
-	0xFFFFFE00,
-	0xFFFFFF00,
-	0xFFFFFF80,
-	0xFFFFFFC0,
-	0xFFFFFFE0,
-	0xFFFFFFF0,
-	0xFFFFFFF8,
-	0xFFFFFFFC,
-	0xFFFFFFFE
-};
-
-void
-hyper_windowmove(struct ite_data *ip, int sy, int sx, int dy, int dx,
-    int h, int w, int func)
-{
-	int width;		/* add to get to same position in next line */
-
-	unsigned int *psrcLine, *pdstLine;
-				/* pointers to line with current src and dst */
-	unsigned int *psrc;	/* pointer to current src longword */
-	unsigned int *pdst;	/* pointer to current dst longword */
-
-				/* following used for looping through a line */
-	unsigned int startmask, endmask;  /* masks for writing ends of dst */
-	int nlMiddle;		/* whole longwords in dst */
-	int nl;			/* temp copy of nlMiddle */
-	unsigned int tmpSrc;
-				/* place to store full source word */
-	int xoffSrc;		/* offset (>= 0, < 32) from which to
-				   fetch whole longwords fetched
-				   in src */
-	int nstart;		/* number of ragged bits at start of dst */
-	int nend;		/* number of ragged bits at end of dst */
-	int srcStartOver;	/* pulling nstart bits from src
-				   overflows into the next word? */
-
-	if (h == 0 || w == 0)
-		return;
-
-	width = ip->fbwidth >> 5;
-	psrcLine = ((unsigned int *) ip->fbbase) + (sy * width);
-	pdstLine = ((unsigned int *) ip->fbbase) + (dy * width);
-
-	/* x direction doesn't matter for < 1 longword */
-	if (w <= 32) {
-		int srcBit, dstBit;     /* bit offset of src and dst */
-
-		pdstLine += (dx >> 5);
-		psrcLine += (sx >> 5);
-		psrc = psrcLine;
-		pdst = pdstLine;
-
-		srcBit = sx & 0x1f;
-		dstBit = dx & 0x1f;
-
-		while (h--) {
-			getandputrop(psrc, srcBit, dstBit, w, pdst, func);
-		        pdst += width;
-			psrc += width;
-		}
-	} else {
-		maskbits(dx, w, startmask, endmask, nlMiddle);
-		if (startmask)
-			nstart = 32 - (dx & 0x1f);
-		else
-			nstart = 0;
-		if (endmask)
-			nend = (dx + w) & 0x1f;
-		else
-			nend = 0;
-
-		xoffSrc = ((sx & 0x1f) + nstart) & 0x1f;
-		srcStartOver = ((sx & 0x1f) + nstart) > 31;
-
-		pdstLine += (dx >> 5);
-		psrcLine += (sx >> 5);
-
-		while (h--) {
-		        psrc = psrcLine;
-			pdst = pdstLine;
-
-			if (startmask) {
-				getandputrop(psrc, (sx & 0x1f),
-				    (dx & 0x1f), nstart, pdst, func);
-				pdst++;
-				if (srcStartOver)
-					psrc++;
-			}
-
-			/* special case for aligned operations */
-			if (xoffSrc == 0) {
-				nl = nlMiddle;
-				while (nl--) {
-					DoRop (*pdst, func, *psrc++, *pdst);
-					pdst++;
-		    		}
-			} else {
-				nl = nlMiddle + 1;
-				while (--nl) {
-					getunalignedword(psrc, xoffSrc, tmpSrc);
-					DoRop(*pdst, func, tmpSrc, *pdst);
-					pdst++;
-					psrc++;
-				}
-			}
-
-			if (endmask) {
-				getandputrop0(psrc, xoffSrc, nend, pdst, func);
-			}
-
-			pdstLine += width;
-			psrcLine += width;
-		}
-	}
+	ite_dio_windowmove1bpp(ip, charY(ip, ' '), charX1bpp(ip, ' '),
+	    ip->cblanky, ip->cblankx, ip->ftheight, ip->ftwidth,
+	    RR_COPYINVERTED);
 }
 #endif

Index: src/sys/arch/hp300/stand/common/ite_rb.c
diff -u src/sys/arch/hp300/stand/common/ite_rb.c:1.10 src/sys/arch/hp300/stand/common/ite_rb.c:1.11
--- src/sys/arch/hp300/stand/common/ite_rb.c:1.10	Thu Feb 10 11:08:23 2011
+++ src/sys/arch/hp300/stand/common/ite_rb.c	Thu Feb 10 12:46:22 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: ite_rb.c,v 1.10 2011/02/10 11:08:23 tsutsui Exp $	*/
+/*	$NetBSD: ite_rb.c,v 1.11 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	rbox_windowmove
-
 void rbox_windowmove(struct ite_data *, int, int, int, int, int, int, int);
 
 void
@@ -57,7 +55,9 @@
 {
 	struct rboxfb *regbase = (void *)ip->regbase;
 	int i;
-	
+
+	ip->bmv = rbox_windowmove;
+
 	rb_waitbusy(regbase);
 	DELAY(3000);
 
@@ -68,7 +68,7 @@
 	regbase->vdrive = 0x0;
 
 	ite_fontinfo(ip);
-	
+
 	regbase->opwen = 0xFF;
 
 	/*
@@ -76,7 +76,7 @@
 	 */
 	rbox_windowmove(ip, 0, 0, 0, 0, ip->fbheight, ip->fbwidth, RR_CLEAR);
 	rb_waitbusy(regbase);
-	
+
 	for(i = 0; i < 16; i++) {
 		*((char *)ip->regbase + 0x63c3 + i * 4) = 0x0;
 		*((char *)ip->regbase + 0x6403 + i * 4) = 0x0;
@@ -89,7 +89,7 @@
 	}
 
 	regbase->rep_rule = 0x33;
-	
+
 	/*
 	 * I cannot figure out how to make the blink planes stop. So, we
 	 * must set both colormaps so that when the planes blink, and
@@ -112,7 +112,7 @@
 	regbase->blink = 0x00;
 	regbase->write_enable = 0x01;
 	regbase->opwen = 0x00;
-	
+
 	ite_fontinit8bpp(ip);
 
 	/*
@@ -124,60 +124,14 @@
 }
 
 void
-rbox_putc(struct ite_data *ip, int c, int dy, int dx, int mode)
-{
-
-	rbox_windowmove(ip, charY(ip, c), charX(ip, c),
-			dy * ip->ftheight, dx * ip->ftwidth,
-			ip->ftheight, ip->ftwidth, RR_COPY);
-}
-
-void
-rbox_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
-rbox_clear(struct ite_data *ip, int sy, int sx, int h, int w)
-{
-
-	rbox_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth,
-			sy * ip->ftheight, sx * ip->ftwidth, 
-			h  * ip->ftheight, w  * ip->ftwidth,
-			RR_CLEAR);
-}
-
-void
-rbox_scroll(struct ite_data *ip, int sy, int sx, int count, int dir)
-{
-	int dy = sy - count;
-	int height = ip->rows - sy;
-
-	rbox_cursor(ip, ERASE_CURSOR);
-
-	rbox_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth,
-			dy * ip->ftheight, sx * ip->ftwidth,
-			height * ip->ftheight,
-			ip->cols * ip->ftwidth, RR_COPY);
-}
-
-void
-rbox_windowmove(struct ite_data *ip, int sy, int sx, int dy, int dx,
-    int h, int w, int func)
+rbox_windowmove(struct ite_data *ip, int sy, int sx, int dy, int dx, int h,
+    int w, int func)
 {
 	struct rboxfb *rp = (void *)ip->regbase;
 
 	if (h == 0 || w == 0)
 		return;
-	
+
 	rb_waitbusy(rp);
 	rp->rep_rule = func << 4 | func;
 	rp->source_y = sy;

Index: src/sys/arch/hp300/stand/common/itevar.h
diff -u src/sys/arch/hp300/stand/common/itevar.h:1.12 src/sys/arch/hp300/stand/common/itevar.h:1.13
--- src/sys/arch/hp300/stand/common/itevar.h:1.12	Thu Feb 10 11:17:21 2011
+++ src/sys/arch/hp300/stand/common/itevar.h	Thu Feb 10 12:46:22 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: itevar.h,v 1.12 2011/02/10 11:17:21 tsutsui Exp $	*/
+/*	$NetBSD: itevar.h,v 1.13 2011/02/10 12:46:22 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -42,19 +42,14 @@
  * Standalone version of hp300 ITE.
  */
 
-#define ITEUNIT(dev)       minor(dev)
+struct ite_data;
 
-#define getbyte(ip, offset) \
-	*(((u_char *)(ip)->regbase) + (offset))
-
-#define getword(ip, offset) \
-	((getbyte(ip, offset) << 8) | getbyte(ip, (offset) + 2))
+typedef	void (*ite_windowmover)(struct ite_data *, int, int, int, int, int,
+	    int, int);
 
 struct ite_data {
-	int	flags;
-	struct	tty *tty;
+	int	alive;
 	struct  itesw *isw;
-	struct  grf_data *grf;
 	void 	*regbase, *fbbase;
 	short	curx, cury;
 	short   cursorx, cursory;
@@ -65,117 +60,50 @@
 	short	fbheight, fbwidth;
 	short	ftheight, ftwidth;
 	short	fontx, fonty;
-	short   attribute;
-	u_char	*attrbuf;
 	short	planemask;
-	short	pos;
-	char	imode, escape, fpd, hold;
-	void *	devdata;			/* display dependent data */
+	ite_windowmover bmv;
 };
 
 struct itesw {
 	int	ite_hwid;
 	void	(*ite_init)(struct ite_data *);
 	void	(*ite_clear)(struct ite_data *, int, int, int, int);
-	void	(*ite_putc)(struct ite_data *, int, int, int, int);
+	void	(*ite_putc)(struct ite_data *, int, int, int);
 	void	(*ite_cursor)(struct ite_data *, int);
-	void	(*ite_scroll)(struct ite_data *, int, int, int, int);
+	void	(*ite_scroll)(struct ite_data *);
 };
 
-/* 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) \
-	memset(ip->attrbuf + ((sy) * ip->cols) + (sx), 0, (h) * (w))
-  
-#define attrmov(ip, sy, sx, dy, dx, h, w) \
-	memmove(ip->attrbuf + ((dy) * ip->cols) + (dx), \
-	    ip->attrbuf + ((sy) * ip->cols) + (sx), \
-	    (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 charX1bpp(ip,c) \
+	(((c) % (ip)->cpl) * ((((ip)->ftwidth + 7) / 8) * 8) + (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
+#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)
+#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 */
 
 extern	struct ite_data ite_data[];
 extern	struct itesw itesw[];
@@ -187,36 +115,20 @@
 void ite_fontinfo(struct ite_data *);
 void ite_fontinit1bpp(struct ite_data *);
 void ite_fontinit8bpp(struct ite_data *);
+void ite_dio_clear(struct ite_data *, int, int, int, int);
+void ite_dio_cursor(struct ite_data *, int);
+void ite_dio_putc1bpp(struct ite_data *, int, int, int);
+void ite_dio_putc8bpp(struct ite_data *, int, int, int);
+void ite_dio_scroll(struct ite_data *);
+void ite_dio_windowmove1bpp(struct ite_data *, int, int, int, int,
+    int, int, int);
 
 /*
  * Framebuffer-specific ITE prototypes.
  */
 void topcat_init(struct ite_data *);
-void topcat_clear(struct ite_data *, int, int, int, int);
-void topcat_putc(struct ite_data *, int, int, int, int);
-void topcat_cursor(struct ite_data *, int);
-void topcat_scroll(struct ite_data *, int, int, int, int);
-
 void gbox_init(struct ite_data *);
-void gbox_clear(struct ite_data *, int, int, int, int);
-void gbox_putc(struct ite_data *, int, int, int, int);
-void gbox_cursor(struct ite_data *, int);
-void gbox_scroll(struct ite_data *, int, int, int, int);
-
+void gbox_scroll(struct ite_data *);
 void rbox_init(struct ite_data *);
-void rbox_clear(struct ite_data *, int, int, int, int);
-void rbox_putc(struct ite_data *, int, int, int, int);
-void rbox_cursor(struct ite_data *, int);
-void rbox_scroll(struct ite_data *, int, int, int, int);
-
 void dvbox_init(struct ite_data *);
-void dvbox_clear(struct ite_data *, int, int, int, int);
-void dvbox_putc(struct ite_data *, int, int, int, int);
-void dvbox_cursor(struct ite_data *, int);
-void dvbox_scroll(struct ite_data *, int, int, int, int);
-
 void hyper_init(struct ite_data *);
-void hyper_clear(struct ite_data *, int, int, int, int);
-void hyper_putc(struct ite_data *, int, int, int, int);
-void hyper_cursor(struct ite_data *, int);
-void hyper_scroll(struct ite_data *, int, int, int, int);

Reply via email to