/[pcsx2_0.9.7]/trunk/pcsx2/Gif.h
ViewVC logotype

Annotation of /trunk/pcsx2/Gif.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 62 - (hide annotations) (download)
Tue Sep 7 11:08:22 2010 UTC (9 years, 5 months ago) by william
File MIME type: text/plain
File size: 6673 byte(s)
Auto Commited Import of: pcsx2-0.9.7-r3738-debug in ./trunk
1 william 31 /* PCSX2 - PS2 Emulator for PCs
2     * Copyright (C) 2002-2010 PCSX2 Dev Team
3     *
4     * PCSX2 is free software: you can redistribute it and/or modify it under the terms
5     * of the GNU Lesser General Public License as published by the Free Software Found-
6     * ation, either version 3 of the License, or (at your option) any later version.
7     *
8     * PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
9     * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
10     * PURPOSE. See the GNU General Public License for more details.
11     *
12     * You should have received a copy of the GNU General Public License along with PCSX2.
13     * If not, see <http://www.gnu.org/licenses/>.
14     */
15    
16     #ifndef __GIF_H__
17     #define __GIF_H__
18    
19     enum gifstate_t
20     {
21     GIF_STATE_READY = 0,
22     GIF_STATE_STALL = 1,
23     GIF_STATE_DONE = 2,
24     GIF_STATE_EMPTY = 0x10
25     };
26    
27     enum GSTransferModes //0 = Image Mode (DirectHL), 1 = transferring, 2 = Stopped at End of Packet
28     {
29 william 62 PENDINGIMAGE_MODE = 0,
30     IMAGE_MODE = 1,
31     TRANSFER_MODE = 2,
32     PENDINGSTOP_MODE = 3,
33     IDLE_MODE = 4,
34     STOPPED_MODE = 5
35 william 31 };
36    
37     union tGSTransferStatus {
38     struct {
39 william 62 u32 PTH1 : 4; // Resets Vif(0/1) when written.
40     u32 PTH2 : 4; // Causes a Forcebreak to Vif((0/1) when true. (Stall)
41     u32 PTH3 : 4; // Stops after the end of the Vifcode in progress when true. (Stall)
42     u32 reserved : 20;
43 william 31 };
44     u32 _u32;
45    
46     tGSTransferStatus(u32 val) { _u32 = val; }
47     bool test (u32 flags) const { return !!(_u32 & flags); }
48     void set_flags (u32 flags) { _u32 |= flags; }
49     void clear_flags(u32 flags) { _u32 &= ~flags; }
50     void reset() { _u32 = 0; }
51     wxString desc() const { return wxsFormat(L"GSTransferStatus.PTH3: 0x%x", _u32); }
52     };
53     //GIF_STAT
54     enum gif_stat_flags
55     {
56     GIF_STAT_M3R = (1), // GIF_MODE Mask
57     GIF_STAT_M3P = (1<<1), // VIF PATH3 Mask
58     GIF_STAT_IMT = (1<<2), // Intermittent Transfer Mode
59     GIF_STAT_PSE = (1<<3), // Temporary Transfer Stop
60     GIF_STAT_IP3 = (1<<5), // Interrupted PATH3
61     GIF_STAT_P3Q = (1<<6), // PATH3 request Queued
62     GIF_STAT_P2Q = (1<<7), // PATH2 request Queued
63     GIF_STAT_P1Q = (1<<8), // PATH1 request Queued
64     GIF_STAT_OPH = (1<<9), // Output Path (Outputting Data)
65     GIF_STAT_APATH1 = (1<<10), // Data Transfer Path 1 (In progress)
66     GIF_STAT_APATH2 = (2<<10), // Data Transfer Path 2 (In progress)
67     GIF_STAT_APATH3 = (3<<10), // Data Transfer Path 3 (In progress) (Mask too)
68     GIF_STAT_DIR = (1<<12), // Transfer Direction
69     GIF_STAT_FQC = (31<<24) // QWC in GIF-FIFO
70     };
71    
72     enum gif_mode_flags
73     {
74     GIF_MODE_M3R = (1),
75     GIF_MODE_IMT = (1<<2)
76     };
77    
78     union tGIF_CTRL
79     {
80     struct
81     {
82     u32 RST : 1;
83     u32 reserved1 : 2;
84     u32 PSE : 1;
85     u32 reserved2 : 28;
86     };
87     u32 _u32;
88    
89     tGIF_CTRL(u32 val) { _u32 = val; }
90    
91     bool test(u32 flags) { return !!(_u32 & flags); }
92     void set_flags(u32 flags) { _u32 |= flags; }
93     void clear_flags(u32 flags) { _u32 &= ~flags; }
94     void reset() { _u32 = 0; }
95     wxString desc() { return wxsFormat(L"Ctrl: 0x%x", _u32); }
96     };
97    
98     union tGIF_MODE
99     {
100     struct
101     {
102     u32 M3R : 1;
103     u32 reserved1 : 1;
104     u32 IMT : 1;
105     u32 reserved2 : 29;
106     };
107     u32 _u32;
108    
109     tGIF_MODE(u32 val) { _u32 = val; }
110    
111     void write(u32 val) { _u32 = val; }
112     bool test(u32 flags) { return !!(_u32 & flags); }
113     void set_flags(u32 flags) { _u32 |= flags; }
114     void clear_flags(u32 flags) { _u32 &= ~flags; }
115     void reset() { _u32 = 0; }
116     wxString desc() { return wxsFormat(L"Mode: 0x%x", _u32); }
117     };
118    
119     enum gif_paths
120     {
121     GIF_APATH_IDLE = 0,
122     GIF_APATH1,
123     GIF_APATH2,
124     GIF_APATH3
125     };
126    
127     union tGIF_STAT
128     {
129     struct
130     {
131     u32 M3R : 1;
132     u32 M3P : 1;
133     u32 IMT : 1;
134     u32 PSE : 1;
135     u32 reserved1 : 1;
136     u32 IP3 : 1;
137     u32 P3Q : 1;
138     u32 P2Q : 1;
139     u32 P1Q : 1;
140     u32 OPH : 1;
141     u32 APATH : 2;
142     u32 DIR : 1;
143     u32 reserved2 : 11;
144     u32 FQC : 5;
145     u32 reserved3 : 3;
146     };
147     u32 _u32;
148    
149     tGIF_STAT(u32 val) { _u32 = val; }
150    
151     bool test(u32 flags) { return !!(_u32 & flags); }
152     void set_flags(u32 flags) { _u32 |= flags; }
153     void clear_flags(u32 flags) { _u32 &= ~flags; }
154     void reset() { _u32 = 0; }
155     wxString desc() { return wxsFormat(L"Stat: 0x%x", _u32); }
156     };
157    
158     union tGIF_TAG0
159     {
160     struct
161     {
162     u32 NLOOP : 15;
163     u32 EOP : 1;
164     u32 TAG : 16;
165     };
166     u32 _u32;
167    
168     tGIF_TAG0(u32 val) { _u32 = val; }
169    
170     bool test(u32 flags) { return !!(_u32 & flags); }
171     void set_flags(u32 flags) { _u32 |= flags; }
172     void clear_flags(u32 flags) { _u32 &= ~flags; }
173     void reset() { _u32 = 0; }
174     wxString desc() { return wxsFormat(L"Tag0: 0x%x", _u32); }
175     };
176    
177     union tGIF_TAG1
178     {
179     struct
180     {
181     u32 TAG : 14;
182     u32 PRE : 1;
183     u32 PRIM : 11;
184     u32 FLG : 2;
185     u32 NREG : 4;
186     };
187     u32 _u32;
188    
189     tGIF_TAG1(u32 val) { _u32 = val; }
190    
191     bool test(u32 flags) { return !!(_u32 & flags); }
192     void set_flags(u32 flags) { _u32 |= flags; }
193     void clear_flags(u32 flags) { _u32 &= ~flags; }
194     void reset() { _u32 = 0; }
195     wxString desc() { return wxsFormat(L"Tag1: 0x%x", _u32); }
196     };
197    
198     union tGIF_CNT
199     {
200     struct
201     {
202     u32 LOOPCNT : 15;
203     u32 reserved1 : 1;
204     u32 REGCNT : 4;
205     u32 VUADDR : 2;
206     u32 reserved2 : 10;
207    
208     };
209     u32 _u32;
210    
211     tGIF_CNT(u32 val) { _u32 = val; }
212    
213     bool test(u32 flags) { return !!(_u32 & flags); }
214     void set_flags(u32 flags) { _u32 |= flags; }
215     void clear_flags(u32 flags) { _u32 &= ~flags; }
216     void reset() { _u32 = 0; }
217     wxString desc() { return wxsFormat(L"CNT: 0x%x", _u32); }
218     };
219    
220     union tGIF_P3CNT
221     {
222     struct
223     {
224     u32 P3CNT : 15;
225     u32 reserved1 : 17;
226     };
227     u32 _u32;
228    
229     tGIF_P3CNT(u32 val) { _u32 = val; }
230    
231     void reset() { _u32 = 0; }
232     wxString desc() { return wxsFormat(L"P3CNT: 0x%x", _u32); }
233     };
234    
235     union tGIF_P3TAG
236     {
237     struct
238     {
239     u32 LOOPCNT : 15;
240     u32 EOP : 1;
241     u32 reserved1 : 16;
242     };
243     u32 _u32;
244    
245     tGIF_P3TAG(u32 val) { _u32 = val; }
246    
247     bool test(u32 flags) { return !!(_u32 & flags); }
248     void set_flags(u32 flags) { _u32 |= flags; }
249     void clear_flags(u32 flags) { _u32 &= ~flags; }
250     void reset() { _u32 = 0; }
251     wxString desc() { return wxsFormat(L"P3Tag: 0x%x", _u32); }
252     };
253    
254     struct GIFregisters
255     {
256     tGIF_CTRL ctrl;
257     u32 padding[3];
258     tGIF_MODE mode;
259     u32 padding1[3];
260     tGIF_STAT stat;
261     u32 padding2[7];
262    
263     tGIF_TAG0 tag0;
264     u32 padding3[3];
265     tGIF_TAG1 tag1;
266     u32 padding4[3];
267     u32 tag2;
268     u32 padding5[3];
269     u32 tag3;
270     u32 padding6[3];
271    
272     tGIF_CNT cnt;
273     u32 padding7[3];
274     tGIF_P3CNT p3cnt;
275     u32 padding8[3];
276     tGIF_P3TAG p3tag;
277     u32 padding9[3];
278     };
279    
280 william 62 static GIFregisters& gifRegs = (GIFregisters&)eeHw[0x3000];
281 william 31
282     extern tGSTransferStatus GSTransferStatus;
283    
284     extern void gsInterrupt();
285     extern int _GIFchain();
286     extern void GIFdma();
287     extern void dmaGIF();
288     extern void mfifoGIFtransfer(int qwc);
289     extern void gifMFIFOInterrupt();
290    
291 william 62 //Just some temporary bits to store Path1 transfers if another is in progress.
292     extern void gsPath1Interrupt();
293     extern __aligned16 u8 Path1Buffer[0x1000000];
294     extern u32 Path1WritePos;
295     extern u32 Path1ReadPos;
296 william 31 #endif

  ViewVC Help
Powered by ViewVC 1.1.22