1*f6330dd7Stsutsui /* $NetBSD: ite_rb.c,v 1.11 2011/02/10 12:46:22 tsutsui Exp $ */
2a0864b3eSthorpej
3a0864b3eSthorpej /*
49b6bd2d9Srmind * Copyright (c) 1988 University of Utah.
5a0864b3eSthorpej * Copyright (c) 1990, 1993
6a0864b3eSthorpej * The Regents of the University of California. All rights reserved.
7a0864b3eSthorpej *
8a0864b3eSthorpej * This code is derived from software contributed to Berkeley by
9a0864b3eSthorpej * the Systems Programming Group of the University of Utah Computer
10a0864b3eSthorpej * Science Department.
11a0864b3eSthorpej *
12a0864b3eSthorpej * Redistribution and use in source and binary forms, with or without
13a0864b3eSthorpej * modification, are permitted provided that the following conditions
14a0864b3eSthorpej * are met:
15a0864b3eSthorpej * 1. Redistributions of source code must retain the above copyright
16a0864b3eSthorpej * notice, this list of conditions and the following disclaimer.
17a0864b3eSthorpej * 2. Redistributions in binary form must reproduce the above copyright
18a0864b3eSthorpej * notice, this list of conditions and the following disclaimer in the
19a0864b3eSthorpej * documentation and/or other materials provided with the distribution.
20aad01611Sagc * 3. Neither the name of the University nor the names of its contributors
21aad01611Sagc * may be used to endorse or promote products derived from this software
22aad01611Sagc * without specific prior written permission.
23aad01611Sagc *
24aad01611Sagc * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25aad01611Sagc * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26aad01611Sagc * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27aad01611Sagc * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28aad01611Sagc * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29aad01611Sagc * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30aad01611Sagc * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31aad01611Sagc * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32aad01611Sagc * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33aad01611Sagc * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34aad01611Sagc * SUCH DAMAGE.
35aad01611Sagc *
36aad01611Sagc * from: Utah $Hdr: ite_rb.c 1.6 92/01/20$
37aad01611Sagc *
38aad01611Sagc * @(#)ite_rb.c 8.1 (Berkeley) 6/10/93
39aad01611Sagc */
40a0864b3eSthorpej
41a0864b3eSthorpej #ifdef ITECONSOLE
42a0864b3eSthorpej
43a0864b3eSthorpej #include <sys/param.h>
44a0864b3eSthorpej
4513b242e4Stsutsui #include <hp300/stand/common/itereg.h>
4613b242e4Stsutsui #include <hp300/stand/common/grf_rbreg.h>
47a0864b3eSthorpej
48a0864b3eSthorpej #include <hp300/stand/common/samachdep.h>
49a0864b3eSthorpej #include <hp300/stand/common/itevar.h>
50a0864b3eSthorpej
51212f884fStsutsui void rbox_windowmove(struct ite_data *, int, int, int, int, int, int, int);
52a0864b3eSthorpej
53a0864b3eSthorpej void
rbox_init(struct ite_data * ip)54d3dc0553Stsutsui rbox_init(struct ite_data *ip)
55a0864b3eSthorpej {
56212f884fStsutsui struct rboxfb *regbase = (void *)ip->regbase;
57a0864b3eSthorpej int i;
58a0864b3eSthorpej
59*f6330dd7Stsutsui ip->bmv = rbox_windowmove;
60*f6330dd7Stsutsui
61212f884fStsutsui rb_waitbusy(regbase);
62a0864b3eSthorpej DELAY(3000);
63a0864b3eSthorpej
64212f884fStsutsui regbase->interrupt = 0x04;
65212f884fStsutsui regbase->display_enable = 0x01;
66212f884fStsutsui regbase->video_enable = 0x01;
67212f884fStsutsui regbase->drive = 0x01;
68212f884fStsutsui regbase->vdrive = 0x0;
69a0864b3eSthorpej
70a0864b3eSthorpej ite_fontinfo(ip);
71a0864b3eSthorpej
72212f884fStsutsui regbase->opwen = 0xFF;
73a0864b3eSthorpej
74a0864b3eSthorpej /*
75a0864b3eSthorpej * Clear the framebuffer.
76a0864b3eSthorpej */
77a0864b3eSthorpej rbox_windowmove(ip, 0, 0, 0, 0, ip->fbheight, ip->fbwidth, RR_CLEAR);
78212f884fStsutsui rb_waitbusy(regbase);
79a0864b3eSthorpej
80a0864b3eSthorpej for(i = 0; i < 16; i++) {
81331a9e6cShe *((char *)ip->regbase + 0x63c3 + i * 4) = 0x0;
82331a9e6cShe *((char *)ip->regbase + 0x6403 + i * 4) = 0x0;
83331a9e6cShe *((char *)ip->regbase + 0x6803 + i * 4) = 0x0;
84331a9e6cShe *((char *)ip->regbase + 0x6c03 + i * 4) = 0x0;
85331a9e6cShe *((char *)ip->regbase + 0x73c3 + i * 4) = 0x0;
86331a9e6cShe *((char *)ip->regbase + 0x7403 + i * 4) = 0x0;
87331a9e6cShe *((char *)ip->regbase + 0x7803 + i * 4) = 0x0;
88331a9e6cShe *((char *)ip->regbase + 0x7c03 + i * 4) = 0x0;
89a0864b3eSthorpej }
90a0864b3eSthorpej
91212f884fStsutsui regbase->rep_rule = 0x33;
92a0864b3eSthorpej
93a0864b3eSthorpej /*
94a0864b3eSthorpej * I cannot figure out how to make the blink planes stop. So, we
95a0864b3eSthorpej * must set both colormaps so that when the planes blink, and
96a0864b3eSthorpej * the secondary colormap is active, we still get text.
97a0864b3eSthorpej */
98a0864b3eSthorpej CM1RED[0x00].value = 0x00;
99a0864b3eSthorpej CM1GRN[0x00].value = 0x00;
100a0864b3eSthorpej CM1BLU[0x00].value = 0x00;
101a0864b3eSthorpej CM1RED[0x01].value = 0xFF;
102a0864b3eSthorpej CM1GRN[0x01].value = 0xFF;
103a0864b3eSthorpej CM1BLU[0x01].value = 0xFF;
104a0864b3eSthorpej
105a0864b3eSthorpej CM2RED[0x00].value = 0x00;
106a0864b3eSthorpej CM2GRN[0x00].value = 0x00;
107a0864b3eSthorpej CM2BLU[0x00].value = 0x00;
108a0864b3eSthorpej CM2RED[0x01].value = 0xFF;
109a0864b3eSthorpej CM2GRN[0x01].value = 0xFF;
110a0864b3eSthorpej CM2BLU[0x01].value = 0xFF;
111a0864b3eSthorpej
112212f884fStsutsui regbase->blink = 0x00;
113212f884fStsutsui regbase->write_enable = 0x01;
114212f884fStsutsui regbase->opwen = 0x00;
115a0864b3eSthorpej
11636ac47efStsutsui ite_fontinit8bpp(ip);
117a0864b3eSthorpej
118a0864b3eSthorpej /*
119a0864b3eSthorpej * Stash the inverted cursor.
120a0864b3eSthorpej */
121a0864b3eSthorpej rbox_windowmove(ip, charY(ip, ' '), charX(ip, ' '),
122a0864b3eSthorpej ip->cblanky, ip->cblankx, ip->ftheight,
123a0864b3eSthorpej ip->ftwidth, RR_COPYINVERTED);
124a0864b3eSthorpej }
125a0864b3eSthorpej
126a0864b3eSthorpej void
rbox_windowmove(struct ite_data * ip,int sy,int sx,int dy,int dx,int h,int w,int func)127*f6330dd7Stsutsui rbox_windowmove(struct ite_data *ip, int sy, int sx, int dy, int dx, int h,
128*f6330dd7Stsutsui int w, int func)
129a0864b3eSthorpej {
130212f884fStsutsui struct rboxfb *rp = (void *)ip->regbase;
131212f884fStsutsui
132a0864b3eSthorpej if (h == 0 || w == 0)
133a0864b3eSthorpej return;
134a0864b3eSthorpej
135212f884fStsutsui rb_waitbusy(rp);
136a0864b3eSthorpej rp->rep_rule = func << 4 | func;
137a0864b3eSthorpej rp->source_y = sy;
138a0864b3eSthorpej rp->source_x = sx;
139a0864b3eSthorpej rp->dest_y = dy;
140a0864b3eSthorpej rp->dest_x = dx;
141a0864b3eSthorpej rp->wheight = h;
142a0864b3eSthorpej rp->wwidth = w;
143a0864b3eSthorpej rp->wmove = 1;
144a0864b3eSthorpej }
145a0864b3eSthorpej #endif
146