- Create KD branch. All debugging support is removed in this branch (no symbols,...
[reactos.git] / reactos / include / ddk / ntddcdrm.h
1 /*
2 * ntddcdrm.h
3 *
4 * CDROM IOCTL interface.
5 *
6 * This file is part of the w32api package.
7 *
8 * Contributors:
9 * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
10 *
11 * THIS SOFTWARE IS NOT COPYRIGHTED
12 *
13 * This source code is offered for use in the public domain. You may
14 * use, modify or distribute it freely.
15 *
16 * This code is distributed in the hope that it will be useful but
17 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
18 * DISCLAIMED. This includes but is not limited to warranties of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20 *
21 */
22
23 #ifndef __NTDDCDRM_H
24 #define __NTDDCDRM_H
25
26 #if __GNUC__ >=3
27 #pragma GCC system_header
28 #endif
29
30 #include "ntddstor.h"
31
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35
36 #define IOCTL_CDROM_BASE FILE_DEVICE_CD_ROM
37
38 #define IOCTL_CDROM_CHECK_VERIFY \
39 CTL_CODE(IOCTL_CDROM_BASE, 0x0200, METHOD_BUFFERED, FILE_READ_ACCESS)
40
41 #define IOCTL_CDROM_FIND_NEW_DEVICES \
42 CTL_CODE(IOCTL_CDROM_BASE, 0x0206, METHOD_BUFFERED, FILE_READ_ACCESS)
43
44 #define IOCTL_CDROM_GET_CONTROL \
45 CTL_CODE(IOCTL_CDROM_BASE, 0x000D, METHOD_BUFFERED, FILE_READ_ACCESS)
46
47 #define IOCTL_CDROM_GET_DRIVE_GEOMETRY \
48 CTL_CODE(IOCTL_CDROM_BASE, 0x0013, METHOD_BUFFERED, FILE_READ_ACCESS)
49
50 #define IOCTL_CDROM_GET_LAST_SESSION \
51 CTL_CODE(IOCTL_CDROM_BASE, 0x000E, METHOD_BUFFERED, FILE_READ_ACCESS)
52
53 #define IOCTL_CDROM_GET_VOLUME \
54 CTL_CODE(IOCTL_CDROM_BASE, 0x0005, METHOD_BUFFERED, FILE_READ_ACCESS)
55
56 #define IOCTL_CDROM_PAUSE_AUDIO \
57 CTL_CODE(IOCTL_CDROM_BASE, 0x0003, METHOD_BUFFERED, FILE_READ_ACCESS)
58
59 #define IOCTL_CDROM_PLAY_AUDIO_MSF \
60 CTL_CODE(IOCTL_CDROM_BASE, 0x0006, METHOD_BUFFERED, FILE_READ_ACCESS)
61
62 #define IOCTL_CDROM_RAW_READ \
63 CTL_CODE(IOCTL_CDROM_BASE, 0x000F, METHOD_OUT_DIRECT, FILE_READ_ACCESS)
64
65 #define IOCTL_CDROM_READ_Q_CHANNEL \
66 CTL_CODE(IOCTL_CDROM_BASE, 0x000B, METHOD_BUFFERED, FILE_READ_ACCESS)
67
68 #define IOCTL_CDROM_READ_TOC \
69 CTL_CODE(IOCTL_CDROM_BASE, 0x0000, METHOD_BUFFERED, FILE_READ_ACCESS)
70
71 #define IOCTL_CDROM_READ_TOC_EX \
72 CTL_CODE(IOCTL_CDROM_BASE, 0x0015, METHOD_BUFFERED, FILE_READ_ACCESS)
73
74 #define IOCTL_CDROM_RESUME_AUDIO \
75 CTL_CODE(IOCTL_CDROM_BASE, 0x0004, METHOD_BUFFERED, FILE_READ_ACCESS)
76
77 #define IOCTL_CDROM_SEEK_AUDIO_MSF \
78 CTL_CODE(IOCTL_CDROM_BASE, 0x0001, METHOD_BUFFERED, FILE_READ_ACCESS)
79
80 #define IOCTL_CDROM_SET_VOLUME \
81 CTL_CODE(IOCTL_CDROM_BASE, 0x000A, METHOD_BUFFERED, FILE_READ_ACCESS)
82
83 #define IOCTL_CDROM_SIMBAD \
84 CTL_CODE(IOCTL_CDROM_BASE, 0x1003, METHOD_BUFFERED, FILE_READ_ACCESS)
85
86 #define IOCTL_CDROM_STOP_AUDIO \
87 CTL_CODE(IOCTL_CDROM_BASE, 0x0002, METHOD_BUFFERED, FILE_READ_ACCESS)
88
89
90 #define MAXIMUM_NUMBER_TRACKS 100
91 #define MAXIMUM_CDROM_SIZE 804
92 #define MINIMUM_CDROM_READ_TOC_EX_SIZE 2
93
94 typedef struct _TRACK_DATA {
95 UCHAR Reserved;
96 UCHAR Control : 4;
97 UCHAR Adr : 4;
98 UCHAR TrackNumber;
99 UCHAR Reserved1;
100 UCHAR Address[4];
101 } TRACK_DATA, *PTRACK_DATA;
102
103 /* CDROM_DISK_DATA.DiskData flags */
104 #define CDROM_DISK_AUDIO_TRACK 0x00000001
105 #define CDROM_DISK_DATA_TRACK 0x00000002
106
107 typedef struct _CDROM_DISK_DATA {
108 ULONG DiskData;
109 } CDROM_DISK_DATA, *PCDROM_DISK_DATA;
110
111 typedef struct _CDROM_PLAY_AUDIO_MSF {
112 UCHAR StartingM;
113 UCHAR StartingS;
114 UCHAR StartingF;
115 UCHAR EndingM;
116 UCHAR EndingS;
117 UCHAR EndingF;
118 } CDROM_PLAY_AUDIO_MSF, *PCDROM_PLAY_AUDIO_MSF;
119
120 /* CDROM_READ_TOC_EX.Format constants */
121 #define CDROM_READ_TOC_EX_FORMAT_TOC 0x00
122 #define CDROM_READ_TOC_EX_FORMAT_SESSION 0x01
123 #define CDROM_READ_TOC_EX_FORMAT_FULL_TOC 0x02
124 #define CDROM_READ_TOC_EX_FORMAT_PMA 0x03
125 #define CDROM_READ_TOC_EX_FORMAT_ATIP 0x04
126 #define CDROM_READ_TOC_EX_FORMAT_CDTEXT 0x05
127
128 typedef struct _CDROM_READ_TOC_EX {
129 UCHAR Format : 4;
130 UCHAR Reserved1 : 3;
131 UCHAR Msf : 1;
132 UCHAR SessionTrack;
133 UCHAR Reserved2;
134 UCHAR Reserved3;
135 } CDROM_READ_TOC_EX, *PCDROM_READ_TOC_EX;
136
137 typedef struct _CDROM_SEEK_AUDIO_MSF {
138 UCHAR M;
139 UCHAR S;
140 UCHAR F;
141 } CDROM_SEEK_AUDIO_MSF, *PCDROM_SEEK_AUDIO_MSF;
142
143 /* CDROM_SUB_Q_DATA_FORMAT.Format constants */
144 #define IOCTL_CDROM_SUB_Q_CHANNEL 0x00
145 #define IOCTL_CDROM_CURRENT_POSITION 0x01
146 #define IOCTL_CDROM_MEDIA_CATALOG 0x02
147 #define IOCTL_CDROM_TRACK_ISRC 0x03
148
149 typedef struct _CDROM_SUB_Q_DATA_FORMAT {
150 UCHAR Format;
151 UCHAR Track;
152 } CDROM_SUB_Q_DATA_FORMAT, *PCDROM_SUB_Q_DATA_FORMAT;
153
154 typedef struct _CDROM_TOC {
155 UCHAR Length[2];
156 UCHAR FirstTrack;
157 UCHAR LastTrack;
158 TRACK_DATA TrackData[MAXIMUM_NUMBER_TRACKS];
159 } CDROM_TOC, *PCDROM_TOC;
160
161 #define CDROM_TOC_SIZE sizeof(CDROM_TOC)
162
163 typedef struct _CDROM_TOC_ATIP_DATA_BLOCK {
164 UCHAR CdrwReferenceSpeed : 3;
165 UCHAR Reserved3 : 1;
166 UCHAR WritePower : 3;
167 UCHAR True1 : 1;
168 UCHAR Reserved4 : 6;
169 UCHAR UnrestrictedUse : 1;
170 UCHAR Reserved5 : 1;
171 UCHAR A3Valid : 1;
172 UCHAR A2Valid : 1;
173 UCHAR A1Valid : 1;
174 UCHAR Reserved6 : 3;
175 UCHAR IsCdrw : 1;
176 UCHAR True2 : 1;
177 UCHAR Reserved7;
178 UCHAR LeadInMsf[3];
179 UCHAR Reserved8;
180 UCHAR LeadOutMsf[3];
181 UCHAR Reserved9;
182 UCHAR A1Values[3];
183 UCHAR Reserved10;
184 UCHAR A2Values[3];
185 UCHAR Reserved11;
186 UCHAR A3Values[3];
187 UCHAR Reserved12;
188 } CDROM_TOC_ATIP_DATA_BLOCK, *PCDROM_TOC_ATIP_DATA_BLOCK;
189
190 typedef struct _CDROM_TOC_ATIP_DATA {
191 UCHAR Length[2];
192 UCHAR Reserved1;
193 UCHAR Reserved2;
194 CDROM_TOC_ATIP_DATA_BLOCK Descriptors[0];
195 } CDROM_TOC_ATIP_DATA, *PCDROM_TOC_ATIP_DATA;
196
197 /* CDROM_TOC_CD_TEXT_DATA_BLOCK.PackType constants */
198 #define CDROM_CD_TEXT_PACK_ALBUM_NAME 0x80
199 #define CDROM_CD_TEXT_PACK_PERFORMER 0x81
200 #define CDROM_CD_TEXT_PACK_SONGWRITER 0x82
201 #define CDROM_CD_TEXT_PACK_COMPOSER 0x83
202 #define CDROM_CD_TEXT_PACK_ARRANGER 0x84
203 #define CDROM_CD_TEXT_PACK_MESSAGES 0x85
204 #define CDROM_CD_TEXT_PACK_DISC_ID 0x86
205 #define CDROM_CD_TEXT_PACK_GENRE 0x87
206 #define CDROM_CD_TEXT_PACK_TOC_INFO 0x88
207 #define CDROM_CD_TEXT_PACK_TOC_INFO2 0x89
208 #define CDROM_CD_TEXT_PACK_UPC_EAN 0x8e
209 #define CDROM_CD_TEXT_PACK_SIZE_INFO 0x8f
210
211 typedef struct _CDROM_TOC_CD_TEXT_DATA_BLOCK {
212 UCHAR PackType;
213 UCHAR TrackNumber : 7;
214 UCHAR ExtensionFlag : 1;
215 UCHAR SequenceNumber;
216 UCHAR CharacterPosition : 4;
217 UCHAR BlockNumber : 3;
218 UCHAR Unicode : 1;
219 _ANONYMOUS_UNION union {
220 UCHAR Text[12];
221 WCHAR WText[6];
222 } DUMMYUNIONNAME;
223 UCHAR CRC[2];
224 } CDROM_TOC_CD_TEXT_DATA_BLOCK, *PCDROM_TOC_CD_TEXT_DATA_BLOCK;
225
226 typedef struct _CDROM_TOC_CD_TEXT_DATA {
227 UCHAR Length[2];
228 UCHAR Reserved1;
229 UCHAR Reserved2;
230 CDROM_TOC_CD_TEXT_DATA_BLOCK Descriptors[0];
231 } CDROM_TOC_CD_TEXT_DATA, *PCDROM_TOC_CD_TEXT_DATA;
232
233 /* CDROM_TOC_FULL_TOC_DATA_BLOCK.Adr constants */
234 #define ADR_NO_MODE_INFORMATION 0x0
235 #define ADR_ENCODES_CURRENT_POSITION 0x1
236 #define ADR_ENCODES_MEDIA_CATALOG 0x2
237 #define ADR_ENCODES_ISRC 0x3
238
239 typedef struct _CDROM_TOC_FULL_TOC_DATA_BLOCK {
240 UCHAR SessionNumber;
241 UCHAR Control : 4;
242 UCHAR Adr : 4;
243 UCHAR Reserved1;
244 UCHAR Point;
245 UCHAR MsfExtra[3];
246 UCHAR Zero;
247 UCHAR Msf[3];
248 } CDROM_TOC_FULL_TOC_DATA_BLOCK, *PCDROM_TOC_FULL_TOC_DATA_BLOCK;
249
250 typedef struct _CDROM_TOC_FULL_TOC_DATA {
251 UCHAR Length[2];
252 UCHAR FirstCompleteSession;
253 UCHAR LastCompleteSession;
254 CDROM_TOC_FULL_TOC_DATA_BLOCK Descriptors[0];
255 } CDROM_TOC_FULL_TOC_DATA, *PCDROM_TOC_FULL_TOC_DATA;
256
257 typedef struct _CDROM_TOC_PMA_DATA {
258 UCHAR Length[2];
259 UCHAR Reserved1;
260 UCHAR Reserved2;
261 CDROM_TOC_FULL_TOC_DATA_BLOCK Descriptors[0];
262 } CDROM_TOC_PMA_DATA, *PCDROM_TOC_PMA_DATA;
263
264 /* SUB_Q_HEADER.AudioStatus constants */
265 #define AUDIO_STATUS_NOT_SUPPORTED 0x00
266 #define AUDIO_STATUS_IN_PROGRESS 0x11
267 #define AUDIO_STATUS_PAUSED 0x12
268 #define AUDIO_STATUS_PLAY_COMPLETE 0x13
269 #define AUDIO_STATUS_PLAY_ERROR 0x14
270 #define AUDIO_STATUS_NO_STATUS 0x15
271
272 typedef struct _SUB_Q_HEADER {
273 UCHAR Reserved;
274 UCHAR AudioStatus;
275 UCHAR DataLength[2];
276 } SUB_Q_HEADER, *PSUB_Q_HEADER;
277
278 typedef struct _SUB_Q_MEDIA_CATALOG_NUMBER {
279 SUB_Q_HEADER Header;
280 UCHAR FormatCode;
281 UCHAR Reserved[3];
282 UCHAR Reserved1 : 7;
283 UCHAR Mcval :1;
284 UCHAR MediaCatalog[15];
285 } SUB_Q_MEDIA_CATALOG_NUMBER, *PSUB_Q_MEDIA_CATALOG_NUMBER;
286
287 typedef struct _SUB_Q_TRACK_ISRC {
288 SUB_Q_HEADER Header;
289 UCHAR FormatCode;
290 UCHAR Reserved0;
291 UCHAR Track;
292 UCHAR Reserved1;
293 UCHAR Reserved2 : 7;
294 UCHAR Tcval : 1;
295 UCHAR TrackIsrc[15];
296 } SUB_Q_TRACK_ISRC, *PSUB_Q_TRACK_ISRC;
297
298 typedef struct _SUB_Q_CURRENT_POSITION {
299 SUB_Q_HEADER Header;
300 UCHAR FormatCode;
301 UCHAR Control : 4;
302 UCHAR ADR : 4;
303 UCHAR TrackNumber;
304 UCHAR IndexNumber;
305 UCHAR AbsoluteAddress[4];
306 UCHAR TrackRelativeAddress[4];
307 } SUB_Q_CURRENT_POSITION, *PSUB_Q_CURRENT_POSITION;
308
309 typedef union _SUB_Q_CHANNEL_DATA {
310 SUB_Q_CURRENT_POSITION CurrentPosition;
311 SUB_Q_MEDIA_CATALOG_NUMBER MediaCatalog;
312 SUB_Q_TRACK_ISRC TrackIsrc;
313 } SUB_Q_CHANNEL_DATA, *PSUB_Q_CHANNEL_DATA;
314
315 /* CDROM_AUDIO_CONTROL.LbaFormat constants */
316 #define AUDIO_WITH_PREEMPHASIS 0x1
317 #define DIGITAL_COPY_PERMITTED 0x2
318 #define AUDIO_DATA_TRACK 0x4
319 #define TWO_FOUR_CHANNEL_AUDIO 0x8
320
321 typedef struct _CDROM_AUDIO_CONTROL {
322 UCHAR LbaFormat;
323 USHORT LogicalBlocksPerSecond;
324 } CDROM_AUDIO_CONTROL, *PCDROM_AUDIO_CONTROL;
325
326 typedef struct _VOLUME_CONTROL {
327 UCHAR PortVolume[4];
328 } VOLUME_CONTROL, *PVOLUME_CONTROL;
329
330 typedef enum _TRACK_MODE_TYPE {
331 YellowMode2,
332 XAForm2,
333 CDDA
334 } TRACK_MODE_TYPE, *PTRACK_MODE_TYPE;
335
336 typedef struct __RAW_READ_INFO {
337 LARGE_INTEGER DiskOffset;
338 ULONG SectorCount;
339 TRACK_MODE_TYPE TrackMode;
340 } RAW_READ_INFO, *PRAW_READ_INFO;
341
342 #ifdef __cplusplus
343 }
344 #endif
345
346 #endif /* __NTDDCDRM_H */