Work around MinGW mangling of "host:/path"
[msysgit/historical-msysgit.git] / mingw / include / ddk / scsi.h
blob65adcdd3a9066deffe513d775fb04c09f0ac53ca
1 /*
2 * scsi.h
4 * SCSI port and class interface.
6 * This file is part of the w32api package.
8 * Contributors:
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.
23 #ifndef __SCSI_H
24 #define __SCSI_H
26 #if __GNUC__ >=3
27 #pragma GCC system_header
28 #endif
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
34 #include "ntddk.h"
36 typedef union _CDB {
37 struct _CDB6GENERIC {
38 UCHAR OperationCode;
39 UCHAR Immediate : 1;
40 UCHAR CommandUniqueBits : 4;
41 UCHAR LogicalUnitNumber : 3;
42 UCHAR CommandUniqueBytes[3];
43 UCHAR Link : 1;
44 UCHAR Flag : 1;
45 UCHAR Reserved : 4;
46 UCHAR VendorUnique : 2;
47 } CDB6GENERIC, *PCDB6GENERIC;
49 struct _CDB6READWRITE {
50 UCHAR OperationCode;
51 UCHAR LogicalBlockMsb1 : 5;
52 UCHAR LogicalUnitNumber : 3;
53 UCHAR LogicalBlockMsb0;
54 UCHAR LogicalBlockLsb;
55 UCHAR TransferBlocks;
56 UCHAR Control;
57 } CDB6READWRITE, *PCDB6READWRITE;
59 struct _CDB6INQUIRY {
60 UCHAR OperationCode;
61 UCHAR Reserved1 : 5;
62 UCHAR LogicalUnitNumber : 3;
63 UCHAR PageCode;
64 UCHAR IReserved;
65 UCHAR AllocationLength;
66 UCHAR Control;
67 } CDB6INQUIRY, *PCDB6INQUIRY;
69 struct _CDB6INQUIRY3 {
70 UCHAR OperationCode;
71 UCHAR EnableVitalProductData : 1;
72 UCHAR CommandSupportData : 1;
73 UCHAR Reserved1 : 6;
74 UCHAR PageCode;
75 UCHAR Reserved2;
76 UCHAR AllocationLength;
77 UCHAR Control;
78 } CDB6INQUIRY3, *PCDB6INQUIRY3;
80 struct _CDB6VERIFY {
81 UCHAR OperationCode;
82 UCHAR Fixed : 1;
83 UCHAR ByteCompare : 1;
84 UCHAR Immediate : 1;
85 UCHAR Reserved : 2;
86 UCHAR LogicalUnitNumber : 3;
87 UCHAR VerificationLength[3];
88 UCHAR Control;
89 } CDB6VERIFY, *PCDB6VERIFY;
91 struct _CDB6FORMAT {
92 UCHAR OperationCode;
93 UCHAR FormatControl : 5;
94 UCHAR LogicalUnitNumber : 3;
95 UCHAR FReserved1;
96 UCHAR InterleaveMsb;
97 UCHAR InterleaveLsb;
98 UCHAR FReserved2;
99 } CDB6FORMAT, *PCDB6FORMAT;
101 struct _CDB10 {
102 UCHAR OperationCode;
103 UCHAR RelativeAddress : 1;
104 UCHAR Reserved1 : 2;
105 UCHAR ForceUnitAccess : 1;
106 UCHAR DisablePageOut : 1;
107 UCHAR LogicalUnitNumber : 3;
108 UCHAR LogicalBlockByte0;
109 UCHAR LogicalBlockByte1;
110 UCHAR LogicalBlockByte2;
111 UCHAR LogicalBlockByte3;
112 UCHAR Reserved2;
113 UCHAR TransferBlocksMsb;
114 UCHAR TransferBlocksLsb;
115 UCHAR Control;
116 } CDB10, *PCDB10;
118 struct _CDB12 {
119 UCHAR OperationCode;
120 UCHAR RelativeAddress : 1;
121 UCHAR Reserved1 : 2;
122 UCHAR ForceUnitAccess : 1;
123 UCHAR DisablePageOut : 1;
124 UCHAR LogicalUnitNumber : 3;
125 UCHAR LogicalBlock[4];
126 UCHAR TransferLength[4];
127 UCHAR Reserved2;
128 UCHAR Control;
129 } CDB12, *PCDB12;
131 struct _PAUSE_RESUME {
132 UCHAR OperationCode;
133 UCHAR Reserved1 : 5;
134 UCHAR LogicalUnitNumber : 3;
135 UCHAR Reserved2[6];
136 UCHAR Action;
137 UCHAR Control;
138 } PAUSE_RESUME, *PPAUSE_RESUME;
140 struct _READ_TOC {
141 UCHAR OperationCode;
142 UCHAR Reserved0 : 1;
143 UCHAR Msf : 1;
144 UCHAR Reserved1 : 3;
145 UCHAR LogicalUnitNumber : 3;
146 UCHAR Format2 : 4;
147 UCHAR Reserved2 : 4;
148 UCHAR Reserved3[3];
149 UCHAR StartingTrack;
150 UCHAR AllocationLength[2];
151 UCHAR Control : 6;
152 UCHAR Format : 2;
153 } READ_TOC, *PREAD_TOC;
155 struct _READ_DISK_INFORMATION {
156 UCHAR OperationCode;
157 UCHAR Reserved1 : 5;
158 UCHAR Lun : 3;
159 UCHAR Reserved2[5];
160 UCHAR AllocationLength[2];
161 UCHAR Control;
162 } READ_DISK_INFORMATION, *PREAD_DISK_INFORMATION;
164 struct _READ_TRACK_INFORMATION {
165 UCHAR OperationCode;
166 UCHAR Track : 1;
167 UCHAR Reserved1 : 3;
168 UCHAR Reserved2 : 1;
169 UCHAR Lun : 3;
170 UCHAR BlockAddress[4];
171 UCHAR Reserved3;
172 UCHAR AllocationLength[2];
173 UCHAR Control;
174 } READ_TRACK_INFORMATION, *PREAD_TRACK_INFORMATION;
176 struct _RESERVE_TRACK_RZONE {
177 UCHAR OperationCode;
178 UCHAR Reserved1[4];
179 UCHAR ReservationSize[4];
180 UCHAR Control;
181 } RESERVE_TRACK_RZONE, *PRESERVE_TRACK_RZONE;
183 struct _SEND_OPC_INFORMATION {
184 UCHAR OperationCode;
185 UCHAR DoOpc : 1;
186 UCHAR Reserved : 7;
187 UCHAR Reserved1[5];
188 UCHAR ParameterListLength[2];
189 UCHAR Reserved2;
190 } SEND_OPC_INFORMATION, *PSEND_OPC_INFORMATION;
192 struct _CLOSE_TRACK {
193 UCHAR OperationCode;
194 UCHAR Immediate : 1;
195 UCHAR Reserved1 : 7;
196 UCHAR Track : 1;
197 UCHAR Session : 1;
198 UCHAR Reserved2 : 6;
199 UCHAR Reserved3;
200 UCHAR TrackNumber[2];
201 UCHAR Reserved4[3];
202 UCHAR Control;
203 } CLOSE_TRACK, *PCLOSE_TRACK;
205 struct _SEND_CUE_SHEET {
206 UCHAR OperationCode;
207 UCHAR Reserved[5];
208 UCHAR CueSheetSize[3];
209 UCHAR Control;
210 } SEND_CUE_SHEET, *PSEND_CUE_SHEET;
212 struct _READ_HEADER {
213 UCHAR OperationCode;
214 UCHAR Reserved1 : 1;
215 UCHAR Msf : 1;
216 UCHAR Reserved2 : 3;
217 UCHAR Lun : 3;
218 UCHAR LogicalBlockAddress[4];
219 UCHAR Reserved3;
220 UCHAR AllocationLength[2];
221 UCHAR Control;
222 } READ_HEADER, *PREAD_HEADER;
224 struct _PLAY_AUDIO {
225 UCHAR OperationCode;
226 UCHAR Reserved1 : 5;
227 UCHAR LogicalUnitNumber : 3;
228 UCHAR StartingBlockAddress[4];
229 UCHAR Reserved2;
230 UCHAR PlayLength[2];
231 UCHAR Control;
232 } PLAY_AUDIO, *PPLAY_AUDIO;
234 struct _PLAY_AUDIO_MSF {
235 UCHAR OperationCode;
236 UCHAR Reserved1 : 5;
237 UCHAR LogicalUnitNumber : 3;
238 UCHAR Reserved2;
239 UCHAR StartingM;
240 UCHAR StartingS;
241 UCHAR StartingF;
242 UCHAR EndingM;
243 UCHAR EndingS;
244 UCHAR EndingF;
245 UCHAR Control;
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
250 for C++. */
251 struct _PLAY_CD {
252 UCHAR OperationCode;
253 UCHAR Reserved1 : 1;
254 UCHAR CMSF : 1;
255 UCHAR ExpectedSectorType : 3;
256 UCHAR Lun : 3;
257 #ifndef __cplusplus
258 _ANONYMOUS_UNION
259 #endif
260 union {
261 struct _LBA {
262 UCHAR StartingBlockAddress[4];
263 UCHAR PlayLength[4];
264 } LBA;
266 struct _MSF {
267 UCHAR Reserved1;
268 UCHAR StartingM;
269 UCHAR StartingS;
270 UCHAR StartingF;
271 UCHAR EndingM;
272 UCHAR EndingS;
273 UCHAR EndingF;
274 UCHAR Reserved2;
275 } MSF;
276 #ifndef __cplusplus
277 }DUMMYUNIONNAME;
278 #else
280 #endif
282 UCHAR Audio : 1;
283 UCHAR Composite : 1;
284 UCHAR Port1 : 1;
285 UCHAR Port2 : 1;
286 UCHAR Reserved2 : 3;
287 UCHAR Speed : 1;
288 UCHAR Control;
289 } PLAY_CD, *PPLAY_CD;
291 struct _SCAN_CD {
292 UCHAR OperationCode;
293 UCHAR RelativeAddress : 1;
294 UCHAR Reserved1 : 3;
295 UCHAR Direct : 1;
296 UCHAR Lun : 3;
297 UCHAR StartingAddress[4];
298 UCHAR Reserved2[3];
299 UCHAR Reserved3 : 6;
300 UCHAR Type : 2;
301 UCHAR Reserved4;
302 UCHAR Control;
303 } SCAN_CD, *PSCAN_CD;
305 struct _STOP_PLAY_SCAN {
306 UCHAR OperationCode;
307 UCHAR Reserved1 : 5;
308 UCHAR Lun : 3;
309 UCHAR Reserved2[7];
310 UCHAR Control;
311 } STOP_PLAY_SCAN, *PSTOP_PLAY_SCAN;
313 struct _SUBCHANNEL {
314 UCHAR OperationCode;
315 UCHAR Reserved0 : 1;
316 UCHAR Msf : 1;
317 UCHAR Reserved1 : 3;
318 UCHAR LogicalUnitNumber : 3;
319 UCHAR Reserved2 : 6;
320 UCHAR SubQ : 1;
321 UCHAR Reserved3 : 1;
322 UCHAR Format;
323 UCHAR Reserved4[2];
324 UCHAR TrackNumber;
325 UCHAR AllocationLength[2];
326 UCHAR Control;
327 } SUBCHANNEL, *PSUBCHANNEL;
329 struct _READ_CD {
330 UCHAR OperationCode;
331 UCHAR RelativeAddress : 1;
332 UCHAR Reserved0 : 1;
333 UCHAR ExpectedSectorType : 3;
334 UCHAR Lun : 3;
335 UCHAR StartingLBA[4];
336 UCHAR TransferBlocks[3];
337 UCHAR Reserved2 : 1;
338 UCHAR ErrorFlags : 2;
339 UCHAR IncludeEDC : 1;
340 UCHAR IncludeUserData : 1;
341 UCHAR HeaderCode : 2;
342 UCHAR IncludeSyncData : 1;
343 UCHAR SubChannelSelection : 3;
344 UCHAR Reserved3 : 5;
345 UCHAR Control;
346 } READ_CD, *PREAD_CD;
348 struct _READ_CD_MSF {
349 UCHAR OperationCode;
350 UCHAR RelativeAddress : 1;
351 UCHAR Reserved1 : 1;
352 UCHAR ExpectedSectorType : 3;
353 UCHAR Lun : 3;
354 UCHAR Reserved2;
355 UCHAR StartingM;
356 UCHAR StartingS;
357 UCHAR StartingF;
358 UCHAR EndingM;
359 UCHAR EndingS;
360 UCHAR EndingF;
361 UCHAR Reserved3;
362 UCHAR Reserved4 : 1;
363 UCHAR ErrorFlags : 2;
364 UCHAR IncludeEDC : 1;
365 UCHAR IncludeUserData : 1;
366 UCHAR HeaderCode : 2;
367 UCHAR IncludeSyncData : 1;
368 UCHAR SubChannelSelection : 3;
369 UCHAR Reserved5 : 5;
370 UCHAR Control;
371 } READ_CD_MSF, *PREAD_CD_MSF;
373 struct _PLXTR_READ_CDDA {
374 UCHAR OperationCode;
375 UCHAR Reserved0 : 5;
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;
385 UCHAR SubCode;
386 UCHAR Control;
387 } PLXTR_READ_CDDA, *PPLXTR_READ_CDDA;
389 struct _NEC_READ_CDDA {
390 UCHAR OperationCode;
391 UCHAR Reserved0;
392 UCHAR LogicalBlockByte0;
393 UCHAR LogicalBlockByte1;
394 UCHAR LogicalBlockByte2;
395 UCHAR LogicalBlockByte3;
396 UCHAR Reserved1;
397 UCHAR TransferBlockByte0;
398 UCHAR TransferBlockByte1;
399 UCHAR Control;
400 } NEC_READ_CDDA, *PNEC_READ_CDDA;
402 struct _MODE_SENSE {
403 UCHAR OperationCode;
404 UCHAR Reserved1 : 3;
405 UCHAR Dbd : 1;
406 UCHAR Reserved2 : 1;
407 UCHAR LogicalUnitNumber : 3;
408 UCHAR PageCode : 6;
409 UCHAR Pc : 2;
410 UCHAR Reserved3;
411 UCHAR AllocationLength;
412 UCHAR Control;
413 } MODE_SENSE, *PMODE_SENSE;
415 struct _MODE_SENSE10 {
416 UCHAR OperationCode;
417 UCHAR Reserved1 : 3;
418 UCHAR Dbd : 1;
419 UCHAR Reserved2 : 1;
420 UCHAR LogicalUnitNumber : 3;
421 UCHAR PageCode : 6;
422 UCHAR Pc : 2;
423 UCHAR Reserved3[4];
424 UCHAR AllocationLength[2];
425 UCHAR Control;
426 } MODE_SENSE10, *PMODE_SENSE10;
428 struct _MODE_SELECT {
429 UCHAR OperationCode;
430 UCHAR SPBit : 1;
431 UCHAR Reserved1 : 3;
432 UCHAR PFBit : 1;
433 UCHAR LogicalUnitNumber : 3;
434 UCHAR Reserved2[2];
435 UCHAR ParameterListLength;
436 UCHAR Control;
437 } MODE_SELECT, *PMODE_SELECT;
439 struct _MODE_SELECT10 {
440 UCHAR OperationCode;
441 UCHAR SPBit : 1;
442 UCHAR Reserved1 : 3;
443 UCHAR PFBit : 1;
444 UCHAR LogicalUnitNumber : 3;
445 UCHAR Reserved2[5];
446 UCHAR ParameterListLength[2];
447 UCHAR Control;
448 } MODE_SELECT10, *PMODE_SELECT10;
450 struct _LOCATE {
451 UCHAR OperationCode;
452 UCHAR Immediate : 1;
453 UCHAR CPBit : 1;
454 UCHAR BTBit : 1;
455 UCHAR Reserved1 : 2;
456 UCHAR LogicalUnitNumber : 3;
457 UCHAR Reserved3;
458 UCHAR LogicalBlockAddress[4];
459 UCHAR Reserved4;
460 UCHAR Partition;
461 UCHAR Control;
462 } LOCATE, *PLOCATE;
464 struct _LOGSENSE {
465 UCHAR OperationCode;
466 UCHAR SPBit : 1;
467 UCHAR PPCBit : 1;
468 UCHAR Reserved1 : 3;
469 UCHAR LogicalUnitNumber : 3;
470 UCHAR PageCode : 6;
471 UCHAR PCBit : 2;
472 UCHAR Reserved2;
473 UCHAR Reserved3;
474 UCHAR ParameterPointer[2];
475 UCHAR AllocationLength[2];
476 UCHAR Control;
477 } LOGSENSE, *PLOGSENSE;
479 struct _LOGSELECT {
480 UCHAR OperationCode;
481 UCHAR SPBit : 1;
482 UCHAR PCRBit : 1;
483 UCHAR Reserved1 : 3;
484 UCHAR LogicalUnitNumber : 3;
485 UCHAR Reserved : 6;
486 UCHAR PCBit : 2;
487 UCHAR Reserved2[4];
488 UCHAR ParameterListLength[2];
489 UCHAR Control;
490 } LOGSELECT, *PLOGSELECT;
492 struct _PRINT {
493 UCHAR OperationCode;
494 UCHAR Reserved : 5;
495 UCHAR LogicalUnitNumber : 3;
496 UCHAR TransferLength[3];
497 UCHAR Control;
498 } PRINT, *PPRINT;
500 struct _SEEK {
501 UCHAR OperationCode;
502 UCHAR Reserved1 : 5;
503 UCHAR LogicalUnitNumber : 3;
504 UCHAR LogicalBlockAddress[4];
505 UCHAR Reserved2[3];
506 UCHAR Control;
507 } SEEK, *PSEEK;
509 struct _ERASE {
510 UCHAR OperationCode;
511 UCHAR Long : 1;
512 UCHAR Immediate : 1;
513 UCHAR Reserved1 : 3;
514 UCHAR LogicalUnitNumber : 3;
515 UCHAR Reserved2[3];
516 UCHAR Control;
517 } ERASE, *PERASE;
519 struct _START_STOP {
520 UCHAR OperationCode;
521 UCHAR Immediate: 1;
522 UCHAR Reserved1 : 4;
523 UCHAR LogicalUnitNumber : 3;
524 UCHAR Reserved2[2];
525 UCHAR Start : 1;
526 UCHAR LoadEject : 1;
527 UCHAR Reserved3 : 6;
528 UCHAR Control;
529 } START_STOP, *PSTART_STOP;
531 struct _MEDIA_REMOVAL {
532 UCHAR OperationCode;
533 UCHAR Reserved1 : 5;
534 UCHAR LogicalUnitNumber : 3;
535 UCHAR Reserved2[2];
537 UCHAR Prevent : 1;
538 UCHAR Persistant : 1;
539 UCHAR Reserved3 : 6;
541 UCHAR Control;
542 } MEDIA_REMOVAL, *PMEDIA_REMOVAL;
544 struct _SEEK_BLOCK {
545 UCHAR OperationCode;
546 UCHAR Immediate : 1;
547 UCHAR Reserved1 : 7;
548 UCHAR BlockAddress[3];
549 UCHAR Link : 1;
550 UCHAR Flag : 1;
551 UCHAR Reserved2 : 4;
552 UCHAR VendorUnique : 2;
553 } SEEK_BLOCK, *PSEEK_BLOCK;
555 struct _REQUEST_BLOCK_ADDRESS {
556 UCHAR OperationCode;
557 UCHAR Reserved1[3];
558 UCHAR AllocationLength;
559 UCHAR Link : 1;
560 UCHAR Flag : 1;
561 UCHAR Reserved2 : 4;
562 UCHAR VendorUnique : 2;
563 } REQUEST_BLOCK_ADDRESS, *PREQUEST_BLOCK_ADDRESS;
565 struct _PARTITION {
566 UCHAR OperationCode;
567 UCHAR Immediate : 1;
568 UCHAR Sel: 1;
569 UCHAR PartitionSelect : 6;
570 UCHAR Reserved1[3];
571 UCHAR Control;
572 } PARTITION, *PPARTITION;
574 struct _WRITE_TAPE_MARKS {
575 UCHAR OperationCode;
576 UCHAR Immediate : 1;
577 UCHAR WriteSetMarks: 1;
578 UCHAR Reserved : 3;
579 UCHAR LogicalUnitNumber : 3;
580 UCHAR TransferLength[3];
581 UCHAR Control;
582 } WRITE_TAPE_MARKS, *PWRITE_TAPE_MARKS;
584 struct _SPACE_TAPE_MARKS {
585 UCHAR OperationCode;
586 UCHAR Code : 3;
587 UCHAR Reserved : 2;
588 UCHAR LogicalUnitNumber : 3;
589 UCHAR NumMarksMSB ;
590 UCHAR NumMarks;
591 UCHAR NumMarksLSB;
592 union {
593 UCHAR value;
594 struct {
595 UCHAR Link : 1;
596 UCHAR Flag : 1;
597 UCHAR Reserved : 4;
598 UCHAR VendorUnique : 2;
599 } Fields;
600 } Byte6;
601 } SPACE_TAPE_MARKS, *PSPACE_TAPE_MARKS;
603 struct _READ_POSITION {
604 UCHAR Operation;
605 UCHAR BlockType : 1;
606 UCHAR Reserved1 : 4;
607 UCHAR Lun : 3;
608 UCHAR Reserved2[7];
609 UCHAR Control;
610 } READ_POSITION, *PREAD_POSITION;
612 struct _CDB6READWRITETAPE {
613 UCHAR OperationCode;
614 UCHAR VendorSpecific : 5;
615 UCHAR Reserved : 3;
616 UCHAR TransferLenMSB;
617 UCHAR TransferLen;
618 UCHAR TransferLenLSB;
619 UCHAR Link : 1;
620 UCHAR Flag : 1;
621 UCHAR Reserved1 : 4;
622 UCHAR VendorUnique : 2;
623 } CDB6READWRITETAPE, *PCDB6READWRITETAPE;
625 struct _INIT_ELEMENT_STATUS {
626 UCHAR OperationCode;
627 UCHAR Reserved1 : 5;
628 UCHAR LogicalUnitNubmer : 3;
629 UCHAR Reserved2[3];
630 UCHAR Reserved3 : 7;
631 UCHAR NoBarCode : 1;
632 } INIT_ELEMENT_STATUS, *PINIT_ELEMENT_STATUS;
634 struct _INITIALIZE_ELEMENT_RANGE {
635 UCHAR OperationCode;
636 UCHAR Range : 1;
637 UCHAR Reserved1 : 4;
638 UCHAR LogicalUnitNubmer : 3;
639 UCHAR FirstElementAddress[2];
640 UCHAR Reserved2[2];
641 UCHAR NumberOfElements[2];
642 UCHAR Reserved3;
643 UCHAR Reserved4 : 7;
644 UCHAR NoBarCode : 1;
645 } INITIALIZE_ELEMENT_RANGE, *PINITIALIZE_ELEMENT_RANGE;
647 struct _POSITION_TO_ELEMENT {
648 UCHAR OperationCode;
649 UCHAR Reserved1 : 5;
650 UCHAR LogicalUnitNumber : 3;
651 UCHAR TransportElementAddress[2];
652 UCHAR DestinationElementAddress[2];
653 UCHAR Reserved2[2];
654 UCHAR Flip : 1;
655 UCHAR Reserved3 : 7;
656 UCHAR Control;
657 } POSITION_TO_ELEMENT, *PPOSITION_TO_ELEMENT;
659 struct _MOVE_MEDIUM {
660 UCHAR OperationCode;
661 UCHAR Reserved1 : 5;
662 UCHAR LogicalUnitNumber : 3;
663 UCHAR TransportElementAddress[2];
664 UCHAR SourceElementAddress[2];
665 UCHAR DestinationElementAddress[2];
666 UCHAR Reserved2[2];
667 UCHAR Flip : 1;
668 UCHAR Reserved3 : 7;
669 UCHAR Control;
670 } MOVE_MEDIUM, *PMOVE_MEDIUM;
672 struct _EXCHANGE_MEDIUM {
673 UCHAR OperationCode;
674 UCHAR Reserved1 : 5;
675 UCHAR LogicalUnitNumber : 3;
676 UCHAR TransportElementAddress[2];
677 UCHAR SourceElementAddress[2];
678 UCHAR Destination1ElementAddress[2];
679 UCHAR Destination2ElementAddress[2];
680 UCHAR Flip1 : 1;
681 UCHAR Flip2 : 1;
682 UCHAR Reserved3 : 6;
683 UCHAR Control;
684 } EXCHANGE_MEDIUM, *PEXCHANGE_MEDIUM;
686 struct _READ_ELEMENT_STATUS {
687 UCHAR OperationCode;
688 UCHAR ElementType : 4;
689 UCHAR VolTag : 1;
690 UCHAR LogicalUnitNumber : 3;
691 UCHAR StartingElementAddress[2];
692 UCHAR NumberOfElements[2];
693 UCHAR Reserved1;
694 UCHAR AllocationLength[3];
695 UCHAR Reserved2;
696 UCHAR Control;
697 } READ_ELEMENT_STATUS, *PREAD_ELEMENT_STATUS;
699 struct _SEND_VOLUME_TAG {
700 UCHAR OperationCode;
701 UCHAR ElementType : 4;
702 UCHAR Reserved1 : 1;
703 UCHAR LogicalUnitNumber : 3;
704 UCHAR StartingElementAddress[2];
705 UCHAR Reserved2;
706 UCHAR ActionCode : 5;
707 UCHAR Reserved3 : 3;
708 UCHAR Reserved4[2];
709 UCHAR ParameterListLength[2];
710 UCHAR Reserved5;
711 UCHAR Control;
712 } SEND_VOLUME_TAG, *PSEND_VOLUME_TAG;
714 struct _REQUEST_VOLUME_ELEMENT_ADDRESS {
715 UCHAR OperationCode;
716 UCHAR ElementType : 4;
717 UCHAR VolTag : 1;
718 UCHAR LogicalUnitNumber : 3;
719 UCHAR StartingElementAddress[2];
720 UCHAR NumberElements[2];
721 UCHAR Reserved1;
722 UCHAR AllocationLength[3];
723 UCHAR Reserved2;
724 UCHAR Control;
725 } REQUEST_VOLUME_ELEMENT_ADDRESS, *PREQUEST_VOLUME_ELEMENT_ADDRESS;
727 struct _LOAD_UNLOAD {
728 UCHAR OperationCode;
729 UCHAR Immediate : 1;
730 UCHAR Reserved1 : 4;
731 UCHAR Lun : 3;
732 UCHAR Reserved2[2];
733 UCHAR Start : 1;
734 UCHAR LoadEject : 1;
735 UCHAR Reserved3: 6;
736 UCHAR Reserved4[3];
737 UCHAR Slot;
738 UCHAR Reserved5[3];
739 } LOAD_UNLOAD, *PLOAD_UNLOAD;
741 struct _MECH_STATUS {
742 UCHAR OperationCode;
743 UCHAR Reserved : 5;
744 UCHAR Lun : 3;
745 UCHAR Reserved1[6];
746 UCHAR AllocationLength[2];
747 UCHAR Reserved2[1];
748 UCHAR Control;
749 } MECH_STATUS, *PMECH_STATUS;
751 struct _SYNCHRONIZE_CACHE10 {
753 UCHAR OperationCode;
755 UCHAR RelAddr : 1;
756 UCHAR Immediate : 1;
757 UCHAR Reserved : 3;
758 UCHAR Lun : 3;
760 UCHAR LogicalBlockAddress[4];
761 UCHAR Reserved2;
762 UCHAR BlockCount[2];
763 UCHAR Control;
764 } SYNCHRONIZE_CACHE10, *PSYNCHRONIZE_CACHE10;
766 struct _GET_EVENT_STATUS_NOTIFICATION {
767 UCHAR OperationCode;
769 UCHAR Immediate : 1;
770 UCHAR Reserved : 4;
771 UCHAR Lun : 3;
773 UCHAR Reserved2[2];
774 UCHAR NotificationClassRequest;
775 UCHAR Reserved3[2];
776 UCHAR EventListLength[2];
778 UCHAR Control;
779 } GET_EVENT_STATUS_NOTIFICATION, *PGET_EVENT_STATUS_NOTIFICATION;
781 struct _READ_DVD_STRUCTURE {
782 UCHAR OperationCode;
783 UCHAR Reserved1 : 5;
784 UCHAR Lun : 3;
785 UCHAR RMDBlockNumber[4];
786 UCHAR LayerNumber;
787 UCHAR Format;
788 UCHAR AllocationLength[2];
789 UCHAR Reserved3 : 6;
790 UCHAR AGID : 2;
791 UCHAR Control;
792 } READ_DVD_STRUCTURE, *PREAD_DVD_STRUCTURE;
794 struct _SEND_DVD_STRUCTURE {
795 UCHAR OperationCode;
796 UCHAR Reserved1 : 5;
797 UCHAR Lun : 3;
798 UCHAR Reserved2[5];
799 UCHAR Format;
800 UCHAR ParameterListLength[2];
801 UCHAR Reserved3;
802 UCHAR Control;
803 } SEND_DVD_STRUCTURE, *PSEND_DVD_STRUCTURE;
805 struct _SEND_KEY {
806 UCHAR OperationCode;
807 UCHAR Reserved1 : 5;
808 UCHAR Lun : 3;
809 UCHAR Reserved2[6];
810 UCHAR ParameterListLength[2];
811 UCHAR KeyFormat : 6;
812 UCHAR AGID : 2;
813 UCHAR Control;
814 } SEND_KEY, *PSEND_KEY;
816 struct _REPORT_KEY {
817 UCHAR OperationCode;
818 UCHAR Reserved1 : 5;
819 UCHAR Lun : 3;
820 UCHAR LogicalBlockAddress[4];
821 UCHAR Reserved2[2];
822 UCHAR AllocationLength[2];
823 UCHAR KeyFormat : 6;
824 UCHAR AGID : 2;
825 UCHAR Control;
826 } REPORT_KEY, *PREPORT_KEY;
828 struct _SET_READ_AHEAD {
829 UCHAR OperationCode;
830 UCHAR Reserved1 : 5;
831 UCHAR Lun : 3;
832 UCHAR TriggerLBA[4];
833 UCHAR ReadAheadLBA[4];
834 UCHAR Reserved2;
835 UCHAR Control;
836 } SET_READ_AHEAD, *PSET_READ_AHEAD;
838 struct _READ_FORMATTED_CAPACITIES {
839 UCHAR OperationCode;
840 UCHAR Reserved1 : 5;
841 UCHAR Lun : 3;
842 UCHAR Reserved2[5];
843 UCHAR AllocationLength[2];
844 UCHAR Control;
845 } READ_FORMATTED_CAPACITIES, *PREAD_FORMATTED_CAPACITIES;
847 struct _REPORT_LUNS {
848 UCHAR OperationCode;
849 UCHAR Reserved1[5];
850 UCHAR AllocationLength[4];
851 UCHAR Reserved2[1];
852 UCHAR Control;
853 } REPORT_LUNS, *PREPORT_LUNS;
855 struct _PERSISTENT_RESERVE_IN {
856 UCHAR OperationCode;
857 UCHAR ServiceAction : 5;
858 UCHAR Reserved1 : 3;
859 UCHAR Reserved2[5];
860 UCHAR AllocationLength[2];
861 UCHAR Control;
862 } PERSISTENT_RESERVE_IN, *PPERSISTENT_RESERVE_IN;
864 struct _PERSISTENT_RESERVE_OUT {
865 UCHAR OperationCode;
866 UCHAR ServiceAction : 5;
867 UCHAR Reserved1 : 3;
868 UCHAR Type : 4;
869 UCHAR Scope : 4;
870 UCHAR Reserved2[4];
871 UCHAR ParameterListLength[2];
872 UCHAR Control;
873 } PERSISTENT_RESERVE_OUT, *PPERSISTENT_RESERVE_OUT;
875 struct _GET_CONFIGURATION {
876 UCHAR OperationCode;
877 UCHAR RequestType : 1;
878 UCHAR Reserved1 : 7;
879 UCHAR StartingFeature[2];
880 UCHAR Reserved2[3];
881 UCHAR AllocationLength[2];
882 UCHAR Control;
883 } GET_CONFIGURATION, *PGET_CONFIGURATION;
885 struct _SET_CD_SPEED {
886 UCHAR OperationCode;
887 UCHAR Reserved1;
888 UCHAR ReadSpeed[2];
889 UCHAR WriteSpeed[2];
890 UCHAR Reserved2[5];
891 UCHAR Control;
892 } SET_CD_SPEED, *PSET_CD_SPEED;
894 ULONG AsUlong[4];
895 UCHAR AsByte[16];
896 } CDB, *PCDB;
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 {
909 UCHAR Versions;
910 _ANONYMOUS_STRUCT struct {
911 UCHAR ANSIVersion : 3;
912 UCHAR ECMAVersion : 3;
913 UCHAR ISOVersion : 2;
914 } DUMMYSTRUCTNAME;
915 } DUMMYUNIONNAME;
916 UCHAR ResponseDataFormat : 4;
917 UCHAR HiSupport : 1;
918 UCHAR NormACA : 1;
919 UCHAR TerminateTask : 1;
920 UCHAR AERC : 1;
921 UCHAR AdditionalLength;
922 UCHAR Reserved;
923 UCHAR Addr16 : 1;
924 UCHAR Addr32 : 1;
925 UCHAR AckReqQ: 1;
926 UCHAR MediumChanger : 1;
927 UCHAR MultiPort : 1;
928 UCHAR ReservedBit2 : 1;
929 UCHAR EnclosureServices : 1;
930 UCHAR ReservedBit3 : 1;
931 UCHAR SoftReset : 1;
932 UCHAR CommandQueue : 1;
933 UCHAR TransferDisable : 1;
934 UCHAR LinkedCommands : 1;
935 UCHAR Synchronous : 1;
936 UCHAR Wide16Bit : 1;
937 UCHAR Wide32Bit : 1;
938 UCHAR RelativeAddressing : 1;
939 UCHAR VendorId[8];
940 UCHAR ProductId[16];
941 UCHAR ProductRevisionLevel[4];
942 UCHAR VendorSpecific[20];
943 UCHAR Reserved3[40];
944 } INQUIRYDATA, *PINQUIRYDATA;
945 #endif
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;
1166 UCHAR Valid : 1;
1167 UCHAR SegmentNumber;
1168 UCHAR SenseKey : 4;
1169 UCHAR Reserved : 1;
1170 UCHAR IncorrectLength : 1;
1171 UCHAR EndOfMedia : 1;
1172 UCHAR FileMark : 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
1184 /* Sense codes */
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 {
1283 UCHAR Reserved;
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;
1291 UCHAR MediumType;
1292 UCHAR DeviceSpecificParameter;
1293 UCHAR BlockDescriptorLength;
1294 }MODE_PARAMETER_HEADER, *PMODE_PARAMETER_HEADER;
1296 typedef struct _MODE_PARAMETER_HEADER10 {
1297 UCHAR ModeDataLength[2];
1298 UCHAR MediumType;
1299 UCHAR DeviceSpecificParameter;
1300 UCHAR Reserved[2];
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 {
1311 UCHAR DensityCode;
1312 UCHAR NumberOfBlocks[3];
1313 UCHAR Reserved;
1314 UCHAR BlockLength[3];
1315 } MODE_PARAMETER_BLOCK, *PMODE_PARAMETER_BLOCK;
1317 typedef struct _MODE_DISCONNECT_PAGE {
1318 UCHAR PageCode : 6;
1319 UCHAR Reserved : 1;
1320 UCHAR PageSavable : 1;
1321 UCHAR PageLength;
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;
1329 UCHAR Reserved2[3];
1330 }MODE_DISCONNECT_PAGE, *PMODE_DISCONNECT_PAGE;
1332 typedef struct _MODE_CACHING_PAGE {
1333 UCHAR PageCode : 6;
1334 UCHAR Reserved : 1;
1335 UCHAR PageSavable : 1;
1336 UCHAR PageLength;
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 {
1350 UCHAR PageLength;
1351 UCHAR WriteType : 4;
1352 UCHAR TestWrite : 1;
1353 UCHAR LinkSizeValid : 1;
1354 UCHAR BufferUnderrunFreeEnabled : 1;
1355 UCHAR Reserved2 : 1;
1356 UCHAR TrackMode : 4;
1357 UCHAR Copy : 1;
1358 UCHAR FixedPacket : 1;
1359 UCHAR MultiSession : 2;
1360 UCHAR DataBlockType : 4;
1361 UCHAR Reserved3 : 4;
1362 UCHAR LinkSize;
1363 UCHAR Reserved4;
1364 UCHAR HostApplicationCode : 6;
1365 UCHAR Reserved5 : 2;
1366 UCHAR SessionFormat;
1367 UCHAR Reserved6;
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];
1378 UCHAR ISRCOwner[3];
1379 UCHAR ISRCRecordingYear[2];
1380 UCHAR ISRCSerialNumber[5];
1381 UCHAR ISRCZero;
1382 UCHAR ISRCAFrame;
1383 UCHAR ISRCReserved;
1384 UCHAR SubHeaderData[4];
1385 } MODE_CDROM_WRITE_PARAMETERS_PAGE, *PMODE_CDROM_WRITE_PARAMETERS_PAGE;
1387 typedef struct _MODE_FLEXIBLE_DISK_PAGE {
1388 UCHAR PageCode : 6;
1389 UCHAR Reserved : 1;
1390 UCHAR PageSavable : 1;
1391 UCHAR PageLength;
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];
1399 UCHAR StepRate[2];
1400 UCHAR StepPluseWidth;
1401 UCHAR HeadSettleDelay[2];
1402 UCHAR MotorOnDelay;
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];
1418 UCHAR Reserved4[2];
1419 } MODE_FLEXIBLE_DISK_PAGE, *PMODE_FLEXIBLE_DISK_PAGE;
1421 typedef struct _MODE_FORMAT_PAGE {
1422 UCHAR PageCode : 6;
1423 UCHAR Reserved : 1;
1424 UCHAR PageSavable : 1;
1425 UCHAR PageLength;
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;
1440 UCHAR Reserved3[3];
1441 } MODE_FORMAT_PAGE, *PMODE_FORMAT_PAGE;
1443 typedef struct _MODE_RIGID_GEOMETRY_PAGE {
1444 UCHAR PageCode : 6;
1445 UCHAR Reserved : 1;
1446 UCHAR PageSavable : 1;
1447 UCHAR PageLength;
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;
1457 UCHAR Reserved3;
1458 UCHAR RoataionRate[2];
1459 UCHAR Reserved4[2];
1460 } MODE_RIGID_GEOMETRY_PAGE, *PMODE_RIGID_GEOMETRY_PAGE;
1462 typedef struct _MODE_READ_WRITE_RECOVERY_PAGE {
1463 UCHAR PageCode : 6;
1464 UCHAR Reserved1 : 1;
1465 UCHAR PSBit : 1;
1466 UCHAR PageLength;
1467 UCHAR DCRBit : 1;
1468 UCHAR DTEBit : 1;
1469 UCHAR PERBit : 1;
1470 UCHAR EERBit : 1;
1471 UCHAR RCBit : 1;
1472 UCHAR TBBit : 1;
1473 UCHAR ARRE : 1;
1474 UCHAR AWRE : 1;
1475 UCHAR ReadRetryCount;
1476 UCHAR Reserved4[4];
1477 UCHAR WriteRetryCount;
1478 UCHAR Reserved5[3];
1479 } MODE_READ_WRITE_RECOVERY_PAGE, *PMODE_READ_WRITE_RECOVERY_PAGE;
1481 typedef struct _MODE_READ_RECOVERY_PAGE {
1482 UCHAR PageCode : 6;
1483 UCHAR Reserved1 : 1;
1484 UCHAR PSBit : 1;
1485 UCHAR PageLength;
1486 UCHAR DCRBit : 1;
1487 UCHAR DTEBit : 1;
1488 UCHAR PERBit : 1;
1489 UCHAR Reserved2 : 1;
1490 UCHAR RCBit : 1;
1491 UCHAR TBBit : 1;
1492 UCHAR Reserved3 : 2;
1493 UCHAR ReadRetryCount;
1494 UCHAR Reserved4[4];
1495 } MODE_READ_RECOVERY_PAGE, *PMODE_READ_RECOVERY_PAGE;
1497 typedef struct _MODE_INFO_EXCEPTIONS {
1498 UCHAR PageCode : 6;
1499 UCHAR Reserved1 : 1;
1500 UCHAR PSBit : 1;
1501 UCHAR PageLength;
1502 _ANONYMOUS_UNION union {
1503 UCHAR Flags;
1504 _ANONYMOUS_STRUCT struct {
1505 UCHAR LogErr : 1;
1506 UCHAR Reserved2 : 1;
1507 UCHAR Test : 1;
1508 UCHAR Dexcpt : 1;
1509 UCHAR Reserved3 : 3;
1510 UCHAR Perf : 1;
1511 } DUMMYSTRUCTNAME;
1512 } DUMMYUNIONNAME;
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;
1537 UCHAR Volume;
1538 } PORT_OUTPUT, *PPORT_OUTPUT;
1540 typedef struct _AUDIO_OUTPUT {
1541 UCHAR CodePage;
1542 UCHAR ParameterLength;
1543 UCHAR Immediate;
1544 UCHAR Reserved[2];
1545 UCHAR LbaFormat;
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;
1558 UCHAR Fault : 1;
1559 UCHAR Reserved : 5;
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;
1568 UCHAR Reserved : 6;
1569 UCHAR DiscPresent : 1;
1570 UCHAR Reserved2[3];
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;
1587 USHORT Reserved3;
1588 UCHAR FirstBlock[4];
1589 UCHAR LastBlock[4];
1590 UCHAR Reserved4;
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 {
1599 UCHAR Byte0;
1600 UCHAR Byte1;
1601 UCHAR Byte2;
1602 UCHAR Byte3;
1603 UCHAR Byte4;
1604 UCHAR Byte5;
1605 UCHAR Byte6;
1606 UCHAR Byte7;
1607 } DUMMYSTRUCTNAME;
1608 ULONGLONG AsULongLong;
1609 } EIGHT_BYTE, *PEIGHT_BYTE;
1611 typedef union _FOUR_BYTE {
1612 _ANONYMOUS_STRUCT struct {
1613 UCHAR Byte0;
1614 UCHAR Byte1;
1615 UCHAR Byte2;
1616 UCHAR Byte3;
1617 } DUMMYSTRUCTNAME;
1618 ULONG AsULong;
1619 } FOUR_BYTE, *PFOUR_BYTE;
1621 typedef union _TWO_BYTE {
1622 _ANONYMOUS_STRUCT struct {
1623 UCHAR Byte0;
1624 UCHAR Byte1;
1625 } DUMMYSTRUCTNAME;
1626 USHORT AsUShort;
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) { \
1661 UCHAR _val; \
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) { \
1669 UCHAR _val; \
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) { \
1680 UCHAR _val; \
1681 for (_val = 0; _val < 32; _val++) { \
1682 if (((Data) >> _val) == 1) { \
1683 break; \
1686 ASSERT(_val != 32); \
1687 (Bit) = _val; \
1690 #ifdef __cplusplus
1692 #endif
1694 #endif /* __SCSI_H */