sticreg.h revision 1.2.2.2 1 1.2.2.2 bouyer /* $NetBSD: sticreg.h,v 1.2.2.2 2001/03/12 13:31:26 bouyer Exp $ */
2 1.1 jonathan
3 1.2.2.1 bouyer /*-
4 1.2.2.2 bouyer * Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc.
5 1.1 jonathan * All rights reserved.
6 1.1 jonathan *
7 1.2.2.1 bouyer * This code is derived from software contributed to The NetBSD Foundation
8 1.2.2.1 bouyer * by Andrew Doran.
9 1.2.2.1 bouyer *
10 1.1 jonathan * Redistribution and use in source and binary forms, with or without
11 1.1 jonathan * modification, are permitted provided that the following conditions
12 1.1 jonathan * are met:
13 1.1 jonathan * 1. Redistributions of source code must retain the above copyright
14 1.1 jonathan * notice, this list of conditions and the following disclaimer.
15 1.1 jonathan * 2. Redistributions in binary form must reproduce the above copyright
16 1.1 jonathan * notice, this list of conditions and the following disclaimer in the
17 1.1 jonathan * documentation and/or other materials provided with the distribution.
18 1.1 jonathan * 3. All advertising materials mentioning features or use of this software
19 1.1 jonathan * must display the following acknowledgement:
20 1.2.2.1 bouyer * This product includes software developed by the NetBSD
21 1.2.2.1 bouyer * Foundation, Inc. and its contributors.
22 1.2.2.1 bouyer * 4. Neither the name of The NetBSD Foundation nor the names of its
23 1.2.2.1 bouyer * contributors may be used to endorse or promote products derived
24 1.2.2.1 bouyer * from this software without specific prior written permission.
25 1.2.2.1 bouyer *
26 1.2.2.1 bouyer * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27 1.2.2.1 bouyer * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28 1.2.2.1 bouyer * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 1.2.2.1 bouyer * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30 1.2.2.1 bouyer * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 1.2.2.1 bouyer * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 1.2.2.1 bouyer * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 1.2.2.1 bouyer * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 1.2.2.1 bouyer * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 1.2.2.1 bouyer * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 1.2.2.1 bouyer * POSSIBILITY OF SUCH DAMAGE.
37 1.1 jonathan */
38 1.1 jonathan
39 1.2.2.1 bouyer #ifndef _TC_STICREG_H_
40 1.1 jonathan #define _TC_STICREG_H_
41 1.1 jonathan
42 1.2.2.1 bouyer /*
43 1.2.2.1 bouyer * PixelStamp command packets take this general format:
44 1.2.2.1 bouyer *
45 1.2.2.1 bouyer * command word
46 1.2.2.1 bouyer * plane mask & primitive count
47 1.2.2.1 bouyer * always zero
48 1.2.2.1 bouyer * update method
49 1.2.2.1 bouyer *
50 1.2.2.1 bouyer * per-packet context (optional):
51 1.2.2.1 bouyer * line width
52 1.2.2.1 bouyer * xy mask
53 1.2.2.1 bouyer * cliping rectangle min & max
54 1.2.2.1 bouyer * rgb constant
55 1.2.2.1 bouyer * z constant
56 1.2.2.1 bouyer *
57 1.2.2.1 bouyer * per-primitive context (optional):
58 1.2.2.1 bouyer * xy mask
59 1.2.2.1 bouyer * xy mask address
60 1.2.2.1 bouyer * primitive data (vertices, spans info, video)
61 1.2.2.1 bouyer * line width
62 1.2.2.1 bouyer * halfspace equals conditions
63 1.2.2.1 bouyer * rgb flat, or rgb{1,2,3} smooth
64 1.2.2.1 bouyer * z flat, or z{1,2,3} smooth
65 1.2.2.1 bouyer */
66 1.2.2.1 bouyer
67 1.2.2.1 bouyer /*
68 1.2.2.1 bouyer * Command word.
69 1.2.2.1 bouyer */
70 1.2.2.1 bouyer #define STAMP_CMD_POINTS (0x0000)
71 1.2.2.1 bouyer #define STAMP_CMD_LINES (0x0001)
72 1.2.2.1 bouyer #define STAMP_CMD_TRIANGLES (0x0002)
73 1.2.2.1 bouyer #define STAMP_CMD_COPYSPANS (0x0005)
74 1.2.2.1 bouyer #define STAMP_CMD_READSPANS (0x0006)
75 1.2.2.1 bouyer #define STAMP_CMD_WRITESPANS (0x0007)
76 1.2.2.1 bouyer #define STAMP_CMD_VIDEO (0x0008)
77 1.2.2.1 bouyer
78 1.2.2.1 bouyer #define STAMP_RGB_NONE (0x0000)
79 1.2.2.1 bouyer #define STAMP_RGB_CONST (0x0010)
80 1.2.2.1 bouyer #define STAMP_RGB_FLAT (0x0020)
81 1.2.2.1 bouyer #define STAMP_RGB_SMOOTH (0x0030)
82 1.2.2.1 bouyer
83 1.2.2.1 bouyer #define STAMP_Z_NONE (0x0000)
84 1.2.2.1 bouyer #define STAMP_Z_CONST (0x0040)
85 1.2.2.1 bouyer #define STAMP_Z_FLAT (0x0080)
86 1.2.2.1 bouyer #define STAMP_Z_SMOOTH (0x00c0)
87 1.2.2.1 bouyer
88 1.2.2.1 bouyer #define STAMP_XY_NONE (0x0000)
89 1.2.2.1 bouyer #define STAMP_XY_PERPACKET (0x0100)
90 1.2.2.1 bouyer #define STAMP_XY_PERPRIMATIVE (0x0200)
91 1.2.2.1 bouyer
92 1.2.2.1 bouyer #define STAMP_LW_NONE (0x0000)
93 1.2.2.1 bouyer #define STAMP_LW_PERPACKET (0x0400)
94 1.2.2.1 bouyer #define STAMP_LW_PERPRIMATIVE (0x0800)
95 1.2.2.1 bouyer
96 1.2.2.1 bouyer #define STAMP_CLIPRECT (0x00080000)
97 1.2.2.1 bouyer #define STAMP_MESH (0x00200000)
98 1.2.2.1 bouyer #define STAMP_AALINE (0x00800000)
99 1.2.2.1 bouyer #define STAMP_HS_EQUALS (0x80000000)
100 1.2.2.1 bouyer
101 1.2.2.1 bouyer /*
102 1.2.2.1 bouyer * Update word.
103 1.2.2.1 bouyer */
104 1.2.2.1 bouyer #define STAMP_PLANE_8X3 (0 << 5)
105 1.2.2.1 bouyer #define STAMP_PLANE_24 (1 << 5)
106 1.2.2.1 bouyer
107 1.2.2.1 bouyer /* Write enable */
108 1.2.2.1 bouyer #define STAMP_WE_SIGN (0x04 << 8)
109 1.2.2.1 bouyer #define STAMP_WE_XYMASK (0x02 << 8)
110 1.2.2.1 bouyer #define STAMP_WE_CLIPRECT (0x01 << 8)
111 1.2.2.1 bouyer #define STAMP_WE_NONE (0x00 << 8)
112 1.2.2.1 bouyer
113 1.2.2.1 bouyer #define STAMP_METHOD_CLEAR (0x60 << 12)
114 1.2.2.1 bouyer #define STAMP_METHOD_AND (0x14 << 12)
115 1.2.2.1 bouyer #define STAMP_METHOD_ANDREV (0x15 << 12)
116 1.2.2.1 bouyer #define STAMP_METHOD_COPY (0x20 << 12)
117 1.2.2.1 bouyer #define STAMP_METHOD_ANDINV (0x16 << 12)
118 1.2.2.1 bouyer #define STAMP_METHOD_NOOP (0x40 << 12)
119 1.2.2.1 bouyer #define STAMP_METHOD_XOR (0x11 << 12)
120 1.2.2.1 bouyer #define STAMP_METHOD_OR (0x0f << 12)
121 1.2.2.1 bouyer #define STAMP_METHOD_NOR (0x17 << 12)
122 1.2.2.1 bouyer #define STAMP_METHOD_EQUIV (0x10 << 12)
123 1.2.2.1 bouyer #define STAMP_METHOD_INV (0x4e << 12)
124 1.2.2.1 bouyer #define STAMP_METHOD_ORREV (0x0e << 12)
125 1.2.2.1 bouyer #define STAMP_METHOD_COPYINV (0x2d << 12)
126 1.2.2.1 bouyer #define STAMP_METHOD_ORINV (0x0d << 12)
127 1.2.2.1 bouyer #define STAMP_METHOD_NAND (0x0c << 12)
128 1.2.2.1 bouyer #define STAMP_METHOD_SET (0x6c << 12)
129 1.2.2.1 bouyer #define STAMP_METHOD_SUM (0x00 << 12)
130 1.2.2.1 bouyer #define STAMP_METHOD_DIFF (0x02 << 12)
131 1.2.2.1 bouyer #define STAMP_METHOD_REVDIFF (0x01 << 12)
132 1.2.2.1 bouyer
133 1.2.2.1 bouyer /* Double buffering */
134 1.2.2.1 bouyer #define STAMP_DB_NONE (0x00 << 28)
135 1.2.2.1 bouyer #define STAMP_DB_01 (0x01 << 28)
136 1.2.2.1 bouyer #define STAMP_DB_12 (0x02 << 28)
137 1.2.2.1 bouyer #define STAMP_DB_02 (0x04 << 28)
138 1.2.2.1 bouyer
139 1.2.2.1 bouyer #define STAMP_UPDATE_ENABLE (1 << 0)
140 1.2.2.1 bouyer #define STAMP_SAVE_SIGN (1 << 6)
141 1.2.2.1 bouyer #define STAMP_SAVE_ALPHA (1 << 7)
142 1.2.2.1 bouyer #define STAMP_SUPERSAMPLE (1 << 11)
143 1.2.2.1 bouyer #define STAMP_SPAN (1 << 19)
144 1.2.2.1 bouyer #define STAMP_COPYSPAN_ALIGNED (1 << 20)
145 1.2.2.1 bouyer #define STAMP_MINMAX (1 << 21)
146 1.2.2.1 bouyer #define STAMP_MULT (1 << 22)
147 1.2.2.1 bouyer #define STAMP_MULTACC (1 << 23)
148 1.2.2.1 bouyer #define STAMP_HALF_BUFF (1 << 27)
149 1.2.2.1 bouyer #define STAMP_INITIALIZE (1 << 31)
150 1.1 jonathan
151 1.2.2.1 bouyer /*
152 1.2.2.1 bouyer * Mask address calculation.
153 1.2.2.1 bouyer */
154 1.2.2.1 bouyer #define XMASKADDR(sw, sx, a) (((a)-((sx) % (sw))) & 15)
155 1.2.2.1 bouyer #define YMASKADDR(sh, sy, b) (((b)-((sy) % (sh))) & 15)
156 1.2.2.1 bouyer #define XYMASKADDR(sw,sh,x,y,a,b) \
157 1.2.2.1 bouyer (XMASKADDR(sw,x,a) << 16 | YMASKADDR(sh,y,b))
158 1.2.2.1 bouyer
159 1.2.2.1 bouyer /*
160 1.2.2.1 bouyer * Miscellenous constants.
161 1.2.2.1 bouyer */
162 1.2.2.1 bouyer #define STIC_MAGIC_X 370
163 1.2.2.1 bouyer #define STIC_MAGIC_Y 37
164 1.1 jonathan
165 1.2.2.1 bouyer #define STAMP_OK (0)
166 1.2.2.1 bouyer #define STAMP_BUSY (1)
167 1.2.2.2 bouyer #define STAMP_RETRIES (100000)
168 1.2.2.2 bouyer #define STAMP_DELAY (10)
169 1.1 jonathan
170 1.1 jonathan /*
171 1.2.2.1 bouyer * STIC registers.
172 1.1 jonathan */
173 1.2.2.1 bouyer struct stic_regs {
174 1.2.2.1 bouyer u_int32_t sr_pad0;
175 1.2.2.1 bouyer u_int32_t sr_pad1;
176 1.2.2.1 bouyer u_int32_t sr_hsync;
177 1.2.2.1 bouyer u_int32_t sr_hsync2;
178 1.2.2.1 bouyer u_int32_t sr_hblank;
179 1.2.2.1 bouyer u_int32_t sr_vsync;
180 1.2.2.1 bouyer u_int32_t sr_vblank;
181 1.2.2.1 bouyer u_int32_t sr_vtest;
182 1.2.2.1 bouyer u_int32_t sr_ipdvint;
183 1.2.2.1 bouyer u_int32_t sr_pad2;
184 1.2.2.1 bouyer u_int32_t sr_sticsr;
185 1.2.2.1 bouyer u_int32_t sr_busdat;
186 1.2.2.1 bouyer u_int32_t sr_busadr;
187 1.2.2.1 bouyer u_int32_t sr_pad3;
188 1.2.2.1 bouyer u_int32_t sr_buscsr;
189 1.2.2.1 bouyer u_int32_t sr_modcl;
190 1.2.2.1 bouyer };
191 1.2.2.1 bouyer
192 1.2.2.1 bouyer /*
193 1.2.2.1 bouyer * Bit definitions for stic_regs::sticsr.
194 1.2.2.1 bouyer */
195 1.2.2.1 bouyer #define STIC_CSR_TSTFNC 0x00000003
196 1.1 jonathan # define STIC_CSR_TSTFNC_NORMAL 0
197 1.1 jonathan # define STIC_CSR_TSTFNC_PARITY 1
198 1.1 jonathan # define STIC_CSR_TSTFNC_CNTPIX 2
199 1.1 jonathan # define STIC_CSR_TSTFNC_TSTDAC 3
200 1.2.2.1 bouyer #define STIC_CSR_CHECKPAR 0x00000004
201 1.2.2.1 bouyer #define STIC_CSR_STARTVT 0x00000010
202 1.2.2.1 bouyer #define STIC_CSR_START 0x00000020
203 1.2.2.1 bouyer #define STIC_CSR_RESET 0x00000040
204 1.2.2.1 bouyer #define STIC_CSR_STARTST 0x00000080
205 1.2.2.1 bouyer
206 1.2.2.1 bouyer /*
207 1.2.2.1 bouyer * Bit definitions for stic_regs::int. Three four-bit wide fields, for
208 1.2.2.1 bouyer * error (E), vertical-blank (V), and packetbuf-done (P) intererupts,
209 1.2.2.1 bouyer * respectively. The low-order three bits of each field are enable,
210 1.2.2.1 bouyer * requested, and acknowledge bits. The top bit of each field is unused.
211 1.2.2.1 bouyer */
212 1.2.2.1 bouyer #define STIC_INT_E_EN 0x00000001
213 1.2.2.1 bouyer #define STIC_INT_E 0x00000002
214 1.2.2.1 bouyer #define STIC_INT_E_WE 0x00000004
215 1.2.2.1 bouyer
216 1.2.2.1 bouyer #define STIC_INT_V_EN 0x00000100
217 1.2.2.1 bouyer #define STIC_INT_V 0x00000200
218 1.2.2.1 bouyer #define STIC_INT_V_WE 0x00000400
219 1.2.2.1 bouyer
220 1.2.2.1 bouyer #define STIC_INT_P_EN 0x00010000
221 1.2.2.1 bouyer #define STIC_INT_P 0x00020000
222 1.2.2.1 bouyer #define STIC_INT_P_WE 0x00040000
223 1.2.2.1 bouyer
224 1.2.2.1 bouyer #define STIC_INT_E_MASK (STIC_INT_E_EN | STIC_INT_E | STIC_INT_E_WE)
225 1.2.2.1 bouyer #define STIC_INT_V_MASK (STIC_INT_V_EN | STIC_INT_V | STIC_INT_V_WE)
226 1.2.2.1 bouyer #define STIC_INT_P_MASK (STIC_INT_P_EN | STIC_INT_P | STIC_INT_P_WE)
227 1.2.2.1 bouyer #define STIC_INT_MASK (STIC_INT_E_MASK | STIC_INT_P_MASK | STIC_INT_V_MASK)
228 1.1 jonathan
229 1.2.2.1 bouyer #define STIC_INT_WE (STIC_INT_E_WE | STIC_INT_V_WE | STIC_INT_P_WE)
230 1.2.2.1 bouyer #define STIC_INT_CLR (STIC_INT_E_EN | STIC_INT_V_EN | STIC_INT_P_EN)
231 1.2.2.1 bouyer
232 1.2.2.1 bouyer /*
233 1.2.2.1 bouyer * On DMA: reading from a STIC poll register causes load & execution of
234 1.2.2.1 bouyer * the packet at the correspoinding physical address. Either STAMP_OK
235 1.2.2.1 bouyer * or STAMP_BUSY will be returned to indicate status.
236 1.2.2.1 bouyer *
237 1.2.2.1 bouyer * The STIC sees only 23-bits (8MB) of address space. Bits 21-22 in
238 1.2.2.1 bouyer * physical address space map to bits 27-28, and bits 15-20 map to bits
239 1.2.2.1 bouyer * 18-23 in the STIC's warped view of the word. On the PXG, the STIC
240 1.2.2.1 bouyer * sees only the onboard SRAM (so any `physical addresses' are offsets
241 1.2.2.1 bouyer * into the beginning of the SRAM).
242 1.2.2.1 bouyer */
243 1.1 jonathan
244 1.1 jonathan #endif /* _TC_STICREG_H_ */
245