/[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 191 - (show annotations) (download)
Mon Sep 20 05:35:51 2010 UTC (9 years, 4 months ago) by william
File MIME type: text/plain
File size: 2897 byte(s)
Auto Commited Import of: pcsx2-0.9.7-DEBUG (upstream: v0.9.7.3795 local: v0.9.7.186-latest) 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 u128 MaskRow, MaskCol;
60
61 vifCode tag;
62 int cmd;
63 int irq;
64 int cl;
65 int qwcalign;
66 u8 usn;
67
68 bool done;
69 bool vifstalled;
70 bool stallontag;
71
72 // GS registers used for calculating the size of the last local->host transfer initiated on the GS
73 // Transfer size calculation should be restricted to GS emulation in the future
74 tBITBLTBUF BITBLTBUF;
75 tTRXREG TRXREG;
76 u32 GSLastDownloadSize;
77
78 u8 irqoffset; // 32bit offset where next vif code is
79 u32 savedtag; // need this for backwards compat with save states
80 u32 vifpacketsize;
81 u8 inprogress;
82 u32 lastcmd;
83 u8 dmamode;
84 u8 GifWaitState; // 0 = General PATH checking, 1 = Flush path 3, 2 == Wait for VU1
85 };
86
87 extern __aligned16 vifStruct vif0, vif1;
88 extern u8 schedulepath3msk;
89
90 _vifT extern u32 vifRead32(u32 mem);
91 _vifT extern bool vifWrite32(u32 mem, u32 value);
92
93 extern void vif0Interrupt();
94 extern void vif0Reset();
95
96 extern void vif1Interrupt();
97 extern void Vif1MskPath3();
98 extern void vif1Reset();
99
100 typedef int __fastcall FnType_VifCmdHandler(int pass, const u32 *data);
101 typedef FnType_VifCmdHandler* Fnptr_VifCmdHandler;
102
103 extern const __aligned16 Fnptr_VifCmdHandler vifCmdHandler[2][128];
104
105 __fi static int _limit(int a, int max)
106 {
107 return ((a > max) ? max : a);
108 }
109
110 enum VifModes
111 {
112 VIF_NORMAL_TO_MEM_MODE = 0,
113 VIF_NORMAL_FROM_MEM_MODE = 1,
114 VIF_CHAIN_MODE = 2
115 };
116
117 // Generic constants
118 static const unsigned int VIF0intc = 4;
119 static const unsigned int VIF1intc = 5;
120
121 extern u32 g_vifCycles;
122 extern u32 g_vu0Cycles;
123 extern u32 g_vu1Cycles;
124 extern u32 g_packetsizeonvu;
125 extern void vif0FLUSH();
126 extern void vif1FLUSH();

  ViewVC Help
Powered by ViewVC 1.1.22