[UDFS] Svn add some missing files. CORE-9774
[reactos.git] / reactos / drivers / filesystems / udfs / CDRW / cdrw_hw.h
1 ////////////////////////////////////////////////////////////////////
2 // Copyright (C) Alexander Telyatnikov, Ivan Keliukh, Yegor Anchishkin, SKIF Software, 1999-2013. Kiev, Ukraine
3 // All rights reserved
4 ////////////////////////////////////////////////////////////////////
5 /*
6
7 Module Name:
8
9 cdrw_hw.h
10
11 Abstract:
12
13 Here are the structures and defines used for device low level control.
14
15 Environment:
16
17 kernel mode only
18
19 */
20 #ifndef __CDRW_DEVICE_H__
21 #define __CDRW_DEVICE_H__
22
23 #pragma pack(push, 1)
24
25 // Command Descriptor Block. Passed by SCSI controller chip over the SCSI bus
26
27 typedef union _CDB {
28
29 // Generic 6-Byte CDB
30 struct _CDB6 {
31 UCHAR OperationCode;
32 UCHAR Immediate : 1;
33 UCHAR CommandUniqueBits : 4;
34 UCHAR Lun : 3;
35 UCHAR CommandUniqueBytes[3];
36 UCHAR Link : 1;
37 UCHAR Flag : 1;
38 UCHAR Reserved : 4;
39 UCHAR VendorUnique : 2;
40 } CDB6, *PCDB6;
41
42 struct _REQUEST_SENSE {
43 UCHAR OperationCode;
44 UCHAR Reserved0 : 5;
45 UCHAR Lun : 3;
46 UCHAR Reserved1[2];
47 UCHAR AllocationLength;
48 UCHAR Link : 1;
49 UCHAR Flag : 1;
50 UCHAR Reserved2 : 6;
51 } REQUEST_SENSE, *PREQUEST_SENSE;
52
53 // Standard 6-byte CDB
54 struct _CDB6READWRITE {
55 UCHAR OperationCode;
56 UCHAR LBA2 : 5;
57 UCHAR Lun : 3;
58 UCHAR LBA0[2];
59 UCHAR NumOfBlocks;
60 UCHAR Control;
61 } CDB6READWRITE, *PCDB6READWRITE;
62
63 // SCSI Inquiry CDB
64 struct _CDB6INQUIRY {
65 UCHAR OperationCode;
66 UCHAR Reserved1 : 5;
67 UCHAR Lun : 3;
68 UCHAR PageCode;
69 UCHAR IReserved;
70 UCHAR AllocationLength;
71 UCHAR Control;
72 } CDB6INQUIRY, *PCDB6INQUIRY;
73
74 // SCSI Format CDB
75
76 struct _ERASE {
77 UCHAR OperationCode;
78 UCHAR Long : 1;
79 UCHAR Immediate : 1;
80 UCHAR Reserved1 : 3;
81 UCHAR Lun : 3;
82 UCHAR Reserved2[3];
83 UCHAR Control;
84 } ERASE, *PERASE;
85
86 #define FormatUnit_Code_Mask 0x07
87 #define FormatUnit_Cmp 0x08
88 #define FormatUnit_Fmt 0x10
89
90 #define FormatUnit_Code_oldCDRW 0x07
91 #define FormatUnit_Code_CD_DVD 0x01
92
93 struct _CDB6FORMAT {
94 UCHAR OperationCode;
95 union {
96 UCHAR Flags;
97 struct {
98 UCHAR FormatCode : 3;
99 UCHAR Cmp:1;
100 UCHAR Fmt:1;
101 UCHAR Lun : 3;
102 } Fields;
103 } Byte1;
104 UCHAR FReserved1;
105 UCHAR Interleave[2];
106 UCHAR FReserved2;
107 } CDB6FORMAT, *PCDB6FORMAT;
108
109 // Standard 10-byte CDB
110 struct _CDB10 {
111 UCHAR OperationCode;
112 UCHAR RelativeAddress : 1;
113 UCHAR Reserved1 : 2;
114 UCHAR ForceUnitAccess : 1;
115 UCHAR DisablePageOut : 1;
116 UCHAR Lun : 3;
117 UCHAR LBA[4];
118 UCHAR Reserved2;
119 UCHAR TransferBlocks[2];
120 UCHAR Control;
121 } CDB10, *PCDB10;
122
123 // CD Rom Audio CDBs
124
125 #define PauseResume_Pause 0x00
126 #define PauseResume_Resume 0x01
127
128 struct _PAUSE_RESUME {
129 UCHAR OperationCode;
130 UCHAR Reserved1 : 5;
131 UCHAR Lun : 3;
132 UCHAR Reserved2[6];
133 UCHAR Action;
134 UCHAR Control;
135 } PAUSE_RESUME, *PPAUSE_RESUME;
136
137 // Read Table of Contents (TOC)
138
139 #define ReadTOC_Format_Mask 0x0f
140 #define ReadTOC_Format_TOC 0x00
141 #define ReadTOC_Format_SesInfo 0x01
142 #define ReadTOC_Format_FullTOC 0x02
143 #define ReadTOC_Format_PMA 0x03
144 #define ReadTOC_Format_ATIP 0x04
145 #define ReadTOC_Format_CdText 0x05
146
147 struct _READ_TOC {
148 UCHAR OperationCode;
149 UCHAR Reserved0 : 1;
150 UCHAR Msf : 1; // HMSF MMC-3
151 UCHAR Reserved1 : 3;
152 UCHAR Lun : 3;
153
154 union {
155 UCHAR Flags;
156 struct {
157 UCHAR Format : 4;
158 UCHAR Reserved : 4;
159 } Fields;
160 } Byte2;
161
162 UCHAR Reserved2[3];
163 UCHAR Start_TrackSes;
164 UCHAR AllocationLength[2];
165 UCHAR Control : 6;
166 UCHAR Format : 2;
167 } READ_TOC, *PREAD_TOC;
168
169 // Read Header
170 struct _READ_HEADER {
171 UCHAR OperationCode;
172 UCHAR Reserved0 : 1;
173 UCHAR Msf : 1; // HMSF MMC-3
174 UCHAR Reserved1 : 3;
175 UCHAR Lun : 3;
176
177 UCHAR LBA[4];
178 UCHAR Reserved2;
179 UCHAR AllocationLength[2];
180 UCHAR Control;
181 } READ_HEADER, *PREAD_HEADER;
182
183 // Play Audio MSF
184 struct _PLAY_AUDIO_MSF {
185 UCHAR OperationCode;
186 UCHAR Reserved1 : 5;
187 UCHAR Lun : 3;
188 UCHAR Reserved2;
189 UCHAR StartingMSF[3];
190 UCHAR EndingMSF[3];
191 UCHAR Control;
192 } PLAY_AUDIO_MSF, *PPLAY_AUDIO_MSF;
193
194 // Read SubChannel Data
195
196 #define SubChannel_SubQ_Header 0x00
197 #define SubChannel_SubQ_Block 0x01
198
199 struct _SUBCHANNEL {
200 UCHAR OperationCode;
201 UCHAR Reserved0 : 1;
202 UCHAR Msf : 1;
203 UCHAR Reserved1 : 3;
204 UCHAR Lun : 3;
205 UCHAR Reserved2 : 6;
206 UCHAR SubQ : 1;
207 UCHAR Reserved3 : 1;
208 UCHAR Format;
209 UCHAR Reserved4[2];
210 UCHAR TrackNumber;
211 UCHAR AllocationLength[2];
212 UCHAR Control;
213 } SUBCHANNEL, *PSUBCHANNEL;
214
215 #define SetStreaming_Type_Performance 0x00
216 #define SetStreaming_Type_DBICacheZone 0x05
217
218 struct _SET_STREAMING {
219 UCHAR OperationCode;
220
221 UCHAR Reserved0[7];
222 UCHAR Type;
223 UCHAR AllocationLength[2];
224
225 UCHAR Control;
226 } SET_STREAMING, *PSET_STREAMING;
227
228 // Read CD (by LBA/MSF). Used by Atapi for raw sector reads.
229
230 #define ReadCD_SecType_Mask 0x1c
231 #define ReadCD_SecType_Any 0x00
232 #define ReadCD_SecType_CDDA 0x04
233 #define ReadCD_SecType_M1 0x08
234 #define ReadCD_SecType_M2 0x0c
235 #define ReadCD_SecType_M2F1 0x10
236 #define ReadCD_SecType_M2F2 0x14
237
238 struct _READ_CD_MSF {
239 UCHAR OperationCode;
240
241 UCHAR Reserved0 : 1;
242 UCHAR DAP : 1;
243 UCHAR ExpectedSectorType : 3;
244 UCHAR Reserved1 : 3;
245
246 UCHAR Reserved2;
247 UCHAR Starting_MSF[3];
248 UCHAR Ending_MSF[3];
249
250 UCHAR Reserved3 : 1;
251 UCHAR ErrorFlags : 2;
252 UCHAR IncludeEDC : 1;
253 UCHAR IncludeUserData : 1;
254 UCHAR HeaderCode : 2;
255 UCHAR IncludeSyncData : 1;
256
257 UCHAR SubChannelSelection : 3;
258 UCHAR Reserved4 : 5;
259
260 UCHAR Control;
261 } READ_CD_MSF, *PREAD_CD_MSF;
262
263 struct _READ_CD {
264 UCHAR OperationCode;
265
266 UCHAR RelAdr : 1; // must be 0
267 UCHAR DAP : 1; // Digital Audio Play - enable mute & interpolate when reading CDDA
268 UCHAR ExpectedSectorType : 3;
269 UCHAR Reserved1 : 3;
270
271 UCHAR LBA[4];
272 UCHAR NumOfBlocks[3];
273
274 UCHAR Reserved3 : 1;
275 UCHAR ErrorFlags : 2;
276 UCHAR IncludeEDC : 1;
277 UCHAR IncludeUserData : 1;
278 UCHAR HeaderCode : 2;
279 UCHAR IncludeSyncData : 1;
280
281 UCHAR SubChannelSelection : 3;
282 UCHAR Reserved4 : 5;
283
284 UCHAR Control;
285 } READ_CD, *PREAD_CD;
286
287 #define WriteCd_RELADR 0x01
288 #define WriteCd_FUA 0x08
289 #define WriteCd_DPO 0x10
290
291 struct _WRITE_CD {
292 UCHAR OperationCode;
293 union {
294 UCHAR Flags;
295 struct {
296 UCHAR RELADR : 1;
297 UCHAR Reserved0 : 2;
298 UCHAR FUA : 1;
299 UCHAR DPO : 1;
300 UCHAR Reserved1 : 3;
301 } Fields;
302 } Byte1;
303 UCHAR LBA [4];
304 UCHAR Reserved1;
305 UCHAR NumOfBlocks [2];
306 UCHAR Reserved2 [3];
307 } WRITE_CD, *PWRITE_CD;
308
309 // Mode sense
310 struct _MODE_SENSE {
311 UCHAR OperationCode;
312 UCHAR Reserved1 : 3;
313 UCHAR Dbd : 1;
314 UCHAR Reserved2 : 1;
315 UCHAR Lun : 3;
316 UCHAR PageCode : 6;
317 UCHAR Pc : 2;
318 UCHAR Reserved3;
319 UCHAR AllocationLength;
320 UCHAR Control;
321 } MODE_SENSE, *PMODE_SENSE;
322
323 // 10 bytes
324 struct _MODE_SENSE10 {
325 UCHAR OperationCode;
326 UCHAR Reserved1 : 3;
327 UCHAR Dbd : 1;
328 UCHAR Reserved2 : 1;
329 UCHAR Lun : 3;
330 UCHAR PageCode : 6;
331 UCHAR Pc : 2;
332 UCHAR Reserved3[4];
333 UCHAR AllocationLength[2];
334 UCHAR Control;
335 } MODE_SENSE10, *PMODE_SENSE10;
336
337 // 6 bytes
338 struct _MODE_SELECT {
339 UCHAR OperationCode;
340 UCHAR SPBit : 1;
341 UCHAR Reserved1 : 3;
342 UCHAR PFBit : 1;
343 UCHAR Lun : 3;
344 UCHAR Reserved2[2];
345 UCHAR ParameterListLength;
346 UCHAR Control;
347 } MODE_SELECT, *PMODE_SELECT;
348
349 struct _MODE_SELECT10 {
350 UCHAR OperationCode;
351 UCHAR SPBit : 1;
352 UCHAR Reserved1 : 3;
353 UCHAR PFBit : 1;
354 UCHAR Lun : 3;
355 UCHAR Reserved2[5];
356 UCHAR ParameterListLength[2];
357 UCHAR Control;
358 } MODE_SELECT10, *PMODE_SELECT10;
359
360 struct _LOGSENSE {
361 UCHAR OperationCode;
362 UCHAR SPBit : 1;
363 UCHAR PPCBit : 1;
364 UCHAR Reserved1 : 3;
365 UCHAR Lun : 3;
366 UCHAR PageCode : 6;
367 UCHAR PCBit : 2;
368 UCHAR Reserved2;
369 UCHAR Reserved3;
370 UCHAR ParameterPointer[2]; // [0]=MSB, [1]=LSB
371 UCHAR AllocationLength[2]; // [0]=MSB, [1]=LSB
372 UCHAR Control;
373 } LOGSENSE, *PLOGSENSE;
374
375 struct _SEEK {
376 UCHAR OperationCode;
377 UCHAR Reserved1 : 5;
378 UCHAR Lun : 3;
379 UCHAR LBA[4];
380 UCHAR Reserved2[3];
381 UCHAR Control;
382 } SEEK, *PSEEK;
383
384 #define StartStop_Start 0x01
385 #define StartStop_Load 0x02
386
387 struct _START_STOP {
388 UCHAR OperationCode;
389 UCHAR Immediate: 1;
390 UCHAR Reserved1 : 4;
391 UCHAR Lun : 3;
392 UCHAR Reserved2[2];
393 UCHAR Start : 1;
394 UCHAR LoadEject : 1;
395 UCHAR Reserved3 : 6;
396 UCHAR Control;
397 } START_STOP, *PSTART_STOP;
398
399 struct _MEDIA_REMOVAL {
400 UCHAR OperationCode;
401 UCHAR Reserved1 : 5;
402 UCHAR Lun : 3;
403 UCHAR Reserved2[2];
404 UCHAR Prevent;
405 UCHAR Control;
406 } MEDIA_REMOVAL, *PMEDIA_REMOVAL;
407
408 //#ifndef WITHOUT_FORMATTER
409 // 10 bytes
410 struct _READ_FORMAT_CAPACITIES {
411 UCHAR OperationCode;
412 union {
413 UCHAR Flags;
414 struct {
415 UCHAR Reserved0 : 5;
416 UCHAR Reserved1 : 3;
417 } Fields;
418 } Byte1;
419 UCHAR Reserved0[5];
420 UCHAR AllocationLength[2];
421 UCHAR Control;
422 } READ_FORMAT_CAPACITIES, *PREAD_FORMAT_CAPACITIES;
423 //#endif //WITHOUT_FORMATTER
424
425 // Atapi 2.5 Changer 12-byte CDBs
426 #define LoadUnload_Start 0x01
427 #define LoadUnload_Load 0x02
428
429 struct _LOAD_UNLOAD {
430 UCHAR OperationCode;
431 UCHAR Immediate : 1;
432 UCHAR Reserved1 : 7;
433 UCHAR Reserved2[2];
434 UCHAR Start : 1;
435 UCHAR LoadEject : 1;
436 UCHAR Reserved3: 6;
437 UCHAR Reserved4[3];
438 UCHAR Slot;
439 UCHAR Reserved5[3];
440 } LOAD_UNLOAD, *PLOAD_UNLOAD;
441
442 struct _MECH_STATUS {
443 UCHAR OperationCode;
444 UCHAR Reserved0[7];
445 UCHAR AllocationLength[2];
446 UCHAR Reserved2[2];
447 } MECH_STATUS, *PMECH_STATUS;
448
449 struct _LOCK_DOOR {
450 UCHAR OperationCode;
451 UCHAR Reserved0[9];
452 } LOCK_DOOR, *PLOCK_DOOR;
453
454 #define EventStat_Immed 0x01
455
456 #define EventStat_Class_OpChange 0x02
457 #define EventStat_Class_PM 0x04
458 #define EventStat_Class_ExternalReq 0x08
459 #define EventStat_Class_Media 0x10
460 #define EventStat_Class_MultiInit 0x20
461 #define EventStat_Class_DevBusy 0x40
462
463 struct _GET_EVENT_STATUS {
464 UCHAR OperationCode;
465 union {
466 UCHAR Flags;
467 struct {
468 UCHAR Immed : 1;
469 UCHAR Reserved0 : 7;
470 } Fields;
471 } Byte1;
472 UCHAR Reserved0[2];
473 UCHAR NotificationClass;
474 UCHAR Reserved1[2];
475 UCHAR AllocationLength[2];
476 UCHAR Control;
477 } GET_EVENT_STATUS, *PGET_EVENT_STATUS;
478
479 #define ReadDiscInfo_Type_Mask 0x07
480 #define ReadDiscInfo_Type_Std 0x00
481 #define ReadDiscInfo_Type_TrkRes 0x01 // MMC-6
482 #define ReadDiscInfo_Type_POWRes 0x02 // MMC-6
483
484 struct _READ_DISC_INFO {
485 UCHAR OperationCode;
486
487 UCHAR DataType : 3; // MMC-6
488 UCHAR Reserved0 : 5;
489
490 UCHAR Reserved1[5];
491 UCHAR AllocationLength[2];
492 UCHAR Reserved2[3];
493 } READ_DISC_INFO, *PREAD_DISC_INFO;
494
495 #define ReadTrackInfo_Type_Mask 0x01
496 #define ReadTrackInfo_Type_LBA 0x00
497 #define ReadTrackInfo_Type_Track 0x01
498 #define ReadTrackInfo_Type_POW 0x02
499
500 #define ReadTrackInfo_LastTrk 0xff
501
502 struct _READ_TRACK_INFO {
503 UCHAR OperationCode;
504 UCHAR Track : 1;
505 UCHAR Reserved0 : 7;
506 UCHAR LBA_TrkNum [4];
507 UCHAR Reserved1;
508 UCHAR AllocationLength[2];
509 UCHAR Reserved2[3];
510 } READ_TRACK_INFO, *PREAD_TRACK_INFO;
511
512 #define ReadTrackInfo3_Type_Mask 0x03
513 #define ReadTrackInfo3_Type_LBA ReadTrackInfo_Type_LBA
514 #define ReadTrackInfo3_Type_Track ReadTrackInfo_Type_Track
515 #define ReadTrackInfo3_Type_Ses 0x02
516
517 #define ReadTrackInfo3_LastTrk ReadTrackInfo_LastTrk
518 #define ReadTrackInfo3_DiscLeadIn 0x00 // for Track type
519
520 struct _READ_TRACK_INFO_3 {
521 UCHAR OperationCode;
522 UCHAR DataType : 2;
523 UCHAR Reserved0 : 6;
524 UCHAR LBA_TrkNum [4];
525 UCHAR Reserved1;
526 UCHAR AllocationLength[2];
527 UCHAR Reserved2[3];
528 } READ_TRACK_INFO_3, *PREAD_TRACK_INFO_3;
529
530 struct _RESERVE_TRACK {
531 UCHAR OperationCode;
532
533 UCHAR ARSV:1; // 0 - size format, 1 - start LBA
534 UCHAR RMZ:1; // 0 - logical track, 1 - U-RMZ (HD-DVD)
535 UCHAR Reserved0:6;
536
537 union {
538 struct {
539 UCHAR Reserved1[3];
540 UCHAR Blocks[4];
541 } Size;
542 struct {
543 UCHAR Start[4];
544 UCHAR Reserved1[3];
545 } LBA;
546 };
547 UCHAR Control;
548 } RESERVE_TRACK, *PRESERVE_TRACK;
549
550 #define CloseTrkSes_Immed 0x01
551
552 #define CloseTrkSes_BGF 0x00 // DVD+RW only
553 #define CloseTrkSes_Trk 0x01 // also stops BGF on MRW disks
554 #define CloseTrkSes_BGF_QCompat 0x02 // ensures 30mm radius of recorded area
555 #define CloseTrkSes_Ses 0x02
556 #define CloseTrkSes_BGF_Compat 0x03
557 #define CloseTrkSes_SesSpec 0x03
558 #define CloseTrkSes_FinSpec 0x05 // MMC-5, DVD+R only
559 #define CloseTrkSes_Fin 0x06 // MMC-5, DVD+R only
560
561 #define CloseTrkSes_LastTrkSes 0xff
562
563 #define CloseTrkSes_Delay 3100000000I64 // 310 s
564
565 struct _CLOSE_TRACK_SESSION {
566 UCHAR OperationCode;
567 union {
568 UCHAR Flags;
569 struct {
570 UCHAR Immed : 1;
571 UCHAR Reserved0 : 7;
572 } Fields;
573 } Byte1;
574 union {
575 UCHAR Flags;
576 struct {
577 UCHAR Track : 1;
578 UCHAR Session : 1;
579 UCHAR Reserved0 : 6;
580 } Fields;
581 } Byte2;
582 UCHAR Reserved1 [2];
583 UCHAR TrackNum;
584 UCHAR Reserved2 [6];
585
586 } CLOSE_TRACK_SESSION, *PCLOSE_TRACK_SESSION;
587
588 struct _SET_CD_SPEED {
589 UCHAR OperationCode;
590 UCHAR RotCtrl : 2;
591
592 #define CdSpeed_RotCtrl_CLV 0x00
593 #define CdSpeed_RotCtrl_CAV 0x01
594
595 UCHAR Reserved0 : 6;
596 UCHAR ReadSpeed [2]; // Kbyte/sec
597 UCHAR WriteSpeed [2]; // Kbyte/sec
598 UCHAR Reserved1[6];
599 } SET_CD_SPEED, *PSET_CD_SPEED;
600
601 #define SyncCache_RELADR 0x01
602 #define SyncCache_Immed 0x02
603
604 struct _SYNCHRONIZE_CACHE {
605 UCHAR OperationCode;
606 union {
607 UCHAR Flags;
608 struct {
609 UCHAR RELADR : 1;
610 UCHAR Immed : 1;
611 UCHAR Reserved0 : 6; // All these are unused by drive
612 } Fields;
613 } Byte1;
614 UCHAR LBA [4];
615 UCHAR Reserved1;
616 UCHAR NumOfBlocks [2];
617 UCHAR Reserved2 [3];
618 /*
619 UCHAR Unused [11];*/
620 } SYNCHRONIZE_CACHE, *PSYNCHRONIZE_CACHE;
621
622 #define BlankMedia_Mask 0x07
623 #define BlankMedia_Complete 0x00
624 #define BlankMedia_Minimal 0x01
625 #define BlankMedia_Track 0x02
626 #define BlankMedia_UnreserveTrack 0x03
627 #define BlankMedia_TrackTail 0x04
628 #define BlankMedia_UncloseLastSes 0x05
629 #define BlankMedia_EraseSes 0x06
630 #define BlankMedia_Immed 0x10
631
632 struct _BLANK_MEDIA {
633 UCHAR OperationCode;
634 union {
635 UCHAR Flags;
636 struct {
637 UCHAR BlankType : 3;
638 UCHAR Reserved0 : 1;
639 UCHAR Immed : 1;
640 UCHAR Reserved1 : 3;
641 } Fields;
642 } Byte1;
643 UCHAR StartAddr_TrkNum [4];
644 UCHAR Reserved2 [6];
645 } BLANK_MEDIA, *PBLANK_MEDIA;
646
647 #define SendKey_ReportAGID 0x00
648 #define SendKey_ChallengeKey 0x01
649 #define SendKey_Key1 0x02
650 #define SendKey_Key2 0x03
651 #define SendKey_TitleKey 0x04
652 #define SendKey_ReportASF 0x05
653 #define SendKey_InvalidateAGID 0x3F
654
655 struct _SEND_KEY {
656 UCHAR OperationCode;
657 UCHAR Reserved1 : 5;
658 UCHAR Lun : 3;
659 UCHAR Reserved2[6];
660 UCHAR ParameterListLength[2];
661 UCHAR KeyFormat : 6;
662 UCHAR AGID : 2;
663 UCHAR Control;
664 } SEND_KEY, *PSEND_KEY;
665
666 struct _REPORT_KEY {
667 UCHAR OperationCode; // 0xA4
668 UCHAR Reserved1 : 5;
669 UCHAR Lun : 3;
670 UCHAR LBA[4]; // for title key
671 UCHAR Reserved2[2];
672 UCHAR AllocationLength[2];
673 UCHAR KeyFormat : 6;
674 UCHAR AGID : 2;
675 UCHAR Control;
676 } REPORT_KEY, *PREPORT_KEY;
677
678 #define ReadDvdStruc_Fmt_PhInfo 0x00
679 #define ReadDvdStruc_Fmt_Copyright_LeadIn 0x01
680 #define ReadDvdStruc_Fmt_DiscKey 0x02
681 #define ReadDvdStruc_Fmt_BurstCuttingArea 0x03
682 #define ReadDvdStruc_Fmt_Manufacturer_LeadIn 0x04
683 #define ReadDvdStruc_Fmt_Copyright_Sector 0x05
684 #define ReadDvdStruc_Fmt_MediaId_BusKey 0x06
685 #define ReadDvdStruc_Fmt_MediaKeyBlock_BusKey 0x07
686 #define ReadDvdStruc_Fmt_DDS_RAM 0x08
687 #define ReadDvdStruc_Fmt_MediumStatus_RAM 0x09
688 #define ReadDvdStruc_Fmt_SpareArea_RAM 0x0a
689 // 0x0b
690 #define ReadDvdStruc_Fmt_LastRMD 0x0c
691 #define ReadDvdStruc_Fmt_RMD 0x0d
692 #define ReadDvdStruc_Fmt_PreRec_LeadIn 0x0e
693 #define ReadDvdStruc_Fmt_MediaId_R_RW 0x0f
694 #define ReadDvdStruc_Fmt_PhFmtInfo_R_RW 0x10
695
696 #define ReadDvdStruc_Fmt_DCB 0x30 //Disc Control Block
697 #define ReadDvdStruc_Fmt_MTA_ECC_pMRW 0x31
698
699 #define ReadDvdStruc_Fmt_WriteProtection 0xc0
700 #define ReadDvdStruc_Fmt_ReadSend_DvdStruc_cap 0xff
701
702 struct _READ_DVD_STRUCTURE {
703 UCHAR OperationCode; // 0xAD
704 UCHAR MediaType : 4; // =1 For BlueRay (BD)
705 UCHAR Reserved1 : 4;
706 UCHAR RMDBlockNumber[4];
707 UCHAR LayerNumber;
708 UCHAR Format;
709 UCHAR AllocationLength[2]; // [0]=MSB, [1]=LSB
710 UCHAR Reserved3 : 6;
711 UCHAR AGID : 2;
712 UCHAR Control;
713 } READ_DVD_STRUCTURE, *PREAD_DVD_STRUCTURE;
714
715 struct _READ_BUFFER_CAPACITY {
716 UCHAR OperationCode;
717 UCHAR Reserved0 [6];
718 UCHAR AllocationLength[2];
719 UCHAR Reserved1 [3];
720 } READ_BUFFER_CAPACITY, *PREAD_BUFFER_CAPACITY;
721
722 struct _GET_CONFIGURATION {
723 UCHAR OperationCode;
724 union {
725 UCHAR Flags;
726 struct {
727 UCHAR RT : 2;
728 UCHAR Reserved0 : 6;
729 } Fields;
730 } Byte1;
731 UCHAR StartFeatureNum [2];
732 UCHAR Reserved0 [3];
733 UCHAR AllocationLength[2];
734 UCHAR Control;
735 } GET_CONFIGURATION, *PGET_CONFIGURATION;
736
737 struct _SET_READ_AHEAD {
738 UCHAR OperationCode;
739 UCHAR Reserved0;
740 UCHAR TriggerLBA[4];
741 UCHAR ReadAheadLBA[4];
742 UCHAR Reserved1;
743 UCHAR Control;
744 } SET_READ_AHEAD, *PSET_READ_AHEAD;
745
746 #define SendOpc_DoOpc 0x01
747
748 struct _SEND_OPC_INFO {
749 UCHAR OperationCode;
750 union {
751 UCHAR Flags;
752 struct {
753 UCHAR DoOpc : 1;
754 UCHAR Reserved0 : 4;
755 UCHAR Reserved1 : 3;
756 } Fields;
757 } Byte1;
758 union {
759 UCHAR Flags;
760 struct {
761 UCHAR Exclude0 : 1; // exclude layer 0
762 UCHAR Exclude1 : 1; // exclude layer 0
763 UCHAR Reserved1 : 6;
764 } Fields;
765 } Byte2;
766 UCHAR Reserved0 [4];
767 UCHAR AllocationLength[2];
768 UCHAR Control;
769 } SEND_OPC_INFO, *PSEND_OPC_INFO;
770
771 struct _SEND_CUE_SHEET {
772 UCHAR OperationCode;
773 UCHAR Reserved0 [5];
774 UCHAR AllocationLength[3];
775 UCHAR Control;
776 } SEND_CUE_SHEET, *PSEND_CUE_SHEET;
777
778 struct _CDB12 {
779 UCHAR OperationCode;
780 UCHAR Params[11];
781 } CDB12, *PCDB12;
782
783 struct _CDB12READWRITE {
784 UCHAR OperationCode;
785 union {
786 UCHAR Flags;
787 struct {
788 UCHAR RELADR : 1;
789 UCHAR Reserved0 : 2;
790 UCHAR FUA : 1;
791 UCHAR DPO : 1;
792 UCHAR Reserved1 : 3;
793 } Fields;
794 } Byte1;
795 UCHAR LBA [4];
796 UCHAR NumOfBlocks [4];
797
798 UCHAR Reserved1 : 7;
799 UCHAR Streaming : 1;
800
801 UCHAR Reserved2;
802 } CDB12READWRITE, *PCDB12READWRITE;
803
804 // Plextor Read CD-DA
805 struct _PLXTR_READ_CDDA {
806 UCHAR OperationCode;
807 UCHAR Reserved0 : 5;
808 UCHAR Lun :3;
809 UCHAR LBA[4];
810 UCHAR TransferBlock[4];
811 UCHAR SubCode;
812 UCHAR Control;
813 } PLXTR_READ_CDDA, *PPLXTR_READ_CDDA;
814
815 // NEC Read CD-DA
816 struct _NEC_READ_CDDA {
817 UCHAR OperationCode;
818 UCHAR Reserved0;
819 UCHAR LBA[4];
820 UCHAR Reserved1;
821 UCHAR TransferBlock[2];
822 UCHAR Control;
823 } NEC_READ_CDDA, *PNEC_READ_CDDA;
824
825 } CDB, *PCDB;
826
827 // Command Descriptor Block constants.
828
829 #define CDB6GENERIC_LENGTH 6
830 #define CDB10GENERIC_LENGTH 10
831 #define CDB12GENERIC_LENGTH 12
832
833 #define MAXIMUM_NUMBER_OF_TRACKS 100
834 #define MAXIMUM_NUMBER_OF_SESSIONS 1024 //maximal number of entries in Read Full TOC
835
836 #define SETBITON 1
837 #define SETBITOFF 0
838
839 // Mode Sense/Select page constants.
840
841 #define MODE_PAGE_ERROR_RECOVERY 0x01
842 #define MODE_PAGE_MRW2 0x03 // fuck, standard commitee claimed new standard
843 #define MODE_PAGE_WRITE_PARAMS 0x05
844 #define MODE_PAGE_VERIFY_ERROR 0x07 // shall not be used
845 #define MODE_PAGE_CACHING 0x08 // undocumented, but used by DirectCd
846 #define MODE_PAGE_MEDIUM_TYPES 0x0B // shall not be used
847 #define MODE_PAGE_CD_DEVICE_PARAMS 0x0D
848 #define MODE_PAGE_CD_AUDIO_CONTROL 0x0E
849 #define MODE_PAGE_POWER_CONDITION 0x1A
850 #define MODE_PAGE_FAIL_REPORT 0x1C
851 #define MODE_PAGE_TIMEOUT_AND_PROTECT 0x1D
852 #define MODE_PAGE_PHILIPS_SECTOR_TYPE 0x21
853 #define MODE_PAGE_CAPABILITIES 0x2A
854 #define MODE_PAGE_MRW 0x2C
855
856 #define MODE_SENSE_RETURN_ALL 0x3f
857
858 #define MODE_SENSE_CURRENT_VALUES 0x00
859 #define MODE_SENSE_CHANGEABLE_VALUES 0x40
860 #define MODE_SENSE_DEFAULT_VAULES 0x80
861 #define MODE_SENSE_SAVED_VALUES 0xc0
862
863 // SCSI CDB operation codes
864
865 #define SCSIOP_TEST_UNIT_READY 0x00
866 #define SCSIOP_REZERO_UNIT 0x01
867 #define SCSIOP_REWIND 0x01
868 #define SCSIOP_REQUEST_BLOCK_ADDR 0x02
869 #define SCSIOP_REQUEST_SENSE 0x03
870 #define SCSIOP_FORMAT_UNIT 0x04
871 #define SCSIOP_READ_BLOCK_LIMITS 0x05
872 #define SCSIOP_REASSIGN_BLOCKS 0x07
873 #define SCSIOP_READ6 0x08
874 #define SCSIOP_RECEIVE 0x08
875 #define SCSIOP_WRITE6 0x0A
876 #define SCSIOP_PRINT 0x0A
877 #define SCSIOP_SEND 0x0A
878 #define SCSIOP_SEEK6 0x0B
879 #define SCSIOP_TRACK_SELECT 0x0B
880 #define SCSIOP_SLEW_PRINT 0x0B
881 #define SCSIOP_SEEK_BLOCK 0x0C
882 #define SCSIOP_PARTITION 0x0D
883 #define SCSIOP_READ_REVERSE 0x0F
884 #define SCSIOP_WRITE_FILEMARKS 0x10
885 #define SCSIOP_FLUSH_BUFFER 0x10
886 #define SCSIOP_SPACE 0x11
887 #define SCSIOP_INQUIRY 0x12
888 #define SCSIOP_VERIFY6 0x13
889 #define SCSIOP_RECOVER_BUF_DATA 0x14
890 #define SCSIOP_MODE_SELECT 0x15
891 #define SCSIOP_RESERVE_UNIT 0x16
892 #define SCSIOP_RELEASE_UNIT 0x17
893 #define SCSIOP_COPY 0x18
894 #define SCSIOP_ERASE 0x19
895 #define SCSIOP_MODE_SENSE 0x1A
896 #define SCSIOP_START_STOP_UNIT 0x1B
897 #define SCSIOP_STOP_PRINT 0x1B
898 #define SCSIOP_LOAD_UNLOAD 0x1B
899 #define SCSIOP_RECEIVE_DIAGNOSTIC 0x1C
900 #define SCSIOP_SEND_DIAGNOSTIC 0x1D
901 #define SCSIOP_MEDIUM_REMOVAL 0x1E
902 #define SCSIOP_READ_FORMAT_CAPACITY 0x23
903 #define SCSIOP_READ_CAPACITY 0x25
904 #define SCSIOP_READ 0x28
905 #define SCSIOP_WRITE 0x2A
906 #define SCSIOP_WRITE_CD 0x2A
907 #define SCSIOP_SEEK 0x2B
908 #define SCSIOP_LOCATE 0x2B
909 #define SCSIOP_ERASE10 0x2C
910 #define SCSIOP_WRITE_VERIFY 0x2E
911 #define SCSIOP_VERIFY 0x2F
912 #define SCSIOP_SEARCH_DATA_HIGH 0x30
913 #define SCSIOP_SEARCH_DATA_EQUAL 0x31
914 #define SCSIOP_SEARCH_DATA_LOW 0x32
915 #define SCSIOP_SET_LIMITS 0x33
916 #define SCSIOP_READ_POSITION 0x34
917 #define SCSIOP_SYNCHRONIZE_CACHE 0x35
918 #define SCSIOP_COMPARE 0x39
919 #define SCSIOP_COPY_COMPARE 0x3A
920 #define SCSIOP_COPY_VERIFY 0x3A
921 #define SCSIOP_WRITE_DATA_BUFF 0x3B
922 #define SCSIOP_READ_DATA_BUFF 0x3C
923 #define SCSIOP_CHANGE_DEFINITION 0x40
924 #define SCSIOP_PLAY_AUDIO10 0x41
925 #define SCSIOP_READ_SUB_CHANNEL 0x42
926 #define SCSIOP_READ_TOC 0x43
927 #define SCSIOP_READ_HEADER 0x44
928 #define SCSIOP_PLAY_AUDIO 0x45
929 #define SCSIOP_GET_CONFIGURATION 0x46
930 #define SCSIOP_PLAY_AUDIO_MSF 0x47
931 #define SCSIOP_PLAY_TRACK_INDEX 0x48
932 #define SCSIOP_PLAY_TRACK_RELATIVE 0x49
933 #define SCSIOP_GET_EVENT_STATUS 0x4A
934 #define SCSIOP_PAUSE_RESUME 0x4B
935 #define SCSIOP_LOG_SELECT 0x4C
936 #define SCSIOP_LOG_SENSE 0x4D
937 #define SCSIOP_STOP_PLAY_SCAN 0x4E
938 #define SCSIOP_READ_DISC_INFO 0x51
939 #define SCSIOP_READ_TRACK_INFO 0x52
940 #define SCSIOP_RESERVE_TRACK 0x53
941 #define SCSIOP_SEND_OPC_INFO 0x54
942 #define SCSIOP_MODE_SELECT10 0x55
943 #define SCSIOP_REPAIR_TRACK 0x58 // obsolete
944 #define SCSIOP_READ_MASTER_CUE 0x59
945 #define SCSIOP_MODE_SENSE10 0x5A
946 #define SCSIOP_CLOSE_TRACK_SESSION 0x5B
947 #define SCSIOP_READ_BUFFER_CAPACITY 0x5C
948 #define SCSIOP_SEND_CUE_SHEET 0x5D
949 #define SCSIOP_BLANK 0xA1
950 #define SCSIOP_SEND_KEY 0xA3
951 #define SCSIOP_REPORT_KEY 0xA4
952 #define SCSIOP_PLAY_AUDIO12 0xA5
953 #define SCSIOP_LOAD_UNLOAD_SLOT 0xA6
954 #define SCSIOP_SET_READ_AHEAD 0xA7
955 #define SCSIOP_READ12 0xA8
956 #define SCSIOP_WRITE12 0xAA
957 #define SCSIOP_SEEK12 0xAB
958 #define SCSIOP_GET_PERFORMANCE 0xAC
959 #define SCSIOP_READ_DVD_STRUCTURE 0xAD
960 #define SCSIOP_WRITE_VERIFY12 0xAE
961 #define SCSIOP_VERIFY12 0xAF
962 #define SCSIOP_SET_STREAMING 0xB6
963 #define SCSIOP_READ_CD_MSF 0xB9
964 #define SCSIOP_SET_CD_SPEED 0xBB
965 #define SCSIOP_MECHANISM_STATUS 0xBD
966 #define SCSIOP_READ_CD 0xBE
967 #define SCSIOP_SEND_DISK_STRUCTURE 0xBF
968 #define SCSIOP_SEND_DVD_STRUCTURE 0xBF // see sub-command field
969 #define SCSIOP_SEND_BD_STRUCTURE 0xBF // see sub-command field
970 #define SCSIOP_DOORLOCK 0xDE // lock door on removable drives
971 #define SCSIOP_DOORUNLOCK 0xDF // unlock door on removable drives
972
973 // If the IMMED bit is 1, status is returned as soon
974 // as the operation is initiated. If the IMMED bit
975 // is 0, status is not returned until the operation
976 // is completed.
977
978 #define CDB_RETURN_ON_COMPLETION 0
979 #define CDB_RETURN_IMMEDIATE 1
980
981 // end_ntminitape
982
983 // CDB Force media access used in extended read and write commands.
984
985 #define CDB_FORCE_MEDIA_ACCESS 0x08
986
987 // Denon CD ROM operation codes
988
989 #define SCSIOP_DENON_EJECT_DISC 0xE6
990 #define SCSIOP_DENON_STOP_AUDIO 0xE7
991 #define SCSIOP_DENON_PLAY_AUDIO 0xE8
992 #define SCSIOP_DENON_READ_TOC 0xE9
993 #define SCSIOP_DENON_READ_SUBCODE 0xEB
994
995 // Philips/Matshushita CD-R(W) operation codes
996
997 #define SCSIOP_PHILIPS_GET_NWA 0xE2
998 #define SCSIOP_PHILIPS_RESERVE_TRACK 0xE4
999 #define SCSIOP_PHILIPS_WRITE_TRACK 0xE6
1000 #define SCSIOP_PHILIPS_LOAD_UNLOAD 0xE7
1001 #define SCSIOP_PHILIPS_CLOSE_TRACK_SESSION 0xE9
1002 #define SCSIOP_PHILIPS_RECOVER_BUF_DATA 0xEC
1003 #define SCSIOP_PHILIPS_READ_SESSION_INFO 0xEE
1004
1005 // Plextor operation codes
1006
1007 #define SCSIOP_PLEXTOR_READ_CDDA 0xD8
1008
1009 // NEC operation codes
1010
1011 #define SCSIOP_NEC_READ_CDDA 0xD4
1012
1013 // SCSI Bus Messages
1014
1015 #define SCSIMESS_ABORT 0x06
1016 #define SCSIMESS_ABORT_WITH_TAG 0x0D
1017 #define SCSIMESS_BUS_DEVICE_RESET 0X0C
1018 #define SCSIMESS_CLEAR_QUEUE 0X0E
1019 #define SCSIMESS_COMMAND_COMPLETE 0X00
1020 #define SCSIMESS_DISCONNECT 0X04
1021 #define SCSIMESS_EXTENDED_MESSAGE 0X01
1022 #define SCSIMESS_IDENTIFY 0X80
1023 #define SCSIMESS_IDENTIFY_WITH_DISCON 0XC0
1024 #define SCSIMESS_IGNORE_WIDE_RESIDUE 0X23
1025 #define SCSIMESS_INITIATE_RECOVERY 0X0F
1026 #define SCSIMESS_INIT_DETECTED_ERROR 0X05
1027 #define SCSIMESS_LINK_CMD_COMP 0X0A
1028 #define SCSIMESS_LINK_CMD_COMP_W_FLAG 0X0B
1029 #define SCSIMESS_MESS_PARITY_ERROR 0X09
1030 #define SCSIMESS_MESSAGE_REJECT 0X07
1031 #define SCSIMESS_NO_OPERATION 0X08
1032 #define SCSIMESS_HEAD_OF_QUEUE_TAG 0X21
1033 #define SCSIMESS_ORDERED_QUEUE_TAG 0X22
1034 #define SCSIMESS_SIMPLE_QUEUE_TAG 0X20
1035 #define SCSIMESS_RELEASE_RECOVERY 0X10
1036 #define SCSIMESS_RESTORE_POINTERS 0X03
1037 #define SCSIMESS_SAVE_DATA_POINTER 0X02
1038 #define SCSIMESS_TERMINATE_IO_PROCESS 0X11
1039
1040 // SCSI Extended Message operation codes
1041
1042 #define SCSIMESS_MODIFY_DATA_POINTER 0X00
1043 #define SCSIMESS_SYNCHRONOUS_DATA_REQ 0X01
1044 #define SCSIMESS_WIDE_DATA_REQUEST 0X03
1045
1046 // SCSI Extended Message Lengths
1047
1048 #define SCSIMESS_MODIFY_DATA_LENGTH 5
1049 #define SCSIMESS_SYNCH_DATA_LENGTH 3
1050 #define SCSIMESS_WIDE_DATA_LENGTH 2
1051
1052 // SCSI extended message structure
1053
1054 typedef struct _SCSI_EXTENDED_MESSAGE {
1055 UCHAR InitialMessageCode;
1056 UCHAR MessageLength;
1057 UCHAR MessageType;
1058 union _EXTENDED_ARGUMENTS {
1059
1060 struct {
1061 UCHAR Modifier[4];
1062 } Modify;
1063
1064 struct {
1065 UCHAR TransferPeriod;
1066 UCHAR ReqAckOffset;
1067 } Synchronous;
1068
1069 struct{
1070 UCHAR Width;
1071 } Wide;
1072 }ExtendedArguments;
1073 }SCSI_EXTENDED_MESSAGE, *PSCSI_EXTENDED_MESSAGE;
1074
1075 // SCSI bus status codes.
1076
1077 #define SCSISTAT_GOOD 0x00
1078 #define SCSISTAT_CHECK_CONDITION 0x02
1079 #define SCSISTAT_CONDITION_MET 0x04
1080 #define SCSISTAT_BUSY 0x08
1081 #define SCSISTAT_INTERMEDIATE 0x10
1082 #define SCSISTAT_INTERMEDIATE_COND_MET 0x14
1083 #define SCSISTAT_RESERVATION_CONFLICT 0x18
1084 #define SCSISTAT_COMMAND_TERMINATED 0x22
1085 #define SCSISTAT_QUEUE_FULL 0x28
1086
1087 // Enable Vital Product Data Flag (EVPD)
1088 // used with INQUIRY command.
1089
1090 #define CDB_INQUIRY_EVPD 0x01
1091
1092 // retry time (in deci-seconds)
1093 #define NOT_READY_RETRY_INTERVAL 20
1094
1095 // Defines for format CDB
1096 #define LUN0_FORMAT_SAVING_DEFECT_LIST 0
1097 #define USE_DEFAULTMSB 0
1098 #define USE_DEFAULTLSB 0
1099
1100 #define START_UNIT_CODE 0x01
1101 #define STOP_UNIT_CODE 0x00
1102
1103 // Inquiry buffer structure. This is the data returned from the target
1104 // after it receives an inquiry.
1105 //
1106 // This structure may be extended by the number of bytes specified
1107 // in the field AdditionalLength. The defined size constant only
1108 // includes fields through ProductRevisionLevel.
1109 //
1110 // The NT SCSI drivers are only interested in the first 36 bytes of data.
1111
1112 #define INQUIRYDATABUFFERSIZE 36
1113
1114 typedef struct _INQUIRYDATA {
1115 UCHAR DeviceType : 5;
1116 UCHAR DeviceTypeQualifier : 3;
1117 UCHAR DeviceTypeModifier : 7;
1118 UCHAR RemovableMedia : 1;
1119 UCHAR Versions;
1120 UCHAR ResponseDataFormat;
1121 UCHAR AdditionalLength;
1122 UCHAR Reserved[2];
1123 UCHAR SoftReset : 1;
1124 UCHAR CommandQueue : 1;
1125 UCHAR Reserved2 : 1;
1126 UCHAR LinkedCommands : 1;
1127 UCHAR Synchronous : 1;
1128 UCHAR Wide16Bit : 1;
1129 UCHAR Wide32Bit : 1;
1130 UCHAR RelativeAddressing : 1;
1131 UCHAR VendorId[8];
1132 UCHAR ProductId[16];
1133 UCHAR ProductRevisionLevel[4];
1134 UCHAR VendorSpecific[20];
1135 UCHAR Reserved3[40];
1136 } INQUIRYDATA, *PINQUIRYDATA;
1137
1138 // Inquiry defines. Used to interpret data returned from target as result
1139 // of inquiry command.
1140
1141 // DeviceType field
1142
1143 #define DIRECT_ACCESS_DEVICE 0x00 // disks
1144 #define SEQUENTIAL_ACCESS_DEVICE 0x01 // tapes
1145 #define PRINTER_DEVICE 0x02 // printers
1146 #define PROCESSOR_DEVICE 0x03 // scanners, printers, etc
1147 #define WRITE_ONCE_READ_MULTIPLE_DEVICE 0x04 // worms
1148 #define READ_ONLY_DIRECT_ACCESS_DEVICE 0x05 // cdroms
1149 #define SCANNER_DEVICE 0x06 // scanners
1150 #define OPTICAL_DEVICE 0x07 // optical disks
1151 #define MEDIUM_CHANGER 0x08 // jukebox
1152 #define COMMUNICATION_DEVICE 0x09 // network
1153 #define LOGICAL_UNIT_NOT_PRESENT_DEVICE 0x7F
1154 #define DEVICE_QUALIFIER_NOT_SUPPORTED 0x03
1155
1156 // DeviceTypeQualifier field
1157
1158 #define DEVICE_CONNECTED 0x00
1159
1160 // Sense Data Format
1161
1162 typedef struct _SENSE_DATA {
1163 UCHAR ErrorCode:7;
1164 UCHAR Valid:1;
1165 UCHAR SegmentNumber;
1166 UCHAR SenseKey:4;
1167 UCHAR Reserved:1;
1168 UCHAR IncorrectLength:1;
1169 UCHAR EndOfMedia:1;
1170 UCHAR FileMark:1;
1171 UCHAR Information[4];
1172 UCHAR AdditionalSenseLength;
1173 UCHAR CommandSpecificInformation[4];
1174 UCHAR AdditionalSenseCode;
1175 UCHAR AdditionalSenseCodeQualifier;
1176 UCHAR FieldReplaceableUnitCode;
1177 UCHAR SenseKeySpecific[3];
1178 } SENSE_DATA, *PSENSE_DATA;
1179
1180 // Default request sense buffer size
1181
1182 #define SENSE_BUFFER_SIZE (sizeof(SENSE_DATA))
1183
1184 // Sense keys
1185
1186 #define SCSI_SENSE_NO_SENSE 0x00
1187 #define SCSI_SENSE_RECOVERED_ERROR 0x01
1188 #define SCSI_SENSE_NOT_READY 0x02
1189 #define SCSI_SENSE_MEDIUM_ERROR 0x03
1190 #define SCSI_SENSE_HARDWARE_ERROR 0x04
1191 #define SCSI_SENSE_ILLEGAL_REQUEST 0x05
1192 #define SCSI_SENSE_UNIT_ATTENTION 0x06
1193 #define SCSI_SENSE_DATA_PROTECT 0x07
1194 #define SCSI_SENSE_BLANK_CHECK 0x08
1195 #define SCSI_SENSE_UNIQUE 0x09
1196 #define SCSI_SENSE_COPY_ABORTED 0x0A
1197 #define SCSI_SENSE_ABORTED_COMMAND 0x0B
1198 #define SCSI_SENSE_EQUAL 0x0C
1199 #define SCSI_SENSE_VOL_OVERFLOW 0x0D
1200 #define SCSI_SENSE_MISCOMPARE 0x0E
1201 #define SCSI_SENSE_RESERVED 0x0F
1202
1203 // Additional Sense codes
1204
1205 // SK = 0x00
1206 #define SCSI_ADSENSE_NO_SENSE 0x00
1207
1208 // SK = 0x01
1209 #define SCSI_ADSENSE_WARNING 0x0B
1210 #define SCSI_ADSENSE_REC_DATA_NOECC 0x17
1211 #define SCSI_ADSENSE_REC_DATA_ECC 0x18
1212 #define SCSI_ADSENSE_ROUNDED_PARAM 0x37
1213 #define SCSI_ADSENSE_FAILURE_PREDICTED 0x5D
1214 #define SCSI_ADSENSE_CD_CONTROL_ERR 0x73
1215
1216 // SK = 0x02
1217 #define SCSI_ADSENSE_LUN_NOT_READY 0x04
1218 #define SCSI_ADSENSE_INCOMPATIBLE_MEDIA 0x30
1219 #define SCSI_ADSENSE_INVALID_MEDIA SCSI_ADSENSE_INCOMPATIBLE_MEDIA // for w2k
1220 #define SCSI_ADSENSE_NO_MEDIA_IN_DEVICE 0x3A
1221 #define SCSI_ADSENSE_POSITION_ERROR 0x3B
1222 #define SCSI_ADSENSE_NOT_SELF_CONFIGURED 0x3E
1223
1224
1225 // SK = 0x03
1226 #define SCSI_ADSENSE_NO_SEEK 0x02
1227 #define SCSI_ADSENSE_NO_REFERENCE 0x06
1228 #define SCSI_ADSENSE_CD_WRITE_ERROR 0x0C
1229 #define SCSI_ADSENSE_CD_READ_ERROR 0x11
1230 #define SCSI_ADSENSE_TRACK_ERROR 0x14
1231 #define SCSI_ADSENSE_SEEK_ERROR 0x15
1232 #define SCSI_ADSENSE_FORMAT_CORRUPTED 0x31
1233 #define SCSI_ADSENSE_ENCLOSURE_FAILURE 0x34
1234 #define SCSI_ADSENSE_ENCLOSURE_SERVICE 0x35
1235 #define SCSI_ADSENSE_ERASE_ERROR 0x51
1236 #define SCSI_ADSENSE_UNRECOVERED_TOC 0x57
1237 #define SCSI_ADSENSE_SESSION_FIXATION 0x71
1238 //#define SCSI_ADSENSE_CD_CONTROL_ERR 0x73 // redefinition
1239
1240 // SK = 0x04
1241 #define SCSI_ADSENSE_CLEAN_REQUEST 0x00
1242 #define SCSI_ADSENSE_SELECT 0x04
1243 #define SCSI_ADSENSE_COMMUNICATION 0x08
1244 #define SCSI_ADSENSE_LOST_STREAMING 0x09
1245 #define SCSI_ADSENSE_SYNC_ERROR 0x1B
1246 #define SCSI_ADSENSE_MECH_ERROR 0x3B
1247 #define SCSI_ADSENSE_LUN_ERROR 0x3E
1248 #define SCSI_ADSENSE_DIAGNOSTIC 0x40
1249 #define SCSI_ADSENSE_INTERNAL 0x44
1250 #define SCSI_ADSENSE_SOFT_RESET 0x46
1251 #define SCSI_ADSENSE_SCSI_PARITY 0x47
1252 #define SCSI_ADSENSE_CMD_PHASE 0x4A
1253 #define SCSI_ADSENSE_DATA_PHASE 0x4B
1254 #define SCSI_ADSENSE_SELF_CONFIG 0x4C
1255 #define SCSI_ADSENSE_MEDIUM_REMOVAL 0x53
1256 #define SCSI_ADSENSE_VOLTAGE 0x65
1257
1258 // SK = 0x05
1259 #define SCSI_ADSENSE_AUDIO_PLAY 0x00
1260 #define SCSI_ADSENSE_MULTISELECT 0x07
1261 #define SCSI_ADSENSE_INVALID_PARAM_LENGTH 0x1A
1262 #define SCSI_ADSENSE_ILLEGAL_COMMAND 0x20
1263 #define SCSI_ADSENSE_ILLEGAL_BLOCK 0x21
1264 #define SCSI_ADSENSE_INVALID_CDB 0x24
1265 #define SCSI_ADSENSE_INVALID_LUN 0x25
1266 #define SCSI_ADSENSE_INVALID_VALUE 0x26
1267 #define SCSI_ADSENSE_WRITE_PROTECT 0x27
1268 #define SCSI_ADSENSE_CANT_DISCONNECT 0x2B
1269 #define SCSI_ADSENSE_INVALID_CMD_SEQUENCE 0x2C
1270 #define SCSI_ADSENSE_INVALID_SESSION_MODE 0x30
1271 #define SCSI_ADSENSE_SAVE_NOT_SUPPORTED 0x35
1272 #define SCSI_ADSENSE_INVALID_BITS_IN_IDENT_MSG 0x3D
1273 #define SCSI_ADSENSE_MSG_ERROR 0x43
1274 //#define SCSI_ADSENSE_MEDIUM_REMOVAL 0x53 // redefinition
1275 #define SCSI_ADSENSE_SYS_RESOURCE_FAILURE 0x55
1276 #define SCSI_ADSENSE_OUT_OF_SPACE 0x63
1277 #define SCSI_ADSENSE_ILLEGAL_MODE_FOR_THIS_TRACK 0x64
1278 #define SCSI_ADSENSE_CD_COPY_ERROR 0x6F
1279 #define SCSI_ADSENSE_INCOMPLETE_DATA 0x72
1280 #define SCSI_ADSENSE_VENDOR_UNIQUE 0x80
1281 #define SCSI_ADSENSE_MUSIC_AREA 0xA0
1282 #define SCSI_ADSENSE_DATA_AREA 0xA1
1283 #define SCSI_ADSENSE_VOLUME_OVERFLOW 0xA7
1284
1285 // SK = 0x06
1286 #define SCSI_ADSENSE_LOG_OVERFLOW 0x0A
1287 #define SCSI_ADSENSE_MEDIUM_CHANGED 0x28
1288 #define SCSI_ADSENSE_BUS_RESET 0x29
1289 #define SCSI_ADSENSE_PARAM_CHANGE 0x2A
1290 #define SCSI_ADSENSE_CMD_CLEARED_BY_ANOTHER 0x2F
1291 #define SCSI_ADSENSE_MEDIA_STATE 0x3B
1292 #define SCSI_ADSENSE_FUNCTIONALTY_CHANGE 0x3F
1293 #define SCSI_ADSENSE_OPERATOR 0x5A
1294 #define SCSI_ADSENSE_MAX_LOG 0x5B
1295 #define SCSI_ADSENSE_POWER 0x5E
1296
1297 // SK = 0x0B
1298 #define SCSI_ADSENSE_READ_LOST_STREAMING 0x11
1299 #define SCSI_ADSENSE_RESELECT_FAILURE 0x45
1300 #define SCSI_ADSENSE_ERR_MSG_DETECTED 0x48
1301 #define SCSI_ADSENSE_INVALID_ERR_MSG 0x49
1302 #define SCSI_ADSENSE_TEGGED_OVERLAPPED 0x4D
1303 #define SCSI_ADSENSE_OVERLAPPED_ATTEMPT 0x4E
1304
1305 // Additional sense code qualifier
1306
1307 #define SCSI_SENSEQ_NO_SENSE 0x00
1308
1309 // SK:ASC = 02:04
1310 //#define SCSI_SENSEQ_NO_SENSE 0x00
1311 #define SCSI_SENSEQ_CAUSE_NOT_REPORTABLE 0x00
1312 #define SCSI_SENSEQ_BECOMING_READY 0x01
1313 #define SCSI_SENSEQ_INIT_COMMAND_REQUIRED 0x02
1314 #define SCSI_SENSEQ_MANUAL_INTERVENTION_REQUIRED 0x03
1315 #define SCSI_SENSEQ_FORMAT_IN_PROGRESS 0x04
1316 #define SCSI_SENSEQ_OPERATION_IN_PROGRESS 0x07
1317 #define SCSI_SENSEQ_LONG_WRITE_IN_PROGRESS 0x08
1318
1319 // SK:ASC = 02:30
1320 #define SCSI_SENSEQ_INCOMPATIBLE_MEDIA_INSTALLED 0x00
1321 #define SCSI_SENSEQ_UNKNOWN_FORMAT 0x01
1322 #define SCSI_SENSEQ_INCOMPATIBLE_FORMAT 0x02
1323 #define SCSI_SENSEQ_CLEANING_CARTRIDGE_INSTALLED 0x03
1324 #define SCSI_SENSEQ_WRITE_UNKNOWN_FORMAT 0x04
1325 #define SCSI_SENSEQ_WRITE_INCOMPATIBLE_FORMAT 0x05
1326 #define SCSI_SENSEQ_FORMAT_INCOMPATIBLE_MEDIUM 0x06
1327 #define SCSI_SENSEQ_CLEANING_FAILURE 0x07
1328
1329 // SK:ASC = 02:3A
1330 #define SCSI_SENSEQ_TRAY_CLOSED 0x01
1331 #define SCSI_SENSEQ_TRAY_OPEN 0x02
1332
1333 // SK:ASC = 03:0C
1334 #define SENSEQ_W_RECOVERY_NEEDED 0x07
1335 #define SENSEQ_W_RECOVERY_FAILED 0x08
1336 #define SENSEQ_LOST_STREAMING 0x09
1337 #define SENSEQ_PADDING_BLOCKS_ADDED 0x0A
1338
1339 // SK:ASC = 03:72, 05:72
1340 //#define SCSI_SENSEQ_NO_SENSE 0x00
1341 #define SCSI_SENSEQ_LEAD_IN_ERROR 0x01
1342 #define SCSI_SENSEQ_LEAD_OUT_ERRROR 0x02
1343 #define SCSI_SENSEQ_INCOMPLETE_TRACK 0x03
1344 #define SCSI_SENSEQ_INCOMPLETE_RESERVED_TRACK 0x04
1345 #define SCSI_SENSEQ_NO_MORE_RESERVATION 0x05
1346
1347 // SK:ASC = 04:3E
1348 #define SCSI_SENSEQ_LUN_FAILURE 0x01
1349 #define SCSI_SENSEQ_LUN_TIMEOUT 0x02
1350
1351 // SK:ASC = 05:21
1352 #define SCSI_SENSEQ_ADDR_OUT_OF_RANGE 0x00
1353 #define SCSI_SENSEQ_INVALID_ELEMENT_ADDR 0x01
1354 #define SCSI_SENSEQ_INVALID_WRITE_ADDR 0x02
1355 #define SCSI_SENSEQ_INVALID_WRITE_CROSS_LAYER_JUMP 0x03
1356
1357 // SK:ASC = 05:26
1358 #define SCSI_SENSEQ_PARAM_NOT_SUPPORTED 0x01
1359 #define SCSI_SENSEQ_PARAM_INVALID_VALUE 0x02
1360 #define SCSI_SENSEQ_THRESHOLD_PARAM_NOT_SUPPORTED 0x03
1361 #define SCSI_SENSEQ_INVALID_RELEASE_OF_PERSISTENT_RESERVATION 0x04
1362
1363 // SK:ASC = 05:27
1364 #define SCSI_SENSEQ_HW_PROTECTION 0x01
1365 #define SCSI_SENSEQ_LUN_SOFT_PROTECTION 0x02
1366 #define SCSI_SENSEQ_ASSOCIATED_PROTECTION 0x03
1367 #define SCSI_SENSEQ_PERSIST_PROTECTION 0x04
1368 #define SCSI_SENSEQ_PERMANENT_PROTECTION 0x05
1369
1370 // SK:ASC = 05:2C
1371 #define SCSI_SENSEQ_PROGRAMM_AREA_NOT_EMPTY 0x03
1372 #define SCSI_SENSEQ_PROGRAMM_AREA_EMPTY 0x04
1373
1374 // SK:ASC = 05:30
1375 //#define SCSI_SENSEQ_INCOMPATIBLE_MEDIA_INSTALLED 0x00
1376 //#define SCSI_SENSEQ_UNKNOWN_FORMAT 0x01
1377 //#define SCSI_SENSEQ_INCOMPATIBLE_FORMAT 0x02
1378 //#define SCSI_SENSEQ_CLEANING_CARTRIDGE_INSTALLED 0x03
1379 //#define SCSI_SENSEQ_WRITE_UNKNOWN_FORMAT 0x04
1380 //#define SCSI_SENSEQ_WRITE_INCOMPATIBLE_FORMAT 0x05
1381 //#define SCSI_SENSEQ_FORMAT_INCOMPATIBLE_MEDIUM 0x06
1382 //#define SCSI_SENSEQ_CLEANING_FAILURE 0x07
1383 #define SCSI_SENSEQ_APP_CODE_MISSMATCH 0x08
1384 #define SCSI_SENSEQ_NOT_FIXED_FOR_APPEND 0x09
1385 #define SCSI_SENSEQ_NOT_FORMATTED 0x10
1386 #define SCSI_SENSEQ_UNSUPPORTED_MEDIA_VERSION 0x11
1387
1388 // SK:ASC = 05:6F
1389 #define SCSI_SENSEQ_AUTHENTICATION_FAILURE 0x00
1390 #define SCSI_SENSEQ_KEY_NOT_PRESENT 0x01
1391 #define SCSI_SENSEQ_KEY_NOT_ESTABLISHED 0x02
1392 #define SCSI_SENSEQ_READ_OF_SCRAMBLED_SECTOR_WITHOUT_AUTHENTICATION 0x03
1393 #define SCSI_SENSEQ_MEDIA_CODE_MISMATCHED_TO_LOGICAL_UNIT 0x04
1394 #define SCSI_SENSEQ_LOGICAL_UNIT_RESET_COUNT_ERROR 0x05
1395
1396 // SK:ASC = 06:28
1397 #define SCSI_SENSEQ_IMPORT_OR_EXPERT_ELEMENT_ACCESS 0x01
1398
1399 // SK:ASC = 06:29
1400 #define SCSI_SENSEQ_POWER_ON 0x01
1401 #define SCSI_SENSEQ_SCSI_BUS 0x02
1402 #define SCSI_SENSEQ_BUS_DEVICE_FUNCTION 0x03
1403 #define SCSI_SENSEQ_DEVICE_INTERNAL 0x04
1404
1405 // SK:ASC = 06:2A
1406 #define SCSI_SENSEQ_MODE_PARAMETERS 0x01
1407 #define SCSI_SENSEQ_LOG_PARAMETERS 0x02
1408 #define SCSI_SENSEQ_RESERVATIONS_PREEMPTED 0x03
1409
1410 // SK:ASC = 06:3B
1411 #define SCSI_SENSEQ_DESTINATION_ELEMENT_FULL 0x0D
1412 #define SCSI_SENSEQ_SOURCE_ELEMENT_EMPTY 0x0E
1413 #define SCSI_SENSEQ_END_OF_MEDIUM 0x0F
1414 #define SCSI_SENSEQ_MAGAZINE_NOT_ACCESSIBLE 0x11
1415 #define SCSI_SENSEQ_MAGAZINE_REMOVED 0x12
1416 #define SCSI_SENSEQ_MAGAZINE_INSERTED 0x13
1417 #define SCSI_SENSEQ_MAGAZINE_LOCKED 0x14
1418 #define SCSI_SENSEQ_MAGAZINE_UNLOCKED 0x15
1419
1420 // SK:ASC = 06:3F
1421 #define SCSI_SENSEQ_MICROCODE 0x01
1422 #define SCSI_SENSEQ_OPERATION_DEFINITION 0x02
1423 #define SCSI_SENSEQ_INQUIRY_DATA 0x03
1424
1425 // SK:ASC = 06:5A
1426 #define SCSI_SENSEQ_MEDIUM_CHANGE_REQ 0x01
1427 #define SCSI_SENSEQ_W_PROTECT_SELECTED 0x02
1428 #define SCSI_SENSEQ_W_PROTECT_PERMITED 0x03
1429
1430 // SK:ASC = 06:5E
1431 #define SCSI_SENSEQ_LOW_POWER_COND 0x00
1432 #define SCSI_SENSEQ_IDLE_BY_TIMER 0x01
1433 #define SCSI_SENSEQ_STANDBY_BY_TIMER 0x02
1434 #define SCSI_SENSEQ_IDLE_BY_CMD 0x03
1435 #define SCSI_SENSEQ_STANDBY_BY_CMD 0x04
1436
1437 #define SCSI_SENSEQ_FILEMARK_DETECTED 0x01
1438 #define SCSI_SENSEQ_SETMARK_DETECTED 0x03
1439 #define SCSI_SENSEQ_END_OF_MEDIA_DETECTED 0x02
1440 #define SCSI_SENSEQ_BEGINNING_OF_MEDIA_DETECTED 0x04
1441
1442 // SK:ASC = 0B:00
1443 #define SCSI_SENSEQ_IO_TERMINATED 0x06
1444
1445
1446 // SCSI IO Device Control Codes
1447
1448 #define FILE_DEVICE_SCSI 0x0000001b
1449
1450 #define IOCTL_SCSI_EXECUTE_IN ((FILE_DEVICE_SCSI << 16) + 0x0011)
1451 #define IOCTL_SCSI_EXECUTE_OUT ((FILE_DEVICE_SCSI << 16) + 0x0012)
1452 #define IOCTL_SCSI_EXECUTE_NONE ((FILE_DEVICE_SCSI << 16) + 0x0013)
1453
1454 // SMART support in atapi
1455
1456 #define IOCTL_SCSI_MINIPORT_SMART_VERSION ((FILE_DEVICE_SCSI << 16) + 0x0500)
1457 #define IOCTL_SCSI_MINIPORT_IDENTIFY ((FILE_DEVICE_SCSI << 16) + 0x0501)
1458 #define IOCTL_SCSI_MINIPORT_READ_SMART_ATTRIBS ((FILE_DEVICE_SCSI << 16) + 0x0502)
1459 #define IOCTL_SCSI_MINIPORT_READ_SMART_THRESHOLDS ((FILE_DEVICE_SCSI << 16) + 0x0503)
1460 #define IOCTL_SCSI_MINIPORT_ENABLE_SMART ((FILE_DEVICE_SCSI << 16) + 0x0504)
1461 #define IOCTL_SCSI_MINIPORT_DISABLE_SMART ((FILE_DEVICE_SCSI << 16) + 0x0505)
1462 #define IOCTL_SCSI_MINIPORT_RETURN_STATUS ((FILE_DEVICE_SCSI << 16) + 0x0506)
1463 #define IOCTL_SCSI_MINIPORT_ENABLE_DISABLE_AUTOSAVE ((FILE_DEVICE_SCSI << 16) + 0x0507)
1464 #define IOCTL_SCSI_MINIPORT_SAVE_ATTRIBUTE_VALUES ((FILE_DEVICE_SCSI << 16) + 0x0508)
1465 #define IOCTL_SCSI_MINIPORT_EXECUTE_OFFLINE_DIAGS ((FILE_DEVICE_SCSI << 16) + 0x0509)
1466
1467 // Read Capacity Data - returned in Big Endian format
1468
1469 typedef struct _READ_CAPACITY_DATA {
1470 ULONG LogicalBlockAddress;
1471 ULONG BytesPerBlock;
1472 } READ_CAPACITY_DATA, *PREAD_CAPACITY_DATA;
1473
1474 typedef struct _CD_SECTOR_HEADER {
1475 UCHAR MSF[3];
1476
1477 // See WParam_SubHdr_xxx
1478
1479 /*
1480 #define WParam_SubHdr_Mode_Mask 0x03
1481 #define WParam_SubHdr_Mode0 0x00
1482 #define WParam_SubHdr_Mode1 0x01
1483 #define WParam_SubHdr_Mode2 0x02
1484 #define WParam_SubHdr_Format_Mask 0xe0
1485 #define WParam_SubHdr_Format_UserData 0x00
1486 #define WParam_SubHdr_Format_RunIn4 0x20
1487 #define WParam_SubHdr_Format_RunIn3 0x40
1488 #define WParam_SubHdr_Format_RunIn2 0x60
1489 #define WParam_SubHdr_Format_RunIn1 0x80
1490 #define WParam_SubHdr_Format_Link 0xa0
1491 #define WParam_SubHdr_Format_RunOut2 0xc0
1492 #define WParam_SubHdr_Format_RunOut1 0xe0
1493 */
1494 union {
1495 UCHAR Flags;
1496 struct {
1497 UCHAR Mode : 2;
1498 UCHAR Reserved : 3;
1499 UCHAR Format : 3;
1500 } Fields;
1501 } Mode;
1502 } CD_SECTOR_HEADER, *PCD_SECTOR_HEADER;
1503
1504 // CD ROM Read Table Of Contents (TOC) structures
1505 // Format 0 - Get table of contents
1506
1507 #define TocControl_TrkMode_Mask WParam_TrkMode_Mask
1508 #define TocControl_TrkMode_Audio WParam_TrkMode_Audio
1509 #define TocControl_TrkMode_Audio_PreEmph WParam_TrkMode_Audio_PreEmph
1510 #define TocControl_TrkMode_Data WParam_TrkMode_Data
1511 #define TocControl_TrkMode_IncrData WParam_TrkMode_IncrData
1512 #define TocControl_TrkMode_QAudio_PreEmph WParam_TrkMode_QAudio_PreEmph
1513 #define TocControl_TrkMode_AllowCpy WParam_TrkMode_AllowCpy
1514
1515 typedef struct _TOC_TRACK_INFO {
1516 UCHAR Reserved;
1517 UCHAR Control : 4;
1518 UCHAR Adr : 4;
1519 UCHAR TrackNum;
1520 UCHAR Reserved1;
1521 UCHAR LBA[4];
1522 } TOC_TRACK_INFO, *PTOC_TRACK_INFO;
1523
1524 typedef struct _READ_TOC_HEADER {
1525 UCHAR Length[2];
1526 UCHAR First_TrackSes;
1527 UCHAR Last_TrackSes;
1528 } READ_TOC_HEADER, *PREAD_TOC_HEADER;
1529
1530 #define TOC_LastTrack_ID 0xAA
1531
1532 typedef struct _READ_TOC_TOC {
1533 READ_TOC_HEADER Tracks;
1534 TOC_TRACK_INFO TrackData[MAXIMUM_NUMBER_OF_TRACKS+1];
1535 } READ_TOC_TOC, *PREAD_TOC_TOC;
1536
1537 // Format 1 - Session Info
1538
1539 typedef struct _READ_TOC_SES {
1540 READ_TOC_HEADER Sessions;
1541 TOC_TRACK_INFO LastSes_1stTrack; // First Track Number In Last Complete Session
1542 } READ_TOC_SES, *PREAD_TOC_SES;
1543
1544 // Format 2,3 - Full TOC, PMA
1545
1546 #define TOC_CTL_Normal 0x00
1547 //#define TOC_CTL_MRW 0x01
1548 #define TOC_CTL_MRWTrackInfo 0x06
1549 #define TOC_CTL_MRWLastSes 0x07
1550
1551 // Ctl = 0
1552 #define TOC_ADR_TrackInfo 0x01
1553 #define TOC_ADR_Internal 0x05
1554 // ?? // Ctl = 1
1555
1556 // ADR = 1
1557 #define POINT_StartPositionOfTrack_Min 0x01
1558 #define POINT_StartPositionOfTrack_Max 0x63
1559 #define POINT_FirstTrackNum 0xA0
1560 #define POINT_LastTrackNum 0xA1
1561 #define POINT_StartPositionOfLeadOut 0xA2
1562 // ADR = 5
1563 #define POINT_SkipInterval_Min 0x01
1564 #define POINT_SkipInterval_Max 0x40
1565 #define POINT_StartPositionOfNextProgramArea 0xB0
1566 #define POINT_NumOfSkips 0xB1
1567 #define POINT_SkipTrackAssignmet_Min 0xB2
1568 #define POINT_SkipTrackAssignmet_Max 0xB4
1569 #define POINT_StartPositionOfFirstLeadIn 0xC0
1570 #define POINT_CopyOfAdditionalAreaInATIP 0xC1
1571 // ADR = 6, Control = 1
1572 // POINT 0x01 - 0x63, 0xA0 - 0xA2 are treated like for ADR = 1
1573 // rest - like for ADR = 5
1574
1575 // ADR = 7, Control = 1
1576 // POINT 0x01 - 0x63 are treated as FirstTrackInLastSession
1577
1578 typedef struct _TOC_SES_INFO {
1579 UCHAR SesNumber;
1580 UCHAR Control : 4;
1581 UCHAR Adr : 4;
1582 UCHAR TNO;
1583 UCHAR POINT;
1584
1585 union {
1586
1587 struct {
1588 UCHAR MSF[3];
1589 UCHAR Reserved;
1590 UCHAR P_MSF[3];
1591 } GENERIC;
1592
1593 // ADR = 1
1594 // or
1595 // ADR = 6, Control = 1
1596 // or
1597 // ADR = 7, Control = 1:
1598
1599 //0x01 - 0x63
1600 struct {
1601 UCHAR ATIME[3];
1602 UCHAR Zero;
1603 UCHAR MSF[3];
1604 } StartPositionOfTrack;
1605
1606 // ADR = 1
1607 // or
1608 // ADR = 6, Control = 1:
1609
1610 //0xA0
1611 #define FullTOC_DiscType_CDDA_or_M1 WParam_SesFmt_CdRom // 0x00
1612 #define FullTOC_DiscType_CDI WParam_SesFmt_CdI // 0x10
1613 #define FullTOC_DiscType_CDXA_M2 WParam_SesFmt_CdRomXa // 0x20
1614
1615 struct {
1616 UCHAR ATIME[3];
1617 UCHAR Zero;
1618 UCHAR FirstTrackNum;
1619 UCHAR DiscType;
1620 UCHAR Zero1;
1621 } FirstTrackNum;
1622
1623 //0xA1
1624 struct {
1625 UCHAR ATIME[3];
1626 UCHAR Zero;
1627 UCHAR LastTrackNum;
1628 UCHAR Zero1[2];
1629 } LastTrackNum;
1630
1631 //0xA2
1632 struct {
1633 UCHAR ATIME[3];
1634 UCHAR Zero;
1635 UCHAR MSF[3];
1636 } StartPositionOfLeadOut;
1637
1638 // ADR = 5:
1639
1640 //0x01 - 0x40
1641 struct {
1642 UCHAR End_MSF[3];
1643 UCHAR Reserved;
1644 UCHAR Start_MSF[3];
1645 } SkipInterval;
1646
1647 // ADR = 5
1648 // or
1649 // ADR = 6, Control = 1:
1650
1651 //0xB0
1652 struct {
1653 UCHAR Program_MSF[3];
1654 UCHAR NumOfPointers_M5;
1655 UCHAR MaxLeadOut_MSF[3];
1656 } StartPositionOfNextProgramArea;
1657
1658 //0xB1
1659 struct {
1660 UCHAR Zero[4];
1661 UCHAR Intervals;
1662 UCHAR Tracks;
1663 UCHAR Zero1;
1664 } NumOfSkips;
1665
1666 //0xB2 - 0xB4
1667 struct {
1668 UCHAR SkipNum[7];
1669 } SkipTrackAsignment;
1670
1671 //0xC0
1672 struct {
1673 UCHAR OptimumRecordingPower;
1674 UCHAR SpecInfoATIP[3];
1675 UCHAR LeadIn_MSF[3];
1676 } StartPositionOfFirstLeadIn;
1677
1678 //0xC1
1679 struct {
1680 UCHAR Bytes[7];
1681 } AdditionalAreaInATIP;
1682
1683 } Params;
1684 } TOC_SES_INFO, *PTOC_SES_INFO;
1685
1686 typedef struct _READ_TOC_FULL_TOC {
1687 READ_TOC_HEADER Sessions;
1688 TOC_SES_INFO SessionData[MAXIMUM_NUMBER_OF_SESSIONS];
1689 } READ_TOC_FULL_TOC, *PREAD_TOC_FULL_TOC;
1690
1691 typedef READ_TOC_FULL_TOC READ_TOC_PMA;
1692 typedef PREAD_TOC_FULL_TOC PREAD_TOC_PMA;
1693
1694 // Format 4 - ATIP
1695
1696 typedef struct _READ_TOC_ATIP {
1697 UCHAR Length[2];
1698 UCHAR Reserved[2];
1699
1700 #define ATIP_SpeedRef_Mask 0x07
1701 #define ATIP_SpeedRef_2X 0x01
1702 #define ATIP_WritingPower_Mask 0x07
1703
1704 union {
1705 UCHAR Flags;
1706 struct {
1707 UCHAR SpeedRef: 3;
1708 UCHAR Reserved: 1;
1709 UCHAR WritingPower: 3;
1710 UCHAR One: 1;
1711 } Fields;
1712 } Flags1;
1713
1714 #define ATIP_URU 0x40
1715
1716 union {
1717 UCHAR Flags;
1718 struct {
1719 UCHAR Reserved: 6;
1720 UCHAR URU: 1;
1721 UCHAR Zero: 1;
1722 } Fields;
1723 } Flags2;
1724
1725 #define ATIP_A1 0x01 // 16-18 are valid
1726 #define ATIP_A2 0x02 // 20-22 are valid
1727 #define ATIP_A3 0x04 // 24-26 are valid
1728 #define ATIP_SubType_Mask 0x38 // shall be set to zero
1729 #define ATIP_Type_Mask 0x40
1730 #define ATIP_Type_CDR 0x00
1731 #define ATIP_Type_CDRW 0x40
1732
1733 union {
1734 UCHAR Flags;
1735 struct {
1736 UCHAR A1: 1;
1737 UCHAR A2: 1;
1738 UCHAR A3: 1;
1739 UCHAR SubType: 3;
1740 UCHAR Type: 1;
1741 UCHAR One: 1;
1742 } Fields;
1743 } DiscType;
1744
1745 UCHAR Reserved0;
1746 UCHAR LeadIn_MSF[3];
1747 UCHAR Reserved1;
1748 UCHAR LeadOut_MSF[3];
1749 UCHAR Reserved2;
1750
1751 #define ATIP_MinSpeedCVL_Mask 0x70
1752 #define ATIP_MinSpeedCVL_2X 0x10
1753 #define ATIP_MaxSpeedCVL_Mask 0x0f
1754 #define ATIP_MaxSpeedCVL_2X 0x01
1755 #define ATIP_MaxSpeedCVL_4X 0x02
1756 #define ATIP_MaxSpeedCVL_6X 0x03
1757 #define ATIP_MaxSpeedCVL_8X 0x04
1758
1759 union {
1760 UCHAR Flags;
1761 struct {
1762 UCHAR MaxSpeedCVL: 4;
1763 UCHAR MinSpeedCVL: 3;
1764 UCHAR Zero: 1;
1765 } Fields;
1766 } Speed;
1767
1768 #define ATIP_Power_Y_Mask 0x0e
1769 #define ATIP_Power_P_Mask 0x70
1770
1771 union {
1772 UCHAR Flags;
1773 struct {
1774 UCHAR Reserved: 1;
1775 UCHAR Y_value: 3;
1776 UCHAR P_factor: 3;
1777 UCHAR Zero: 1;
1778 } Fields;
1779 } Power;
1780
1781 #define ATIP_PW_ratio_Mask 0x70
1782
1783 union {
1784 UCHAR Flags;
1785 struct {
1786 UCHAR Reserved: 4;
1787 UCHAR P_W_ratio: 3;
1788 UCHAR Zero: 1;
1789 } Fields;
1790 } ErasePower;
1791
1792 UCHAR Reserved3;
1793 UCHAR A1_value[3];
1794 UCHAR Reserved4;
1795 UCHAR A2_value[3];
1796 UCHAR Reserved5;
1797 UCHAR A3_value[3];
1798
1799 } READ_TOC_ATIP, *PREAD_TOC_ATIP;
1800
1801 // Format 5 - CD-TEXT
1802
1803 typedef struct _CD_TEXT_PACK_DATA {
1804
1805 #define CdText_ID1_Title 0x80 // ID2 = 0 - Album, ID2 = 1-63 - Track
1806 #define CdText_ID1_Performer 0x81
1807 #define CdText_ID1_Songwriter 0x82
1808 #define CdText_ID1_Composer 0x83
1809 #define CdText_ID1_Arranger 0x84
1810 #define CdText_ID1_Message 0x85
1811 #define CdText_ID1_DiscID 0x86
1812 #define CdText_ID1_GenreInfo 0x87
1813 #define CdText_ID1_TOC 0x88
1814 #define CdText_ID1_TOC2 0x89
1815 #define CdText_ID1_Special 0x8D
1816 #define CdText_ID1_UPC_EAN_ISRC 0x8E
1817 #define CdText_ID1_BlockSizeInfo 0x8F
1818
1819 UCHAR ID1;
1820 UCHAR ID2;
1821 UCHAR ID3;
1822
1823 #define CdText_CharPos_Mask 0x0f
1824 #define CdText_BlkNum_Mask 0x70
1825
1826 union {
1827 UCHAR Flags;
1828 struct {
1829 UCHAR CharPos: 4;
1830 UCHAR BlkNum: 3;
1831 UCHAR DBCC: 1; // used to indicate Double Byte text encoding (Unicode ?)
1832 } Fields;
1833 } BlkNum_CharPos;
1834
1835 UCHAR TextData[12];
1836 UCHAR CRC[2];
1837 } CD_TEXT_PACK_DATA, *PCD_TEXT_PACK_DATA;
1838
1839 typedef struct _READ_TOC_CD_TEXT {
1840 UCHAR Length[2];
1841 UCHAR Reserved[2];
1842 CD_TEXT_PACK_DATA Chunk0;
1843 } READ_TOC_CD_TEXT, *PREAD_TOC_CD_TEXT;
1844
1845 // Read header
1846
1847 #define ReadHeader_CdMode_Audio 0x00
1848 #define ReadHeader_CdMode_Mode1 0x01
1849 #define ReadHeader_CdMode_Mode2 0x02
1850
1851 typedef struct _READ_HEADER_LBA {
1852 UCHAR CdDataMode;
1853 UCHAR Reserved[3];
1854 UCHAR LBA[4];
1855 } READ_HEADER_LBA, *PREAD_HEADER_LBA;
1856
1857 typedef struct _READ_HEADER_MSF {
1858 UCHAR CdDataMode;
1859 UCHAR Reserved[4];
1860 UCHAR MSF[3];
1861 } READ_HEADER_MSF, *PREAD_HEADER_MSF;
1862
1863
1864 // OPC block
1865
1866 typedef struct _OPC_INFO_BLOCK {
1867 UCHAR Speed[2];
1868 UCHAR OpcValue[6];
1869 } OPC_INFO_BLOCK, *POPC_INFO_BLOCK;
1870
1871 // Buffer Capacity format
1872
1873 typedef struct _BUFFER_CAPACITY_BLOCK {
1874 UCHAR DataLength[2];
1875 UCHAR Reserved0[2];
1876 UCHAR BufferLength[4];
1877 UCHAR BlankBufferLength[4];
1878 } BUFFER_CAPACITY_BLOCK, *PBUFFER_CAPACITY_BLOCK;
1879
1880 //#ifndef WITHOUT_FORMATTER
1881 // Format Unit structures
1882
1883 typedef struct _FORMAT_LIST_HEADER {
1884 UCHAR Reserved0;
1885
1886 #define FormatHeader_VS 0x01
1887 #define FormatHeader_Immed 0x02
1888 #define FormatHeader_DSP 0x04
1889 #define FormatHeader_IP 0x08
1890 #define FormatHeader_STPF 0x10
1891 #define FormatHeader_DCRT 0x20
1892 #define FormatHeader_DPRY 0x40
1893 #define FormatHeader_FOV 0x80
1894
1895 union {
1896 UCHAR Flags;
1897 struct {
1898 UCHAR VS: 1;
1899 UCHAR Immed: 1;
1900 UCHAR DSP: 1;
1901 UCHAR IP: 1;
1902 UCHAR STPF: 1;
1903 UCHAR DCRT: 1;
1904 UCHAR DPRY: 1;
1905 UCHAR FOV: 1;
1906 } Fields;
1907 } Flags;
1908 UCHAR FormatDescriptorLength[2]; // =0x0008
1909 } FORMAT_LIST_HEADER, *PFORMAT_LIST_HEADER;
1910
1911 typedef struct _CDRW_FORMAT_DESCRIPTOR {
1912
1913 #define FormatDesc_Grow 0x40
1914 #define FormatDesc_Ses 0x80
1915
1916 union {
1917 UCHAR Flags;
1918 struct {
1919 UCHAR Reserved0: 6;
1920 UCHAR Grow: 1;
1921 UCHAR Ses: 1;
1922 } Fields;
1923 } Flags;
1924 UCHAR Reserved1[3];
1925 UCHAR FormatSize[4];
1926 } CDRW_FORMAT_DESCRIPTOR, *PCDRW_FORMAT_DESCRIPTOR;
1927
1928 typedef struct _DVD_FORMAT_DESCRIPTOR {
1929
1930 UCHAR NumOfBlocks[4];
1931
1932 #define DvdFormatType_Full 0x00
1933 #define DvdFormatType_SpareExpansion 0x01
1934 #define DvdFormatType_ZoneReformat 0x04
1935 #define DvdFormatType_ZoneFormat 0x05
1936 #define DvdFormatType_CD_DVD_RW_Full 0x10
1937 #define DvdFormatType_CD_DVD_RW_GrowSes 0x11
1938 #define DvdFormatType_CD_DVD_RW_AddSes 0x12
1939 #define DvdFormatType_DVD_RW_QuickGrowSes 0x13
1940 #define DvdFormatType_DVD_RW_QuickAddSes 0x14
1941 #define DvdFormatType_DVD_RW_Quick 0x15
1942 #define DvdFormatType_DVD_pRW_Full_3Gb 0x20 // obsolete
1943 #define DvdFormatType_CD_MRW_Full 0x24
1944 #define DvdFormatType_DVD_pRW_basic 0x26
1945 #define DvdFormatType_DDCD_RW_Quick 0x28
1946 #define DvdFormatType_BDRE_Full_Spare 0x30
1947 #define DvdFormatType_BDRE_Full 0x31
1948 #define DvdFormatType_BDR_Full_Spare 0x32
1949
1950 #define DvdFormatSubType_BDRE_QuickReformat 0x00
1951 #define DvdFormatSubType_BDRE_NoCert 0x01
1952 #define DvdFormatSubType_BDRE_FullCert 0x02
1953 #define DvdFormatSubType_BDRE_QuickCert 0x03
1954
1955 #define DvdFormatSubType_BDR_SRMpPOW 0x00
1956 #define DvdFormatSubType_BDR_SRM_POW 0x01
1957 #define DvdFormatSubType_BDR_RRM 0x02
1958
1959 union {
1960 UCHAR Flags;
1961 struct {
1962 UCHAR FormatSubType: 2;
1963 UCHAR FormatType: 6;
1964 } Fields;
1965 } Flags;
1966
1967 /*
1968 #define FormatUnit_MRW_SetNew(desc) { desc->TypeDependent[0] = 0; \
1969 desc->TypeDependent[1] = 0; \
1970 desc->TypeDependent[2] = 0; }
1971
1972 #define FormatUnit_MRW_SetRestart(desc) { desc->TypeDependent[0] = 0; \
1973 desc->TypeDependent[1] = 0; \
1974 desc->TypeDependent[2] = 1; }
1975 */
1976 union {
1977 UCHAR BlockSize [3];
1978 UCHAR TypeDependent [3];
1979 struct {
1980 UCHAR Reserved1 [2];
1981 UCHAR Restart : 1;
1982 UCHAR QuickStart : 1; // MMC-5
1983 UCHAR Reserved2 : 6;
1984 } MRW;
1985 };
1986
1987
1988 } DVD_FORMAT_DESCRIPTOR, *PDVD_FORMAT_DESCRIPTOR;
1989
1990 typedef struct _FORMAT_UNIT_PARAMETER_LIST {
1991 FORMAT_LIST_HEADER Header;
1992 union {
1993 struct {
1994 UCHAR InitPatternDescr[4];
1995 CDRW_FORMAT_DESCRIPTOR CdFormatDescr;
1996 };
1997 DVD_FORMAT_DESCRIPTOR DvdFormatDescr;
1998 };
1999 } FORMAT_UNIT_PARAMETER_LIST, *PFORMAT_UNIT_PARAMETER_LIST;
2000
2001 // define Read Format Capacities info blocks
2002
2003 typedef struct _CAPACITY_LIST_HEADER {
2004 UCHAR Reserved[3];
2005 UCHAR Length;
2006 } CAPACITY_LIST_HEADER, *PCAPACITY_LIST_HEADER;
2007
2008 typedef struct _FORMATTABLE_CAPACITY_DESCRIPTOR {
2009 UCHAR NumOfBlocks [4];
2010 union {
2011 UCHAR Flags;
2012 struct {
2013
2014 #define FormatCapcity_Descr_Reserved 0x00
2015 #define FormatCapcity_Descr_Unformatted 0x01
2016 #define FormatCapcity_Descr_Formatted 0x02
2017 #define FormatCapcity_Descr_NoMedia 0x03
2018
2019 // valid for the 1st descriptor only
2020 UCHAR DescType: 2;
2021
2022 // valid for all descriptors except the 1st one
2023 UCHAR FormatType: 6;
2024
2025 } Fields;
2026 } Flags;
2027 union {
2028 UCHAR BlockSize [3];
2029 UCHAR TypeDependent [3];
2030 };
2031 } FORMATTABLE_CAPACITY_DESCRIPTOR, *PFORMATTABLE_CAPACITY_DESCRIPTOR;
2032
2033 typedef struct _FORMAT_CAPACITIES_DATA {
2034 CAPACITY_LIST_HEADER Header;
2035
2036 #define FormatCap_CurMaxDescrOffset 0x00
2037 #define FormatCap_FormatDescrOffset(i) (i+1)
2038
2039 FORMATTABLE_CAPACITY_DESCRIPTOR Descriptors[1];
2040 } FORMAT_CAPACITIES_DATA, *PFORMAT_CAPACITIES_DATA;
2041
2042 //#endif //WITHOUT_FORMATTER
2043
2044 // Define Event Status info blocks
2045
2046 typedef struct _EVENT_STAT_HEADER {
2047 UCHAR DataLength[2];
2048
2049 #define EventRetStat_Class_Mask 0x07
2050 #define EventRetStat_Class_OpChange 0x01
2051 #define EventRetStat_Class_PM 0x02
2052 #define EventRetStat_Class_ExternReq 0x03
2053 #define EventRetStat_Class_Media 0x04
2054 #define EventRetStat_Class_MultInitiators 0x05
2055 #define EventRetStat_Class_DevBusy 0x06
2056 #define EventRetStat_NEA 0x80
2057
2058 union {
2059 UCHAR Flags;
2060 struct {
2061 UCHAR Class: 3;
2062 UCHAR Reserved0: 4;
2063 UCHAR NEA: 1;
2064 } Fields;
2065 } Flags;
2066
2067 UCHAR SupportedClasses; // see command format
2068
2069 } EVENT_STAT_HEADER, *PEVENT_STAT_HEADER;
2070
2071 typedef struct _EVENT_STAT_OPERATIONAL_BLOCK {
2072
2073 EVENT_STAT_HEADER Header;
2074
2075 #define EventStat_OpEvent_Mask 0x0f
2076
2077 union {
2078 UCHAR Flags;
2079 struct {
2080 UCHAR OpEvent : 4;
2081 UCHAR Reserved0: 4;
2082 } Fields;
2083 } Byte0;
2084
2085 #define EventStat_OpStat_Mask 0x0f
2086 #define EventStat_OpStat_Ready 0x00
2087 #define EventStat_OpStat_TempBusy 0x01
2088 #define EventStat_OpStat_Busy 0x02
2089
2090 union {
2091 UCHAR Flags;
2092 struct {
2093 UCHAR OpStatus : 4;
2094 UCHAR Reserved0 : 3;
2095 UCHAR PersistentPrevent: 1;
2096 } Fields;
2097 } Byte1;
2098
2099 #define EventStat_OpReport_NoChg 0x00
2100 #define EventStat_OpReport_Change 0x01
2101 #define EventStat_OpReport_AddChg 0x02
2102 #define EventStat_OpReport_Reset 0x03
2103 #define EventStat_OpReport_FirmwareChg 0x04 // microcode change
2104 #define EventStat_OpReport_InquiryChg 0x05
2105 #define EventStat_OpReport_CtrlReq 0x06
2106 #define EventStat_OpReport_CtrlRelease 0x07
2107
2108 UCHAR OpReport[2];
2109
2110 } EVENT_STAT_OPERATIONAL_BLOCK, *PEVENT_STAT_OPERATIONAL_BLOCK;
2111
2112 typedef struct _EVENT_STAT_PM_BLOCK {
2113
2114 EVENT_STAT_HEADER Header;
2115
2116 #define EventStat_PowerEvent_Mask 0x0f
2117 #define EventStat_PowerEvent_NoChg 0x00
2118 #define EventStat_PowerEvent_ChgOK 0x01
2119 #define EventStat_PowerEvent_ChgFail 0x02
2120
2121 union {
2122 UCHAR Flags;
2123 struct {
2124 UCHAR PowerEvent : 4;
2125 UCHAR Reserved0 : 4;
2126 } Fields;
2127 } Byte0;
2128
2129 #define EventStat_PowerStat_Mask 0x0f
2130 #define EventStat_PowerStat_Active 0x01
2131 #define EventStat_PowerStat_Idle 0x02
2132 #define EventStat_PowerStat_Standby 0x03
2133 #define EventStat_PowerStat_Sleep 0x04
2134
2135 union {
2136 UCHAR Flags;
2137 struct {
2138 UCHAR PowerStatus: 4;
2139 UCHAR Reserved0 : 4;
2140 } Fields;
2141 } Byte1;
2142
2143 UCHAR Reserved0[2];
2144
2145 } EVENT_STAT_PM_BLOCK, *PEVENT_STAT_PM_BLOCK;
2146
2147 typedef struct _EVENT_STAT_EXT_REQ_BLOCK {
2148
2149 EVENT_STAT_HEADER Header;
2150
2151 #define EventStat_ExtrnReqEvent_Mask 0x0f
2152 #define EventStat_ExtrnReqEvent_None 0x00
2153 #define EventStat_ExtrnReqEvent_KeyDown 0x01
2154 #define EventStat_ExtrnReqEvent_KeyUp 0x02
2155 #define EventStat_ExtrnReqEvent_ExtrnReq 0x03
2156
2157 union {
2158 UCHAR Flags;
2159 struct {
2160 UCHAR ExtrnReqEvent : 4;
2161 UCHAR Reserved0 : 4;
2162 } Fields;
2163 } Byte0;
2164
2165 #define EventStat_ExtrnReqStatus_Mask 0x0f
2166 #define EventStat_ExtrnReqStatus_Ready 0x00
2167 #define EventStat_ExtrnReqStatus_OtherPrevent 0x01
2168
2169 union {
2170 UCHAR Flags;
2171 struct {
2172 UCHAR ExtrnReqStatus : 4;
2173 UCHAR Reserved0 : 3;
2174 UCHAR PersistentPrevent : 1;
2175 } Fields;
2176 } Byte1;
2177
2178 #define EventStat_ExtrnReq_None 0x000
2179 #define EventStat_ExtrnReq_Overrun 0x001
2180 #define EventStat_ExtrnReq_Play 0x101
2181 #define EventStat_ExtrnReq_Rewind 0x102
2182 #define EventStat_ExtrnReq_FastFwd 0x103
2183 #define EventStat_ExtrnReq_Pause 0x104
2184 #define EventStat_ExtrnReq_Stop 0x106
2185 #define EventStat_ExtrnReq_MinASCII 0x200
2186 #define EventStat_ExtrnReq_MaxASCII 0x2ff
2187
2188 UCHAR ExternalReq[2];
2189
2190 } EVENT_STAT_EXT_REQ_BLOCK, *PEVENT_STAT_EXT_REQ_BLOCK;
2191
2192 typedef struct _EVENT_STAT_MEDIA_BLOCK {
2193
2194 EVENT_STAT_HEADER Header;
2195
2196 #define EventStat_MediaEvent_Mask 0x0f
2197 #define EventStat_MediaEvent_None 0x00
2198 #define EventStat_MediaEvent_EjectReq 0x01
2199 #define EventStat_MediaEvent_New 0x02
2200 #define EventStat_MediaEvent_Removal 0x03
2201 #define EventStat_MediaEvent_Chg 0x04
2202 #define EventStat_MediaEvent_BGFormatOk 0x05
2203 #define EventStat_MediaEvent_BGFormatRst 0x06
2204
2205 union {
2206 UCHAR Flags;
2207 struct {
2208 UCHAR MediaEvent : 4;
2209 UCHAR Reserved0 : 4;
2210 } Fields;
2211 } Byte0;
2212
2213 #define EventStat_MediaStat_DoorOpen 0x01
2214 #define EventStat_MediaStat_Present 0x02
2215
2216 union {
2217 UCHAR Flags;
2218 struct {
2219 UCHAR DoorOpen : 1;
2220 UCHAR Present : 1;
2221 UCHAR Reserved0 : 6;
2222 } Fields;
2223 } Byte1;
2224
2225 UCHAR StartSlot;
2226 UCHAR EndSlot;
2227
2228 } EVENT_STAT_MEDIA_BLOCK, *PEVENT_STAT_MEDIA_BLOCK;
2229
2230 typedef struct _EVENT_STAT_DEV_BUSY_BLOCK {
2231
2232 EVENT_STAT_HEADER Header;
2233
2234 #define EventStat_BusyEvent_Mask 0x0f
2235 #define EventStat_BusyEvent_None 0x00
2236 #define EventStat_BusyEvent_Busy 0x01
2237
2238 union {
2239 UCHAR Flags;
2240 struct {
2241 UCHAR BusyEvent : 4;
2242 UCHAR Reserved0 : 4;
2243 } Fields;
2244 } Byte0;
2245
2246 #define EventStat_BusyStat_Mask 0x0f
2247 #define EventStat_BusyStat_NoEvent 0x00
2248 #define EventStat_BusyStat_Power 0x01
2249 #define EventStat_BusyStat_Immed 0x02
2250 #define EventStat_BusyStat_Deferred 0x03
2251
2252 union {
2253 UCHAR Flags;
2254 struct {
2255 UCHAR BusyStatus: 4;
2256 UCHAR Reserved0 : 4;
2257 } Fields;
2258 } Byte1;
2259
2260 UCHAR Time[2];
2261
2262 } EVENT_STAT_DEV_BUSY_BLOCK, *PEVENT_STAT_DEV_BUSY_BLOCK;
2263
2264 // Define mode disc info block.
2265
2266 typedef struct _DISC_INFO_BLOCK { //
2267 UCHAR DataLength [2];
2268
2269 #define DiscInfo_Disk_Mask 0x03
2270 #define DiscInfo_Disk_Empty 0x00
2271 #define DiscInfo_Disk_Appendable 0x01
2272 #define DiscInfo_Disk_Complete 0x02
2273 #define DiscInfo_Disk_OtherRW 0x03
2274
2275 #define DiscInfo_Ses_Mask 0x0C
2276 #define DiscInfo_Ses_Empty 0x00
2277 #define DiscInfo_Ses_Incomplete 0x04
2278 #define DiscInfo_Ses_Complete 0x0C
2279
2280 #define DiscInfo_Disk_Erasable 0x10
2281
2282 union {
2283 UCHAR Flags;
2284 struct {
2285 UCHAR DiscStat : 2;
2286 UCHAR LastSesStat : 2;
2287 UCHAR Erasable : 1;
2288 UCHAR DiscInfoType : 3;
2289 } Fields;
2290 } DiscStat;
2291
2292 UCHAR FirstTrackNum;
2293 UCHAR NumOfSes;
2294 UCHAR FirstTrackNumLastSes;
2295 UCHAR LastTrackNumLastSes;
2296
2297 #define DiscInfo_BGF_Mask 0x03
2298 #define DiscInfo_BGF_None 0x00
2299 #define DiscInfo_BGF_Interrupted 0x01 // \ indicates that disk is MRW or Basic-formatted
2300 #define DiscInfo_BGF_InProgress 0x02 // } note, you should issue READ_TOC
2301 #define DiscInfo_BGF_Complete 0x03 // / to check MRW state on old drives
2302
2303 #define DiscInfo_DBit 0x04 // MRW structures may be not current (dirty)
2304 #define DiscInfo_DAC_V 0x10 // Disk Appclication Code valid
2305 #define DiscInfo_URU 0x20 // unrestricted use (1 for CD/DVD, 0 for DB)
2306 #define DiscInfo_DBC_V 0x40 // Disk Bar Code valid
2307 #define DiscInfo_DID_V 0x80 // DiskID valid
2308
2309 union {
2310 UCHAR Flags;
2311 struct {
2312 UCHAR BGFmtStatus: 2;
2313 UCHAR DBit: 1;
2314 UCHAR Reserved1: 1;
2315 UCHAR DAC_V : 1;
2316 UCHAR URU : 1;
2317 UCHAR DBC_V : 1; // 0
2318 UCHAR DID_V : 1;
2319 } Fields;
2320 } Flags;
2321
2322 #define DiscInfo_Type_cdrom 0x00 // CD-DA / CD-ROM
2323 #define DiscInfo_Type_cdi 0x10 // CD-I
2324 #define DiscInfo_Type_cdromxa 0x20 // CD-ROM XA
2325 #define DiscInfo_Type_unknown 0xFF // HZ ;)
2326
2327 UCHAR DiskType;
2328 UCHAR NumOfSes2; // MSB MMC-3
2329 UCHAR FirstTrackNumLastSes2; // MSB MMC-3
2330 UCHAR LastTrackNumLastSes2; // MSB MMC-3
2331 UCHAR DiskId [4];
2332 UCHAR LastSesLeadInTime [4]; // MSF
2333 UCHAR LastSesLeadOutTime [4]; // MSF
2334 UCHAR DiskBarCode [8];
2335 UCHAR Reserved3;
2336 UCHAR OPCNum;
2337
2338 } DISC_INFO_BLOCK, *PDISC_INFO_BLOCK;
2339
2340 typedef struct _DISC_INFO_TRACK_BLOCK { //
2341 UCHAR DataLength [2];
2342
2343 UCHAR Reserved: 5;
2344 UCHAR InfoType: 3;
2345 UCHAR Reserved1;
2346
2347 UCHAR MaxLastTrackNum[2];
2348 UCHAR NumOfTracks[2];
2349 UCHAR MaxNumOfAppendableTracks[2];
2350 UCHAR NumOfAppendableTracks[2];
2351
2352 } DISC_INFO_TRACK_BLOCK, *PDISC_INFO_TRACK_BLOCK;
2353
2354 typedef struct _DISC_INFO_POW_BLOCK { //
2355 UCHAR DataLength [2];
2356
2357 UCHAR Reserved: 5;
2358 UCHAR InfoType: 3;
2359 UCHAR Reserved1;
2360
2361 UCHAR RemainingPOWReplacements[4];
2362 UCHAR RemainingPOWMapEntries[4];
2363 UCHAR RemainingPOWUpdates[4];
2364
2365 } DISC_INFO_POW_BLOCK, *PDISC_INFO_POW_BLOCK;
2366
2367 // Define track info block.
2368
2369 #define Trk_QSubChan_Type_Mask 0x0d
2370 #define Trk_QSubChan_Type_None 0x00
2371 #define Trk_QSubChan_Type_Audio 0x00
2372 #define Trk_QSubChan_Type_Audio_PreEmph 0x01
2373 #define Trk_QSubChan_Type_Data 0x04
2374 #define Trk_QSubChan_Type_IncrData 0x05
2375 #define Trk_QSubChan_Type_QAudio_PreEmph 0x08
2376 #define Trk_QSubChan_Type_AllowCpy 0x02
2377
2378 typedef struct _TRACK_INFO_BLOCK {
2379 UCHAR DataLength [2];
2380 UCHAR TrackNum;
2381 UCHAR SesNum;
2382 UCHAR Reserved0;
2383
2384 #define TrkInfo_Trk_Mask Trk_QSubChan_Type_Mask
2385 #define TrkInfo_Trk_None Trk_QSubChan_Type_None
2386 #define TrkInfo_Trk_Mode1 Trk_QSubChan_Type_Audio_PreEmph
2387 #define TrkInfo_Trk_Mode2 (Trk_QSubChan_Type_Audio | Trk_QSubChan_Type_AllowCpy)
2388 #define TrkInfo_Trk_XA (Trk_QSubChan_Type_Audio | Trk_QSubChan_Type_AllowCpy)
2389 #define TrkInfo_Trk_DDCD Trk_QSubChan_Type_Data // MMC-3
2390 #define TrkInfo_Trk_NonCD Trk_QSubChan_Type_Data // MMC-3
2391 #define TrkInfo_Trk_Inc Trk_QSubChan_Type_IncrData // MMC-3
2392 #define TrkInfo_Trk_unknown 0x0F
2393
2394 #define TrkInfo_Copy 0x10
2395 #define TrkInfo_Damage 0x20
2396 /* Layer Jump state */
2397 #define TrkInfo_LJ_Mask 0xc0
2398 #define TrkInfo_LJ_None 0x00
2399 #define TrkInfo_LJ_Ready 0x40
2400 #define TrkInfo_LJ_Manual 0x80
2401 #define TrkInfo_LJ_Regular 0xc0
2402
2403 UCHAR TrackParam;
2404 /* UCHAR TrackMode : 4;
2405 UCHAR Copy : 1;
2406 UCHAR Damage : 1;
2407 UCHAR LJRS : 2; */
2408
2409 #define TrkInfo_Dat_Mask 0x0F
2410 #define TrkInfo_Dat_Mode1 0x01
2411 #define TrkInfo_Dat_Mode2 0x02
2412 #define TrkInfo_Dat_XA 0x02
2413 #define TrkInfo_Dat_DDCD 0x02
2414 #define TrkInfo_Dat_unknown 0x0F
2415 #define TrkInfo_Dat_Unknown TrkInfo_Dat_unknown
2416 #define TrkInfo_FP 0x10
2417 #define TrkInfo_Packet 0x20
2418 #define TrkInfo_Blank 0x40
2419 #define TrkInfo_RT 0x80
2420
2421 UCHAR DataParam;
2422 /* UCHAR DataMode : 4;
2423 UCHAR FP : 1;
2424 UCHAR Packet : 1;
2425 UCHAR Blank : 1;
2426 UCHAR RT : 1; */
2427
2428 #define TrkInfo_NWA_V 0x01
2429 #define TrkInfo_LRA_V 0x02 // MMC-3
2430
2431 UCHAR NWA_V;
2432 /* UCHAR NWA_V : 1;
2433 UCHAR LRA_V : 1;
2434 UCHAR Reserved : 6; */
2435
2436 UCHAR TrackStartAddr [4];
2437 UCHAR NextWriteAddr [4];
2438 UCHAR FreeBlocks [4];
2439 UCHAR FixPacketSize [4];
2440 UCHAR TrackLength [4];
2441
2442 // MMC-3
2443
2444 UCHAR LastRecordedAddr [4];
2445 UCHAR TrackNum2; // MSB
2446 UCHAR SesNum2; // MSB
2447 UCHAR Reserved2[2];
2448
2449 // MMC-5
2450
2451 UCHAR ReadCompatLBA [4];
2452
2453 // MMC-6
2454
2455 UCHAR NextLJ_LBA [4];
2456 UCHAR LastLJ_LBA [4];
2457
2458 } TRACK_INFO_BLOCK, *PTRACK_INFO_BLOCK;
2459
2460 // Mode data structures.
2461
2462 // Define Mode parameter header.
2463
2464 #define MediaType_Unknown 0x00
2465 #define MediaType_120mm_CDROM_DataOnly 0x01
2466 #define MediaType_120mm_CDROM_AudioOnly 0x02 //CDDA
2467 #define MediaType_120mm_CDROM_DataAudioCombined 0x03
2468 #define MediaType_120mm_CDROM_Hybrid_PhotoCD 0x04
2469 #define MediaType_80mm_CDROM_DataOnly 0x05
2470 #define MediaType_80mm_CDROM_AudioOnly 0x06 //CDDA
2471 #define MediaType_80mm_CDROM_DataAudioCombined 0x07
2472 #define MediaType_80mm_CDROM_Hybrid_PhotoCD 0x08
2473
2474 #define MediaType_UnknownSize_CDR 0x10
2475 #define MediaType_120mm_CDR_DataOnly 0x11
2476 #define MediaType_120mm_CDR_AudioOnly 0x12 //CDDA
2477 #define MediaType_120mm_CDR_DataAudioCombined 0x13
2478 #define MediaType_120mm_CDR_Hybrid_PhotoCD 0x14
2479 #define MediaType_80mm_CDR_DataOnly 0x15
2480 #define MediaType_80mm_CDR_AudioOnly 0x16 //CDDA
2481 #define MediaType_80mm_CDR_DataAudioCombined 0x17
2482 #define MediaType_80mm_CDR_Hybrid_Photo_CD 0x18
2483
2484 #define MediaType_UnknownSize_CDRW 0x20
2485 #define MediaType_120mm_CDRW_DataOnly 0x21
2486 #define MediaType_120mm_CDRW_AudioOnly 0x22 //CDDA
2487 #define MediaType_120mm_CDRW_DataAudioCombined 0x23
2488 #define MediaType_120mm_CDRW_Hybrid 0x24
2489 #define MediaType_80mm_CDRW_DataOnly 0x25
2490 #define MediaType_80mm_CDRW_AudioOnly 0x26 //CDDA
2491 #define MediaType_80mm_CDRW_DataAudioCombined 0x27
2492 #define MediaType_80mm_CDRW_Hybrid 0x28
2493
2494 #define MediaType_UnknownSize_Unknown 0x30
2495
2496 #define MediaType_120mm_DVDRW_DataOnly 0x41
2497
2498 #define MediaType_NoDiscPresent 0x70
2499 #define MediaType_DoorOpen 0x71
2500
2501 //*********************************************************************************************
2502
2503 typedef struct _MODE_PARAMETER_HEADER {
2504 UCHAR ModeDataLength;
2505 UCHAR MediumType;
2506 UCHAR DeviceSpecificParameter;
2507 UCHAR BlockDescriptorLength;
2508 } MODE_PARAMETER_HEADER, *PMODE_PARAMETER_HEADER;
2509
2510 typedef struct _MODE_PARAMETER_HEADER10 {
2511 UCHAR ModeDataLength[2];
2512 UCHAR MediumType;
2513 UCHAR DeviceSpecificParameter;
2514 UCHAR Reserved[2];
2515 UCHAR BlockDescriptorLength[2];
2516 } MODE_PARAMETER_HEADER10, *PMODE_PARAMETER_HEADER10;
2517
2518 #define MODE_FD_SINGLE_SIDE 0x01
2519 #define MODE_FD_DOUBLE_SIDE 0x02
2520 #define MODE_FD_MAXIMUM_TYPE 0x1E
2521 #define MODE_DSP_FUA_SUPPORTED 0x10
2522 #define MODE_DSP_WRITE_PROTECT 0x80
2523
2524 // Define the mode parameter block.
2525
2526 typedef struct _MODE_PARAMETER_BLOCK {
2527 UCHAR DensityCode;
2528 UCHAR NumberOfBlocks[3];
2529 UCHAR Reserved;
2530 UCHAR BlockLength[3];
2531 } MODE_PARAMETER_BLOCK, *PMODE_PARAMETER_BLOCK;
2532
2533 typedef struct _MODE_PARM_READ_WRITE {
2534
2535 MODE_PARAMETER_HEADER ParameterListHeader; // List Header Format
2536 MODE_PARAMETER_BLOCK ParameterListBlock; // List Block Descriptor
2537
2538 } MODE_PARM_READ_WRITE_DATA, *PMODE_PARM_READ_WRITE_DATA;
2539
2540 //*********************************************************************************************
2541 // Define read write recovery page
2542
2543 typedef struct _MODE_READ_WRITE_RECOVERY_PAGE { // 0x01
2544
2545 UCHAR PageCode : 6;
2546 UCHAR Reserved1 : 1;
2547 UCHAR PageSavable : 1;
2548
2549 UCHAR PageLength;
2550
2551 union {
2552 UCHAR Flags;
2553 struct {
2554 UCHAR DCRBit : 1;
2555 UCHAR DTEBit : 1;
2556 UCHAR PERBit : 1;
2557 UCHAR EERBit : 1;
2558 UCHAR RCBit : 1;
2559 UCHAR TBBit : 1;
2560 UCHAR ARRE : 1;
2561 UCHAR AWRE : 1;
2562 } Fields;
2563 } ErrorRecoveryParam;
2564 UCHAR ReadRetryCount;
2565 UCHAR CorrectionSpan; //SCSI CBS only
2566 UCHAR HeadOffsetCount; //SCSI CBS only
2567 UCHAR DataStrobOffsetCount; //SCSI CBS only
2568 union {
2569 UCHAR Flags;
2570 struct {
2571 UCHAR EMCDR : 2;
2572 UCHAR Reserved : 6;
2573 } Fields;
2574 } ErrorRecoveryParam2;
2575 UCHAR WriteRetryCount;
2576 union {
2577 struct {
2578 UCHAR Reserved5;
2579 UCHAR RecoveryTimeLimit[2]; // 0
2580 };
2581 UCHAR ErrorReportingWindowSize[3];
2582 };
2583
2584 } MODE_READ_WRITE_RECOVERY_PAGE, *PMODE_READ_WRITE_RECOVERY_PAGE;
2585
2586 // Define Read Recovery page - cdrom
2587
2588 typedef struct _MODE_READ_RECOVERY_PAGE { // 0x01
2589
2590 UCHAR PageCode : 6;
2591 UCHAR Reserved1 : 1;
2592 UCHAR PageSavable : 1;
2593
2594 UCHAR PageLength;
2595
2596 UCHAR DCRBit : 1;
2597 UCHAR DTEBit : 1;
2598 UCHAR PERBit : 1;
2599 UCHAR Reserved2 : 1;
2600 UCHAR RCBit : 1;
2601 UCHAR TBBit : 1;
2602 UCHAR Reserved3 : 2;
2603
2604 UCHAR ReadRetryCount;
2605 UCHAR Reserved4[4];
2606
2607 } MODE_READ_RECOVERY_PAGE, *PMODE_READ_RECOVERY_PAGE;
2608
2609 //*********************************************************************************************
2610 // Define mode write parameters page.
2611
2612 typedef struct _MODE_WRITE_PARAMS_PAGE { // 0x05
2613 UCHAR PageCode : 6;
2614 UCHAR Reserved1: 1;
2615 UCHAR PageSavable : 1;
2616
2617 UCHAR PageLength; // 0x32
2618
2619 #define WParam_WType_Mask 0x0f
2620 #define WParam_WType_Packet 0x00
2621 #define WParam_WType_TAO 0x01
2622 #define WParam_WType_Ses 0x02
2623 #define WParam_WType_Raw 0x03
2624 #define WParam_TestWrite 0x10
2625 #define WParam_LS_V 0x20
2626 #define WParam_BUFF 0x40 // buffer underrun protection
2627
2628 union {
2629 UCHAR Flags;
2630 struct {
2631 UCHAR WriteType: 4; // 1
2632 UCHAR TestWrite: 1;
2633 UCHAR LS_V: 1;
2634 UCHAR BUFF: 1;
2635 UCHAR Reserved1: 1;
2636 } Fields;
2637 } Byte2;
2638
2639 #define WParam_TrkMode_Mask Trk_QSubChan_Type_Mask //0x0d // xx0x
2640 #define WParam_TrkMode_None Trk_QSubChan_Type_None //0x00
2641 #define WParam_TrkMode_Audio Trk_QSubChan_Type_Audio //0x00
2642 #define WParam_TrkMode_Audio_PreEmph Trk_QSubChan_Type_Audio_PreEmph //0x01
2643 #define WParam_TrkMode_Data Trk_QSubChan_Type_Data //0x04
2644 #define WParam_TrkMode_IncrData Trk_QSubChan_Type_IncrData //0x05
2645 #define WParam_TrkMode_QAudio_PreEmph Trk_QSubChan_Type_QAudio_PreEmph //0x08
2646 #define WParam_TrkMode_AllowCpy Trk_QSubChan_Type_AllowCpy //0x02
2647 #define WParam_Copy 0x10
2648 #define WParam_FP 0x20
2649 #define WParam_MultiSes_Mask 0xc0
2650 #define WParam_Multises_None 0x00
2651 #define WParam_Multises_Final 0x80
2652 #define WParam_Multises_Multi 0xc0
2653
2654 union {
2655 UCHAR Flags;
2656 struct {
2657 UCHAR TrackMode: 4; // 4
2658 UCHAR Copy : 1; // 0
2659 UCHAR FP : 1; // 0
2660 UCHAR Multisession: 2; // 11
2661 } Fields;
2662 } Byte3;
2663
2664 #define WParam_BlkType_Mask 0x0f
2665 #define WParam_BlkType_Raw_2352 0x00
2666 #define WParam_BlkType_RawPQ_2368 0x01
2667 #define WParam_BlkType_RawPW_2448 0x02
2668 #define WParam_BlkType_RawPW_R_2448 0x03
2669 #define WParam_BlkType_VendorSpec1 0x07
2670 #define WParam_BlkType_M1_2048 0x08
2671 #define WParam_BlkType_M2_2336 0x09
2672 #define WParam_BlkType_M2XAF1_2048 0x0a
2673 #define WParam_BlkType_M2XAF1SH_2056 0x0b
2674 #define WParam_BlkType_M2XAF2_2324 0x0c
2675 #define WParam_BlkType_M2XAFXSH_2332 0x0d
2676 #define WParam_BlkType_VendorSpec2 0x0f
2677
2678 union {
2679 UCHAR Flags;
2680 struct {
2681 UCHAR DataBlockType: 4; // 8
2682 UCHAR Reserved2: 4;
2683 } Fields;
2684 } Byte4;
2685
2686 UCHAR LinkSize;
2687 UCHAR Reserved3;
2688
2689 union {
2690 UCHAR Flags;
2691 struct {
2692 UCHAR HostAppCode : 6; // 0
2693 UCHAR Reserved4 : 2;
2694 } Fields;
2695 } Byte7;
2696
2697 #define WParam_SesFmt_CdRom 0x00
2698 #define WParam_SesFmt_CdI 0x10
2699 #define WParam_SesFmt_CdRomXa 0x20
2700
2701 UCHAR SesFmt; // 0
2702 UCHAR Reserved5;
2703 UCHAR PacketSize[4]; // 0
2704 UCHAR AudioPause[2]; // 150
2705
2706 UCHAR Reserved6: 7;
2707 UCHAR MCVAL : 1;
2708
2709 UCHAR N[13];
2710 UCHAR Zero;
2711 UCHAR AFRAME;
2712
2713 UCHAR Reserved7: 7;
2714 UCHAR TCVAL : 1;
2715
2716 UCHAR I[12];
2717 UCHAR Zero_2;
2718 UCHAR AFRAME_2;
2719 UCHAR Reserved8;
2720
2721 struct {
2722 union {
2723 UCHAR MSF[3];
2724 struct _SubHdrParams1 {
2725 UCHAR FileNum;
2726 UCHAR ChannelNum;
2727
2728 #define WParam_SubHdr_SubMode0 0x00
2729 #define WParam_SubHdr_SubMode1 0x08
2730
2731 UCHAR SubMode;
2732 } Params1;
2733 } Params;
2734
2735 #define WParam_SubHdr_Mode_Mask 0x03
2736 #define WParam_SubHdr_Mode0 0x00
2737 #define WParam_SubHdr_Mode1 0x01
2738 #define WParam_SubHdr_Mode2 0x02
2739 #define WParam_SubHdr_Format_Mask 0xe0
2740 #define WParam_SubHdr_Format_UserData 0x00
2741 #define WParam_SubHdr_Format_RunIn4 0x20
2742 #define WParam_SubHdr_Format_RunIn3 0x40
2743 #define WParam_SubHdr_Format_RunIn2 0x60
2744 #define WParam_SubHdr_Format_RunIn1 0x80
2745 #define WParam_SubHdr_Format_Link 0xa0
2746 #define WParam_SubHdr_Format_RunOut2 0xc0
2747 #define WParam_SubHdr_Format_RunOut1 0xe0
2748
2749 union {
2750 UCHAR Flags;
2751 struct {
2752 UCHAR Mode : 2;
2753 UCHAR Reserved : 3;
2754 UCHAR Format : 3;
2755 } Fields;
2756 } Mode;
2757 } SubHeader ;
2758
2759 } MODE_WRITE_PARAMS_PAGE, *PMODE_WRITE_PARAMS_PAGE;
2760
2761 typedef struct _MODE_WRITE_PARAMS_PAGE_3 {
2762 MODE_WRITE_PARAMS_PAGE Standard;
2763 UCHAR VendorSpec[4];
2764 } MODE_WRITE_PARAMS_PAGE_3, *PMODE_WRITE_PARAMS_PAGE_3;
2765
2766 //*********************************************************************************************
2767 // Define Caching page.
2768
2769 typedef struct _MODE_CACHING_PAGE { // 0x08
2770 UCHAR PageCode : 6;
2771 UCHAR Reserved1: 1;
2772 UCHAR PageSavable : 1;
2773
2774 UCHAR PageLength;
2775
2776 UCHAR ReadDisableCache : 1;
2777 UCHAR MultiplicationFactor : 1;
2778 UCHAR WriteCacheEnable : 1;
2779 UCHAR Reserved2 : 5;
2780
2781 UCHAR WriteRetensionPriority : 4;
2782 UCHAR ReadRetensionPriority : 4;
2783
2784 UCHAR DisablePrefetchTransfer[2];
2785 UCHAR MinimumPrefetch[2];
2786 UCHAR MaximumPrefetch[2];
2787 UCHAR MaximumPrefetchCeiling[2];
2788 } MODE_CACHING_PAGE, *PMODE_CACHING_PAGE;
2789
2790 //*********************************************************************************************
2791 // Define CD Parameters page.
2792
2793 typedef struct _MODE_CD_PARAMS_PAGE { // 0x0D
2794 UCHAR PageCode : 6;
2795 UCHAR Reserved : 1;
2796 UCHAR PageSavable : 1;
2797
2798 UCHAR PageLength; // 0x06
2799 UCHAR Reserved1;
2800
2801 #define CdParams_InactvityTime_Mask 0x0f
2802
2803 union {
2804 UCHAR Flags;
2805 struct {
2806 UCHAR InactivityTime: 4; // 1 - 125ms, 2 - 250ms... 9 - 32s, A - 1min...
2807 UCHAR Reserved0 : 4;
2808 } Fields;
2809 } Byte2;
2810
2811 UCHAR SUnits_per_MUnit[2];
2812 UCHAR FUnits_per_SUnit[2];
2813 } MODE_CD_PARAMS_PAGE, *PMODE_CD_PARAMS_PAGE;
2814
2815 //*********************************************************************************************
2816 // Define CD Audio Control Mode page.
2817
2818 typedef struct _CDDA_PORT_CONTROL {
2819
2820 #define CddaPort_Channel_Mask 0x0f
2821 #define CddaPort_Channel_Mute 0x00
2822 #define CddaPort_Channel_0 0x01
2823 #define CddaPort_Channel_1 0x02
2824 #define CddaPort_Channel_0_1 0x03
2825 #define CddaPort_Channel_2 0x04
2826 #define CddaPort_Channel_3 0x08
2827
2828 UCHAR ChannelSelection;
2829 UCHAR Volume;
2830 } CDDA_PORT_CONTROL, *PCDDA_PORT_CONTROL;
2831
2832 typedef struct _MODE_CD_AUDIO_CONTROL_PAGE { // 0x0E
2833 UCHAR PageCode : 6;
2834 UCHAR Reserved1: 1;
2835 UCHAR PageSavable : 1;
2836
2837 UCHAR PageLength; // 0x0E
2838
2839 #define CdAudio_SOTC 0x02
2840 #define CdAudio_Immed 0x04
2841
2842 union {
2843 UCHAR Flags;
2844 struct {
2845 UCHAR Reserved0 : 1;
2846 UCHAR SOTC : 1;
2847 UCHAR Immed : 1;
2848 UCHAR Reserved1 : 5;
2849 } Fields;
2850 } Byte2;
2851
2852 UCHAR Reserved2[2];
2853 UCHAR LbaFormat;
2854 UCHAR LogicalBlocksPerSecond[2];
2855 CDDA_PORT_CONTROL Port[4];
2856 } MODE_CD_AUDIO_CONTROL_PAGE, *PMODE_CD_AUDIO_CONTROL_PAGE;
2857
2858 //*********************************************************************************************
2859 // Define Power Condition Mode page.
2860
2861 typedef struct _MODE_POWER_CONDITION_PAGE { // 0x1A
2862 UCHAR PageCode : 6;
2863 UCHAR Reserved1: 1;
2864 UCHAR PageSavable : 1;
2865
2866 UCHAR PageLength; // 0x0A
2867 UCHAR Reserved2;
2868
2869 #define PowerCond_Standby 0x01
2870 #define PowerCond_Idle 0x02
2871
2872 union {
2873 UCHAR Flags;
2874 struct {
2875 UCHAR Standby : 1;
2876 UCHAR Idle : 1;
2877 UCHAR Reserved1 : 6;
2878 } Fields;
2879 } Byte3;
2880
2881 UCHAR IdleTimer[4]; // 1unit = 100ms
2882 UCHAR StandbyTimer[4]; // 1unit = 100ms
2883 } MODE_POWER_CONDITION_PAGE, *PMODE_POWER_CONDITION_PAGE;
2884
2885 //*********************************************************************************************
2886 // Define Fault/Failure Reporting Control page.
2887
2888 typedef struct _MODE_FAIL_REPORT_PAGE { // 0x1C
2889 UCHAR PageCode : 6;
2890 UCHAR Reserved1: 1;
2891 UCHAR PageSavable : 1;
2892
2893 UCHAR PageLength; // 0x0A
2894
2895 #define FailReport_LogErr 0x01
2896 #define FailReport_Test 0x04
2897 #define FailReport_DExcept 0x08
2898 #define FailReport_Perf 0x80
2899
2900 union {
2901 UCHAR Flags;
2902 struct {
2903 UCHAR LogErr : 1;
2904 UCHAR Reserved1 : 1;
2905 UCHAR Test : 1;
2906 UCHAR DExcept : 1;
2907 UCHAR Reserved2 : 3;
2908 UCHAR Perf : 1;
2909 } Fields;
2910 } Byte2;
2911
2912 union {
2913 UCHAR Flags;
2914 struct {
2915 UCHAR MRIE : 4;
2916 UCHAR Reserved1 : 4;
2917 } Fields;
2918 } Byte3;
2919
2920 UCHAR IntervalTimer[4]; // 1unit = 100ms
2921 UCHAR ReportCount[4];
2922 } MODE_FAIL_REPORT_PAGE, *PMODE_FAIL_REPORT_PAGE;
2923
2924 //*********************************************************************************************
2925 // Define Time-out and Protect page.
2926
2927 typedef struct _MODE_TIMEOUT_AND_PROTECT_PAGE { // 0x1D
2928 UCHAR PageCode : 6;
2929 UCHAR Reserved1: 1;
2930 UCHAR PageSavable : 1;
2931
2932 UCHAR PageLength; // 0x08
2933
2934 UCHAR Reserved2[2];
2935
2936 #define Timeout_SW 0x01
2937 #define Timeout_DISP 0x02
2938 #define Timeout_TMOE 0x04
2939
2940 union {
2941 UCHAR Flags;
2942 struct {
2943 UCHAR SW : 1;
2944 UCHAR DISP : 1;
2945 UCHAR TMOE : 1;
2946 UCHAR Reserved : 5;
2947 } Fields;
2948 } Byte4;
2949
2950 UCHAR Reserved3;
2951
2952 UCHAR Group1_Timeout[2]; // 1unit = 1s
2953 UCHAR Group2_Timeout[2]; // 1unit = 1s
2954 } MODE_TIMEOUT_AND_PROTECT_PAGE, *PMODE_TIMEOUT_AND_PROTECT_PAGE;
2955
2956 //*********************************************************************************************
2957 // Define Philips CD-R(W) Sector Mode page.
2958
2959 typedef struct _MODE_PHILIPS_SECTOR_TYPE_PAGE { // 0x21
2960 UCHAR PageCode : 6;
2961 UCHAR Reserved1 : 1;
2962 UCHAR PSBit : 1;
2963
2964 UCHAR PageLength;
2965
2966 UCHAR Reserved0[2];
2967
2968 union {
2969 UCHAR Flags;
2970 struct {
2971 UCHAR DataBlockType: 4; // 8
2972 UCHAR Reserved2: 4;
2973 } Fields;
2974 } Byte4;
2975
2976 #define WParams_Philips_CreateNewTrack 0
2977
2978 UCHAR Track;
2979 UCHAR ISRC[9];
2980
2981 UCHAR Reserved3[2];
2982 } MODE_PHILIPS_SECTOR_TYPE_PAGE, *PMODE_PHILIPS_SECTOR_TYPE_PAGE;
2983
2984 //*********************************************************************************************
2985 // Define CD-X Capabilities and Mechanical Status page.
2986
2987 typedef struct _MODE_CAPABILITIES_PAGE2 { // 0x2A
2988 UCHAR PageCode : 6;
2989 UCHAR Reserved1 : 1;
2990 UCHAR PSBit : 1;
2991
2992 UCHAR PageLength;
2993
2994 #define DevCap_read_cd_r 0x01 // reserved in 1.2
2995 #define DevCap_read_cd_rw 0x02 // reserved in 1.2
2996 #define DevCap_method2 0x04
2997 #define DevCap_read_dvd_rom 0x08
2998 #define DevCap_read_dvd_r 0x10
2999 #define DevCap_read_dvd_ram 0x20
3000
3001 #define DevCap_read_dvd (DevCap_read_dvd_rom | DevCap_read_dvd_r | DevCap_read_dvd_ram)
3002
3003 UCHAR ReadCap; // DevCap_*_read // 0x02
3004 /* UCHAR cd_r_read : 1; // reserved in 1.2
3005 UCHAR cd_rw_read : 1; // reserved in 1.2
3006 UCHAR method2 : 1;
3007 UCHAR dvd_rom : 1;
3008 UCHAR dvd_r_read : 1;
3009 UCHAR dvd_ram_read : 1;
3010 UCHAR Reserved2 : 2;*/
3011
3012 #define DevCap_write_cd_r 0x01 // reserved in 1.2
3013 #define DevCap_write_cd_rw 0x02 // reserved in 1.2
3014 #define DevCap_test_write 0x04
3015 #define DevCap_write_dvd_r 0x10
3016 #define DevCap_write_dvd_ram 0x20
3017
3018 UCHAR WriteCap; // DevCap_*_write // 0x03
3019 /* UCHAR cd_r_write : 1; // reserved in 1.2
3020 UCHAR cd_rw_write : 1; // reserved in 1.2
3021 UCHAR test_write : 1;
3022 UCHAR reserved3a : 1;
3023 UCHAR dvd_r_write : 1;
3024 UCHAR dvd_ram_write : 1;
3025 UCHAR Reserved3 : 2;*/
3026
3027 #define DevCap_audio_play 0x01
3028 #define DevCap_composite 0x02
3029 #define DevCap_digport1 0x04
3030 #define DevCap_digport2 0x08
3031 #define DevCap_mode2_form1 0x10
3032 #define DevCap_mode2_form2 0x20
3033 #define DevCap_multisession 0x40
3034
3035 UCHAR Capabilities0; // 0x04
3036 /* UCHAR audio_play : 1;
3037 UCHAR composite : 1;
3038 UCHAR digport1 : 1;
3039 UCHAR digport2 : 1;
3040 UCHAR mode2_form1 : 1;
3041 UCHAR mode2_form2 : 1;
3042 UCHAR multisession : 1;
3043 UCHAR Reserved4 : 1;*/
3044
3045 #define DevCap_cdda 0x01
3046 #define DevCap_cdda_accurate 0x02
3047 #define DevCap_rw_supported 0x04
3048 #define DevCap_rw_corr 0x08
3049 #define DevCap_c2_pointers 0x10
3050 #define DevCap_isrc 0x20
3051 #define DevCap_upc 0x40
3052 #define DevCap_read_bar_code 0x80
3053
3054 UCHAR Capabilities1; // 0x05
3055 /* UCHAR cdda : 1;
3056 UCHAR cdda_accurate : 1;
3057 UCHAR rw_supported : 1;
3058 UCHAR rw_corr : 1;
3059 UCHAR c2_pointers : 1;
3060 UCHAR isrc : 1;
3061 UCHAR upc : 1;
3062 UCHAR Reserved5 : 1;*/
3063
3064 #define DevCap_lock 0x01
3065 #define DevCap_lock_state 0x02
3066 #define DevCap_prevent_jumper 0x04
3067 #define DevCap_eject 0x08
3068 #define DevCap_mechtype_mask 0xE0
3069 #define DevCap_mechtype_caddy 0x00
3070 #define DevCap_mechtype_tray (0x01<<5)
3071 #define DevCap_mechtype_popup (0x02<<5)
3072 #define DevCap_mechtype_individual_changer (0x04<<5)
3073 #define DevCap_mechtype_cartridge_changer (0x05<<5)
3074
3075 UCHAR Capabilities2; // 0x06
3076 /* UCHAR lock : 1;
3077 UCHAR lock_state : 1;
3078 UCHAR prevent_jumper : 1;
3079 UCHAR eject : 1;
3080 UCHAR Reserved6 : 1;
3081 UCHAR mechtype : 3;*/
3082
3083 #define DevCap_separate_volume 0x01
3084 #define DevCap_separate_mute 0x02
3085 #define DevCap_disc_present 0x04 // reserved in 1.2
3086 #define DevCap_sw_slot_select 0x08 // reserved in 1.2
3087 #define DevCap_change_side_cap 0x10
3088 #define DevCap_rw_leadin_read 0x20
3089
3090 UCHAR Capabilities3; // 0x07
3091 /* UCHAR separate_volume : 1;
3092 UCHAR separate_mute : 1;
3093 UCHAR disc_present : 1; // reserved in 1.2
3094 UCHAR sss : 1; // reserved in 1.2
3095 UCHAR Reserved7 : 4;*/
3096
3097 UCHAR MaximumSpeedSupported[2]; // 0x08
3098 UCHAR NumberVolumeLevels[2]; // 0x0a
3099 UCHAR BufferSize[2]; // 0x0c
3100 UCHAR CurrentSpeed[2]; // obsolete in MMC3 // 0x0e
3101
3102 UCHAR Reserved8; // 0x10
3103
3104 UCHAR SpecialParameters0; // 0x11
3105 /* UCHAR Reserved9 : 1;
3106 UCHAR BCK : 1;
3107 UCHAR RCK : 1;
3108 UCHAR LSBF : 1;
3109 UCHAR Length : 2;
3110 UCHAR Reserved10 : 2;*/
3111
3112 UCHAR MaximumWriteSpeedSupported[2]; // obsolete in MMC3
3113 UCHAR CurrentWriteSpeed[2]; // obsolete in MMC3
3114 UCHAR CopyManagementRevision[2]; // 0x16
3115 UCHAR Reserved11[2]; // 0x18
3116
3117 // MMC3
3118
3119 UCHAR Reserved12; // 0x1a
3120
3121 UCHAR SpecialParameters1; // 0x1b
3122 /* UCHAR RCS : 2; // rotation control selected
3123 UCHAR Reserved13 : 6; */
3124
3125 UCHAR CurrentWriteSpeed3[2]; // 0x1c
3126 UCHAR LunWPerfDescriptorCount[2]; // 0x1e
3127
3128 // LUN_WRITE_PERF_DESC LunWPerfDescriptor[0];
3129 } MODE_CAPABILITIES_PAGE2, *PMODE_CAPABILITIES_PAGE2;
3130
3131 /*typedef struct _MODE_CAPABILITIES_PAGE3 { // 0x2A
3132 struct MODE_CAPABILITIES_PAGE2;
3133
3134 } MODE_CAPABILITIES_PAGE3, *PMODE_CAPABILITIES_PAGE3;*/
3135
3136 typedef struct _LUN_WRITE_PERF_DESC {
3137 UCHAR Reserved;
3138
3139 #define LunWPerf_RotCtrl_Mask 0x07
3140 #define LunWPerf_RotCtrl_CLV 0x00
3141 #define LunWPerf_RotCtrl_CAV 0x01
3142
3143 UCHAR RotationControl;
3144 UCHAR WriteSpeedSupported[2]; // kbps
3145
3146 } LUN_WRITE_PERF_DESC, *PLUN_WRITE_PERF_DESC;
3147
3148 // Mode parameter list block descriptor -
3149 // set the block length for reading/writing
3150
3151 #define MODE_BLOCK_DESC_LENGTH 8
3152 #define MODE_HEADER_LENGTH 4
3153 #define MODE_HEADER_LENGTH10 8
3154
3155 #define CDB_USE_MSF 0x01
3156
3157 // Atapi 2.5 changer
3158 typedef struct _MECHANICAL_STATUS_INFORMATION_HEADER {
3159 UCHAR CurrentSlot : 5;
3160 UCHAR ChangerState : 2;
3161 UCHAR Fault : 1;
3162 UCHAR Reserved : 5;
3163 UCHAR MechanismState : 3;
3164 UCHAR CurrentLogicalBlockAddress[3];
3165 UCHAR NumberAvailableSlots;
3166 UCHAR SlotTableLength[2];
3167 } MECHANICAL_STATUS_INFORMATION_HEADER, *PMECHANICAL_STATUS_INFORMATION_HEADER;
3168
3169 typedef struct _SLOT_TABLE_INFORMATION {
3170 UCHAR DiscChanged : 1;
3171 UCHAR Reserved : 6;
3172 UCHAR DiscPresent : 1;
3173 UCHAR Reserved2[3];
3174 } SLOT_TABLE_INFORMATION, *PSLOT_TABLE_INFORMATION;
3175
3176 typedef struct _MECHANICAL_STATUS {
3177 MECHANICAL_STATUS_INFORMATION_HEADER MechanicalStatusHeader;
3178 SLOT_TABLE_INFORMATION SlotTableInfo[1];
3179 } MECHANICAL_STATUS, *PMECHANICAL_STATUS;
3180
3181 typedef struct _MODE_MRW_PAGE { // 0x2C
3182 UCHAR PageCode : 6;
3183 UCHAR Reserved1 : 1;
3184 UCHAR PSBit : 1;
3185
3186 UCHAR PageLength;
3187
3188 UCHAR Reserved2;
3189
3190 #define MrwPage_use_DMA 0x00
3191 #define MrwPage_use_GAA 0x01
3192
3193 UCHAR AddressMode;
3194 UCHAR Reserved3[4];
3195
3196 } MODE_MRW_PAGE, *PMODE_MRW_PAGE;
3197
3198 #define MRW_DMA_OFFSET 0x500
3199 #define MRW_DA_SIZE (136*32)
3200 #define MRW_SA_SIZE (8*32)
3201 #define MRW_DMA_SEGMENT_SIZE (MRW_DA_SIZE+MRW_SA_SIZE)
3202
3203 //
3204 // SET STREAMING descriptors
3205 //
3206
3207 typedef struct _SET_STREAMING_PERFORMANCE_DESCRIPTOR {
3208 UCHAR RA : 1; // Random Access
3209 UCHAR Exact : 1;
3210 UCHAR RDD : 1; // Restore Defaults
3211 UCHAR WRC : 2;
3212 UCHAR Reserved0 : 3;
3213
3214 UCHAR Reserved1[3];
3215
3216 UCHAR StartLBA[4];
3217 UCHAR EndLBA[4];
3218
3219 UCHAR ReadSize[4]; // KBytes
3220 UCHAR ReadTime[4]; // ms
3221
3222 UCHAR WriteSize[4]; // KBytes
3223 UCHAR WriteTime[4]; // ms
3224
3225 } SET_STREAMING_PERFORMANCE_DESCRIPTOR, *PSET_STREAMING_PERFORMANCE_DESCRIPTOR;
3226
3227 //
3228 // GET CONFIGURATION response format
3229 //
3230
3231 // Feature Request types
3232 #define RT_ALL 0x00
3233 #define RT_CURRENT 0x01
3234 #define RT_ONE 0x02
3235 #define RT_RESERVED 0x03
3236
3237 // Feature codes
3238 #define FC_PROFILE_LIST 0x0000
3239 #define FC_CORE 0x0001
3240 #define FC_MORPHING 0x0002
3241 #define FC_REMOVALE_MEDIUM 0x0003
3242 #define FC_WRITE_PROTECT_CTL 0x0004
3243 #define FC_RANDOM_READABLE 0x0010
3244 #define FC_MULTIREAD 0x001d
3245 #define FC_CDREAD 0x001e
3246 #define FC_DVDREAD 0x001f
3247 #define FC_RANDOM_WRITEABLE 0x0020
3248 #define FC_INCREMENTAL_STREAMING_WRITEABLE 0x0021
3249 #define FC_SECTOR_ERASABLE 0x0022
3250 #define FC_FORMATTABLE 0x0023
3251 #define FC_DEFECT_MANAGMENT 0x0024
3252 #define FC_WRITE_ONCE 0x0025
3253 #define FC_RESTRICTED_OWERWRITE 0x0026
3254 #define FC_CDRW_CAV_WRITE 0x0027
3255 #define FC_MRW 0x0028
3256 #define FC_ENHANCED_DEFECT_REPORTING 0x0029
3257 #define FC_DVDpRW 0x002a
3258 #define FC_DVDpR 0x002b // MMC-6
3259 #define FC_RIGID_RESTRICTED_OWERWRITE 0x002c
3260 #define FC_CD_TAO 0x002d
3261 #define FC_CD_MASTERING 0x002e
3262 #define FC_DVD_R_RW_WRITE 0x002f
3263 #define FC_DDCD_READ 0x0030 // removed from MMC-5
3264 #define FC_DDCDR_WRITE 0x0031 // removed from MMC-5
3265 #define FC_DDCDRW_WRITE 0x0032 // removed from MMC-5
3266 #define FC_LAYER_JUMP_RECORDING 0x0033 // MMC-6
3267 #define FC_CDRW_WRITE 0x0037 // MMC-5
3268 #define FC_BDR_POW 0x0038 // MMC-6
3269 #define FC_DVDpR_DL 0x003a // MMC-6
3270 #define FC_DVDpRW_DL 0x003b // MMC-5
3271 #define FC_BD_READ 0x0040 // MMC-5, BlueRay
3272 #define FC_BD_WRITE 0x0041 // MMC-6, BlueRay
3273 #define FC_TSR 0x0042 // MMC-6
3274 #define FC_HD_DVD_READ 0x0050 // MMC-6
3275 #define FC_HD_DVD_WRITE 0x0051 // MMC-6
3276 #define FC_HYBRID_DISC 0x0080 // MMC-6
3277 #define FC_POWER_MANAGMENT 0x0100
3278 #define FC_SMART 0x0101
3279 #define FC_EMBEDED_CHANGER 0x0102
3280 #define FC_CD_AUDIO_ANALOG_PLAY 0x0103
3281 #define FC_MICROCODE_UPGRADE 0x0104
3282 #define FC_TIMEOUT 0x0105
3283 #define FC_DVD_CSS 0x0106
3284 #define FC_REAL_TIME_STREAMING 0x0107
3285 #define FC_LU_SERIAL_NUMBER 0x0108
3286 #define FC_MEDIA_SERIAL_NUMBER 0x0109
3287 #define FC_DISK_CONTROL_BLOCK 0x010a
3288 #define FC_DVD_CPRM 0x010b
3289 #define FC_FIRMWARE_INFO 0x010c
3290 #define FC_AACS 0x010d
3291
3292 // Feature Header
3293 typedef struct _FEATURE_LIST_HEADER {
3294 UCHAR DataLength[4];
3295 UCHAR Reserved[2];
3296 UCHAR CurrentProfile[2];
3297 } FEATURE_LIST_HEADER, *PFEATURE_LIST_HEADER;
3298
3299 // Profile List Feature
3300
3301
3302 // Profile list descriptor format
3303 typedef struct _PROFILE_LIST_DESCRIPTOR {
3304 UCHAR FC[2]; // Feature code
3305 UCHAR Current : 1;
3306 UCHAR Persistent: 1;
3307 UCHAR Version : 4;
3308 UCHAR Reserved : 2;
3309 UCHAR AdditionLen;
3310 } PROFILE_LIST_DESCRIPTOR, *PPROFILE_LIST_DESCRIPTOR;
3311
3312 // Profile descriptor format
3313 typedef struct _PROFILE_DESCRIPTOR {
3314 UCHAR ProfileNum[2]; // Profile Number
3315 UCHAR CurrentProfile : 1; // indicate that this Profile curently active
3316 UCHAR Reserved1 : 7;
3317 UCHAR Reserved;
3318 } PROFILE_DESCRIPTOR, *PPROFILE_DESCRIPTOR;
3319
3320 #define PFNUM_Min 0x0001
3321 #define PFNUM_NonRemovableDisk 0x0001
3322 #define PFNUM_RemovableDisk 0x0002
3323 #define PFNUM_MO_Erasable 0x0003
3324 #define PFNUM_MO_WORM 0x0004
3325 #define PFNUM_AS_MO 0x0005
3326 #define PFNUM_CDROM 0x0008
3327 #define PFNUM_CDR 0x0009
3328 #define PFNUM_CDRW 0x000a
3329 #define PFNUM_DVDROM 0x0010
3330 #define PFNUM_DVDR 0x0011
3331 #define PFNUM_DVDRAM 0x0012
3332 #define PFNUM_DVDRW_RESTRICTED_OVERWRITE 0x0013
3333 #define PFNUM_DVDRW_SEQUENTIAL 0x0014
3334 #define PFNUM_DVDR_DL_SEQUENTIAL 0x0015 // MMC-6
3335 #define PFNUM_DVDR_DL_JUMP_RECORDING 0x0016 // MMC-6
3336 #define PFNUM_DVDRW_DL 0x0017 // MMC-6
3337 #define PFNUM_DVDpRW 0x001a
3338 #define PFNUM_DVDpR 0x001b
3339 #define PFNUM_DDCDROM 0x0020
3340 #define PFNUM_DDCDR 0x0021
3341 #define PFNUM_DDCDRW 0x0022
3342 #define PFNUM_DVDpRW_DL 0x002a
3343 #define PFNUM_DVDpR_DL 0x002b
3344 #define PFNUM_BDROM 0x0040 // BlueRay
3345 #define PFNUM_BDR_SEQUENTIAL 0x0041
3346 #define PFNUM_BDR_RANDOM 0x0042
3347 #define PFNUM_BDRE 0x0043 // BlueRay
3348 #define PFNUM_HD_DVDROM 0x0050
3349 #define PFNUM_HD_DVDR 0x0051
3350 #define PFNUM_HD_DVDRAM 0x0052
3351 #define PFNUM_HD_DVDRW 0x0053
3352 #define PFNUM_HD_DVDR_DL 0x0058
3353 #define PFNUM_HD_DVDRW_DL 0x005a
3354 #define PFNUM_Max PFNUM_HD_DVDRW_DL
3355 //
3356
3357 // ** FC_REMOVALE_MEDIUM **
3358 // Removable Media descriptor format 0x03
3359 typedef struct _REMOVABLE_MEDIA_DESCRIPTOR {
3360 PROFILE_LIST_DESCRIPTOR header;
3361
3362 UCHAR lock : 1;
3363 UCHAR Reserved0 : 1; // read current state from header.Current
3364 UCHAR prevent_jumper : 1;
3365 UCHAR eject : 1;
3366 UCHAR Reserved1 : 1;
3367 UCHAR mechtype : 3; // see Capabilities2 in MODE_CAPABILITIES_PAGE2
3368
3369 } REMOVABLE_MEDIA_DESCRIPTOR, *PREMOVABLE_MEDIA_DESCRIPTOR;
3370
3371 // ** FC_MULTIREAD **
3372 // MultiRead descriptor format 0x1d
3373 typedef struct _MULTIREAD_DESCRIPTOR {
3374 PROFILE_LIST_DESCRIPTOR header;
3375 } MULTIREAD_DESCRIPTOR, *PMULTIREAD_DESCRIPTOR;
3376
3377 // ** FC_CDREAD **
3378 // CD-Read descriptor format 0x1e
3379 typedef struct _CD_READ_DESCRIPTOR {
3380 PROFILE_LIST_DESCRIPTOR header;
3381
3382 UCHAR CdText : 1;
3383 UCHAR c2_pointers : 1;
3384 UCHAR Reserved2 : 5;
3385 UCHAR DAP : 1; // DAP bit support in READ_CD/READ_CD_MFS
3386
3387 UCHAR Reserved3[3];
3388 } CD_READ_DESCRIPTOR, *PCD_READ_DESCRIPTOR;
3389
3390 // ** FC_FORMATTABLE **
3391 // Formattable descriptor format 0x23
3392 typedef struct _FORMATTABLE_DESCRIPTOR {
3393 PROFILE_LIST_DESCRIPTOR header;
3394 // BD-RE options
3395 UCHAR Cert : 1;
3396 UCHAR QCert : 1;
3397 UCHAR Expand : 1; // Format Type 0x01 (Expand Spare)
3398 UCHAR RENoSA : 1; // Format Type 0x31 (NoSpare)
3399 UCHAR Reserved : 4;
3400 UCHAR Reserved2[3];
3401 // BD-R options
3402 UCHAR RRM : 1;
3403 UCHAR Reserved3 : 7;
3404 UCHAR Reserved4[3];
3405 } FORMATTABLE_DESCRIPTOR, *PFORMATTABLE_DESCRIPTOR;
3406
3407 // ** FC_CDRW_CAV_WRITE **