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
38 UCHAR CommandUniqueBits
: 4;
39 UCHAR LogicalUnitNumber
: 3;
40 UCHAR CommandUniqueBytes
[3];
44 UCHAR VendorUnique
: 2;
45 } CDB6GENERIC
, *PCDB6GENERIC
;
47 struct _CDB6READWRITE
{
49 UCHAR LogicalBlockMsb1
: 5;
50 UCHAR LogicalUnitNumber
: 3;
51 UCHAR LogicalBlockMsb0
;
52 UCHAR LogicalBlockLsb
;
55 } CDB6READWRITE
, *PCDB6READWRITE
;
60 UCHAR LogicalUnitNumber
: 3;
63 UCHAR AllocationLength
;
65 } CDB6INQUIRY
, *PCDB6INQUIRY
;
67 struct _CDB6INQUIRY3
{
69 UCHAR EnableVitalProductData
: 1;
70 UCHAR CommandSupportData
: 1;
74 UCHAR AllocationLength
;
76 } CDB6INQUIRY3
, *PCDB6INQUIRY3
;
81 UCHAR ByteCompare
: 1;
84 UCHAR LogicalUnitNumber
: 3;
85 UCHAR VerificationLength
[3];
87 } CDB6VERIFY
, *PCDB6VERIFY
;
91 UCHAR FormatControl
: 5;
92 UCHAR LogicalUnitNumber
: 3;
97 } CDB6FORMAT
, *PCDB6FORMAT
;
101 UCHAR RelativeAddress
: 1;
103 UCHAR ForceUnitAccess
: 1;
104 UCHAR DisablePageOut
: 1;
105 UCHAR LogicalUnitNumber
: 3;
106 UCHAR LogicalBlockByte0
;
107 UCHAR LogicalBlockByte1
;
108 UCHAR LogicalBlockByte2
;
109 UCHAR LogicalBlockByte3
;
111 UCHAR TransferBlocksMsb
;
112 UCHAR TransferBlocksLsb
;
118 UCHAR RelativeAddress
: 1;
120 UCHAR ForceUnitAccess
: 1;
121 UCHAR DisablePageOut
: 1;
122 UCHAR LogicalUnitNumber
: 3;
123 UCHAR LogicalBlock
[4];
124 UCHAR TransferLength
[4];
129 struct _PAUSE_RESUME
{
132 UCHAR LogicalUnitNumber
: 3;
136 } PAUSE_RESUME
, *PPAUSE_RESUME
;
143 UCHAR LogicalUnitNumber
: 3;
148 UCHAR AllocationLength
[2];
151 } READ_TOC
, *PREAD_TOC
;
153 struct _READ_DISK_INFORMATION
{
158 UCHAR AllocationLength
[2];
160 } READ_DISK_INFORMATION
, *PREAD_DISK_INFORMATION
;
162 struct _READ_TRACK_INFORMATION
{
168 UCHAR BlockAddress
[4];
170 UCHAR AllocationLength
[2];
172 } READ_TRACK_INFORMATION
, *PREAD_TRACK_INFORMATION
;
174 struct _RESERVE_TRACK_RZONE
{
177 UCHAR ReservationSize
[4];
179 } RESERVE_TRACK_RZONE
, *PRESERVE_TRACK_RZONE
;
181 struct _SEND_OPC_INFORMATION
{
186 UCHAR ParameterListLength
[2];
188 } SEND_OPC_INFORMATION
, *PSEND_OPC_INFORMATION
;
190 struct _CLOSE_TRACK
{
198 UCHAR TrackNumber
[2];
201 } CLOSE_TRACK
, *PCLOSE_TRACK
;
203 struct _SEND_CUE_SHEET
{
206 UCHAR CueSheetSize
[3];
208 } SEND_CUE_SHEET
, *PSEND_CUE_SHEET
;
210 struct _READ_HEADER
{
216 UCHAR LogicalBlockAddress
[4];
218 UCHAR AllocationLength
[2];
220 } READ_HEADER
, *PREAD_HEADER
;
225 UCHAR LogicalUnitNumber
: 3;
226 UCHAR StartingBlockAddress
[4];
230 } PLAY_AUDIO
, *PPLAY_AUDIO
;
232 struct _PLAY_AUDIO_MSF
{
235 UCHAR LogicalUnitNumber
: 3;
244 } PLAY_AUDIO_MSF
, *PPLAY_AUDIO_MSF
;
246 /* FIXME: Should the union be anonymous in C++ too? If so,
247 can't define named types _LBA and _MSF within anonymous union
253 UCHAR ExpectedSectorType
: 3;
260 UCHAR StartingBlockAddress
[4];
287 } PLAY_CD
, *PPLAY_CD
;
291 UCHAR RelativeAddress
: 1;
295 UCHAR StartingAddress
[4];
301 } SCAN_CD
, *PSCAN_CD
;
303 struct _STOP_PLAY_SCAN
{
309 } STOP_PLAY_SCAN
, *PSTOP_PLAY_SCAN
;
316 UCHAR LogicalUnitNumber
: 3;
323 UCHAR AllocationLength
[2];
325 } SUBCHANNEL
, *PSUBCHANNEL
;
329 UCHAR RelativeAddress
: 1;
331 UCHAR ExpectedSectorType
: 3;
333 UCHAR StartingLBA
[4];
334 UCHAR TransferBlocks
[3];
336 UCHAR ErrorFlags
: 2;
337 UCHAR IncludeEDC
: 1;
338 UCHAR IncludeUserData
: 1;
339 UCHAR HeaderCode
: 2;
340 UCHAR IncludeSyncData
: 1;
341 UCHAR SubChannelSelection
: 3;
344 } READ_CD
, *PREAD_CD
;
346 struct _READ_CD_MSF
{
348 UCHAR RelativeAddress
: 1;
350 UCHAR ExpectedSectorType
: 3;
361 UCHAR ErrorFlags
: 2;
362 UCHAR IncludeEDC
: 1;
363 UCHAR IncludeUserData
: 1;
364 UCHAR HeaderCode
: 2;
365 UCHAR IncludeSyncData
: 1;
366 UCHAR SubChannelSelection
: 3;
369 } READ_CD_MSF
, *PREAD_CD_MSF
;
371 struct _PLXTR_READ_CDDA
{
374 UCHAR LogicalUnitNumber
: 3;
375 UCHAR LogicalBlockByte0
;
376 UCHAR LogicalBlockByte1
;
377 UCHAR LogicalBlockByte2
;
378 UCHAR LogicalBlockByte3
;
379 UCHAR TransferBlockByte0
;
380 UCHAR TransferBlockByte1
;
381 UCHAR TransferBlockByte2
;
382 UCHAR TransferBlockByte3
;
385 } PLXTR_READ_CDDA
, *PPLXTR_READ_CDDA
;
387 struct _NEC_READ_CDDA
{
390 UCHAR LogicalBlockByte0
;
391 UCHAR LogicalBlockByte1
;
392 UCHAR LogicalBlockByte2
;
393 UCHAR LogicalBlockByte3
;
395 UCHAR TransferBlockByte0
;
396 UCHAR TransferBlockByte1
;
398 } NEC_READ_CDDA
, *PNEC_READ_CDDA
;
405 UCHAR LogicalUnitNumber
: 3;
409 UCHAR AllocationLength
;
411 } MODE_SENSE
, *PMODE_SENSE
;
413 struct _MODE_SENSE10
{
418 UCHAR LogicalUnitNumber
: 3;
422 UCHAR AllocationLength
[2];
424 } MODE_SENSE10
, *PMODE_SENSE10
;
426 struct _MODE_SELECT
{
431 UCHAR LogicalUnitNumber
: 3;
433 UCHAR ParameterListLength
;
435 } MODE_SELECT
, *PMODE_SELECT
;
437 struct _MODE_SELECT10
{
442 UCHAR LogicalUnitNumber
: 3;
444 UCHAR ParameterListLength
[2];
446 } MODE_SELECT10
, *PMODE_SELECT10
;
454 UCHAR LogicalUnitNumber
: 3;
456 UCHAR LogicalBlockAddress
[4];
467 UCHAR LogicalUnitNumber
: 3;
472 UCHAR ParameterPointer
[2];
473 UCHAR AllocationLength
[2];
475 } LOGSENSE
, *PLOGSENSE
;
482 UCHAR LogicalUnitNumber
: 3;
486 UCHAR ParameterListLength
[2];
488 } LOGSELECT
, *PLOGSELECT
;
493 UCHAR LogicalUnitNumber
: 3;
494 UCHAR TransferLength
[3];
501 UCHAR LogicalUnitNumber
: 3;
502 UCHAR LogicalBlockAddress
[4];
512 UCHAR LogicalUnitNumber
: 3;
521 UCHAR LogicalUnitNumber
: 3;
527 } START_STOP
, *PSTART_STOP
;
529 struct _MEDIA_REMOVAL
{
532 UCHAR LogicalUnitNumber
: 3;
536 UCHAR Persistant
: 1;
540 } MEDIA_REMOVAL
, *PMEDIA_REMOVAL
;
546 UCHAR BlockAddress
[3];
550 UCHAR VendorUnique
: 2;
551 } SEEK_BLOCK
, *PSEEK_BLOCK
;
553 struct _REQUEST_BLOCK_ADDRESS
{
556 UCHAR AllocationLength
;
560 UCHAR VendorUnique
: 2;
561 } REQUEST_BLOCK_ADDRESS
, *PREQUEST_BLOCK_ADDRESS
;
567 UCHAR PartitionSelect
: 6;
570 } PARTITION
, *PPARTITION
;
572 struct _WRITE_TAPE_MARKS
{
575 UCHAR WriteSetMarks
: 1;
577 UCHAR LogicalUnitNumber
: 3;
578 UCHAR TransferLength
[3];
580 } WRITE_TAPE_MARKS
, *PWRITE_TAPE_MARKS
;
582 struct _SPACE_TAPE_MARKS
{
586 UCHAR LogicalUnitNumber
: 3;
596 UCHAR VendorUnique
: 2;
599 } SPACE_TAPE_MARKS
, *PSPACE_TAPE_MARKS
;
601 struct _READ_POSITION
{
608 } READ_POSITION
, *PREAD_POSITION
;
610 struct _CDB6READWRITETAPE
{
612 UCHAR VendorSpecific
: 5;
614 UCHAR TransferLenMSB
;
616 UCHAR TransferLenLSB
;
620 UCHAR VendorUnique
: 2;
621 } CDB6READWRITETAPE
, *PCDB6READWRITETAPE
;
623 struct _INIT_ELEMENT_STATUS
{
626 UCHAR LogicalUnitNubmer
: 3;
630 } INIT_ELEMENT_STATUS
, *PINIT_ELEMENT_STATUS
;
632 struct _INITIALIZE_ELEMENT_RANGE
{
636 UCHAR LogicalUnitNubmer
: 3;
637 UCHAR FirstElementAddress
[2];
639 UCHAR NumberOfElements
[2];
643 } INITIALIZE_ELEMENT_RANGE
, *PINITIALIZE_ELEMENT_RANGE
;
645 struct _POSITION_TO_ELEMENT
{
648 UCHAR LogicalUnitNumber
: 3;
649 UCHAR TransportElementAddress
[2];
650 UCHAR DestinationElementAddress
[2];
655 } POSITION_TO_ELEMENT
, *PPOSITION_TO_ELEMENT
;
657 struct _MOVE_MEDIUM
{
660 UCHAR LogicalUnitNumber
: 3;
661 UCHAR TransportElementAddress
[2];
662 UCHAR SourceElementAddress
[2];
663 UCHAR DestinationElementAddress
[2];
668 } MOVE_MEDIUM
, *PMOVE_MEDIUM
;
670 struct _EXCHANGE_MEDIUM
{
673 UCHAR LogicalUnitNumber
: 3;
674 UCHAR TransportElementAddress
[2];
675 UCHAR SourceElementAddress
[2];
676 UCHAR Destination1ElementAddress
[2];
677 UCHAR Destination2ElementAddress
[2];
682 } EXCHANGE_MEDIUM
, *PEXCHANGE_MEDIUM
;
684 struct _READ_ELEMENT_STATUS
{
686 UCHAR ElementType
: 4;
688 UCHAR LogicalUnitNumber
: 3;
689 UCHAR StartingElementAddress
[2];
690 UCHAR NumberOfElements
[2];
692 UCHAR AllocationLength
[3];
695 } READ_ELEMENT_STATUS
, *PREAD_ELEMENT_STATUS
;
697 struct _SEND_VOLUME_TAG
{
699 UCHAR ElementType
: 4;
701 UCHAR LogicalUnitNumber
: 3;
702 UCHAR StartingElementAddress
[2];
704 UCHAR ActionCode
: 5;
707 UCHAR ParameterListLength
[2];
710 } SEND_VOLUME_TAG
, *PSEND_VOLUME_TAG
;
712 struct _REQUEST_VOLUME_ELEMENT_ADDRESS
{
714 UCHAR ElementType
: 4;
716 UCHAR LogicalUnitNumber
: 3;
717 UCHAR StartingElementAddress
[2];
718 UCHAR NumberElements
[2];
720 UCHAR AllocationLength
[3];
723 } REQUEST_VOLUME_ELEMENT_ADDRESS
, *PREQUEST_VOLUME_ELEMENT_ADDRESS
;
725 struct _LOAD_UNLOAD
{
737 } LOAD_UNLOAD
, *PLOAD_UNLOAD
;
739 struct _MECH_STATUS
{
744 UCHAR AllocationLength
[2];
747 } MECH_STATUS
, *PMECH_STATUS
;
749 struct _SYNCHRONIZE_CACHE10
{
758 UCHAR LogicalBlockAddress
[4];
762 } SYNCHRONIZE_CACHE10
, *PSYNCHRONIZE_CACHE10
;
764 struct _GET_EVENT_STATUS_NOTIFICATION
{
772 UCHAR NotificationClassRequest
;
774 UCHAR EventListLength
[2];
777 } GET_EVENT_STATUS_NOTIFICATION
, *PGET_EVENT_STATUS_NOTIFICATION
;
779 struct _READ_DVD_STRUCTURE
{
783 UCHAR RMDBlockNumber
[4];
786 UCHAR AllocationLength
[2];
790 } READ_DVD_STRUCTURE
, *PREAD_DVD_STRUCTURE
;
792 struct _SEND_DVD_STRUCTURE
{
798 UCHAR ParameterListLength
[2];
801 } SEND_DVD_STRUCTURE
, *PSEND_DVD_STRUCTURE
;
808 UCHAR ParameterListLength
[2];
812 } SEND_KEY
, *PSEND_KEY
;
818 UCHAR LogicalBlockAddress
[4];
820 UCHAR AllocationLength
[2];
824 } REPORT_KEY
, *PREPORT_KEY
;
826 struct _SET_READ_AHEAD
{
831 UCHAR ReadAheadLBA
[4];
834 } SET_READ_AHEAD
, *PSET_READ_AHEAD
;
836 struct _READ_FORMATTED_CAPACITIES
{
841 UCHAR AllocationLength
[2];
843 } READ_FORMATTED_CAPACITIES
, *PREAD_FORMATTED_CAPACITIES
;
845 struct _REPORT_LUNS
{
848 UCHAR AllocationLength
[4];
851 } REPORT_LUNS
, *PREPORT_LUNS
;
853 struct _PERSISTENT_RESERVE_IN
{
855 UCHAR ServiceAction
: 5;
858 UCHAR AllocationLength
[2];
860 } PERSISTENT_RESERVE_IN
, *PPERSISTENT_RESERVE_IN
;
862 struct _PERSISTENT_RESERVE_OUT
{
864 UCHAR ServiceAction
: 5;
869 UCHAR ParameterListLength
[2];
871 } PERSISTENT_RESERVE_OUT
, *PPERSISTENT_RESERVE_OUT
;
873 struct _GET_CONFIGURATION
{
875 UCHAR RequestType
: 1;
877 UCHAR StartingFeature
[2];
879 UCHAR AllocationLength
[2];
881 } GET_CONFIGURATION
, *PGET_CONFIGURATION
;
883 struct _SET_CD_SPEED
{
890 } SET_CD_SPEED
, *PSET_CD_SPEED
;
896 #ifndef _INQUIRYDATA_DEFINED /* also in minitape.h */
897 #define _INQUIRYDATA_DEFINED
899 #define INQUIRYDATABUFFERSIZE 36
901 typedef struct _INQUIRYDATA
{
902 UCHAR DeviceType
: 5;
903 UCHAR DeviceTypeQualifier
: 3;
904 UCHAR DeviceTypeModifier
: 7;
905 UCHAR RemovableMedia
: 1;
906 _ANONYMOUS_UNION
union {
908 _ANONYMOUS_STRUCT
struct {
909 UCHAR ANSIVersion
: 3;
910 UCHAR ECMAVersion
: 3;
911 UCHAR ISOVersion
: 2;
914 UCHAR ResponseDataFormat
: 4;
917 UCHAR TerminateTask
: 1;
919 UCHAR AdditionalLength
;
924 UCHAR MediumChanger
: 1;
926 UCHAR ReservedBit2
: 1;
927 UCHAR EnclosureServices
: 1;
928 UCHAR ReservedBit3
: 1;
930 UCHAR CommandQueue
: 1;
931 UCHAR TransferDisable
: 1;
932 UCHAR LinkedCommands
: 1;
933 UCHAR Synchronous
: 1;
936 UCHAR RelativeAddressing
: 1;
939 UCHAR ProductRevisionLevel
[4];
940 UCHAR VendorSpecific
[20];
942 } INQUIRYDATA
, *PINQUIRYDATA
;
945 /* INQUIRYDATA.DeviceType constants */
946 #define DIRECT_ACCESS_DEVICE 0x00
947 #define SEQUENTIAL_ACCESS_DEVICE 0x01
948 #define PRINTER_DEVICE 0x02
949 #define PROCESSOR_DEVICE 0x03
950 #define WRITE_ONCE_READ_MULTIPLE_DEVICE 0x04
951 #define READ_ONLY_DIRECT_ACCESS_DEVICE 0x05
952 #define SCANNER_DEVICE 0x06
953 #define OPTICAL_DEVICE 0x07
954 #define MEDIUM_CHANGER 0x08
955 #define COMMUNICATION_DEVICE 0x09
956 #define LOGICAL_UNIT_NOT_PRESENT_DEVICE 0x7F
957 #define DEVICE_QUALIFIER_NOT_SUPPORTED 0x03
959 /* INQUIRYDATA.DeviceTypeQualifier constants */
960 #define DEVICE_CONNECTED 0x00
962 #define SCSISTAT_GOOD 0x00
963 #define SCSISTAT_CHECK_CONDITION 0x02
964 #define SCSISTAT_CONDITION_MET 0x04
965 #define SCSISTAT_BUSY 0x08
966 #define SCSISTAT_INTERMEDIATE 0x10
967 #define SCSISTAT_INTERMEDIATE_COND_MET 0x14
968 #define SCSISTAT_RESERVATION_CONFLICT 0x18
969 #define SCSISTAT_COMMAND_TERMINATED 0x22
970 #define SCSISTAT_QUEUE_FULL 0x28
972 /* Mode Sense/Select page constants */
973 #define MODE_PAGE_ERROR_RECOVERY 0x01
974 #define MODE_PAGE_DISCONNECT 0x02
975 #define MODE_PAGE_FORMAT_DEVICE 0x03
976 #define MODE_PAGE_RIGID_GEOMETRY 0x04
977 #define MODE_PAGE_FLEXIBILE 0x05
978 #define MODE_PAGE_WRITE_PARAMETERS 0x05
979 #define MODE_PAGE_VERIFY_ERROR 0x07
980 #define MODE_PAGE_CACHING 0x08
981 #define MODE_PAGE_PERIPHERAL 0x09
982 #define MODE_PAGE_CONTROL 0x0A
983 #define MODE_PAGE_MEDIUM_TYPES 0x0B
984 #define MODE_PAGE_NOTCH_PARTITION 0x0C
985 #define MODE_PAGE_CD_AUDIO_CONTROL 0x0E
986 #define MODE_PAGE_DATA_COMPRESS 0x0F
987 #define MODE_PAGE_DEVICE_CONFIG 0x10
988 #define MODE_PAGE_MEDIUM_PARTITION 0x11
989 #define MODE_PAGE_CDVD_FEATURE_SET 0x18
990 #define MODE_PAGE_POWER_CONDITION 0x1A
991 #define MODE_PAGE_FAULT_REPORTING 0x1C
992 #define MODE_PAGE_CDVD_INACTIVITY 0x1D
993 #define MODE_PAGE_ELEMENT_ADDRESS 0x1D
994 #define MODE_PAGE_TRANSPORT_GEOMETRY 0x1E
995 #define MODE_PAGE_DEVICE_CAPABILITIES 0x1F
996 #define MODE_PAGE_CAPABILITIES 0x2A
997 #define MODE_SENSE_RETURN_ALL 0x3f
998 #define MODE_SENSE_CURRENT_VALUES 0x00
999 #define MODE_SENSE_CHANGEABLE_VALUES 0x40
1000 #define MODE_SENSE_DEFAULT_VAULES 0x80
1001 #define MODE_SENSE_SAVED_VALUES 0xc0
1003 /* SCSI CDB operation codes */
1004 #define SCSIOP_TEST_UNIT_READY 0x00
1005 #define SCSIOP_REZERO_UNIT 0x01
1006 #define SCSIOP_REWIND 0x01
1007 #define SCSIOP_REQUEST_BLOCK_ADDR 0x02
1008 #define SCSIOP_REQUEST_SENSE 0x03
1009 #define SCSIOP_FORMAT_UNIT 0x04
1010 #define SCSIOP_READ_BLOCK_LIMITS 0x05
1011 #define SCSIOP_REASSIGN_BLOCKS 0x07
1012 #define SCSIOP_INIT_ELEMENT_STATUS 0x07
1013 #define SCSIOP_READ6 0x08
1014 #define SCSIOP_RECEIVE 0x08
1015 #define SCSIOP_WRITE6 0x0A
1016 #define SCSIOP_PRINT 0x0A
1017 #define SCSIOP_SEND 0x0A
1018 #define SCSIOP_SEEK6 0x0B
1019 #define SCSIOP_TRACK_SELECT 0x0B
1020 #define SCSIOP_SLEW_PRINT 0x0B
1021 #define SCSIOP_SEEK_BLOCK 0x0C
1022 #define SCSIOP_PARTITION 0x0D
1023 #define SCSIOP_READ_REVERSE 0x0F
1024 #define SCSIOP_WRITE_FILEMARKS 0x10
1025 #define SCSIOP_FLUSH_BUFFER 0x10
1026 #define SCSIOP_SPACE 0x11
1027 #define SCSIOP_INQUIRY 0x12
1028 #define SCSIOP_VERIFY6 0x13
1029 #define SCSIOP_RECOVER_BUF_DATA 0x14
1030 #define SCSIOP_MODE_SELECT 0x15
1031 #define SCSIOP_RESERVE_UNIT 0x16
1032 #define SCSIOP_RELEASE_UNIT 0x17
1033 #define SCSIOP_COPY 0x18
1034 #define SCSIOP_ERASE 0x19
1035 #define SCSIOP_MODE_SENSE 0x1A
1036 #define SCSIOP_START_STOP_UNIT 0x1B
1037 #define SCSIOP_STOP_PRINT 0x1B
1038 #define SCSIOP_LOAD_UNLOAD 0x1B
1039 #define SCSIOP_RECEIVE_DIAGNOSTIC 0x1C
1040 #define SCSIOP_SEND_DIAGNOSTIC 0x1D
1041 #define SCSIOP_MEDIUM_REMOVAL 0x1E
1043 #define SCSIOP_READ_FORMATTED_CAPACITY 0x23
1044 #define SCSIOP_READ_CAPACITY 0x25
1045 #define SCSIOP_READ 0x28
1046 #define SCSIOP_WRITE 0x2A
1047 #define SCSIOP_SEEK 0x2B
1048 #define SCSIOP_LOCATE 0x2B
1049 #define SCSIOP_POSITION_TO_ELEMENT 0x2B
1050 #define SCSIOP_WRITE_VERIFY 0x2E
1051 #define SCSIOP_VERIFY 0x2F
1052 #define SCSIOP_SEARCH_DATA_HIGH 0x30
1053 #define SCSIOP_SEARCH_DATA_EQUAL 0x31
1054 #define SCSIOP_SEARCH_DATA_LOW 0x32
1055 #define SCSIOP_SET_LIMITS 0x33
1056 #define SCSIOP_READ_POSITION 0x34
1057 #define SCSIOP_SYNCHRONIZE_CACHE 0x35
1058 #define SCSIOP_COMPARE 0x39
1059 #define SCSIOP_COPY_COMPARE 0x3A
1060 #define SCSIOP_WRITE_DATA_BUFF 0x3B
1061 #define SCSIOP_READ_DATA_BUFF 0x3C
1062 #define SCSIOP_CHANGE_DEFINITION 0x40
1063 #define SCSIOP_READ_SUB_CHANNEL 0x42
1064 #define SCSIOP_READ_TOC 0x43
1065 #define SCSIOP_READ_HEADER 0x44
1066 #define SCSIOP_PLAY_AUDIO 0x45
1067 #define SCSIOP_GET_CONFIGURATION 0x46
1068 #define SCSIOP_PLAY_AUDIO_MSF 0x47
1069 #define SCSIOP_PLAY_TRACK_INDEX 0x48
1070 #define SCSIOP_PLAY_TRACK_RELATIVE 0x49
1071 #define SCSIOP_GET_EVENT_STATUS 0x4A
1072 #define SCSIOP_PAUSE_RESUME 0x4B
1073 #define SCSIOP_LOG_SELECT 0x4C
1074 #define SCSIOP_LOG_SENSE 0x4D
1075 #define SCSIOP_STOP_PLAY_SCAN 0x4E
1076 #define SCSIOP_READ_DISK_INFORMATION 0x51
1077 #define SCSIOP_READ_TRACK_INFORMATION 0x52
1078 #define SCSIOP_RESERVE_TRACK_RZONE 0x53
1079 #define SCSIOP_SEND_OPC_INFORMATION 0x54
1080 #define SCSIOP_MODE_SELECT10 0x55
1081 #define SCSIOP_MODE_SENSE10 0x5A
1082 #define SCSIOP_CLOSE_TRACK_SESSION 0x5B
1083 #define SCSIOP_READ_BUFFER_CAPACITY 0x5C
1084 #define SCSIOP_SEND_CUE_SHEET 0x5D
1085 #define SCSIOP_PERSISTENT_RESERVE_IN 0x5E
1086 #define SCSIOP_PERSISTENT_RESERVE_OUT 0x5F
1088 #define SCSIOP_REPORT_LUNS 0xA0
1089 #define SCSIOP_BLANK 0xA1
1090 #define SCSIOP_SEND_KEY 0xA3
1091 #define SCSIOP_REPORT_KEY 0xA4
1092 #define SCSIOP_MOVE_MEDIUM 0xA5
1093 #define SCSIOP_LOAD_UNLOAD_SLOT 0xA6
1094 #define SCSIOP_EXCHANGE_MEDIUM 0xA6
1095 #define SCSIOP_SET_READ_AHEAD 0xA7
1096 #define SCSIOP_READ_DVD_STRUCTURE 0xAD
1097 #define SCSIOP_REQUEST_VOL_ELEMENT 0xB5
1098 #define SCSIOP_SEND_VOLUME_TAG 0xB6
1099 #define SCSIOP_READ_ELEMENT_STATUS 0xB8
1100 #define SCSIOP_READ_CD_MSF 0xB9
1101 #define SCSIOP_SCAN_CD 0xBA
1102 #define SCSIOP_SET_CD_SPEED 0xBB
1103 #define SCSIOP_PLAY_CD 0xBC
1104 #define SCSIOP_MECHANISM_STATUS 0xBD
1105 #define SCSIOP_READ_CD 0xBE
1106 #define SCSIOP_SEND_DVD_STRUCTURE 0xBF
1107 #define SCSIOP_INIT_ELEMENT_RANGE 0xE7
1109 #define SCSIOP_DENON_EJECT_DISC 0xE6
1110 #define SCSIOP_DENON_STOP_AUDIO 0xE7
1111 #define SCSIOP_DENON_PLAY_AUDIO 0xE8
1112 #define SCSIOP_DENON_READ_TOC 0xE9
1113 #define SCSIOP_DENON_READ_SUBCODE 0xEB
1115 #define SCSIMESS_MODIFY_DATA_POINTER 0x00
1116 #define SCSIMESS_SYNCHRONOUS_DATA_REQ 0x01
1117 #define SCSIMESS_WIDE_DATA_REQUEST 0x03
1119 #define SCSIMESS_MODIFY_DATA_LENGTH 5
1120 #define SCSIMESS_SYNCH_DATA_LENGTH 3
1121 #define SCSIMESS_WIDE_DATA_LENGTH 2
1123 #define SCSIMESS_ABORT 0x06
1124 #define SCSIMESS_ABORT_WITH_TAG 0x0D
1125 #define SCSIMESS_BUS_DEVICE_RESET 0x0C
1126 #define SCSIMESS_CLEAR_QUEUE 0x0E
1127 #define SCSIMESS_COMMAND_COMPLETE 0x00
1128 #define SCSIMESS_DISCONNECT 0x04
1129 #define SCSIMESS_EXTENDED_MESSAGE 0x01
1130 #define SCSIMESS_IDENTIFY 0x80
1131 #define SCSIMESS_IDENTIFY_WITH_DISCON 0xC0
1132 #define SCSIMESS_IGNORE_WIDE_RESIDUE 0x23
1133 #define SCSIMESS_INITIATE_RECOVERY 0x0F
1134 #define SCSIMESS_INIT_DETECTED_ERROR 0x05
1135 #define SCSIMESS_LINK_CMD_COMP 0x0A
1136 #define SCSIMESS_LINK_CMD_COMP_W_FLAG 0x0B
1137 #define SCSIMESS_MESS_PARITY_ERROR 0x09
1138 #define SCSIMESS_MESSAGE_REJECT 0x07
1139 #define SCSIMESS_NO_OPERATION 0x08
1140 #define SCSIMESS_HEAD_OF_QUEUE_TAG 0x21
1141 #define SCSIMESS_ORDERED_QUEUE_TAG 0x22
1142 #define SCSIMESS_SIMPLE_QUEUE_TAG 0x20
1143 #define SCSIMESS_RELEASE_RECOVERY 0x10
1144 #define SCSIMESS_RESTORE_POINTERS 0x03
1145 #define SCSIMESS_SAVE_DATA_POINTER 0x02
1146 #define SCSIMESS_TERMINATE_IO_PROCESS 0x11
1148 #define CDB_FORCE_MEDIA_ACCESS 0x08
1150 #define CDB_RETURN_ON_COMPLETION 0
1151 #define CDB_RETURN_IMMEDIATE 1
1153 #define CDB_INQUIRY_EVPD 0x01
1155 #define LUN0_FORMAT_SAVING_DEFECT_LIST 0
1156 #define USE_DEFAULTMSB 0
1157 #define USE_DEFAULTLSB 0
1159 #define START_UNIT_CODE 0x01
1160 #define STOP_UNIT_CODE 0x00
1162 typedef struct _SENSE_DATA
{
1163 UCHAR ErrorCode
: 7;
1165 UCHAR SegmentNumber
;
1168 UCHAR IncorrectLength
: 1;
1169 UCHAR EndOfMedia
: 1;
1171 UCHAR Information
[4];
1172 UCHAR AdditionalSenseLength
;
1173 UCHAR CommandSpecificInformation
[4];
1174 UCHAR AdditionalSenseCode
;
1175 UCHAR AdditionalSenseCodeQualifier
;
1176 UCHAR FieldReplaceableUnitCode
;
1177 UCHAR SenseKeySpecific
[3];
1178 } SENSE_DATA
, *PSENSE_DATA
;
1180 #define SENSE_BUFFER_SIZE 18
1183 #define SCSI_SENSE_NO_SENSE 0x00
1184 #define SCSI_SENSE_RECOVERED_ERROR 0x01
1185 #define SCSI_SENSE_NOT_READY 0x02
1186 #define SCSI_SENSE_MEDIUM_ERROR 0x03
1187 #define SCSI_SENSE_HARDWARE_ERROR 0x04
1188 #define SCSI_SENSE_ILLEGAL_REQUEST 0x05
1189 #define SCSI_SENSE_UNIT_ATTENTION 0x06
1190 #define SCSI_SENSE_DATA_PROTECT 0x07
1191 #define SCSI_SENSE_BLANK_CHECK 0x08
1192 #define SCSI_SENSE_UNIQUE 0x09
1193 #define SCSI_SENSE_COPY_ABORTED 0x0A
1194 #define SCSI_SENSE_ABORTED_COMMAND 0x0B
1195 #define SCSI_SENSE_EQUAL 0x0C
1196 #define SCSI_SENSE_VOL_OVERFLOW 0x0D
1197 #define SCSI_SENSE_MISCOMPARE 0x0E
1198 #define SCSI_SENSE_RESERVED 0x0F
1200 /* Additional tape bit */
1201 #define SCSI_ILLEGAL_LENGTH 0x20
1202 #define SCSI_EOM 0x40
1203 #define SCSI_FILE_MARK 0x80
1205 /* Additional Sense codes */
1206 #define SCSI_ADSENSE_NO_SENSE 0x00
1207 #define SCSI_ADSENSE_NO_SEEK_COMPLETE 0x02
1208 #define SCSI_ADSENSE_LUN_NOT_READY 0x04
1209 #define SCSI_ADSENSE_WRITE_ERROR 0x0C
1210 #define SCSI_ADSENSE_TRACK_ERROR 0x14
1211 #define SCSI_ADSENSE_SEEK_ERROR 0x15
1212 #define SCSI_ADSENSE_REC_DATA_NOECC 0x17
1213 #define SCSI_ADSENSE_REC_DATA_ECC 0x18
1214 #define SCSI_ADSENSE_ILLEGAL_COMMAND 0x20
1215 #define SCSI_ADSENSE_ILLEGAL_BLOCK 0x21
1216 #define SCSI_ADSENSE_INVALID_CDB 0x24
1217 #define SCSI_ADSENSE_INVALID_LUN 0x25
1218 #define SCSI_ADSENSE_WRITE_PROTECT 0x27
1219 #define SCSI_ADSENSE_MEDIUM_CHANGED 0x28
1220 #define SCSI_ADSENSE_BUS_RESET 0x29
1221 #define SCSI_ADSENSE_INSUFFICIENT_TIME_FOR_OPERATION 0x2E
1222 #define SCSI_ADSENSE_INVALID_MEDIA 0x30
1223 #define SCSI_ADSENSE_NO_MEDIA_IN_DEVICE 0x3a
1224 #define SCSI_ADSENSE_POSITION_ERROR 0x3b
1225 #define SCSI_ADSENSE_OPERATOR_REQUEST 0x5a
1226 #define SCSI_ADSENSE_FAILURE_PREDICTION_THRESHOLD_EXCEEDED 0x5d
1227 #define SCSI_ADSENSE_ILLEGAL_MODE_FOR_THIS_TRACK 0x64
1228 #define SCSI_ADSENSE_COPY_PROTECTION_FAILURE 0x6f
1229 #define SCSI_ADSENSE_POWER_CALIBRATION_ERROR 0x73
1230 #define SCSI_ADSENSE_VENDOR_UNIQUE 0x80
1231 #define SCSI_ADSENSE_MUSIC_AREA 0xA0
1232 #define SCSI_ADSENSE_DATA_AREA 0xA1
1233 #define SCSI_ADSENSE_VOLUME_OVERFLOW 0xA7
1235 #define SCSI_SENSEQ_CAUSE_NOT_REPORTABLE 0x00
1236 #define SCSI_SENSEQ_BECOMING_READY 0x01
1237 #define SCSI_SENSEQ_INIT_COMMAND_REQUIRED 0x02
1238 #define SCSI_SENSEQ_MANUAL_INTERVENTION_REQUIRED 0x03
1239 #define SCSI_SENSEQ_FORMAT_IN_PROGRESS 0x04
1240 #define SCSI_SENSEQ_REBUILD_IN_PROGRESS 0x05
1241 #define SCSI_SENSEQ_RECALCULATION_IN_PROGRESS 0x06
1242 #define SCSI_SENSEQ_OPERATION_IN_PROGRESS 0x07
1243 #define SCSI_SENSEQ_LONG_WRITE_IN_PROGRESS 0x08
1244 #define SCSI_SENSEQ_LOSS_OF_STREAMING 0x09
1245 #define SCSI_SENSEQ_PADDING_BLOCKS_ADDED 0x0A
1248 #define FILE_DEVICE_SCSI 0x0000001b
1250 #define IOCTL_SCSI_EXECUTE_IN ((FILE_DEVICE_SCSI << 16) + 0x0011)
1251 #define IOCTL_SCSI_EXECUTE_OUT ((FILE_DEVICE_SCSI << 16) + 0x0012)
1252 #define IOCTL_SCSI_EXECUTE_NONE ((FILE_DEVICE_SCSI << 16) + 0x0013)
1254 /* SMART support in ATAPI */
1255 #define IOCTL_SCSI_MINIPORT_SMART_VERSION ((FILE_DEVICE_SCSI << 16) + 0x0500)
1256 #define IOCTL_SCSI_MINIPORT_IDENTIFY ((FILE_DEVICE_SCSI << 16) + 0x0501)
1257 #define IOCTL_SCSI_MINIPORT_READ_SMART_ATTRIBS ((FILE_DEVICE_SCSI << 16) + 0x0502)
1258 #define IOCTL_SCSI_MINIPORT_READ_SMART_THRESHOLDS ((FILE_DEVICE_SCSI << 16) + 0x0503)
1259 #define IOCTL_SCSI_MINIPORT_ENABLE_SMART ((FILE_DEVICE_SCSI << 16) + 0x0504)
1260 #define IOCTL_SCSI_MINIPORT_DISABLE_SMART ((FILE_DEVICE_SCSI << 16) + 0x0505)
1261 #define IOCTL_SCSI_MINIPORT_RETURN_STATUS ((FILE_DEVICE_SCSI << 16) + 0x0506)
1262 #define IOCTL_SCSI_MINIPORT_ENABLE_DISABLE_AUTOSAVE ((FILE_DEVICE_SCSI << 16) + 0x0507)
1263 #define IOCTL_SCSI_MINIPORT_SAVE_ATTRIBUTE_VALUES ((FILE_DEVICE_SCSI << 16) + 0x0508)
1264 #define IOCTL_SCSI_MINIPORT_EXECUTE_OFFLINE_DIAGS ((FILE_DEVICE_SCSI << 16) + 0x0509)
1265 #define IOCTL_SCSI_MINIPORT_ENABLE_DISABLE_AUTO_OFFLINE ((FILE_DEVICE_SCSI << 16) + 0x050a)
1266 #define IOCTL_SCSI_MINIPORT_READ_SMART_LOG ((FILE_DEVICE_SCSI << 16) + 0x050b)
1267 #define IOCTL_SCSI_MINIPORT_WRITE_SMART_LOG ((FILE_DEVICE_SCSI << 16) + 0x050c)
1269 /* CLUSTER support */
1270 #define IOCTL_SCSI_MINIPORT_NOT_QUORUM_CAPABLE ((FILE_DEVICE_SCSI << 16) + 0x0520)
1271 #define IOCTL_SCSI_MINIPORT_NOT_CLUSTER_CAPABLE ((FILE_DEVICE_SCSI << 16) + 0x0521)
1273 /* Read Capacity Data. Returned in Big Endian format */
1274 typedef struct _READ_CAPACITY_DATA
{
1275 ULONG LogicalBlockAddress
;
1276 ULONG BytesPerBlock
;
1277 } READ_CAPACITY_DATA
, *PREAD_CAPACITY_DATA
;
1279 /* Read Block Limits Data. Returned in Big Endian format */
1280 typedef struct _READ_BLOCK_LIMITS
{
1282 UCHAR BlockMaximumSize
[3];
1283 UCHAR BlockMinimumSize
[2];
1284 } READ_BLOCK_LIMITS_DATA
, *PREAD_BLOCK_LIMITS_DATA
;
1286 #define MODE_BLOCK_DESC_LENGTH 8
1287 #define MODE_HEADER_LENGTH 4
1288 #define MODE_HEADER_LENGTH10 8
1290 typedef struct _MODE_PARAMETER_HEADER
{
1291 UCHAR ModeDataLength
;
1293 UCHAR DeviceSpecificParameter
;
1294 UCHAR BlockDescriptorLength
;
1295 } MODE_PARAMETER_HEADER
, *PMODE_PARAMETER_HEADER
;
1297 typedef struct _MODE_PARAMETER_HEADER10
{
1298 UCHAR ModeDataLength
[2];
1300 UCHAR DeviceSpecificParameter
;
1302 UCHAR BlockDescriptorLength
[2];
1303 } MODE_PARAMETER_HEADER10
, *PMODE_PARAMETER_HEADER10
;
1305 #define MODE_FD_SINGLE_SIDE 0x01
1306 #define MODE_FD_DOUBLE_SIDE 0x02
1307 #define MODE_FD_MAXIMUM_TYPE 0x1E
1308 #define MODE_DSP_FUA_SUPPORTED 0x10
1309 #define MODE_DSP_WRITE_PROTECT 0x80
1311 typedef struct _MODE_PARAMETER_BLOCK
{
1313 UCHAR NumberOfBlocks
[3];
1315 UCHAR BlockLength
[3];
1316 } MODE_PARAMETER_BLOCK
, *PMODE_PARAMETER_BLOCK
;
1318 typedef struct _MODE_DISCONNECT_PAGE
{
1321 UCHAR PageSavable
: 1;
1323 UCHAR BufferFullRatio
;
1324 UCHAR BufferEmptyRatio
;
1325 UCHAR BusInactivityLimit
[2];
1326 UCHAR BusDisconnectTime
[2];
1327 UCHAR BusConnectTime
[2];
1328 UCHAR MaximumBurstSize
[2];
1329 UCHAR DataTransferDisconnect
: 2;
1331 } MODE_DISCONNECT_PAGE
, *PMODE_DISCONNECT_PAGE
;
1333 typedef struct _MODE_CACHING_PAGE
{
1336 UCHAR PageSavable
: 1;
1338 UCHAR ReadDisableCache
: 1;
1339 UCHAR MultiplicationFactor
: 1;
1340 UCHAR WriteCacheEnable
: 1;
1341 UCHAR Reserved2
: 5;
1342 UCHAR WriteRetensionPriority
: 4;
1343 UCHAR ReadRetensionPriority
: 4;
1344 UCHAR DisablePrefetchTransfer
[2];
1345 UCHAR MinimumPrefetch
[2];
1346 UCHAR MaximumPrefetch
[2];
1347 UCHAR MaximumPrefetchCeiling
[2];
1348 } MODE_CACHING_PAGE
, *PMODE_CACHING_PAGE
;
1350 typedef struct _MODE_CDROM_WRITE_PARAMETERS_PAGE
{
1352 UCHAR WriteType
: 4;
1353 UCHAR TestWrite
: 1;
1354 UCHAR LinkSizeValid
: 1;
1355 UCHAR BufferUnderrunFreeEnabled
: 1;
1356 UCHAR Reserved2
: 1;
1357 UCHAR TrackMode
: 4;
1359 UCHAR FixedPacket
: 1;
1360 UCHAR MultiSession
: 2;
1361 UCHAR DataBlockType
: 4;
1362 UCHAR Reserved3
: 4;
1365 UCHAR HostApplicationCode
: 6;
1366 UCHAR Reserved5
: 2;
1367 UCHAR SessionFormat
;
1369 UCHAR PacketSize
[4];
1370 UCHAR AudioPauseLength
[2];
1371 UCHAR Reserved7
: 7;
1372 UCHAR MediaCatalogNumberValid
: 1;
1373 UCHAR MediaCatalogNumber
[13];
1374 UCHAR MediaCatalogNumberZero
;
1375 UCHAR MediaCatalogNumberAFrame
;
1376 UCHAR Reserved8
: 7;
1377 UCHAR ISRCValid
: 1;
1378 UCHAR ISRCCountry
[2];
1380 UCHAR ISRCRecordingYear
[2];
1381 UCHAR ISRCSerialNumber
[5];
1385 UCHAR SubHeaderData
[4];
1386 } MODE_CDROM_WRITE_PARAMETERS_PAGE
, *PMODE_CDROM_WRITE_PARAMETERS_PAGE
;
1388 typedef struct _MODE_FLEXIBLE_DISK_PAGE
{
1391 UCHAR PageSavable
: 1;
1393 UCHAR TransferRate
[2];
1394 UCHAR NumberOfHeads
;
1395 UCHAR SectorsPerTrack
;
1396 UCHAR BytesPerSector
[2];
1397 UCHAR NumberOfCylinders
[2];
1398 UCHAR StartWritePrecom
[2];
1399 UCHAR StartReducedCurrent
[2];
1401 UCHAR StepPluseWidth
;
1402 UCHAR HeadSettleDelay
[2];
1404 UCHAR MotorOffDelay
;
1405 UCHAR Reserved2
: 5;
1406 UCHAR MotorOnAsserted
: 1;
1407 UCHAR StartSectorNumber
: 1;
1408 UCHAR TrueReadySignal
: 1;
1409 UCHAR StepPlusePerCyclynder
: 4;
1410 UCHAR Reserved3
: 4;
1411 UCHAR WriteCompenstation
;
1412 UCHAR HeadLoadDelay
;
1413 UCHAR HeadUnloadDelay
;
1414 UCHAR Pin2Usage
: 4;
1415 UCHAR Pin34Usage
: 4;
1416 UCHAR Pin1Usage
: 4;
1417 UCHAR Pin4Usage
: 4;
1418 UCHAR MediumRotationRate
[2];
1420 } MODE_FLEXIBLE_DISK_PAGE
, *PMODE_FLEXIBLE_DISK_PAGE
;
1422 typedef struct _MODE_FORMAT_PAGE
{
1425 UCHAR PageSavable
: 1;
1427 UCHAR TracksPerZone
[2];
1428 UCHAR AlternateSectorsPerZone
[2];
1429 UCHAR AlternateTracksPerZone
[2];
1430 UCHAR AlternateTracksPerLogicalUnit
[2];
1431 UCHAR SectorsPerTrack
[2];
1432 UCHAR BytesPerPhysicalSector
[2];
1433 UCHAR Interleave
[2];
1434 UCHAR TrackSkewFactor
[2];
1435 UCHAR CylinderSkewFactor
[2];
1436 UCHAR Reserved2
: 4;
1437 UCHAR SurfaceFirst
: 1;
1438 UCHAR RemovableMedia
: 1;
1439 UCHAR HardSectorFormating
: 1;
1440 UCHAR SoftSectorFormating
: 1;
1442 } MODE_FORMAT_PAGE
, *PMODE_FORMAT_PAGE
;
1444 typedef struct _MODE_RIGID_GEOMETRY_PAGE
{
1447 UCHAR PageSavable
: 1;
1449 UCHAR NumberOfCylinders
[3];
1450 UCHAR NumberOfHeads
;
1451 UCHAR StartWritePrecom
[3];
1452 UCHAR StartReducedCurrent
[3];
1453 UCHAR DriveStepRate
[2];
1454 UCHAR LandZoneCyclinder
[3];
1455 UCHAR RotationalPositionLock
: 2;
1456 UCHAR Reserved2
: 6;
1457 UCHAR RotationOffset
;
1459 UCHAR RoataionRate
[2];
1461 } MODE_RIGID_GEOMETRY_PAGE
, *PMODE_RIGID_GEOMETRY_PAGE
;
1463 typedef struct _MODE_READ_WRITE_RECOVERY_PAGE
{
1465 UCHAR Reserved1
: 1;
1476 UCHAR ReadRetryCount
;
1478 UCHAR WriteRetryCount
;
1480 } MODE_READ_WRITE_RECOVERY_PAGE
, *PMODE_READ_WRITE_RECOVERY_PAGE
;
1482 typedef struct _MODE_READ_RECOVERY_PAGE
{
1484 UCHAR Reserved1
: 1;
1490 UCHAR Reserved2
: 1;
1493 UCHAR Reserved3
: 2;
1494 UCHAR ReadRetryCount
;
1496 } MODE_READ_RECOVERY_PAGE
, *PMODE_READ_RECOVERY_PAGE
;
1498 typedef struct _MODE_INFO_EXCEPTIONS
{
1500 UCHAR Reserved1
: 1;
1503 _ANONYMOUS_UNION
union {
1505 _ANONYMOUS_STRUCT
struct {
1507 UCHAR Reserved2
: 1;
1510 UCHAR Reserved3
: 3;
1514 UCHAR ReportMethod
: 4;
1515 UCHAR Reserved4
: 4;
1516 UCHAR IntervalTimer
[4];
1517 UCHAR ReportCount
[4];
1518 } MODE_INFO_EXCEPTIONS
, *PMODE_INFO_EXCEPTIONS
;
1520 /* CDROM audio control */
1521 #define CDB_AUDIO_PAUSE 0x00
1522 #define CDB_AUDIO_RESUME 0x01
1523 #define CDB_DEVICE_START 0x11
1524 #define CDB_DEVICE_STOP 0x10
1525 #define CDB_EJECT_MEDIA 0x10
1526 #define CDB_LOAD_MEDIA 0x01
1527 #define CDB_SUBCHANNEL_HEADER 0x00
1528 #define CDB_SUBCHANNEL_BLOCK 0x01
1530 #define CDROM_AUDIO_CONTROL_PAGE 0x0E
1531 #define MODE_SELECT_IMMEDIATE 0x04
1532 #define MODE_SELECT_PFBIT 0x10
1534 #define CDB_USE_MSF 0x01
1536 typedef struct _PORT_OUTPUT
{
1537 UCHAR ChannelSelection
;
1539 } PORT_OUTPUT
, *PPORT_OUTPUT
;
1541 typedef struct _AUDIO_OUTPUT
{
1543 UCHAR ParameterLength
;
1547 UCHAR LogicalBlocksPerSecond
[2];
1548 PORT_OUTPUT PortOutput
[4];
1549 } AUDIO_OUTPUT
, *PAUDIO_OUTPUT
;
1551 /* Multisession CDROMs */
1552 #define GET_LAST_SESSION 0x01
1553 #define GET_SESSION_DATA 0x02;
1555 /* Atapi 2.5 changers */
1556 typedef struct _MECHANICAL_STATUS_INFORMATION_HEADER
{
1557 UCHAR CurrentSlot
: 5;
1558 UCHAR ChangerState
: 2;
1561 UCHAR MechanismState
: 3;
1562 UCHAR CurrentLogicalBlockAddress
[3];
1563 UCHAR NumberAvailableSlots
;
1564 UCHAR SlotTableLength
[2];
1565 } MECHANICAL_STATUS_INFORMATION_HEADER
, *PMECHANICAL_STATUS_INFORMATION_HEADER
;
1567 typedef struct _SLOT_TABLE_INFORMATION
{
1568 UCHAR DiscChanged
: 1;
1570 UCHAR DiscPresent
: 1;
1572 } SLOT_TABLE_INFORMATION
, *PSLOT_TABLE_INFORMATION
;
1574 typedef struct _MECHANICAL_STATUS
{
1575 MECHANICAL_STATUS_INFORMATION_HEADER MechanicalStatusHeader
;
1576 SLOT_TABLE_INFORMATION SlotTableInfo
[1];
1577 } MECHANICAL_STATUS
, *PMECHANICAL_STATUS
;
1580 /* Tape definitions */
1581 typedef struct _TAPE_POSITION_DATA
{
1582 UCHAR Reserved1
: 2;
1583 UCHAR BlockPositionUnsupported
: 1;
1584 UCHAR Reserved2
: 3;
1585 UCHAR EndOfPartition
: 1;
1586 UCHAR BeginningOfPartition
: 1;
1587 UCHAR PartitionNumber
;
1589 UCHAR FirstBlock
[4];
1592 UCHAR NumberOfBlocks
[3];
1593 UCHAR NumberOfBytes
[4];
1594 } TAPE_POSITION_DATA
, *PTAPE_POSITION_DATA
;
1596 /* This structure is used to convert little endian ULONGs
1597 to SCSI CDB big endians values. */
1598 typedef union _EIGHT_BYTE
{
1599 _ANONYMOUS_STRUCT
struct {
1609 ULONGLONG AsULongLong
;
1610 } EIGHT_BYTE
, *PEIGHT_BYTE
;
1612 typedef union _FOUR_BYTE
{
1613 _ANONYMOUS_STRUCT
struct {
1620 } FOUR_BYTE
, *PFOUR_BYTE
;
1622 typedef union _TWO_BYTE
{
1623 _ANONYMOUS_STRUCT
struct {
1628 } TWO_BYTE
, *PTWO_BYTE
;
1630 /* Byte reversing macro for converting between
1631 big- and little-endian formats */
1632 #define REVERSE_BYTES_QUAD(Destination, Source) { \
1633 PEIGHT_BYTE _val1 = (PEIGHT_BYTE)(Destination); \
1634 PEIGHT_BYTE _val2 = (PEIGHT_BYTE)(Source); \
1635 _val1->Byte7 = _val2->Byte0; \
1636 _val1->Byte6 = _val2->Byte1; \
1637 _val1->Byte5 = _val2->Byte2; \
1638 _val1->Byte4 = _val2->Byte3; \
1639 _val1->Byte3 = _val2->Byte4; \
1640 _val1->Byte2 = _val2->Byte5; \
1641 _val1->Byte1 = _val2->Byte6; \
1642 _val1->Byte0 = _val2->Byte7; \
1645 #define REVERSE_BYTES(Destination, Source) { \
1646 PFOUR_BYTE _val1 = (PFOUR_BYTE)(Destination); \
1647 PFOUR_BYTE _val2 = (PFOUR_BYTE)(Source); \
1648 _val1->Byte3 = _val2->Byte0; \
1649 _val1->Byte2 = _val2->Byte1; \
1650 _val1->Byte1 = _val2->Byte2; \
1651 _val1->Byte0 = _val2->Byte3; \
1654 #define REVERSE_BYTES_SHORT(Destination, Source) { \
1655 PTWO_BYTE _val1 = (PTWO_BYTE)(Destination); \
1656 PTWO_BYTE _val2 = (PTWO_BYTE)(Source); \
1657 _val1->Byte1 = _val2->Byte0; \
1658 _val1->Byte0 = _val2->Byte1; \
1661 #define REVERSE_SHORT(Short) { \
1663 PTWO_BYTE _val2 = (PTWO_BYTE)(Short); \
1664 _val = _val2->Byte0; \
1665 _val2->Byte0 = _val2->Byte1; \
1666 _val2->Byte1 = _val; \
1669 #define REVERSE_LONG(Long) { \
1671 PFOUR_BYTE _val2 = (PFOUR_BYTE)(Long); \
1672 _val = _val2->Byte3; \
1673 _val2->Byte3 = _val2->Byte0; \
1674 _val2->Byte0 = _val; \
1675 _val = _val2->Byte2; \
1676 _val2->Byte2 = _val2->Byte1; \
1677 _val2->Byte1 = _val; \
1680 #define WHICH_BIT(Data, Bit) { \
1682 for (_val = 0; _val < 32; _val++) { \
1683 if (((Data) >> _val) == 1) { \
1687 ASSERT(_val != 32); \
1695 #endif /* _NTSCSI_ */