Home | History | Annotate | Line # | Download | only in dev
ite_ul.c revision 1.9.22.1
      1  1.9.22.1  jdolecek /*	$NetBSD: ite_ul.c,v 1.9.22.1 2002/02/11 20:07:02 jdolecek Exp $ */
      2       1.1    chopps 
      3       1.8        is /*-
      4       1.9        is  * Copyright (c) 1995 The NetBSD Foundation, Inc.
      5       1.1    chopps  * All rights reserved.
      6       1.1    chopps  *
      7       1.8        is  * This code is derived from software contributed to The NetBSD Foundation
      8       1.8        is  * by Ignatios Souvatzis.
      9       1.8        is  *
     10       1.1    chopps  * Redistribution and use in source and binary forms, with or without
     11       1.1    chopps  * modification, are permitted provided that the following conditions
     12       1.1    chopps  * are met:
     13       1.1    chopps  * 1. Redistributions of source code must retain the above copyright
     14       1.1    chopps  *    notice, this list of conditions and the following disclaimer.
     15       1.1    chopps  * 2. Redistributions in binary form must reproduce the above copyright
     16       1.1    chopps  *    notice, this list of conditions and the following disclaimer in the
     17       1.1    chopps  *    documentation and/or other materials provided with the distribution.
     18       1.1    chopps  * 3. All advertising materials mentioning features or use of this software
     19       1.1    chopps  *    must display the following acknowledgement:
     20       1.8        is  *        This product includes software developed by the NetBSD
     21       1.8        is  *        Foundation, Inc. and its contributors.
     22       1.8        is  * 4. Neither the name of The NetBSD Foundation nor the names of its
     23       1.8        is  *    contributors may be used to endorse or promote products derived
     24       1.8        is  *    from this software without specific prior written permission.
     25       1.1    chopps  *
     26       1.8        is  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     27       1.8        is  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     28       1.8        is  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     29       1.8        is  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     30       1.8        is  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     31       1.8        is  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     32       1.8        is  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     33       1.8        is  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     34       1.8        is  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     35       1.8        is  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     36       1.8        is  * POSSIBILITY OF SUCH DAMAGE.
     37       1.1    chopps  */
     38       1.8        is 
     39  1.9.22.1  jdolecek #include <sys/cdefs.h>
     40  1.9.22.1  jdolecek __KERNEL_RCSID(0, "$NetBSD: ite_ul.c,v 1.9.22.1 2002/02/11 20:07:02 jdolecek Exp $");
     41  1.9.22.1  jdolecek 
     42       1.1    chopps #include "grful.h"
     43       1.1    chopps #if NGRFUL > 0
     44       1.1    chopps 
     45       1.1    chopps #include <sys/param.h>
     46       1.1    chopps #include <sys/conf.h>
     47       1.1    chopps #include <sys/proc.h>
     48       1.1    chopps #include <sys/device.h>
     49       1.1    chopps #include <sys/ioctl.h>
     50       1.1    chopps #include <sys/tty.h>
     51       1.1    chopps #include <sys/systm.h>
     52       1.1    chopps #include <dev/cons.h>
     53       1.1    chopps #include <machine/cpu.h>
     54       1.1    chopps #include <amiga/amiga/device.h>
     55       1.1    chopps #include <amiga/amiga/isr.h>
     56       1.1    chopps #include <amiga/dev/itevar.h>
     57       1.1    chopps #include <amiga/dev/grfioctl.h>
     58       1.1    chopps #include <amiga/dev/grfvar.h>
     59       1.1    chopps #include <amiga/dev/grf_ulreg.h>
     60       1.1    chopps 
     61  1.9.22.1  jdolecek #ifndef KFONT_CUSTOM
     62       1.1    chopps #ifdef KFONT_8X11
     63       1.1    chopps #define kernel_font_width       kernel_font_width_8x11
     64       1.1    chopps #define kernel_font_height      kernel_font_height_8x11
     65       1.1    chopps #define kernel_font_baseline    kernel_font_baseline_8x11
     66       1.1    chopps #define kernel_font_boldsmear   kernel_font_boldsmear_8x11
     67       1.1    chopps #define kernel_font_lo  kernel_font_lo_8x11
     68       1.1    chopps #define kernel_font_hi  kernel_font_hi_8x11
     69       1.1    chopps #define kernel_font     kernel_font_8x11
     70       1.1    chopps #define kernel_cursor   kernel_cursor_8x11
     71       1.1    chopps #else
     72       1.1    chopps #define kernel_font_width       kernel_font_width_8x8
     73       1.1    chopps #define kernel_font_height      kernel_font_height_8x8
     74       1.1    chopps #define kernel_font_baseline    kernel_font_baseline_8x8
     75       1.1    chopps #define kernel_font_boldsmear   kernel_font_boldsmear_8x8
     76       1.1    chopps #define kernel_font_lo  kernel_font_lo_8x8
     77       1.1    chopps #define kernel_font_hi  kernel_font_hi_8x8
     78       1.1    chopps #define kernel_font     kernel_font_8x8
     79       1.1    chopps #define kernel_cursor   kernel_cursor_8x8
     80       1.1    chopps #endif
     81       1.1    chopps #endif
     82       1.1    chopps 
     83       1.1    chopps extern u_int8_t kernel_font_width, kernel_font_height, kernel_font_baseline;
     84       1.1    chopps extern short  kernel_font_boldsmear;
     85       1.1    chopps extern u_int8_t kernel_font_lo, kernel_font_hi;
     86       1.1    chopps extern u_int8_t kernel_font[], kernel_cursor[];
     87       1.1    chopps 
     88       1.1    chopps 
     89       1.1    chopps #ifdef DEBUG_UL
     90       1.1    chopps #define gsp_out(ba,cmd,len) gsp_dump(cmd,len); gsp_write(ba,cmd,len)
     91       1.1    chopps #else
     92       1.1    chopps #define gsp_out(ba,cmd,len) gsp_write(ba,cmd,len)
     93       1.1    chopps #endif
     94       1.1    chopps 
     95       1.1    chopps int ulowell_console = 1;
     96       1.1    chopps 
     97  1.9.22.1  jdolecek void ulowell_cursor(struct ite_softc *, int);
     98  1.9.22.1  jdolecek void ulowell_scroll(struct ite_softc *, int, int, int, int);
     99  1.9.22.1  jdolecek void ulowell_deinit(struct ite_softc *);
    100  1.9.22.1  jdolecek void ulowell_clear(struct ite_softc *, int, int, int, int);
    101  1.9.22.1  jdolecek void ulowell_putc(struct ite_softc *, int, int, int, int);
    102  1.9.22.1  jdolecek void ulowell_init(struct ite_softc *);
    103       1.1    chopps 
    104       1.1    chopps #ifdef DEBUG_UL
    105  1.9.22.1  jdolecek void gsp_dump(u_int16_t *, int);
    106       1.1    chopps #endif
    107       1.1    chopps 
    108       1.1    chopps /* Text always on overlay plane, so: */
    109       1.1    chopps 
    110       1.1    chopps #define UL_FG(ip)  0xFFFF
    111       1.1    chopps #define UL_BG(ip)  0x0000
    112       1.1    chopps 
    113       1.1    chopps /*
    114       1.1    chopps  * this function is called from grf_ul to init the grf_softc->g_conpri
    115       1.1    chopps  * field each time a ulowell board is attached.
    116       1.1    chopps  */
    117       1.1    chopps int
    118  1.9.22.1  jdolecek grful_cnprobe(void)
    119       1.1    chopps {
    120       1.1    chopps 	static int done;
    121       1.1    chopps 	int uv;
    122       1.1    chopps 
    123       1.1    chopps 	if (ulowell_console && done == 0)
    124       1.1    chopps 		uv = CN_INTERNAL;
    125       1.1    chopps 	else
    126       1.1    chopps 		uv = CN_NORMAL;
    127       1.1    chopps 	done = 1;
    128       1.1    chopps 	return(uv);
    129       1.1    chopps }
    130       1.1    chopps 
    131  1.9.22.1  jdolecek /*
    132       1.1    chopps  * init the required fields in the grf_softc struct for a
    133       1.1    chopps  * grf to function as an ite.
    134       1.1    chopps  */
    135       1.1    chopps void
    136  1.9.22.1  jdolecek grful_iteinit(struct grf_softc *gp)
    137       1.1    chopps {
    138       1.1    chopps 	gp->g_iteinit = ulowell_init;
    139       1.1    chopps 	gp->g_itedeinit = ulowell_deinit;
    140       1.1    chopps 	gp->g_iteclear = ulowell_clear;
    141       1.1    chopps 	gp->g_iteputc = ulowell_putc;
    142       1.1    chopps 	gp->g_itescroll = ulowell_scroll;
    143       1.1    chopps 	gp->g_itecursor = ulowell_cursor;
    144       1.1    chopps }
    145       1.1    chopps 
    146       1.1    chopps void
    147  1.9.22.1  jdolecek ulowell_init(struct ite_softc *ip)
    148       1.1    chopps {
    149       1.1    chopps 	struct gspregs *ba;
    150       1.1    chopps 
    151       1.1    chopps 	u_int16_t *sp;
    152       1.1    chopps 	u_int16_t cmd[8];
    153       1.1    chopps 
    154       1.1    chopps 	int i;
    155       1.1    chopps 
    156       1.1    chopps 	ba = (struct gspregs *) ip->grf->g_regkva;
    157       1.1    chopps 
    158       1.1    chopps 	ip->font     = kernel_font;
    159       1.1    chopps 	ip->font_lo  = kernel_font_lo;
    160       1.1    chopps 	ip->font_hi  = kernel_font_hi;
    161       1.1    chopps 	ip->ftwidth  = kernel_font_width;
    162       1.1    chopps 	ip->ftheight = kernel_font_height;
    163       1.1    chopps 	ip->ftbaseline = kernel_font_baseline;
    164       1.1    chopps 	ip->ftboldsmear = kernel_font_boldsmear;
    165       1.1    chopps 
    166       1.1    chopps 	/* upload font data */
    167       1.1    chopps 
    168       1.1    chopps 	ba->ctrl = LBL|INCW;
    169  1.9.22.1  jdolecek 	ba->hstadrh = 0xFFA2;
    170  1.9.22.1  jdolecek 	ba->hstadrl = 0x0200;
    171       1.1    chopps 
    172  1.9.22.1  jdolecek 	ba->data = 0x0000;
    173  1.9.22.1  jdolecek 	ba->data = 0xFFA3;
    174  1.9.22.1  jdolecek 	ba->data = ip->ftwidth;
    175  1.9.22.1  jdolecek 	ba->data = ip->ftheight;
    176       1.1    chopps 	ba->data = ip->ftbaseline;
    177       1.1    chopps 	ba->data = 1;
    178       1.1    chopps 	ba->data = ip->font_lo;
    179       1.1    chopps 	ba->data = ip->font_hi;
    180       1.1    chopps 	ba->data = ip->ftboldsmear;
    181  1.9.22.1  jdolecek 
    182  1.9.22.1  jdolecek 	ba->hstadrh = 0xFFA3;
    183  1.9.22.1  jdolecek 	ba->hstadrl = 0x0000;
    184  1.9.22.1  jdolecek 
    185  1.9.22.1  jdolecek 	/*
    186       1.1    chopps 	 * font has to be word aligned and padded to word boundary.
    187       1.1    chopps 	 * 8 bit wide fonts will be byte swapped in the bit swap
    188       1.1    chopps 	 * routine.
    189  1.9.22.1  jdolecek 	 */
    190       1.1    chopps 
    191       1.1    chopps 	i = (ip->font_hi - ip->font_lo + 1) * ip->ftheight;
    192       1.1    chopps 	if (ip->ftwidth <= 8)
    193       1.1    chopps 		i /= 2;
    194       1.1    chopps 	for (sp = (u_int16_t *)ip->font; i>0; --i,++sp) {
    195       1.1    chopps 		ba->data = *sp;
    196  1.9.22.1  jdolecek 	}
    197       1.1    chopps 
    198       1.1    chopps 	/* bitwise mirror the font: */
    199       1.1    chopps 
    200       1.1    chopps 	cmd[0] = GCMD_FNTMIR;
    201       1.1    chopps 	gsp_out(ba, cmd, 1);
    202       1.1    chopps 
    203  1.9.22.1  jdolecek 	ip->priv = NULL;
    204       1.1    chopps 	ip->cursor_opt = 0;
    205       1.1    chopps 
    206       1.1    chopps 	if (ip->ftwidth >0 && ip->ftheight > 0) {
    207       1.1    chopps 		ip->cols = ip->grf->g_display.gd_dwidth  / ip->ftwidth;
    208       1.1    chopps 		ip->rows = ip->grf->g_display.gd_dheight / ip->ftheight;
    209       1.1    chopps 	}
    210       1.1    chopps 
    211       1.1    chopps 	ulowell_clear(ip, 0, 0, ip->rows, ip->cols);
    212       1.1    chopps 
    213  1.9.22.1  jdolecek 	/*
    214       1.1    chopps 	 * switch overlay plane 0 on again, in case s.b. did a GM_GRFOVOFF
    215       1.1    chopps 	 * XXX maybe this should be done on each output, by the TMS code?
    216       1.1    chopps 	 * what happens on panic?
    217       1.1    chopps 
    218       1.1    chopps 	ba->ctrl = LBL;
    219       1.1    chopps 	GSPSETHADRS(ba, 0xFE800000);
    220       1.1    chopps 	ba->data = 0;
    221       1.1    chopps 	ba->hstadrl = 0x0020;
    222       1.1    chopps 	gup->gus_ovslct |= 1;
    223       1.1    chopps 	ba->data = gup->gus_ovslct;
    224       1.1    chopps 	 */
    225       1.1    chopps 
    226       1.1    chopps #ifdef UL_DEBUG
    227       1.7  christos 	printf("ulowell_init: %d %d %d %d %d %d\n", ip->ftwidth, ip->ftheight,
    228       1.1    chopps 		ip->ftbaseline, ip->font_lo, ip->font_hi, ip->ftboldsmear);
    229       1.1    chopps #endif
    230       1.1    chopps }
    231       1.1    chopps 
    232       1.1    chopps 
    233       1.1    chopps void ulowell_cursor(struct ite_softc *ip, int flag)
    234       1.1    chopps {
    235       1.1    chopps 	struct gspregs *ba;
    236       1.1    chopps 	u_int16_t cmd[7];
    237       1.1    chopps 
    238       1.1    chopps 	ba = (struct gspregs *)ip->grf->g_regkva;
    239       1.1    chopps 
    240       1.1    chopps 	if (flag == END_CURSOROPT)
    241       1.1    chopps 		--ip->cursor_opt;
    242       1.1    chopps 	else if (flag == START_CURSOROPT) {
    243       1.1    chopps 		if (!ip->cursor_opt)
    244       1.1    chopps 			ulowell_cursor(ip, ERASE_CURSOR);
    245       1.1    chopps 		++ip->cursor_opt;
    246       1.1    chopps 		return;		/* if we are already opted */
    247       1.1    chopps 	}
    248       1.1    chopps 
    249       1.1    chopps 	if (ip->cursor_opt)
    250       1.1    chopps 		return;		/* if we are still nested. */
    251       1.1    chopps 
    252       1.1    chopps 	/* else we draw the cursor */
    253       1.1    chopps 
    254       1.1    chopps 	if (flag != DRAW_CURSOR && flag != END_CURSOROPT) {
    255       1.1    chopps 		/* erase cursor */
    256       1.1    chopps #if 0
    257       1.1    chopps 		cmd[0] = GCMD_PIXBLT;
    258       1.1    chopps 		cmd[1] = 1024 - ip->ftwidth;
    259       1.1    chopps 		cmd[2] = 1024 - ip->ftheight;
    260       1.1    chopps 		cmd[3] = ip->ftwidth;
    261       1.1    chopps 		cmd[4] = ip->ftheight;
    262       1.1    chopps 		cmd[5] = ip->cursorx * ip->ftwidth;
    263       1.1    chopps 		cmd[6] = ip->cursory * ip->ftheight;
    264       1.1    chopps 		gsp_out(ba, cmd, 7);
    265       1.1    chopps #endif
    266       1.1    chopps 		cmd[0] = GCMD_FILL;
    267       1.1    chopps 		cmd[1] = UL_FG(ip);
    268       1.1    chopps 		cmd[2] = ip->cursorx * ip->ftwidth;
    269       1.1    chopps 		cmd[3] = ip->cursory * ip->ftheight;
    270       1.1    chopps 		cmd[4] = ip->ftwidth;
    271       1.1    chopps 		cmd[5] = ip->ftheight;
    272       1.1    chopps 		cmd[6] = 10;	/* thats src xor dst */
    273       1.1    chopps 		gsp_out(ba, cmd, 7);
    274       1.1    chopps 	}
    275  1.9.22.1  jdolecek 
    276       1.1    chopps 	if (flag != DRAW_CURSOR && flag != MOVE_CURSOR &&
    277       1.1    chopps 	    flag != END_CURSOROPT)
    278       1.1    chopps 		return;
    279       1.1    chopps 
    280       1.1    chopps 	/* draw cursor */
    281       1.1    chopps 
    282       1.1    chopps 	ip->cursorx = min(ip->curx, ip->cols-1);
    283       1.1    chopps 	ip->cursory = ip->cury;
    284       1.1    chopps #if 0
    285       1.1    chopps 	cmd[0] = GCMD_PIXBLT;
    286       1.1    chopps 	cmd[1] = ip->cursorx * ip->ftwidth;
    287       1.1    chopps 	cmd[2] = ip->cursory * ip->ftheight;
    288       1.1    chopps 	cmd[3] = ip->ftwidth;
    289       1.1    chopps 	cmd[4] = ip->ftheight;
    290       1.1    chopps 	cmd[5] = 1024 - ip->ftwidth;
    291       1.1    chopps 	cmd[6] = 1024 - ip->ftheight;
    292       1.1    chopps 	gsp_out(ba, cmd, 7);
    293       1.1    chopps #endif
    294       1.1    chopps 	cmd[0] = GCMD_FILL;
    295       1.1    chopps 	cmd[1] = UL_FG(ip);
    296       1.1    chopps 	cmd[2] = ip->cursorx * ip->ftwidth;
    297       1.1    chopps 	cmd[3] = ip->cursory * ip->ftheight;
    298       1.1    chopps 	cmd[4] = ip->ftwidth;
    299       1.1    chopps 	cmd[5] = ip->ftheight;
    300       1.1    chopps 	cmd[6] = 10;	/* thats src xor dst */
    301       1.1    chopps 	gsp_out(ba, cmd, 7);
    302       1.1    chopps 
    303       1.1    chopps }
    304       1.1    chopps 
    305       1.1    chopps 
    306       1.1    chopps 
    307  1.9.22.1  jdolecek static void screen_up(struct ite_softc *ip, int top, int bottom, int lines)
    308  1.9.22.1  jdolecek {
    309       1.1    chopps 	struct gspregs *ba;
    310       1.1    chopps 
    311       1.1    chopps 	u_int16_t cmd[7];
    312       1.1    chopps 
    313       1.1    chopps 	ba = (struct gspregs *)ip->grf->g_regkva;
    314       1.1    chopps 
    315       1.1    chopps #ifdef DEBUG_UL
    316       1.7  christos 	printf("screen_up %d %d %d ->",top,bottom,lines);
    317       1.1    chopps #endif
    318       1.1    chopps 	/* do some bounds-checking here.. */
    319       1.1    chopps 
    320       1.1    chopps 	if (top >= bottom)
    321       1.1    chopps 		return;
    322  1.9.22.1  jdolecek 
    323       1.1    chopps 	if (top + lines >= bottom)
    324       1.1    chopps 	{
    325       1.1    chopps 		ulowell_clear (ip, top, 0, bottom - top, ip->cols);
    326       1.1    chopps 		return;
    327       1.1    chopps 	}
    328       1.1    chopps 
    329       1.1    chopps 	cmd[0] = GCMD_PIXBLT;
    330       1.1    chopps 	cmd[1] = 0;					/* x */
    331       1.1    chopps 	cmd[2] = top			* ip->ftheight;	/* y */
    332       1.1    chopps 	cmd[3] = ip->cols		* ip->ftwidth;	/* w */
    333       1.1    chopps 	cmd[4] = (bottom-top+1)		* ip->ftheight;	/* h */
    334       1.1    chopps 	cmd[5] = 0;					/* dst x */
    335       1.1    chopps 	cmd[6] = (top-lines)  		* ip->ftheight;	/* dst y */
    336       1.1    chopps 	gsp_out(ba, cmd, 7);
    337       1.1    chopps 
    338       1.1    chopps 	ulowell_clear(ip, bottom-lines+1, 0, lines-1, ip->cols);
    339       1.1    chopps };
    340       1.1    chopps 
    341  1.9.22.1  jdolecek static void screen_down(struct ite_softc *ip, int top, int bottom, int lines)
    342  1.9.22.1  jdolecek {
    343       1.1    chopps 	struct gspregs *ba;
    344       1.1    chopps 
    345       1.1    chopps 	u_int16_t cmd[7];
    346       1.1    chopps 
    347       1.1    chopps 	ba = (struct gspregs *)ip->grf->g_regkva;
    348       1.1    chopps 
    349       1.1    chopps #ifdef DEBUG_UL
    350       1.7  christos 	printf("screen_down %d %d %d ->",top,bottom,lines);
    351       1.1    chopps #endif
    352       1.1    chopps 
    353       1.1    chopps 	/* do some bounds-checking here.. */
    354       1.1    chopps 
    355       1.1    chopps 	if (top >= bottom)
    356       1.1    chopps 		return;
    357  1.9.22.1  jdolecek 
    358       1.1    chopps 	if (top + lines >= bottom)
    359       1.1    chopps 	{
    360       1.1    chopps 	    ulowell_clear (ip, top, 0, bottom - top, ip->cols);
    361       1.1    chopps 	    return;
    362       1.1    chopps 	}
    363       1.1    chopps 
    364       1.1    chopps 	cmd[0] = GCMD_PIXBLT;
    365       1.1    chopps 	cmd[1] = 0;					/* x */
    366       1.1    chopps 	cmd[2] = top			* ip->ftheight;	/* y */
    367       1.1    chopps 	cmd[3] = ip->cols		* ip->ftwidth;	/* w */
    368       1.1    chopps 	cmd[4] = (bottom - top - lines)	* ip->ftheight;	/* h */
    369       1.1    chopps 	cmd[5] = 0;					/* dst x */
    370       1.1    chopps 	cmd[6] = (top + lines)		* ip->ftheight;	/* dst y */
    371       1.1    chopps 	gsp_out(ba, cmd, 7);
    372       1.1    chopps 
    373       1.1    chopps 	ulowell_clear(ip, top, 0, lines, ip->cols);
    374       1.1    chopps };
    375       1.1    chopps 
    376       1.1    chopps void ulowell_deinit(struct ite_softc *ip)
    377       1.1    chopps {
    378       1.1    chopps 	ip->flags &= ~ITE_INITED;
    379       1.1    chopps }
    380       1.1    chopps 
    381       1.1    chopps 
    382       1.1    chopps void ulowell_putc(struct ite_softc *ip, int c, int dy, int dx, int mode)
    383       1.1    chopps {
    384       1.1    chopps 	struct gspregs *ba;
    385       1.1    chopps 	u_int16_t cmd[8];
    386  1.9.22.1  jdolecek 
    387       1.1    chopps 	ba = (struct gspregs *)ip->grf->g_regkva;
    388       1.1    chopps 
    389       1.1    chopps 	cmd[0] = GCMD_CHAR;
    390       1.1    chopps 	cmd[1] = c & 0xff;
    391       1.1    chopps 	cmd[2] = 0x0;
    392       1.1    chopps 	cmd[3] = UL_FG(ip);
    393       1.1    chopps 	cmd[4] = dx * ip->ftwidth;
    394       1.1    chopps 	cmd[5] = dy * ip->ftheight;
    395       1.1    chopps 	cmd[6] = mode;
    396       1.1    chopps 	gsp_write(ba, cmd, 7);
    397       1.1    chopps }
    398       1.1    chopps 
    399       1.1    chopps void ulowell_clear(struct ite_softc *ip, int sy, int sx, int h, int w)
    400       1.1    chopps {
    401       1.1    chopps 	/* XXX TBD */
    402       1.1    chopps 	struct gspregs * ba;
    403       1.1    chopps 
    404       1.1    chopps 	u_int16_t cmd[7];
    405       1.1    chopps 
    406       1.1    chopps #ifdef	DEBUG_UL
    407       1.7  christos 	printf("ulowell_clear %d %d %d %d ->",sy,sx,h,w);
    408       1.1    chopps #endif
    409       1.1    chopps 	ba = (struct gspregs *)ip->grf->g_regkva;
    410       1.1    chopps 
    411       1.1    chopps 	cmd[0] = GCMD_FILL;
    412       1.1    chopps 	cmd[1] = 0x0; /* XXX */
    413       1.1    chopps 	cmd[2] = sx * ip->ftwidth;
    414       1.1    chopps 	cmd[3] = sy * ip->ftheight;
    415       1.1    chopps 	cmd[4] = w * ip->ftwidth;
    416       1.1    chopps 	cmd[5] = h * ip->ftheight;
    417       1.1    chopps 	cmd[6] = 0;
    418       1.1    chopps 
    419       1.1    chopps 	gsp_out(ba, cmd, 7);
    420       1.1    chopps }
    421       1.1    chopps 
    422       1.1    chopps void ulowell_scroll(struct ite_softc *ip, int sy, int sx, int count, int dir)
    423       1.1    chopps {
    424       1.1    chopps 	struct gspregs *ba;
    425       1.1    chopps 	u_int16_t cmd[7];
    426       1.1    chopps 
    427       1.1    chopps 	ba = (struct gspregs *)ip->grf->g_regkva;
    428       1.1    chopps 
    429       1.1    chopps #ifdef DEBUG_UL
    430       1.7  christos 	printf("ulowell_scroll %d %d %d %d ->",sy,sx,count,dir);
    431       1.1    chopps #endif
    432       1.1    chopps 
    433       1.1    chopps 	ulowell_cursor(ip, ERASE_CURSOR);
    434       1.1    chopps 
    435       1.1    chopps 	if (dir == SCROLL_UP) {
    436       1.1    chopps 		screen_up (ip, sy, ip->bottom_margin, count);
    437       1.1    chopps 	} else if (dir == SCROLL_DOWN) {
    438       1.1    chopps 		screen_down (ip, sy, ip->bottom_margin, count);
    439       1.1    chopps 	} else if (dir == SCROLL_RIGHT) {
    440       1.1    chopps 		cmd[0] = GCMD_PIXBLT;
    441       1.1    chopps 		cmd[1] = sx * ip->ftwidth;
    442       1.1    chopps 		cmd[2] = sy * ip->ftheight;
    443       1.1    chopps 		cmd[3] = (ip->cols - sx - count) * ip->ftwidth;
    444       1.1    chopps 		cmd[4] = ip->ftheight;
    445       1.1    chopps 		cmd[5] = (sx + count) * ip->ftwidth;
    446       1.1    chopps 		cmd[6] = sy * ip->ftheight;
    447       1.1    chopps 		gsp_out(ba,cmd,7);
    448       1.1    chopps 		ulowell_clear (ip, sy, sx, 1, count);
    449       1.1    chopps 	} else {
    450       1.1    chopps 		cmd[0] = GCMD_PIXBLT;
    451       1.1    chopps 		cmd[1] = sx * ip->ftwidth;
    452       1.1    chopps 		cmd[2] = sy * ip->ftheight;
    453       1.1    chopps 		cmd[3] = (ip->cols - sx) * ip->ftwidth;
    454       1.1    chopps 		cmd[4] = ip->ftheight;
    455       1.1    chopps 		cmd[5] = (sx - count) * ip->ftwidth;
    456       1.1    chopps 		cmd[6] = sy * ip->ftheight;
    457       1.1    chopps 		gsp_out(ba,cmd,7);
    458       1.1    chopps 		ulowell_clear (ip, sy, ip->cols - count, 1, count);
    459  1.9.22.1  jdolecek 	}
    460       1.1    chopps }
    461       1.1    chopps 
    462       1.1    chopps #ifdef DEBUG_UL
    463       1.1    chopps void
    464       1.1    chopps gsp_dump(cmd,len)
    465       1.1    chopps 	u_int16_t *cmd;
    466       1.1    chopps 	int len;
    467       1.1    chopps {
    468       1.7  christos 	printf("gsp");
    469       1.1    chopps 	while (len-- > 0)
    470       1.7  christos 		printf(" %lx",*cmd++);
    471       1.7  christos 	printf("\n");
    472       1.1    chopps }
    473       1.1    chopps #endif
    474       1.1    chopps #endif /* NGRFUL */
    475