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