* 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
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* 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
* from: Utah $Hdr: ite_dv.c 1.10 93/06/25$
* @(#)ite_dv.c 8.1 (Berkeley) 7/8/93
#include <hp/dev/itevar.h>
#include <hp/dev/itereg.h>
#include <hp300/dev/grf_dvreg.h>
#include <hp/dev/grfioctl.h>
#include <hp/dev/grfvar.h>
#define REGBASE ((struct dvboxfb *)(ip->regbase))
#define WINDOWMOVER dvbox_windowmove
register struct ite_softc
*ip
;
struct grf_softc
*gp
= ip
->grf
;
ip
->regbase
= gp
->g_regkva
;
ip
->fbbase
= gp
->g_fbkva
;
ip
->fbwidth
= gp
->g_display
.gd_fbwidth
;
ip
->fbheight
= gp
->g_display
.gd_fbheight
;
ip
->dwidth
= gp
->g_display
.gd_dwidth
;
ip
->dheight
= gp
->g_display
.gd_dheight
;
* XXX some displays (e.g. the davinci) appear
* to return a display height greater than the
* returned FB height. Guess we should go back
* to getting the display dimensions from the
if (ip
->dwidth
> ip
->fbwidth
)
ip
->dwidth
= ip
->fbwidth
;
if (ip
->dheight
> ip
->fbheight
)
ip
->dheight
= ip
->fbheight
;
* Turn on frame buffer, turn on overlay planes, set replacement
* rule, enable top overlay plane writes for ite, disable all frame
* buffer planes, set byte per pixel, and display frame buffer 0.
* Lastly, turn on the box.
REGBASE
->interrupt
= 0x04;
REGBASE
->rep_rule
= RR_COPY
<< 4 | RR_COPY
;
* Video enable top overlay plane.
* Make sure that overlay planes override frame buffer planes.
* Setup the overlay colormaps. Need to set the 0,1 (black/white)
for (i
= 0; i
<= 1; i
++) {
REGBASE
->rgb
[0].red
= 0x00;
REGBASE
->rgb
[0].green
= 0x00;
REGBASE
->rgb
[0].blue
= 0x00;
REGBASE
->rgb
[1].red
= 0xFF;
REGBASE
->rgb
[1].green
= 0xFF;
REGBASE
->rgb
[1].blue
= 0xFF;
db_waitbusy(ip
->regbase
);
* Clear the (visible) framebuffer.
dvbox_windowmove(ip
, 0, 0, 0, 0, ip
->dheight
, ip
->dwidth
, RR_CLEAR
);
db_waitbusy(ip
->regbase
);
* Stash the inverted cursor.
dvbox_windowmove(ip
, charY(ip
, ' '), charX(ip
, ' '),
ip
->cblanky
, ip
->cblankx
, ip
->ftheight
,
ip
->ftwidth
, RR_COPYINVERTED
);
register struct ite_softc
*ip
;
dvbox_windowmove(ip
, 0, 0, 0, 0, ip
->fbheight
, ip
->fbwidth
, RR_CLEAR
);
db_waitbusy(ip
->regbase
);
ip
->flags
&= ~ITE_INITED
;
dvbox_putc(ip
, c
, dy
, dx
, mode
)
register struct ite_softc
*ip
;
register int wrr
= ((mode
== ATTR_INV
) ? RR_COPYINVERTED
: RR_COPY
);
dvbox_windowmove(ip
, charY(ip
, c
), charX(ip
, c
),
dy
* ip
->ftheight
, dx
* ip
->ftwidth
,
ip
->ftheight
, ip
->ftwidth
, wrr
);
register struct ite_softc
*ip
;
else if (flag
== MOVE_CURSOR
) {
dvbox_clear(ip
, sy
, sx
, h
, w
)
register int sy
, sx
, h
, w
;
dvbox_windowmove(ip
, sy
* ip
->ftheight
, sx
* ip
->ftwidth
,
sy
* ip
->ftheight
, sx
* ip
->ftwidth
,
h
* ip
->ftheight
, w
* ip
->ftwidth
,
dvbox_scroll(ip
, sy
, sx
, count
, dir
)
register struct ite_softc
*ip
;
register int width
= ip
->cols
;
else if (dir
== SCROLL_DOWN
) {
height
= ip
->rows
- dy
- 1;
else if (dir
== SCROLL_RIGHT
) {
dvbox_windowmove(ip
, sy
* ip
->ftheight
, sx
* ip
->ftwidth
,
dy
* ip
->ftheight
, dx
* ip
->ftwidth
,
width
* ip
->ftwidth
, RR_COPY
);
dvbox_windowmove(ip
, sy
, sx
, dy
, dx
, h
, w
, func
)
int sy
, sx
, dy
, dx
, h
, w
, func
;
register struct dvboxfb
*dp
= REGBASE
;
db_waitbusy(ip
->regbase
);
dp
->rep_rule
= func
<< 4 | func
;