xref: /netbsd/sys/arch/playstation2/ee/gsreg.h (revision 768423b8)
1*768423b8Smartin /*	$NetBSD: gsreg.h,v 1.4 2014/03/31 11:25:49 martin Exp $	*/
2*768423b8Smartin 
3*768423b8Smartin /*-
4*768423b8Smartin  * Copyright (c) 2001 The NetBSD Foundation, Inc.
5*768423b8Smartin  * All rights reserved.
6*768423b8Smartin  *
7*768423b8Smartin  * This code is derived from software contributed to The NetBSD Foundation
8*768423b8Smartin  * by UCHIYAMA Yasushi.
9*768423b8Smartin  *
10*768423b8Smartin  * Redistribution and use in source and binary forms, with or without
11*768423b8Smartin  * modification, are permitted provided that the following conditions
12*768423b8Smartin  * are met:
13*768423b8Smartin  * 1. Redistributions of source code must retain the above copyright
14*768423b8Smartin  *    notice, this list of conditions and the following disclaimer.
15*768423b8Smartin  * 2. Redistributions in binary form must reproduce the above copyright
16*768423b8Smartin  *    notice, this list of conditions and the following disclaimer in the
17*768423b8Smartin  *    documentation and/or other materials provided with the distribution.
18*768423b8Smartin  *
19*768423b8Smartin  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20*768423b8Smartin  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21*768423b8Smartin  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22*768423b8Smartin  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23*768423b8Smartin  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24*768423b8Smartin  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25*768423b8Smartin  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26*768423b8Smartin  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27*768423b8Smartin  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28*768423b8Smartin  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29*768423b8Smartin  * POSSIBILITY OF SUCH DAMAGE.
30*768423b8Smartin  */
31*768423b8Smartin 
32*768423b8Smartin #define GS_S_PMODE_REG		MIPS_PHYS_TO_KSEG1(0x12000000)
33*768423b8Smartin #define GS_S_SMODE1_REG		MIPS_PHYS_TO_KSEG1(0x12000010)
34*768423b8Smartin #define GS_S_SMODE2_REG		MIPS_PHYS_TO_KSEG1(0x12000020)
35*768423b8Smartin #define GS_S_SRFSH_REG		MIPS_PHYS_TO_KSEG1(0x12000030)
36*768423b8Smartin #define GS_S_SYNCH1_REG		MIPS_PHYS_TO_KSEG1(0x12000040)
37*768423b8Smartin #define GS_S_SYNCH2_REG		MIPS_PHYS_TO_KSEG1(0x12000050)
38*768423b8Smartin #define GS_S_SYNCV_REG		MIPS_PHYS_TO_KSEG1(0x12000060)
39*768423b8Smartin #define GS_S_DISPFB1_REG	MIPS_PHYS_TO_KSEG1(0x12000070)
40*768423b8Smartin #define GS_S_DISPLAY1_REG	MIPS_PHYS_TO_KSEG1(0x12000080)
41*768423b8Smartin #define GS_S_DISPFB2_REG	MIPS_PHYS_TO_KSEG1(0x12000090)
42*768423b8Smartin #define GS_S_DISPLAY2_REG	MIPS_PHYS_TO_KSEG1(0x120000a0)
43*768423b8Smartin #define GS_S_EXTBUF_REG		MIPS_PHYS_TO_KSEG1(0x120000b0)
44*768423b8Smartin #define GS_S_EXTDATA_REG	MIPS_PHYS_TO_KSEG1(0x120000c0)
45*768423b8Smartin #define GS_S_EXTWRITE_REG	MIPS_PHYS_TO_KSEG1(0x120000d0)
46*768423b8Smartin #define GS_S_BGCOLOR_REG	MIPS_PHYS_TO_KSEG1(0x120000e0)
47*768423b8Smartin #define GS_S_CSR_REG		MIPS_PHYS_TO_KSEG1(0x12001000)
48*768423b8Smartin #define GS_S_IMR_REG		MIPS_PHYS_TO_KSEG1(0x12001010)
49*768423b8Smartin #define GS_S_BUSDIR_REG		MIPS_PHYS_TO_KSEG1(0x12001040)
50*768423b8Smartin #define GS_S_SIGLBLID_REG	MIPS_PHYS_TO_KSEG1(0x12001080)
51*768423b8Smartin 
52*768423b8Smartin #define SMODE1(vhp, vcksel, slck2, nvck, clksel, pevs, pehs, pvs, phs,	\
53*768423b8Smartin     gcont, spml, pck2, xpck, sint, prst, ex, cmod, slck, t1248, lc, rc)	\
54*768423b8Smartin 	(((u_int64_t)(vhp)	<< 36) |				\
55*768423b8Smartin 	((u_int64_t)(vcksel)	<< 34) |				\
56*768423b8Smartin 	((u_int64_t)(slck2)	<< 33) |				\
57*768423b8Smartin 	((u_int64_t)(nvck)	<< 32) |				\
58*768423b8Smartin 	((u_int64_t)(clksel)	<< 30) |				\
59*768423b8Smartin 	((u_int64_t)(pevs)	<< 29) |				\
60*768423b8Smartin 	((u_int64_t)(pehs)	<< 28) |				\
61*768423b8Smartin 	((u_int64_t)(pvs)	<< 27) |				\
62*768423b8Smartin 	((u_int64_t)(phs)	<< 26) |				\
63*768423b8Smartin 	((u_int64_t)(gcont)	<< 25) |				\
64*768423b8Smartin 	((u_int64_t)(spml)	<< 21) |				\
65*768423b8Smartin 	((u_int64_t)(pck2)	<< 19) |				\
66*768423b8Smartin 	((u_int64_t)(xpck)	<< 18) |				\
67*768423b8Smartin 	((u_int64_t)(sint)	<< 17) |				\
68*768423b8Smartin 	((u_int64_t)(prst)	<< 16) |				\
69*768423b8Smartin 	((u_int64_t)(ex)	<< 15) |				\
70*768423b8Smartin 	((u_int64_t)(cmod)	<< 13) |				\
71*768423b8Smartin 	((u_int64_t)(slck)	<< 12) |				\
72*768423b8Smartin 	((u_int64_t)(t1248)	<< 10) |				\
73*768423b8Smartin 	((u_int64_t)(lc)	<<  3) |				\
74*768423b8Smartin 	((u_int64_t)(rc)	<<  0))
75*768423b8Smartin 
76*768423b8Smartin #define SMODE2(dpms, ffmd, inter)					\
77*768423b8Smartin 	(((u_int64_t)(dpms)	<< 2)	|				\
78*768423b8Smartin 	 ((u_int64_t)(ffmd)	<< 1)	|				\
79*768423b8Smartin 	 ((u_int64_t)(inter)	<< 0))
80*768423b8Smartin 
81*768423b8Smartin #define SRFSH(x)	(x)
82*768423b8Smartin 
83*768423b8Smartin #define SYNCH1(hs, hsvs, hseq, hbp, hfp)				\
84*768423b8Smartin 	(((u_int64_t)(hs)	<< 43) |				\
85*768423b8Smartin 	((u_int64_t)(hsvs)	<< 32) |				\
86*768423b8Smartin 	((u_int64_t)(hseq)	<< 22) |				\
87*768423b8Smartin 	((u_int64_t)(hbp)	<< 11) |				\
88*768423b8Smartin 	((u_int64_t)(hfp)	<< 0))
89*768423b8Smartin 
90*768423b8Smartin #define SYNCH2(hb, hf)							\
91*768423b8Smartin 	(((u_int64_t)(hb)	<< 11) |				\
92*768423b8Smartin 	((u_int64_t)(hf)	<< 0))
93*768423b8Smartin 
94*768423b8Smartin #define SYNCV(vs, vdp, vbpe, vbp, vfpe, vfp)				\
95*768423b8Smartin 	(((u_int64_t)(vs)	<< 53) |				\
96*768423b8Smartin 	((u_int64_t)(vdp)	<< 42) |				\
97*768423b8Smartin 	((u_int64_t)(vbpe)	<< 32) |				\
98*768423b8Smartin 	((u_int64_t)(vbp)	<< 20) |				\
99*768423b8Smartin 	((u_int64_t)(vfpe)	<< 10) |				\
100*768423b8Smartin 	((u_int64_t)(vfp)	<< 0))
101*768423b8Smartin 
102*768423b8Smartin #define DISPLAY(dh, dw, magv, magh, dy, dx)				\
103*768423b8Smartin 	(((u_int64_t)(dh)	<< 44)	|				\
104*768423b8Smartin 	 ((u_int64_t)(dw)	<< 32)	|				\
105*768423b8Smartin 	 ((u_int64_t)(magv)	<< 27)	|				\
106*768423b8Smartin 	 ((u_int64_t)(magh)	<< 23)	|				\
107*768423b8Smartin 	 ((u_int64_t)(dy)	<< 12)	|				\
108*768423b8Smartin 	 ((u_int64_t)(dx)	<<  0))
109