/[pcsx2_0.9.7]/trunk/plugins/CDVDpeops/CDVDlib.h
ViewVC logotype

Contents of /trunk/plugins/CDVDpeops/CDVDlib.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 31 - (show annotations) (download)
Tue Sep 7 03:24:11 2010 UTC (9 years, 11 months ago) by william
File MIME type: text/plain
File size: 5882 byte(s)
committing r3113 initial commit again...
1 /*
2 * Original code from libcdvd by Hiryu & Sjeep (C) 2002
3 * Linux kernel headers
4 * Modified by Florin for PCSX2 emu
5 */
6
7 #ifndef _CDVDLIB_H
8 #define _CDVDLIB_H
9
10 #define __WIN32__
11 #define __MSCW32__
12 #define CDVDdefs
13 #include "PS2Etypes.h"
14 #include "PS2Edefs.h"
15
16 // Macros for READ Data pattan
17 #define CdSecS2048 0 // sector size 2048
18 #define CdSecS2328 1 // sector size 2328
19 #define CdSecS2340 2 // sector size 2340
20
21 //#define CD_FRAMESIZE_RAW1 (CD_FRAMESIZE_RAW-CD_SYNC_SIZE) /*2340*/
22 //#define CD_FRAMESIZE_RAW0 (CD_FRAMESIZE_RAW-CD_SYNC_SIZE-CD_HEAD_SIZE) /*2336*/
23 //#define CD_HEAD_SIZE 4 /* header (address) bytes per raw data frame */
24 //#define CD_SUBHEAD_SIZE 8 /* subheader bytes per raw XA data frame */
25 //#define CD_XA_HEAD (CD_HEAD_SIZE+CD_SUBHEAD_SIZE) /* "before data" part of raw XA frame */
26
27 /*
28 * A CD-ROM physical sector size is 2048, 2052, 2056, 2324, 2332, 2336,
29 * 2340, or 2352 bytes long.
30 * Sector types of the standard CD-ROM data formats:
31 *
32 * format sector type user data size (bytes)
33 * -----------------------------------------------------------------------------
34 * 1 (Red Book) CD-DA 2352 (CD_FRAMESIZE_RAW)
35 * 2 (Yellow Book) Mode1 Form1 2048 (CD_FRAMESIZE)
36 * 3 (Yellow Book) Mode1 Form2 2336 (CD_FRAMESIZE_RAW0)
37 * 4 (Green Book) Mode2 Form1 2048 (CD_FRAMESIZE)
38 * 5 (Green Book) Mode2 Form2 2328 (2324+4 spare bytes)
39 *
40 *
41 * The layout of the standard CD-ROM data formats:
42 * -----------------------------------------------------------------------------
43 * - audio (red): | audio_sample_bytes |
44 * | 2352 |
45 *
46 * - data (yellow, mode1): | sync - head - data - EDC - zero - ECC |
47 * | 12 - 4 - 2048 - 4 - 8 - 276 |
48 *
49 * - data (yellow, mode2): | sync - head - data |
50 * | 12 - 4 - 2336 |
51 *
52 * - XA data (green, mode2 form1): | sync - head - sub - data - EDC - ECC |
53 * | 12 - 4 - 8 - 2048 - 4 - 276 |
54 *
55 * - XA data (green, mode2 form2): | sync - head - sub - data - Spare |
56 * | 12 - 4 - 8 - 2324 - 4 |
57 *
58 */
59
60 // Macros for Spindle control
61 #define CdSpinMax 0
62 #define CdSpinNom 1 // Starts reading data at maximum rotational velocity and if a read error occurs, the rotational velocity is reduced.
63 #define CdSpinStm 0 // Recommended stream rotation speed.
64
65 // Macros for TrayReq
66 #define CdTrayOpen 0
67 #define CdTrayClose 1
68 #define CdTrayCheck 2
69
70 /*
71 * Macros for sceCdGetDiskType() //comments translated from japanese;)
72 */
73 #define SCECdIllgalMedia 0xff
74 /* ILIMEDIA (Illegal Media)
75 A non-PS / non-PS2 Disc. */
76 #define SCECdDVDV 0xfe
77 /* DVDV (DVD Video)
78 A non-PS / non-PS2 Disc, but a DVD Video Disc */
79 #define SCECdCDDA 0xfd
80 /* CDDA (CD DA)
81 A non-PS / non-PS2 Disc that include a DA track */
82 #define SCECdPS2DVD 0x14
83 /* PS2DVD PS2 consumer DVD. */
84 #define SCECdPS2CDDA 0x13
85 /* PS2CDDA PS2 consumer CD that includes a DA track */
86 #define SCECdPS2CD 0x12
87 /* PS2CD PS2 consumer CD that does not include a DA track */
88 #define SCECdPSCDDA 0x11
89 /* PSCDDA PS CD that includes a DA track */
90 #define SCECdPSCD 0x10
91 /* PSCD PS CD that does not include a DA track */
92 #define SCECdDETCT 0x01
93 /* DETCT (Detecting) Disc distinction action */
94 #define SCECdNODISC 0x00
95 /* NODISC (No disc) No disc entered */
96
97 /*
98 * Media mode
99 */
100 #define SCECdCD 1
101 #define SCECdDVD 2
102
103 typedef struct {
104 u8 stat; // 0: normal. Any other: error
105 u8 second; // second (BCD value)
106 u8 minute; // minute (BCD value)
107 u8 hour; // hour (BCD value)
108 u8 week; // week (BCD value)
109 u8 day; // day (BCD value)
110 u8 month; // month (BCD value)
111 u8 year; // year (BCD value)
112 } CdCLOCK;
113
114 typedef struct {
115 u32 lsn; // Logical sector number of file
116 u32 size; // File size (in bytes)
117 char name[16]; // Filename
118 u8 date[8]; // 1th: Seconds
119 // 2th: Minutes
120 // 3th: Hours
121 // 4th: Date
122 // 5th: Month
123 // 6th 7th: Year (4 digits)
124 } CdlFILE;
125
126 typedef struct {
127 u8 minute; // Minutes
128 u8 second; // Seconds
129 u8 sector; // Sector
130 u8 track; // Track number
131 } CdlLOCCD;
132
133 typedef struct {
134 u8 trycount; // Read try count (No. of error retries + 1) (0 - 255)
135 u8 spindlctrl; // SCECdSpinStm: Recommended stream rotation speed.
136 // SCECdSpinNom: Starts reading data at maximum rotational velocity and if a read error occurs, the rotational velocity is reduced.
137 u8 datapattern; // SCECdSecS2048: Data size 2048 bytes
138 // SCECdSecS2328: 2328 bytes
139 // SCECdSecS2340: 2340 bytes
140 u8 pad; // Padding data produced by alignment.
141 } CdRMode;
142
143 #if defined(__WIN32__)
144 #pragma pack(1)
145 #endif
146
147 struct TocEntry
148 {
149 u32 fileLBA;
150 u32 fileSize;
151 u8 fileProperties;
152 u8 padding1[3];
153 u8 filename[128+1];
154 u8 date[7];
155 #if defined(__WIN32__)
156 };
157 #else
158 } __attribute__((packed));
159 #endif
160
161 #if defined(__WIN32__)
162 #pragma pack()
163 #endif
164
165 int CDVD_findfile(char* fname, struct TocEntry* tocEntry);
166 /*
167 int CdBreak(void);
168 int CdCallback( void (*func)() );
169 int CdDiskReady(int mode);
170 int CdGetDiskType(void);
171 int CdGetError(void);
172 u32 CdGetReadPos(void);
173 int CdGetToc(u8 *toc);
174 int CdInit(int init_mode);
175 CdlLOCCD *CdIntToPos(int i, CdlLOCCD *p);
176 int CdPause(void);
177 int CdPosToInt(CdlLOCCD *p);*/
178 int CdRead(u32 lsn, u32 sectors, void *buf, CdRMode *mode);
179 int DvdRead(u32 lsn, u32 sectors, void *buf, CdRMode *mode);
180 /*int CdReadClock(CdCLOCK *rtc);
181 int CdSearchFile (CdlFILE *fp, const char *name);
182 int CdSeek(u32 lsn);
183 int CdStandby(void);
184 int CdStatus(void);
185 int CdStop(void);
186 int CdSync(int mode);
187 int CdTrayReq(int mode, u32 *traycnt);
188 */
189 #endif // _CDVDLIB_H

  ViewVC Help
Powered by ViewVC 1.1.22