147b3f2c5Smckusick /*
247b3f2c5Smckusick * Copyright (c) 1988 University of Utah.
3*f190575cSbostic * Copyright (c) 1990, 1993
4*f190575cSbostic * The Regents of the University of California. All rights reserved.
547b3f2c5Smckusick *
647b3f2c5Smckusick * This code is derived from software contributed to Berkeley by
747b3f2c5Smckusick * the Systems Programming Group of the University of Utah Computer
847b3f2c5Smckusick * Science Department.
947b3f2c5Smckusick *
1047b3f2c5Smckusick * %sccs.include.redist.c%
1147b3f2c5Smckusick *
1253bb62c5Shibler * from: Utah $Hdr: ite_dv.c 1.2 92/01/20$
1347b3f2c5Smckusick *
14*f190575cSbostic * @(#)ite_dv.c 8.1 (Berkeley) 06/10/93
1547b3f2c5Smckusick */
1647b3f2c5Smckusick
17bd0ff0deSbostic #include <hp300/stand/samachdep.h>
1847b3f2c5Smckusick
1947b3f2c5Smckusick #ifdef ITECONSOLE
2047b3f2c5Smckusick
21bd0ff0deSbostic #include <sys/param.h>
22bd0ff0deSbostic #include <hp/dev/itevar.h>
23bd0ff0deSbostic #include <hp/dev/itereg.h>
24bd0ff0deSbostic #include <hp300/dev/grf_dvreg.h>
2547b3f2c5Smckusick
2647b3f2c5Smckusick #define REGBASE ((struct dvboxfb *)(ip->regbase))
2747b3f2c5Smckusick #define WINDOWMOVER dvbox_windowmove
2847b3f2c5Smckusick
2947b3f2c5Smckusick dvbox_init(ip)
3047b3f2c5Smckusick struct ite_softc *ip;
3147b3f2c5Smckusick {
3247b3f2c5Smckusick int i;
3347b3f2c5Smckusick
3453bb62c5Shibler dv_reset(ip->regbase);
3547b3f2c5Smckusick DELAY(4000);
3647b3f2c5Smckusick
3747b3f2c5Smckusick /*
3847b3f2c5Smckusick * Turn on frame buffer, turn on overlay planes, set replacement
3947b3f2c5Smckusick * rule, enable top overlay plane writes for ite, disable all frame
4047b3f2c5Smckusick * buffer planes, set byte per pixel, and display frame buffer 0.
4147b3f2c5Smckusick * Lastly, turn on the box.
4247b3f2c5Smckusick */
4347b3f2c5Smckusick REGBASE->interrupt = 0x04;
4447b3f2c5Smckusick REGBASE->drive = 0x10;
4547b3f2c5Smckusick REGBASE->rep_rule = RR_COPY << 4 | RR_COPY;
4647b3f2c5Smckusick REGBASE->opwen = 0x01;
4747b3f2c5Smckusick REGBASE->fbwen = 0x0;
4847b3f2c5Smckusick REGBASE->fold = 0x01;
4947b3f2c5Smckusick REGBASE->vdrive = 0x0;
5047b3f2c5Smckusick REGBASE->dispen = 0x01;
5147b3f2c5Smckusick
5247b3f2c5Smckusick /*
5347b3f2c5Smckusick * Video enable top overlay plane.
5447b3f2c5Smckusick */
5547b3f2c5Smckusick REGBASE->opvenp = 0x01;
5647b3f2c5Smckusick REGBASE->opvens = 0x01;
5747b3f2c5Smckusick
5847b3f2c5Smckusick /*
5947b3f2c5Smckusick * Make sure that overlay planes override frame buffer planes.
6047b3f2c5Smckusick */
6147b3f2c5Smckusick REGBASE->ovly0p = 0x0;
6247b3f2c5Smckusick REGBASE->ovly0s = 0x0;
6347b3f2c5Smckusick REGBASE->ovly1p = 0x0;
6447b3f2c5Smckusick REGBASE->ovly1s = 0x0;
6547b3f2c5Smckusick REGBASE->fv_trig = 0x1;
6647b3f2c5Smckusick DELAY(400);
6747b3f2c5Smckusick
6847b3f2c5Smckusick /*
6947b3f2c5Smckusick * Setup the overlay colormaps. Need to set the 0,1 (black/white)
7047b3f2c5Smckusick * color for both banks.
7147b3f2c5Smckusick */
7247b3f2c5Smckusick
7347b3f2c5Smckusick for (i = 0; i <= 1; i++) {
7447b3f2c5Smckusick REGBASE->cmapbank = i;
7547b3f2c5Smckusick REGBASE->rgb[0].red = 0x00;
7647b3f2c5Smckusick REGBASE->rgb[0].green = 0x00;
7747b3f2c5Smckusick REGBASE->rgb[0].blue = 0x00;
7847b3f2c5Smckusick REGBASE->rgb[1].red = 0xFF;
7947b3f2c5Smckusick REGBASE->rgb[1].green = 0xFF;
8047b3f2c5Smckusick REGBASE->rgb[1].blue = 0xFF;
8147b3f2c5Smckusick }
8247b3f2c5Smckusick REGBASE->cmapbank = 0;
8347b3f2c5Smckusick
8453bb62c5Shibler db_waitbusy(ip->regbase);
8547b3f2c5Smckusick
8653bb62c5Shibler ite_fontinfo(ip);
8747b3f2c5Smckusick ite_fontinit(ip);
8847b3f2c5Smckusick
8947b3f2c5Smckusick /*
9047b3f2c5Smckusick * Clear the (visible) framebuffer.
9147b3f2c5Smckusick */
9247b3f2c5Smckusick dvbox_windowmove(ip, 0, 0, 0, 0, ip->dheight, ip->dwidth, RR_CLEAR);
9353bb62c5Shibler db_waitbusy(ip->regbase);
9447b3f2c5Smckusick
9547b3f2c5Smckusick /*
9647b3f2c5Smckusick * Stash the inverted cursor.
9747b3f2c5Smckusick */
9847b3f2c5Smckusick dvbox_windowmove(ip, charY(ip, ' '), charX(ip, ' '),
9947b3f2c5Smckusick ip->cblanky, ip->cblankx, ip->ftheight,
10047b3f2c5Smckusick ip->ftwidth, RR_COPYINVERTED);
10153bb62c5Shibler db_waitbusy(ip->regbase);
10247b3f2c5Smckusick }
10347b3f2c5Smckusick
dvbox_putc(ip,c,dy,dx,mode)10447b3f2c5Smckusick dvbox_putc(ip, c, dy, dx, mode)
10547b3f2c5Smckusick register struct ite_softc *ip;
10647b3f2c5Smckusick register int dy, dx;
10747b3f2c5Smckusick int c, mode;
10847b3f2c5Smckusick {
10947b3f2c5Smckusick dvbox_windowmove(ip, charY(ip, c), charX(ip, c),
11047b3f2c5Smckusick dy * ip->ftheight, dx * ip->ftwidth,
11147b3f2c5Smckusick ip->ftheight, ip->ftwidth, RR_COPY);
11247b3f2c5Smckusick }
11347b3f2c5Smckusick
dvbox_cursor(ip,flag)11447b3f2c5Smckusick dvbox_cursor(ip, flag)
11547b3f2c5Smckusick register struct ite_softc *ip;
11647b3f2c5Smckusick register int flag;
11747b3f2c5Smckusick {
11847b3f2c5Smckusick if (flag == DRAW_CURSOR)
11947b3f2c5Smckusick draw_cursor(ip)
12047b3f2c5Smckusick else if (flag == MOVE_CURSOR) {
12147b3f2c5Smckusick erase_cursor(ip)
12247b3f2c5Smckusick draw_cursor(ip)
12347b3f2c5Smckusick }
12447b3f2c5Smckusick else
12547b3f2c5Smckusick erase_cursor(ip)
12647b3f2c5Smckusick }
12747b3f2c5Smckusick
12847b3f2c5Smckusick dvbox_clear(ip, sy, sx, h, w)
12947b3f2c5Smckusick struct ite_softc *ip;
13047b3f2c5Smckusick register int sy, sx, h, w;
13147b3f2c5Smckusick {
13247b3f2c5Smckusick dvbox_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth,
13347b3f2c5Smckusick sy * ip->ftheight, sx * ip->ftwidth,
13447b3f2c5Smckusick h * ip->ftheight, w * ip->ftwidth,
13547b3f2c5Smckusick RR_CLEAR);
13647b3f2c5Smckusick }
13747b3f2c5Smckusick
dvbox_scroll(ip,sy,sx,count,dir)13847b3f2c5Smckusick dvbox_scroll(ip, sy, sx, count, dir)
13947b3f2c5Smckusick register struct ite_softc *ip;
14047b3f2c5Smckusick register int sy, count;
14147b3f2c5Smckusick int dir, sx;
14247b3f2c5Smckusick {
14347b3f2c5Smckusick register int dy = sy - count;
14447b3f2c5Smckusick register int height = ip->rows - sy;
14547b3f2c5Smckusick
14647b3f2c5Smckusick dvbox_cursor(ip, ERASE_CURSOR);
14747b3f2c5Smckusick
14847b3f2c5Smckusick dvbox_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth,
14947b3f2c5Smckusick dy * ip->ftheight, sx * ip->ftwidth,
15047b3f2c5Smckusick height * ip->ftheight,
15147b3f2c5Smckusick ip->cols * ip->ftwidth, RR_COPY);
15247b3f2c5Smckusick }
15347b3f2c5Smckusick
15447b3f2c5Smckusick dvbox_windowmove(ip, sy, sx, dy, dx, h, w, func)
15547b3f2c5Smckusick struct ite_softc *ip;
15647b3f2c5Smckusick int sy, sx, dy, dx, h, w, func;
15747b3f2c5Smckusick {
15847b3f2c5Smckusick register struct dvboxfb *dp = REGBASE;
15947b3f2c5Smckusick if (h == 0 || w == 0)
16047b3f2c5Smckusick return;
16147b3f2c5Smckusick
16253bb62c5Shibler db_waitbusy(ip->regbase);
16347b3f2c5Smckusick dp->rep_rule = func << 4 | func;
16447b3f2c5Smckusick dp->source_y = sy;
16547b3f2c5Smckusick dp->source_x = sx;
16647b3f2c5Smckusick dp->dest_y = dy;
16747b3f2c5Smckusick dp->dest_x = dx;
16847b3f2c5Smckusick dp->wheight = h;
16947b3f2c5Smckusick dp->wwidth = w;
17047b3f2c5Smckusick dp->wmove = 1;
17147b3f2c5Smckusick }
17247b3f2c5Smckusick
dv_reset(dbp)17347b3f2c5Smckusick dv_reset(dbp)
17447b3f2c5Smckusick register struct dvboxfb *dbp;
17547b3f2c5Smckusick {
17647b3f2c5Smckusick dbp->reset = 0x80;
17747b3f2c5Smckusick DELAY(400);
17847b3f2c5Smckusick
17947b3f2c5Smckusick dbp->interrupt = 0x04;
18047b3f2c5Smckusick dbp->en_scan = 0x01;
18147b3f2c5Smckusick dbp->fbwen = ~0;
18247b3f2c5Smckusick dbp->opwen = ~0;
18347b3f2c5Smckusick dbp->fold = 0x01;
18447b3f2c5Smckusick dbp->drive = 0x01;
18547b3f2c5Smckusick dbp->rep_rule = 0x33;
18647b3f2c5Smckusick dbp->alt_rr = 0x33;
18747b3f2c5Smckusick dbp->zrr = 0x33;
18847b3f2c5Smckusick
18947b3f2c5Smckusick dbp->fbvenp = 0xFF;
19047b3f2c5Smckusick dbp->dispen = 0x01;
19147b3f2c5Smckusick dbp->fbvens = 0x0;
19247b3f2c5Smckusick dbp->fv_trig = 0x01;
19347b3f2c5Smckusick DELAY(400);
19447b3f2c5Smckusick dbp->vdrive = 0x0;
19547b3f2c5Smckusick dbp->zconfig = 0x0;
19647b3f2c5Smckusick
19747b3f2c5Smckusick while (dbp->wbusy & 0x01)
19847b3f2c5Smckusick DELAY(400);
19947b3f2c5Smckusick
20047b3f2c5Smckusick /*
20147b3f2c5Smckusick * Start of missing ROM code.
20247b3f2c5Smckusick */
20347b3f2c5Smckusick dbp->cmapbank = 0;
20447b3f2c5Smckusick
20547b3f2c5Smckusick dbp->red0 = 0;
20647b3f2c5Smckusick dbp->red1 = 0;
20747b3f2c5Smckusick dbp->green0 = 0;
20847b3f2c5Smckusick dbp->green1 = 0;
20947b3f2c5Smckusick dbp->blue0 = 0;
21047b3f2c5Smckusick dbp->blue1 = 0;
21147b3f2c5Smckusick
21247b3f2c5Smckusick dbp->panxh = 0;
21347b3f2c5Smckusick dbp->panxl = 0;
21447b3f2c5Smckusick dbp->panyh = 0;
21547b3f2c5Smckusick dbp->panyl = 0;
21647b3f2c5Smckusick dbp->zoom = 0;
21747b3f2c5Smckusick dbp->cdwidth = 0x50;
21847b3f2c5Smckusick dbp->chstart = 0x52;
21947b3f2c5Smckusick dbp->cvwidth = 0x22;
22047b3f2c5Smckusick dbp->pz_trig = 1;
22147b3f2c5Smckusick /*
22247b3f2c5Smckusick * End of missing ROM code.
22347b3f2c5Smckusick */
22447b3f2c5Smckusick }
22547b3f2c5Smckusick
22647b3f2c5Smckusick #endif
227