ReactOS  0.4.14-dev-49-gfb4591c
cdrw_hw.h
Go to the documentation of this file.
1 // Copyright (C) Alexander Telyatnikov, Ivan Keliukh, Yegor Anchishkin, SKIF Software, 1999-2013. Kiev, Ukraine
3 // All rights reserved
4 // This file was released under the GPLv2 on June 2015.
6 /*
7 
8 Module Name:
9 
10  cdrw_hw.h
11 
12 Abstract:
13 
14  Here are the structures and defines used for device low level control.
15 
16 Environment:
17 
18  kernel mode only
19 
20  */
21 #ifndef __CDRW_DEVICE_H__
22 #define __CDRW_DEVICE_H__
23 
24 #pragma pack(push, 1)
25 
26 // Command Descriptor Block. Passed by SCSI controller chip over the SCSI bus
27 
28 typedef union _CDB {
29 
30  // Generic 6-Byte CDB
31  struct _CDB6 {
35  UCHAR Lun : 3;
37  UCHAR Link : 1;
38  UCHAR Flag : 1;
41  } CDB6, *PCDB6;
42 
43  struct _REQUEST_SENSE {
46  UCHAR Lun : 3;
49  UCHAR Link : 1;
50  UCHAR Flag : 1;
53 
54  // Standard 6-byte CDB
55  struct _CDB6READWRITE {
57  UCHAR LBA2 : 5;
58  UCHAR Lun : 3;
59  UCHAR LBA0[2];
63 
64  // SCSI Inquiry CDB
65  struct _CDB6INQUIRY {
68  UCHAR Lun : 3;
74 
75  // SCSI Format CDB
76 
77  struct _ERASE {
79  UCHAR Long : 1;
82  UCHAR Lun : 3;
85  } ERASE, *PERASE;
86 
87 #define FormatUnit_Code_Mask 0x07
88 #define FormatUnit_Cmp 0x08
89 #define FormatUnit_Fmt 0x10
90 
91 #define FormatUnit_Code_oldCDRW 0x07
92 #define FormatUnit_Code_CD_DVD 0x01
93 
94  struct _CDB6FORMAT {
96  union {
98  struct {
102  UCHAR Lun : 3;
103  } Fields;
104  } Byte1;
109 
110  // Standard 10-byte CDB
111  struct _CDB10 {
117  UCHAR Lun : 3;
118  UCHAR LBA[4];
122  } CDB10, *PCDB10;
123 
124  // CD Rom Audio CDBs
125 
126 #define PauseResume_Pause 0x00
127 #define PauseResume_Resume 0x01
128 
129  struct _PAUSE_RESUME {
132  UCHAR Lun : 3;
137 
138  // Read Table of Contents (TOC)
139 
140 #define ReadTOC_Format_Mask 0x0f
141 #define ReadTOC_Format_TOC 0x00
142 #define ReadTOC_Format_SesInfo 0x01
143 #define ReadTOC_Format_FullTOC 0x02
144 #define ReadTOC_Format_PMA 0x03
145 #define ReadTOC_Format_ATIP 0x04
146 #define ReadTOC_Format_CdText 0x05
147 
148  struct _READ_TOC {
151  UCHAR Msf : 1; // HMSF MMC-3
153  UCHAR Lun : 3;
154 
155  union {
157  struct {
160  } Fields;
161  } Byte2;
162 
167  UCHAR Format : 2;
168  } READ_TOC, *PREAD_TOC;
169 
170  // Read Header
171  struct _READ_HEADER {
174  UCHAR Msf : 1; // HMSF MMC-3
176  UCHAR Lun : 3;
177 
178  UCHAR LBA[4];
183 
184  // Play Audio MSF
188  UCHAR Lun : 3;
194 
195  // Read SubChannel Data
196 
197 #define SubChannel_SubQ_Header 0x00
198 #define SubChannel_SubQ_Block 0x01
199 
200  struct _SUBCHANNEL {
203  UCHAR Msf : 1;
205  UCHAR Lun : 3;
207  UCHAR SubQ : 1;
215 
216 #define SetStreaming_Type_Performance 0x00
217 #define SetStreaming_Type_DBICacheZone 0x05
218 
219  struct _SET_STREAMING {
221 
225 
228 
229  // Read CD (by LBA/MSF). Used by Atapi for raw sector reads.
230 
231 #define ReadCD_SecType_Mask 0x1c
232 #define ReadCD_SecType_Any 0x00
233 #define ReadCD_SecType_CDDA 0x04
234 #define ReadCD_SecType_M1 0x08
235 #define ReadCD_SecType_M2 0x0c
236 #define ReadCD_SecType_M2F1 0x10
237 #define ReadCD_SecType_M2F2 0x14
238 
239  struct _READ_CD_MSF {
241 
243  UCHAR DAP : 1;
246 
250 
257 
260 
263 
264  struct _READ_CD {
266 
267  UCHAR RelAdr : 1; // must be 0
268  UCHAR DAP : 1; // Digital Audio Play - enable mute & interpolate when reading CDDA
271 
272  UCHAR LBA[4];
274 
281 
284 
286  } READ_CD, *PREAD_CD;
287 
288 #define WriteCd_RELADR 0x01
289 #define WriteCd_FUA 0x08
290 #define WriteCd_DPO 0x10
291 
292  struct _WRITE_CD {
294  union {
296  struct {
299  UCHAR FUA : 1;
300  UCHAR DPO : 1;
302  } Fields;
303  } Byte1;
304  UCHAR LBA [4];
308  } WRITE_CD, *PWRITE_CD;
309 
310  // Mode sense
311  struct _MODE_SENSE {
314  UCHAR Dbd : 1;
316  UCHAR Lun : 3;
318  UCHAR Pc : 2;
323 
324  // 10 bytes
325  struct _MODE_SENSE10 {
328  UCHAR Dbd : 1;
330  UCHAR Lun : 3;
332  UCHAR Pc : 2;
337 
338  // 6 bytes
339  struct _MODE_SELECT {
344  UCHAR Lun : 3;
349 
350  struct _MODE_SELECT10 {
355  UCHAR Lun : 3;
360 
361  struct _LOGSENSE {
366  UCHAR Lun : 3;
371  UCHAR ParameterPointer[2]; // [0]=MSB, [1]=LSB
372  UCHAR AllocationLength[2]; // [0]=MSB, [1]=LSB
374  } LOGSENSE, *PLOGSENSE;
375 
376  struct _SEEK {
379  UCHAR Lun : 3;
380  UCHAR LBA[4];
383  } SEEK, *PSEEK;
384 
385 #define StartStop_Start 0x01
386 #define StartStop_Load 0x02
387 
388  struct _START_STOP {
392  UCHAR Lun : 3;
399 
400  struct _MEDIA_REMOVAL {
403  UCHAR Lun : 3;
408 
409 //#ifndef WITHOUT_FORMATTER
410  // 10 bytes
413  union {
415  struct {
418  } Fields;
419  } Byte1;
420  UCHAR Reserved0[5];
424 //#endif //WITHOUT_FORMATTER
425 
426  // Atapi 2.5 Changer 12-byte CDBs
427 #define LoadUnload_Start 0x01
428 #define LoadUnload_Load 0x02
429 
430  struct _LOAD_UNLOAD {
442 
443  struct _MECH_STATUS {
449 
450  struct _LOCK_DOOR {
453  } LOCK_DOOR, *PLOCK_DOOR;
454 
455 #define EventStat_Immed 0x01
456 
457 #define EventStat_Class_OpChange 0x02
458 #define EventStat_Class_PM 0x04
459 #define EventStat_Class_ExternalReq 0x08
460 #define EventStat_Class_Media 0x10
461 #define EventStat_Class_MultiInit 0x20
462 #define EventStat_Class_DevBusy 0x40
463 
466  union {
468  struct {
471  } Fields;
472  } Byte1;
473  UCHAR Reserved0[2];
479 
480 #define ReadDiscInfo_Type_Mask 0x07
481 #define ReadDiscInfo_Type_Std 0x00
482 #define ReadDiscInfo_Type_TrkRes 0x01 // MMC-6
483 #define ReadDiscInfo_Type_POWRes 0x02 // MMC-6
484 
487 
488  UCHAR DataType : 3; // MMC-6
490 
495 
496 #define ReadTrackInfo_Type_Mask 0x01
497 #define ReadTrackInfo_Type_LBA 0x00
498 #define ReadTrackInfo_Type_Track 0x01
499 #define ReadTrackInfo_Type_POW 0x02
500 
501 #define ReadTrackInfo_LastTrk 0xff
502 
512 
513 #define ReadTrackInfo3_Type_Mask 0x03
514 #define ReadTrackInfo3_Type_LBA ReadTrackInfo_Type_LBA
515 #define ReadTrackInfo3_Type_Track ReadTrackInfo_Type_Track
516 #define ReadTrackInfo3_Type_Ses 0x02
517 
518 #define ReadTrackInfo3_LastTrk ReadTrackInfo_LastTrk
519 #define ReadTrackInfo3_DiscLeadIn 0x00 // for Track type
520 
530 
531  struct _RESERVE_TRACK {
533 
534  UCHAR ARSV:1; // 0 - size format, 1 - start LBA
535  UCHAR RMZ:1; // 0 - logical track, 1 - U-RMZ (HD-DVD)
537 
538  union {
539  struct {
542  } Size;
543  struct {
545  UCHAR Reserved1[3];
546  } LBA;
547  };
550 
551 #define CloseTrkSes_Immed 0x01
552 
553 #define CloseTrkSes_BGF 0x00 // DVD+RW only
554 #define CloseTrkSes_Trk 0x01 // also stops BGF on MRW disks
555 #define CloseTrkSes_BGF_QCompat 0x02 // ensures 30mm radius of recorded area
556 #define CloseTrkSes_Ses 0x02
557 #define CloseTrkSes_BGF_Compat 0x03
558 #define CloseTrkSes_SesSpec 0x03
559 #define CloseTrkSes_FinSpec 0x05 // MMC-5, DVD+R only
560 #define CloseTrkSes_Fin 0x06 // MMC-5, DVD+R only
561 
562 #define CloseTrkSes_LastTrkSes 0xff
563 
564 #define CloseTrkSes_Delay 3100000000I64 // 310 s
565 
568  union {
570  struct {
573  } Fields;
574  } Byte1;
575  union {
576  UCHAR Flags;
577  struct {
580  UCHAR Reserved0 : 6;
581  } Fields;
582  } Byte2;
586 
588 
589  struct _SET_CD_SPEED {
592 
593 #define CdSpeed_RotCtrl_CLV 0x00
594 #define CdSpeed_RotCtrl_CAV 0x01
595 
597  UCHAR ReadSpeed [2]; // Kbyte/sec
598  UCHAR WriteSpeed [2]; // Kbyte/sec
601 
602 #define SyncCache_RELADR 0x01
603 #define SyncCache_Immed 0x02
604 
607  union {
609  struct {
612  UCHAR Reserved0 : 6; // All these are unused by drive
613  } Fields;
614  } Byte1;
615  UCHAR LBA [4];
619 /*
620  UCHAR Unused [11];*/
622 
623 #define BlankMedia_Mask 0x07
624 #define BlankMedia_Complete 0x00
625 #define BlankMedia_Minimal 0x01
626 #define BlankMedia_Track 0x02
627 #define BlankMedia_UnreserveTrack 0x03
628 #define BlankMedia_TrackTail 0x04
629 #define BlankMedia_UncloseLastSes 0x05
630 #define BlankMedia_EraseSes 0x06
631 #define BlankMedia_Immed 0x10
632 
633  struct _BLANK_MEDIA {
635  union {
637  struct {
642  } Fields;
643  } Byte1;
647 
648 #define SendKey_ReportAGID 0x00
649 #define SendKey_ChallengeKey 0x01
650 #define SendKey_Key1 0x02
651 #define SendKey_Key2 0x03
652 #define SendKey_TitleKey 0x04
653 #define SendKey_ReportASF 0x05
654 #define SendKey_InvalidateAGID 0x3F
655 
656  struct _SEND_KEY {
659  UCHAR Lun : 3;
663  UCHAR AGID : 2;
665  } SEND_KEY, *PSEND_KEY;
666 
667  struct _REPORT_KEY {
670  UCHAR Lun : 3;
671  UCHAR LBA[4]; // for title key
675  UCHAR AGID : 2;
678 
679 #define ReadDvdStruc_Fmt_PhInfo 0x00
680 #define ReadDvdStruc_Fmt_Copyright_LeadIn 0x01
681 #define ReadDvdStruc_Fmt_DiscKey 0x02
682 #define ReadDvdStruc_Fmt_BurstCuttingArea 0x03
683 #define ReadDvdStruc_Fmt_Manufacturer_LeadIn 0x04
684 #define ReadDvdStruc_Fmt_Copyright_Sector 0x05
685 #define ReadDvdStruc_Fmt_MediaId_BusKey 0x06
686 #define ReadDvdStruc_Fmt_MediaKeyBlock_BusKey 0x07
687 #define ReadDvdStruc_Fmt_DDS_RAM 0x08
688 #define ReadDvdStruc_Fmt_MediumStatus_RAM 0x09
689 #define ReadDvdStruc_Fmt_SpareArea_RAM 0x0a
690  // 0x0b
691 #define ReadDvdStruc_Fmt_LastRMD 0x0c
692 #define ReadDvdStruc_Fmt_RMD 0x0d
693 #define ReadDvdStruc_Fmt_PreRec_LeadIn 0x0e
694 #define ReadDvdStruc_Fmt_MediaId_R_RW 0x0f
695 #define ReadDvdStruc_Fmt_PhFmtInfo_R_RW 0x10
696 
697 #define ReadDvdStruc_Fmt_DCB 0x30 //Disc Control Block
698 #define ReadDvdStruc_Fmt_MTA_ECC_pMRW 0x31
699 
700 #define ReadDvdStruc_Fmt_WriteProtection 0xc0
701 #define ReadDvdStruc_Fmt_ReadSend_DvdStruc_cap 0xff
702 
705  UCHAR MediaType : 4; // =1 For BlueRay (BD)
710  UCHAR AllocationLength[2]; // [0]=MSB, [1]=LSB
712  UCHAR AGID : 2;
715 
722 
725  union {
727  struct {
728  UCHAR RT : 2;
730  } Fields;
731  } Byte1;
733  UCHAR Reserved0 [3];
737 
746 
747 #define SendOpc_DoOpc 0x01
748 
749  struct _SEND_OPC_INFO {
751  union {
753  struct {
757  } Fields;
758  } Byte1;
759  union {
760  UCHAR Flags;
761  struct {
762  UCHAR Exclude0 : 1; // exclude layer 0
763  UCHAR Exclude1 : 1; // exclude layer 0
764  UCHAR Reserved1 : 6;
765  } Fields;
766  } Byte2;
767  UCHAR Reserved0 [4];
771 
778 
779  struct _CDB12 {
782  } CDB12, *PCDB12;
783 
786  union {
788  struct {
791  UCHAR FUA : 1;
792  UCHAR DPO : 1;
794  } Fields;
795  } Byte1;
796  UCHAR LBA [4];
798 
799  UCHAR Reserved1 : 7;
801 
804 
805  // Plextor Read CD-DA
809  UCHAR Lun :3;
810  UCHAR LBA[4];
815 
816  // NEC Read CD-DA
817  struct _NEC_READ_CDDA {
820  UCHAR LBA[4];
825 
826 } CDB, *PCDB;
827 
828 // Command Descriptor Block constants.
829 
830 #define CDB6GENERIC_LENGTH 6
831 #define CDB10GENERIC_LENGTH 10
832 #define CDB12GENERIC_LENGTH 12
833 
834 #define MAXIMUM_NUMBER_OF_TRACKS 100
835 #define MAXIMUM_NUMBER_OF_SESSIONS 1024 //maximal number of entries in Read Full TOC
836 
837 #define SETBITON 1
838 #define SETBITOFF 0
839 
840 // Mode Sense/Select page constants.
841 
842 #define MODE_PAGE_ERROR_RECOVERY 0x01
843 #define MODE_PAGE_MRW2 0x03 // fuck, standard commitee claimed new standard
844 #define MODE_PAGE_WRITE_PARAMS 0x05
845 #define MODE_PAGE_VERIFY_ERROR 0x07 // shall not be used
846 #define MODE_PAGE_CACHING 0x08 // undocumented, but used by DirectCd
847 #define MODE_PAGE_MEDIUM_TYPES 0x0B // shall not be used
848 #define MODE_PAGE_CD_DEVICE_PARAMS 0x0D
849 #define MODE_PAGE_CD_AUDIO_CONTROL 0x0E
850 #define MODE_PAGE_POWER_CONDITION 0x1A
851 #define MODE_PAGE_FAIL_REPORT 0x1C
852 #define MODE_PAGE_TIMEOUT_AND_PROTECT 0x1D
853 #define MODE_PAGE_PHILIPS_SECTOR_TYPE 0x21
854 #define MODE_PAGE_CAPABILITIES 0x2A
855 #define MODE_PAGE_MRW 0x2C
856 
857 #define MODE_SENSE_RETURN_ALL 0x3f
858 
859 #define MODE_SENSE_CURRENT_VALUES 0x00
860 #define MODE_SENSE_CHANGEABLE_VALUES 0x40
861 #define MODE_SENSE_DEFAULT_VAULES 0x80
862 #define MODE_SENSE_SAVED_VALUES 0xc0
863 
864 // SCSI CDB operation codes
865 
866 #define SCSIOP_TEST_UNIT_READY 0x00
867 #define SCSIOP_REZERO_UNIT 0x01
868 #define SCSIOP_REWIND 0x01
869 #define SCSIOP_REQUEST_BLOCK_ADDR 0x02
870 #define SCSIOP_REQUEST_SENSE 0x03
871 #define SCSIOP_FORMAT_UNIT 0x04
872 #define SCSIOP_READ_BLOCK_LIMITS 0x05
873 #define SCSIOP_REASSIGN_BLOCKS 0x07
874 #define SCSIOP_READ6 0x08
875 #define SCSIOP_RECEIVE 0x08
876 #define SCSIOP_WRITE6 0x0A
877 #define SCSIOP_PRINT 0x0A
878 #define SCSIOP_SEND 0x0A
879 #define SCSIOP_SEEK6 0x0B
880 #define SCSIOP_TRACK_SELECT 0x0B
881 #define SCSIOP_SLEW_PRINT 0x0B
882 #define SCSIOP_SEEK_BLOCK 0x0C
883 #define SCSIOP_PARTITION 0x0D
884 #define SCSIOP_READ_REVERSE 0x0F
885 #define SCSIOP_WRITE_FILEMARKS 0x10
886 #define SCSIOP_FLUSH_BUFFER 0x10
887 #define SCSIOP_SPACE 0x11
888 #define SCSIOP_INQUIRY 0x12
889 #define SCSIOP_VERIFY6 0x13
890 #define SCSIOP_RECOVER_BUF_DATA 0x14
891 #define SCSIOP_MODE_SELECT 0x15
892 #define SCSIOP_RESERVE_UNIT 0x16
893 #define SCSIOP_RELEASE_UNIT 0x17
894 #define SCSIOP_COPY 0x18
895 #define SCSIOP_ERASE 0x19
896 #define SCSIOP_MODE_SENSE 0x1A
897 #define SCSIOP_START_STOP_UNIT 0x1B
898 #define SCSIOP_STOP_PRINT 0x1B
899 #define SCSIOP_LOAD_UNLOAD 0x1B
900 #define SCSIOP_RECEIVE_DIAGNOSTIC 0x1C
901 #define SCSIOP_SEND_DIAGNOSTIC 0x1D
902 #define SCSIOP_MEDIUM_REMOVAL 0x1E
903 #define SCSIOP_READ_FORMAT_CAPACITY 0x23
904 #define SCSIOP_READ_CAPACITY 0x25
905 #define SCSIOP_READ 0x28
906 #define SCSIOP_WRITE 0x2A
907 #define SCSIOP_WRITE_CD 0x2A
908 #define SCSIOP_SEEK 0x2B
909 #define SCSIOP_LOCATE 0x2B
910 #define SCSIOP_ERASE10 0x2C
911 #define SCSIOP_WRITE_VERIFY 0x2E
912 #define SCSIOP_VERIFY 0x2F
913 #define SCSIOP_SEARCH_DATA_HIGH 0x30
914 #define SCSIOP_SEARCH_DATA_EQUAL 0x31
915 #define SCSIOP_SEARCH_DATA_LOW 0x32
916 #define SCSIOP_SET_LIMITS 0x33
917 #define SCSIOP_READ_POSITION 0x34
918 #define SCSIOP_SYNCHRONIZE_CACHE 0x35
919 #define SCSIOP_COMPARE 0x39
920 #define SCSIOP_COPY_COMPARE 0x3A
921 #define SCSIOP_COPY_VERIFY 0x3A
922 #define SCSIOP_WRITE_DATA_BUFF 0x3B
923 #define SCSIOP_READ_DATA_BUFF 0x3C
924 #define SCSIOP_CHANGE_DEFINITION 0x40
925 #define SCSIOP_PLAY_AUDIO10 0x41
926 #define SCSIOP_READ_SUB_CHANNEL 0x42
927 #define SCSIOP_READ_TOC 0x43
928 #define SCSIOP_READ_HEADER 0x44
929 #define SCSIOP_PLAY_AUDIO 0x45
930 #define SCSIOP_GET_CONFIGURATION 0x46
931 #define SCSIOP_PLAY_AUDIO_MSF 0x47
932 #define SCSIOP_PLAY_TRACK_INDEX 0x48
933 #define SCSIOP_PLAY_TRACK_RELATIVE 0x49
934 #define SCSIOP_GET_EVENT_STATUS 0x4A
935 #define SCSIOP_PAUSE_RESUME 0x4B
936 #define SCSIOP_LOG_SELECT 0x4C
937 #define SCSIOP_LOG_SENSE 0x4D
938 #define SCSIOP_STOP_PLAY_SCAN 0x4E
939 #define SCSIOP_READ_DISC_INFO 0x51
940 #define SCSIOP_READ_TRACK_INFO 0x52
941 #define SCSIOP_RESERVE_TRACK 0x53
942 #define SCSIOP_SEND_OPC_INFO 0x54
943 #define SCSIOP_MODE_SELECT10 0x55
944 #define SCSIOP_REPAIR_TRACK 0x58 // obsolete
945 #define SCSIOP_READ_MASTER_CUE 0x59
946 #define SCSIOP_MODE_SENSE10 0x5A
947 #define SCSIOP_CLOSE_TRACK_SESSION 0x5B
948 #define SCSIOP_READ_BUFFER_CAPACITY 0x5C
949 #define SCSIOP_SEND_CUE_SHEET 0x5D
950 #define SCSIOP_BLANK 0xA1
951 #define SCSIOP_SEND_KEY 0xA3
952 #define SCSIOP_REPORT_KEY 0xA4
953 #define SCSIOP_PLAY_AUDIO12 0xA5
954 #define SCSIOP_LOAD_UNLOAD_SLOT 0xA6
955 #define SCSIOP_SET_READ_AHEAD 0xA7
956 #define SCSIOP_READ12 0xA8
957 #define SCSIOP_WRITE12 0xAA
958 #define SCSIOP_SEEK12 0xAB
959 #define SCSIOP_GET_PERFORMANCE 0xAC
960 #define SCSIOP_READ_DVD_STRUCTURE 0xAD
961 #define SCSIOP_WRITE_VERIFY12 0xAE
962 #define SCSIOP_VERIFY12 0xAF
963 #define SCSIOP_SET_STREAMING 0xB6
964 #define SCSIOP_READ_CD_MSF 0xB9
965 #define SCSIOP_SET_CD_SPEED 0xBB
966 #define SCSIOP_MECHANISM_STATUS 0xBD
967 #define SCSIOP_READ_CD 0xBE
968 #define SCSIOP_SEND_DISK_STRUCTURE 0xBF
969 #define SCSIOP_SEND_DVD_STRUCTURE 0xBF // see sub-command field
970 #define SCSIOP_SEND_BD_STRUCTURE 0xBF // see sub-command field
971 #define SCSIOP_DOORLOCK 0xDE // lock door on removable drives
972 #define SCSIOP_DOORUNLOCK 0xDF // unlock door on removable drives
973 
974 // If the IMMED bit is 1, status is returned as soon
975 // as the operation is initiated. If the IMMED bit
976 // is 0, status is not returned until the operation
977 // is completed.
978 
979 #define CDB_RETURN_ON_COMPLETION 0
980 #define CDB_RETURN_IMMEDIATE 1
981 
982 // end_ntminitape
983 
984 // CDB Force media access used in extended read and write commands.
985 
986 #define CDB_FORCE_MEDIA_ACCESS 0x08
987 
988 // Denon CD ROM operation codes
989 
990 #define SCSIOP_DENON_EJECT_DISC 0xE6
991 #define SCSIOP_DENON_STOP_AUDIO 0xE7
992 #define SCSIOP_DENON_PLAY_AUDIO 0xE8
993 #define SCSIOP_DENON_READ_TOC 0xE9
994 #define SCSIOP_DENON_READ_SUBCODE 0xEB
995 
996 // Philips/Matshushita CD-R(W) operation codes
997 
998 #define SCSIOP_PHILIPS_GET_NWA 0xE2
999 #define SCSIOP_PHILIPS_RESERVE_TRACK 0xE4
1000 #define SCSIOP_PHILIPS_WRITE_TRACK 0xE6
1001 #define SCSIOP_PHILIPS_LOAD_UNLOAD 0xE7
1002 #define SCSIOP_PHILIPS_CLOSE_TRACK_SESSION 0xE9
1003 #define SCSIOP_PHILIPS_RECOVER_BUF_DATA 0xEC
1004 #define SCSIOP_PHILIPS_READ_SESSION_INFO 0xEE
1005 
1006 // Plextor operation codes
1007 
1008 #define SCSIOP_PLEXTOR_READ_CDDA 0xD8
1009 
1010 // NEC operation codes
1011 
1012 #define SCSIOP_NEC_READ_CDDA 0xD4
1013 
1014 // SCSI Bus Messages
1015 
1016 #define SCSIMESS_ABORT 0x06
1017 #define SCSIMESS_ABORT_WITH_TAG 0x0D
1018 #define SCSIMESS_BUS_DEVICE_RESET 0X0C
1019 #define SCSIMESS_CLEAR_QUEUE 0X0E
1020 #define SCSIMESS_COMMAND_COMPLETE 0X00
1021 #define SCSIMESS_DISCONNECT 0X04
1022 #define SCSIMESS_EXTENDED_MESSAGE 0X01
1023 #define SCSIMESS_IDENTIFY 0X80
1024 #define SCSIMESS_IDENTIFY_WITH_DISCON 0XC0
1025 #define SCSIMESS_IGNORE_WIDE_RESIDUE 0X23
1026 #define SCSIMESS_INITIATE_RECOVERY 0X0F
1027 #define SCSIMESS_INIT_DETECTED_ERROR 0X05
1028 #define SCSIMESS_LINK_CMD_COMP 0X0A
1029 #define SCSIMESS_LINK_CMD_COMP_W_FLAG 0X0B
1030 #define SCSIMESS_MESS_PARITY_ERROR 0X09
1031 #define SCSIMESS_MESSAGE_REJECT 0X07
1032 #define SCSIMESS_NO_OPERATION 0X08
1033 #define SCSIMESS_HEAD_OF_QUEUE_TAG 0X21
1034 #define SCSIMESS_ORDERED_QUEUE_TAG 0X22
1035 #define SCSIMESS_SIMPLE_QUEUE_TAG 0X20
1036 #define SCSIMESS_RELEASE_RECOVERY 0X10
1037 #define SCSIMESS_RESTORE_POINTERS 0X03
1038 #define SCSIMESS_SAVE_DATA_POINTER 0X02
1039 #define SCSIMESS_TERMINATE_IO_PROCESS 0X11
1040 
1041 // SCSI Extended Message operation codes
1042 
1043 #define SCSIMESS_MODIFY_DATA_POINTER 0X00
1044 #define SCSIMESS_SYNCHRONOUS_DATA_REQ 0X01
1045 #define SCSIMESS_WIDE_DATA_REQUEST 0X03
1046 
1047 // SCSI Extended Message Lengths
1048 
1049 #define SCSIMESS_MODIFY_DATA_LENGTH 5
1050 #define SCSIMESS_SYNCH_DATA_LENGTH 3
1051 #define SCSIMESS_WIDE_DATA_LENGTH 2
1052 
1053 // SCSI extended message structure
1054 
1055 typedef struct _SCSI_EXTENDED_MESSAGE {
1060 
1061  struct {
1063  } Modify;
1064 
1065  struct {
1068  } Synchronous;
1069 
1070  struct{
1072  } Wide;
1075 
1076 // SCSI bus status codes.
1077 
1078 #define SCSISTAT_GOOD 0x00
1079 #define SCSISTAT_CHECK_CONDITION 0x02
1080 #define SCSISTAT_CONDITION_MET 0x04
1081 #define SCSISTAT_BUSY 0x08
1082 #define SCSISTAT_INTERMEDIATE 0x10
1083 #define SCSISTAT_INTERMEDIATE_COND_MET 0x14
1084 #define SCSISTAT_RESERVATION_CONFLICT 0x18
1085 #define SCSISTAT_COMMAND_TERMINATED 0x22
1086 #define SCSISTAT_QUEUE_FULL 0x28
1087 
1088 // Enable Vital Product Data Flag (EVPD)
1089 // used with INQUIRY command.
1090 
1091 #define CDB_INQUIRY_EVPD 0x01
1092 
1093 // retry time (in deci-seconds)
1094 #define NOT_READY_RETRY_INTERVAL 20
1095 
1096 // Defines for format CDB
1097 #define LUN0_FORMAT_SAVING_DEFECT_LIST 0
1098 #define USE_DEFAULTMSB 0
1099 #define USE_DEFAULTLSB 0
1100 
1101 #define START_UNIT_CODE 0x01
1102 #define STOP_UNIT_CODE 0x00
1103 
1104 // Inquiry buffer structure. This is the data returned from the target
1105 // after it receives an inquiry.
1106 //
1107 // This structure may be extended by the number of bytes specified
1108 // in the field AdditionalLength. The defined size constant only
1109 // includes fields through ProductRevisionLevel.
1110 //
1111 // The NT SCSI drivers are only interested in the first 36 bytes of data.
1112 
1113 #define INQUIRYDATABUFFERSIZE 36
1114 
1115 typedef struct _INQUIRYDATA {
1138 
1139 // Inquiry defines. Used to interpret data returned from target as result
1140 // of inquiry command.
1141 
1142 // DeviceType field
1143 
1144 #define DIRECT_ACCESS_DEVICE 0x00 // disks
1145 #define SEQUENTIAL_ACCESS_DEVICE 0x01 // tapes
1146 #define PRINTER_DEVICE 0x02 // printers
1147 #define PROCESSOR_DEVICE 0x03 // scanners, printers, etc
1148 #define WRITE_ONCE_READ_MULTIPLE_DEVICE 0x04 // worms
1149 #define READ_ONLY_DIRECT_ACCESS_DEVICE 0x05 // cdroms
1150 #define SCANNER_DEVICE 0x06 // scanners
1151 #define OPTICAL_DEVICE 0x07 // optical disks
1152 #define MEDIUM_CHANGER 0x08 // jukebox
1153 #define COMMUNICATION_DEVICE 0x09 // network
1154 #define LOGICAL_UNIT_NOT_PRESENT_DEVICE 0x7F
1155 #define DEVICE_QUALIFIER_NOT_SUPPORTED 0x03
1156 
1157 // DeviceTypeQualifier field
1158 
1159 #define DEVICE_CONNECTED 0x00
1160 
1161 // Sense Data Format
1162 
1163 typedef struct _SENSE_DATA {
1180 
1181 // Default request sense buffer size
1182 
1183 #define SENSE_BUFFER_SIZE (sizeof(SENSE_DATA))
1184 
1185 // Sense keys
1186 
1187 #define SCSI_SENSE_NO_SENSE 0x00
1188 #define SCSI_SENSE_RECOVERED_ERROR 0x01
1189 #define SCSI_SENSE_NOT_READY 0x02
1190 #define SCSI_SENSE_MEDIUM_ERROR 0x03
1191 #define SCSI_SENSE_HARDWARE_ERROR 0x04
1192 #define SCSI_SENSE_ILLEGAL_REQUEST 0x05
1193 #define SCSI_SENSE_UNIT_ATTENTION 0x06
1194 #define SCSI_SENSE_DATA_PROTECT 0x07
1195 #define SCSI_SENSE_BLANK_CHECK 0x08
1196 #define SCSI_SENSE_UNIQUE 0x09
1197 #define SCSI_SENSE_COPY_ABORTED 0x0A
1198 #define SCSI_SENSE_ABORTED_COMMAND 0x0B
1199 #define SCSI_SENSE_EQUAL 0x0C
1200 #define SCSI_SENSE_VOL_OVERFLOW 0x0D
1201 #define SCSI_SENSE_MISCOMPARE 0x0E
1202 #define SCSI_SENSE_RESERVED 0x0F
1203 
1204 // Additional Sense codes
1205 
1206 // SK = 0x00
1207 #define SCSI_ADSENSE_NO_SENSE 0x00
1208 
1209 // SK = 0x01
1210 #define SCSI_ADSENSE_WARNING 0x0B
1211 #define SCSI_ADSENSE_REC_DATA_NOECC 0x17
1212 #define SCSI_ADSENSE_REC_DATA_ECC 0x18
1213 #define SCSI_ADSENSE_ROUNDED_PARAM 0x37
1214 #define SCSI_ADSENSE_FAILURE_PREDICTED 0x5D
1215 #define SCSI_ADSENSE_CD_CONTROL_ERR 0x73
1216 
1217 // SK = 0x02
1218 #define SCSI_ADSENSE_LUN_NOT_READY 0x04
1219 #define SCSI_ADSENSE_INCOMPATIBLE_MEDIA 0x30
1220 #define SCSI_ADSENSE_INVALID_MEDIA SCSI_ADSENSE_INCOMPATIBLE_MEDIA // for w2k
1221 #define SCSI_ADSENSE_NO_MEDIA_IN_DEVICE 0x3A
1222 #define SCSI_ADSENSE_POSITION_ERROR 0x3B
1223 #define SCSI_ADSENSE_NOT_SELF_CONFIGURED 0x3E
1224 
1225 
1226 // SK = 0x03
1227 #define SCSI_ADSENSE_NO_SEEK 0x02
1228 #define SCSI_ADSENSE_NO_REFERENCE 0x06
1229 #define SCSI_ADSENSE_CD_WRITE_ERROR 0x0C
1230 #define SCSI_ADSENSE_CD_READ_ERROR 0x11
1231 #define SCSI_ADSENSE_TRACK_ERROR 0x14
1232 #define SCSI_ADSENSE_SEEK_ERROR 0x15
1233 #define SCSI_ADSENSE_FORMAT_CORRUPTED 0x31
1234 #define SCSI_ADSENSE_ENCLOSURE_FAILURE 0x34
1235 #define SCSI_ADSENSE_ENCLOSURE_SERVICE 0x35
1236 #define SCSI_ADSENSE_ERASE_ERROR 0x51
1237 #define SCSI_ADSENSE_UNRECOVERED_TOC 0x57
1238 #define SCSI_ADSENSE_SESSION_FIXATION 0x71
1239 //#define SCSI_ADSENSE_CD_CONTROL_ERR 0x73 // redefinition
1240 
1241 // SK = 0x04
1242 #define SCSI_ADSENSE_CLEAN_REQUEST 0x00
1243 #define SCSI_ADSENSE_SELECT 0x04
1244 #define SCSI_ADSENSE_COMMUNICATION 0x08
1245 #define SCSI_ADSENSE_LOST_STREAMING 0x09
1246 #define SCSI_ADSENSE_SYNC_ERROR 0x1B
1247 #define SCSI_ADSENSE_MECH_ERROR 0x3B
1248 #define SCSI_ADSENSE_LUN_ERROR 0x3E
1249 #define SCSI_ADSENSE_DIAGNOSTIC 0x40
1250 #define SCSI_ADSENSE_INTERNAL 0x44
1251 #define SCSI_ADSENSE_SOFT_RESET 0x46
1252 #define SCSI_ADSENSE_SCSI_PARITY 0x47
1253 #define SCSI_ADSENSE_CMD_PHASE 0x4A
1254 #define SCSI_ADSENSE_DATA_PHASE 0x4B
1255 #define SCSI_ADSENSE_SELF_CONFIG 0x4C
1256 #define SCSI_ADSENSE_MEDIUM_REMOVAL 0x53
1257 #define SCSI_ADSENSE_VOLTAGE 0x65
1258 
1259 // SK = 0x05
1260 #define SCSI_ADSENSE_AUDIO_PLAY 0x00
1261 #define SCSI_ADSENSE_MULTISELECT 0x07
1262 #define SCSI_ADSENSE_INVALID_PARAM_LENGTH 0x1A
1263 #define SCSI_ADSENSE_ILLEGAL_COMMAND 0x20
1264 #define SCSI_ADSENSE_ILLEGAL_BLOCK 0x21
1265 #define SCSI_ADSENSE_INVALID_CDB 0x24
1266 #define SCSI_ADSENSE_INVALID_LUN 0x25
1267 #define SCSI_ADSENSE_INVALID_VALUE 0x26
1268 #define SCSI_ADSENSE_WRITE_PROTECT 0x27
1269 #define SCSI_ADSENSE_CANT_DISCONNECT 0x2B
1270 #define SCSI_ADSENSE_INVALID_CMD_SEQUENCE 0x2C
1271 #define SCSI_ADSENSE_INVALID_SESSION_MODE 0x30
1272 #define SCSI_ADSENSE_SAVE_NOT_SUPPORTED 0x35
1273 #define SCSI_ADSENSE_INVALID_BITS_IN_IDENT_MSG 0x3D
1274 #define SCSI_ADSENSE_MSG_ERROR 0x43
1275 //#define SCSI_ADSENSE_MEDIUM_REMOVAL 0x53 // redefinition
1276 #define SCSI_ADSENSE_SYS_RESOURCE_FAILURE 0x55
1277 #define SCSI_ADSENSE_OUT_OF_SPACE 0x63
1278 #define SCSI_ADSENSE_ILLEGAL_MODE_FOR_THIS_TRACK 0x64
1279 #define SCSI_ADSENSE_CD_COPY_ERROR 0x6F
1280 #define SCSI_ADSENSE_INCOMPLETE_DATA 0x72
1281 #define SCSI_ADSENSE_VENDOR_UNIQUE 0x80
1282 #define SCSI_ADSENSE_MUSIC_AREA 0xA0
1283 #define SCSI_ADSENSE_DATA_AREA 0xA1
1284 #define SCSI_ADSENSE_VOLUME_OVERFLOW 0xA7
1285 
1286 // SK = 0x06
1287 #define SCSI_ADSENSE_LOG_OVERFLOW 0x0A
1288 #define SCSI_ADSENSE_MEDIUM_CHANGED 0x28
1289 #define SCSI_ADSENSE_BUS_RESET 0x29
1290 #define SCSI_ADSENSE_PARAM_CHANGE 0x2A
1291 #define SCSI_ADSENSE_CMD_CLEARED_BY_ANOTHER 0x2F
1292 #define SCSI_ADSENSE_MEDIA_STATE 0x3B
1293 #define SCSI_ADSENSE_FUNCTIONALTY_CHANGE 0x3F
1294 #define SCSI_ADSENSE_OPERATOR 0x5A
1295 #define SCSI_ADSENSE_MAX_LOG 0x5B
1296 #define SCSI_ADSENSE_POWER 0x5E
1297 
1298 // SK = 0x0B
1299 #define SCSI_ADSENSE_READ_LOST_STREAMING 0x11
1300 #define SCSI_ADSENSE_RESELECT_FAILURE 0x45
1301 #define SCSI_ADSENSE_ERR_MSG_DETECTED 0x48
1302 #define SCSI_ADSENSE_INVALID_ERR_MSG 0x49
1303 #define SCSI_ADSENSE_TEGGED_OVERLAPPED 0x4D
1304 #define SCSI_ADSENSE_OVERLAPPED_ATTEMPT 0x4E
1305 
1306 // Additional sense code qualifier
1307 
1308 #define SCSI_SENSEQ_NO_SENSE 0x00
1309 
1310 // SK:ASC = 02:04
1311 //#define SCSI_SENSEQ_NO_SENSE 0x00
1312 #define SCSI_SENSEQ_CAUSE_NOT_REPORTABLE 0x00
1313 #define SCSI_SENSEQ_BECOMING_READY 0x01
1314 #define SCSI_SENSEQ_INIT_COMMAND_REQUIRED 0x02
1315 #define SCSI_SENSEQ_MANUAL_INTERVENTION_REQUIRED 0x03
1316 #define SCSI_SENSEQ_FORMAT_IN_PROGRESS 0x04
1317 #define SCSI_SENSEQ_OPERATION_IN_PROGRESS 0x07
1318 #define SCSI_SENSEQ_LONG_WRITE_IN_PROGRESS 0x08
1319 
1320 // SK:ASC = 02:30
1321 #define SCSI_SENSEQ_INCOMPATIBLE_MEDIA_INSTALLED 0x00
1322 #define SCSI_SENSEQ_UNKNOWN_FORMAT 0x01
1323 #define SCSI_SENSEQ_INCOMPATIBLE_FORMAT 0x02
1324 #define SCSI_SENSEQ_CLEANING_CARTRIDGE_INSTALLED 0x03
1325 #define SCSI_SENSEQ_WRITE_UNKNOWN_FORMAT 0x04
1326 #define SCSI_SENSEQ_WRITE_INCOMPATIBLE_FORMAT 0x05
1327 #define SCSI_SENSEQ_FORMAT_INCOMPATIBLE_MEDIUM 0x06
1328 #define SCSI_SENSEQ_CLEANING_FAILURE 0x07
1329 
1330 // SK:ASC = 02:3A
1331 #define SCSI_SENSEQ_TRAY_CLOSED 0x01
1332 #define SCSI_SENSEQ_TRAY_OPEN 0x02
1333 
1334 // SK:ASC = 03:0C
1335 #define SENSEQ_W_RECOVERY_NEEDED 0x07
1336 #define SENSEQ_W_RECOVERY_FAILED 0x08
1337 #define SENSEQ_LOST_STREAMING 0x09
1338 #define SENSEQ_PADDING_BLOCKS_ADDED 0x0A
1339 
1340 // SK:ASC = 03:72, 05:72
1341 //#define SCSI_SENSEQ_NO_SENSE 0x00
1342 #define SCSI_SENSEQ_LEAD_IN_ERROR 0x01
1343 #define SCSI_SENSEQ_LEAD_OUT_ERRROR 0x02
1344 #define SCSI_SENSEQ_INCOMPLETE_TRACK 0x03
1345 #define SCSI_SENSEQ_INCOMPLETE_RESERVED_TRACK 0x04
1346 #define SCSI_SENSEQ_NO_MORE_RESERVATION 0x05
1347 
1348 // SK:ASC = 04:3E
1349 #define SCSI_SENSEQ_LUN_FAILURE 0x01
1350 #define SCSI_SENSEQ_LUN_TIMEOUT 0x02
1351 
1352 // SK:ASC = 05:21
1353 #define SCSI_SENSEQ_ADDR_OUT_OF_RANGE 0x00
1354 #define SCSI_SENSEQ_INVALID_ELEMENT_ADDR 0x01
1355 #define SCSI_SENSEQ_INVALID_WRITE_ADDR 0x02
1356 #define SCSI_SENSEQ_INVALID_WRITE_CROSS_LAYER_JUMP 0x03
1357 
1358 // SK:ASC = 05:26
1359 #define SCSI_SENSEQ_PARAM_NOT_SUPPORTED 0x01
1360 #define SCSI_SENSEQ_PARAM_INVALID_VALUE 0x02
1361 #define SCSI_SENSEQ_THRESHOLD_PARAM_NOT_SUPPORTED 0x03
1362 #define SCSI_SENSEQ_INVALID_RELEASE_OF_PERSISTENT_RESERVATION 0x04
1363 
1364 // SK:ASC = 05:27
1365 #define SCSI_SENSEQ_HW_PROTECTION 0x01
1366 #define SCSI_SENSEQ_LUN_SOFT_PROTECTION 0x02
1367 #define SCSI_SENSEQ_ASSOCIATED_PROTECTION 0x03
1368 #define SCSI_SENSEQ_PERSIST_PROTECTION 0x04
1369 #define SCSI_SENSEQ_PERMANENT_PROTECTION 0x05
1370 
1371 // SK:ASC = 05:2C
1372 #define SCSI_SENSEQ_PROGRAMM_AREA_NOT_EMPTY 0x03
1373 #define SCSI_SENSEQ_PROGRAMM_AREA_EMPTY 0x04
1374 
1375 // SK:ASC = 05:30
1376 //#define SCSI_SENSEQ_INCOMPATIBLE_MEDIA_INSTALLED 0x00
1377 //#define SCSI_SENSEQ_UNKNOWN_FORMAT 0x01
1378 //#define SCSI_SENSEQ_INCOMPATIBLE_FORMAT 0x02
1379 //#define SCSI_SENSEQ_CLEANING_CARTRIDGE_INSTALLED 0x03
1380 //#define SCSI_SENSEQ_WRITE_UNKNOWN_FORMAT 0x04
1381 //#define SCSI_SENSEQ_WRITE_INCOMPATIBLE_FORMAT 0x05
1382 //#define SCSI_SENSEQ_FORMAT_INCOMPATIBLE_MEDIUM 0x06
1383 //#define SCSI_SENSEQ_CLEANING_FAILURE 0x07
1384 #define SCSI_SENSEQ_APP_CODE_MISSMATCH 0x08
1385 #define SCSI_SENSEQ_NOT_FIXED_FOR_APPEND 0x09
1386 #define SCSI_SENSEQ_NOT_FORMATTED 0x10
1387 #define SCSI_SENSEQ_UNSUPPORTED_MEDIA_VERSION 0x11
1388 
1389 // SK:ASC = 05:6F
1390 #define SCSI_SENSEQ_AUTHENTICATION_FAILURE 0x00
1391 #define SCSI_SENSEQ_KEY_NOT_PRESENT 0x01
1392 #define SCSI_SENSEQ_KEY_NOT_ESTABLISHED 0x02
1393 #define SCSI_SENSEQ_READ_OF_SCRAMBLED_SECTOR_WITHOUT_AUTHENTICATION 0x03
1394 #define SCSI_SENSEQ_MEDIA_CODE_MISMATCHED_TO_LOGICAL_UNIT 0x04
1395 #define SCSI_SENSEQ_LOGICAL_UNIT_RESET_COUNT_ERROR 0x05
1396 
1397 // SK:ASC = 06:28
1398 #define SCSI_SENSEQ_IMPORT_OR_EXPERT_ELEMENT_ACCESS 0x01
1399 
1400 // SK:ASC = 06:29
1401 #define SCSI_SENSEQ_POWER_ON 0x01
1402 #define SCSI_SENSEQ_SCSI_BUS 0x02
1403 #define SCSI_SENSEQ_BUS_DEVICE_FUNCTION 0x03
1404 #define SCSI_SENSEQ_DEVICE_INTERNAL 0x04
1405 
1406 // SK:ASC = 06:2A
1407 #define SCSI_SENSEQ_MODE_PARAMETERS 0x01
1408 #define SCSI_SENSEQ_LOG_PARAMETERS 0x02
1409 #define SCSI_SENSEQ_RESERVATIONS_PREEMPTED 0x03
1410 
1411 // SK:ASC = 06:3B
1412 #define SCSI_SENSEQ_DESTINATION_ELEMENT_FULL 0x0D
1413 #define SCSI_SENSEQ_SOURCE_ELEMENT_EMPTY 0x0E
1414 #define SCSI_SENSEQ_END_OF_MEDIUM 0x0F
1415 #define SCSI_SENSEQ_MAGAZINE_NOT_ACCESSIBLE 0x11
1416 #define SCSI_SENSEQ_MAGAZINE_REMOVED 0x12
1417 #define SCSI_SENSEQ_MAGAZINE_INSERTED 0x13
1418 #define SCSI_SENSEQ_MAGAZINE_LOCKED 0x14
1419 #define SCSI_SENSEQ_MAGAZINE_UNLOCKED 0x15
1420 
1421 // SK:ASC = 06:3F
1422 #define SCSI_SENSEQ_MICROCODE 0x01
1423 #define SCSI_SENSEQ_OPERATION_DEFINITION 0x02
1424 #define SCSI_SENSEQ_INQUIRY_DATA 0x03
1425 
1426 // SK:ASC = 06:5A
1427 #define SCSI_SENSEQ_MEDIUM_CHANGE_REQ 0x01
1428 #define SCSI_SENSEQ_W_PROTECT_SELECTED 0x02
1429 #define SCSI_SENSEQ_W_PROTECT_PERMITED 0x03
1430 
1431 // SK:ASC = 06:5E
1432 #define SCSI_SENSEQ_LOW_POWER_COND 0x00
1433 #define SCSI_SENSEQ_IDLE_BY_TIMER 0x01
1434 #define SCSI_SENSEQ_STANDBY_BY_TIMER 0x02
1435 #define SCSI_SENSEQ_IDLE_BY_CMD 0x03
1436 #define SCSI_SENSEQ_STANDBY_BY_CMD 0x04
1437 
1438 #define SCSI_SENSEQ_FILEMARK_DETECTED 0x01
1439 #define SCSI_SENSEQ_SETMARK_DETECTED 0x03
1440 #define SCSI_SENSEQ_END_OF_MEDIA_DETECTED 0x02
1441 #define SCSI_SENSEQ_BEGINNING_OF_MEDIA_DETECTED 0x04
1442 
1443 // SK:ASC = 0B:00
1444 #define SCSI_SENSEQ_IO_TERMINATED 0x06
1445 
1446 
1447 // SCSI IO Device Control Codes
1448 
1449 #define FILE_DEVICE_SCSI 0x0000001b
1450 
1451 #define IOCTL_SCSI_EXECUTE_IN ((FILE_DEVICE_SCSI << 16) + 0x0011)
1452 #define IOCTL_SCSI_EXECUTE_OUT ((FILE_DEVICE_SCSI << 16) + 0x0012)
1453 #define IOCTL_SCSI_EXECUTE_NONE ((FILE_DEVICE_SCSI << 16) + 0x0013)
1454 
1455 // SMART support in atapi
1456 
1457 #define IOCTL_SCSI_MINIPORT_SMART_VERSION ((FILE_DEVICE_SCSI << 16) + 0x0500)
1458 #define IOCTL_SCSI_MINIPORT_IDENTIFY ((FILE_DEVICE_SCSI << 16) + 0x0501)
1459 #define IOCTL_SCSI_MINIPORT_READ_SMART_ATTRIBS ((FILE_DEVICE_SCSI << 16) + 0x0502)
1460 #define IOCTL_SCSI_MINIPORT_READ_SMART_THRESHOLDS ((FILE_DEVICE_SCSI << 16) + 0x0503)
1461 #define IOCTL_SCSI_MINIPORT_ENABLE_SMART ((FILE_DEVICE_SCSI << 16) + 0x0504)
1462 #define IOCTL_SCSI_MINIPORT_DISABLE_SMART ((FILE_DEVICE_SCSI << 16) + 0x0505)
1463 #define IOCTL_SCSI_MINIPORT_RETURN_STATUS ((FILE_DEVICE_SCSI << 16) + 0x0506)
1464 #define IOCTL_SCSI_MINIPORT_ENABLE_DISABLE_AUTOSAVE ((FILE_DEVICE_SCSI << 16) + 0x0507)
1465 #define IOCTL_SCSI_MINIPORT_SAVE_ATTRIBUTE_VALUES ((FILE_DEVICE_SCSI << 16) + 0x0508)
1466 #define IOCTL_SCSI_MINIPORT_EXECUTE_OFFLINE_DIAGS ((FILE_DEVICE_SCSI << 16) + 0x0509)
1467 
1468 // Read Capacity Data - returned in Big Endian format
1469 
1470 typedef struct _READ_CAPACITY_DATA {
1474 
1475 typedef struct _CD_SECTOR_HEADER {
1477 
1478  // See WParam_SubHdr_xxx
1479 
1480 /*
1481 #define WParam_SubHdr_Mode_Mask 0x03
1482 #define WParam_SubHdr_Mode0 0x00
1483 #define WParam_SubHdr_Mode1 0x01
1484 #define WParam_SubHdr_Mode2 0x02
1485 #define WParam_SubHdr_Format_Mask 0xe0
1486 #define WParam_SubHdr_Format_UserData 0x00
1487 #define WParam_SubHdr_Format_RunIn4 0x20
1488 #define WParam_SubHdr_Format_RunIn3 0x40
1489 #define WParam_SubHdr_Format_RunIn2 0x60
1490 #define WParam_SubHdr_Format_RunIn1 0x80
1491 #define WParam_SubHdr_Format_Link 0xa0
1492 #define WParam_SubHdr_Format_RunOut2 0xc0
1493 #define WParam_SubHdr_Format_RunOut1 0xe0
1494 */
1495  union {
1497  struct {
1501  } Fields;
1502  } Mode;
1504 
1505 // CD ROM Read Table Of Contents (TOC) structures
1506 // Format 0 - Get table of contents
1507 
1508 #define TocControl_TrkMode_Mask WParam_TrkMode_Mask
1509 #define TocControl_TrkMode_Audio WParam_TrkMode_Audio
1510 #define TocControl_TrkMode_Audio_PreEmph WParam_TrkMode_Audio_PreEmph
1511 #define TocControl_TrkMode_Data WParam_TrkMode_Data
1512 #define TocControl_TrkMode_IncrData WParam_TrkMode_IncrData
1513 #define TocControl_TrkMode_QAudio_PreEmph WParam_TrkMode_QAudio_PreEmph
1514 #define TocControl_TrkMode_AllowCpy WParam_TrkMode_AllowCpy
1515 
1516 typedef struct _TOC_TRACK_INFO {
1519  UCHAR Adr : 4;
1524 
1525 typedef struct _READ_TOC_HEADER {
1530 
1531 #define TOC_LastTrack_ID 0xAA
1532 
1533 typedef struct _READ_TOC_TOC {
1537 
1538 // Format 1 - Session Info
1539 
1540 typedef struct _READ_TOC_SES {
1542  TOC_TRACK_INFO LastSes_1stTrack; // First Track Number In Last Complete Session
1544 
1545 // Format 2,3 - Full TOC, PMA
1546 
1547 #define TOC_CTL_Normal 0x00
1548 //#define TOC_CTL_MRW 0x01
1549 #define TOC_CTL_MRWTrackInfo 0x06
1550 #define TOC_CTL_MRWLastSes 0x07
1551 
1552 // Ctl = 0
1553 #define TOC_ADR_TrackInfo 0x01
1554 #define TOC_ADR_Internal 0x05
1555 // ?? // Ctl = 1
1556 
1557 // ADR = 1
1558 #define POINT_StartPositionOfTrack_Min 0x01
1559 #define POINT_StartPositionOfTrack_Max 0x63
1560 #define POINT_FirstTrackNum 0xA0
1561 #define POINT_LastTrackNum 0xA1
1562 #define POINT_StartPositionOfLeadOut 0xA2
1563 // ADR = 5
1564 #define POINT_SkipInterval_Min 0x01
1565 #define POINT_SkipInterval_Max 0x40
1566 #define POINT_StartPositionOfNextProgramArea 0xB0
1567 #define POINT_NumOfSkips 0xB1
1568 #define POINT_SkipTrackAssignmet_Min 0xB2
1569 #define POINT_SkipTrackAssignmet_Max 0xB4
1570 #define POINT_StartPositionOfFirstLeadIn 0xC0
1571 #define POINT_CopyOfAdditionalAreaInATIP 0xC1
1572 // ADR = 6, Control = 1
1573 // POINT 0x01 - 0x63, 0xA0 - 0xA2 are treated like for ADR = 1
1574 // rest - like for ADR = 5
1575 
1576 // ADR = 7, Control = 1
1577 // POINT 0x01 - 0x63 are treated as FirstTrackInLastSession
1578 
1579 typedef struct _TOC_SES_INFO {
1582  UCHAR Adr : 4;
1585 
1586  union {
1587 
1588  struct {
1592  } GENERIC;
1593 
1594 // ADR = 1
1595 // or
1596 // ADR = 6, Control = 1
1597 // or
1598 // ADR = 7, Control = 1:
1599 
1600 //0x01 - 0x63
1601  struct {
1604  UCHAR MSF[3];
1606 
1607 // ADR = 1
1608 // or
1609 // ADR = 6, Control = 1:
1610 
1611 //0xA0
1612 #define FullTOC_DiscType_CDDA_or_M1 WParam_SesFmt_CdRom // 0x00
1613 #define FullTOC_DiscType_CDI WParam_SesFmt_CdI // 0x10
1614 #define FullTOC_DiscType_CDXA_M2 WParam_SesFmt_CdRomXa // 0x20
1615 
1616  struct {
1617  UCHAR ATIME[3];
1618  UCHAR Zero;
1622  } FirstTrackNum;
1623 
1624 //0xA1
1625  struct {
1626  UCHAR ATIME[3];
1627  UCHAR Zero;
1629  UCHAR Zero1[2];
1630  } LastTrackNum;
1631 
1632 //0xA2
1633  struct {
1634  UCHAR ATIME[3];
1635  UCHAR Zero;
1636  UCHAR MSF[3];
1638 
1639 // ADR = 5:
1640 
1641 //0x01 - 0x40
1642  struct {
1644  UCHAR Reserved;
1646  } SkipInterval;
1647 
1648 // ADR = 5
1649 // or
1650 // ADR = 6, Control = 1:
1651 
1652 //0xB0
1653  struct {
1658 
1659 //0xB1
1660  struct {
1661  UCHAR Zero[4];
1664  UCHAR Zero1;
1665  } NumOfSkips;
1666 
1667 //0xB2 - 0xB4
1668  struct {
1671 
1672 //0xC0
1673  struct {
1678 
1679 //0xC1
1680  struct {
1683 
1684  } Params;
1686 
1687 typedef struct _READ_TOC_FULL_TOC {
1691 
1694 
1695 // Format 4 - ATIP
1696 
1697 typedef struct _READ_TOC_ATIP {
1700 
1701 #define ATIP_SpeedRef_Mask 0x07
1702 #define ATIP_SpeedRef_2X 0x01
1703 #define ATIP_WritingPower_Mask 0x07
1704 
1705  union {
1707  struct {
1709  UCHAR Reserved: 1;
1712  } Fields;
1713  } Flags1;
1714 
1715 #define ATIP_URU 0x40
1716 
1717  union {
1718  UCHAR Flags;
1719  struct {
1720  UCHAR Reserved: 6;
1723  } Fields;
1724  } Flags2;
1725 
1726 #define ATIP_A1 0x01 // 16-18 are valid
1727 #define ATIP_A2 0x02 // 20-22 are valid
1728 #define ATIP_A3 0x04 // 24-26 are valid
1729 #define ATIP_SubType_Mask 0x38 // shall be set to zero
1730 #define ATIP_Type_Mask 0x40
1731 #define ATIP_Type_CDR 0x00
1732 #define ATIP_Type_CDRW 0x40
1733 
1734  union {
1735  UCHAR Flags;
1736  struct {
1737  UCHAR A1: 1;
1738  UCHAR A2: 1;
1739  UCHAR A3: 1;
1742  UCHAR One: 1;
1743  } Fields;
1744  } DiscType;
1745 
1751 
1752 #define ATIP_MinSpeedCVL_Mask 0x70
1753 #define ATIP_MinSpeedCVL_2X 0x10
1754 #define ATIP_MaxSpeedCVL_Mask 0x0f
1755 #define ATIP_MaxSpeedCVL_2X 0x01
1756 #define ATIP_MaxSpeedCVL_4X 0x02
1757 #define ATIP_MaxSpeedCVL_6X 0x03
1758 #define ATIP_MaxSpeedCVL_8X 0x04
1759 
1760  union {
1761  UCHAR Flags;
1762  struct {
1765  UCHAR Zero: 1;
1766  } Fields;
1767  } Speed;
1768 
1769 #define ATIP_Power_Y_Mask 0x0e
1770 #define ATIP_Power_P_Mask 0x70
1771 
1772  union {
1773  UCHAR Flags;
1774  struct {
1775  UCHAR Reserved: 1;
1778  UCHAR Zero: 1;
1779  } Fields;
1780  } Power;
1781 
1782 #define ATIP_PW_ratio_Mask 0x70
1783 
1784  union {
1785  UCHAR Flags;
1786  struct {
1787  UCHAR Reserved: 4;
1789  UCHAR Zero: 1;
1790  } Fields;
1791  } ErasePower;
1792 
1799 
1801 
1802 // Format 5 - CD-TEXT
1803 
1804 typedef struct _CD_TEXT_PACK_DATA {
1805 
1806 #define CdText_ID1_Title 0x80 // ID2 = 0 - Album, ID2 = 1-63 - Track
1807 #define CdText_ID1_Performer 0x81
1808 #define CdText_ID1_Songwriter 0x82
1809 #define CdText_ID1_Composer 0x83
1810 #define CdText_ID1_Arranger 0x84
1811 #define CdText_ID1_Message 0x85
1812 #define CdText_ID1_DiscID 0x86
1813 #define CdText_ID1_GenreInfo 0x87
1814 #define CdText_ID1_TOC 0x88
1815 #define CdText_ID1_TOC2 0x89
1816 #define CdText_ID1_Special 0x8D
1817 #define CdText_ID1_UPC_EAN_ISRC 0x8E
1818 #define CdText_ID1_BlockSizeInfo 0x8F
1819 
1823 
1824 #define CdText_CharPos_Mask 0x0f
1825 #define CdText_BlkNum_Mask 0x70
1826 
1827  union {
1829  struct {
1832  UCHAR DBCC: 1; // used to indicate Double Byte text encoding (Unicode ?)
1833  } Fields;
1834  } BlkNum_CharPos;
1835 
1839 
1840 typedef struct _READ_TOC_CD_TEXT {
1845 
1846 // Read header
1847 
1848 #define ReadHeader_CdMode_Audio 0x00
1849 #define ReadHeader_CdMode_Mode1 0x01
1850 #define ReadHeader_CdMode_Mode2 0x02
1851 
1852 typedef struct _READ_HEADER_LBA {
1857 
1858 typedef struct _READ_HEADER_MSF {
1863 
1864 
1865 // OPC block
1866 
1867 typedef struct _OPC_INFO_BLOCK {
1871 
1872 // Buffer Capacity format
1873 
1874 typedef struct _BUFFER_CAPACITY_BLOCK {
1880 
1881 //#ifndef WITHOUT_FORMATTER
1882 // Format Unit structures
1883 
1884 typedef struct _FORMAT_LIST_HEADER {
1886 
1887 #define FormatHeader_VS 0x01
1888 #define FormatHeader_Immed 0x02
1889 #define FormatHeader_DSP 0x04
1890 #define FormatHeader_IP 0x08
1891 #define FormatHeader_STPF 0x10
1892 #define FormatHeader_DCRT 0x20
1893 #define FormatHeader_DPRY 0x40
1894 #define FormatHeader_FOV 0x80
1895 
1896  union {
1898  struct {
1899  UCHAR VS: 1;
1902  UCHAR IP: 1;
1907  } Fields;
1908  } Flags;
1911 
1912 typedef struct _CDRW_FORMAT_DESCRIPTOR {
1913 
1914 #define FormatDesc_Grow 0x40
1915 #define FormatDesc_Ses 0x80
1916 
1917  union {
1919  struct {
1923  } Fields;
1924  } Flags;
1928 
1929 typedef struct _DVD_FORMAT_DESCRIPTOR {
1930 
1932 
1933 #define DvdFormatType_Full 0x00
1934 #define DvdFormatType_SpareExpansion 0x01
1935 #define DvdFormatType_ZoneReformat 0x04
1936 #define DvdFormatType_ZoneFormat 0x05
1937 #define DvdFormatType_CD_DVD_RW_Full 0x10
1938 #define DvdFormatType_CD_DVD_RW_GrowSes 0x11
1939 #define DvdFormatType_CD_DVD_RW_AddSes 0x12
1940 #define DvdFormatType_DVD_RW_QuickGrowSes 0x13
1941 #define DvdFormatType_DVD_RW_QuickAddSes 0x14
1942 #define DvdFormatType_DVD_RW_Quick 0x15
1943 #define DvdFormatType_DVD_pRW_Full_3Gb 0x20 // obsolete
1944 #define DvdFormatType_CD_MRW_Full 0x24
1945 #define DvdFormatType_DVD_pRW_basic 0x26
1946 #define DvdFormatType_DDCD_RW_Quick 0x28
1947 #define DvdFormatType_BDRE_Full_Spare 0x30
1948 #define DvdFormatType_BDRE_Full 0x31
1949 #define DvdFormatType_BDR_Full_Spare 0x32
1950 
1951 #define DvdFormatSubType_BDRE_QuickReformat 0x00
1952 #define DvdFormatSubType_BDRE_NoCert 0x01
1953 #define DvdFormatSubType_BDRE_FullCert 0x02
1954 #define DvdFormatSubType_BDRE_QuickCert 0x03
1955 
1956 #define DvdFormatSubType_BDR_SRMpPOW 0x00
1957 #define DvdFormatSubType_BDR_SRM_POW 0x01
1958 #define DvdFormatSubType_BDR_RRM 0x02
1959 
1960  union {
1962  struct {
1965  } Fields;
1966  } Flags;
1967 
1968 /*
1969 #define FormatUnit_MRW_SetNew(desc) { desc->TypeDependent[0] = 0; \
1970  desc->TypeDependent[1] = 0; \
1971  desc->TypeDependent[2] = 0; }
1972 
1973 #define FormatUnit_MRW_SetRestart(desc) { desc->TypeDependent[0] = 0; \
1974  desc->TypeDependent[1] = 0; \
1975  desc->TypeDependent[2] = 1; }
1976 */
1977  union {
1980  struct {
1983  UCHAR QuickStart : 1; // MMC-5
1985  } MRW;
1986  };
1987 
1988 
1990 
1993  union {
1994  struct {
1997  };
1999  };
2001 
2002 // define Read Format Capacities info blocks
2003 
2004 typedef struct _CAPACITY_LIST_HEADER {
2008 
2011  union {
2013  struct {
2014 
2015 #define FormatCapcity_Descr_Reserved 0x00
2016 #define FormatCapcity_Descr_Unformatted 0x01
2017 #define FormatCapcity_Descr_Formatted 0x02
2018 #define FormatCapcity_Descr_NoMedia 0x03
2019 
2020  // valid for the 1st descriptor only
2022 
2023  // valid for all descriptors except the 1st one
2025 
2026  } Fields;
2027  } Flags;
2028  union {
2031  };
2033 
2034 typedef struct _FORMAT_CAPACITIES_DATA {
2036 
2037 #define FormatCap_CurMaxDescrOffset 0x00
2038 #define FormatCap_FormatDescrOffset(i) (i+1)
2039 
2042 
2043 //#endif //WITHOUT_FORMATTER
2044 
2045 // Define Event Status info blocks
2046 
2047 typedef struct _EVENT_STAT_HEADER {
2049 
2050 #define EventRetStat_Class_Mask 0x07
2051 #define EventRetStat_Class_OpChange 0x01
2052 #define EventRetStat_Class_PM 0x02
2053 #define EventRetStat_Class_ExternReq 0x03
2054 #define EventRetStat_Class_Media 0x04
2055 #define EventRetStat_Class_MultInitiators 0x05
2056 #define EventRetStat_Class_DevBusy 0x06
2057 #define EventRetStat_NEA 0x80
2058 
2059  union {
2061  struct {
2065  } Fields;
2066  } Flags;
2067 
2068  UCHAR SupportedClasses; // see command format
2069 
2071 
2073 
2075 
2076 #define EventStat_OpEvent_Mask 0x0f
2077 
2078  union {
2080  struct {
2083  } Fields;
2084  } Byte0;
2085 
2086 #define EventStat_OpStat_Mask 0x0f
2087 #define EventStat_OpStat_Ready 0x00
2088 #define EventStat_OpStat_TempBusy 0x01
2089 #define EventStat_OpStat_Busy 0x02
2090 
2091  union {
2092  UCHAR Flags;
2093  struct {
2095  UCHAR Reserved0 : 3;
2097  } Fields;
2098  } Byte1;
2099 
2100 #define EventStat_OpReport_NoChg 0x00
2101 #define EventStat_OpReport_Change 0x01
2102 #define EventStat_OpReport_AddChg 0x02
2103 #define EventStat_OpReport_Reset 0x03
2104 #define EventStat_OpReport_FirmwareChg 0x04 // microcode change
2105 #define EventStat_OpReport_InquiryChg 0x05
2106 #define EventStat_OpReport_CtrlReq 0x06
2107 #define EventStat_OpReport_CtrlRelease 0x07
2108 
2110 
2112 
2113 typedef struct _EVENT_STAT_PM_BLOCK {
2114 
2116 
2117 #define EventStat_PowerEvent_Mask 0x0f
2118 #define EventStat_PowerEvent_NoChg 0x00
2119 #define EventStat_PowerEvent_ChgOK 0x01
2120 #define EventStat_PowerEvent_ChgFail 0x02
2121 
2122  union {
2124  struct {
2127  } Fields;
2128  } Byte0;
2129 
2130 #define EventStat_PowerStat_Mask 0x0f
2131 #define EventStat_PowerStat_Active 0x01
2132 #define EventStat_PowerStat_Idle 0x02
2133 #define EventStat_PowerStat_Standby 0x03
2134 #define EventStat_PowerStat_Sleep 0x04
2135 
2136  union {
2137  UCHAR Flags;
2138  struct {
2140  UCHAR Reserved0 : 4;
2141  } Fields;
2142  } Byte1;
2143 
2144  UCHAR Reserved0[2];
2145 
2147 
2149 
2151 
2152 #define EventStat_ExtrnReqEvent_Mask 0x0f
2153 #define EventStat_ExtrnReqEvent_None 0x00
2154 #define EventStat_ExtrnReqEvent_KeyDown 0x01
2155 #define EventStat_ExtrnReqEvent_KeyUp 0x02
2156 #define EventStat_ExtrnReqEvent_ExtrnReq 0x03
2157 
2158  union {
2160  struct {
2163  } Fields;
2164  } Byte0;
2165 
2166 #define EventStat_ExtrnReqStatus_Mask 0x0f
2167 #define EventStat_ExtrnReqStatus_Ready 0x00
2168 #define EventStat_ExtrnReqStatus_OtherPrevent 0x01
2169 
2170  union {
2171  UCHAR Flags;
2172  struct {
2174  UCHAR Reserved0 : 3;
2176  } Fields;
2177  } Byte1;
2178 
2179 #define EventStat_ExtrnReq_None 0x000
2180 #define EventStat_ExtrnReq_Overrun 0x001
2181 #define EventStat_ExtrnReq_Play 0x101
2182 #define EventStat_ExtrnReq_Rewind 0x102
2183 #define EventStat_ExtrnReq_FastFwd 0x103
2184 #define EventStat_ExtrnReq_Pause 0x104
2185 #define EventStat_ExtrnReq_Stop 0x106
2186 #define EventStat_ExtrnReq_MinASCII 0x200
2187 #define EventStat_ExtrnReq_MaxASCII 0x2ff
2188 
2190 
2192 
2193 typedef struct _EVENT_STAT_MEDIA_BLOCK {
2194 
2196 
2197 #define EventStat_MediaEvent_Mask 0x0f
2198 #define EventStat_MediaEvent_None 0x00
2199 #define EventStat_MediaEvent_EjectReq 0x01
2200 #define EventStat_MediaEvent_New 0x02
2201 #define EventStat_MediaEvent_Removal 0x03
2202 #define EventStat_MediaEvent_Chg 0x04
2203 #define EventStat_MediaEvent_BGFormatOk 0x05
2204 #define EventStat_MediaEvent_BGFormatRst 0x06
2205 
2206  union {
2208  struct {
2211  } Fields;
2212  } Byte0;
2213 
2214 #define EventStat_MediaStat_DoorOpen 0x01
2215 #define EventStat_MediaStat_Present 0x02
2216 
2217  union {
2218  UCHAR Flags;
2219  struct {
2222  UCHAR Reserved0 : 6;
2223  } Fields;
2224  } Byte1;
2225 
2228 
2230 
2232 
2234 
2235 #define EventStat_BusyEvent_Mask 0x0f
2236 #define EventStat_BusyEvent_None 0x00
2237 #define EventStat_BusyEvent_Busy 0x01
2238 
2239  union {
2241  struct {
2244  } Fields;
2245  } Byte0;
2246 
2247 #define EventStat_BusyStat_Mask 0x0f
2248 #define EventStat_BusyStat_NoEvent 0x00
2249 #define EventStat_BusyStat_Power 0x01
2250 #define EventStat_BusyStat_Immed 0x02
2251 #define EventStat_BusyStat_Deferred 0x03
2252 
2253  union {
2254  UCHAR Flags;
2255  struct {
2257  UCHAR Reserved0 : 4;
2258  } Fields;
2259  } Byte1;
2260 
2262 
2264 
2265 // Define mode disc info block.
2266 
2267 typedef struct _DISC_INFO_BLOCK { //
2269 
2270 #define DiscInfo_Disk_Mask 0x03
2271 #define DiscInfo_Disk_Empty 0x00
2272 #define DiscInfo_Disk_Appendable 0x01
2273 #define DiscInfo_Disk_Complete 0x02
2274 #define DiscInfo_Disk_OtherRW 0x03
2275 
2276 #define DiscInfo_Ses_Mask 0x0C
2277 #define DiscInfo_Ses_Empty 0x00
2278 #define DiscInfo_Ses_Incomplete 0x04
2279 #define DiscInfo_Ses_Complete 0x0C
2280 
2281 #define DiscInfo_Disk_Erasable 0x10
2282 
2283  union {
2285  struct {
2290  } Fields;
2291  } DiscStat;
2292 
2297 
2298 #define DiscInfo_BGF_Mask 0x03
2299 #define DiscInfo_BGF_None 0x00
2300 #define DiscInfo_BGF_Interrupted 0x01 // \ indicates that disk is MRW or Basic-formatted
2301 #define DiscInfo_BGF_InProgress 0x02 // } note, you should issue READ_TOC
2302 #define DiscInfo_BGF_Complete 0x03 // / to check MRW state on old drives
2303 
2304 #define DiscInfo_DBit 0x04 // MRW structures may be not current (dirty)
2305 #define DiscInfo_DAC_V 0x10 // Disk Appclication Code valid
2306 #define DiscInfo_URU 0x20 // unrestricted use (1 for CD/DVD, 0 for DB)
2307 #define DiscInfo_DBC_V 0x40 // Disk Bar Code valid
2308 #define DiscInfo_DID_V 0x80 // DiskID valid
2309 
2310  union {
2311  UCHAR Flags;
2312  struct {
2317  UCHAR URU : 1;
2318  UCHAR DBC_V : 1; // 0
2320  } Fields;
2321  } Flags;
2322 
2323 #define DiscInfo_Type_cdrom 0x00 // CD-DA / CD-ROM
2324 #define DiscInfo_Type_cdi 0x10 // CD-I
2325 #define DiscInfo_Type_cdromxa 0x20 // CD-ROM XA
2326 #define DiscInfo_Type_unknown 0xFF // HZ ;)
2327 
2329  UCHAR NumOfSes2; // MSB MMC-3
2338 
2340 
2341 typedef struct _DISC_INFO_TRACK_BLOCK { //
2343 
2347 
2352 
2354 
2355 typedef struct _DISC_INFO_POW_BLOCK { //
2357 
2361 
2365 
2367 
2368 // Define track info block.
2369 
2370 #define Trk_QSubChan_Type_Mask 0x0d
2371 #define Trk_QSubChan_Type_None 0x00
2372 #define Trk_QSubChan_Type_Audio 0x00
2373 #define Trk_QSubChan_Type_Audio_PreEmph 0x01
2374 #define Trk_QSubChan_Type_Data 0x04
2375 #define Trk_QSubChan_Type_IncrData 0x05
2376 #define Trk_QSubChan_Type_QAudio_PreEmph 0x08
2377 #define Trk_QSubChan_Type_AllowCpy 0x02
2378 
2379 typedef struct _TRACK_INFO_BLOCK {
2384 
2385 #define TrkInfo_Trk_Mask Trk_QSubChan_Type_Mask
2386 #define TrkInfo_Trk_None Trk_QSubChan_Type_None
2387 #define TrkInfo_Trk_Mode1 Trk_QSubChan_Type_Audio_PreEmph
2388 #define TrkInfo_Trk_Mode2 (Trk_QSubChan_Type_Audio | Trk_QSubChan_Type_AllowCpy)
2389 #define TrkInfo_Trk_XA (Trk_QSubChan_Type_Audio | Trk_QSubChan_Type_AllowCpy)
2390 #define TrkInfo_Trk_DDCD Trk_QSubChan_Type_Data // MMC-3
2391 #define TrkInfo_Trk_NonCD Trk_QSubChan_Type_Data // MMC-3
2392 #define TrkInfo_Trk_Inc Trk_QSubChan_Type_IncrData // MMC-3
2393 #define TrkInfo_Trk_unknown 0x0F
2394 
2395 #define TrkInfo_Copy 0x10
2396 #define TrkInfo_Damage 0x20
2397 /* Layer Jump state */
2398 #define TrkInfo_LJ_Mask 0xc0
2399 #define TrkInfo_LJ_None 0x00
2400 #define TrkInfo_LJ_Ready 0x40
2401 #define TrkInfo_LJ_Manual 0x80
2402 #define TrkInfo_LJ_Regular 0xc0
2403 
2405 /* UCHAR TrackMode : 4;
2406  UCHAR Copy : 1;
2407  UCHAR Damage : 1;
2408  UCHAR LJRS : 2; */
2409 
2410 #define TrkInfo_Dat_Mask 0x0F
2411 #define TrkInfo_Dat_Mode1 0x01
2412 #define TrkInfo_Dat_Mode2 0x02
2413 #define TrkInfo_Dat_XA 0x02
2414 #define TrkInfo_Dat_DDCD 0x02
2415 #define TrkInfo_Dat_unknown 0x0F
2416 #define TrkInfo_Dat_Unknown TrkInfo_Dat_unknown
2417 #define TrkInfo_FP 0x10
2418 #define TrkInfo_Packet 0x20
2419 #define TrkInfo_Blank 0x40
2420 #define TrkInfo_RT 0x80
2421 
2423 /* UCHAR DataMode : 4;
2424  UCHAR FP : 1;
2425  UCHAR Packet : 1;
2426  UCHAR Blank : 1;
2427  UCHAR RT : 1; */
2428 
2429 #define TrkInfo_NWA_V 0x01
2430 #define TrkInfo_LRA_V 0x02 // MMC-3
2431 
2433 /* UCHAR NWA_V : 1;
2434  UCHAR LRA_V : 1;
2435  UCHAR Reserved : 6; */
2436 
2442 
2443 // MMC-3
2444 
2447  UCHAR SesNum2; // MSB
2449 
2450 // MMC-5
2451 
2453 
2454 // MMC-6
2455 
2458 
2460 
2461 // Mode data structures.
2462 
2463 // Define Mode parameter header.
2464 
2465 #define MediaType_Unknown 0x00
2466 #define MediaType_120mm_CDROM_DataOnly 0x01
2467 #define MediaType_120mm_CDROM_AudioOnly 0x02 //CDDA
2468 #define MediaType_120mm_CDROM_DataAudioCombined 0x03
2469 #define MediaType_120mm_CDROM_Hybrid_PhotoCD 0x04
2470 #define MediaType_80mm_CDROM_DataOnly 0x05
2471 #define MediaType_80mm_CDROM_AudioOnly 0x06 //CDDA
2472 #define MediaType_80mm_CDROM_DataAudioCombined 0x07
2473 #define MediaType_80mm_CDROM_Hybrid_PhotoCD 0x08
2474 
2475 #define MediaType_UnknownSize_CDR 0x10
2476 #define MediaType_120mm_CDR_DataOnly 0x11
2477 #define MediaType_120mm_CDR_AudioOnly 0x12 //CDDA
2478 #define MediaType_120mm_CDR_DataAudioCombined 0x13
2479 #define MediaType_120mm_CDR_Hybrid_PhotoCD 0x14
2480 #define MediaType_80mm_CDR_DataOnly 0x15
2481 #define MediaType_80mm_CDR_AudioOnly 0x16 //CDDA
2482 #define MediaType_80mm_CDR_DataAudioCombined 0x17
2483 #define MediaType_80mm_CDR_Hybrid_Photo_CD 0x18
2484 
2485 #define MediaType_UnknownSize_CDRW 0x20
2486 #define MediaType_120mm_CDRW_DataOnly 0x21
2487 #define MediaType_120mm_CDRW_AudioOnly 0x22 //CDDA
2488 #define MediaType_120mm_CDRW_DataAudioCombined 0x23
2489 #define MediaType_120mm_CDRW_Hybrid 0x24
2490 #define MediaType_80mm_CDRW_DataOnly 0x25
2491 #define MediaType_80mm_CDRW_AudioOnly 0x26 //CDDA
2492 #define MediaType_80mm_CDRW_DataAudioCombined 0x27
2493 #define MediaType_80mm_CDRW_Hybrid 0x28
2494 
2495 #define MediaType_UnknownSize_Unknown 0x30
2496 
2497 #define MediaType_120mm_DVDRW_DataOnly 0x41
2498 
2499 #define MediaType_NoDiscPresent 0x70
2500 #define MediaType_DoorOpen 0x71
2501 
2502 //*********************************************************************************************
2503 
2504 typedef struct _MODE_PARAMETER_HEADER {
2510 
2518 
2519 #define MODE_FD_SINGLE_SIDE 0x01
2520 #define MODE_FD_DOUBLE_SIDE 0x02
2521 #define MODE_FD_MAXIMUM_TYPE 0x1E
2522 #define MODE_DSP_FUA_SUPPORTED 0x10
2523 #define MODE_DSP_WRITE_PROTECT 0x80
2524 
2525 // Define the mode parameter block.
2526 
2527 typedef struct _MODE_PARAMETER_BLOCK {
2533 
2534 typedef struct _MODE_PARM_READ_WRITE {
2535 
2537  MODE_PARAMETER_BLOCK ParameterListBlock; // List Block Descriptor
2538 
2540 
2541 //*********************************************************************************************
2542 // Define read write recovery page
2543 
2544 typedef struct _MODE_READ_WRITE_RECOVERY_PAGE { // 0x01
2545 
2549 
2551 
2552  union {
2554  struct {
2563  } Fields;
2566  UCHAR CorrectionSpan; //SCSI CBS only
2567  UCHAR HeadOffsetCount; //SCSI CBS only
2568  UCHAR DataStrobOffsetCount; //SCSI CBS only
2569  union {
2570  UCHAR Flags;
2571  struct {
2574  } Fields;
2577  union {
2578  struct {
2581  };
2583  };
2584 
2586 
2587 // Define Read Recovery page - cdrom
2588 
2589 typedef struct _MODE_READ_RECOVERY_PAGE { // 0x01
2590 
2594 
2596 
2604 
2607 
2609 
2610 //*********************************************************************************************
2611 // Define mode write parameters page.
2612 
2613 typedef struct _MODE_WRITE_PARAMS_PAGE { // 0x05
2617 
2619 
2620 #define WParam_WType_Mask 0x0f
2621 #define WParam_WType_Packet 0x00
2622 #define WParam_WType_TAO 0x01
2623 #define WParam_WType_Ses 0x02
2624 #define WParam_WType_Raw 0x03
2625 #define WParam_TestWrite 0x10
2626 #define WParam_LS_V 0x20
2627 #define WParam_BUFF 0x40 // buffer underrun protection
2628 
2629  union {
2631  struct {
2632  UCHAR WriteType: 4; // 1
2636  UCHAR Reserved1: 1;
2637  } Fields;
2638  } Byte2;
2639 
2640 #define WParam_TrkMode_Mask Trk_QSubChan_Type_Mask //0x0d // xx0x
2641 #define WParam_TrkMode_None Trk_QSubChan_Type_None //0x00
2642 #define WParam_TrkMode_Audio Trk_QSubChan_Type_Audio //0x00
2643 #define WParam_TrkMode_Audio_PreEmph Trk_QSubChan_Type_Audio_PreEmph //0x01
2644 #define WParam_TrkMode_Data Trk_QSubChan_Type_Data //0x04
2645 #define WParam_TrkMode_IncrData Trk_QSubChan_Type_IncrData //0x05
2646 #define WParam_TrkMode_QAudio_PreEmph Trk_QSubChan_Type_QAudio_PreEmph //0x08
2647 #define WParam_TrkMode_AllowCpy Trk_QSubChan_Type_AllowCpy //0x02
2648 #define WParam_Copy 0x10
2649 #define WParam_FP 0x20
2650 #define WParam_MultiSes_Mask 0xc0
2651 #define WParam_Multises_None 0x00
2652 #define WParam_Multises_Final 0x80
2653 #define WParam_Multises_Multi 0xc0
2654 
2655  union {
2656  UCHAR Flags;
2657  struct {
2658  UCHAR TrackMode: 4; // 4
2659  UCHAR Copy : 1; // 0
2660  UCHAR FP : 1; // 0
2662  } Fields;
2663  } Byte3;
2664 
2665 #define WParam_BlkType_Mask 0x0f
2666 #define WParam_BlkType_Raw_2352 0x00
2667 #define WParam_BlkType_RawPQ_2368 0x01
2668 #define WParam_BlkType_RawPW_2448 0x02
2669 #define WParam_BlkType_RawPW_R_2448 0x03
2670 #define WParam_BlkType_VendorSpec1 0x07
2671 #define WParam_BlkType_M1_2048 0x08
2672 #define WParam_BlkType_M2_2336 0x09
2673 #define WParam_BlkType_M2XAF1_2048 0x0a
2674 #define WParam_BlkType_M2XAF1SH_2056 0x0b
2675 #define WParam_BlkType_M2XAF2_2324 0x0c
2676 #define WParam_BlkType_M2XAFXSH_2332 0x0d
2677 #define WParam_BlkType_VendorSpec2 0x0f
2678 
2679  union {
2680  UCHAR Flags;
2681  struct {
2684  } Fields;
2685  } Byte4;
2686 
2689 
2690  union {
2691  UCHAR Flags;
2692  struct {
2693  UCHAR HostAppCode : 6; // 0
2695  } Fields;
2696  } Byte7;
2697 
2698 #define WParam_SesFmt_CdRom 0x00
2699 #define WParam_SesFmt_CdI 0x10
2700 #define WParam_SesFmt_CdRomXa 0x20
2701 
2705  UCHAR AudioPause[2]; // 150
2706 
2709 
2710  UCHAR N[13];
2713 
2716 
2717  UCHAR I[12];
2721 
2722  struct {
2723  union {
2725  struct _SubHdrParams1 {
2728 
2729 #define WParam_SubHdr_SubMode0 0x00
2730 #define WParam_SubHdr_SubMode1 0x08
2731 
2733  } Params1;
2734  } Params;
2735 
2736 #define WParam_SubHdr_Mode_Mask 0x03
2737 #define WParam_SubHdr_Mode0 0x00
2738 #define WParam_SubHdr_Mode1 0x01
2739 #define WParam_SubHdr_Mode2 0x02
2740 #define WParam_SubHdr_Format_Mask 0xe0
2741 #define WParam_SubHdr_Format_UserData 0x00
2742 #define WParam_SubHdr_Format_RunIn4 0x20
2743 #define WParam_SubHdr_Format_RunIn3 0x40
2744 #define WParam_SubHdr_Format_RunIn2 0x60
2745 #define WParam_SubHdr_Format_RunIn1 0x80
2746 #define WParam_SubHdr_Format_Link 0xa0
2747 #define WParam_SubHdr_Format_RunOut2 0xc0
2748 #define WParam_SubHdr_Format_RunOut1 0xe0
2749 
2750  union {
2751  UCHAR Flags;
2752  struct {
2756  } Fields;
2757  } Mode;
2758  } SubHeader ;
2759 
2761 
2766 
2767 //*********************************************************************************************
2768 // Define Caching page.
2769 
2770 typedef struct _MODE_CACHING_PAGE { // 0x08
2774 
2776 
2781 
2784 
2790 
2791 //*********************************************************************************************
2792 // Define CD Parameters page.
2793 
2794 typedef struct _MODE_CD_PARAMS_PAGE { // 0x0D
2798 
2801 
2802 #define CdParams_InactvityTime_Mask 0x0f
2803 
2804  union {
2806  struct {
2807  UCHAR InactivityTime: 4; // 1 - 125ms, 2 - 250ms... 9 - 32s, A - 1min...
2809  } Fields;
2810  } Byte2;
2811 
2815 
2816 //*********************************************************************************************
2817 // Define CD Audio Control Mode page.
2818 
2819 typedef struct _CDDA_PORT_CONTROL {
2820 
2821 #define CddaPort_Channel_Mask 0x0f
2822 #define CddaPort_Channel_Mute 0x00
2823 #define CddaPort_Channel_0 0x01
2824 #define CddaPort_Channel_1 0x02
2825 #define CddaPort_Channel_0_1 0x03
2826 #define CddaPort_Channel_2 0x04
2827 #define CddaPort_Channel_3 0x08
2828 
2832 
2833 typedef struct _MODE_CD_AUDIO_CONTROL_PAGE { // 0x0E
2837 
2839 
2840 #define CdAudio_SOTC 0x02
2841 #define CdAudio_Immed 0x04
2842 
2843  union {
2845  struct {
2849  UCHAR Reserved1 : 5;
2850  } Fields;
2851  } Byte2;
2852 
2858 
2859 //*********************************************************************************************
2860 // Define Power Condition Mode page.
2861 
2862 typedef struct _MODE_POWER_CONDITION_PAGE { // 0x1A
2866 
2869 
2870 #define PowerCond_Standby 0x01
2871 #define PowerCond_Idle 0x02
2872 
2873  union {
2875  struct {
2878  UCHAR Reserved1 : 6;
2879  } Fields;
2880  } Byte3;
2881 
2882  UCHAR IdleTimer[4]; // 1unit = 100ms
2883  UCHAR StandbyTimer[4]; // 1unit = 100ms
2885 
2886 //*********************************************************************************************
2887 // Define Fault/Failure Reporting Control page.
2888 
2889 typedef struct _MODE_FAIL_REPORT_PAGE { // 0x1C
2893 
2895 
2896 #define FailReport_LogErr 0x01
2897 #define FailReport_Test 0x04
2898 #define FailReport_DExcept 0x08
2899 #define FailReport_Perf 0x80
2900 
2901  union {
2903  struct {
2905  UCHAR Reserved1 : 1;
2910  } Fields;
2911  } Byte2;
2912 
2913  union {
2914  UCHAR Flags;
2915  struct {
2917  UCHAR Reserved1 : 4;
2918  } Fields;
2919  } Byte3;
2920 
2921  UCHAR IntervalTimer[4]; // 1unit = 100ms
2924 
2925 //*********************************************************************************************
2926 // Define Time-out and Protect page.
2927 
2928 typedef struct _MODE_TIMEOUT_AND_PROTECT_PAGE { // 0x1D
2932 
2934 
2936 
2937 #define Timeout_SW 0x01
2938 #define Timeout_DISP 0x02
2939 #define Timeout_TMOE 0x04
2940 
2941  union {
2943  struct {
2944  UCHAR SW : 1;
2948  } Fields;
2949  } Byte4;
2950 
2952 
2953  UCHAR Group1_Timeout[2]; // 1unit = 1s
2954  UCHAR Group2_Timeout[2]; // 1unit = 1s
2956 
2957 //*********************************************************************************************
2958 // Define Philips CD-R(W) Sector Mode page.
2959 
2960 typedef struct _MODE_PHILIPS_SECTOR_TYPE_PAGE { // 0x21
2964 
2966 
2968 
2969  union {
2971  struct {
2974  } Fields;
2975  } Byte4;
2976 
2977 #define WParams_Philips_CreateNewTrack 0
2978 
2981 
2984 
2985 //*********************************************************************************************
2986 // Define CD-X Capabilities and Mechanical Status page.
2987 
2988 typedef struct _MODE_CAPABILITIES_PAGE2 { // 0x2A
2992 
2994 
2995 #define DevCap_read_cd_r 0x01 // reserved in 1.2
2996 #define DevCap_read_cd_rw 0x02 // reserved in 1.2
2997 #define DevCap_method2 0x04
2998 #define DevCap_read_dvd_rom 0x08
2999 #define DevCap_read_dvd_r 0x10
3000 #define DevCap_read_dvd_ram 0x20
3001 
3002 #define DevCap_read_dvd (DevCap_read_dvd_rom | DevCap_read_dvd_r | DevCap_read_dvd_ram)
3003 
3004  UCHAR ReadCap; // DevCap_*_read // 0x02
3005 /* UCHAR cd_r_read : 1; // reserved in 1.2
3006  UCHAR cd_rw_read : 1; // reserved in 1.2
3007  UCHAR method2 : 1;
3008  UCHAR dvd_rom : 1;
3009  UCHAR dvd_r_read : 1;
3010  UCHAR dvd_ram_read : 1;
3011  UCHAR Reserved2 : 2;*/
3012 
3013 #define DevCap_write_cd_r 0x01 // reserved in 1.2
3014 #define DevCap_write_cd_rw 0x02 // reserved in 1.2
3015 #define DevCap_test_write 0x04
3016 #define DevCap_write_dvd_r 0x10
3017 #define DevCap_write_dvd_ram 0x20
3018 
3019  UCHAR WriteCap; // DevCap_*_write // 0x03
3020 /* UCHAR cd_r_write : 1; // reserved in 1.2
3021  UCHAR cd_rw_write : 1; // reserved in 1.2
3022  UCHAR test_write : 1;
3023  UCHAR reserved3a : 1;
3024  UCHAR dvd_r_write : 1;
3025  UCHAR dvd_ram_write : 1;
3026  UCHAR Reserved3 : 2;*/
3027 
3028 #define DevCap_audio_play 0x01
3029 #define DevCap_composite 0x02
3030 #define DevCap_digport1 0x04
3031 #define DevCap_digport2 0x08
3032 #define DevCap_mode2_form1 0x10
3033 #define DevCap_mode2_form2 0x20
3034 #define DevCap_multisession 0x40
3035 
3037 /* UCHAR audio_play : 1;
3038  UCHAR composite : 1;
3039  UCHAR digport1 : 1;
3040  UCHAR digport2 : 1;
3041  UCHAR mode2_form1 : 1;
3042  UCHAR mode2_form2 : 1;
3043  UCHAR multisession : 1;
3044  UCHAR Reserved4 : 1;*/
3045 
3046 #define DevCap_cdda 0x01
3047 #define DevCap_cdda_accurate 0x02
3048 #define DevCap_rw_supported 0x04
3049 #define DevCap_rw_corr 0x08
3050 #define DevCap_c2_pointers 0x10
3051 #define DevCap_isrc 0x20
3052 #define DevCap_upc 0x40
3053 #define DevCap_read_bar_code 0x80
3054 
3056 /* UCHAR cdda : 1;
3057  UCHAR cdda_accurate : 1;
3058  UCHAR rw_supported : 1;
3059  UCHAR rw_corr : 1;
3060  UCHAR c2_pointers : 1;
3061  UCHAR isrc : 1;
3062  UCHAR upc : 1;
3063  UCHAR Reserved5 : 1;*/
3064 
3065 #define DevCap_lock 0x01
3066 #define DevCap_lock_state 0x02
3067 #define DevCap_prevent_jumper 0x04
3068 #define DevCap_eject 0x08
3069 #define DevCap_mechtype_mask 0xE0
3070 #define DevCap_mechtype_caddy 0x00
3071 #define DevCap_mechtype_tray (0x01<<5)
3072 #define DevCap_mechtype_popup (0x02<<5)
3073 #define DevCap_mechtype_individual_changer (0x04<<5)
3074 #define DevCap_mechtype_cartridge_changer (0x05<<5)
3075 
3077 /* UCHAR lock : 1;
3078  UCHAR lock_state : 1;
3079  UCHAR prevent_jumper : 1;
3080  UCHAR eject : 1;
3081  UCHAR Reserved6 : 1;
3082  UCHAR mechtype : 3;*/
3083 
3084 #define DevCap_separate_volume 0x01
3085 #define DevCap_separate_mute 0x02
3086 #define DevCap_disc_present 0x04 // reserved in 1.2
3087 #define DevCap_sw_slot_select 0x08 // reserved in 1.2
3088 #define DevCap_change_side_cap 0x10
3089 #define DevCap_rw_leadin_read 0x20
3090 
3092 /* UCHAR separate_volume : 1;
3093  UCHAR separate_mute : 1;
3094  UCHAR disc_present : 1; // reserved in 1.2
3095  UCHAR sss : 1; // reserved in 1.2
3096  UCHAR Reserved7 : 4;*/
3097 
3100  UCHAR BufferSize[2]; // 0x0c
3101  UCHAR CurrentSpeed[2]; // obsolete in MMC3 // 0x0e
3102 
3103  UCHAR Reserved8; // 0x10
3104 
3106 /* UCHAR Reserved9 : 1;
3107  UCHAR BCK : 1;
3108  UCHAR RCK : 1;
3109  UCHAR LSBF : 1;
3110  UCHAR Length : 2;
3111  UCHAR Reserved10 : 2;*/
3112 
3113  UCHAR MaximumWriteSpeedSupported[2]; // obsolete in MMC3
3114  UCHAR CurrentWriteSpeed[2]; // obsolete in MMC3
3116  UCHAR Reserved11[2]; // 0x18
3117 
3118 // MMC3
3119 
3121 
3123 /* UCHAR RCS : 2; // rotation control selected
3124  UCHAR Reserved13 : 6; */
3125 
3128 
3129 // LUN_WRITE_PERF_DESC LunWPerfDescriptor[0];
3131 
3132 /*typedef struct _MODE_CAPABILITIES_PAGE3 { // 0x2A
3133  struct MODE_CAPABILITIES_PAGE2;
3134 
3135 } MODE_CAPABILITIES_PAGE3, *PMODE_CAPABILITIES_PAGE3;*/
3136 
3137 typedef struct _LUN_WRITE_PERF_DESC {
3139 
3140 #define LunWPerf_RotCtrl_Mask 0x07
3141 #define LunWPerf_RotCtrl_CLV 0x00
3142 #define LunWPerf_RotCtrl_CAV 0x01
3143 
3146 
3148 
3149 // Mode parameter list block descriptor -
3150 // set the block length for reading/writing
3151 
3152 #define MODE_BLOCK_DESC_LENGTH 8
3153 #define MODE_HEADER_LENGTH 4
3154 #define MODE_HEADER_LENGTH10 8
3155 
3156 #define CDB_USE_MSF 0x01
3157 
3158 // Atapi 2.5 changer
3169 
3170 typedef struct _SLOT_TABLE_INFORMATION {
3176 
3177 typedef struct _MECHANICAL_STATUS {
3181 
3182 typedef struct _MODE_MRW_PAGE { // 0x2C
3186 
3188 
3190 
3191 #define MrwPage_use_DMA 0x00
3192 #define MrwPage_use_GAA 0x01
3193 
3196 
3198 
3199 #define MRW_DMA_OFFSET 0x500
3200 #define MRW_DA_SIZE (136*32)
3201 #define MRW_SA_SIZE (8*32)
3202 #define MRW_DMA_SEGMENT_SIZE (MRW_DA_SIZE+MRW_SA_SIZE)
3203 
3204 //
3205 // SET STREAMING descriptors
3206 //
3207 
3209  UCHAR RA : 1; // Random Access
3211  UCHAR RDD : 1; // Restore Defaults
3212  UCHAR WRC : 2;
3214 
3216 
3219 
3220  UCHAR ReadSize[4]; // KBytes
3221  UCHAR ReadTime[4]; // ms
3222 
3223  UCHAR WriteSize[4]; // KBytes
3224  UCHAR WriteTime[4]; // ms
3225 
3227 
3228 //
3229 // GET CONFIGURATION response format
3230 //
3231 
3232 // Feature Request types
3233 #define RT_ALL 0x00
3234 #define RT_CURRENT 0x01
3235 #define RT_ONE 0x02
3236 #define RT_RESERVED 0x03
3237 
3238 // Feature codes
3239 #define FC_PROFILE_LIST 0x0000
3240 #define FC_CORE 0x0001
3241 #define FC_MORPHING 0x0002
3242 #define FC_REMOVALE_MEDIUM 0x0003
3243 #define FC_WRITE_PROTECT_CTL 0x0004
3244 #define FC_RANDOM_READABLE 0x0010
3245 #define FC_MULTIREAD 0x001d
3246 #define FC_CDREAD 0x001e
3247 #define FC_DVDREAD 0x001f
3248 #define FC_RANDOM_WRITEABLE 0x0020
3249 #define FC_INCREMENTAL_STREAMING_WRITEABLE 0x0021
3250 #define FC_SECTOR_ERASABLE 0x0022
3251 #define FC_FORMATTABLE 0x0023
3252 #define FC_DEFECT_MANAGMENT 0x0024
3253 #define FC_WRITE_ONCE 0x0025
3254 #define FC_RESTRICTED_OWERWRITE 0x0026
3255 #define FC_CDRW_CAV_WRITE 0x0027
3256 #define FC_MRW 0x0028
3257 #define FC_ENHANCED_DEFECT_REPORTING 0x0029
3258 #define FC_DVDpRW 0x002a
3259 #define FC_DVDpR 0x002b // MMC-6
3260 #define FC_RIGID_RESTRICTED_OWERWRITE 0x002c
3261 #define FC_CD_TAO 0x002d
3262 #define FC_CD_MASTERING 0x002e
3263 #define FC_DVD_R_RW_WRITE 0x002f
3264 #define FC_DDCD_READ 0x0030 // removed from MMC-5
3265 #define FC_DDCDR_WRITE 0x0031 // removed from MMC-5
3266 #define FC_DDCDRW_WRITE 0x0032 // removed from MMC-5
3267 #define FC_LAYER_JUMP_RECORDING 0x0033 // MMC-6
3268 #define FC_CDRW_WRITE 0x0037 // MMC-5
3269 #define FC_BDR_POW 0x0038 // MMC-6
3270 #define FC_DVDpR_DL 0x003a // MMC-6
3271 #define FC_DVDpRW_DL 0x003b // MMC-5
3272 #define FC_BD_READ 0x0040 // MMC-5, BlueRay
3273 #define FC_BD_WRITE 0x0041 // MMC-6, BlueRay
3274 #define FC_TSR 0x0042 // MMC-6
3275 #define FC_HD_DVD_READ 0x0050 // MMC-6
3276 #define FC_HD_DVD_WRITE 0x0051 // MMC-6
3277 #define FC_HYBRID_DISC 0x0080 // MMC-6
3278 #define FC_POWER_MANAGMENT 0x0100
3279 #define FC_SMART 0x0101
3280 #define FC_EMBEDED_CHANGER 0x0102
3281 #define FC_CD_AUDIO_ANALOG_PLAY 0x0103
3282 #define FC_MICROCODE_UPGRADE 0x0104
3283 #define FC_TIMEOUT 0x0105
3284 #define FC_DVD_CSS 0x0106
3285 #define FC_REAL_TIME_STREAMING 0x0107
3286 #define FC_LU_SERIAL_NUMBER 0x0108
3287 #define FC_MEDIA_SERIAL_NUMBER 0x0109
3288 #define FC_DISK_CONTROL_BLOCK 0x010a
3289 #define FC_DVD_CPRM 0x010b
3290 #define FC_FIRMWARE_INFO 0x010c
3291 #define FC_AACS 0x010d
3292 
3293 // Feature Header
3294 typedef struct _FEATURE_LIST_HEADER {
3299 
3300 // Profile List Feature
3301 
3302 
3303 // Profile list descriptor format
3305  UCHAR FC[2]; // Feature code
3312 
3313 // Profile descriptor format
3314 typedef struct _PROFILE_DESCRIPTOR {
3315  UCHAR ProfileNum[2]; // Profile Number
3316  UCHAR CurrentProfile : 1; // indicate that this Profile curently active
3320 
3321 #define PFNUM_Min 0x0001
3322 #define PFNUM_NonRemovableDisk 0x0001
3323 #define PFNUM_RemovableDisk 0x0002
3324 #define PFNUM_MO_Erasable 0x0003
3325 #define PFNUM_MO_WORM 0x0004
3326 #define PFNUM_AS_MO 0x0005
3327 #define PFNUM_CDROM 0x0008
3328 #define PFNUM_CDR 0x0009
3329 #define PFNUM_CDRW 0x000a
3330 #define PFNUM_DVDROM 0x0010
3331 #define PFNUM_DVDR 0x0011
3332 #define PFNUM_DVDRAM 0x0012
3333 #define PFNUM_DVDRW_RESTRICTED_OVERWRITE 0x0013
3334 #define PFNUM_DVDRW_SEQUENTIAL 0x0014
3335 #define PFNUM_DVDR_DL_SEQUENTIAL 0x0015 // MMC-6
3336 #define PFNUM_DVDR_DL_JUMP_RECORDING 0x0016 // MMC-6
3337 #define PFNUM_DVDRW_DL 0x0017 // MMC-6
3338 #define PFNUM_DVDpRW 0x001a
3339 #define PFNUM_DVDpR 0x001b
3340 #define PFNUM_DDCDROM 0x0020
3341 #define PFNUM_DDCDR 0x0021
3342 #define PFNUM_DDCDRW 0x0022
3343 #define PFNUM_DVDpRW_DL 0x002a
3344 #define PFNUM_DVDpR_DL 0x002b
3345 #define PFNUM_BDROM 0x0040 // BlueRay
3346 #define PFNUM_BDR_SEQUENTIAL 0x0041
3347 #define PFNUM_BDR_RANDOM 0x0042
3348 #define PFNUM_BDRE 0x0043 // BlueRay
3349 #define PFNUM_HD_DVDROM 0x0050
3350 #define PFNUM_HD_DVDR 0x0051
3351 #define PFNUM_HD_DVDRAM 0x0052
3352 #define PFNUM_HD_DVDRW 0x0053
3353 #define PFNUM_HD_DVDR_DL 0x0058
3354 #define PFNUM_HD_DVDRW_DL 0x005a
3355 #define PFNUM_Max PFNUM_HD_DVDRW_DL
3356 //
3357 
3358 // ** FC_REMOVALE_MEDIUM **
3359 // Removable Media descriptor format 0x03
3362 
3364  UCHAR Reserved0 : 1; // read current state from header.Current
3368  UCHAR mechtype : 3; // see Capabilities2 in MODE_CAPABILITIES_PAGE2
3369 
3371 
3372 // ** FC_MULTIREAD **
3373 // MultiRead descriptor format 0x1d
3374 typedef struct _MULTIREAD_DESCRIPTOR {
3377 
3378 // ** FC_CDREAD **
3379 // CD-Read descriptor format 0x1e
3380 typedef struct _CD_READ_DESCRIPTOR {
3382 
3386  UCHAR DAP : 1; // DAP bit support in READ_CD/READ_CD_MFS
3387 
3390 
3391 // ** FC_FORMATTABLE **
3392 // Formattable descriptor format 0x23
3393 typedef struct _FORMATTABLE_DESCRIPTOR {
3395  // BD-RE options
3398  UCHAR Expand : 1; // Format Type 0x01 (Expand Spare)
3399  UCHAR RENoSA : 1; // Format Type 0x31 (NoSpare)
3402  // BD-R options
3403  UCHAR RRM : 1;
3407 
3408 // ** FC_CDRW_CAV_WRITE **
3409 // CD-RW CAV descriptor format 0x27
3410 typedef struct _CDRW_CAV_DESCRIPTOR {
3412 
3415 
3416 // ** FC_MRW **
3417 // MRW descriptor format 0x28
3418 typedef struct _MRW_DESCRIPTOR {
3420 
3425 
3426 // ** FC_DVDpRW **
3427 // DVD+RW descriptor format
3428 typedef struct _DVDpRW_DESCRIPTOR {
3430 
3433 
3437 
3440 
3441 // ** FC_DVDpR **
3442 // DVD+R descriptor format
3443 typedef struct _DVDpR_DESCRIPTOR {
3445 
3450 
3451 // ** FC_DVD_R_RW_WRITE **
3452 // DVD+R/RW writable descriptor format
3455 
3460  UCHAR BUF : 1;
3462 
3465 
3466 // ** FC_DVDpR_DL **
3467 // DVD+R DL descriptor format
3468 typedef struct _DVDpR_DL_DESCRIPTOR {
3470 
3475 
3476 // ** FC_REAL_TIME_STREAMING **
3477 // Real-time streaming descriptor format
3480 
3481  UCHAR SW : 1; // Stream Writing
3482  UCHAR WSPD : 1; // Write Speed (0x03) in GET_PREFORMANCE supported
3483  UCHAR MP2A : 1; // Mode page 2a (capabilities) supported
3484  UCHAR SCS : 1; // Set CD Speed supported
3485  UCHAR RBCB : 1; // Read Buffer Capacity supported
3487 
3490 
3491 // ** FC_BD_READ **
3492 // BlueRay Read descriptor format 0x40
3493 typedef struct _BD_READ_DESCRIPTOR {
3495 
3497  struct {
3502  } BD_RE_Bitmaps;
3503  struct {
3504  UCHAR Class0[2];
3505  UCHAR Class1[2];
3506  UCHAR Class2[2];
3507  UCHAR Class3[2];
3508  } BD_R_Bitmaps;
3509  struct {
3510  UCHAR Class0[2];
3511  UCHAR Class1[2];
3512  UCHAR Class2[2];
3513  UCHAR Class3[2];
3514  } BD_ROM_Bitmaps;
3515 
3517 
3518 // ** FC_BD_WRITE **
3519 // BlueRay Write descriptor format 0x41
3520 typedef struct _BD_WRITE_DESCRIPTOR {
3522 
3526  struct {
3531  } BD_RE_Bitmaps;
3532  struct {
3533  UCHAR Class0[2];
3534  UCHAR Class1[2];
3535  UCHAR Class2[2];
3536  UCHAR Class3[2];
3537  } BD_R_Bitmaps;
3538 
3540 
3541 // DVD structure blocks
3542 
3543 #define DvdBookType_ROM 0
3544 #define DvdBookType_RAM 1
3545 #define DvdBookType_R 2
3546 #define DvdBookType_RW 3
3547 #define DvdBookType_HD_ROM 4
3548 #define DvdBookType_HD_RAM 5
3549 #define DvdBookType_HD_R 6
3550 #define DvdBookType_pRold 8 // old spec ??
3551 #define DvdBookType_pRW 9
3552 #define DvdBookType_pR 0x0a
3553 #define DvdBookType_pRW_DL 0x0d
3554 #define DvdBookType_pR_DL 0x0e
3555 
3556 #define DvdDiskSize_120mm 0
3557 #define DvdDiskSize_80mm 1
3558 
3559 #define DvdLayerType_ROM 0x01
3560 #define DvdLayerType_R 0x02
3561 #define DvdLayerType_RW 0x04
3562 
3563 #define DvdMinimumRate_2_52 0x00
3564 #define DvdMinimumRate_5_04 0x01
3565 #define DvdMinimumRate_10_08 0x02
3566 #define DvdMinimumRate_20_16 0x03
3567 #define DvdMinimumRate_30_24 0x04
3568 #define DvdMinimumRate_NotSpecified 0x0f
3569 
3575 
3579 
3580 typedef struct _CDVD_KEY_HEADER {
3584 
3585 typedef struct _CDVD_REPORT_AGID_DATA {
3591 
3597 
3598 typedef struct _CDVD_KEY_DATA {
3603 
3604 typedef struct _CDVD_REPORT_ASF_DATA {
3610 
3611 typedef struct _CDVD_TITLE_KEY_HEADER {
3617  UCHAR CPM : 1;
3621 
3622 #pragma pack(pop)
3623 
3624 #endif //__CDRW_DEVICE_H__
UCHAR FieldReplaceableUnitCode
Definition: cdrw_hw.h:1177
struct _READ_TOC_FULL_TOC READ_TOC_FULL_TOC
struct _LUN_WRITE_PERF_DESC * PLUN_WRITE_PERF_DESC
struct _DISC_INFO_BLOCK::@861::@863 Fields
UCHAR Reserved2
Definition: cdrw_hw.h:1126
struct _MECHANICAL_STATUS_INFORMATION_HEADER * PMECHANICAL_STATUS_INFORMATION_HEADER
UCHAR CommandUniqueBits
Definition: cdrw_hw.h:34
UCHAR Params[11]
Definition: cdrw_hw.h:781
MODE_PARAMETER_HEADER ParameterListHeader
Definition: cdrw_hw.h:2536
UCHAR FirstTrackNumLastSes
Definition: cdrw_hw.h:2295
struct _CDB::_GET_EVENT_STATUS GET_EVENT_STATUS
UCHAR LeadIn_MSF[3]
Definition: cdrw_hw.h:1676
struct _CDB::_READ_DISC_INFO * PREAD_DISC_INFO
struct _CDB::_MODE_SELECT10 MODE_SELECT10
union _MODE_TIMEOUT_AND_PROTECT_PAGE::@895 Byte4
union _READ_TOC_ATIP::@810 DiscType
UCHAR Reserved2[2]
Definition: cdrw_hw.h:672
UCHAR SenseKey
Definition: cdrw_hw.h:1167
union _EVENT_STAT_MEDIA_BLOCK::@854 Byte1
UCHAR Reserved2[2]
Definition: cdrw_hw.h:447
struct _MODE_READ_RECOVERY_PAGE MODE_READ_RECOVERY_PAGE
UCHAR DataLength[2]
Definition: cdrw_hw.h:2048
struct _CDB::_READ_TRACK_INFO_3 * PREAD_TRACK_INFO_3
union _EVENT_STAT_MEDIA_BLOCK::@853 Byte0
struct _MODE_CD_PARAMS_PAGE::@885::@886 Fields
UCHAR Reserved3
Definition: cdrw_hw.h:1793
UCHAR Control
Definition: cdrw_hw.h:166
UCHAR Start_MSF[3]
Definition: cdrw_hw.h:1645
UCHAR Control
Definition: cdrw_hw.h:285
struct _CDB::_CLOSE_TRACK_SESSION * PCLOSE_TRACK_SESSION
struct _SLOT_TABLE_INFORMATION * PSLOT_TABLE_INFORMATION
UCHAR CommandSpecificInformation[4]
Definition: cdrw_hw.h:1174
struct _MRW_DESCRIPTOR MRW_DESCRIPTOR
struct _CDB::_LOAD_UNLOAD LOAD_UNLOAD
UCHAR MSF[3]
Definition: cdrw_hw.h:1589
UCHAR Reserved2[3]
Definition: cdrw_hw.h:163
struct _CDRW_FORMAT_DESCRIPTOR::@824::@825 Fields
UCHAR ProductRevisionLevel[4]
Definition: cdrw_hw.h:1134
struct _MODE_PARM_READ_WRITE MODE_PARM_READ_WRITE_DATA
struct _TOC_SES_INFO::@796::@806 StartPositionOfFirstLeadIn
UCHAR Reserved
Definition: cdrw_hw.h:39
struct _EVENT_STAT_DEV_BUSY_BLOCK * PEVENT_STAT_DEV_BUSY_BLOCK
struct _CDB::_WRITE_CD::@765::@766 Fields
UCHAR AllocationLength[2]
Definition: cdrw_hw.h:527
UCHAR Ending_MSF[3]
Definition: cdrw_hw.h:249
MODE_WRITE_PARAMS_PAGE Standard
Definition: cdrw_hw.h:2763
struct _EVENT_STAT_EXT_REQ_BLOCK * PEVENT_STAT_EXT_REQ_BLOCK
CDDA_PORT_CONTROL Port[4]
Definition: cdrw_hw.h:2856
struct _MODE_PARAMETER_HEADER MODE_PARAMETER_HEADER
struct _MODE_POWER_CONDITION_PAGE MODE_POWER_CONDITION_PAGE
union _EVENT_STAT_EXT_REQ_BLOCK::@849 Byte0
UCHAR LastRecordedAddr[4]
Definition: cdrw_hw.h:2445
struct _CDB::_WRITE_CD WRITE_CD
UCHAR AllocationLength[2]
Definition: cdrw_hw.h:768
UCHAR CopyManagementRevision[2]
Definition: cdrw_hw.h:3115
UCHAR AllocationLength[2]
Definition: cdrw_hw.h:492
UCHAR WriteCacheEnable
Definition: cdrw_hw.h:2779
UCHAR DataLength[2]
Definition: cdrw_hw.h:3581
UCHAR NumOfBlocks[3]
Definition: cdrw_hw.h:273
struct _CDB::_NEC_READ_CDDA NEC_READ_CDDA
struct _CDRW_CAV_DESCRIPTOR * PCDRW_CAV_DESCRIPTOR
DVD_FORMAT_DESCRIPTOR DvdFormatDescr
Definition: cdrw_hw.h:1998
struct _CDB::_MEDIA_REMOVAL MEDIA_REMOVAL
struct _DVDpR_DESCRIPTOR * PDVDpR_DESCRIPTOR
struct _READ_TOC_ATIP::@808::@814 Fields
struct _CDVD_KEY_DATA CDVD_KEY_DATA
UCHAR NumOfBlocks[2]
Definition: cdrw_hw.h:306
struct _CDB::_READ_CD * PREAD_CD
UCHAR NumOfPointers_M5
Definition: cdrw_hw.h:1655
struct _CDB::_READ_BUFFER_CAPACITY * PREAD_BUFFER_CAPACITY
UCHAR TrackLength[4]
Definition: cdrw_hw.h:2441
struct _FORMAT_LIST_HEADER FORMAT_LIST_HEADER
UCHAR Reserved
Definition: cdrw_hw.h:159
UCHAR CdDataMode
Definition: cdrw_hw.h:1859
UCHAR CurrentProfile[2]
Definition: cdrw_hw.h:3297
struct _FORMAT_LIST_HEADER::@822::@823 Fields
UCHAR WriteSpeed[2]
Definition: cdrw_hw.h:598
struct _MODE_POWER_CONDITION_PAGE::@889::@890 Fields
struct _CDB::_REPORT_KEY REPORT_KEY
CDRW_FORMAT_DESCRIPTOR CdFormatDescr
Definition: cdrw_hw.h:1996
struct _DVD_COPYRIGHT_INFORMATION DVD_COPYRIGHT_INFORMATION
UCHAR MaxSpeedCVL
Definition: cdrw_hw.h:1763
struct _CDB::_ERASE ERASE
struct _CAPACITY_LIST_HEADER CAPACITY_LIST_HEADER
struct _MODE_CAPABILITIES_PAGE2 * PMODE_CAPABILITIES_PAGE2
UCHAR ResponseDataFormat
Definition: cdrw_hw.h:1121
struct _CDB::_SEEK * PSEEK
UCHAR Control
Definition: cdrw_hw.h:664
struct _REMOVABLE_MEDIA_DESCRIPTOR * PREMOVABLE_MEDIA_DESCRIPTOR
UCHAR FReserved2
Definition: cdrw_hw.h:107
UCHAR LBA[4]
Definition: cdrw_hw.h:380
struct _FEATURE_LIST_HEADER FEATURE_LIST_HEADER
struct _CDB::_READ_TRACK_INFO READ_TRACK_INFO
UCHAR OperationCode
Definition: cdrw_hw.h:312
struct _CDB::_GET_CONFIGURATION GET_CONFIGURATION
struct _MODE_PARM_READ_WRITE * PMODE_PARM_READ_WRITE_DATA
UCHAR TriggerLBA[4]
Definition: cdrw_hw.h:741
struct _CDB::_SYNCHRONIZE_CACHE::@779::@780 Fields
struct _MODE_PARAMETER_BLOCK MODE_PARAMETER_BLOCK
struct _FORMATTABLE_DESCRIPTOR * PFORMATTABLE_DESCRIPTOR
FORMATTABLE_CAPACITY_DESCRIPTOR Descriptors[1]
Definition: cdrw_hw.h:2040
UCHAR SegmentNumber
Definition: cdrw_hw.h:1166
Definition: cdrw_hw.h:28
UCHAR NumOfAppendableTracks[2]
Definition: cdrw_hw.h:2351
struct _MODE_MRW_PAGE * PMODE_MRW_PAGE