1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
|
#ifndef _LIBPSXCD_H
#define _LIBPSXCD_H
#include <sys/types.h>
/*
* CD-ROM control commands
*/
#define CdlNop 0x01 /* a.k.a. Getstat */
#define CdlSetloc 0x02
#define CdlPlay 0x03
#define CdlForward 0x04
#define CdlBackward 0x05
#define CdlReadN 0x06
#define CdlStandby 0x07 /* a.k.a. MotorOn */
#define CdlStop 0x08
#define CdlPause 0x09
#define CdlInit 0x0A
#define CdlMute 0x0B
#define CdlDemute 0x0C
#define CdlSetfilter 0x0D
#define CdlSetmode 0x0E
#define CdlGetparam 0x0F
#define CdlGetlocL 0x10
#define CdlGetlocP 0x11
#define CdlSetsession 0x12 /* ORIGINAL CODE */
#define CdlGetTN 0x13
#define CdlGetTD 0x14
#define CdlSeekL 0x15
#define CdlSeekP 0x16
#define CdlTest 0x19 /* ORIGINAL CODE */
#define CdlReadS 0x1B
/*
* CD-ROM status bits
*/
#define CdlStatError 0x01
#define CdlStatStandby 0x02
#define CdlStatSeekError 0x04
#define CdlStatIdError 0x08 /* ORIGINAL CODE */
#define CdlStatShellOpen 0x10
#define CdlStatRead 0x20
#define CdlStatSeek 0x40
#define CdlStatPlay 0x80
/*
* CD-ROM mode bits
*/
#define CdlModeDA 0x01
#define CdlModeAP 0x02
#define CdlModeRept 0x04
#define CdlModeSF 0x08
#define CdlModeSize0 0x10
#define CdlModeSize1 0x20
#define CdlModeRT 0x40
#define CdlModeSpeed 0x80
/*
* CD-ROM interrupt result values
*/
#define CdlNoIntr 0x00
#define CdlDataReady 0x01
#define CdlComplete 0x02
#define CdlAcknowledge 0x03
#define CdlDataEnd 0x04
#define CdlDiskError 0x05
/*
* CD-ROM file system error codes (original)
*/
#define CdlIsoOkay 0x00
#define CdlIsoSeekError 0x01
#define CdlIsoReadError 0x02
#define CdlIsoInvalidFs 0x03
#define CdlIsoLidOpen 0x04
#define btoi(b) ((b)/16*10+(b)%16) /* Convert BCD value to integer */
#define itob(i) ((i)/10*16+(i)%10) /* Convert integer to BCD value */
/*
* CD-ROM disc location struct
*/
typedef struct _CdlLOC
{
u_char minute;
u_char second;
u_char sector;
u_char track;
} CdlLOC;
/*
* CD-ROM audio attenuation struct (volume)
*/
typedef struct _CdlATV
{
u_char val0; /* L -> SPU L */
u_char val1; /* L -> SPU R */
u_char val2; /* R -> SPU R */
u_char val3; /* R -> SPU L */
} CdlATV;
/*
* CD-ROM file information struct
*/
typedef struct _CdlFILE
{
CdlLOC pos;
u_long size;
char name[16];
} CdlFILE;
typedef struct _CdlFILTER
{
u_char file;
u_char chan;
u_short pad;
} CdlFILTER;
/* Directory query context */
typedef void* CdlDIR;
/* Data callback */
typedef void (*CdlCB)(int, u_char *);
#ifdef __cplusplus
extern "C" {
#endif
int CdInit(void);
CdlLOC* CdIntToPos(int i, CdlLOC *p);
int CdPosToInt(CdlLOC *p);
int CdGetToc(CdlLOC *toc);
int CdControl(u_char com, u_char *param, u_char *result);
int CdControlB(u_char com, u_char *param, u_char *result);
int CdControlF(u_char com, u_char *param);
int CdSync(int mode, u_char *result);
u_long CdSyncCallback(CdlCB func);
long CdReadyCallback(CdlCB func);
int CdGetSector(void *madr, int size);
CdlFILE* CdSearchFile(CdlFILE *loc, const char *filename);
int CdRead(int sectors, u_long *buf, int mode);
int CdReadSync(int mode, u_char *result);
u_long CdReadCallback(CdlCB func);
int CdStatus(void);
int CdMode(void);
int CdMix(CdlATV *vol);
/* ORIGINAL CODE */
CdlDIR* CdOpenDir(const char* path);
int CdReadDir(CdlDIR* dir, CdlFILE* file);
void CdCloseDir(CdlDIR* dir);
int CdGetVolumeLabel(char* label);
long* CdAutoPauseCallback(void(*func)());
int CdIsoError();
int CdLoadSession(int session);
#ifdef __cplusplus
}
#endif
#endif /* _LIBPSXCD_H */
|