/[pcsx2_0.9.7]/trunk/common/include/PS2Edefs.h
ViewVC logotype

Contents of /trunk/common/include/PS2Edefs.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 62 - (show annotations) (download)
Tue Sep 7 11:08:22 2010 UTC (9 years, 11 months ago) by william
File MIME type: text/plain
File size: 27322 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 #ifndef __PS2EDEFS_H__
17 #define __PS2EDEFS_H__
18
19 // Global enable/disable flag, disables all the parts if off
20 //#define ENABLE_NEW_IOPDMA
21
22 // Parts of the dmac, each one can be turned on independently
23 #ifdef ENABLE_NEW_IOPDMA
24 //#define ENABLE_NEW_IOPDMA_SPU2 /* working */
25 //#define ENABLE_NEW_IOPDMA_SIO /* working */
26 //#define ENABLE_NEW_IOPDMA_CDVD /* NOT IMPLEMENTED */
27 //#define ENABLE_NEW_IOPDMA_SIF /* NOT IMPLEMENTED */
28 //#define ENABLE_NEW_IOPDMA_DEV9 /* untested (no plugins) */
29 #endif
30
31 /*
32 * PS2E Definitions v0.6.2 (beta)
33 *
34 * Author: linuzappz@hotmail.com
35 * shadowpcsx2@yahoo.gr
36 * florinsasu@hotmail.com
37 */
38
39 /*
40 Notes:
41 * Since this is still beta things may change.
42
43 * OSflags:
44 __LINUX__ (linux OS)
45 _WIN32 (win32 OS)
46
47 * common return values (for ie. GSinit):
48 0 - success
49 -1 - error
50
51 * reserved keys:
52 F1 to F10 are reserved for the emulator
53
54 * plugins should NOT change the current
55 working directory.
56 (on win32, add flag OFN_NOCHANGEDIR for
57 GetOpenFileName)
58
59 */
60
61 #include "Pcsx2Defs.h"
62
63 ///////////////////////////////////////////////////////////////////////
64
65 // freeze modes:
66 #define FREEZE_LOAD 0
67 #define FREEZE_SAVE 1
68 #define FREEZE_SIZE 2
69
70 // event values:
71 #define KEYPRESS 1
72 #define KEYRELEASE 2
73
74 typedef struct {
75 int size;
76 s8 *data;
77 } freezeData;
78
79 typedef struct _keyEvent {
80 u32 key;
81 u32 evt;
82 } keyEvent;
83
84 ///////////////////////////////////////////////////////////////////////
85
86 #if defined(GSdefs) || defined(PADdefs) || defined(SIOdefs) || \
87 defined(SPU2defs) || defined(CDVDdefs) || defined(DEV9defs) || \
88 defined(USBdefs) || defined(FWdefs)
89 #define COMMONdefs
90 #endif
91
92 // PS2EgetLibType returns (may be OR'd)
93 #define PS2E_LT_GS 0x01
94 #define PS2E_LT_PAD 0x02 // -=[ OBSOLETE ]=-
95 #define PS2E_LT_SPU2 0x04
96 #define PS2E_LT_CDVD 0x08
97 #define PS2E_LT_DEV9 0x10
98 #define PS2E_LT_USB 0x20
99 #define PS2E_LT_FW 0x40
100 #define PS2E_LT_SIO 0x80
101
102 // PS2EgetLibVersion2 (high 16 bits)
103 #define PS2E_GS_VERSION 0x0006
104 #define PS2E_PAD_VERSION 0x0002 // -=[ OBSOLETE ]=-
105 #ifdef ENABLE_NEW_IOPDMA_SPU2
106 # define PS2E_SPU2_VERSION 0x0006
107 #else
108 # define PS2E_SPU2_VERSION 0x0005
109 #endif
110 #define PS2E_CDVD_VERSION 0x0005
111 #ifdef ENABLE_NEW_IOPDMA_DEV9
112 # define PS2E_DEV9_VERSION 0x0004
113 #else
114 # define PS2E_DEV9_VERSION 0x0003
115 #endif
116 #define PS2E_USB_VERSION 0x0003
117 #define PS2E_FW_VERSION 0x0002
118 #define PS2E_SIO_VERSION 0x0001
119 #ifdef COMMONdefs
120
121 #ifdef __cplusplus
122 extern "C" {
123 #endif
124
125 u32 CALLBACK PS2EgetLibType(void);
126 u32 CALLBACK PS2EgetLibVersion2(u32 type);
127 char* CALLBACK PS2EgetLibName(void);
128
129 #ifdef __cplusplus
130 }
131 #endif
132
133 #endif
134
135 // key values:
136 /* key values must be OS dependant:
137 win32: the VK_XXX will be used (WinUser)
138 linux: the XK_XXX will be used (XFree86)
139 */
140
141 // for 64bit compilers
142 typedef char __keyEvent_Size__[(sizeof(keyEvent) == 8)?1:-1];
143
144 // plugin types
145 #define SIO_TYPE_PAD 0x00000001
146 #define SIO_TYPE_MTAP 0x00000004
147 #define SIO_TYPE_RM 0x00000040
148 #define SIO_TYPE_MC 0x00000100
149
150 typedef int (CALLBACK * SIOchangeSlotCB)(int slot);
151
152 typedef struct _cdvdSubQ {
153 u8 ctrl:4; // control and mode bits
154 u8 mode:4; // control and mode bits
155 u8 trackNum; // current track number (1 to 99)
156 u8 trackIndex; // current index within track (0 to 99)
157 u8 trackM; // current minute location on the disc (BCD encoded)
158 u8 trackS; // current sector location on the disc (BCD encoded)
159 u8 trackF; // current frame location on the disc (BCD encoded)
160 u8 pad; // unused
161 u8 discM; // current minute offset from first track (BCD encoded)
162 u8 discS; // current sector offset from first track (BCD encoded)
163 u8 discF; // current frame offset from first track (BCD encoded)
164 } cdvdSubQ;
165
166 typedef struct _cdvdTD { // NOT bcd coded
167 u32 lsn;
168 u8 type;
169 } cdvdTD;
170
171 typedef struct _cdvdTN {
172 u8 strack; //number of the first track (usually 1)
173 u8 etrack; //number of the last track
174 } cdvdTN;
175
176 // CDVDreadTrack mode values:
177 #define CDVD_MODE_2352 0 // full 2352 bytes
178 #define CDVD_MODE_2340 1 // skip sync (12) bytes
179 #define CDVD_MODE_2328 2 // skip sync+head+sub (24) bytes
180 #define CDVD_MODE_2048 3 // skip sync+head+sub (24) bytes
181 #define CDVD_MODE_2368 4 // full 2352 bytes + 16 subq
182
183 // CDVDgetDiskType returns:
184 #define CDVD_TYPE_ILLEGAL 0xff // Illegal Disc
185 #define CDVD_TYPE_DVDV 0xfe // DVD Video
186 #define CDVD_TYPE_CDDA 0xfd // Audio CD
187 #define CDVD_TYPE_PS2DVD 0x14 // PS2 DVD
188 #define CDVD_TYPE_PS2CDDA 0x13 // PS2 CD (with audio)
189 #define CDVD_TYPE_PS2CD 0x12 // PS2 CD
190 #define CDVD_TYPE_PSCDDA 0x11 // PS CD (with audio)
191 #define CDVD_TYPE_PSCD 0x10 // PS CD
192 #define CDVD_TYPE_UNKNOWN 0x05 // Unknown
193 #define CDVD_TYPE_DETCTDVDD 0x04 // Detecting Dvd Dual Sided
194 #define CDVD_TYPE_DETCTDVDS 0x03 // Detecting Dvd Single Sided
195 #define CDVD_TYPE_DETCTCD 0x02 // Detecting Cd
196 #define CDVD_TYPE_DETCT 0x01 // Detecting
197 #define CDVD_TYPE_NODISC 0x00 // No Disc
198
199 // CDVDgetTrayStatus returns:
200 #define CDVD_TRAY_CLOSE 0x00
201 #define CDVD_TRAY_OPEN 0x01
202
203 // cdvdTD.type (track types for cds)
204 #define CDVD_AUDIO_TRACK 0x01
205 #define CDVD_MODE1_TRACK 0x41
206 #define CDVD_MODE2_TRACK 0x61
207
208 #define CDVD_AUDIO_MASK 0x00
209 #define CDVD_DATA_MASK 0x40
210 // CDROM_DATA_TRACK 0x04 //do not enable this! (from linux kernel)
211
212 typedef void (*DEV9callback)(int cycles);
213 typedef int (*DEV9handler)(void);
214
215 typedef void (*USBcallback)(int cycles);
216 typedef int (*USBhandler)(void);
217
218 typedef struct _GSdriverInfo {
219 char name[8];
220 void *common;
221 } GSdriverInfo;
222
223 #ifdef _WINDOWS_
224 typedef struct _winInfo { // unsupported values must be set to zero
225 HWND hWnd;
226 HMENU hMenu;
227 HWND hStatusWnd;
228 } winInfo;
229 #endif
230
231 #ifdef __cplusplus
232 extern "C" {
233 #endif
234
235 /* GS plugin API */
236
237 // if this file is included with this define
238 // the next api will not be skipped by the compiler
239 #ifdef GSdefs
240
241 // basic funcs
242
243 s32 CALLBACK GSinit();
244 s32 CALLBACK GSopen(void *pDsp, char *Title, int multithread);
245 void CALLBACK GSclose();
246 void CALLBACK GSshutdown();
247 void CALLBACK GSsetSettingsDir( const char* dir );
248 void CALLBACK GSsetLogDir( const char* dir );
249
250 void CALLBACK GSvsync(int field);
251 void CALLBACK GSgifTransfer(const u32 *pMem, u32 addr);
252 void CALLBACK GSgifTransfer1(u32 *pMem, u32 addr);
253 void CALLBACK GSgifTransfer2(u32 *pMem, u32 size);
254 void CALLBACK GSgifTransfer3(u32 *pMem, u32 size);
255 void CALLBACK GSgetLastTag(u64* ptag); // returns the last tag processed (64 bits)
256 void CALLBACK GSgifSoftReset(u32 mask);
257 void CALLBACK GSreadFIFO(u64 *mem);
258 void CALLBACK GSreadFIFO2(u64 *mem, int qwc);
259
260 // extended funcs
261
262 // GSkeyEvent gets called when there is a keyEvent from the PAD plugin
263 void CALLBACK GSkeyEvent(keyEvent *ev);
264 void CALLBACK GSchangeSaveState(int, const char* filename);
265 void CALLBACK GSmakeSnapshot(char *path);
266 void CALLBACK GSmakeSnapshot2(char *pathname, int* snapdone, int savejpg);
267 void CALLBACK GSirqCallback(void (*callback)());
268 void CALLBACK GSprintf(int timeout, char *fmt, ...);
269 void CALLBACK GSsetBaseMem(void*);
270 void CALLBACK GSsetGameCRC(int crc, int gameoptions);
271
272 // controls frame skipping in the GS, if this routine isn't present, frame skipping won't be done
273 void CALLBACK GSsetFrameSkip(int frameskip);
274
275 // if start is 1, starts recording spu2 data, else stops
276 // returns a non zero value if successful
277 // for now, pData is not used
278 int CALLBACK GSsetupRecording(int start, void* pData);
279
280 void CALLBACK GSreset();
281 void CALLBACK GSgetTitleInfo( char dest[128] );
282 void CALLBACK GSwriteCSR(u32 value);
283 s32 CALLBACK GSfreeze(int mode, freezeData *data);
284 void CALLBACK GSconfigure();
285 void CALLBACK GSabout();
286 s32 CALLBACK GStest();
287
288 #endif
289
290 /* PAD plugin API -=[ OBSOLETE ]=- */
291
292 // if this file is included with this define
293 // the next api will not be skipped by the compiler
294 #ifdef PADdefs
295
296 // basic funcs
297
298 s32 CALLBACK PADinit(u32 flags);
299 s32 CALLBACK PADopen(void *pDsp);
300 void CALLBACK PADclose();
301 void CALLBACK PADshutdown();
302 void CALLBACK PADsetSettingsDir( const char* dir );
303 void CALLBACK PADsetLogDir( const char* dir );
304
305 // PADkeyEvent is called every vsync (return NULL if no event)
306 keyEvent* CALLBACK PADkeyEvent();
307 u8 CALLBACK PADstartPoll(int pad);
308 u8 CALLBACK PADpoll(u8 value);
309 // returns: 1 if supported pad1
310 // 2 if supported pad2
311 // 3 if both are supported
312 u32 CALLBACK PADquery();
313
314 // call to give a hint to the PAD plugin to query for the keyboard state. A
315 // good plugin will query the OS for keyboard state ONLY in this function.
316 // This function is necessary when multithreading because otherwise
317 // the PAD plugin can get into deadlocks with the thread that really owns
318 // the window (and input). Note that PADupdate can be called from a different
319 // thread than the other functions, so mutex or other multithreading primitives
320 // have to be added to maintain data integrity.
321 void CALLBACK PADupdate(int pad);
322
323 // extended funcs
324
325 void CALLBACK PADgsDriverInfo(GSdriverInfo *info);
326 void CALLBACK PADconfigure();
327 void CALLBACK PADabout();
328 s32 CALLBACK PADtest();
329
330 #endif
331
332 /* SPU2 plugin API */
333
334 // if this file is included with this define
335 // the next api will not be skipped by the compiler
336 #ifdef SPU2defs
337
338 // basic funcs
339
340 s32 CALLBACK SPU2init();
341 s32 CALLBACK SPU2open(void *pDsp);
342 void CALLBACK SPU2close();
343 void CALLBACK SPU2shutdown();
344 void CALLBACK SPU2setSettingsDir( const char* dir );
345 void CALLBACK SPU2setLogDir( const char* dir );
346
347 void CALLBACK SPU2reset();
348 void CALLBACK SPU2write(u32 mem, u16 value);
349 u16 CALLBACK SPU2read(u32 mem);
350
351 #ifdef ENABLE_NEW_IOPDMA_SPU2
352 s32 CALLBACK SPU2dmaRead(s32 channel, u32* data, u32 bytesLeft, u32* bytesProcessed);
353 s32 CALLBACK SPU2dmaWrite(s32 channel, u32* data, u32 bytesLeft, u32* bytesProcessed);
354 void CALLBACK SPU2dmaInterrupt(s32 channel);
355
356 // dma irq callbacks not needed anymore, they are handled by the dmac
357 void CALLBACK SPU2irqCallback(void (*SPU2callback)());
358 #else
359 void CALLBACK SPU2readDMA4Mem(u16 *pMem, int size);
360 void CALLBACK SPU2writeDMA4Mem(u16 *pMem, int size);
361 void CALLBACK SPU2interruptDMA4();
362 void CALLBACK SPU2readDMA7Mem(u16* pMem, int size);
363 void CALLBACK SPU2writeDMA7Mem(u16 *pMem, int size);
364
365 // all addresses passed by dma will be pointers to the array starting at baseaddr
366 // This function is necessary to successfully save and reload the spu2 state
367 void CALLBACK SPU2setDMABaseAddr(uptr baseaddr);
368
369 void CALLBACK SPU2interruptDMA7();
370
371 u32 CALLBACK SPU2ReadMemAddr(int core);
372 void CALLBACK SPU2WriteMemAddr(int core,u32 value);
373
374 void CALLBACK SPU2irqCallback(void (*SPU2callback)(),void (*DMA4callback)(),void (*DMA7callback)());
375 #endif
376
377 // extended funcs
378 // if start is 1, starts recording spu2 data, else stops
379 // returns a non zero value if successful
380 // for now, pData is not used
381 int CALLBACK SPU2setupRecording(int start, void* pData);
382
383 void CALLBACK SPU2setClockPtr(u32* ptr);
384 void CALLBACK SPU2setTimeStretcher(short int enable);
385
386 void CALLBACK SPU2async(u32 cycles);
387 s32 CALLBACK SPU2freeze(int mode, freezeData *data);
388 void CALLBACK SPU2configure();
389 void CALLBACK SPU2about();
390 s32 CALLBACK SPU2test();
391
392 #endif
393
394 /* CDVD plugin API */
395
396 // if this file is included with this define
397 // the next api will not be skipped by the compiler
398 #ifdef CDVDdefs
399
400 // basic funcs
401
402 s32 CALLBACK CDVDinit();
403 s32 CALLBACK CDVDopen(const char* pTitleFilename);
404 void CALLBACK CDVDclose();
405 void CALLBACK CDVDshutdown();
406 void CALLBACK CDVDsetSettingsDir( const char* dir );
407 void CALLBACK CDVDsetLogDir( const char* dir );
408
409 s32 CALLBACK CDVDreadTrack(u32 lsn, int mode);
410
411 // return can be NULL (for async modes)
412 u8* CALLBACK CDVDgetBuffer();
413
414 s32 CALLBACK CDVDreadSubQ(u32 lsn, cdvdSubQ* subq);//read subq from disc (only cds have subq data)
415 s32 CALLBACK CDVDgetTN(cdvdTN *Buffer); //disk information
416 s32 CALLBACK CDVDgetTD(u8 Track, cdvdTD *Buffer); //track info: min,sec,frame,type
417 s32 CALLBACK CDVDgetTOC(void* toc); //gets ps2 style toc from disc
418 s32 CALLBACK CDVDgetDiskType(); //CDVD_TYPE_xxxx
419 s32 CALLBACK CDVDgetTrayStatus(); //CDVD_TRAY_xxxx
420 s32 CALLBACK CDVDctrlTrayOpen(); //open disc tray
421 s32 CALLBACK CDVDctrlTrayClose(); //close disc tray
422
423 // extended funcs
424
425 void CALLBACK CDVDconfigure();
426 void CALLBACK CDVDabout();
427 s32 CALLBACK CDVDtest();
428 void CALLBACK CDVDnewDiskCB(void (*callback)());
429
430 // new funcs
431
432 // read a track directly
433 s32 CALLBACK CDVDreadSector(u8* buffer, s32 lsn, int mode);
434
435 // improved getBuffer
436 s32 CALLBACK CDVDgetBuffer2(u8* buffer);
437
438 // tool function
439 s32 CALLBACK CDVDgetDualInfo(s32* dualType, u32* _layer1start);
440
441 #endif
442
443 /* DEV9 plugin API */
444
445 // if this file is included with this define
446 // the next api will not be skipped by the compiler
447 #ifdef DEV9defs
448
449 // basic funcs
450
451 // NOTE: The read/write functions CANNOT use XMM/MMX regs
452 // If you want to use them, need to save and restore current ones
453 s32 CALLBACK DEV9init();
454 s32 CALLBACK DEV9open(void *pDsp);
455 void CALLBACK DEV9close();
456 void CALLBACK DEV9shutdown();
457 void CALLBACK DEV9setSettingsDir( const char* dir );
458 void CALLBACK DEV9setLogDir( const char* dir );
459
460 u8 CALLBACK DEV9read8(u32 addr);
461 u16 CALLBACK DEV9read16(u32 addr);
462 u32 CALLBACK DEV9read32(u32 addr);
463 void CALLBACK DEV9write8(u32 addr, u8 value);
464 void CALLBACK DEV9write16(u32 addr, u16 value);
465 void CALLBACK DEV9write32(u32 addr, u32 value);
466 #ifdef ENABLE_NEW_IOPDMA_DEV9
467 s32 CALLBACK DEV9dmaRead(s32 channel, u32* data, u32 bytesLeft, u32* bytesProcessed);
468 s32 CALLBACK DEV9dmaWrite(s32 channel, u32* data, u32 bytesLeft, u32* bytesProcessed);
469 void CALLBACK DEV9dmaInterrupt(s32 channel);
470 #else
471 void CALLBACK DEV9readDMA8Mem(u32 *pMem, int size);
472 void CALLBACK DEV9writeDMA8Mem(u32 *pMem, int size);
473 #endif
474 // cycles = IOP cycles before calling callback,
475 // if callback returns 1 the irq is triggered, else not
476 void CALLBACK DEV9irqCallback(DEV9callback callback);
477 DEV9handler CALLBACK DEV9irqHandler(void);
478
479 // extended funcs
480
481 s32 CALLBACK DEV9freeze(int mode, freezeData *data);
482 void CALLBACK DEV9configure();
483 void CALLBACK DEV9about();
484 s32 CALLBACK DEV9test();
485
486 #endif
487
488 /* USB plugin API */
489
490 // if this file is included with this define
491 // the next api will not be skipped by the compiler
492 #ifdef USBdefs
493
494 // basic funcs
495
496 s32 CALLBACK USBinit();
497 s32 CALLBACK USBopen(void *pDsp);
498 void CALLBACK USBclose();
499 void CALLBACK USBshutdown();
500 void CALLBACK USBsetSettingsDir( const char* dir );
501 void CALLBACK USBsetLogDir( const char* dir );
502
503 u8 CALLBACK USBread8(u32 addr);
504 u16 CALLBACK USBread16(u32 addr);
505 u32 CALLBACK USBread32(u32 addr);
506 void CALLBACK USBwrite8(u32 addr, u8 value);
507 void CALLBACK USBwrite16(u32 addr, u16 value);
508 void CALLBACK USBwrite32(u32 addr, u32 value);
509 void CALLBACK USBasync(u32 cycles);
510
511 // cycles = IOP cycles before calling callback,
512 // if callback returns 1 the irq is triggered, else not
513 void CALLBACK USBirqCallback(USBcallback callback);
514 USBhandler CALLBACK USBirqHandler(void);
515 void CALLBACK USBsetRAM(void *mem);
516
517 // extended funcs
518
519 s32 CALLBACK USBfreeze(int mode, freezeData *data);
520 void CALLBACK USBconfigure();
521 void CALLBACK USBabout();
522 s32 CALLBACK USBtest();
523
524 #endif
525
526 /* FW plugin API */
527
528 // if this file is included with this define
529 // the next api will not be skipped by the compiler
530 #ifdef FWdefs
531 // basic funcs
532
533 // NOTE: The read/write functions CANNOT use XMM/MMX regs
534 // If you want to use them, need to save and restore current ones
535 s32 CALLBACK FWinit();
536 s32 CALLBACK FWopen(void *pDsp);
537 void CALLBACK FWclose();
538 void CALLBACK FWshutdown();
539 void CALLBACK FWsetSettingsDir( const char* dir );
540 void CALLBACK FWsetLogDir( const char* dir );
541
542 u32 CALLBACK FWread32(u32 addr);
543 void CALLBACK FWwrite32(u32 addr, u32 value);
544 void CALLBACK FWirqCallback(void (*callback)());
545
546 // extended funcs
547
548 s32 CALLBACK FWfreeze(int mode, freezeData *data);
549 void CALLBACK FWconfigure();
550 void CALLBACK FWabout();
551 s32 CALLBACK FWtest();
552 #endif
553
554 // might be useful for emulators
555 #ifdef PLUGINtypedefs
556
557 typedef u32 (CALLBACK* _PS2EgetLibType)(void);
558 typedef u32 (CALLBACK* _PS2EgetLibVersion2)(u32 type);
559 typedef char*(CALLBACK* _PS2EgetLibName)(void);
560
561 typedef void (CALLBACK* _PS2EsetEmuVersion)(const char* emuId, u32 version); // HACK to let some plugins know it's 0.9.7 PCSX2 --air
562
563 // GS
564 // NOTE: GSreadFIFOX/GSwriteCSR functions CANNOT use XMM/MMX regs
565 // If you want to use them, need to save and restore current ones
566 typedef s32 (CALLBACK* _GSopen)(void *pDsp, char *Title, int multithread);
567 typedef s32 (CALLBACK* _GSopen2)( void *pDsp, u32 flags );
568 typedef void (CALLBACK* _GSvsync)(int field);
569 typedef void (CALLBACK* _GSgifTransfer)(const u32 *pMem, u32 size);
570 typedef void (CALLBACK* _GSgifTransfer1)(u32 *pMem, u32 addr);
571 typedef void (CALLBACK* _GSgifTransfer2)(u32 *pMem, u32 size);
572 typedef void (CALLBACK* _GSgifTransfer3)(u32 *pMem, u32 size);
573 typedef void (CALLBACK* _GSgifSoftReset)(u32 mask);
574 typedef void (CALLBACK* _GSreadFIFO)(u64 *pMem);
575 typedef void (CALLBACK* _GSreadFIFO2)(u64 *pMem, int qwc);
576
577 typedef void (CALLBACK* _GSchangeSaveState)(int, const char* filename);
578 typedef void (CALLBACK* _GSgetTitleInfo)(char dest[128]);
579 typedef void (CALLBACK* _GSirqCallback)(void (*callback)());
580 typedef void (CALLBACK* _GSprintf)(int timeout, char *fmt, ...);
581 typedef void (CALLBACK* _GSsetBaseMem)(void*);
582 typedef void (CALLBACK* _GSsetGameCRC)(int, int);
583 typedef void (CALLBACK* _GSsetFrameSkip)(int frameskip);
584 typedef void (CALLBACK* _GSsetFrameLimit)(int limit);
585 typedef void (CALLBACK* _GSsetVsync)(int enabled);
586 typedef void (CALLBACK* _GSsetExclusive)(int isExclusive);
587 typedef int (CALLBACK* _GSsetupRecording)(int, void*);
588 typedef void (CALLBACK* _GSreset)();
589 typedef void (CALLBACK* _GSwriteCSR)(u32 value);
590 typedef void (CALLBACK* _GSmakeSnapshot)(const char *path);
591 typedef void (CALLBACK* _GSmakeSnapshot2)(const char *path, int*, int);
592
593 // PAD
594 typedef s32 (CALLBACK* _PADinit)(u32 flags);
595 typedef s32 (CALLBACK* _PADopen)(void *pDsp);
596 typedef u8 (CALLBACK* _PADstartPoll)(int pad);
597 typedef u8 (CALLBACK* _PADpoll)(u8 value);
598 typedef u32 (CALLBACK* _PADquery)(int pad);
599 typedef void (CALLBACK* _PADupdate)(int pad);
600 typedef keyEvent* (CALLBACK* _PADkeyEvent)();
601 typedef void (CALLBACK* _PADgsDriverInfo)(GSdriverInfo *info);
602 typedef s32 (CALLBACK* _PADsetSlot)(u8 port, u8 slot);
603 typedef s32 (CALLBACK* _PADqueryMtap)(u8 port);
604
605 // SPU2
606 typedef s32 (CALLBACK* _SPU2open)(void *pDsp);
607 typedef void (CALLBACK* _SPU2reset)();
608 typedef void (CALLBACK* _SPU2write)(u32 mem, u16 value);
609 typedef u16 (CALLBACK* _SPU2read)(u32 mem);
610
611 #ifdef ENABLE_NEW_IOPDMA_SPU2
612 typedef s32 (CALLBACK* _SPU2dmaRead)(s32 channel, u32* data, u32 bytesLeft, u32* bytesProcessed);
613 typedef s32 (CALLBACK* _SPU2dmaWrite)(s32 channel, u32* data, u32 bytesLeft, u32* bytesProcessed);
614 typedef void (CALLBACK* _SPU2dmaInterrupt)(s32 channel);
615
616 // dma irq callbacks not needed anymore, they are handled by the dmac
617 typedef void (CALLBACK* _SPU2irqCallback)(void (*SPU2callback)());
618 #else
619 typedef void (CALLBACK* _SPU2readDMA4Mem)(u16 *pMem, int size);
620 typedef void (CALLBACK* _SPU2writeDMA4Mem)(u16 *pMem, int size);
621 typedef void (CALLBACK* _SPU2interruptDMA4)();
622 typedef void (CALLBACK* _SPU2readDMA7Mem)(u16 *pMem, int size);
623 typedef void (CALLBACK* _SPU2writeDMA7Mem)(u16 *pMem, int size);
624 typedef void (CALLBACK* _SPU2setDMABaseAddr)(uptr baseaddr);
625 typedef void (CALLBACK* _SPU2interruptDMA7)();
626 typedef void (CALLBACK* _SPU2irqCallback)(void (*SPU2callback)(),void (*DMA4callback)(),void (*DMA7callback)());
627 typedef u32 (CALLBACK* _SPU2ReadMemAddr)(int core);
628 typedef void (CALLBACK* _SPU2WriteMemAddr)(int core,u32 value);
629 #endif
630
631 typedef int (CALLBACK* _SPU2setupRecording)(int, void*);
632
633 typedef void (CALLBACK* _SPU2setClockPtr)(u32*ptr);
634 typedef void (CALLBACK* _SPU2setTimeStretcher)(short int enable);
635
636 typedef void (CALLBACK* _SPU2async)(u32 cycles);
637
638
639 // CDVD
640 // NOTE: The read/write functions CANNOT use XMM/MMX regs
641 // If you want to use them, need to save and restore current ones
642 typedef s32 (CALLBACK* _CDVDopen)(const char* pTitleFilename);
643
644 // Initiates an asynchronous track read operation.
645 // Returns -1 on error (invalid track)
646 // Returns 0 on success.
647 typedef s32 (CALLBACK* _CDVDreadTrack)(u32 lsn, int mode);
648
649 // *OBSOLETE* returns a pointer to the buffer, or NULL if data hasn't finished
650 // loading yet.
651 typedef u8* (CALLBACK* _CDVDgetBuffer)();
652
653 // Copies loaded data to the target buffer.
654 // Returns -2 if the asynchronous read is still pending.
655 // Returns -1 if the asyncronous read failed.
656 // Returns 0 on success.
657 typedef s32 (CALLBACK* _CDVDgetBuffer2)(u8* buffer);
658
659 typedef s32 (CALLBACK* _CDVDreadSubQ)(u32 lsn, cdvdSubQ* subq);
660 typedef s32 (CALLBACK* _CDVDgetTN)(cdvdTN *Buffer);
661 typedef s32 (CALLBACK* _CDVDgetTD)(u8 Track, cdvdTD *Buffer);
662 typedef s32 (CALLBACK* _CDVDgetTOC)(void* toc);
663 typedef s32 (CALLBACK* _CDVDgetDiskType)();
664 typedef s32 (CALLBACK* _CDVDgetTrayStatus)();
665 typedef s32 (CALLBACK* _CDVDctrlTrayOpen)();
666 typedef s32 (CALLBACK* _CDVDctrlTrayClose)();
667 typedef s32 (CALLBACK* _CDVDreadSector)(u8* buffer, u32 lsn, int mode);
668 typedef s32 (CALLBACK* _CDVDgetDualInfo)(s32* dualType, u32* _layer1start);
669
670 typedef void (CALLBACK* _CDVDnewDiskCB)(void (*callback)());
671
672
673 // DEV9
674 // NOTE: The read/write functions CANNOT use XMM/MMX regs
675 // If you want to use them, need to save and restore current ones
676 typedef s32 (CALLBACK* _DEV9open)(void *pDsp);
677 typedef u8 (CALLBACK* _DEV9read8)(u32 mem);
678 typedef u16 (CALLBACK* _DEV9read16)(u32 mem);
679 typedef u32 (CALLBACK* _DEV9read32)(u32 mem);
680 typedef void (CALLBACK* _DEV9write8)(u32 mem, u8 value);
681 typedef void (CALLBACK* _DEV9write16)(u32 mem, u16 value);
682 typedef void (CALLBACK* _DEV9write32)(u32 mem, u32 value);
683 #ifdef ENABLE_NEW_IOPDMA_DEV9
684 typedef s32 (CALLBACK* _DEV9dmaRead)(s32 channel, u32* data, u32 bytesLeft, u32* bytesProcessed);
685 typedef s32 (CALLBACK* _DEV9dmaWrite)(s32 channel, u32* data, u32 bytesLeft, u32* bytesProcessed);
686 typedef void (CALLBACK* _DEV9dmaInterrupt)(s32 channel);
687 #else
688 typedef void (CALLBACK* _DEV9readDMA8Mem)(u32 *pMem, int size);
689 typedef void (CALLBACK* _DEV9writeDMA8Mem)(u32 *pMem, int size);
690 #endif
691 typedef void (CALLBACK* _DEV9irqCallback)(DEV9callback callback);
692 typedef DEV9handler (CALLBACK* _DEV9irqHandler)(void);
693
694 // USB
695 // NOTE: The read/write functions CANNOT use XMM/MMX regs
696 // If you want to use them, need to save and restore current ones
697 typedef s32 (CALLBACK* _USBopen)(void *pDsp);
698 typedef u8 (CALLBACK* _USBread8)(u32 mem);
699 typedef u16 (CALLBACK* _USBread16)(u32 mem);
700 typedef u32 (CALLBACK* _USBread32)(u32 mem);
701 typedef void (CALLBACK* _USBwrite8)(u32 mem, u8 value);
702 typedef void (CALLBACK* _USBwrite16)(u32 mem, u16 value);
703 typedef void (CALLBACK* _USBwrite32)(u32 mem, u32 value);
704 typedef void (CALLBACK* _USBasync)(u32 cycles);
705
706 typedef void (CALLBACK* _USBirqCallback)(USBcallback callback);
707 typedef USBhandler (CALLBACK* _USBirqHandler)(void);
708 typedef void (CALLBACK* _USBsetRAM)(void *mem);
709
710 //FW
711 typedef s32 (CALLBACK* _FWopen)(void *pDsp);
712 typedef u32 (CALLBACK* _FWread32)(u32 mem);
713 typedef void (CALLBACK* _FWwrite32)(u32 mem, u32 value);
714 typedef void (CALLBACK* _FWirqCallback)(void (*callback)());
715 #endif
716
717 #ifdef PLUGINfuncs
718
719 // GS
720 extern _GSopen GSopen;
721 extern _GSopen2 GSopen2;
722 extern _GSvsync GSvsync;
723 extern _GSgifTransfer GSgifTransfer;
724 extern _GSgifTransfer1 GSgifTransfer1;
725 extern _GSgifTransfer2 GSgifTransfer2;
726 extern _GSgifTransfer3 GSgifTransfer3;
727 extern _GSgifSoftReset GSgifSoftReset;
728 extern _GSreadFIFO GSreadFIFO;
729 extern _GSreadFIFO2 GSreadFIFO2;
730
731 extern _GSchangeSaveState GSchangeSaveState;
732 extern _GSgetTitleInfo GSgetTitleInfo;
733 extern _GSmakeSnapshot GSmakeSnapshot;
734 extern _GSmakeSnapshot2 GSmakeSnapshot2;
735 extern _GSirqCallback GSirqCallback;
736 extern _GSprintf GSprintf;
737 extern _GSsetBaseMem GSsetBaseMem;
738 extern _GSsetGameCRC GSsetGameCRC;
739 extern _GSsetFrameSkip GSsetFrameSkip;
740 extern _GSsetFrameLimit GSsetFrameLimit;
741 extern _GSsetVsync GSsetVsync;
742 extern _GSsetupRecording GSsetupRecording;
743 extern _GSreset GSreset;
744 extern _GSwriteCSR GSwriteCSR;
745
746 // PAD
747 extern _PADopen PADopen;
748 extern _PADstartPoll PADstartPoll;
749 extern _PADpoll PADpoll;
750 extern _PADquery PADquery;
751 extern _PADupdate PADupdate;
752 extern _PADkeyEvent PADkeyEvent;
753 extern _PADgsDriverInfo PADgsDriverInfo;
754 extern _PADsetSlot PADsetSlot;
755 extern _PADqueryMtap PADqueryMtap;
756
757 // SPU2
758 extern _SPU2open SPU2open;
759 extern _SPU2reset SPU2reset;
760 extern _SPU2write SPU2write;
761 extern _SPU2read SPU2read;
762
763 #ifdef ENABLE_NEW_IOPDMA_SPU2
764 extern _SPU2dmaRead SPU2dmaRead;
765 extern _SPU2dmaWrite SPU2dmaWrite;
766 extern _SPU2dmaInterrupt SPU2dmaInterrupt;
767 #else
768 extern _SPU2readDMA4Mem SPU2readDMA4Mem;
769 extern _SPU2writeDMA4Mem SPU2writeDMA4Mem;
770 extern _SPU2interruptDMA4 SPU2interruptDMA4;
771 extern _SPU2readDMA7Mem SPU2readDMA7Mem;
772 extern _SPU2writeDMA7Mem SPU2writeDMA7Mem;
773 extern _SPU2setDMABaseAddr SPU2setDMABaseAddr;
774 extern _SPU2interruptDMA7 SPU2interruptDMA7;
775 extern _SPU2ReadMemAddr SPU2ReadMemAddr;
776 extern _SPU2setupRecording SPU2setupRecording;
777 extern _SPU2WriteMemAddr SPU2WriteMemAddr;
778 extern _SPU2irqCallback SPU2irqCallback;
779 #endif
780
781 extern _SPU2irqCallback SPU2irqCallback;
782
783 extern _SPU2setupRecording SPU2setupRecording;
784
785 extern _SPU2setClockPtr SPU2setClockPtr;
786 extern _SPU2setTimeStretcher SPU2setTimeStretcher;
787
788 extern _SPU2async SPU2async;
789
790 // DEV9
791 extern _DEV9open DEV9open;
792 extern _DEV9read8 DEV9read8;
793 extern _DEV9read16 DEV9read16;
794 extern _DEV9read32 DEV9read32;
795 extern _DEV9write8 DEV9write8;
796 extern _DEV9write16 DEV9write16;
797 extern _DEV9write32 DEV9write32;
798 #ifdef ENABLE_NEW_IOPDMA_DEV9
799 extern _DEV9dmaRead DEV9dmaRead;
800 extern _DEV9dmaWrite DEV9dmaWrite;
801 extern _DEV9dmaInterrupt DEV9dmaInterrupt;
802 #else
803 extern _DEV9readDMA8Mem DEV9readDMA8Mem;
804 extern _DEV9writeDMA8Mem DEV9writeDMA8Mem;
805 #endif
806 extern _DEV9irqCallback DEV9irqCallback;
807 extern _DEV9irqHandler DEV9irqHandler;
808
809 // USB
810 extern _USBopen USBopen;
811 extern _USBread8 USBread8;
812 extern _USBread16 USBread16;
813 extern _USBread32 USBread32;
814 extern _USBwrite8 USBwrite8;
815 extern _USBwrite16 USBwrite16;
816 extern _USBwrite32 USBwrite32;
817 extern _USBasync USBasync;
818
819 extern _USBirqCallback USBirqCallback;
820 extern _USBirqHandler USBirqHandler;
821 extern _USBsetRAM USBsetRAM;
822
823 // FW
824 extern _FWopen FWopen;
825 extern _FWread32 FWread32;
826 extern _FWwrite32 FWwrite32;
827 extern _FWirqCallback FWirqCallback;
828
829 #endif
830
831 #ifdef __cplusplus
832 } // End extern "C"
833 #endif
834
835 #endif /* __PS2EDEFS_H__ */

  ViewVC Help
Powered by ViewVC 1.1.22