4 * SCSI port and class interface.
6 * This file is part of the w32api package.
9 * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
11 * THIS SOFTWARE IS NOT COPYRIGHTED
13 * This source code is offered for use in the public domain. You may
14 * use, modify or distribute it freely.
16 * This code is distributed in the hope that it will be useful but
17 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
18 * DISCLAIMED. This includes but is not limited to warranties of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
27 #pragma GCC system_header
40 UCHAR CommandUniqueBits
: 4;
41 UCHAR LogicalUnitNumber
: 3;
42 UCHAR CommandUniqueBytes
[3];
46 UCHAR VendorUnique
: 2;
47 } CDB6GENERIC
, *PCDB6GENERIC
;
49 struct _CDB6READWRITE
{
51 UCHAR LogicalBlockMsb1
: 5;
52 UCHAR LogicalUnitNumber
: 3;
53 UCHAR LogicalBlockMsb0
;
54 UCHAR LogicalBlockLsb
;
57 } CDB6READWRITE
, *PCDB6READWRITE
;
62 UCHAR LogicalUnitNumber
: 3;
65 UCHAR AllocationLength
;
67 } CDB6INQUIRY
, *PCDB6INQUIRY
;
69 struct _CDB6INQUIRY3
{
71 UCHAR EnableVitalProductData
: 1;
72 UCHAR CommandSupportData
: 1;
76 UCHAR AllocationLength
;
78 } CDB6INQUIRY3
, *PCDB6INQUIRY3
;
83 UCHAR ByteCompare
: 1;
86 UCHAR LogicalUnitNumber
: 3;
87 UCHAR VerificationLength
[3];
89 } CDB6VERIFY
, *PCDB6VERIFY
;
93 UCHAR FormatControl
: 5;
94 UCHAR LogicalUnitNumber
: 3;
99 } CDB6FORMAT
, *PCDB6FORMAT
;
103 UCHAR RelativeAddress
: 1;
105 UCHAR ForceUnitAccess
: 1;
106 UCHAR DisablePageOut
: 1;
107 UCHAR LogicalUnitNumber
: 3;
108 UCHAR LogicalBlockByte0
;
109 UCHAR LogicalBlockByte1
;
110 UCHAR LogicalBlockByte2
;
111 UCHAR LogicalBlockByte3
;
113 UCHAR TransferBlocksMsb
;
114 UCHAR TransferBlocksLsb
;
120 UCHAR RelativeAddress
: 1;
122 UCHAR ForceUnitAccess
: 1;
123 UCHAR DisablePageOut
: 1;
124 UCHAR LogicalUnitNumber
: 3;
125 UCHAR LogicalBlock
[4];
126 UCHAR TransferLength
[4];
131 struct _PAUSE_RESUME
{
134 UCHAR LogicalUnitNumber
: 3;
138 } PAUSE_RESUME
, *PPAUSE_RESUME
;
145 UCHAR LogicalUnitNumber
: 3;
150 UCHAR AllocationLength
[2];
153 } READ_TOC
, *PREAD_TOC
;
155 struct _READ_DISK_INFORMATION
{
160 UCHAR AllocationLength
[2];
162 } READ_DISK_INFORMATION
, *PREAD_DISK_INFORMATION
;
164 struct _READ_TRACK_INFORMATION
{
170 UCHAR BlockAddress
[4];
172 UCHAR AllocationLength
[2];
174 } READ_TRACK_INFORMATION
, *PREAD_TRACK_INFORMATION
;
176 struct _RESERVE_TRACK_RZONE
{
179 UCHAR ReservationSize
[4];
181 } RESERVE_TRACK_RZONE
, *PRESERVE_TRACK_RZONE
;
183 struct _SEND_OPC_INFORMATION
{
188 UCHAR ParameterListLength
[2];
190 } SEND_OPC_INFORMATION
, *PSEND_OPC_INFORMATION
;
192 struct _CLOSE_TRACK
{
200 UCHAR TrackNumber
[2];
203 } CLOSE_TRACK
, *PCLOSE_TRACK
;
205 struct _SEND_CUE_SHEET
{
208 UCHAR CueSheetSize
[3];
210 } SEND_CUE_SHEET
, *PSEND_CUE_SHEET
;
212 struct _READ_HEADER
{
218 UCHAR LogicalBlockAddress
[4];
220 UCHAR AllocationLength
[2];
222 } READ_HEADER
, *PREAD_HEADER
;
227 UCHAR LogicalUnitNumber
: 3;
228 UCHAR StartingBlockAddress
[4];
232 } PLAY_AUDIO
, *PPLAY_AUDIO
;
234 struct _PLAY_AUDIO_MSF
{
237 UCHAR LogicalUnitNumber
: 3;
246 } PLAY_AUDIO_MSF
, *PPLAY_AUDIO_MSF
;
248 /* FIXME: Should the union be anonymous in C++ too? If so,
249 can't define named types _LBA and _MSF within anonymous union
255 UCHAR ExpectedSectorType
: 3;
262 UCHAR StartingBlockAddress
[4];
289 } PLAY_CD
, *PPLAY_CD
;
293 UCHAR RelativeAddress
: 1;
297 UCHAR StartingAddress
[4];
303 } SCAN_CD
, *PSCAN_CD
;
305 struct _STOP_PLAY_SCAN
{
311 } STOP_PLAY_SCAN
, *PSTOP_PLAY_SCAN
;
318 UCHAR LogicalUnitNumber
: 3;
325 UCHAR AllocationLength
[2];
327 } SUBCHANNEL
, *PSUBCHANNEL
;
331 UCHAR RelativeAddress
: 1;
333 UCHAR ExpectedSectorType
: 3;
335 UCHAR StartingLBA
[4];
336 UCHAR TransferBlocks
[3];
338 UCHAR ErrorFlags
: 2;
339 UCHAR IncludeEDC
: 1;
340 UCHAR IncludeUserData
: 1;
341 UCHAR HeaderCode
: 2;
342 UCHAR IncludeSyncData
: 1;
343 UCHAR SubChannelSelection
: 3;
346 } READ_CD
, *PREAD_CD
;
348 struct _READ_CD_MSF
{
350 UCHAR RelativeAddress
: 1;
352 UCHAR ExpectedSectorType
: 3;
363 UCHAR ErrorFlags
: 2;
364 UCHAR IncludeEDC
: 1;
365 UCHAR IncludeUserData
: 1;
366 UCHAR HeaderCode
: 2;
367 UCHAR IncludeSyncData
: 1;
368 UCHAR SubChannelSelection
: 3;
371 } READ_CD_MSF
, *PREAD_CD_MSF
;
373 struct _PLXTR_READ_CDDA
{
376 UCHAR LogicalUnitNumber
: 3;
377 UCHAR LogicalBlockByte0
;
378 UCHAR LogicalBlockByte1
;
379 UCHAR LogicalBlockByte2
;
380 UCHAR LogicalBlockByte3
;
381 UCHAR TransferBlockByte0
;
382 UCHAR TransferBlockByte1
;
383 UCHAR TransferBlockByte2
;
384 UCHAR TransferBlockByte3
;
387 } PLXTR_READ_CDDA
, *PPLXTR_READ_CDDA
;
389 struct _NEC_READ_CDDA
{
392 UCHAR LogicalBlockByte0
;
393 UCHAR LogicalBlockByte1
;
394 UCHAR LogicalBlockByte2
;
395 UCHAR LogicalBlockByte3
;
397 UCHAR TransferBlockByte0
;
398 UCHAR TransferBlockByte1
;
400 } NEC_READ_CDDA
, *PNEC_READ_CDDA
;
407 UCHAR LogicalUnitNumber
: 3;
411 UCHAR AllocationLength
;
413 } MODE_SENSE
, *PMODE_SENSE
;
415 struct _MODE_SENSE10
{
420 UCHAR LogicalUnitNumber
: 3;
424 UCHAR AllocationLength
[2];
426 } MODE_SENSE10
, *PMODE_SENSE10
;
428 struct _MODE_SELECT
{
433 UCHAR LogicalUnitNumber
: 3;
435 UCHAR ParameterListLength
;
437 } MODE_SELECT
, *PMODE_SELECT
;
439 struct _MODE_SELECT10
{
444 UCHAR LogicalUnitNumber
: 3;
446 UCHAR ParameterListLength
[2];
448 } MODE_SELECT10
, *PMODE_SELECT10
;
456 UCHAR LogicalUnitNumber
: 3;
458 UCHAR LogicalBlockAddress
[4];
469 UCHAR LogicalUnitNumber
: 3;
474 UCHAR ParameterPointer
[2];
475 UCHAR AllocationLength
[2];
477 } LOGSENSE
, *PLOGSENSE
;
484 UCHAR LogicalUnitNumber
: 3;
488 UCHAR ParameterListLength
[2];
490 } LOGSELECT
, *PLOGSELECT
;
495 UCHAR LogicalUnitNumber
: 3;
496 UCHAR TransferLength
[3];
503 UCHAR LogicalUnitNumber
: 3;
504 UCHAR LogicalBlockAddress
[4];
514 UCHAR LogicalUnitNumber
: 3;
523 UCHAR LogicalUnitNumber
: 3;
529 } START_STOP
, *PSTART_STOP
;
531 struct _MEDIA_REMOVAL
{
534 UCHAR LogicalUnitNumber
: 3;
538 UCHAR Persistant
: 1;
542 } MEDIA_REMOVAL
, *PMEDIA_REMOVAL
;
548 UCHAR BlockAddress
[3];
552 UCHAR VendorUnique
: 2;
553 } SEEK_BLOCK
, *PSEEK_BLOCK
;
555 struct _REQUEST_BLOCK_ADDRESS
{
558 UCHAR AllocationLength
;
562 UCHAR VendorUnique
: 2;
563 } REQUEST_BLOCK_ADDRESS
, *PREQUEST_BLOCK_ADDRESS
;
569 UCHAR PartitionSelect
: 6;
572 } PARTITION
, *PPARTITION
;
574 struct _WRITE_TAPE_MARKS
{
577 UCHAR WriteSetMarks
: 1;
579 UCHAR LogicalUnitNumber
: 3;
580 UCHAR TransferLength
[3];
582 } WRITE_TAPE_MARKS
, *PWRITE_TAPE_MARKS
;
584 struct _SPACE_TAPE_MARKS
{
588 UCHAR LogicalUnitNumber
: 3;
598 UCHAR VendorUnique
: 2;
601 } SPACE_TAPE_MARKS
, *PSPACE_TAPE_MARKS
;
603 struct _READ_POSITION
{
610 } READ_POSITION
, *PREAD_POSITION
;
612 struct _CDB6READWRITETAPE
{
614 UCHAR VendorSpecific
: 5;
616 UCHAR TransferLenMSB
;
618 UCHAR TransferLenLSB
;
622 UCHAR VendorUnique
: 2;
623 } CDB6READWRITETAPE
, *PCDB6READWRITETAPE
;
625 struct _INIT_ELEMENT_STATUS
{
628 UCHAR LogicalUnitNubmer
: 3;
632 } INIT_ELEMENT_STATUS
, *PINIT_ELEMENT_STATUS
;
634 struct _INITIALIZE_ELEMENT_RANGE
{
638 UCHAR LogicalUnitNubmer
: 3;
639 UCHAR FirstElementAddress
[2];
641 UCHAR NumberOfElements
[2];
645 } INITIALIZE_ELEMENT_RANGE
, *PINITIALIZE_ELEMENT_RANGE
;
647 struct _POSITION_TO_ELEMENT
{
650 UCHAR LogicalUnitNumber
: 3;
651 UCHAR TransportElementAddress
[2];
652 UCHAR DestinationElementAddress
[2];
657 } POSITION_TO_ELEMENT
, *PPOSITION_TO_ELEMENT
;
659 struct _MOVE_MEDIUM
{
662 UCHAR LogicalUnitNumber
: 3;
663 UCHAR TransportElementAddress
[2];
664 UCHAR SourceElementAddress
[2];
665 UCHAR DestinationElementAddress
[2];
670 } MOVE_MEDIUM
, *PMOVE_MEDIUM
;
672 struct _EXCHANGE_MEDIUM
{
675 UCHAR LogicalUnitNumber
: 3;
676 UCHAR TransportElementAddress
[2];
677 UCHAR SourceElementAddress
[2];
678 UCHAR Destination1ElementAddress
[2];
679 UCHAR Destination2ElementAddress
[2];
684 } EXCHANGE_MEDIUM
, *PEXCHANGE_MEDIUM
;
686 struct _READ_ELEMENT_STATUS
{
688 UCHAR ElementType
: 4;
690 UCHAR LogicalUnitNumber
: 3;
691 UCHAR StartingElementAddress
[2];
692 UCHAR NumberOfElements
[2];
694 UCHAR AllocationLength
[3];
697 } READ_ELEMENT_STATUS
, *PREAD_ELEMENT_STATUS
;
699 struct _SEND_VOLUME_TAG
{
701 UCHAR ElementType
: 4;
703 UCHAR LogicalUnitNumber
: 3;
704 UCHAR StartingElementAddress
[2];
706 UCHAR ActionCode
: 5;
709 UCHAR ParameterListLength
[2];
712 } SEND_VOLUME_TAG
, *PSEND_VOLUME_TAG
;
714 struct _REQUEST_VOLUME_ELEMENT_ADDRESS
{
716 UCHAR ElementType
: 4;
718 UCHAR LogicalUnitNumber
: 3;
719 UCHAR StartingElementAddress
[2];
720 UCHAR NumberElements
[2];
722 UCHAR AllocationLength
[3];
725 } REQUEST_VOLUME_ELEMENT_ADDRESS
, *PREQUEST_VOLUME_ELEMENT_ADDRESS
;
727 struct _LOAD_UNLOAD
{
739 } LOAD_UNLOAD
, *PLOAD_UNLOAD
;
741 struct _MECH_STATUS
{
746 UCHAR AllocationLength
[2];
749 } MECH_STATUS
, *PMECH_STATUS
;
751 struct _SYNCHRONIZE_CACHE10
{
760 UCHAR LogicalBlockAddress
[4];
764 } SYNCHRONIZE_CACHE10
, *PSYNCHRONIZE_CACHE10
;
766 struct _GET_EVENT_STATUS_NOTIFICATION
{
774 UCHAR NotificationClassRequest
;
776 UCHAR EventListLength
[2];
779 } GET_EVENT_STATUS_NOTIFICATION
, *PGET_EVENT_STATUS_NOTIFICATION
;
781 struct _READ_DVD_STRUCTURE
{
785 UCHAR RMDBlockNumber
[4];
788 UCHAR AllocationLength
[2];
792 } READ_DVD_STRUCTURE
, *PREAD_DVD_STRUCTURE
;
794 struct _SEND_DVD_STRUCTURE
{
800 UCHAR ParameterListLength
[2];
803 } SEND_DVD_STRUCTURE
, *PSEND_DVD_STRUCTURE
;
810 UCHAR ParameterListLength
[2];
814 } SEND_KEY
, *PSEND_KEY
;
820 UCHAR LogicalBlockAddress
[4];
822 UCHAR AllocationLength
[2];
826 } REPORT_KEY
, *PREPORT_KEY
;
828 struct _SET_READ_AHEAD
{
833 UCHAR ReadAheadLBA
[4];
836 } SET_READ_AHEAD
, *PSET_READ_AHEAD
;
838 struct _READ_FORMATTED_CAPACITIES
{
843 UCHAR AllocationLength
[2];
845 } READ_FORMATTED_CAPACITIES
, *PREAD_FORMATTED_CAPACITIES
;
847 struct _REPORT_LUNS
{
850 UCHAR AllocationLength
[4];
853 } REPORT_LUNS
, *PREPORT_LUNS
;
855 struct _PERSISTENT_RESERVE_IN
{
857 UCHAR ServiceAction
: 5;
860 UCHAR AllocationLength
[2];
862 } PERSISTENT_RESERVE_IN
, *PPERSISTENT_RESERVE_IN
;
864 struct _PERSISTENT_RESERVE_OUT
{
866 UCHAR ServiceAction
: 5;
871 UCHAR ParameterListLength
[2];
873 } PERSISTENT_RESERVE_OUT
, *PPERSISTENT_RESERVE_OUT
;
875 struct _GET_CONFIGURATION
{
877 UCHAR RequestType
: 1;
879 UCHAR StartingFeature
[2];
881 UCHAR AllocationLength
[2];
883 } GET_CONFIGURATION
, *PGET_CONFIGURATION
;
885 struct _SET_CD_SPEED
{
892 } SET_CD_SPEED
, *PSET_CD_SPEED
;
898 #ifndef _INQUIRYDATA_DEFINED /* also in minitape.h */
899 #define _INQUIRYDATA_DEFINED
901 #define INQUIRYDATABUFFERSIZE 36
903 typedef struct _INQUIRYDATA
{
904 UCHAR DeviceType
: 5;
905 UCHAR DeviceTypeQualifier
: 3;
906 UCHAR DeviceTypeModifier
: 7;
907 UCHAR RemovableMedia
: 1;
908 _ANONYMOUS_UNION
union {
910 _ANONYMOUS_STRUCT
struct {
911 UCHAR ANSIVersion
: 3;
912 UCHAR ECMAVersion
: 3;
913 UCHAR ISOVersion
: 2;
916 UCHAR ResponseDataFormat
: 4;
919 UCHAR TerminateTask
: 1;
921 UCHAR AdditionalLength
;
926 UCHAR MediumChanger
: 1;
928 UCHAR ReservedBit2
: 1;
929 UCHAR EnclosureServices
: 1;
930 UCHAR ReservedBit3
: 1;
932 UCHAR CommandQueue
: 1;
933 UCHAR TransferDisable
: 1;
934 UCHAR LinkedCommands
: 1;
935 UCHAR Synchronous
: 1;
938 UCHAR RelativeAddressing
: 1;
941 UCHAR ProductRevisionLevel
[4];
942 UCHAR VendorSpecific
[20];
944 } INQUIRYDATA
, *PINQUIRYDATA
;
947 /* INQUIRYDATA.DeviceType constants */
948 #define DIRECT_ACCESS_DEVICE 0x00
949 #define SEQUENTIAL_ACCESS_DEVICE 0x01
950 #define PRINTER_DEVICE 0x02
951 #define PROCESSOR_DEVICE 0x03
952 #define WRITE_ONCE_READ_MULTIPLE_DEVICE 0x04
953 #define READ_ONLY_DIRECT_ACCESS_DEVICE 0x05
954 #define SCANNER_DEVICE 0x06
955 #define OPTICAL_DEVICE 0x07
956 #define MEDIUM_CHANGER 0x08
957 #define COMMUNICATION_DEVICE 0x09
958 #define LOGICAL_UNIT_NOT_PRESENT_DEVICE 0x7F
959 #define DEVICE_QUALIFIER_NOT_SUPPORTED 0x03
961 /* INQUIRYDATA.DeviceTypeQualifier constants */
962 #define DEVICE_CONNECTED 0x00
964 #define SCSISTAT_GOOD 0x00
965 #define SCSISTAT_CHECK_CONDITION 0x02
966 #define SCSISTAT_CONDITION_MET 0x04
967 #define SCSISTAT_BUSY 0x08
968 #define SCSISTAT_INTERMEDIATE 0x10
969 #define SCSISTAT_INTERMEDIATE_COND_MET 0x14
970 #define SCSISTAT_RESERVATION_CONFLICT 0x18
971 #define SCSISTAT_COMMAND_TERMINATED 0x22
972 #define SCSISTAT_QUEUE_FULL 0x28
974 /* Mode Sense/Select page constants */
975 #define MODE_PAGE_ERROR_RECOVERY 0x01
976 #define MODE_PAGE_DISCONNECT 0x02
977 #define MODE_PAGE_FORMAT_DEVICE 0x03
978 #define MODE_PAGE_RIGID_GEOMETRY 0x04
979 #define MODE_PAGE_FLEXIBILE 0x05
980 #define MODE_PAGE_WRITE_PARAMETERS 0x05
981 #define MODE_PAGE_VERIFY_ERROR 0x07
982 #define MODE_PAGE_CACHING 0x08
983 #define MODE_PAGE_PERIPHERAL 0x09
984 #define MODE_PAGE_CONTROL 0x0A
985 #define MODE_PAGE_MEDIUM_TYPES 0x0B
986 #define MODE_PAGE_NOTCH_PARTITION 0x0C
987 #define MODE_PAGE_CD_AUDIO_CONTROL 0x0E
988 #define MODE_PAGE_DATA_COMPRESS 0x0F
989 #define MODE_PAGE_DEVICE_CONFIG 0x10
990 #define MODE_PAGE_MEDIUM_PARTITION 0x11
991 #define MODE_PAGE_CDVD_FEATURE_SET 0x18
992 #define MODE_PAGE_POWER_CONDITION 0x1A
993 #define MODE_PAGE_FAULT_REPORTING 0x1C
994 #define MODE_PAGE_CDVD_INACTIVITY 0x1D
995 #define MODE_PAGE_ELEMENT_ADDRESS 0x1D
996 #define MODE_PAGE_TRANSPORT_GEOMETRY 0x1E
997 #define MODE_PAGE_DEVICE_CAPABILITIES 0x1F
998 #define MODE_PAGE_CAPABILITIES 0x2A
999 #define MODE_SENSE_RETURN_ALL 0x3f
1000 #define MODE_SENSE_CURRENT_VALUES 0x00
1001 #define MODE_SENSE_CHANGEABLE_VALUES 0x40
1002 #define MODE_SENSE_DEFAULT_VAULES 0x80
1003 #define MODE_SENSE_SAVED_VALUES 0xc0
1005 /* SCSI CDB operation codes */
1006 #define SCSIOP_TEST_UNIT_READY 0x00
1007 #define SCSIOP_REZERO_UNIT 0x01
1008 #define SCSIOP_REWIND 0x01
1009 #define SCSIOP_REQUEST_BLOCK_ADDR 0x02
1010 #define SCSIOP_REQUEST_SENSE 0x03
1011 #define SCSIOP_FORMAT_UNIT 0x04
1012 #define SCSIOP_READ_BLOCK_LIMITS 0x05
1013 #define SCSIOP_REASSIGN_BLOCKS 0x07
1014 #define SCSIOP_INIT_ELEMENT_STATUS 0x07
1015 #define SCSIOP_READ6 0x08
1016 #define SCSIOP_RECEIVE 0x08
1017 #define SCSIOP_WRITE6 0x0A
1018 #define SCSIOP_PRINT 0x0A
1019 #define SCSIOP_SEND 0x0A
1020 #define SCSIOP_SEEK6 0x0B
1021 #define SCSIOP_TRACK_SELECT 0x0B
1022 #define SCSIOP_SLEW_PRINT 0x0B
1023 #define SCSIOP_SEEK_BLOCK 0x0C
1024 #define SCSIOP_PARTITION 0x0D
1025 #define SCSIOP_READ_REVERSE 0x0F
1026 #define SCSIOP_WRITE_FILEMARKS 0x10
1027 #define SCSIOP_FLUSH_BUFFER 0x10
1028 #define SCSIOP_SPACE 0x11
1029 #define SCSIOP_INQUIRY 0x12
1030 #define SCSIOP_VERIFY6 0x13
1031 #define SCSIOP_RECOVER_BUF_DATA 0x14
1032 #define SCSIOP_MODE_SELECT 0x15
1033 #define SCSIOP_RESERVE_UNIT 0x16
1034 #define SCSIOP_RELEASE_UNIT 0x17
1035 #define SCSIOP_COPY 0x18
1036 #define SCSIOP_ERASE 0x19
1037 #define SCSIOP_MODE_SENSE 0x1A
1038 #define SCSIOP_START_STOP_UNIT 0x1B
1039 #define SCSIOP_STOP_PRINT 0x1B
1040 #define SCSIOP_LOAD_UNLOAD 0x1B
1041 #define SCSIOP_RECEIVE_DIAGNOSTIC 0x1C
1042 #define SCSIOP_SEND_DIAGNOSTIC 0x1D
1043 #define SCSIOP_MEDIUM_REMOVAL 0x1E
1045 #define SCSIOP_READ_FORMATTED_CAPACITY 0x23
1046 #define SCSIOP_READ_CAPACITY 0x25
1047 #define SCSIOP_READ 0x28
1048 #define SCSIOP_WRITE 0x2A
1049 #define SCSIOP_SEEK 0x2B
1050 #define SCSIOP_LOCATE 0x2B
1051 #define SCSIOP_POSITION_TO_ELEMENT 0x2B
1052 #define SCSIOP_WRITE_VERIFY 0x2E
1053 #define SCSIOP_VERIFY 0x2F
1054 #define SCSIOP_SEARCH_DATA_HIGH 0x30
1055 #define SCSIOP_SEARCH_DATA_EQUAL 0x31
1056 #define SCSIOP_SEARCH_DATA_LOW 0x32
1057 #define SCSIOP_SET_LIMITS 0x33
1058 #define SCSIOP_READ_POSITION 0x34
1059 #define SCSIOP_SYNCHRONIZE_CACHE 0x35
1060 #define SCSIOP_COMPARE 0x39
1061 #define SCSIOP_COPY_COMPARE 0x3A
1062 #define SCSIOP_WRITE_DATA_BUFF 0x3B
1063 #define SCSIOP_READ_DATA_BUFF 0x3C
1064 #define SCSIOP_CHANGE_DEFINITION 0x40
1065 #define SCSIOP_READ_SUB_CHANNEL 0x42
1066 #define SCSIOP_READ_TOC 0x43
1067 #define SCSIOP_READ_HEADER 0x44
1068 #define SCSIOP_PLAY_AUDIO 0x45
1069 #define SCSIOP_GET_CONFIGURATION 0x46
1070 #define SCSIOP_PLAY_AUDIO_MSF 0x47
1071 #define SCSIOP_PLAY_TRACK_INDEX 0x48
1072 #define SCSIOP_PLAY_TRACK_RELATIVE 0x49
1073 #define SCSIOP_GET_EVENT_STATUS 0x4A
1074 #define SCSIOP_PAUSE_RESUME 0x4B
1075 #define SCSIOP_LOG_SELECT 0x4C
1076 #define SCSIOP_LOG_SENSE 0x4D
1077 #define SCSIOP_STOP_PLAY_SCAN 0x4E
1078 #define SCSIOP_READ_DISK_INFORMATION 0x51
1079 #define SCSIOP_READ_TRACK_INFORMATION 0x52
1080 #define SCSIOP_RESERVE_TRACK_RZONE 0x53
1081 #define SCSIOP_SEND_OPC_INFORMATION 0x54
1082 #define SCSIOP_MODE_SELECT10 0x55
1083 #define SCSIOP_MODE_SENSE10 0x5A
1084 #define SCSIOP_CLOSE_TRACK_SESSION 0x5B
1085 #define SCSIOP_READ_BUFFER_CAPACITY 0x5C
1086 #define SCSIOP_SEND_CUE_SHEET 0x5D
1087 #define SCSIOP_PERSISTENT_RESERVE_IN 0x5E
1088 #define SCSIOP_PERSISTENT_RESERVE_OUT 0x5F
1090 #define SCSIOP_REPORT_LUNS 0xA0
1091 #define SCSIOP_BLANK 0xA1
1092 #define SCSIOP_SEND_KEY 0xA3
1093 #define SCSIOP_REPORT_KEY 0xA4
1094 #define SCSIOP_MOVE_MEDIUM 0xA5
1095 #define SCSIOP_LOAD_UNLOAD_SLOT 0xA6
1096 #define SCSIOP_EXCHANGE_MEDIUM 0xA6
1097 #define SCSIOP_SET_READ_AHEAD 0xA7
1098 #define SCSIOP_READ_DVD_STRUCTURE 0xAD
1099 #define SCSIOP_REQUEST_VOL_ELEMENT 0xB5
1100 #define SCSIOP_SEND_VOLUME_TAG 0xB6
1101 #define SCSIOP_READ_ELEMENT_STATUS 0xB8
1102 #define SCSIOP_READ_CD_MSF 0xB9
1103 #define SCSIOP_SCAN_CD 0xBA
1104 #define SCSIOP_SET_CD_SPEED 0xBB
1105 #define SCSIOP_PLAY_CD 0xBC
1106 #define SCSIOP_MECHANISM_STATUS 0xBD
1107 #define SCSIOP_READ_CD 0xBE
1108 #define SCSIOP_SEND_DVD_STRUCTURE 0xBF
1109 #define SCSIOP_INIT_ELEMENT_RANGE 0xE7
1111 #define SCSIOP_DENON_EJECT_DISC 0xE6
1112 #define SCSIOP_DENON_STOP_AUDIO 0xE7
1113 #define SCSIOP_DENON_PLAY_AUDIO 0xE8
1114 #define SCSIOP_DENON_READ_TOC 0xE9
1115 #define SCSIOP_DENON_READ_SUBCODE 0xEB
1117 #define SCSIMESS_MODIFY_DATA_POINTER 0x00
1118 #define SCSIMESS_SYNCHRONOUS_DATA_REQ 0x01
1119 #define SCSIMESS_WIDE_DATA_REQUEST 0x03
1121 #define SCSIMESS_MODIFY_DATA_LENGTH 5
1122 #define SCSIMESS_SYNCH_DATA_LENGTH 3
1123 #define SCSIMESS_WIDE_DATA_LENGTH 2
1125 #define SCSIMESS_ABORT 0x06
1126 #define SCSIMESS_ABORT_WITH_TAG 0x0D
1127 #define SCSIMESS_BUS_DEVICE_RESET 0x0C
1128 #define SCSIMESS_CLEAR_QUEUE 0x0E
1129 #define SCSIMESS_COMMAND_COMPLETE 0x00
1130 #define SCSIMESS_DISCONNECT 0x04
1131 #define SCSIMESS_EXTENDED_MESSAGE 0x01
1132 #define SCSIMESS_IDENTIFY 0x80
1133 #define SCSIMESS_IDENTIFY_WITH_DISCON 0xC0
1134 #define SCSIMESS_IGNORE_WIDE_RESIDUE 0x23
1135 #define SCSIMESS_INITIATE_RECOVERY 0x0F
1136 #define SCSIMESS_INIT_DETECTED_ERROR 0x05
1137 #define SCSIMESS_LINK_CMD_COMP 0x0A
1138 #define SCSIMESS_LINK_CMD_COMP_W_FLAG 0x0B
1139 #define SCSIMESS_MESS_PARITY_ERROR 0x09
1140 #define SCSIMESS_MESSAGE_REJECT 0x07
1141 #define SCSIMESS_NO_OPERATION 0x08
1142 #define SCSIMESS_HEAD_OF_QUEUE_TAG 0x21
1143 #define SCSIMESS_ORDERED_QUEUE_TAG 0x22
1144 #define SCSIMESS_SIMPLE_QUEUE_TAG 0x20
1145 #define SCSIMESS_RELEASE_RECOVERY 0x10
1146 #define SCSIMESS_RESTORE_POINTERS 0x03
1147 #define SCSIMESS_SAVE_DATA_POINTER 0x02
1148 #define SCSIMESS_TERMINATE_IO_PROCESS 0x11
1150 #define CDB_FORCE_MEDIA_ACCESS 0x08
1152 #define CDB_RETURN_ON_COMPLETION 0
1153 #define CDB_RETURN_IMMEDIATE 1
1155 #define CDB_INQUIRY_EVPD 0x01
1157 #define LUN0_FORMAT_SAVING_DEFECT_LIST 0
1158 #define USE_DEFAULTMSB 0
1159 #define USE_DEFAULTLSB 0
1161 #define START_UNIT_CODE 0x01
1162 #define STOP_UNIT_CODE 0x00
1164 typedef struct _SENSE_DATA
{
1165 UCHAR ErrorCode
: 7;
1167 UCHAR SegmentNumber
;
1170 UCHAR IncorrectLength
: 1;
1171 UCHAR EndOfMedia
: 1;
1173 UCHAR Information
[4];
1174 UCHAR AdditionalSenseLength
;
1175 UCHAR CommandSpecificInformation
[4];
1176 UCHAR AdditionalSenseCode
;
1177 UCHAR AdditionalSenseCodeQualifier
;
1178 UCHAR FieldReplaceableUnitCode
;
1179 UCHAR SenseKeySpecific
[3];
1180 } SENSE_DATA
, *PSENSE_DATA
;
1182 #define SENSE_BUFFER_SIZE 18
1185 #define SCSI_SENSE_NO_SENSE 0x00
1186 #define SCSI_SENSE_RECOVERED_ERROR 0x01
1187 #define SCSI_SENSE_NOT_READY 0x02
1188 #define SCSI_SENSE_MEDIUM_ERROR 0x03
1189 #define SCSI_SENSE_HARDWARE_ERROR 0x04
1190 #define SCSI_SENSE_ILLEGAL_REQUEST 0x05
1191 #define SCSI_SENSE_UNIT_ATTENTION 0x06
1192 #define SCSI_SENSE_DATA_PROTECT 0x07
1193 #define SCSI_SENSE_BLANK_CHECK 0x08
1194 #define SCSI_SENSE_UNIQUE 0x09
1195 #define SCSI_SENSE_COPY_ABORTED 0x0A
1196 #define SCSI_SENSE_ABORTED_COMMAND 0x0B
1197 #define SCSI_SENSE_EQUAL 0x0C
1198 #define SCSI_SENSE_VOL_OVERFLOW 0x0D
1199 #define SCSI_SENSE_MISCOMPARE 0x0E
1200 #define SCSI_SENSE_RESERVED 0x0F
1202 /* Additional tape bit */
1203 #define SCSI_ILLEGAL_LENGTH 0x20
1204 #define SCSI_EOM 0x40
1205 #define SCSI_FILE_MARK 0x80
1207 /* Additional Sense codes */
1208 #define SCSI_ADSENSE_NO_SENSE 0x00
1209 #define SCSI_ADSENSE_NO_SEEK_COMPLETE 0x02
1210 #define SCSI_ADSENSE_LUN_NOT_READY 0x04
1211 #define SCSI_ADSENSE_WRITE_ERROR 0x0C
1212 #define SCSI_ADSENSE_TRACK_ERROR 0x14
1213 #define SCSI_ADSENSE_SEEK_ERROR 0x15
1214 #define SCSI_ADSENSE_REC_DATA_NOECC 0x17
1215 #define SCSI_ADSENSE_REC_DATA_ECC 0x18
1216 #define SCSI_ADSENSE_ILLEGAL_COMMAND 0x20
1217 #define SCSI_ADSENSE_ILLEGAL_BLOCK 0x21
1218 #define SCSI_ADSENSE_INVALID_CDB 0x24
1219 #define SCSI_ADSENSE_INVALID_LUN 0x25
1220 #define SCSI_ADSENSE_WRITE_PROTECT 0x27
1221 #define SCSI_ADSENSE_MEDIUM_CHANGED 0x28
1222 #define SCSI_ADSENSE_BUS_RESET 0x29
1223 #define SCSI_ADSENSE_INSUFFICIENT_TIME_FOR_OPERATION 0x2E
1224 #define SCSI_ADSENSE_INVALID_MEDIA 0x30
1225 #define SCSI_ADSENSE_NO_MEDIA_IN_DEVICE 0x3a
1226 #define SCSI_ADSENSE_POSITION_ERROR 0x3b
1227 #define SCSI_ADSENSE_OPERATOR_REQUEST 0x5a
1228 #define SCSI_ADSENSE_FAILURE_PREDICTION_THRESHOLD_EXCEEDED 0x5d
1229 #define SCSI_ADSENSE_ILLEGAL_MODE_FOR_THIS_TRACK 0x64
1230 #define SCSI_ADSENSE_COPY_PROTECTION_FAILURE 0x6f
1231 #define SCSI_ADSENSE_POWER_CALIBRATION_ERROR 0x73
1232 #define SCSI_ADSENSE_VENDOR_UNIQUE 0x80
1233 #define SCSI_ADSENSE_MUSIC_AREA 0xA0
1234 #define SCSI_ADSENSE_DATA_AREA 0xA1
1235 #define SCSI_ADSENSE_VOLUME_OVERFLOW 0xA7
1237 #define SCSI_SENSEQ_CAUSE_NOT_REPORTABLE 0x00
1238 #define SCSI_SENSEQ_BECOMING_READY 0x01
1239 #define SCSI_SENSEQ_INIT_COMMAND_REQUIRED 0x02
1240 #define SCSI_SENSEQ_MANUAL_INTERVENTION_REQUIRED 0x03
1241 #define SCSI_SENSEQ_FORMAT_IN_PROGRESS 0x04
1242 #define SCSI_SENSEQ_REBUILD_IN_PROGRESS 0x05
1243 #define SCSI_SENSEQ_RECALCULATION_IN_PROGRESS 0x06
1244 #define SCSI_SENSEQ_OPERATION_IN_PROGRESS 0x07
1245 #define SCSI_SENSEQ_LONG_WRITE_IN_PROGRESS 0x08
1246 #define SCSI_SENSEQ_LOSS_OF_STREAMING 0x09
1247 #define SCSI_SENSEQ_PADDING_BLOCKS_ADDED 0x0A
1250 #define FILE_DEVICE_SCSI 0x0000001b
1252 #define IOCTL_SCSI_EXECUTE_IN ((FILE_DEVICE_SCSI << 16) + 0x0011)
1253 #define IOCTL_SCSI_EXECUTE_OUT ((FILE_DEVICE_SCSI << 16) + 0x0012)
1254 #define IOCTL_SCSI_EXECUTE_NONE ((FILE_DEVICE_SCSI << 16) + 0x0013)
1256 /* SMART support in ATAPI */
1257 #define IOCTL_SCSI_MINIPORT_SMART_VERSION ((FILE_DEVICE_SCSI << 16) + 0x0500)
1258 #define IOCTL_SCSI_MINIPORT_IDENTIFY ((FILE_DEVICE_SCSI << 16) + 0x0501)
1259 #define IOCTL_SCSI_MINIPORT_READ_SMART_ATTRIBS ((FILE_DEVICE_SCSI << 16) + 0x0502)
1260 #define IOCTL_SCSI_MINIPORT_READ_SMART_THRESHOLDS ((FILE_DEVICE_SCSI << 16) + 0x0503)
1261 #define IOCTL_SCSI_MINIPORT_ENABLE_SMART ((FILE_DEVICE_SCSI << 16) + 0x0504)
1262 #define IOCTL_SCSI_MINIPORT_DISABLE_SMART ((FILE_DEVICE_SCSI << 16) + 0x0505)
1263 #define IOCTL_SCSI_MINIPORT_RETURN_STATUS ((FILE_DEVICE_SCSI << 16) + 0x0506)
1264 #define IOCTL_SCSI_MINIPORT_ENABLE_DISABLE_AUTOSAVE ((FILE_DEVICE_SCSI << 16) + 0x0507)
1265 #define IOCTL_SCSI_MINIPORT_SAVE_ATTRIBUTE_VALUES ((FILE_DEVICE_SCSI << 16) + 0x0508)
1266 #define IOCTL_SCSI_MINIPORT_EXECUTE_OFFLINE_DIAGS ((FILE_DEVICE_SCSI << 16) + 0x0509)
1267 #define IOCTL_SCSI_MINIPORT_ENABLE_DISABLE_AUTO_OFFLINE ((FILE_DEVICE_SCSI << 16) + 0x050a)
1268 #define IOCTL_SCSI_MINIPORT_READ_SMART_LOG ((FILE_DEVICE_SCSI << 16) + 0x050b)
1269 #define IOCTL_SCSI_MINIPORT_WRITE_SMART_LOG ((FILE_DEVICE_SCSI << 16) + 0x050c)
1271 /* CLUSTER support */
1272 #define IOCTL_SCSI_MINIPORT_NOT_QUORUM_CAPABLE ((FILE_DEVICE_SCSI << 16) + 0x0520)
1273 #define IOCTL_SCSI_MINIPORT_NOT_CLUSTER_CAPABLE ((FILE_DEVICE_SCSI << 16) + 0x0521)
1275 /* Read Capacity Data. Returned in Big Endian format */
1276 typedef struct _READ_CAPACITY_DATA
{
1277 ULONG LogicalBlockAddress
;
1278 ULONG BytesPerBlock
;
1279 } READ_CAPACITY_DATA
, *PREAD_CAPACITY_DATA
;
1281 /* Read Block Limits Data. Returned in Big Endian format */
1282 typedef struct _READ_BLOCK_LIMITS
{
1284 UCHAR BlockMaximumSize
[3];
1285 UCHAR BlockMinimumSize
[2];
1286 } READ_BLOCK_LIMITS_DATA
, *PREAD_BLOCK_LIMITS_DATA
;
1289 typedef struct _MODE_PARAMETER_HEADER
{
1290 UCHAR ModeDataLength
;
1292 UCHAR DeviceSpecificParameter
;
1293 UCHAR BlockDescriptorLength
;
1294 }MODE_PARAMETER_HEADER
, *PMODE_PARAMETER_HEADER
;
1296 typedef struct _MODE_PARAMETER_HEADER10
{
1297 UCHAR ModeDataLength
[2];
1299 UCHAR DeviceSpecificParameter
;
1301 UCHAR BlockDescriptorLength
[2];
1302 } MODE_PARAMETER_HEADER10
, *PMODE_PARAMETER_HEADER10
;
1304 #define MODE_FD_SINGLE_SIDE 0x01
1305 #define MODE_FD_DOUBLE_SIDE 0x02
1306 #define MODE_FD_MAXIMUM_TYPE 0x1E
1307 #define MODE_DSP_FUA_SUPPORTED 0x10
1308 #define MODE_DSP_WRITE_PROTECT 0x80
1310 typedef struct _MODE_PARAMETER_BLOCK
{
1312 UCHAR NumberOfBlocks
[3];
1314 UCHAR BlockLength
[3];
1315 } MODE_PARAMETER_BLOCK
, *PMODE_PARAMETER_BLOCK
;
1317 typedef struct _MODE_DISCONNECT_PAGE
{
1320 UCHAR PageSavable
: 1;
1322 UCHAR BufferFullRatio
;
1323 UCHAR BufferEmptyRatio
;
1324 UCHAR BusInactivityLimit
[2];
1325 UCHAR BusDisconnectTime
[2];
1326 UCHAR BusConnectTime
[2];
1327 UCHAR MaximumBurstSize
[2];
1328 UCHAR DataTransferDisconnect
: 2;
1330 }MODE_DISCONNECT_PAGE
, *PMODE_DISCONNECT_PAGE
;
1332 typedef struct _MODE_CACHING_PAGE
{
1335 UCHAR PageSavable
: 1;
1337 UCHAR ReadDisableCache
: 1;
1338 UCHAR MultiplicationFactor
: 1;
1339 UCHAR WriteCacheEnable
: 1;
1340 UCHAR Reserved2
: 5;
1341 UCHAR WriteRetensionPriority
: 4;
1342 UCHAR ReadRetensionPriority
: 4;
1343 UCHAR DisablePrefetchTransfer
[2];
1344 UCHAR MinimumPrefetch
[2];
1345 UCHAR MaximumPrefetch
[2];
1346 UCHAR MaximumPrefetchCeiling
[2];
1347 }MODE_CACHING_PAGE
, *PMODE_CACHING_PAGE
;
1349 typedef struct _MODE_CDROM_WRITE_PARAMETERS_PAGE
{
1351 UCHAR WriteType
: 4;
1352 UCHAR TestWrite
: 1;
1353 UCHAR LinkSizeValid
: 1;
1354 UCHAR BufferUnderrunFreeEnabled
: 1;
1355 UCHAR Reserved2
: 1;
1356 UCHAR TrackMode
: 4;
1358 UCHAR FixedPacket
: 1;
1359 UCHAR MultiSession
: 2;
1360 UCHAR DataBlockType
: 4;
1361 UCHAR Reserved3
: 4;
1364 UCHAR HostApplicationCode
: 6;
1365 UCHAR Reserved5
: 2;
1366 UCHAR SessionFormat
;
1368 UCHAR PacketSize
[4];
1369 UCHAR AudioPauseLength
[2];
1370 UCHAR Reserved7
: 7;
1371 UCHAR MediaCatalogNumberValid
: 1;
1372 UCHAR MediaCatalogNumber
[13];
1373 UCHAR MediaCatalogNumberZero
;
1374 UCHAR MediaCatalogNumberAFrame
;
1375 UCHAR Reserved8
: 7;
1376 UCHAR ISRCValid
: 1;
1377 UCHAR ISRCCountry
[2];
1379 UCHAR ISRCRecordingYear
[2];
1380 UCHAR ISRCSerialNumber
[5];
1384 UCHAR SubHeaderData
[4];
1385 } MODE_CDROM_WRITE_PARAMETERS_PAGE
, *PMODE_CDROM_WRITE_PARAMETERS_PAGE
;
1387 typedef struct _MODE_FLEXIBLE_DISK_PAGE
{
1390 UCHAR PageSavable
: 1;
1392 UCHAR TransferRate
[2];
1393 UCHAR NumberOfHeads
;
1394 UCHAR SectorsPerTrack
;
1395 UCHAR BytesPerSector
[2];
1396 UCHAR NumberOfCylinders
[2];
1397 UCHAR StartWritePrecom
[2];
1398 UCHAR StartReducedCurrent
[2];
1400 UCHAR StepPluseWidth
;
1401 UCHAR HeadSettleDelay
[2];
1403 UCHAR MotorOffDelay
;
1404 UCHAR Reserved2
: 5;
1405 UCHAR MotorOnAsserted
: 1;
1406 UCHAR StartSectorNumber
: 1;
1407 UCHAR TrueReadySignal
: 1;
1408 UCHAR StepPlusePerCyclynder
: 4;
1409 UCHAR Reserved3
: 4;
1410 UCHAR WriteCompenstation
;
1411 UCHAR HeadLoadDelay
;
1412 UCHAR HeadUnloadDelay
;
1413 UCHAR Pin2Usage
: 4;
1414 UCHAR Pin34Usage
: 4;
1415 UCHAR Pin1Usage
: 4;
1416 UCHAR Pin4Usage
: 4;
1417 UCHAR MediumRotationRate
[2];
1419 } MODE_FLEXIBLE_DISK_PAGE
, *PMODE_FLEXIBLE_DISK_PAGE
;
1421 typedef struct _MODE_FORMAT_PAGE
{
1424 UCHAR PageSavable
: 1;
1426 UCHAR TracksPerZone
[2];
1427 UCHAR AlternateSectorsPerZone
[2];
1428 UCHAR AlternateTracksPerZone
[2];
1429 UCHAR AlternateTracksPerLogicalUnit
[2];
1430 UCHAR SectorsPerTrack
[2];
1431 UCHAR BytesPerPhysicalSector
[2];
1432 UCHAR Interleave
[2];
1433 UCHAR TrackSkewFactor
[2];
1434 UCHAR CylinderSkewFactor
[2];
1435 UCHAR Reserved2
: 4;
1436 UCHAR SurfaceFirst
: 1;
1437 UCHAR RemovableMedia
: 1;
1438 UCHAR HardSectorFormating
: 1;
1439 UCHAR SoftSectorFormating
: 1;
1441 } MODE_FORMAT_PAGE
, *PMODE_FORMAT_PAGE
;
1443 typedef struct _MODE_RIGID_GEOMETRY_PAGE
{
1446 UCHAR PageSavable
: 1;
1448 UCHAR NumberOfCylinders
[3];
1449 UCHAR NumberOfHeads
;
1450 UCHAR StartWritePrecom
[3];
1451 UCHAR StartReducedCurrent
[3];
1452 UCHAR DriveStepRate
[2];
1453 UCHAR LandZoneCyclinder
[3];
1454 UCHAR RotationalPositionLock
: 2;
1455 UCHAR Reserved2
: 6;
1456 UCHAR RotationOffset
;
1458 UCHAR RoataionRate
[2];
1460 } MODE_RIGID_GEOMETRY_PAGE
, *PMODE_RIGID_GEOMETRY_PAGE
;
1462 typedef struct _MODE_READ_WRITE_RECOVERY_PAGE
{
1464 UCHAR Reserved1
: 1;
1475 UCHAR ReadRetryCount
;
1477 UCHAR WriteRetryCount
;
1479 } MODE_READ_WRITE_RECOVERY_PAGE
, *PMODE_READ_WRITE_RECOVERY_PAGE
;
1481 typedef struct _MODE_READ_RECOVERY_PAGE
{
1483 UCHAR Reserved1
: 1;
1489 UCHAR Reserved2
: 1;
1492 UCHAR Reserved3
: 2;
1493 UCHAR ReadRetryCount
;
1495 } MODE_READ_RECOVERY_PAGE
, *PMODE_READ_RECOVERY_PAGE
;
1497 typedef struct _MODE_INFO_EXCEPTIONS
{
1499 UCHAR Reserved1
: 1;
1502 _ANONYMOUS_UNION
union {
1504 _ANONYMOUS_STRUCT
struct {
1506 UCHAR Reserved2
: 1;
1509 UCHAR Reserved3
: 3;
1513 UCHAR ReportMethod
: 4;
1514 UCHAR Reserved4
: 4;
1515 UCHAR IntervalTimer
[4];
1516 UCHAR ReportCount
[4];
1517 } MODE_INFO_EXCEPTIONS
, *PMODE_INFO_EXCEPTIONS
;
1519 /* CDROM audio control */
1520 #define CDB_AUDIO_PAUSE 0x00
1521 #define CDB_AUDIO_RESUME 0x01
1522 #define CDB_DEVICE_START 0x11
1523 #define CDB_DEVICE_STOP 0x10
1524 #define CDB_EJECT_MEDIA 0x10
1525 #define CDB_LOAD_MEDIA 0x01
1526 #define CDB_SUBCHANNEL_HEADER 0x00
1527 #define CDB_SUBCHANNEL_BLOCK 0x01
1529 #define CDROM_AUDIO_CONTROL_PAGE 0x0E
1530 #define MODE_SELECT_IMMEDIATE 0x04
1531 #define MODE_SELECT_PFBIT 0x10
1533 #define CDB_USE_MSF 0x01
1535 typedef struct _PORT_OUTPUT
{
1536 UCHAR ChannelSelection
;
1538 } PORT_OUTPUT
, *PPORT_OUTPUT
;
1540 typedef struct _AUDIO_OUTPUT
{
1542 UCHAR ParameterLength
;
1546 UCHAR LogicalBlocksPerSecond
[2];
1547 PORT_OUTPUT PortOutput
[4];
1548 } AUDIO_OUTPUT
, *PAUDIO_OUTPUT
;
1550 /* Multisession CDROMs */
1551 #define GET_LAST_SESSION 0x01
1552 #define GET_SESSION_DATA 0x02;
1554 /* Atapi 2.5 changers */
1555 typedef struct _MECHANICAL_STATUS_INFORMATION_HEADER
{
1556 UCHAR CurrentSlot
: 5;
1557 UCHAR ChangerState
: 2;
1560 UCHAR MechanismState
: 3;
1561 UCHAR CurrentLogicalBlockAddress
[3];
1562 UCHAR NumberAvailableSlots
;
1563 UCHAR SlotTableLength
[2];
1564 } MECHANICAL_STATUS_INFORMATION_HEADER
, *PMECHANICAL_STATUS_INFORMATION_HEADER
;
1566 typedef struct _SLOT_TABLE_INFORMATION
{
1567 UCHAR DiscChanged
: 1;
1569 UCHAR DiscPresent
: 1;
1571 } SLOT_TABLE_INFORMATION
, *PSLOT_TABLE_INFORMATION
;
1573 typedef struct _MECHANICAL_STATUS
{
1574 MECHANICAL_STATUS_INFORMATION_HEADER MechanicalStatusHeader
;
1575 SLOT_TABLE_INFORMATION SlotTableInfo
[1];
1576 } MECHANICAL_STATUS
, *PMECHANICAL_STATUS
;
1579 /* Tape definitions */
1580 typedef struct _TAPE_POSITION_DATA
{
1581 UCHAR Reserved1
: 2;
1582 UCHAR BlockPositionUnsupported
: 1;
1583 UCHAR Reserved2
: 3;
1584 UCHAR EndOfPartition
: 1;
1585 UCHAR BeginningOfPartition
: 1;
1586 UCHAR PartitionNumber
;
1588 UCHAR FirstBlock
[4];
1591 UCHAR NumberOfBlocks
[3];
1592 UCHAR NumberOfBytes
[4];
1593 } TAPE_POSITION_DATA
, *PTAPE_POSITION_DATA
;
1595 /* This structure is used to convert little endian ULONGs
1596 to SCSI CDB big endians values. */
1597 typedef union _EIGHT_BYTE
{
1598 _ANONYMOUS_STRUCT
struct {
1608 ULONGLONG AsULongLong
;
1609 } EIGHT_BYTE
, *PEIGHT_BYTE
;
1611 typedef union _FOUR_BYTE
{
1612 _ANONYMOUS_STRUCT
struct {
1619 } FOUR_BYTE
, *PFOUR_BYTE
;
1621 typedef union _TWO_BYTE
{
1622 _ANONYMOUS_STRUCT
struct {
1627 } TWO_BYTE
, *PTWO_BYTE
;
1629 /* Byte reversing macro for converting between
1630 big- and little-endian formats */
1631 #define REVERSE_BYTES_QUAD(Destination, Source) { \
1632 PEIGHT_BYTE _val1 = (PEIGHT_BYTE)(Destination); \
1633 PEIGHT_BYTE _val2 = (PEIGHT_BYTE)(Source); \
1634 _val1->Byte7 = _val2->Byte0; \
1635 _val1->Byte6 = _val2->Byte1; \
1636 _val1->Byte5 = _val2->Byte2; \
1637 _val1->Byte4 = _val2->Byte3; \
1638 _val1->Byte3 = _val2->Byte4; \
1639 _val1->Byte2 = _val2->Byte5; \
1640 _val1->Byte1 = _val2->Byte6; \
1641 _val1->Byte0 = _val2->Byte7; \
1644 #define REVERSE_BYTES(Destination, Source) { \
1645 PFOUR_BYTE _val1 = (PFOUR_BYTE)(Destination); \
1646 PFOUR_BYTE _val2 = (PFOUR_BYTE)(Source); \
1647 _val1->Byte3 = _val2->Byte0; \
1648 _val1->Byte2 = _val2->Byte1; \
1649 _val1->Byte1 = _val2->Byte2; \
1650 _val1->Byte0 = _val2->Byte3; \
1653 #define REVERSE_BYTES_SHORT(Destination, Source) { \
1654 PTWO_BYTE _val1 = (PTWO_BYTE)(Destination); \
1655 PTWO_BYTE _val2 = (PTWO_BYTE)(Source); \
1656 _val1->Byte1 = _val2->Byte0; \
1657 _val1->Byte0 = _val2->Byte1; \
1660 #define REVERSE_SHORT(Short) { \
1662 PTWO_BYTE _val2 = (PTWO_BYTE)(Short); \
1663 _val = _val2->Byte0; \
1664 _val2->Byte0 = _val2->Byte1; \
1665 _val2->Byte1 = _val; \
1668 #define REVERSE_LONG(Long) { \
1670 PFOUR_BYTE _val2 = (PFOUR_BYTE)(Long); \
1671 _val = _val2->Byte3; \
1672 _val2->Byte3 = _val2->Byte0; \
1673 _val2->Byte0 = _val; \
1674 _val = _val2->Byte2; \
1675 _val2->Byte2 = _val2->Byte1; \
1676 _val2->Byte1 = _val; \
1679 #define WHICH_BIT(Data, Bit) { \
1681 for (_val = 0; _val < 32; _val++) { \
1682 if (((Data) >> _val) == 1) { \
1686 ASSERT(_val != 32); \
1694 #endif /* __SCSI_H */