11.2Stsutsui/*	$NetBSD: gboxreg.h,v 1.2 2011/02/12 16:40:29 tsutsui Exp $	*/
21.1Stsutsui/*	$OpenBSD: gboxreg.h,v 1.2 2005/01/24 21:36:39 miod Exp $	*/
31.1Stsutsui/*	NetBSD: grf_gbreg.h,v 1.4 1994/10/26 07:23:53 cgd Exp 	*/
41.1Stsutsui
51.1Stsutsui/*
61.1Stsutsui * Copyright (c) 1988 University of Utah.
71.1Stsutsui * Copyright (c) 1990, 1993
81.1Stsutsui *	The Regents of the University of California.  All rights reserved.
91.1Stsutsui *
101.1Stsutsui * This code is derived from software contributed to Berkeley by
111.1Stsutsui * the Systems Programming Group of the University of Utah Computer
121.1Stsutsui * Science Department.
131.1Stsutsui *
141.1Stsutsui * Redistribution and use in source and binary forms, with or without
151.1Stsutsui * modification, are permitted provided that the following conditions
161.1Stsutsui * are met:
171.1Stsutsui * 1. Redistributions of source code must retain the above copyright
181.1Stsutsui *    notice, this list of conditions and the following disclaimer.
191.1Stsutsui * 2. Redistributions in binary form must reproduce the above copyright
201.1Stsutsui *    notice, this list of conditions and the following disclaimer in the
211.1Stsutsui *    documentation and/or other materials provided with the distribution.
221.1Stsutsui * 3. Neither the name of the University nor the names of its contributors
231.1Stsutsui *    may be used to endorse or promote products derived from this software
241.1Stsutsui *    without specific prior written permission.
251.1Stsutsui *
261.1Stsutsui * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
271.1Stsutsui * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
281.1Stsutsui * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
291.1Stsutsui * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
301.1Stsutsui * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
311.1Stsutsui * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
321.1Stsutsui * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
331.1Stsutsui * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
341.1Stsutsui * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
351.1Stsutsui * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
361.1Stsutsui * SUCH DAMAGE.
371.1Stsutsui *
381.1Stsutsui * from: Utah $Hdr: grf_gbreg.h 1.11 92/01/21$
391.1Stsutsui *
401.1Stsutsui *	@(#)grf_gbreg.h	8.1 (Berkeley) 6/10/93
411.1Stsutsui */
421.1Stsutsui
431.1Stsutsui/*
441.1Stsutsui * Gatorbox driver regs
451.1Stsutsui */
461.1Stsutsui
471.1Stsutsui#define TILER_ENABLE		0x80
481.1Stsutsui#define LINE_MOVER_ENABLE	0x80
491.1Stsutsui#define UP_LEFT			0x00
501.1Stsutsui#define DOWN_RIGHT		0x40
511.1Stsutsui#define MOVE_UP_LEFT		(TILER_ENABLE | UP_LEFT)
521.1Stsutsui#define MOVE_DOWN_RIGHT		(TILER_ENABLE | DOWN_RIGHT)
531.1Stsutsui
541.1Stsutsui#define tile_mover_waitbusy(regaddr)					\
551.1Stsutsuido {									\
561.1Stsutsui	while (((volatile struct gboxfb *)(regaddr))->regs.sec_interrupt & 0x10) \
571.1Stsutsui		DELAY(1);						\
581.2Stsutsui} while (/* CONSTCOND */0)
591.1Stsutsui
601.1Stsutsui#define line_mover_waitbusy(regaddr)					\
611.1Stsutsuido {									\
621.1Stsutsui	while ((((volatile struct gboxfb *)(regaddr))->status & 0x80) == 0) \
631.1Stsutsui		DELAY(1);						\
641.2Stsutsui} while (/* CONSTCOND */0)
651.1Stsutsui
661.1Stsutsui#define gbcm_waitbusy(regaddr)						\
671.1Stsutsuido {									\
681.1Stsutsui	while (((volatile struct gboxfb *)(regaddr))->cmap_busy != 0xff) \
691.1Stsutsui		DELAY(1);						\
701.2Stsutsui} while (/* CONSTCOND */0)
711.1Stsutsui
721.1Stsutsuistruct gboxfb {
731.1Stsutsui	struct diofbreg regs;
741.2Stsutsui	uint8_t f2[0x4000-0x5f-1];
751.2Stsutsui	uint8_t crtc_address;		/* CTR controller address reg 0x4000 */
761.2Stsutsui	uint8_t status;			/* Status register	      0x4001 */
771.2Stsutsui	uint8_t crtc_data;		/* CTR controller data reg    0x4002 */
781.2Stsutsui	uint8_t f3[6];
791.2Stsutsui	uint8_t line_mover_rep_rule;	/* Line move rep rule		     */
801.2Stsutsui	uint8_t :8, :8;
811.2Stsutsui	uint8_t line_mover_width;	/* Line move width		     */
821.2Stsutsui	uint8_t f4[0xff3];
831.2Stsutsui	uint8_t width;			/* width in tiles	      0x5001 */
841.2Stsutsui	uint8_t :8;
851.2Stsutsui	uint8_t height;			/* height in tiles	      0x5003 */
861.2Stsutsui	uint8_t f5[3];
871.2Stsutsui	uint8_t rep_rule;		/* replacement rule	      0x5007 */
881.2Stsutsui	uint8_t f6[0x6001-0x5007-1];
891.2Stsutsui	uint8_t blink1;			/* blink 1		      0x6001 */
901.2Stsutsui	uint8_t f7[3];
911.2Stsutsui	uint8_t blink2;			/* blink 2		      0x6005 */
921.2Stsutsui	uint8_t f8[3];
931.2Stsutsui	uint8_t write_protect;		/* write protect	      0x6009 */
941.2Stsutsui	uint8_t f9[0x6803-0x6009-1];
951.2Stsutsui	uint8_t cmap_busy;		/* color map busy	      0x6803 */
961.2Stsutsui	uint8_t f10[0x68b9-0x6803-1];
971.2Stsutsui	uint8_t creg_select;		/* color map register select  0x68b8 */
981.2Stsutsui	uint8_t f11[0x68f1-0x68b9-1];
991.2Stsutsui	uint8_t cmap_write;		/* color map write trigger    0x68f1 */
1001.2Stsutsui	uint8_t f12[0x69b3-0x68f1-1];
1011.2Stsutsui	uint8_t cmap_red;		/* red value register	      0x69b3 */
1021.2Stsutsui	uint8_t :8;
1031.2Stsutsui	uint8_t cmap_grn;		/* green value register	      0x69b5 */
1041.2Stsutsui	uint8_t :8;
1051.2Stsutsui	uint8_t cmap_blu;		/* blue value register	      0x69b6 */
1061.1Stsutsui};
107