PS2SDK
PS2 Homebrew Libraries
cdvdman.h
Go to the documentation of this file.
1 /*
2 # _____ ___ ____ ___ ____
3 # ____| | ____| | | |____|
4 # | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
5 #-----------------------------------------------------------------------
6 # Copyright 2001-2004, ps2dev - http://www.ps2dev.org
7 # Licenced under Academic Free License version 2.0
8 # Review ps2sdk README & LICENSE files for further details.
9 */
10 
16 #ifndef __CDVDMAN_H__
17 #define __CDVDMAN_H__
18 
19 #include <types.h>
20 #include <irx.h>
21 
22 #include <libcdvd-common.h>
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 #ifdef BUILDING_CDVD_MODULE
29 #define PRINTF(...) \
30  { \
31  printf(__VA_ARGS__); \
32  }
33 #define KPRINTF(...) \
34  { \
35  Kprintf(__VA_ARGS__); \
36  }
37 #define VERBOSE_PRINTF(level, ...) \
38  { \
39  if ( g_verbose_level >= (level) ) \
40  { \
41  printf(__VA_ARGS__);\
42  } \
43  }
44 #define VERBOSE_KPRINTF(level, ...) \
45  { \
46  if ( g_verbose_level >= (level) ) \
47  { \
48  Kprintf(__VA_ARGS__);\
49  } \
50  }
51 #endif
52 
54 {
55  u16 m_dma3_blkwords;
56  u16 m_dma3_blkcount;
57  void *m_dma3_maddress;
58  int (*m_dma3_callback)(void);
59  u16 m_dma3_csectors;
60  u16 m_cdvdreg_howto;
61  u32 m_dma3_msectors;
63 
65 {
66  char m_cdvdman_command;
67  unsigned char m_last_error;
68  char m_unused_002;
69  char m_ncmd_intr_count;
70  int m_wait_flag;
71  int m_thread_id;
72  int m_stream_flag;
73  int m_read2_flag;
74  int m_cdvdman_lsn;
75  int m_cdvdman_rbuffer;
76  int m_cdvdman_nsec;
77  int m_cdvdman_csec;
78  int m_cdvdman_rsec;
79  int m_cdvdman_pattern;
80  sceCdRMode m_cdvdman_cdrmode;
81  int m_recover_status;
82  int m_dvd_flag;
83  int m_read_lsn;
84  void *m_read_buf;
85  int m_read_sectors;
86  sceCdRMode m_read_mode;
87  int m_read_chunk_reprocial_32;
88  int m_dintrlsn;
89  void *m_read_callback;
90  int m_read_chunk;
91  char m_scmd_flag;
92  char m_scmd;
93  char m_sdlen;
94  char m_rdlen;
95  char m_scmd_sd[16];
96  char m_scmd_rd[16];
97  int m_sync_error;
98  int m_last_read_timeout;
99  int m_power_flag;
100  u32 m_layer_1_lsn;
101  char m_use_toc;
102  char m_opo_or_para;
103  char m_current_dvd;
104  char m_dual_layer_emulation;
105  u32 m_current_dvd_lsn;
106  int m_check_version;
107  int m_dec_shift;
108  int m_dec_state;
109  int m_no_dec_flag;
110  cdvdman_dma3_parameter_t m_dma3_param;
111  int m_cdvdman_dma3sec;
112  int m_drive_interupt_request;
113  u16 m_dec_mode_set;
114  u16 m_dec_mode_last_set;
115  int m_waf_set_test;
116  // OSD add
117  int m_cd_mode_ps2_atapi;
118  void (*m_cd_atapi_intr_callback)(int writer_drive);
119  int (*m_chgsys_callback)(void *userdata, int writer_drive);
120  int m_chgsys_callback_next_disktype;
121  int m_unusedosd1;
122  int m_field_0DC;
123  int m_var_sc_ffffffdb;
124  // OSD add end
125  int m_interupt_read_state;
126  // OSD add
127  int m_atapi_disk_ejected;
128  // OSD add end
129  int m_cd_inited;
130  // OSD add
131  int m_medium_removal_state;
132  int m_chgsys_callback_next_disktype_last;
133  int m_chgsys_writer_drive_shell_is_open;
134  int m_unusedosd2[6];
135  // OSD add end
136  int m_tray_is_open;
137  int m_break_cdvdfsv_readchain;
138  int m_unused[10];
140 
141 //IOP-only libcdvd function prototypes.
142 extern int sceCdCheckCmd(void);
143 extern int sceCdNop(void);
144 extern void *sceGetFsvRbuf(void);
145 extern int sceCdstm0Cb(void (*p)(int val));
146 extern int sceCdstm1Cb(void (*p)(int val));
147 extern int sceCdSC(int code, int *param);
148 /* Within all CDVDMAN modules, sceCdReadClock and sceCdRC both exist. In the old one, both have exactly the same code.
149  In the newer ones, sceCdReadClock would automatically file off the most significant bit within the month field,
150  while sceCdRC continued having its original behaviour of not changing the data. */
151 extern int sceCdRC(sceCdCLOCK *clock);
152 extern int sceCdRead0(u32 lsn, u32 sectors, void *buffer, sceCdRMode *mode, int csec, void *callback);
153 
159 extern int sceCdRV(u32 lsn, u32 sectors, void *buf, sceCdRMode *mode, int arg5, void *cb);
160 
169 extern int sceCdApplySCmd2(u8 cmdNum, const void* inBuff, unsigned long int inBuffSize, void *outBuff);
170 
181 extern int sceCdApplySCmd3(u8 cmdNum, const void* inBuff, unsigned long int inBuffSize, void *outBuff);
182 
189 extern int sceCdSpinCtrlIOP(u32 speed);
190 
199 extern void *sceCdSetAtapiEjectCallback(int (*cb)(int reason, void *userdata), void *userdata);
200 
201 //DNAS functions
202 
209 extern int sceCdReadDiskID(unsigned int *id);
210 
221 extern int sceCdDeobfuscateUsingUniqueKey(u8 *buffer, unsigned int shiftval, int xorval, u32 *status);
222 
223 #define cdvdman_IMPORTS_start DECLARE_IMPORT_TABLE(cdvdman, 1, 1)
224 #define cdvdman_IMPORTS_end END_IMPORT_TABLE
225 
226 #define I_sceCdInit DECLARE_IMPORT(4, sceCdInit)
227 #define I_sceCdStandby DECLARE_IMPORT(5, sceCdStandby)
228 #define I_sceCdRead DECLARE_IMPORT(6, sceCdRead)
229 #define I_sceCdSeek DECLARE_IMPORT(7, sceCdSeek)
230 #define I_sceCdGetError DECLARE_IMPORT(8, sceCdGetError)
231 #define I_sceCdGetToc DECLARE_IMPORT(9, sceCdGetToc)
232 #define I_sceCdSearchFile DECLARE_IMPORT(10, sceCdSearchFile)
233 #define I_sceCdSync DECLARE_IMPORT(11, sceCdSync)
234 #define I_sceCdGetDiskType DECLARE_IMPORT(12, sceCdGetDiskType)
235 #define I_sceCdDiskReady DECLARE_IMPORT(13, sceCdDiskReady)
236 #define I_sceCdTrayReq DECLARE_IMPORT(14, sceCdTrayReq)
237 #define I_sceCdStop DECLARE_IMPORT(15, sceCdStop)
238 #define I_sceCdPosToInt DECLARE_IMPORT(16, sceCdPosToInt)
239 #define I_sceCdIntToPos DECLARE_IMPORT(17, sceCdIntToPos)
240 #define I_sceCdGetToc2 DECLARE_IMPORT(19, sceCdGetToc2)
241 #define I_sceCdReadDVDV DECLARE_IMPORT(20, sceCdReadDVDV)
242 #define I_sceCdCheckCmd DECLARE_IMPORT(21, sceCdCheckCmd)
243 #define I_sceCdRI DECLARE_IMPORT(22, sceCdRI)
244 #define I_sceCdWI DECLARE_IMPORT(23, sceCdWI)
245 #define I_sceCdReadClock DECLARE_IMPORT(24, sceCdReadClock)
246 #define I_sceCdWriteClock DECLARE_IMPORT(25, sceCdWriteClock)
247 #define I_sceCdReadNVM DECLARE_IMPORT(26, sceCdReadNVM)
248 #define I_sceCdWriteNVM DECLARE_IMPORT(27, sceCdWriteNVM)
249 #define I_sceCdStatus DECLARE_IMPORT(28, sceCdStatus)
250 #define I_sceCdApplySCmd DECLARE_IMPORT(29, sceCdApplySCmd)
251 #define I_sceCdSetHDMode DECLARE_IMPORT(30, sceCdSetHDMode)
252 #define I_sceCdOpenConfig DECLARE_IMPORT(31, sceCdOpenConfig)
253 #define I_sceCdCloseConfig DECLARE_IMPORT(32, sceCdCloseConfig)
254 #define I_sceCdReadConfig DECLARE_IMPORT(33, sceCdReadConfig)
255 #define I_sceCdWriteConfig DECLARE_IMPORT(34, sceCdWriteConfig)
256 #define I_sceCdReadKey DECLARE_IMPORT(35, sceCdReadKey)
257 #define I_sceCdDecSet DECLARE_IMPORT(36, sceCdDecSet)
258 #define I_sceCdCallback DECLARE_IMPORT(37, sceCdCallback)
259 #define I_sceCdPause DECLARE_IMPORT(38, sceCdPause)
260 #define I_sceCdBreak DECLARE_IMPORT(39, sceCdBreak)
261 #define I_sceCdReadCDDA DECLARE_IMPORT(40, sceCdReadCDDA)
262 #define I_sceCdReadConsoleID DECLARE_IMPORT(41, sceCdReadConsoleID)
263 #define I_sceCdWriteConsoleID DECLARE_IMPORT(42, sceCdWriteConsoleID)
264 #define I_sceCdMV DECLARE_IMPORT(43, sceCdMV)
265 #define I_sceCdGetReadPos DECLARE_IMPORT(44, sceCdGetReadPos)
266 #define I_sceCdCtrlADout DECLARE_IMPORT(45, sceCdCtrlADout)
267 #define I_sceCdNop DECLARE_IMPORT(46, sceCdNop)
268 #define I_sceGetFsvRbuf DECLARE_IMPORT(47, sceGetFsvRbuf)
269 #define I_sceCdstm0Cb DECLARE_IMPORT(48, sceCdstm0Cb)
270 #define I_sceCdstm1Cb DECLARE_IMPORT(49, sceCdstm1Cb)
271 #define I_sceCdSC DECLARE_IMPORT(50, sceCdSC)
272 #define I_sceCdRC DECLARE_IMPORT(51, sceCdRC)
273 #define I_sceCdForbidDVDP DECLARE_IMPORT(52, sceCdForbidDVDP)
274 #define I_sceCdReadSUBQ DECLARE_IMPORT(53, sceCdReadSUBQ)
275 #define I_sceCdApplyNCmd DECLARE_IMPORT(54, sceCdApplyNCmd)
276 #define I_sceCdAutoAdjustCtrl DECLARE_IMPORT(55, sceCdAutoAdjustCtrl)
277 #define I_sceCdStInit DECLARE_IMPORT(56, sceCdStInit)
278 #define I_sceCdStRead DECLARE_IMPORT(57, sceCdStRead)
279 #define I_sceCdStSeek DECLARE_IMPORT(58, sceCdStSeek)
280 #define I_sceCdStStart DECLARE_IMPORT(59, sceCdStStart)
281 #define I_sceCdStStat DECLARE_IMPORT(60, sceCdStStat)
282 #define I_sceCdStStop DECLARE_IMPORT(61, sceCdStStop)
283 #define I_sceCdRead0 DECLARE_IMPORT(62, sceCdRead0)
284 #define I_sceCdRV DECLARE_IMPORT(63, sceCdRV)
285 #define I_sceCdRM DECLARE_IMPORT(64, sceCdRM)
286 #define I_sceCdWM DECLARE_IMPORT(65, sceCdWM)
287 #define I_sceCdReadChain DECLARE_IMPORT(66, sceCdReadChain)
288 #define I_sceCdStPause DECLARE_IMPORT(67, sceCdStPause)
289 #define I_sceCdStResume DECLARE_IMPORT(68, sceCdStResume)
290 #define I_sceCdForbidRead DECLARE_IMPORT(69, sceCdForbidRead)
291 #define I_sceCdBootCertify DECLARE_IMPORT(70, sceCdBootCertify)
292 #define I_sceCdSpinCtrlIOP DECLARE_IMPORT(71, sceCdSpinCtrlIOP)
293 #define I_sceCdBlueLEDCtl DECLARE_IMPORT(72, sceCdBlueLEDCtl)
294 #define I_sceCdCancelPOffRdy DECLARE_IMPORT(73, sceCdCancelPOffRdy)
295 #define I_sceCdPowerOff DECLARE_IMPORT(74, sceCdPowerOff)
296 #define I_sceCdMmode DECLARE_IMPORT(75, sceCdMmode)
297 
298 #define I_sceCdReadFull DECLARE_IMPORT(76, sceCdReadFull)
299 #define I_sceCdStSeekF DECLARE_IMPORT(77, sceCdStSeekF)
300 #define I_sceCdPOffCallback DECLARE_IMPORT(78, sceCdPOffCallback)
301 #define I_sceCdReadDiskID DECLARE_IMPORT(79, sceCdReadDiskID)
302 #define I_sceCdReadGUID DECLARE_IMPORT(80, sceCdReadGUID)
303 #define I_sceCdSetTimeout DECLARE_IMPORT(81, sceCdSetTimeout)
304 #define I_sceCdReadModelID DECLARE_IMPORT(82, sceCdReadModelID)
305 #define I_sceCdReadDvdDualInfo DECLARE_IMPORT(83, sceCdReadDvdDualInfo)
306 #define I_sceCdLayerSearchFile DECLARE_IMPORT(84, sceCdLayerSearchFile)
307 #define I_sceCdStatus2 DECLARE_IMPORT(90, sceCdStatus2)
308 #define I_sceCdReadWakeUpTime DECLARE_IMPORT(109, sceCdReadWakeUpTime)
309 #define I_sceCdWriteWakeUpTime DECLARE_IMPORT(110, sceCdWriteWakeUpTime)
310 #define I_sceCdApplySCmd2 DECLARE_IMPORT(112, sceCdApplySCmd2)
311 #define I_sceCdRE DECLARE_IMPORT(114, sceCdRE)
312 #define I_sceCdRcBypassCtl DECLARE_IMPORT(115, sceCdRcBypassCtl)
313 #define I_sceCdSendSCmd1D DECLARE_IMPORT(116, sceCdSendSCmd1D)
314 #define I_sceRemote2_7 DECLARE_IMPORT(117, sceRemote2_7)
315 #define I_sceCdSetLEDsMode DECLARE_IMPORT(120, sceCdSetLEDsMode)
316 #define I_sceCdApplySCmd3 DECLARE_IMPORT(125, sceCdApplySCmd3)
317 #define I_sceRemote2_7Get DECLARE_IMPORT(128, sceRemote2_7Get)
318 #define I_sceCdReadPS1BootParam DECLARE_IMPORT(148, sceCdReadPS1BootParam)
319 #define I_sceCdSetFanProfile DECLARE_IMPORT(150, sceCdSetFanProfile)
320 #define I_cdvdman_152_get_temperature DECLARE_IMPORT(152, cdvdman_152_get_temperature)
321 #define I_sceCdChgSys DECLARE_IMPORT(154, sceCdChgSys)
322 #define I_sceCdNoticeGameStart DECLARE_IMPORT(156, sceCdNoticeGameStart)
323 #define I_sceCdDeobfuscateUsingUniqueKey DECLARE_IMPORT(161, sceCdDeobfuscateUsingUniqueKey)
324 #define I_sceCdXLEDCtl DECLARE_IMPORT(163, sceCdXLEDCtl)
325 #define I_sceCdBuzzerCtl DECLARE_IMPORT(165, sceCdBuzzerCtl)
326 #define I_cdvdman_167_atapi2dragon DECLARE_IMPORT(167, cdvdman_167_atapi2dragon)
327 #define I_cdvdman_169_dragon2atapi DECLARE_IMPORT(169, cdvdman_169_dragon2atapi)
328 #define I_sceCdXBSPowerCtl DECLARE_IMPORT(171, sceCdXBSPowerCtl)
329 #define I_sceCdSetAtapiEjectCallback DECLARE_IMPORT(173, sceCdSetAtapiEjectCallback)
330 #define I_sceCdSetMediumRemoval DECLARE_IMPORT(175, sceCdSetMediumRemoval)
331 #define I_sceCdGetMediumRemoval DECLARE_IMPORT(177, sceCdGetMediumRemoval)
332 #define I_sceCdDoesUniqueKeyExist DECLARE_IMPORT(179, sceCdDoesUniqueKeyExist)
333 #define I_sceCdXDVRPReset DECLARE_IMPORT(181, sceCdXDVRPReset)
334 #define I_sceCdGetWakeUpReason DECLARE_IMPORT(183, sceCdGetWakeUpReason)
335 #define I_sceCdReadRegionParams DECLARE_IMPORT(189, sceCdReadRegionParams)
336 #define I_sceCdWriteRegionParams DECLARE_IMPORT(191, sceCdWriteRegionParams)
337 
338 #ifdef __cplusplus
339 }
340 #endif
341 
342 #endif /* __CDVDMAN_H__ */
cdvdman_dma3_parameter_
Definition: cdvdman.h:53
sceCdCLOCK
Definition: libcdvd-common.h:188
sceCdDeobfuscateUsingUniqueKey
int sceCdDeobfuscateUsingUniqueKey(u8 *buffer, unsigned int shiftval, int xorval, u32 *status)
sceCdSetAtapiEjectCallback
void * sceCdSetAtapiEjectCallback(int(*cb)(int reason, void *userdata), void *userdata)
irx.h
sceCdSpinCtrlIOP
int sceCdSpinCtrlIOP(u32 speed)
Definition: cdvdman.c:2183
sceCdApplySCmd3
int sceCdApplySCmd3(u8 cmdNum, const void *inBuff, unsigned long int inBuffSize, void *outBuff)
sceCdRV
int sceCdRV(u32 lsn, u32 sectors, void *buf, sceCdRMode *mode, int arg5, void *cb)
Definition: cdvdman.c:7127
libcdvd-common.h
cdvdman_internal_struct_
Definition: cdvdman.h:64
sceCdReadDiskID
int sceCdReadDiskID(unsigned int *id)
sceCdRMode
Definition: libcdvd-common.h:233
sceCdApplySCmd2
int sceCdApplySCmd2(u8 cmdNum, const void *inBuff, unsigned long int inBuffSize, void *outBuff)
Definition: cdvdman.c:5441