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