ps2sdk  1.1
A collection of Open Source libraries used for developing applications on Sony's PlayStation 2® (PS2).
ncmd.c
Go to the documentation of this file.
1 /*
2 # _____ ___ ____ ___ ____
3 # ____| | ____| | | |____|
4 # | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
5 #-----------------------------------------------------------------------
6 ## (C) 2002 Nicholas Van Veen (nickvv@xtra.co.nz)
7 # 2003 loser (loser@internalreality.com)
8 # (c) 2004 Marcus R. Brown <mrbrown@0xd6.org> Licenced under Academic Free License version 2.0
9 # Review ps2sdk README & LICENSE files for further details.
10 */
11 
22 #include <stdio.h>
23 #include <kernel.h>
24 #include <sifrpc.h>
25 #include <libcdvd.h>
26 #include <libcdvd-rpc.h>
27 #include <string.h>
28 
29 #include "internal.h"
30 
32 #define CD_SERVER_NCMD 0x80000595
33 
35 typedef enum {
46 
47 int sceCdStream(u32 lbn, u32 nsectors, void *buf, CdvdStCmd_t cmd, sceCdRMode *rm);
48 int sceCdCddaStream(u32 lbn, u32 nsectors, void *buf, CdvdStCmd_t cmd, sceCdRMode *rm);
49 
51  CD_NCMD_READ = 0x01,
67 };
68 
69 int _CdCheckNCmd(int cmd);
70 
71 typedef union {
72  struct cdvdNcmdParam ncmd;
73  struct cdvdReadKeyParam readKey;
74  u8 data[48];
76 
77 #ifdef F__ncmd_internals
78 int bindNCmd = -1;
79 
81 SifRpcClientData_t clientNCmd __attribute__ ((aligned(64)));
82 
84 int nCmdSemaId = -1;
85 
86 int nCmdNum = 0;
87 
88 u32 readStreamData[5] __attribute__ ((aligned(64)));
89 u32 readData[6] __attribute__ ((aligned(64)));
90 sceCdRChain readChainData[66] __attribute__ ((aligned(64)));
92 u32 getTocSendBuff[3] __attribute__ ((aligned(64)));
93 u32 _rd_intr_data[64] __attribute__ ((aligned(64)));
94 u32 curReadPos __attribute__ ((aligned(64)));
96 u8 tocBuff[2064] __attribute__ ((aligned(64)));
97 u8 nCmdRecvBuff[48] __attribute__ ((aligned(64)));
98 nCmdSendParams_t nCmdSendBuff __attribute__ ((aligned(64)));
99 int streamStatus = 0;
101 u32 seekSector __attribute__ ((aligned(64)));
102 u32 cdda_st_buf[64/sizeof(u32)] ALIGNED(64);
103 #endif
104 
105 extern int bindNcmd;
107 extern int nCmdSemaId;
108 extern int nCmdNum;
109 extern u32 readStreamData[5];
110 extern u32 readData[6];
111 extern sceCdRChain readChainData[66];
112 extern u32 getTocSendBuff[3];
113 extern u32 _rd_intr_data[64];
114 extern u32 curReadPos;
115 extern u8 tocBuff[2064];
116 extern u8 nCmdRecvBuff[48];
118 extern int streamStatus;
119 extern sceCdRMode dummyMode;
120 extern u32 seekSector;
121 extern u32 cdda_st_buf[64/sizeof(u32)];
122 
124 
125 /* N-Command Functions */
126 
127 #ifdef _XCDVD
128 struct _cdvd_read_data
129 {
130  u32 size1;
131  u32 size2;
132  void *dest1;
133  void *dest2;
134  u8 src1[64];
135  u8 src2[64];
136 };
137 #else
139 {
142  void *dest1;
143  void *dest2;
144  u8 src1[16];
145  u8 src2[16];
146 };
147 #endif
148 
153 #ifdef F__CdAlignReadBuffer
154 void _CdAlignReadBuffer(void *data)
155 {
156  struct _cdvd_read_data *uncached = UNCACHED_SEG(data);
157 
158  if (uncached->size1 && uncached->dest1) {
159  memcpy(uncached->dest1, &uncached->src1, uncached->size1);
160  }
161 
162  if (uncached->size2 && uncached->dest2) {
163  memcpy(uncached->dest2, &uncached->src2, uncached->size2);
164  }
165 
167 }
168 #endif
169 
170 #ifdef F_sceCdRead
171 int sceCdRead(u32 lbn, u32 sectors, void *buf, sceCdRMode * mode)
172 {
173  int bufSize;
174 
176  return 0;
177  if (_CdCheckNCmd(CD_NCMD_READ) == 0)
178  return 0;
179 
180  readData[0] = lbn;
181  readData[1] = sectors;
182  readData[2] = (u32) buf;
183  readData[3] = (mode->trycount) | (mode->spindlctrl << 8) | (mode->datapattern << 16);
184  readData[4] = (u32) _rd_intr_data;
185  readData[5] = (u32) &curReadPos;
186 
187  // work out buffer size
188  if (mode->datapattern == SCECdSecS2328)
189  bufSize = sectors * 2328;
190  else if (mode->datapattern == SCECdSecS2340)
191  bufSize = sectors * 2340;
192  else
193  bufSize = sectors * 2048;
194 
195  curReadPos = 0;
196  SifWriteBackDCache(buf, bufSize);
198 
199  if (CdDebug > 0)
200  printf("call sceCdread cmd\n");
201 
203  cbSema = 1;
204 
206  CdCallbackNum = 0;
207  cbSema = 0;
209  return 0;
210  }
211 
212  if (CdDebug > 0)
213  printf("sceCdread end\n");
214 
215  //Old versions have this extra SignalSema call here.
216  //SignalSema(nCmdSemaId);
217  return 1;
218 }
219 #endif
220 
221 #ifdef F_sceCdReadDVDV
222 int sceCdReadDVDV(u32 lbn, u32 nsectors, void *buf, sceCdRMode *rm)
223 {
225  return 0;
226  if (_CdCheckNCmd(CD_NCMD_DVDREAD) == 0)
227  return 0;
228 
229  readData[0] = lbn;
230  readData[1] = nsectors;
231  readData[2] = (u32)buf;
232  readData[3] = (rm->trycount) | (rm->spindlctrl << 8) | (rm->datapattern << 16);
233  readData[4] = (u32)_rd_intr_data;
234 
235  SifWriteBackDCache(buf, nsectors * 2064);
236 
238  cbSema = 1;
239 
240  if (SifCallRpc(&clientNCmd, CD_NCMD_DVDREAD, SIF_RPC_M_NOWAIT, readData, 24, NULL, 0, &_CdAlignReadBuffer, _rd_intr_data) < 0) { //The Sony function was broken here: It doesn't set a callback, which will cause the library to enter a deadlocked state.
241  CdCallbackNum = 0;
242  cbSema = 0;
244  return 0;
245  }
246 
247  //Old versions have this extra SignalSema call here.
248  //SignalSema(nCmdSemaId);
249  return 1;
250 }
251 #endif
252 
253 #ifdef F_sceCdReadCDDA
254 int sceCdReadCDDA(u32 lbn, u32 nsectors, void *buf, sceCdRMode *rm)
255 {
256  unsigned int sector_size;
257 
259  return 0;
260  if (_CdCheckNCmd(CD_NCMD_CDDAREAD) == 0)
261  return 0;
262 
263  readData[0] = lbn;
264  readData[1] = nsectors;
265  readData[2] = (u32)buf;
266  readData[3] = (rm->trycount) | (rm->spindlctrl << 8) | (rm->datapattern << 16);
267  readData[4] = (u32)_rd_intr_data;
268 
269  /* Calculate the size of the read buffer. */
270  switch (rm->datapattern) {
271  case SCECdSecS2368:
272  sector_size = 2368;
273  break;
274  case SCECdSecS2448:
275  sector_size = 2448;
276  break;
277  default:
278  sector_size = 2352;
279  }
280 
281  SifWriteBackDCache(buf, nsectors * sector_size);
282 
284  cbSema = 1;
285 
287  CdCallbackNum = 0;
288  cbSema = 0;
290  return 0;
291  }
292 
293  //Old versions have this extra SignalSema call here.
294  //SignalSema(nCmdSemaId);
295  return 1;
296 }
297 #endif
298 
299 #ifdef F_sceCdGetToc
300 int sceCdGetToc(u8 * toc)
301 {
302  u8 *tocPtr, *tocEnd;
303 
304  if (_CdCheckNCmd(CD_NCMD_GETTOC) == 0)
305  return 0;
306 
307  getTocSendBuff[0] = (u32) tocBuff;
309 
312  return 0;
313  }
314 
315  tocPtr = UNCACHED_SEG(tocBuff);
316  tocEnd = tocPtr + 1024;
317  if (*(u32 *) (nCmdRecvBuff + 4)) {
318  do {
319  memcpy(toc, tocPtr, 32);
320  tocPtr += 32;
321  toc += 32;
322  } while (tocPtr < tocEnd);
323  } else {
324  tocEnd = tocPtr + 2048;
325 
326  do {
327  memcpy(toc, tocPtr, 32);
328  tocPtr += 32;
329  toc += 32;
330  } while (tocPtr < tocEnd);
331 
332  memcpy(toc, tocPtr, 16);
333  }
334 
336  return *(int *) UNCACHED_SEG(nCmdRecvBuff);
337 }
338 #endif
339 
340 #ifdef F_sceCdSeek
341 int sceCdSeek(u32 lbn)
342 {
344  return 0;
345  if (_CdCheckNCmd(CD_NCMD_SEEK) == 0)
346  return 0;
347 
348  seekSector = lbn;
349 
351  cbSema = 1;
353  CdCallbackNum = 0;
354  cbSema = 0;
356  return 0;
357  }
358 
359  //Old versions have this extra SignalSema call here.
360  //SignalSema(nCmdSemaId);
361  return 1;
362 }
363 #endif
364 
365 #ifdef F_sceCdStandby
366 int sceCdStandby(void)
367 {
369  return 0;
370  if (_CdCheckNCmd(CD_NCMD_STANDBY) == 0)
371  return 0;
372 
374  cbSema = 1;
376  CdCallbackNum = 0;
377  cbSema = 0;
379  return 0;
380  }
381 
382  //Old versions have this extra SignalSema call here.
383  //SignalSema(nCmdSemaId);
384  return 1;
385 }
386 #endif
387 
388 #ifdef F_sceCdStop
389 int sceCdStop(void)
390 {
392  return 0;
393  if (_CdCheckNCmd(CD_NCMD_STOP) == 0)
394  return 0;
395 
397  cbSema = 1;
399  CdCallbackNum = 0;
400  cbSema = 0;
402  return 0;
403  }
404 
405  //Old versions have this extra SignalSema call here.
406  //SignalSema(nCmdSemaId);
407  return 1;
408 }
409 #endif
410 
411 #ifdef F_sceCdPause
412 int sceCdPause(void)
413 {
415  return 0;
416  if (_CdCheckNCmd(CD_NCMD_PAUSE) == 0)
417  return 0;
418 
420  cbSema = 1;
422  CdCallbackNum = 0;
423  cbSema = 0;
425  return 0;
426  }
427 
428  //Old versions have this extra SignalSema call here.
429  //SignalSema(nCmdSemaId);
430  return 1;
431 }
432 #endif
433 
434 #ifdef F_sceCdApplyNCmd
435 int sceCdApplyNCmd(u8 cmdNum, const void *inBuff, u16 inBuffSize, void *outBuff, u16 outBuffSize)
436 {
438  return 0;
439  if (_CdCheckNCmd(CD_NCMD_NCMD) == 0)
440  return 0;
441 
442  nCmdSendBuff.ncmd.cmdNum = cmdNum;
443  nCmdSendBuff.ncmd.inBuffSize = inBuffSize;
444  memset(nCmdSendBuff.ncmd.inBuff, 0, 16);
445  if (inBuff)
446  memcpy(nCmdSendBuff.ncmd.inBuff, inBuff, inBuffSize);
447 
448  if (SifCallRpc(&clientNCmd, CD_NCMD_NCMD, 0, &nCmdSendBuff, 20, nCmdRecvBuff, 16, NULL, NULL) < 0) {
450  return 0;
451  }
452 
453  if (outBuff)
454  memcpy((void *) outBuff, UNCACHED_SEG(nCmdRecvBuff), outBuffSize);
455 
457  return *(int *) UNCACHED_SEG(nCmdRecvBuff);
458 }
459 #endif
460 
461 #ifdef F_sceCdReadIOPMem
462 int sceCdReadIOPMem(u32 lbn, u32 sectors, void *buf, sceCdRMode * mode)
463 {
465  return 0;
467  return 0;
468 
469  readData[0] = lbn;
470  readData[1] = sectors;
471  readData[2] = (u32) buf;
472  readData[3] = (mode->trycount) | (mode->spindlctrl << 8) | (mode->datapattern << 16);
473  readData[4] = (u32) _rd_intr_data;
474  readData[5] = (u32) & curReadPos;
475 
477  cbSema = 1;
479  CdCallbackNum = 0;
480  cbSema = 0;
482  return 0;
483  }
484 
485  if (CdDebug > 0)
486  printf("sceCdread end\n");
487 
488  //Old versions have this extra SignalSema call here.
489  //SignalSema(nCmdSemaId);
490  return 1;
491 }
492 #endif
493 
494 #ifdef F_sceCdNCmdDiskReady
495 int sceCdNCmdDiskReady(void)
496 {
498  return 0;
499 
500  if (SifCallRpc(&clientNCmd, CD_NCMD_DISKREADY, 0, NULL, 0, &nCmdRecvBuff, 4, NULL, NULL) < 0) {
502  return 0;
503  }
504 
506  return *(int *) UNCACHED_SEG(nCmdRecvBuff);
507 }
508 #endif
509 
510 #ifdef F_sceCdReadChain
511 int sceCdReadChain(sceCdRChain * readChain, sceCdRMode * mode)
512 {
513  int chainNum, i, sectorType;
514 
516  return 0;
518  return 0;
519 
520  if (CdDebug > 0)
521  printf("call sceCdReadChain cmd 0\n");
522 
523  for (chainNum = 0; chainNum < 64; chainNum++) {
524  if (readChain[chainNum].lbn == 0xFFFFFFFF ||
525  readChain[chainNum].sectors == 0xFFFFFFFF || readChain[chainNum].buffer == 0xFFFFFFFF)
526  break;
527  readChainData[chainNum].lbn = readChain[chainNum].lbn;
528  readChainData[chainNum].sectors = readChain[chainNum].sectors;
529  readChainData[chainNum].buffer = readChain[chainNum].buffer;
530  }
531  // store 'end of read-chain' data in chain
532  readChainData[chainNum].lbn = 0xFFFFFFFF;
533  readChainData[chainNum].sectors = 0xFFFFFFFF;
534  readChainData[chainNum].buffer = 0xFFFFFFFF;
535 
536  // store read mode and read position in read chain data
537  readChainData[65].lbn = (mode->trycount) | (mode->spindlctrl << 8) | (mode->datapattern << 16);
539 
540  if (mode->datapattern == SCECdSecS2328)
541  sectorType = 2328;
542  else if (mode->datapattern == SCECdSecS2340)
543  sectorType = 2340;
544  else
545  sectorType = 2048;
546 
547  curReadPos = 0;
548  if (CdDebug > 0)
549  printf("call sceCdReadChain cmd 1\n");
550 
551  for (i = 0; i < chainNum; i++) {
552  // if memory is on EE, make sure its not cached
553  if ((readChainData[i].buffer & 1) == 0) {
554  if (CdDebug > 0)
555  printf("SifWriteBackDCache addr= 0x%08x size= %d, sector= %d\n",
556  readChainData[i].buffer, readChainData[i].sectors * sectorType,
557  readChainData[i].lbn);
559  readChainData[i].sectors * sectorType);
560  }
561  }
562 
564 
565  if (CdDebug > 0)
566  printf("call sceCdReadChain cmd 2\n");
568  cbSema = 1;
570  CdCallbackNum = 0;
571  cbSema = 0;
573  return 0;
574  }
575 
576  if (CdDebug > 0)
577  printf("sceCdread end\n");
578 
579  //Old versions have this extra SignalSema call here.
580  //SignalSema(nCmdSemaId);
581  return 1;
582 }
583 #endif
584 
585 #ifdef F_sceCdGetReadPos
586 u32 sceCdGetReadPos(void)
587 {
588  if (CdCallbackNum == CD_NCMD_READ) {
589  return *(u32 *) UNCACHED_SEG(curReadPos);
590  }
591  return 0;
592 }
593 #endif
594 
595 /* Stream Functions */
596 
597 #ifdef F_sceCdStStart
598 int sceCdStStart(u32 lbn, sceCdRMode * mode)
599 {
600  streamStatus = 1;
601  return sceCdStream(lbn, 0, NULL, CDVD_ST_CMD_START, mode);
602 }
603 #endif
604 
605 #ifdef F_sceCdStRead
606 int sceCdStRead(u32 sectorType, u32 * buffer, u32 mode, u32 * error)
607 {
608  int ret, i, err, sectorReadSize;
609 
610  *error = 0;
611  if (CdDebug > 0)
612  printf("sceCdStRead call read size=%d mode=%d\n", sectorType, mode);
613  if (streamStatus == 0)
614  return 0;
615  SifWriteBackDCache(buffer, sectorType * 2048);
616 
617  // read only data currently in stream buffer
618  if (mode == STMBLK) {
619  ret = sceCdStream(0, sectorType, buffer, CDVD_ST_CMD_READ, &dummyMode);
620  *error = ret >> 16;
621  return ret & 0xFFFF;
622  }
623  // do block reads until all data is read, or error occurs
624  for (i = 0; i < sectorType;) {
625  ret = sceCdStream(0, sectorType - i, (buffer + (i * 2048)), CDVD_ST_CMD_READ, &dummyMode);
626  sectorReadSize = ret & 0xFFFF;
627  i += sectorReadSize;
628  err = ret >> 16;
629 
630  if (err) {
631  *error = err;
632  if (CdDebug > 0)
633  printf("sceCdStRead BLK Read cur_size= %d read_size= %d req_size= %d err 0x%x\n", i,
634  sectorReadSize, sectorType, err);
635 
636  if (sectorReadSize == 0)
637  break;
638  }
639  }
640 
641  if (CdDebug > 0)
642  printf("sceCdStRead BLK Read Ended\n");
643  return i;
644 }
645 #endif
646 
647 #ifdef F_sceCdStStop
648 int sceCdStStop(void)
649 {
650  streamStatus = 0;
651  return sceCdStream(0, 0, NULL, CDVD_ST_CMD_STOP, &dummyMode);
652 }
653 #endif
654 
655 #ifdef F_sceCdStSeek
656 int sceCdStSeek(u32 lbn)
657 {
658  return sceCdStream(lbn, 0, NULL, CDVD_ST_CMD_SEEK, &dummyMode);
659 }
660 #endif
661 
662 #ifdef F_sceCdStInit
663 int sceCdStInit(u32 buffSize, u32 numBuffers, void *buf)
664 {
665  streamStatus = 0;
666  return sceCdStream(buffSize, numBuffers, buf, CDVD_ST_CMD_INIT, &dummyMode);
667 }
668 #endif
669 
670 #ifdef F_sceCdStStat
671 int sceCdStStat(void)
672 {
673  streamStatus = 0;
674  return sceCdStream(0, 0, NULL, CDVD_ST_CMD_STAT, &dummyMode);
675 }
676 #endif
677 
678 #ifdef F_sceCdStPause
679 int sceCdStPause(void)
680 {
681  streamStatus = 0;
682  return sceCdStream(0, 0, NULL, CDVD_ST_CMD_PAUSE, &dummyMode);
683 }
684 #endif
685 
686 #ifdef F_sceCdStResume
687 int sceCdStResume(void)
688 {
689  streamStatus = 0;
690  return sceCdStream(0, 0, NULL, CDVD_ST_CMD_RESUME, &dummyMode);
691 }
692 #endif
693 
695 #ifdef F_sceCdStream
696 int sceCdStream(u32 lbn, u32 nsectors, void *buf, CdvdStCmd_t cmd, sceCdRMode *rm)
697 {
698  if (_CdCheckNCmd(15) == 0)
699  return 0;
700 
701  if (CdDebug > 0)
702  printf("call sceCdreadstm call\n");
703 
704  readStreamData[0] = lbn;
705  readStreamData[1] = nsectors;
706  readStreamData[2] = (u32)buf;
707  readStreamData[3] = cmd;
708  if (rm) {
709  readStreamData[4] = (rm->trycount) | (rm->spindlctrl << 8) | (rm->datapattern << 16);
710  }
711  if (CdDebug > 0)
712  printf("call sceCdreadstm cmd\n");
713 
716  return 0;
717  }
718 
719  if (CdDebug > 0)
720  printf("sceCdread end\n");
722  return *(int *)UNCACHED_SEG(nCmdRecvBuff);
723 }
724 #endif
725 
726 #ifdef F_sceCdCddaStream
727 int sceCdCddaStream(u32 lbn, u32 nsectors, void *buf, CdvdStCmd_t cmd, sceCdRMode *rm)
728 {
729  unsigned int sector_size;
730 
731  if (_CdCheckNCmd(17) == 0)
732  return cmd < CDVD_ST_CMD_INIT ? -1 : 0;
733 
734  if (rm->datapattern == SCECdSecS2368)
735  sector_size = 2368;
736  else
737  sector_size = 2352;
738 
739  readStreamData[0] = lbn;
740  readStreamData[1] = nsectors * sector_size;
741  readStreamData[2] = (u32)buf;
742  readStreamData[3] = cmd;
743  readStreamData[4] = (rm->trycount) | (rm->spindlctrl << 8) | (rm->datapattern << 16);
744 
745  if (cmd == CDVD_ST_CMD_INIT)
747 
748  *cdda_st_buf = 0;
749 
752  return cmd < CDVD_ST_CMD_INIT ? -1 : 0;
753  }
754 
756  return *(int *)UNCACHED_SEG(nCmdRecvBuff);
757 }
758 #endif
759 
760 #ifdef F_sceCdSync
761 int sceCdSync(int mode)
762 {
763  // block till completed mode
764  if (mode == 0) {
765  if (CdDebug > 0)
766  printf("N cmd wait\n");
767 
768  // wait till callback semaphore and client are ready
769  while (cbSema || SifCheckStatRpc(&clientNCmd))
770  ;
771  return 0;
772  }
773  // check status and return
775  return 1;
776 
777  return 0;
778 }
779 #endif
780 
786 #ifdef F__CdCheckNCmd
787 int _CdCheckNCmd(int cmd)
788 {
789  _CdSemaInit();
790  if (PollSema(nCmdSemaId) != nCmdSemaId) {
791  if (CdDebug > 0)
792  printf("Ncmd fail sema cmd:%d keep_cmd:%d\n", cmd, nCmdNum);
793  return 0;
794  }
795 
796  nCmdNum = cmd;
798  if (sceCdSync(1)) {
800  return 0;
801  }
802 
803  SifInitRpc(0);
804  // if already bound, return ok
805  if (bindNCmd >= 0)
806  return 1;
807  // bind rpc for n-commands
808  while (1) {
809  if (SifBindRpc(&clientNCmd, CD_SERVER_NCMD, 0) < 0) {
810  if (CdDebug > 0)
811  printf("Libcdvd bind err N CMD\n");
812  }
813  if (clientNCmd.server != 0)
814  break;
815 
816  nopdelay();
817  }
818 
819  bindNCmd = 0;
820  return 1;
821 }
822 #endif
823 
824 #ifdef F_sceCdReadKey
825 int sceCdReadKey(unsigned char arg1, unsigned char arg2, unsigned int command, unsigned char *key)
826 {
827  int result;
828 
829  if(_CdCheckNCmd(CD_NCMD_READ_KEY)==0) return 0;
830 
831  nCmdSendBuff.readKey.arg1 = arg1;
832  nCmdSendBuff.readKey.arg2 = arg2;
834 
836  memcpy(key, UNCACHED_SEG(&nCmdRecvBuff[4]), 16);
837  result=1;
838  }
839  else{
841  result=0;
842  }
843 
844  return result;
845 }
846 #endif
847 
s32 SignalSema(s32 sema_id)
static void nopdelay(void)
Definition: kernel.h:141
s32 ReferThreadStatus(s32 thread_id, ee_thread_status_t *info)
#define ALIGNED(x)
Definition: kernel.h:50
s32 PollSema(s32 sema_id)
#define UNCACHED_SEG(x)
Definition: kernel.h:35
int sceCdStStop(void)
@ STMBLK
int sceCdReadDVDV(u32 lbn, u32 sectors, void *buffer, sceCdRMode *mode)
@ SCECdSecS2328
@ SCECdSecS2340
@ SCECdSecS2368
@ SCECdSecS2448
@ SCECdNotReady
int sceCdStPause(void)
int sceCdStRead(u32 sectors, u32 *buffer, u32 mode, u32 *error)
int sceCdReadKey(unsigned char arg1, unsigned char arg2, unsigned int command, unsigned char *key)
int sceCdGetToc(u8 *toc)
int sceCdStInit(u32 bufmax, u32 bankmax, void *buffer)
int sceCdPause(void)
int sceCdReadCDDA(u32 lbn, u32 sectors, void *buffer, sceCdRMode *mode)
u32 sceCdGetReadPos(void)
int sceCdSync(int mode)
int sceCdStResume(void)
int sceCdSeek(u32 lbn)
int sceCdStStart(u32 lbn, sceCdRMode *mode)
int sceCdStStat(void)
int sceCdRead(u32 lbn, u32 sectors, void *buffer, sceCdRMode *mode)
int sceCdStandby(void)
int sceCdStSeek(u32 lbn)
int sceCdStop(void)
int sceCdReadChain(sceCdRChain *tag, sceCdRMode *mode)
int sceCdApplyNCmd(u8 cmdNum, const void *inBuff, u16 inBuffSize, void *outBuff, u16 outBuffSize)
int sceCdReadIOPMem(u32 lbn, u32 sectors, void *buf, sceCdRMode *mode)
u32 data
Definition: libmouse.c:36
s32 command
Definition: libpad.c:156
u32 readStreamData[5]
sceCdRMode dummyMode
#define CD_SERVER_NCMD
Definition: ncmd.c:32
u32 _rd_intr_data[64]
int streamStatus
sceCdRChain readChainData[66]
u32 cdda_st_buf[64/sizeof(u32)]
u8 tocBuff[2064]
int bindNcmd
u32 curReadPos
CdvdStCmd_t
Definition: ncmd.c:35
@ CDVD_ST_CMD_STAT
Definition: ncmd.c:41
@ CDVD_ST_CMD_SEEKF
Definition: ncmd.c:44
@ CDVD_ST_CMD_START
Definition: ncmd.c:36
@ CDVD_ST_CMD_READ
Definition: ncmd.c:37
@ CDVD_ST_CMD_SEEK
Definition: ncmd.c:39
@ CDVD_ST_CMD_STOP
Definition: ncmd.c:38
@ CDVD_ST_CMD_INIT
Definition: ncmd.c:40
@ CDVD_ST_CMD_RESUME
Definition: ncmd.c:43
@ CDVD_ST_CMD_PAUSE
Definition: ncmd.c:42
u32 seekSector
int _CdCheckNCmd(int cmd)
u32 getTocSendBuff[3]
void _CdAlignReadBuffer(void *data)
int sceCdNCmdDiskReady(void)
int nCmdNum
int nCmdSemaId
SifRpcClientData_t clientNCmd
u32 readData[6]
u8 nCmdRecvBuff[48]
nCmdSendParams_t nCmdSendBuff
CD_NCMD_CMDS
Definition: ncmd.c:50
@ CD_NCMD_DVDREAD
Definition: ncmd.c:53
@ CD_NCMD_GETTOC
Definition: ncmd.c:54
@ CD_NCMD_SEEK
Definition: ncmd.c:55
@ CD_NCMD_STANDBY
Definition: ncmd.c:56
@ CD_NCMD_PAUSE
Definition: ncmd.c:58
@ CD_NCMD_READ_KEY
Definition: ncmd.c:61
@ CD_NCMD_READIOPMEM
Definition: ncmd.c:63
@ CD_NCMD_READCHAIN
Definition: ncmd.c:66
@ CD_NCMD_STOP
Definition: ncmd.c:57
@ CD_NCMD_CDDAREAD
Definition: ncmd.c:52
@ CD_NCMD_CDDASTREAM
Definition: ncmd.c:60
@ CD_NCMD_DISKREADY
Definition: ncmd.c:64
@ CD_NCMD_STREAM
Definition: ncmd.c:59
@ CD_NCMD_READ
Definition: ncmd.c:51
@ CD_NCMD_NCMD
Definition: ncmd.c:62
int sceCdStream(u32 lbn, u32 nsectors, void *buf, CdvdStCmd_t cmd, sceCdRMode *rm)
int sceCdCddaStream(u32 lbn, u32 nsectors, void *buf, CdvdStCmd_t cmd, sceCdRMode *rm)
void _CdSemaInit(void)
void _CdGenericCallbackFunction(void *funcNum)
volatile int cbSema
int CdDebug
int bindNCmd
volatile int CdCallbackNum
ee_thread_status_t CdThreadParam
int CdThreadId
s32 mode
Definition: rpc_client.c:15
u8 buffer[128]
Definition: rpc_client.c:19
s32 result
Definition: rpc_client.c:23
void SifWriteBackDCache(void *ptr, int size)
void SifInitRpc(int mode)
int SifCheckStatRpc(SifRpcClientData_t *cd)
#define SIF_RPC_M_NOWAIT
Definition: sifrpc.h:24
int SifBindRpc(SifRpcClientData_t *client, int rpc_number, int mode)
int SifCallRpc(SifRpcClientData_t *client, int rpc_number, int mode, void *send, int ssize, void *receive, int rsize, SifRpcEndFunc_t end_function, void *end_param)
struct t_SifRpcServerData * server
Definition: sifrpc.h:142
u8 src2[16]
Definition: ncmd.c:145
u8 src1[16]
Definition: ncmd.c:144
void * dest1
Definition: ncmd.c:142
void * dest2
Definition: ncmd.c:143
u8 inBuff[16]
Definition: libcdvd-rpc.h:47
#define NULL
Definition: tamtypes.h:91
unsigned int u32
Definition: tamtypes.h:30
unsigned short u16
Definition: tamtypes.h:24
unsigned char u8
Definition: tamtypes.h:23
struct cdvdNcmdParam ncmd
Definition: ncmd.c:72
struct cdvdReadKeyParam readKey
Definition: ncmd.c:73