annotate Plugins/Input/sexypsf/PsxHw.c @ 941:f923aa230a2a trunk

[svn] rewritten audiocompress aboutbox
author giacomo
date Sat, 15 Apr 2006 18:49:50 -0700
parents 42cdc99e395a
children 61e7332e0652 f12d7e208b43
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
333
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
1 /* Pcsx - Pc Psx Emulator
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
2 * Copyright (C) 1999-2002 Pcsx Team
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
3 *
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
4 * This program is free software; you can redistribute it and/or modify
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
5 * it under the terms of the GNU General Public License as published by
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
6 * the Free Software Foundation; either version 2 of the License, or
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
7 * (at your option) any later version.
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
8 *
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
9 * This program is distributed in the hope that it will be useful,
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
12 * GNU General Public License for more details.
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
13 *
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
14 * You should have received a copy of the GNU General Public License
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
15 * along with this program; if not, write to the Free Software
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
17 */
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
18
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
19 #include <stdio.h>
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
20 #include <string.h>
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
21
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
22 #include "PsxCommon.h"
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
23
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
24 #define HW_DMA4_MADR (psxHu32(0x10c0)) // SPU DMA
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
25 #define HW_DMA4_BCR (psxHu32(0x10c4))
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
26 #define HW_DMA4_CHCR (psxHu32(0x10c8))
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
27
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
28 #define HW_DMA_PCR (psxHu32(0x10f0))
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
29 #define HW_DMA_ICR (psxHu32(0x10f4))
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
30
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
31 void psxHwReset() {
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
32 memset(psxH, 0, 0x10000);
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
33 psxRcntInit();
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
34 }
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
35
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
36 u8 psxHwRead8(u32 add) {
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
37 u8 hard;
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
38
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
39 switch (add) {
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
40 default:
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
41 hard = psxHu8(add);
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
42 return hard;
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
43 }
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
44 return hard;
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
45 }
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
46
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
47 u16 psxHwRead16(u32 add) {
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
48 u16 hard;
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
49
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
50 switch (add) {
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
51 case 0x1f801100:
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
52 hard = psxRcntRcount(0);
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
53 return hard;
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
54 case 0x1f801104:
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
55 hard = psxCounters[0].mode;
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
56 return hard;
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
57 case 0x1f801108:
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
58 hard = psxCounters[0].target;
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
59 return hard;
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
60 case 0x1f801110:
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
61 hard = psxRcntRcount(1);
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
62 return hard;
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
63 case 0x1f801114:
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
64 hard = psxCounters[1].mode;
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
65 return hard;
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
66 case 0x1f801118:
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
67 hard = psxCounters[1].target;
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
68 return hard;
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
69 case 0x1f801120:
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
70 hard = psxRcntRcount(2);
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
71 return hard;
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
72 case 0x1f801124:
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
73 hard = psxCounters[2].mode;
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
74 return hard;
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
75 case 0x1f801128:
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
76 hard = psxCounters[2].target;
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
77 return hard;
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
78
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
79 default:
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
80 if (add>=0x1f801c00 && add<0x1f801e00) {
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
81 hard = SPUreadRegister(add);
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
82 } else {
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
83 hard = BFLIP16(psxHu16(add));
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
84 }
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
85 return hard;
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
86 }
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
87 return hard;
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
88 }
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
89
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
90 u32 psxHwRead32(u32 add) {
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
91 u32 hard;
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
92
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
93 switch (add) {
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
94 // time for rootcounters :)
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
95 case 0x1f801100:
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
96 hard = psxRcntRcount(0);
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
97 return hard;
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
98 case 0x1f801104:
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
99 hard = psxCounters[0].mode;
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
100 return hard;
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
101 case 0x1f801108:
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
102 hard = psxCounters[0].target;
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
103 return hard;
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
104 case 0x1f801110:
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
105 hard = psxRcntRcount(1);
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
106 return hard;
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
107 case 0x1f801114:
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
108 hard = psxCounters[1].mode;
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
109 return hard;
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
110 case 0x1f801118:
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
111 hard = psxCounters[1].target;
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
112 return hard;
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
113 case 0x1f801120:
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
114 hard = psxRcntRcount(2);
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
115 return hard;
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
116 case 0x1f801124:
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
117 hard = psxCounters[2].mode;
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
118 return hard;
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
119 case 0x1f801128:
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
120 hard = psxCounters[2].target;
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
121 return hard;
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
122
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
123 default:
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
124 hard = BFLIP32(psxHu32(add));
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
125 return hard;
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
126 }
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
127 return hard;
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
128 }
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
129
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
130 void psxHwWrite8(u32 add, u8 value) {
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
131 switch (add) {
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
132 default:
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
133 psxHu8(add) = value;
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
134 return;
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
135 }
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
136 psxHu8(add) = value;
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
137 }
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
138
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
139 void psxHwWrite16(u32 add, u16 value) {
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
140 switch (add) {
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
141
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
142 case 0x1f801070:
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
143 psxHu16(0x1070) &= BFLIP16( BFLIP16(psxHu16(0x1074)) & value);
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
144 return;
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
145 case 0x1f801100:
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
146 psxRcntWcount(0, value); return;
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
147 case 0x1f801104:
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
148 psxRcntWmode(0, value); return;
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
149 case 0x1f801108:
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
150 psxRcntWtarget(0, value); return;
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
151
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
152 case 0x1f801110:
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
153 psxRcntWcount(1, value); return;
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
154 case 0x1f801114:
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
155 psxRcntWmode(1, value); return;
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
156 case 0x1f801118:
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
157 psxRcntWtarget(1, value); return;
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
158
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
159 case 0x1f801120:
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
160 psxRcntWcount(2, value); return;
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
161 case 0x1f801124:
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
162 psxRcntWmode(2, value); return;
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
163 case 0x1f801128:
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
164 psxRcntWtarget(2, value); return;
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
165
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
166 default:
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
167 if (add>=0x1f801c00 && add<0x1f801e00) {
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
168 SPUwriteRegister(add, value);
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
169 return;
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
170 }
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
171
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
172 psxHu16(add) = BFLIP16(value);
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
173 return;
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
174 }
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
175 psxHu16(add) = BFLIP16(value);
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
176 }
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
177
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
178 #define DMA_INTERRUPT(n) \
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
179 if (BFLIP32(HW_DMA_ICR) & (1 << (16 + n))) { \
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
180 HW_DMA_ICR|= BFLIP32(1 << (24 + n)); \
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
181 psxHu32(0x1070) |= BFLIP32(8); \
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
182 }
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
183
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
184 #define DmaExec(n) { \
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
185 if (BFLIP32(HW_DMA##n##_CHCR) & 0x01000000 && BFLIP32(HW_DMA_PCR) & (8 << (n * 4))) { \
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
186 psxDma##n(BFLIP32(HW_DMA##n##_MADR), BFLIP32(HW_DMA##n##_BCR), BFLIP32(HW_DMA##n##_CHCR)); \
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
187 HW_DMA##n##_CHCR &= BFLIP32(~0x01000000); \
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
188 DMA_INTERRUPT(n); \
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
189 } \
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
190 }
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
191
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
192 void psxHwWrite32(u32 add, u32 value) {
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
193 switch (add) {
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
194 case 0x1f801070:
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
195 psxHu32(0x1070) &= BFLIP32(BFLIP32(psxHu32(0x1074)) & value);
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
196 return;
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
197 case 0x1f8010c8:
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
198 HW_DMA4_CHCR = BFLIP32(value); // DMA4 chcr (SPU DMA)
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
199 DmaExec(4);
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
200 return;
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
201 case 0x1f8010f4:
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
202 {
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
203 u32 tmp = (~value) & BFLIP32(HW_DMA_ICR);
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
204 HW_DMA_ICR = BFLIP32(((tmp ^ value) & 0xffffff) ^ tmp);
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
205 return;
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
206 }
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
207
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
208 case 0x1f801100:
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
209 psxRcntWcount(0, value & 0xffff); return;
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
210 case 0x1f801104:
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
211 psxRcntWmode(0, value); return;
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
212 case 0x1f801108:
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
213 psxRcntWtarget(0, value & 0xffff); return;
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
214 // HW_DMA_ICR&= (~value)&0xff000000;
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
215
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
216 case 0x1f801110:
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
217 psxRcntWcount(1, value & 0xffff); return;
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
218 case 0x1f801114:
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
219 psxRcntWmode(1, value); return;
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
220 case 0x1f801118:
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
221 psxRcntWtarget(1, value & 0xffff); return;
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
222
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
223 case 0x1f801120:
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
224 psxRcntWcount(2, value & 0xffff); return;
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
225 case 0x1f801124:
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
226 psxRcntWmode(2, value); return;
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
227 case 0x1f801128:
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
228 psxRcntWtarget(2, value & 0xffff); return;
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
229
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
230 default:
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
231 psxHu32(add) = BFLIP32(value);
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
232 return;
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
233 }
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
234 psxHu32(add) = BFLIP32(value);
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
235 }
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
236