1 |
gbeauche |
1.1 |
/* |
2 |
|
|
* cd_defs.h |
3 |
|
|
* |
4 |
|
|
* Basilisk II (C) 1997-1999 Christian Bauer |
5 |
|
|
* |
6 |
|
|
* Windows platform specific code copyright (C) Lauri Pesonen |
7 |
|
|
* |
8 |
|
|
* This program is free software; you can redistribute it and/or modify |
9 |
|
|
* it under the terms of the GNU General Public License as published by |
10 |
|
|
* the Free Software Foundation; either version 2 of the License, or |
11 |
|
|
* (at your option) any later version. |
12 |
|
|
* |
13 |
|
|
* This program is distributed in the hope that it will be useful, |
14 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 |
|
|
* GNU General Public License for more details. |
17 |
|
|
* |
18 |
|
|
* You should have received a copy of the GNU General Public License |
19 |
|
|
* along with this program; if not, write to the Free Software |
20 |
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
21 |
|
|
*/ |
22 |
|
|
|
23 |
|
|
#define MAXIMUM_NUMBER_TRACKS 100 |
24 |
|
|
#define MAXIMUM_CDROM_SIZE 804 |
25 |
|
|
|
26 |
|
|
typedef struct _TRACK_DATA { |
27 |
|
|
UCHAR Reserved; |
28 |
|
|
UCHAR Control : 4; |
29 |
|
|
UCHAR Adr : 4; |
30 |
|
|
UCHAR TrackNumber; |
31 |
|
|
UCHAR Reserved1; |
32 |
|
|
UCHAR Address[4]; |
33 |
|
|
} ATTRIBUTE_PACKED TRACK_DATA, *PTRACK_DATA; |
34 |
|
|
|
35 |
|
|
typedef struct _CDROM_TOC { |
36 |
|
|
UCHAR Length[2]; |
37 |
|
|
UCHAR FirstTrack; |
38 |
|
|
UCHAR LastTrack; |
39 |
|
|
TRACK_DATA TrackData[MAXIMUM_NUMBER_TRACKS]; |
40 |
|
|
} ATTRIBUTE_PACKED CDROM_TOC, *PCDROM_TOC; |
41 |
|
|
|
42 |
|
|
// #include "ntddcdrm.h" |
43 |
|
|
#define IOCTL_CDROM_BASE FILE_DEVICE_CD_ROM |
44 |
|
|
#define IOCTL_CDROM_UNLOAD_DRIVER CTL_CODE(IOCTL_CDROM_BASE, 0x0402, METHOD_BUFFERED, FILE_READ_ACCESS) |
45 |
|
|
// |
46 |
|
|
// CDROM Audio Device Control Functions |
47 |
|
|
// |
48 |
|
|
#define IOCTL_CDROM_READ_TOC CTL_CODE(IOCTL_CDROM_BASE, 0x0000, METHOD_BUFFERED, FILE_READ_ACCESS) |
49 |
|
|
#define IOCTL_CDROM_GET_CONTROL CTL_CODE(IOCTL_CDROM_BASE, 0x000D, METHOD_BUFFERED, FILE_READ_ACCESS) |
50 |
|
|
#define IOCTL_CDROM_PLAY_AUDIO_MSF CTL_CODE(IOCTL_CDROM_BASE, 0x0006, METHOD_BUFFERED, FILE_READ_ACCESS) |
51 |
|
|
#define IOCTL_CDROM_SEEK_AUDIO_MSF CTL_CODE(IOCTL_CDROM_BASE, 0x0001, METHOD_BUFFERED, FILE_READ_ACCESS) |
52 |
|
|
#define IOCTL_CDROM_STOP_AUDIO CTL_CODE(IOCTL_CDROM_BASE, 0x0002, METHOD_BUFFERED, FILE_READ_ACCESS) |
53 |
|
|
#define IOCTL_CDROM_PAUSE_AUDIO CTL_CODE(IOCTL_CDROM_BASE, 0x0003, METHOD_BUFFERED, FILE_READ_ACCESS) |
54 |
|
|
#define IOCTL_CDROM_RESUME_AUDIO CTL_CODE(IOCTL_CDROM_BASE, 0x0004, METHOD_BUFFERED, FILE_READ_ACCESS) |
55 |
|
|
#define IOCTL_CDROM_GET_VOLUME CTL_CODE(IOCTL_CDROM_BASE, 0x0005, METHOD_BUFFERED, FILE_READ_ACCESS) |
56 |
|
|
#define IOCTL_CDROM_SET_VOLUME CTL_CODE(IOCTL_CDROM_BASE, 0x000A, METHOD_BUFFERED, FILE_READ_ACCESS) |
57 |
|
|
#define IOCTL_CDROM_READ_Q_CHANNEL CTL_CODE(IOCTL_CDROM_BASE, 0x000B, METHOD_BUFFERED, FILE_READ_ACCESS) |
58 |
|
|
#define IOCTL_CDROM_GET_LAST_SESSION CTL_CODE(IOCTL_CDROM_BASE, 0x000E, METHOD_BUFFERED, FILE_READ_ACCESS) |
59 |
|
|
#define IOCTL_CDROM_RAW_READ CTL_CODE(IOCTL_CDROM_BASE, 0x000F, METHOD_OUT_DIRECT, FILE_READ_ACCESS) |
60 |
|
|
#define IOCTL_CDROM_DISK_TYPE CTL_CODE(IOCTL_CDROM_BASE, 0x0010, METHOD_BUFFERED, FILE_ANY_ACCESS) |
61 |
|
|
|
62 |
|
|
typedef struct _VOLUME_CONTROL { |
63 |
|
|
UCHAR PortVolume[4]; |
64 |
|
|
} ATTRIBUTE_PACKED VOLUME_CONTROL, *PVOLUME_CONTROL; |
65 |
|
|
|
66 |
|
|
typedef struct _CDROM_PLAY_AUDIO_MSF { |
67 |
|
|
UCHAR StartingM; |
68 |
|
|
UCHAR StartingS; |
69 |
|
|
UCHAR StartingF; |
70 |
|
|
UCHAR EndingM; |
71 |
|
|
UCHAR EndingS; |
72 |
|
|
UCHAR EndingF; |
73 |
|
|
} ATTRIBUTE_PACKED CDROM_PLAY_AUDIO_MSF, *PCDROM_PLAY_AUDIO_MSF; |
74 |
|
|
|
75 |
|
|
typedef struct _CDROM_SEEK_AUDIO_MSF { |
76 |
|
|
UCHAR M; |
77 |
|
|
UCHAR S; |
78 |
|
|
UCHAR F; |
79 |
|
|
} ATTRIBUTE_PACKED CDROM_SEEK_AUDIO_MSF, *PCDROM_SEEK_AUDIO_MSF; |
80 |
|
|
|
81 |
|
|
|
82 |
|
|
// |
83 |
|
|
// CD ROM Sub-Q Channel Data Format |
84 |
|
|
// |
85 |
|
|
|
86 |
|
|
typedef struct _SUB_Q_HEADER { |
87 |
|
|
UCHAR Reserved; |
88 |
|
|
UCHAR AudioStatus; |
89 |
|
|
UCHAR DataLength[2]; |
90 |
|
|
} ATTRIBUTE_PACKED SUB_Q_HEADER, *PSUB_Q_HEADER; |
91 |
|
|
|
92 |
|
|
typedef struct _SUB_Q_CURRENT_POSITION { |
93 |
|
|
SUB_Q_HEADER Header; |
94 |
|
|
UCHAR FormatCode; |
95 |
|
|
UCHAR Control : 4; |
96 |
|
|
UCHAR ADR : 4; |
97 |
|
|
UCHAR TrackNumber; |
98 |
|
|
UCHAR IndexNumber; |
99 |
|
|
UCHAR AbsoluteAddress[4]; |
100 |
|
|
UCHAR TrackRelativeAddress[4]; |
101 |
|
|
} ATTRIBUTE_PACKED SUB_Q_CURRENT_POSITION, *PSUB_Q_CURRENT_POSITION; |
102 |
|
|
|
103 |
|
|
typedef struct _SUB_Q_MEDIA_CATALOG_NUMBER { |
104 |
|
|
SUB_Q_HEADER Header; |
105 |
|
|
UCHAR FormatCode; |
106 |
|
|
UCHAR Reserved[3]; |
107 |
|
|
UCHAR Reserved1 : 7; |
108 |
|
|
UCHAR Mcval : 1; |
109 |
|
|
UCHAR MediaCatalog[15]; |
110 |
|
|
} ATTRIBUTE_PACKED SUB_Q_MEDIA_CATALOG_NUMBER, *PSUB_Q_MEDIA_CATALOG_NUMBER; |
111 |
|
|
|
112 |
|
|
typedef struct _SUB_Q_TRACK_ISRC { |
113 |
|
|
SUB_Q_HEADER Header; |
114 |
|
|
UCHAR FormatCode; |
115 |
|
|
UCHAR Reserved0; |
116 |
|
|
UCHAR Track; |
117 |
|
|
UCHAR Reserved1; |
118 |
|
|
UCHAR Reserved2 : 7; |
119 |
|
|
UCHAR Tcval : 1; |
120 |
|
|
UCHAR TrackIsrc[15]; |
121 |
|
|
} ATTRIBUTE_PACKED SUB_Q_TRACK_ISRC, *PSUB_Q_TRACK_ISRC; |
122 |
|
|
|
123 |
|
|
typedef union _SUB_Q_CHANNEL_DATA { |
124 |
|
|
SUB_Q_CURRENT_POSITION CurrentPosition; |
125 |
|
|
SUB_Q_MEDIA_CATALOG_NUMBER MediaCatalog; |
126 |
|
|
SUB_Q_TRACK_ISRC TrackIsrc; |
127 |
|
|
} SUB_Q_CHANNEL_DATA, *PSUB_Q_CHANNEL_DATA; |
128 |
|
|
|
129 |
|
|
typedef enum _TRACK_MODE_TYPE { |
130 |
|
|
YellowMode2, |
131 |
|
|
XAForm2, |
132 |
|
|
CDDA |
133 |
|
|
} TRACK_MODE_TYPE, *PTRACK_MODE_TYPE; |
134 |
|
|
|
135 |
|
|
typedef struct __RAW_READ_INFO { |
136 |
|
|
LARGE_INTEGER DiskOffset; |
137 |
|
|
ULONG SectorCount; |
138 |
|
|
TRACK_MODE_TYPE TrackMode; |
139 |
|
|
} ATTRIBUTE_PACKED RAW_READ_INFO, *PRAW_READ_INFO; |
140 |
|
|
|
141 |
|
|
typedef struct _CDROM_SUB_Q_DATA_FORMAT { |
142 |
|
|
UCHAR Format; |
143 |
|
|
UCHAR Track; |
144 |
|
|
} ATTRIBUTE_PACKED CDROM_SUB_Q_DATA_FORMAT, *PCDROM_SUB_Q_DATA_FORMAT; |
145 |
|
|
|
146 |
|
|
#define IOCTL_CDROM_SUB_Q_CHANNEL 0x00 |
147 |
|
|
#define IOCTL_CDROM_CURRENT_POSITION 0x01 |
148 |
|
|
#define IOCTL_CDROM_MEDIA_CATALOG 0x02 |
149 |
|
|
#define IOCTL_CDROM_TRACK_ISRC 0x03 |
150 |
|
|
|
151 |
|
|
#pragma pack() |