1 /***************************************************************************\
3 |* Copyright 1993-1999 NVIDIA, Corporation. All rights reserved. *|
5 |* NOTICE TO USER: The source code is copyrighted under U.S. and *|
6 |* international laws. Users and possessors of this source code are *|
7 |* hereby granted a nonexclusive, royalty-free copyright license to *|
8 |* use this code in individual and commercial software. *|
10 |* Any use of this source code must include, in the user documenta- *|
11 |* tion and internal comments to the code, notices to the end user *|
14 |* Copyright 1993-1999 NVIDIA, Corporation. All rights reserved. *|
16 |* NVIDIA, CORPORATION MAKES NO REPRESENTATION ABOUT THE SUITABILITY *|
17 |* OF THIS SOURCE CODE FOR ANY PURPOSE. IT IS PROVIDED "AS IS" *|
18 |* WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. NVIDIA, CORPOR- *|
19 |* ATION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOURCE CODE, *|
20 |* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGE- *|
21 |* MENT, AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL *|
22 |* NVIDIA, CORPORATION BE LIABLE FOR ANY SPECIAL, INDIRECT, INCI- *|
23 |* DENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RE- *|
24 |* SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION *|
25 |* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF *|
26 |* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOURCE CODE. *|
28 |* U.S. Government End Users. This source code is a "commercial *|
29 |* item," as that term is defined at 48 C.F.R. 2.101 (OCT 1995), *|
30 |* consisting of "commercial computer software" and "commercial *|
31 |* computer software documentation," as such terms are used in *|
32 |* 48 C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Govern- *|
33 |* ment only as a commercial end item. Consistent with 48 C.F.R. *|
34 |* 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), *|
35 |* all U.S. Government End Users acquire the source code with only *|
36 |* those rights set forth herein. *|
38 \***************************************************************************/
42 #define RIVA_SW_VERSION 0x00010003
44 #include <exec/types.h>
46 #define mem_barrier() /* eps */
49 * Define supported architectures.
51 #define NV_ARCH_03 0x03
52 #define NV_ARCH_04 0x04
53 #define NV_ARCH_10 0x10
54 #define NV_ARCH_20 0x20
55 #define NV_ARCH_30 0x30
56 #define NV_ARCH_40 0x40
58 /***************************************************************************\
62 \***************************************************************************/
65 * Raster OPeration. Windows style ROP3.
67 typedef volatile struct
76 ULONG reserved01
[0x0BB];
80 * 8X8 Monochrome pattern.
82 typedef volatile struct
91 ULONG reserved01
[0x0BD];
93 ULONG reserved03
[0x001];
99 * Scissor clip rectangle.
101 typedef volatile struct
110 ULONG reserved01
[0x0BB];
115 * 2D filled rectangle.
117 typedef volatile struct
126 ULONG reserved01
[0x0BC];
128 ULONG reserved03
[0x03E];
133 * 2D screen-screen BLT.
135 typedef volatile struct
144 ULONG reserved01
[0x0BB];
152 typedef volatile struct
161 ULONG reserved01
[0x0BC];
165 ULONG reserved02
[0x03C];
169 * Filled rectangle combined with monochrome expand. Useful for glyphs.
171 typedef volatile struct
180 ULONG reserved01
[0x0BB];
181 ULONG reserved03
[(0x040)-1];
187 } UnclippedRectangle
[64];
188 ULONG reserved04
[(0x080)-3];
199 } ClippedRectangle
[64];
200 ULONG reserved05
[(0x080)-5];
209 ULONG MonochromeData1C
;
210 ULONG reserved06
[(0x080)+121];
217 ULONG WidthHeightInD
;
218 ULONG WidthHeightOutD
;
220 ULONG MonochromeData1D
;
221 ULONG reserved07
[(0x080)+120];
229 ULONG WidthHeightInE
;
230 ULONG WidthHeightOutE
;
232 ULONG MonochromeData01E
;
237 typedef volatile struct
246 ULONG reserved01
[0x0BC];
247 ULONG Color
; /* source color 0304-0307*/
248 ULONG Reserved02
[0x03e];
249 struct { /* start aliased methods in array 0400- */
250 ULONG point0
; /* y_x S16_S16 in pixels 0- 3*/
251 ULONG point1
; /* y_x S16_S16 in pixels 4- 7*/
252 } Lin
[16]; /* end of aliased methods in array -047f*/
253 struct { /* start aliased methods in array 0480- */
254 ULONG point0X
; /* in pixels, 0 at left 0- 3*/
255 ULONG point0Y
; /* in pixels, 0 at top 4- 7*/
256 ULONG point1X
; /* in pixels, 0 at left 8- b*/
257 ULONG point1Y
; /* in pixels, 0 at top c- f*/
258 } Lin32
[8]; /* end of aliased methods in array -04ff*/
259 ULONG PolyLin
[32]; /* y_x S16_S16 in pixels 0500-057f*/
260 struct { /* start aliased methods in array 0580- */
261 ULONG x
; /* in pixels, 0 at left 0- 3*/
262 ULONG y
; /* in pixels, 0 at top 4- 7*/
263 } PolyLin32
[16]; /* end of aliased methods in array -05ff*/
264 struct { /* start aliased methods in array 0600- */
265 ULONG color
; /* source color 0- 3*/
266 ULONG point
; /* y_x S16_S16 in pixels 4- 7*/
267 } ColorPolyLin
[16]; /* end of aliased methods in array -067f*/
272 typedef volatile struct
281 ULONG reserved01
[0x0BE];
285 typedef volatile struct
294 ULONG reserved01
[0x0BB];
301 typedef volatile struct
310 ULONG reserved01
[0x0BD];
312 ULONG RenderBufferOffset
;
316 /***************************************************************************\
318 * Virtualized RIVA H/W interface. *
320 \***************************************************************************/
326 struct _riva_hw_inst
;
327 struct _riva_hw_state
;
329 * Virtialized chip interface. Makes RIVA 128 and TNT look alike.
331 typedef struct _riva_hw_inst
334 * Chip specific settings.
339 ULONG CrystalFreqKHz
;
340 ULONG RamAmountKBytes
;
341 ULONG MaxVClockFreqKHz
;
342 ULONG RamBandwidthKBytesPerSec
;
347 ULONG FifoEmptyCount
;
352 * Non-FIFO registers.
354 volatile ULONG
*PCRTC0
;
355 volatile ULONG
*PCRTC
;
356 volatile ULONG
*PRAMDAC0
;
358 volatile ULONG
*PFIFO
;
359 volatile ULONG
*PGRAPH
;
360 volatile ULONG
*PEXTDEV
;
361 volatile ULONG
*PTIMER
;
363 volatile ULONG
*PRAMIN
;
364 volatile ULONG
*FIFO
;
365 volatile ULONG
*CURSOR
;
366 volatile U008
*PCIO0
;
369 volatile U008
*PDIO0
;
371 volatile ULONG
*PRAMDAC
;
373 * Common chip functions.
375 int (*Busy
)(struct _riva_hw_inst
*);
376 void (*CalcStateExt
)(struct _riva_hw_inst
*,struct _riva_hw_state
*,int,int,int,int,int,int);
377 void (*LoadStateExt
)(struct _riva_hw_inst
*,struct _riva_hw_state
*);
378 void (*UnloadStateExt
)(struct _riva_hw_inst
*,struct _riva_hw_state
*);
379 void (*SetStartAddress
)(struct _riva_hw_inst
*,ULONG
);
380 int (*ShowHideCursor
)(struct _riva_hw_inst
*,int);
381 void (*LockUnlock
)(struct _riva_hw_inst
*, int);
383 * Current extended mode settings.
385 struct _riva_hw_state
*CurrentState
;
396 RivaSurface2
*Surface
;
399 * Extended mode state information.
401 typedef struct _riva_hw_state
436 * FIFO Free Count. Should attempt to yield processor if RIVA is busy.
439 #define RIVA_FIFO_FREE(hwinst,hwptr,cnt) \
441 while ((hwinst).FifoFreeCount < (cnt)) { \
444 (hwinst).FifoFreeCount = (hwinst).hwptr->FifoFree >> 2; \
446 (hwinst).FifoFreeCount -= (cnt); \
448 #define RIVA_BUSY(hwinst) \
451 while ((hwinst).Busy(&(hwinst))); \
453 #endif /* __RIVA_HW_H__ */