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

Contents of /trunk/pcsx2/Vif_Dma.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 62 - (show annotations) (download)
Tue Sep 7 11:08:22 2010 UTC (10 years, 1 month ago) by william
File MIME type: text/plain
File size: 3174 byte(s)
Auto Commited Import of: pcsx2-0.9.7-r3738-debug in ./trunk
1 /* 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 #pragma once
17
18 #include "Vif.h"
19 #include "Vif_Unpack.h"
20
21 struct vifCode {
22 u32 addr;
23 u32 size;
24 u32 cmd;
25 u16 wl;
26 u16 cl;
27 };
28
29 union tBITBLTBUF {
30 u64 _u64;
31 struct {
32 u32 SBP : 14;
33 u32 _pad14 : 2;
34 u32 SBW : 6;
35 u32 _pad22 : 2;
36 u32 SPSM : 6;
37 u32 _pad30 : 2;
38 u32 DBP : 14;
39 u32 _pad46 : 2;
40 u32 DBW : 6;
41 u32 _pad54 : 2;
42 u32 DPSM : 6;
43 u32 _pad62 : 2;
44 };
45 };
46
47 union tTRXREG {
48 u64 _u64;
49 struct {
50 u32 RRW : 12;
51 u32 _pad12 : 20;
52 u32 RRH : 12;
53 u32 _pad44 : 20;
54 };
55 };
56
57 // NOTE, if debugging vif stalls, use sega classics, spyro, gt4, and taito
58 struct vifStruct {
59 vifCode tag;
60 int cmd;
61 int irq;
62 int cl;
63 int qwcalign;
64 u8 usn;
65
66 bool done;
67 bool vifstalled;
68 bool stallontag;
69
70 // GS registers used for calculating the size of the last local->host transfer initiated on the GS
71 // Transfer size calculation should be restricted to GS emulation in the future
72 tBITBLTBUF BITBLTBUF;
73 tTRXREG TRXREG;
74 u32 GSLastDownloadSize;
75
76 u8 irqoffset; // 32bit offset where next vif code is
77 u32 savedtag; // need this for backwards compat with save states
78 u32 vifpacketsize;
79 u8 inprogress;
80 u32 lastcmd;
81 u8 dmamode;
82 u8 GifWaitState; // 0 = General PATH checking, 1 = Flush path 3, 2 == Wait for VU1
83 };
84
85 extern vifStruct* vif;
86 extern vifStruct vif0, vif1;
87 extern u8 schedulepath3msk;
88
89 _vifT extern bool vifWrite32(u32 mem, u32 value);
90
91 extern void vif0Interrupt();
92 extern void vif0Reset();
93
94 extern void vif1Interrupt();
95 extern void Vif1MskPath3();
96 extern void vif1Reset();
97
98 typedef int __fastcall FnType_VifCmdHandler(int pass, const u32 *data);
99 typedef FnType_VifCmdHandler* Fnptr_VifCmdHandler;
100
101 extern const __aligned16 Fnptr_VifCmdHandler vifCmdHandler[2][128];
102
103 __fi static int _limit(int a, int max)
104 {
105 return ((a > max) ? max : a);
106 }
107
108 enum VifModes
109 {
110 VIF_NORMAL_TO_MEM_MODE = 0,
111 VIF_NORMAL_FROM_MEM_MODE = 1,
112 VIF_CHAIN_MODE = 2
113 };
114
115 // Generic constants
116 static const unsigned int VIF0intc = 4;
117 static const unsigned int VIF1intc = 5;
118
119 extern u32 g_vifCycles;
120 extern u32 g_vu0Cycles;
121 extern u32 g_vu1Cycles;
122 extern u32 g_packetsizeonvu;
123 extern void vif0FLUSH();
124 extern void vif1FLUSH();
125
126 //------------------------------------------------------------------
127 // newVif SSE-optimized Row/Col Structs
128 //------------------------------------------------------------------
129
130 struct VifMaskTypes
131 {
132 u32 Row0[4], Col0[4];
133 u32 Row1[4], Col1[4];
134 };
135
136 extern __aligned16 VifMaskTypes g_vifmask; // This struct is used by newVif

  ViewVC Help
Powered by ViewVC 1.1.22