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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 280 - (hide annotations) (download)
Thu Dec 23 12:02:12 2010 UTC (9 years, 7 months ago) by william
File MIME type: text/plain
File size: 27487 byte(s)
re-commit (had local access denied errors when committing)
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 __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 william 62 void CALLBACK GSgifTransfer(const u32 *pMem, u32 addr);
252 william 31 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 william 280 //deprecated: GSgetTitleInfo was used in PCSX2 but no plugin supported it prior to r4070:
282     //void CALLBACK GSgetTitleInfo( char dest[128] );
283     void CALLBACK GSgetTitleInfo2( char* dest, size_t length );
284 william 31 void CALLBACK GSwriteCSR(u32 value);
285     s32 CALLBACK GSfreeze(int mode, freezeData *data);
286     void CALLBACK GSconfigure();
287     void CALLBACK GSabout();
288     s32 CALLBACK GStest();
289    
290     #endif
291    
292     /* PAD plugin API -=[ OBSOLETE ]=- */
293    
294     // if this file is included with this define
295     // the next api will not be skipped by the compiler
296     #ifdef PADdefs
297    
298     // basic funcs
299    
300     s32 CALLBACK PADinit(u32 flags);
301     s32 CALLBACK PADopen(void *pDsp);
302     void CALLBACK PADclose();
303     void CALLBACK PADshutdown();
304     void CALLBACK PADsetSettingsDir( const char* dir );
305     void CALLBACK PADsetLogDir( const char* dir );
306    
307     // PADkeyEvent is called every vsync (return NULL if no event)
308     keyEvent* CALLBACK PADkeyEvent();
309     u8 CALLBACK PADstartPoll(int pad);
310     u8 CALLBACK PADpoll(u8 value);
311     // returns: 1 if supported pad1
312     // 2 if supported pad2
313     // 3 if both are supported
314     u32 CALLBACK PADquery();
315    
316     // call to give a hint to the PAD plugin to query for the keyboard state. A
317     // good plugin will query the OS for keyboard state ONLY in this function.
318     // This function is necessary when multithreading because otherwise
319     // the PAD plugin can get into deadlocks with the thread that really owns
320     // the window (and input). Note that PADupdate can be called from a different
321     // thread than the other functions, so mutex or other multithreading primitives
322     // have to be added to maintain data integrity.
323     void CALLBACK PADupdate(int pad);
324    
325     // extended funcs
326    
327     void CALLBACK PADgsDriverInfo(GSdriverInfo *info);
328     void CALLBACK PADconfigure();
329     void CALLBACK PADabout();
330     s32 CALLBACK PADtest();
331    
332     #endif
333    
334     /* SPU2 plugin API */
335    
336     // if this file is included with this define
337     // the next api will not be skipped by the compiler
338     #ifdef SPU2defs
339    
340     // basic funcs
341    
342     s32 CALLBACK SPU2init();
343     s32 CALLBACK SPU2open(void *pDsp);
344     void CALLBACK SPU2close();
345     void CALLBACK SPU2shutdown();
346     void CALLBACK SPU2setSettingsDir( const char* dir );
347     void CALLBACK SPU2setLogDir( const char* dir );
348    
349 william 62 void CALLBACK SPU2reset();
350 william 31 void CALLBACK SPU2write(u32 mem, u16 value);
351     u16 CALLBACK SPU2read(u32 mem);
352    
353     #ifdef ENABLE_NEW_IOPDMA_SPU2
354     s32 CALLBACK SPU2dmaRead(s32 channel, u32* data, u32 bytesLeft, u32* bytesProcessed);
355     s32 CALLBACK SPU2dmaWrite(s32 channel, u32* data, u32 bytesLeft, u32* bytesProcessed);
356     void CALLBACK SPU2dmaInterrupt(s32 channel);
357    
358     // dma irq callbacks not needed anymore, they are handled by the dmac
359     void CALLBACK SPU2irqCallback(void (*SPU2callback)());
360     #else
361     void CALLBACK SPU2readDMA4Mem(u16 *pMem, int size);
362     void CALLBACK SPU2writeDMA4Mem(u16 *pMem, int size);
363     void CALLBACK SPU2interruptDMA4();
364     void CALLBACK SPU2readDMA7Mem(u16* pMem, int size);
365     void CALLBACK SPU2writeDMA7Mem(u16 *pMem, int size);
366    
367     // all addresses passed by dma will be pointers to the array starting at baseaddr
368     // This function is necessary to successfully save and reload the spu2 state
369     void CALLBACK SPU2setDMABaseAddr(uptr baseaddr);
370    
371     void CALLBACK SPU2interruptDMA7();
372    
373     u32 CALLBACK SPU2ReadMemAddr(int core);
374     void CALLBACK SPU2WriteMemAddr(int core,u32 value);
375    
376     void CALLBACK SPU2irqCallback(void (*SPU2callback)(),void (*DMA4callback)(),void (*DMA7callback)());
377     #endif
378    
379     // extended funcs
380     // if start is 1, starts recording spu2 data, else stops
381     // returns a non zero value if successful
382     // for now, pData is not used
383     int CALLBACK SPU2setupRecording(int start, void* pData);
384    
385     void CALLBACK SPU2setClockPtr(u32* ptr);
386     void CALLBACK SPU2setTimeStretcher(short int enable);
387    
388     void CALLBACK SPU2async(u32 cycles);
389     s32 CALLBACK SPU2freeze(int mode, freezeData *data);
390     void CALLBACK SPU2configure();
391     void CALLBACK SPU2about();
392     s32 CALLBACK SPU2test();
393    
394     #endif
395    
396     /* CDVD plugin API */
397    
398     // if this file is included with this define
399     // the next api will not be skipped by the compiler
400     #ifdef CDVDdefs
401    
402     // basic funcs
403    
404     s32 CALLBACK CDVDinit();
405     s32 CALLBACK CDVDopen(const char* pTitleFilename);
406     void CALLBACK CDVDclose();
407     void CALLBACK CDVDshutdown();
408     void CALLBACK CDVDsetSettingsDir( const char* dir );
409     void CALLBACK CDVDsetLogDir( const char* dir );
410    
411     s32 CALLBACK CDVDreadTrack(u32 lsn, int mode);
412    
413     // return can be NULL (for async modes)
414     u8* CALLBACK CDVDgetBuffer();
415    
416     s32 CALLBACK CDVDreadSubQ(u32 lsn, cdvdSubQ* subq);//read subq from disc (only cds have subq data)
417     s32 CALLBACK CDVDgetTN(cdvdTN *Buffer); //disk information
418     s32 CALLBACK CDVDgetTD(u8 Track, cdvdTD *Buffer); //track info: min,sec,frame,type
419     s32 CALLBACK CDVDgetTOC(void* toc); //gets ps2 style toc from disc
420     s32 CALLBACK CDVDgetDiskType(); //CDVD_TYPE_xxxx
421     s32 CALLBACK CDVDgetTrayStatus(); //CDVD_TRAY_xxxx
422     s32 CALLBACK CDVDctrlTrayOpen(); //open disc tray
423     s32 CALLBACK CDVDctrlTrayClose(); //close disc tray
424    
425     // extended funcs
426    
427     void CALLBACK CDVDconfigure();
428     void CALLBACK CDVDabout();
429     s32 CALLBACK CDVDtest();
430     void CALLBACK CDVDnewDiskCB(void (*callback)());
431    
432     // new funcs
433    
434     // read a track directly
435     s32 CALLBACK CDVDreadSector(u8* buffer, s32 lsn, int mode);
436    
437     // improved getBuffer
438     s32 CALLBACK CDVDgetBuffer2(u8* buffer);
439    
440     // tool function
441     s32 CALLBACK CDVDgetDualInfo(s32* dualType, u32* _layer1start);
442    
443     #endif
444    
445     /* DEV9 plugin API */
446    
447     // if this file is included with this define
448     // the next api will not be skipped by the compiler
449     #ifdef DEV9defs
450    
451     // basic funcs
452    
453     // NOTE: The read/write functions CANNOT use XMM/MMX regs
454     // If you want to use them, need to save and restore current ones
455     s32 CALLBACK DEV9init();
456     s32 CALLBACK DEV9open(void *pDsp);
457     void CALLBACK DEV9close();
458     void CALLBACK DEV9shutdown();
459     void CALLBACK DEV9setSettingsDir( const char* dir );
460     void CALLBACK DEV9setLogDir( const char* dir );
461    
462     u8 CALLBACK DEV9read8(u32 addr);
463     u16 CALLBACK DEV9read16(u32 addr);
464     u32 CALLBACK DEV9read32(u32 addr);
465     void CALLBACK DEV9write8(u32 addr, u8 value);
466     void CALLBACK DEV9write16(u32 addr, u16 value);
467     void CALLBACK DEV9write32(u32 addr, u32 value);
468     #ifdef ENABLE_NEW_IOPDMA_DEV9
469     s32 CALLBACK DEV9dmaRead(s32 channel, u32* data, u32 bytesLeft, u32* bytesProcessed);
470     s32 CALLBACK DEV9dmaWrite(s32 channel, u32* data, u32 bytesLeft, u32* bytesProcessed);
471     void CALLBACK DEV9dmaInterrupt(s32 channel);
472     #else
473     void CALLBACK DEV9readDMA8Mem(u32 *pMem, int size);
474     void CALLBACK DEV9writeDMA8Mem(u32 *pMem, int size);
475     #endif
476     // cycles = IOP cycles before calling callback,
477     // if callback returns 1 the irq is triggered, else not
478     void CALLBACK DEV9irqCallback(DEV9callback callback);
479     DEV9handler CALLBACK DEV9irqHandler(void);
480    
481     // extended funcs
482    
483     s32 CALLBACK DEV9freeze(int mode, freezeData *data);
484     void CALLBACK DEV9configure();
485     void CALLBACK DEV9about();
486     s32 CALLBACK DEV9test();
487    
488     #endif
489    
490     /* USB plugin API */
491    
492     // if this file is included with this define
493     // the next api will not be skipped by the compiler
494     #ifdef USBdefs
495    
496     // basic funcs
497    
498     s32 CALLBACK USBinit();
499     s32 CALLBACK USBopen(void *pDsp);
500     void CALLBACK USBclose();
501     void CALLBACK USBshutdown();
502     void CALLBACK USBsetSettingsDir( const char* dir );
503     void CALLBACK USBsetLogDir( const char* dir );
504    
505     u8 CALLBACK USBread8(u32 addr);
506     u16 CALLBACK USBread16(u32 addr);
507     u32 CALLBACK USBread32(u32 addr);
508     void CALLBACK USBwrite8(u32 addr, u8 value);
509     void CALLBACK USBwrite16(u32 addr, u16 value);
510     void CALLBACK USBwrite32(u32 addr, u32 value);
511     void CALLBACK USBasync(u32 cycles);
512    
513     // cycles = IOP cycles before calling callback,
514     // if callback returns 1 the irq is triggered, else not
515     void CALLBACK USBirqCallback(USBcallback callback);
516     USBhandler CALLBACK USBirqHandler(void);
517     void CALLBACK USBsetRAM(void *mem);
518    
519     // extended funcs
520    
521     s32 CALLBACK USBfreeze(int mode, freezeData *data);
522     void CALLBACK USBconfigure();
523     void CALLBACK USBabout();
524     s32 CALLBACK USBtest();
525    
526     #endif
527    
528     /* FW plugin API */
529    
530     // if this file is included with this define
531     // the next api will not be skipped by the compiler
532     #ifdef FWdefs
533     // basic funcs
534    
535     // NOTE: The read/write functions CANNOT use XMM/MMX regs
536     // If you want to use them, need to save and restore current ones
537     s32 CALLBACK FWinit();
538     s32 CALLBACK FWopen(void *pDsp);
539     void CALLBACK FWclose();
540     void CALLBACK FWshutdown();
541     void CALLBACK FWsetSettingsDir( const char* dir );
542     void CALLBACK FWsetLogDir( const char* dir );
543    
544     u32 CALLBACK FWread32(u32 addr);
545     void CALLBACK FWwrite32(u32 addr, u32 value);
546     void CALLBACK FWirqCallback(void (*callback)());
547    
548     // extended funcs
549    
550     s32 CALLBACK FWfreeze(int mode, freezeData *data);
551     void CALLBACK FWconfigure();
552     void CALLBACK FWabout();
553     s32 CALLBACK FWtest();
554     #endif
555    
556     // might be useful for emulators
557     #ifdef PLUGINtypedefs
558    
559     typedef u32 (CALLBACK* _PS2EgetLibType)(void);
560     typedef u32 (CALLBACK* _PS2EgetLibVersion2)(u32 type);
561     typedef char*(CALLBACK* _PS2EgetLibName)(void);
562    
563     typedef void (CALLBACK* _PS2EsetEmuVersion)(const char* emuId, u32 version); // HACK to let some plugins know it's 0.9.7 PCSX2 --air
564    
565     // GS
566     // NOTE: GSreadFIFOX/GSwriteCSR functions CANNOT use XMM/MMX regs
567     // If you want to use them, need to save and restore current ones
568     typedef s32 (CALLBACK* _GSopen)(void *pDsp, char *Title, int multithread);
569     typedef s32 (CALLBACK* _GSopen2)( void *pDsp, u32 flags );
570     typedef void (CALLBACK* _GSvsync)(int field);
571 william 62 typedef void (CALLBACK* _GSgifTransfer)(const u32 *pMem, u32 size);
572 william 31 typedef void (CALLBACK* _GSgifTransfer1)(u32 *pMem, u32 addr);
573     typedef void (CALLBACK* _GSgifTransfer2)(u32 *pMem, u32 size);
574     typedef void (CALLBACK* _GSgifTransfer3)(u32 *pMem, u32 size);
575     typedef void (CALLBACK* _GSgifSoftReset)(u32 mask);
576     typedef void (CALLBACK* _GSreadFIFO)(u64 *pMem);
577     typedef void (CALLBACK* _GSreadFIFO2)(u64 *pMem, int qwc);
578    
579     typedef void (CALLBACK* _GSchangeSaveState)(int, const char* filename);
580 william 280 typedef void (CALLBACK* _GSgetTitleInfo2)(char* dest, size_t length);
581 william 31 typedef void (CALLBACK* _GSirqCallback)(void (*callback)());
582     typedef void (CALLBACK* _GSprintf)(int timeout, char *fmt, ...);
583     typedef void (CALLBACK* _GSsetBaseMem)(void*);
584     typedef void (CALLBACK* _GSsetGameCRC)(int, int);
585     typedef void (CALLBACK* _GSsetFrameSkip)(int frameskip);
586     typedef void (CALLBACK* _GSsetFrameLimit)(int limit);
587     typedef void (CALLBACK* _GSsetVsync)(int enabled);
588     typedef void (CALLBACK* _GSsetExclusive)(int isExclusive);
589     typedef int (CALLBACK* _GSsetupRecording)(int, void*);
590     typedef void (CALLBACK* _GSreset)();
591     typedef void (CALLBACK* _GSwriteCSR)(u32 value);
592     typedef void (CALLBACK* _GSmakeSnapshot)(const char *path);
593     typedef void (CALLBACK* _GSmakeSnapshot2)(const char *path, int*, int);
594    
595     // PAD
596     typedef s32 (CALLBACK* _PADinit)(u32 flags);
597     typedef s32 (CALLBACK* _PADopen)(void *pDsp);
598     typedef u8 (CALLBACK* _PADstartPoll)(int pad);
599     typedef u8 (CALLBACK* _PADpoll)(u8 value);
600     typedef u32 (CALLBACK* _PADquery)(int pad);
601     typedef void (CALLBACK* _PADupdate)(int pad);
602     typedef keyEvent* (CALLBACK* _PADkeyEvent)();
603     typedef void (CALLBACK* _PADgsDriverInfo)(GSdriverInfo *info);
604     typedef s32 (CALLBACK* _PADsetSlot)(u8 port, u8 slot);
605     typedef s32 (CALLBACK* _PADqueryMtap)(u8 port);
606    
607     // SPU2
608     typedef s32 (CALLBACK* _SPU2open)(void *pDsp);
609 william 62 typedef void (CALLBACK* _SPU2reset)();
610 william 31 typedef void (CALLBACK* _SPU2write)(u32 mem, u16 value);
611     typedef u16 (CALLBACK* _SPU2read)(u32 mem);
612    
613     #ifdef ENABLE_NEW_IOPDMA_SPU2
614     typedef s32 (CALLBACK* _SPU2dmaRead)(s32 channel, u32* data, u32 bytesLeft, u32* bytesProcessed);
615     typedef s32 (CALLBACK* _SPU2dmaWrite)(s32 channel, u32* data, u32 bytesLeft, u32* bytesProcessed);
616     typedef void (CALLBACK* _SPU2dmaInterrupt)(s32 channel);
617    
618     // dma irq callbacks not needed anymore, they are handled by the dmac
619     typedef void (CALLBACK* _SPU2irqCallback)(void (*SPU2callback)());
620     #else
621     typedef void (CALLBACK* _SPU2readDMA4Mem)(u16 *pMem, int size);
622     typedef void (CALLBACK* _SPU2writeDMA4Mem)(u16 *pMem, int size);
623     typedef void (CALLBACK* _SPU2interruptDMA4)();
624     typedef void (CALLBACK* _SPU2readDMA7Mem)(u16 *pMem, int size);
625     typedef void (CALLBACK* _SPU2writeDMA7Mem)(u16 *pMem, int size);
626     typedef void (CALLBACK* _SPU2setDMABaseAddr)(uptr baseaddr);
627     typedef void (CALLBACK* _SPU2interruptDMA7)();
628     typedef void (CALLBACK* _SPU2irqCallback)(void (*SPU2callback)(),void (*DMA4callback)(),void (*DMA7callback)());
629     typedef u32 (CALLBACK* _SPU2ReadMemAddr)(int core);
630     typedef void (CALLBACK* _SPU2WriteMemAddr)(int core,u32 value);
631     #endif
632    
633     typedef int (CALLBACK* _SPU2setupRecording)(int, void*);
634    
635     typedef void (CALLBACK* _SPU2setClockPtr)(u32*ptr);
636     typedef void (CALLBACK* _SPU2setTimeStretcher)(short int enable);
637    
638     typedef void (CALLBACK* _SPU2async)(u32 cycles);
639    
640    
641     // CDVD
642     // NOTE: The read/write functions CANNOT use XMM/MMX regs
643     // If you want to use them, need to save and restore current ones
644     typedef s32 (CALLBACK* _CDVDopen)(const char* pTitleFilename);
645    
646     // Initiates an asynchronous track read operation.
647     // Returns -1 on error (invalid track)
648     // Returns 0 on success.
649     typedef s32 (CALLBACK* _CDVDreadTrack)(u32 lsn, int mode);
650    
651     // *OBSOLETE* returns a pointer to the buffer, or NULL if data hasn't finished
652     // loading yet.
653     typedef u8* (CALLBACK* _CDVDgetBuffer)();
654    
655     // Copies loaded data to the target buffer.
656     // Returns -2 if the asynchronous read is still pending.
657     // Returns -1 if the asyncronous read failed.
658     // Returns 0 on success.
659     typedef s32 (CALLBACK* _CDVDgetBuffer2)(u8* buffer);
660    
661     typedef s32 (CALLBACK* _CDVDreadSubQ)(u32 lsn, cdvdSubQ* subq);
662     typedef s32 (CALLBACK* _CDVDgetTN)(cdvdTN *Buffer);
663     typedef s32 (CALLBACK* _CDVDgetTD)(u8 Track, cdvdTD *Buffer);
664     typedef s32 (CALLBACK* _CDVDgetTOC)(void* toc);
665     typedef s32 (CALLBACK* _CDVDgetDiskType)();
666     typedef s32 (CALLBACK* _CDVDgetTrayStatus)();
667     typedef s32 (CALLBACK* _CDVDctrlTrayOpen)();
668     typedef s32 (CALLBACK* _CDVDctrlTrayClose)();
669     typedef s32 (CALLBACK* _CDVDreadSector)(u8* buffer, u32 lsn, int mode);
670     typedef s32 (CALLBACK* _CDVDgetDualInfo)(s32* dualType, u32* _layer1start);
671    
672     typedef void (CALLBACK* _CDVDnewDiskCB)(void (*callback)());
673    
674    
675     // DEV9
676     // NOTE: The read/write functions CANNOT use XMM/MMX regs
677     // If you want to use them, need to save and restore current ones
678     typedef s32 (CALLBACK* _DEV9open)(void *pDsp);
679     typedef u8 (CALLBACK* _DEV9read8)(u32 mem);
680     typedef u16 (CALLBACK* _DEV9read16)(u32 mem);
681     typedef u32 (CALLBACK* _DEV9read32)(u32 mem);
682     typedef void (CALLBACK* _DEV9write8)(u32 mem, u8 value);
683     typedef void (CALLBACK* _DEV9write16)(u32 mem, u16 value);
684     typedef void (CALLBACK* _DEV9write32)(u32 mem, u32 value);
685     #ifdef ENABLE_NEW_IOPDMA_DEV9
686     typedef s32 (CALLBACK* _DEV9dmaRead)(s32 channel, u32* data, u32 bytesLeft, u32* bytesProcessed);
687     typedef s32 (CALLBACK* _DEV9dmaWrite)(s32 channel, u32* data, u32 bytesLeft, u32* bytesProcessed);
688     typedef void (CALLBACK* _DEV9dmaInterrupt)(s32 channel);
689     #else
690     typedef void (CALLBACK* _DEV9readDMA8Mem)(u32 *pMem, int size);
691     typedef void (CALLBACK* _DEV9writeDMA8Mem)(u32 *pMem, int size);
692     #endif
693     typedef void (CALLBACK* _DEV9irqCallback)(DEV9callback callback);
694     typedef DEV9handler (CALLBACK* _DEV9irqHandler)(void);
695    
696     // USB
697     // NOTE: The read/write functions CANNOT use XMM/MMX regs
698     // If you want to use them, need to save and restore current ones
699     typedef s32 (CALLBACK* _USBopen)(void *pDsp);
700     typedef u8 (CALLBACK* _USBread8)(u32 mem);
701     typedef u16 (CALLBACK* _USBread16)(u32 mem);
702     typedef u32 (CALLBACK* _USBread32)(u32 mem);
703     typedef void (CALLBACK* _USBwrite8)(u32 mem, u8 value);
704     typedef void (CALLBACK* _USBwrite16)(u32 mem, u16 value);
705     typedef void (CALLBACK* _USBwrite32)(u32 mem, u32 value);
706     typedef void (CALLBACK* _USBasync)(u32 cycles);
707    
708     typedef void (CALLBACK* _USBirqCallback)(USBcallback callback);
709     typedef USBhandler (CALLBACK* _USBirqHandler)(void);
710     typedef void (CALLBACK* _USBsetRAM)(void *mem);
711    
712     //FW
713     typedef s32 (CALLBACK* _FWopen)(void *pDsp);
714     typedef u32 (CALLBACK* _FWread32)(u32 mem);
715     typedef void (CALLBACK* _FWwrite32)(u32 mem, u32 value);
716     typedef void (CALLBACK* _FWirqCallback)(void (*callback)());
717     #endif
718    
719     #ifdef PLUGINfuncs
720    
721     // GS
722     extern _GSopen GSopen;
723     extern _GSopen2 GSopen2;
724     extern _GSvsync GSvsync;
725 william 62 extern _GSgifTransfer GSgifTransfer;
726 william 31 extern _GSgifTransfer1 GSgifTransfer1;
727     extern _GSgifTransfer2 GSgifTransfer2;
728     extern _GSgifTransfer3 GSgifTransfer3;
729     extern _GSgifSoftReset GSgifSoftReset;
730     extern _GSreadFIFO GSreadFIFO;
731     extern _GSreadFIFO2 GSreadFIFO2;
732    
733     extern _GSchangeSaveState GSchangeSaveState;
734 william 280 extern _GSgetTitleInfo2 GSgetTitleInfo2;
735 william 31 extern _GSmakeSnapshot GSmakeSnapshot;
736     extern _GSmakeSnapshot2 GSmakeSnapshot2;
737     extern _GSirqCallback GSirqCallback;
738     extern _GSprintf GSprintf;
739     extern _GSsetBaseMem GSsetBaseMem;
740     extern _GSsetGameCRC GSsetGameCRC;
741     extern _GSsetFrameSkip GSsetFrameSkip;
742     extern _GSsetFrameLimit GSsetFrameLimit;
743     extern _GSsetVsync GSsetVsync;
744     extern _GSsetupRecording GSsetupRecording;
745     extern _GSreset GSreset;
746     extern _GSwriteCSR GSwriteCSR;
747    
748     // PAD
749     extern _PADopen PADopen;
750     extern _PADstartPoll PADstartPoll;
751     extern _PADpoll PADpoll;
752     extern _PADquery PADquery;
753     extern _PADupdate PADupdate;
754     extern _PADkeyEvent PADkeyEvent;
755     extern _PADgsDriverInfo PADgsDriverInfo;
756     extern _PADsetSlot PADsetSlot;
757     extern _PADqueryMtap PADqueryMtap;
758    
759     // SPU2
760     extern _SPU2open SPU2open;
761 william 62 extern _SPU2reset SPU2reset;
762 william 31 extern _SPU2write SPU2write;
763     extern _SPU2read SPU2read;
764    
765     #ifdef ENABLE_NEW_IOPDMA_SPU2
766     extern _SPU2dmaRead SPU2dmaRead;
767     extern _SPU2dmaWrite SPU2dmaWrite;
768     extern _SPU2dmaInterrupt SPU2dmaInterrupt;
769     #else
770     extern _SPU2readDMA4Mem SPU2readDMA4Mem;
771     extern _SPU2writeDMA4Mem SPU2writeDMA4Mem;
772     extern _SPU2interruptDMA4 SPU2interruptDMA4;
773     extern _SPU2readDMA7Mem SPU2readDMA7Mem;
774     extern _SPU2writeDMA7Mem SPU2writeDMA7Mem;
775     extern _SPU2setDMABaseAddr SPU2setDMABaseAddr;
776     extern _SPU2interruptDMA7 SPU2interruptDMA7;
777     extern _SPU2ReadMemAddr SPU2ReadMemAddr;
778     extern _SPU2setupRecording SPU2setupRecording;
779     extern _SPU2WriteMemAddr SPU2WriteMemAddr;
780     extern _SPU2irqCallback SPU2irqCallback;
781     #endif
782    
783     extern _SPU2irqCallback SPU2irqCallback;
784    
785     extern _SPU2setupRecording SPU2setupRecording;
786    
787     extern _SPU2setClockPtr SPU2setClockPtr;
788     extern _SPU2setTimeStretcher SPU2setTimeStretcher;
789    
790     extern _SPU2async SPU2async;
791    
792     // DEV9
793     extern _DEV9open DEV9open;
794     extern _DEV9read8 DEV9read8;
795     extern _DEV9read16 DEV9read16;
796     extern _DEV9read32 DEV9read32;
797     extern _DEV9write8 DEV9write8;
798     extern _DEV9write16 DEV9write16;
799     extern _DEV9write32 DEV9write32;
800     #ifdef ENABLE_NEW_IOPDMA_DEV9
801     extern _DEV9dmaRead DEV9dmaRead;
802     extern _DEV9dmaWrite DEV9dmaWrite;
803     extern _DEV9dmaInterrupt DEV9dmaInterrupt;
804     #else
805     extern _DEV9readDMA8Mem DEV9readDMA8Mem;
806     extern _DEV9writeDMA8Mem DEV9writeDMA8Mem;
807     #endif
808     extern _DEV9irqCallback DEV9irqCallback;
809     extern _DEV9irqHandler DEV9irqHandler;
810    
811     // USB
812     extern _USBopen USBopen;
813     extern _USBread8 USBread8;
814     extern _USBread16 USBread16;
815     extern _USBread32 USBread32;
816     extern _USBwrite8 USBwrite8;
817     extern _USBwrite16 USBwrite16;
818     extern _USBwrite32 USBwrite32;
819     extern _USBasync USBasync;
820    
821     extern _USBirqCallback USBirqCallback;
822     extern _USBirqHandler USBirqHandler;
823     extern _USBsetRAM USBsetRAM;
824    
825     // FW
826     extern _FWopen FWopen;
827     extern _FWread32 FWread32;
828     extern _FWwrite32 FWwrite32;
829     extern _FWirqCallback FWirqCallback;
830    
831     #endif
832    
833     #ifdef __cplusplus
834     } // End extern "C"
835     #endif
836    
837     #endif /* __PS2EDEFS_H__ */

  ViewVC Help
Powered by ViewVC 1.1.22