1/*	$NetBSD: grf_ulreg.h,v 1.9 2007/03/05 19:48:20 he Exp $	*/
2
3/*-
4 * Copyright (c) 1995 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Ignatios Souvatzis.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 *    notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 *    notice, this list of conditions and the following disclaimer in the
17 *    documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32/*
33 * Registers etc. for the University of Lowell graphics board.
34 */
35
36struct gspregs {
37	/*
38	 * alas, they didn't invert the A1 bit, so we have to write the
39	 * address pointer in two parts
40	 */
41	volatile u_short hstadrl;
42	volatile u_short hstadrh;
43	volatile u_short data;
44	volatile u_short ctrl;
45};
46
47/* Bits in ctrl */
48#define HLT	0x8000
49#define CF	0x4000
50#define LBL	0x2000
51#define INCR	0x1000
52#define INCW	0x0800
53#define NMIM	0x0200
54#define NMI	0x0100
55
56#define INTOUT	0x0080
57#define MSGOUT	0x0070
58#define INTIN	0x0008
59#define	MSGIN	0x0007
60
61/* address macros */
62
63#define GSPSETHADRS(gsp,adrs)	do {	\
64    (gsp)->hstadrh = (adrs) >> 16;	\
65    (gsp)->hstadrl = (adrs) & 0xFFFF;	\
66    } while (0)
67#define GSPGETHADRS(gsp)	((gsp)->hstadrh << 16 | (gsp)->hstadrl)
68
69/* Standard addresses in GSP memory */
70
71#define PUT_PTR_ADRS    0xFFA20000	/* put pointer in ring buffer */
72#define PUT_HI_PTR_ADRS 0xFFA20010	/* put pointer high word */
73#define GET_PTR_ADRS    0xFFA20020	/* get pointer (low word) */
74#define GSP_MODE_ADRS   0xFFA20040	/* GSP mode word */
75
76/* Bits in GSP mode word */
77#define GMODE_HOLD      1               /* hold screen */
78#define GMODE_FLUSH     2               /* flush GSP input queue */
79#define GMODE_ALTSCRN   4               /* use alternate screen */
80#define GMODE_DISPCTRL  8               /* display control chars */
81
82/* command words */
83#define GCMD_CMD_MSK	0x000F
84#define GCMD_PAR_MSK	0xFFF0
85
86#define GCMD_NOP	0
87#define GCMD_CHAR	1	/* char, fg, bg, x, y */
88#define GCMD_FILL	2	/* fg, x, y, w, h, ppop */
89#define GCMD_PIXBLT	3	/* x, y, w, h, dx, dy */
90#define GCMD_FNTMIR	4	/* */
91#define GCMD_CMAP	5	/* overlay==1, index, red, green, blue */
92#define GCMD_MCHG	6	/* width, height, baseh, basel, pitch, depth */
93
94struct grf_ul_softc {
95	struct grf_softc	gus_sc;
96	u_int8_t		gus_imcmap[768];
97	u_int8_t		gus_ovcmap[12];
98	u_int8_t		gus_ovslct;
99	/* realconfig stuff assumes this is last, else it would get copied: */
100	struct isr		gus_isr;
101};
102
103#ifdef _KERNEL
104void gsp_write(volatile struct gspregs *gsp, u_int16_t *data, size_t size);
105int grful_cnprobe(void);
106void grful_iteinit(struct grf_softc *gp);
107#endif
108
109