xref: /netbsd-src/sys/arch/amiga/dev/grfvar.h (revision e99c9b55dde2a6b49cfa3f9e938d39f4739b709a)
1*e99c9b55Sphx /*	$NetBSD: grfvar.h,v 1.25 2015/11/07 14:29:10 phx Exp $	*/
2ec77f0b3Scgd 
333e84123Smw /*
49b6bd2d9Srmind  * Copyright (c) 1988 University of Utah.
533e84123Smw  * Copyright (c) 1990 The Regents of the University of California.
633e84123Smw  * All rights reserved.
733e84123Smw  *
833e84123Smw  * This code is derived from software contributed to Berkeley by
933e84123Smw  * the Systems Programming Group of the University of Utah Computer
1033e84123Smw  * Science Department.
1133e84123Smw  *
1233e84123Smw  * Redistribution and use in source and binary forms, with or without
1333e84123Smw  * modification, are permitted provided that the following conditions
1433e84123Smw  * are met:
1533e84123Smw  * 1. Redistributions of source code must retain the above copyright
1633e84123Smw  *    notice, this list of conditions and the following disclaimer.
1733e84123Smw  * 2. Redistributions in binary form must reproduce the above copyright
1833e84123Smw  *    notice, this list of conditions and the following disclaimer in the
1933e84123Smw  *    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: grfvar.h 1.9 91/01/21$
37aad01611Sagc  *
38aad01611Sagc  *	@(#)grfvar.h	7.3 (Berkeley) 5/7/91
39aad01611Sagc  */
4033e84123Smw 
4115d4cf6bSchopps struct ite_softc;
4233e84123Smw 
43c132c098She #ifdef _KERNEL
4401173747Sphx /* maximum console size */
4501173747Sphx #define MAXROWS 200
4601173747Sphx #define MAXCOLS 200
4701173747Sphx 
4815d4cf6bSchopps /*
4915d4cf6bSchopps  * this struct is owned by the driver (grfcc, grfrt)
5015d4cf6bSchopps  * and is passed to grf when grf is configed. The ite also
5115d4cf6bSchopps  * uses it...
5215d4cf6bSchopps  */
5333e84123Smw struct	grf_softc {
54cbab9cadSchs 	device_t	g_device;	/* config sets this up. */
5515d4cf6bSchopps 	struct grfinfo	g_display;	/* hardware description (for ioctl) */
5653524e44Schristos 	volatile void	*g_regkva;	/* KVA of registers */
5753524e44Schristos 	volatile void	*g_fbkva;	/* KVA of framebuffer */
5815d4cf6bSchopps 	int		g_flags;	/* software flags */
5915d4cf6bSchopps 	int		g_unit;		/* grf unit we want/have */
6015d4cf6bSchopps 	dev_t		g_itedev;	/* ite device number */
6115d4cf6bSchopps 	dev_t		g_grfdev;	/* grf device number */
6253524e44Schristos 	void		*g_data;	/* device dependent data */
6301173747Sphx 	int		g_blank;	/* shadow copy of blank value */
6401173747Sphx 	int		(*g_mode)(struct grf_softc *, u_long, void *,
6501173747Sphx 				  u_long, int);
6601173747Sphx #if NWSDISPLAY > 0
6701173747Sphx 	struct wsdisplay_accessops	*g_accessops;
6801173747Sphx 	struct wsdisplay_emulops	*g_emulops;
69*e99c9b55Sphx 	struct wsscreen_descr		*g_defaultscr;
70*e99c9b55Sphx 	struct wsscreen_list		*g_scrlist;
7101173747Sphx 	struct vcons_data		g_vd;
7201173747Sphx 	uint16_t g_rowoffset[MAXROWS];	/* speed up putchar-multiplication */
7301173747Sphx 	int	g_wsmode;		/* current wsdisplay mode */
7401173747Sphx 
7501173747Sphx #else
7615d4cf6bSchopps 	int	g_conpri;		/* priority of ite as console */
779382c873Saymeric 	void 	(*g_iteinit)(struct ite_softc *);
789382c873Saymeric 	void 	(*g_itedeinit)(struct ite_softc *);
799382c873Saymeric 	void 	(*g_iteclear)(struct ite_softc *, int, int, int, int);
809382c873Saymeric 	void 	(*g_iteputc)(struct ite_softc *, int, int, int, int);
819382c873Saymeric 	void 	(*g_itecursor)(struct ite_softc *, int);
829382c873Saymeric 	void 	(*g_itescroll)(struct ite_softc *, int, int, int, int);
8301173747Sphx #endif /* NWSDISPLAY */
8433e84123Smw };
85*e99c9b55Sphx 
86*e99c9b55Sphx #if NWSDISPLAY > 0
87*e99c9b55Sphx /*
88*e99c9b55Sphx  * Generic wsdisplay access ops that can be used from all grf drivers.
89*e99c9b55Sphx  */
90*e99c9b55Sphx paddr_t	grf_wsmmap(void *, void *, off_t, int);
91*e99c9b55Sphx int	grf_wsioctl(void *, void *, u_long, void *, int, struct lwp *);
92*e99c9b55Sphx #endif /* NWSDISPLAY */
93*e99c9b55Sphx 
94c132c098She #endif /* _KERNEL */
9533e84123Smw 
9633e84123Smw /* flags */
9733e84123Smw #define	GF_ALIVE	0x01
9833e84123Smw #define GF_OPEN		0x02
9933e84123Smw #define GF_EXCLUDE	0x04
10033e84123Smw #define GF_WANTED	0x08
1013b2546cfSmw #define GF_GRFON	0x10
10201173747Sphx #define GF_CONSOLE	0x20
10333e84123Smw 
10433e84123Smw /* software ids defined in grfioctl.h */
10533e84123Smw 
10615d4cf6bSchopps /* requests to mode routine (g_mode())*/
10733e84123Smw #define GM_GRFON	1
10833e84123Smw #define GM_GRFOFF	2
10933e84123Smw #define GM_GRFOVON	3
11033e84123Smw #define GM_GRFOVOFF	4
11133e84123Smw #define GM_GRFCONFIG	5
1123b2546cfSmw #define GM_GRFGETVMODE	6
1133b2546cfSmw #define GM_GRFSETVMODE	7
1143b2546cfSmw #define GM_GRFGETNUMVM	8
115bdb2629dSmw #define GM_GRFGETBANK	9
116bdb2629dSmw #define GM_GRFSETBANK	10
117bdb2629dSmw #define GM_GRFGETCURBANK 11
118bdb2629dSmw #define GM_GRFIOCTL	12
1194726ce28Schopps #define GM_GRFTOGGLE	13
12033e84123Smw 
12133e84123Smw /* minor device interpretation */
122394b87b8Schopps #define GRFOVDEV	0x10	/* used by grf_ul, overlay planes */
123394b87b8Schopps #define GRFIMDEV	0x20	/* used by grf_ul, images planes */
12433e84123Smw #define GRFUNIT(d)	((d) & 0x7)
12533e84123Smw 
12615d4cf6bSchopps /*
12715d4cf6bSchopps  * unit numbers for devices
12815d4cf6bSchopps  */
12915d4cf6bSchopps enum grfunits {
13015d4cf6bSchopps 	GRF_CC_UNIT,
131c3cb65acSchopps 	GRF_RETINAII_UNIT,
1324726ce28Schopps 	GRF_RETINAIII_UNIT,
133394b87b8Schopps 	GRF_CL5426_UNIT,
134602e68beSchopps 	GRF_ULOWELL_UNIT,
1357212a830Sveego 	GRF_CV64_UNIT,
13670170469Sveego 	GRF_ET4000_UNIT,
13770170469Sveego 	GRF_CV3D_UNIT
13815d4cf6bSchopps };
139