1 | /*
|
---|
2 | * scsi.h
|
---|
3 | *
|
---|
4 | * SCSI port and class interface.
|
---|
5 | *
|
---|
6 | * This file is part of the w32api package.
|
---|
7 | *
|
---|
8 | * Contributors:
|
---|
9 | * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
|
---|
10 | *
|
---|
11 | * THIS SOFTWARE IS NOT COPYRIGHTED
|
---|
12 | *
|
---|
13 | * This source code is offered for use in the public domain. You may
|
---|
14 | * use, modify or distribute it freely.
|
---|
15 | *
|
---|
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.
|
---|
20 | *
|
---|
21 | */
|
---|
22 |
|
---|
23 | #ifndef __SCSI_H
|
---|
24 | #define __SCSI_H
|
---|
25 |
|
---|
26 | #if __GNUC__ >=3
|
---|
27 | #pragma GCC system_header
|
---|
28 | #endif
|
---|
29 |
|
---|
30 | #ifdef __cplusplus
|
---|
31 | extern "C" {
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | #include "ntddk.h"
|
---|
35 |
|
---|
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;
|
---|
48 |
|
---|
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;
|
---|
58 |
|
---|
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;
|
---|
68 |
|
---|
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;
|
---|
79 |
|
---|
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;
|
---|
90 |
|
---|
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;
|
---|
100 |
|
---|
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;
|
---|
117 |
|
---|
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;
|
---|
130 |
|
---|
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;
|
---|
139 |
|
---|
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;
|
---|
154 |
|
---|
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;
|
---|
163 |
|
---|
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;
|
---|
175 |
|
---|
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;
|
---|
182 |
|
---|
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;
|
---|
191 |
|
---|
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;
|
---|
204 |
|
---|
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;
|
---|
211 |
|
---|
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;
|
---|
223 |
|
---|
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;
|
---|
233 |
|
---|
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;
|
---|
247 |
|
---|
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;
|
---|
265 |
|
---|
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
|
---|
279 | }u;
|
---|
280 | #endif
|
---|
281 |
|
---|
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;
|
---|
290 |
|
---|
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;
|
---|
304 |
|
---|
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;
|
---|
312 |
|
---|
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;
|
---|
328 |
|
---|
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;
|
---|
347 |
|
---|
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;
|
---|
372 |
|
---|
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;
|
---|
388 |
|
---|
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;
|
---|
401 |
|
---|
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;
|
---|
414 |
|
---|
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;
|
---|
427 |
|
---|
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;
|
---|
438 |
|
---|
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;
|
---|
449 |
|
---|
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;
|
---|
463 |
|
---|
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;
|
---|
478 |
|
---|
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;
|
---|
491 |
|
---|
492 | struct _PRINT {
|
---|
493 | UCHAR OperationCode;
|
---|
494 | UCHAR Reserved : 5;
|
---|
495 | UCHAR LogicalUnitNumber : 3;
|
---|
496 | UCHAR TransferLength[3];
|
---|
497 | UCHAR Control;
|
---|
498 | } PRINT, *PPRINT;
|
---|
499 |
|
---|
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;
|
---|
508 |
|
---|
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;
|
---|
518 |
|
---|
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;
|
---|
530 |
|
---|
531 | struct _MEDIA_REMOVAL {
|
---|
532 | UCHAR OperationCode;
|
---|
533 | UCHAR Reserved1 : 5;
|
---|
534 | UCHAR LogicalUnitNumber : 3;
|
---|
535 | UCHAR Reserved2[2];
|
---|
536 |
|
---|
537 | UCHAR Prevent : 1;
|
---|
538 | UCHAR Persistant : 1;
|
---|
539 | UCHAR Reserved3 : 6;
|
---|
540 |
|
---|
541 | UCHAR Control;
|
---|
542 | } MEDIA_REMOVAL, *PMEDIA_REMOVAL;
|
---|
543 |
|
---|
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;
|
---|
554 |
|
---|
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;
|
---|
564 |
|
---|
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;
|
---|
573 |
|
---|
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;
|
---|
583 |
|
---|
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;
|
---|
602 |
|
---|
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;
|
---|
611 |
|
---|
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;
|
---|
624 |
|
---|
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;
|
---|
633 |
|
---|
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;
|
---|
646 |
|
---|
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;
|
---|
658 |
|
---|
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;
|
---|
671 |
|
---|
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;
|
---|
685 |
|
---|
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;
|
---|
698 |
|
---|
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;
|
---|
713 |
|
---|
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;
|
---|
726 |
|
---|
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;
|
---|
740 |
|
---|
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;
|
---|
750 |
|
---|
751 | struct _SYNCHRONIZE_CACHE10 {
|
---|
752 |
|
---|
753 | UCHAR OperationCode;
|
---|
754 |
|
---|
755 | UCHAR RelAddr : 1;
|
---|
756 | UCHAR Immediate : 1;
|
---|
757 | UCHAR Reserved : 3;
|
---|
758 | UCHAR Lun : 3;
|
---|
759 |
|
---|
760 | UCHAR LogicalBlockAddress[4];
|
---|
761 | UCHAR Reserved2;
|
---|
762 | UCHAR BlockCount[2];
|
---|
763 | UCHAR Control;
|
---|
764 | } SYNCHRONIZE_CACHE10, *PSYNCHRONIZE_CACHE10;
|
---|
765 |
|
---|
766 | struct _GET_EVENT_STATUS_NOTIFICATION {
|
---|
767 | UCHAR OperationCode;
|
---|
768 |
|
---|
769 | UCHAR Immediate : 1;
|
---|
770 | UCHAR Reserved : 4;
|
---|
771 | UCHAR Lun : 3;
|
---|
772 |
|
---|
773 | UCHAR Reserved2[2];
|
---|
774 | UCHAR NotificationClassRequest;
|
---|
775 | UCHAR Reserved3[2];
|
---|
776 | UCHAR EventListLength[2];
|
---|
777 |
|
---|
778 | UCHAR Control;
|
---|
779 | } GET_EVENT_STATUS_NOTIFICATION, *PGET_EVENT_STATUS_NOTIFICATION;
|
---|
780 |
|
---|
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;
|
---|
793 |
|
---|
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;
|
---|
804 |
|
---|
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;
|
---|
815 |
|
---|
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;
|
---|
827 |
|
---|
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;
|
---|
837 |
|
---|
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;
|
---|
846 |
|
---|
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;
|
---|
854 |
|
---|
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;
|
---|
863 |
|
---|
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;
|
---|
874 |
|
---|
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;
|
---|
884 |
|
---|
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;
|
---|
893 |
|
---|
894 | ULONG AsUlong[4];
|
---|
895 | UCHAR AsByte[16];
|
---|
896 | } CDB, *PCDB;
|
---|
897 |
|
---|
898 | #ifndef _INQUIRYDATA_DEFINED /* also in minitape.h */
|
---|
899 | #define _INQUIRYDATA_DEFINED
|
---|
900 |
|
---|
901 | #define INQUIRYDATABUFFERSIZE 36
|
---|
902 |
|
---|
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
|
---|
946 |
|
---|
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
|
---|
960 |
|
---|
961 | /* INQUIRYDATA.DeviceTypeQualifier constants */
|
---|
962 | #define DEVICE_CONNECTED 0x00
|
---|
963 |
|
---|
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
|
---|
973 |
|
---|
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
|
---|
1004 |
|
---|
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
|
---|
1044 |
|
---|
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
|
---|
1089 |
|
---|
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
|
---|
1110 |
|
---|
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
|
---|
1116 |
|
---|
1117 | #define SCSIMESS_MODIFY_DATA_POINTER 0x00
|
---|
1118 | #define SCSIMESS_SYNCHRONOUS_DATA_REQ 0x01
|
---|
1119 | #define SCSIMESS_WIDE_DATA_REQUEST 0x03
|
---|
1120 |
|
---|
1121 | #define SCSIMESS_MODIFY_DATA_LENGTH 5
|
---|
1122 | #define SCSIMESS_SYNCH_DATA_LENGTH 3
|
---|
1123 | #define SCSIMESS_WIDE_DATA_LENGTH 2
|
---|
1124 |
|
---|
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
|
---|
1149 |
|
---|
1150 | #define CDB_FORCE_MEDIA_ACCESS 0x08
|
---|
1151 |
|
---|
1152 | #define CDB_RETURN_ON_COMPLETION 0
|
---|
1153 | #define CDB_RETURN_IMMEDIATE 1
|
---|
1154 |
|
---|
1155 | #define CDB_INQUIRY_EVPD 0x01
|
---|
1156 |
|
---|
1157 | #define LUN0_FORMAT_SAVING_DEFECT_LIST 0
|
---|
1158 | #define USE_DEFAULTMSB 0
|
---|
1159 | #define USE_DEFAULTLSB 0
|
---|
1160 |
|
---|
1161 | #define START_UNIT_CODE 0x01
|
---|
1162 | #define STOP_UNIT_CODE 0x00
|
---|
1163 |
|
---|
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;
|
---|
1181 |
|
---|
1182 | #define SENSE_BUFFER_SIZE 18
|
---|
1183 |
|
---|
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
|
---|
1201 |
|
---|
1202 | /* Additional tape bit */
|
---|
1203 | #define SCSI_ILLEGAL_LENGTH 0x20
|
---|
1204 | #define SCSI_EOM 0x40
|
---|
1205 | #define SCSI_FILE_MARK 0x80
|
---|
1206 |
|
---|
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
|
---|
1236 |
|
---|
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
|
---|
1248 |
|
---|
1249 |
|
---|
1250 | #define FILE_DEVICE_SCSI 0x0000001b
|
---|
1251 |
|
---|
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)
|
---|
1255 |
|
---|
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)
|
---|
1270 |
|
---|
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)
|
---|
1274 |
|
---|
1275 | /* READ_TOC formats */
|
---|
1276 | #define READ_TOC_FORMAT_TOC 0x00
|
---|
1277 | #define READ_TOC_FORMAT_SESSION 0x01
|
---|
1278 | #define READ_TOC_FORMAT_FULL_TOC 0x02
|
---|
1279 | #define READ_TOC_FORMAT_PMA 0x03
|
---|
1280 | #define READ_TOC_FORMAT_ATIP 0x04
|
---|
1281 |
|
---|
1282 | /* Read Capacity Data. Returned in Big Endian format */
|
---|
1283 | typedef struct _READ_CAPACITY_DATA {
|
---|
1284 | ULONG LogicalBlockAddress;
|
---|
1285 | ULONG BytesPerBlock;
|
---|
1286 | } READ_CAPACITY_DATA, *PREAD_CAPACITY_DATA;
|
---|
1287 |
|
---|
1288 | /* Read Block Limits Data. Returned in Big Endian format */
|
---|
1289 | typedef struct _READ_BLOCK_LIMITS {
|
---|
1290 | UCHAR Reserved;
|
---|
1291 | UCHAR BlockMaximumSize[3];
|
---|
1292 | UCHAR BlockMinimumSize[2];
|
---|
1293 | } READ_BLOCK_LIMITS_DATA, *PREAD_BLOCK_LIMITS_DATA;
|
---|
1294 |
|
---|
1295 |
|
---|
1296 | typedef struct _MODE_PARAMETER_HEADER {
|
---|
1297 | UCHAR ModeDataLength;
|
---|
1298 | UCHAR MediumType;
|
---|
1299 | UCHAR DeviceSpecificParameter;
|
---|
1300 | UCHAR BlockDescriptorLength;
|
---|
1301 | }MODE_PARAMETER_HEADER, *PMODE_PARAMETER_HEADER;
|
---|
1302 |
|
---|
1303 | typedef struct _MODE_PARAMETER_HEADER10 {
|
---|
1304 | UCHAR ModeDataLength[2];
|
---|
1305 | UCHAR MediumType;
|
---|
1306 | UCHAR DeviceSpecificParameter;
|
---|
1307 | UCHAR Reserved[2];
|
---|
1308 | UCHAR BlockDescriptorLength[2];
|
---|
1309 | } MODE_PARAMETER_HEADER10, *PMODE_PARAMETER_HEADER10;
|
---|
1310 |
|
---|
1311 | #define MODE_FD_SINGLE_SIDE 0x01
|
---|
1312 | #define MODE_FD_DOUBLE_SIDE 0x02
|
---|
1313 | #define MODE_FD_MAXIMUM_TYPE 0x1E
|
---|
1314 | #define MODE_DSP_FUA_SUPPORTED 0x10
|
---|
1315 | #define MODE_DSP_WRITE_PROTECT 0x80
|
---|
1316 |
|
---|
1317 | typedef struct _MODE_PARAMETER_BLOCK {
|
---|
1318 | UCHAR DensityCode;
|
---|
1319 | UCHAR NumberOfBlocks[3];
|
---|
1320 | UCHAR Reserved;
|
---|
1321 | UCHAR BlockLength[3];
|
---|
1322 | } MODE_PARAMETER_BLOCK, *PMODE_PARAMETER_BLOCK;
|
---|
1323 |
|
---|
1324 | typedef struct _MODE_DISCONNECT_PAGE {
|
---|
1325 | UCHAR PageCode : 6;
|
---|
1326 | UCHAR Reserved : 1;
|
---|
1327 | UCHAR PageSavable : 1;
|
---|
1328 | UCHAR PageLength;
|
---|
1329 | UCHAR BufferFullRatio;
|
---|
1330 | UCHAR BufferEmptyRatio;
|
---|
1331 | UCHAR BusInactivityLimit[2];
|
---|
1332 | UCHAR BusDisconnectTime[2];
|
---|
1333 | UCHAR BusConnectTime[2];
|
---|
1334 | UCHAR MaximumBurstSize[2];
|
---|
1335 | UCHAR DataTransferDisconnect : 2;
|
---|
1336 | UCHAR Reserved2[3];
|
---|
1337 | }MODE_DISCONNECT_PAGE, *PMODE_DISCONNECT_PAGE;
|
---|
1338 |
|
---|
1339 | typedef struct _MODE_CACHING_PAGE {
|
---|
1340 | UCHAR PageCode : 6;
|
---|
1341 | UCHAR Reserved : 1;
|
---|
1342 | UCHAR PageSavable : 1;
|
---|
1343 | UCHAR PageLength;
|
---|
1344 | UCHAR ReadDisableCache : 1;
|
---|
1345 | UCHAR MultiplicationFactor : 1;
|
---|
1346 | UCHAR WriteCacheEnable : 1;
|
---|
1347 | UCHAR Reserved2 : 5;
|
---|
1348 | UCHAR WriteRetensionPriority : 4;
|
---|
1349 | UCHAR ReadRetensionPriority : 4;
|
---|
1350 | UCHAR DisablePrefetchTransfer[2];
|
---|
1351 | UCHAR MinimumPrefetch[2];
|
---|
1352 | UCHAR MaximumPrefetch[2];
|
---|
1353 | UCHAR MaximumPrefetchCeiling[2];
|
---|
1354 | }MODE_CACHING_PAGE, *PMODE_CACHING_PAGE;
|
---|
1355 |
|
---|
1356 | typedef struct _MODE_CDROM_WRITE_PARAMETERS_PAGE {
|
---|
1357 | UCHAR PageLength;
|
---|
1358 | UCHAR WriteType : 4;
|
---|
1359 | UCHAR TestWrite : 1;
|
---|
1360 | UCHAR LinkSizeValid : 1;
|
---|
1361 | UCHAR BufferUnderrunFreeEnabled : 1;
|
---|
1362 | UCHAR Reserved2 : 1;
|
---|
1363 | UCHAR TrackMode : 4;
|
---|
1364 | UCHAR Copy : 1;
|
---|
1365 | UCHAR FixedPacket : 1;
|
---|
1366 | UCHAR MultiSession : 2;
|
---|
1367 | UCHAR DataBlockType : 4;
|
---|
1368 | UCHAR Reserved3 : 4;
|
---|
1369 | UCHAR LinkSize;
|
---|
1370 | UCHAR Reserved4;
|
---|
1371 | UCHAR HostApplicationCode : 6;
|
---|
1372 | UCHAR Reserved5 : 2;
|
---|
1373 | UCHAR SessionFormat;
|
---|
1374 | UCHAR Reserved6;
|
---|
1375 | UCHAR PacketSize[4];
|
---|
1376 | UCHAR AudioPauseLength[2];
|
---|
1377 | UCHAR Reserved7 : 7;
|
---|
1378 | UCHAR MediaCatalogNumberValid : 1;
|
---|
1379 | UCHAR MediaCatalogNumber[13];
|
---|
1380 | UCHAR MediaCatalogNumberZero;
|
---|
1381 | UCHAR MediaCatalogNumberAFrame;
|
---|
1382 | UCHAR Reserved8 : 7;
|
---|
1383 | UCHAR ISRCValid : 1;
|
---|
1384 | UCHAR ISRCCountry[2];
|
---|
1385 | UCHAR ISRCOwner[3];
|
---|
1386 | UCHAR ISRCRecordingYear[2];
|
---|
1387 | UCHAR ISRCSerialNumber[5];
|
---|
1388 | UCHAR ISRCZero;
|
---|
1389 | UCHAR ISRCAFrame;
|
---|
1390 | UCHAR ISRCReserved;
|
---|
1391 | UCHAR SubHeaderData[4];
|
---|
1392 | } MODE_CDROM_WRITE_PARAMETERS_PAGE, *PMODE_CDROM_WRITE_PARAMETERS_PAGE;
|
---|
1393 |
|
---|
1394 | typedef struct _MODE_FLEXIBLE_DISK_PAGE {
|
---|
1395 | UCHAR PageCode : 6;
|
---|
1396 | UCHAR Reserved : 1;
|
---|
1397 | UCHAR PageSavable : 1;
|
---|
1398 | UCHAR PageLength;
|
---|
1399 | UCHAR TransferRate[2];
|
---|
1400 | UCHAR NumberOfHeads;
|
---|
1401 | UCHAR SectorsPerTrack;
|
---|
1402 | UCHAR BytesPerSector[2];
|
---|
1403 | UCHAR NumberOfCylinders[2];
|
---|
1404 | UCHAR StartWritePrecom[2];
|
---|
1405 | UCHAR StartReducedCurrent[2];
|
---|
1406 | UCHAR StepRate[2];
|
---|
1407 | UCHAR StepPluseWidth;
|
---|
1408 | UCHAR HeadSettleDelay[2];
|
---|
1409 | UCHAR MotorOnDelay;
|
---|
1410 | UCHAR MotorOffDelay;
|
---|
1411 | UCHAR Reserved2 : 5;
|
---|
1412 | UCHAR MotorOnAsserted : 1;
|
---|
1413 | UCHAR StartSectorNumber : 1;
|
---|
1414 | UCHAR TrueReadySignal : 1;
|
---|
1415 | UCHAR StepPlusePerCyclynder : 4;
|
---|
1416 | UCHAR Reserved3 : 4;
|
---|
1417 | UCHAR WriteCompenstation;
|
---|
1418 | UCHAR HeadLoadDelay;
|
---|
1419 | UCHAR HeadUnloadDelay;
|
---|
1420 | UCHAR Pin2Usage : 4;
|
---|
1421 | UCHAR Pin34Usage : 4;
|
---|
1422 | UCHAR Pin1Usage : 4;
|
---|
1423 | UCHAR Pin4Usage : 4;
|
---|
1424 | UCHAR MediumRotationRate[2];
|
---|
1425 | UCHAR Reserved4[2];
|
---|
1426 | } MODE_FLEXIBLE_DISK_PAGE, *PMODE_FLEXIBLE_DISK_PAGE;
|
---|
1427 |
|
---|
1428 | typedef struct _MODE_FORMAT_PAGE {
|
---|
1429 | UCHAR PageCode : 6;
|
---|
1430 | UCHAR Reserved : 1;
|
---|
1431 | UCHAR PageSavable : 1;
|
---|
1432 | UCHAR PageLength;
|
---|
1433 | UCHAR TracksPerZone[2];
|
---|
1434 | UCHAR AlternateSectorsPerZone[2];
|
---|
1435 | UCHAR AlternateTracksPerZone[2];
|
---|
1436 | UCHAR AlternateTracksPerLogicalUnit[2];
|
---|
1437 | UCHAR SectorsPerTrack[2];
|
---|
1438 | UCHAR BytesPerPhysicalSector[2];
|
---|
1439 | UCHAR Interleave[2];
|
---|
1440 | UCHAR TrackSkewFactor[2];
|
---|
1441 | UCHAR CylinderSkewFactor[2];
|
---|
1442 | UCHAR Reserved2 : 4;
|
---|
1443 | UCHAR SurfaceFirst : 1;
|
---|
1444 | UCHAR RemovableMedia : 1;
|
---|
1445 | UCHAR HardSectorFormating : 1;
|
---|
1446 | UCHAR SoftSectorFormating : 1;
|
---|
1447 | UCHAR Reserved3[3];
|
---|
1448 | } MODE_FORMAT_PAGE, *PMODE_FORMAT_PAGE;
|
---|
1449 |
|
---|
1450 | typedef struct _MODE_RIGID_GEOMETRY_PAGE {
|
---|
1451 | UCHAR PageCode : 6;
|
---|
1452 | UCHAR Reserved : 1;
|
---|
1453 | UCHAR PageSavable : 1;
|
---|
1454 | UCHAR PageLength;
|
---|
1455 | UCHAR NumberOfCylinders[3];
|
---|
1456 | UCHAR NumberOfHeads;
|
---|
1457 | UCHAR StartWritePrecom[3];
|
---|
1458 | UCHAR StartReducedCurrent[3];
|
---|
1459 | UCHAR DriveStepRate[2];
|
---|
1460 | UCHAR LandZoneCyclinder[3];
|
---|
1461 | UCHAR RotationalPositionLock : 2;
|
---|
1462 | UCHAR Reserved2 : 6;
|
---|
1463 | UCHAR RotationOffset;
|
---|
1464 | UCHAR Reserved3;
|
---|
1465 | UCHAR RoataionRate[2];
|
---|
1466 | UCHAR Reserved4[2];
|
---|
1467 | } MODE_RIGID_GEOMETRY_PAGE, *PMODE_RIGID_GEOMETRY_PAGE;
|
---|
1468 |
|
---|
1469 | typedef struct _MODE_READ_WRITE_RECOVERY_PAGE {
|
---|
1470 | UCHAR PageCode : 6;
|
---|
1471 | UCHAR Reserved1 : 1;
|
---|
1472 | UCHAR PSBit : 1;
|
---|
1473 | UCHAR PageLength;
|
---|
1474 | UCHAR DCRBit : 1;
|
---|
1475 | UCHAR DTEBit : 1;
|
---|
1476 | UCHAR PERBit : 1;
|
---|
1477 | UCHAR EERBit : 1;
|
---|
1478 | UCHAR RCBit : 1;
|
---|
1479 | UCHAR TBBit : 1;
|
---|
1480 | UCHAR ARRE : 1;
|
---|
1481 | UCHAR AWRE : 1;
|
---|
1482 | UCHAR ReadRetryCount;
|
---|
1483 | UCHAR Reserved4[4];
|
---|
1484 | UCHAR WriteRetryCount;
|
---|
1485 | UCHAR Reserved5[3];
|
---|
1486 | } MODE_READ_WRITE_RECOVERY_PAGE, *PMODE_READ_WRITE_RECOVERY_PAGE;
|
---|
1487 |
|
---|
1488 | typedef struct _MODE_READ_RECOVERY_PAGE {
|
---|
1489 | UCHAR PageCode : 6;
|
---|
1490 | UCHAR Reserved1 : 1;
|
---|
1491 | UCHAR PSBit : 1;
|
---|
1492 | UCHAR PageLength;
|
---|
1493 | UCHAR DCRBit : 1;
|
---|
1494 | UCHAR DTEBit : 1;
|
---|
1495 | UCHAR PERBit : 1;
|
---|
1496 | UCHAR Reserved2 : 1;
|
---|
1497 | UCHAR RCBit : 1;
|
---|
1498 | UCHAR TBBit : 1;
|
---|
1499 | UCHAR Reserved3 : 2;
|
---|
1500 | UCHAR ReadRetryCount;
|
---|
1501 | UCHAR Reserved4[4];
|
---|
1502 | } MODE_READ_RECOVERY_PAGE, *PMODE_READ_RECOVERY_PAGE;
|
---|
1503 |
|
---|
1504 | typedef struct _MODE_INFO_EXCEPTIONS {
|
---|
1505 | UCHAR PageCode : 6;
|
---|
1506 | UCHAR Reserved1 : 1;
|
---|
1507 | UCHAR PSBit : 1;
|
---|
1508 | UCHAR PageLength;
|
---|
1509 | _ANONYMOUS_UNION union {
|
---|
1510 | UCHAR Flags;
|
---|
1511 | _ANONYMOUS_STRUCT struct {
|
---|
1512 | UCHAR LogErr : 1;
|
---|
1513 | UCHAR Reserved2 : 1;
|
---|
1514 | UCHAR Test : 1;
|
---|
1515 | UCHAR Dexcpt : 1;
|
---|
1516 | UCHAR Reserved3 : 3;
|
---|
1517 | UCHAR Perf : 1;
|
---|
1518 | } DUMMYSTRUCTNAME;
|
---|
1519 | } DUMMYUNIONNAME;
|
---|
1520 | UCHAR ReportMethod : 4;
|
---|
1521 | UCHAR Reserved4 : 4;
|
---|
1522 | UCHAR IntervalTimer[4];
|
---|
1523 | UCHAR ReportCount[4];
|
---|
1524 | } MODE_INFO_EXCEPTIONS, *PMODE_INFO_EXCEPTIONS;
|
---|
1525 |
|
---|
1526 | /* CDROM audio control */
|
---|
1527 | #define CDB_AUDIO_PAUSE 0x00
|
---|
1528 | #define CDB_AUDIO_RESUME 0x01
|
---|
1529 | #define CDB_DEVICE_START 0x11
|
---|
1530 | #define CDB_DEVICE_STOP 0x10
|
---|
1531 | #define CDB_EJECT_MEDIA 0x10
|
---|
1532 | #define CDB_LOAD_MEDIA 0x01
|
---|
1533 | #define CDB_SUBCHANNEL_HEADER 0x00
|
---|
1534 | #define CDB_SUBCHANNEL_BLOCK 0x01
|
---|
1535 |
|
---|
1536 | #define CDROM_AUDIO_CONTROL_PAGE 0x0E
|
---|
1537 | #define MODE_SELECT_IMMEDIATE 0x04
|
---|
1538 | #define MODE_SELECT_PFBIT 0x10
|
---|
1539 |
|
---|
1540 | #define CDB_USE_MSF 0x01
|
---|
1541 |
|
---|
1542 | typedef struct _PORT_OUTPUT {
|
---|
1543 | UCHAR ChannelSelection;
|
---|
1544 | UCHAR Volume;
|
---|
1545 | } PORT_OUTPUT, *PPORT_OUTPUT;
|
---|
1546 |
|
---|
1547 | typedef struct _AUDIO_OUTPUT {
|
---|
1548 | UCHAR CodePage;
|
---|
1549 | UCHAR ParameterLength;
|
---|
1550 | UCHAR Immediate;
|
---|
1551 | UCHAR Reserved[2];
|
---|
1552 | UCHAR LbaFormat;
|
---|
1553 | UCHAR LogicalBlocksPerSecond[2];
|
---|
1554 | PORT_OUTPUT PortOutput[4];
|
---|
1555 | } AUDIO_OUTPUT, *PAUDIO_OUTPUT;
|
---|
1556 |
|
---|
1557 | /* Multisession CDROMs */
|
---|
1558 | #define GET_LAST_SESSION 0x01
|
---|
1559 | #define GET_SESSION_DATA 0x02;
|
---|
1560 |
|
---|
1561 | /* Atapi 2.5 changers */
|
---|
1562 | typedef struct _MECHANICAL_STATUS_INFORMATION_HEADER {
|
---|
1563 | UCHAR CurrentSlot : 5;
|
---|
1564 | UCHAR ChangerState : 2;
|
---|
1565 | UCHAR Fault : 1;
|
---|
1566 | UCHAR Reserved : 5;
|
---|
1567 | UCHAR MechanismState : 3;
|
---|
1568 | UCHAR CurrentLogicalBlockAddress[3];
|
---|
1569 | UCHAR NumberAvailableSlots;
|
---|
1570 | UCHAR SlotTableLength[2];
|
---|
1571 | } MECHANICAL_STATUS_INFORMATION_HEADER, *PMECHANICAL_STATUS_INFORMATION_HEADER;
|
---|
1572 |
|
---|
1573 | typedef struct _SLOT_TABLE_INFORMATION {
|
---|
1574 | UCHAR DiscChanged : 1;
|
---|
1575 | UCHAR Reserved : 6;
|
---|
1576 | UCHAR DiscPresent : 1;
|
---|
1577 | UCHAR Reserved2[3];
|
---|
1578 | } SLOT_TABLE_INFORMATION, *PSLOT_TABLE_INFORMATION;
|
---|
1579 |
|
---|
1580 | typedef struct _MECHANICAL_STATUS {
|
---|
1581 | MECHANICAL_STATUS_INFORMATION_HEADER MechanicalStatusHeader;
|
---|
1582 | SLOT_TABLE_INFORMATION SlotTableInfo[1];
|
---|
1583 | } MECHANICAL_STATUS, *PMECHANICAL_STATUS;
|
---|
1584 |
|
---|
1585 |
|
---|
1586 | /* Tape definitions */
|
---|
1587 | typedef struct _TAPE_POSITION_DATA {
|
---|
1588 | UCHAR Reserved1 : 2;
|
---|
1589 | UCHAR BlockPositionUnsupported : 1;
|
---|
1590 | UCHAR Reserved2 : 3;
|
---|
1591 | UCHAR EndOfPartition : 1;
|
---|
1592 | UCHAR BeginningOfPartition : 1;
|
---|
1593 | UCHAR PartitionNumber;
|
---|
1594 | USHORT Reserved3;
|
---|
1595 | UCHAR FirstBlock[4];
|
---|
1596 | UCHAR LastBlock[4];
|
---|
1597 | UCHAR Reserved4;
|
---|
1598 | UCHAR NumberOfBlocks[3];
|
---|
1599 | UCHAR NumberOfBytes[4];
|
---|
1600 | } TAPE_POSITION_DATA, *PTAPE_POSITION_DATA;
|
---|
1601 |
|
---|
1602 | /* This structure is used to convert little endian ULONGs
|
---|
1603 | to SCSI CDB big endians values. */
|
---|
1604 | typedef union _EIGHT_BYTE {
|
---|
1605 | _ANONYMOUS_STRUCT struct {
|
---|
1606 | UCHAR Byte0;
|
---|
1607 | UCHAR Byte1;
|
---|
1608 | UCHAR Byte2;
|
---|
1609 | UCHAR Byte3;
|
---|
1610 | UCHAR Byte4;
|
---|
1611 | UCHAR Byte5;
|
---|
1612 | UCHAR Byte6;
|
---|
1613 | UCHAR Byte7;
|
---|
1614 | } DUMMYSTRUCTNAME;
|
---|
1615 | ULONGLONG AsULongLong;
|
---|
1616 | } EIGHT_BYTE, *PEIGHT_BYTE;
|
---|
1617 |
|
---|
1618 | typedef union _FOUR_BYTE {
|
---|
1619 | _ANONYMOUS_STRUCT struct {
|
---|
1620 | UCHAR Byte0;
|
---|
1621 | UCHAR Byte1;
|
---|
1622 | UCHAR Byte2;
|
---|
1623 | UCHAR Byte3;
|
---|
1624 | } DUMMYSTRUCTNAME;
|
---|
1625 | ULONG AsULong;
|
---|
1626 | } FOUR_BYTE, *PFOUR_BYTE;
|
---|
1627 |
|
---|
1628 | typedef union _TWO_BYTE {
|
---|
1629 | _ANONYMOUS_STRUCT struct {
|
---|
1630 | UCHAR Byte0;
|
---|
1631 | UCHAR Byte1;
|
---|
1632 | } DUMMYSTRUCTNAME;
|
---|
1633 | USHORT AsUShort;
|
---|
1634 | } TWO_BYTE, *PTWO_BYTE;
|
---|
1635 |
|
---|
1636 | /* Byte reversing macro for converting between
|
---|
1637 | big- and little-endian formats */
|
---|
1638 | #define REVERSE_BYTES_QUAD(Destination, Source) { \
|
---|
1639 | PEIGHT_BYTE _val1 = (PEIGHT_BYTE)(Destination); \
|
---|
1640 | PEIGHT_BYTE _val2 = (PEIGHT_BYTE)(Source); \
|
---|
1641 | _val1->Byte7 = _val2->Byte0; \
|
---|
1642 | _val1->Byte6 = _val2->Byte1; \
|
---|
1643 | _val1->Byte5 = _val2->Byte2; \
|
---|
1644 | _val1->Byte4 = _val2->Byte3; \
|
---|
1645 | _val1->Byte3 = _val2->Byte4; \
|
---|
1646 | _val1->Byte2 = _val2->Byte5; \
|
---|
1647 | _val1->Byte1 = _val2->Byte6; \
|
---|
1648 | _val1->Byte0 = _val2->Byte7; \
|
---|
1649 | }
|
---|
1650 |
|
---|
1651 | #define REVERSE_BYTES(Destination, Source) { \
|
---|
1652 | PFOUR_BYTE _val1 = (PFOUR_BYTE)(Destination); \
|
---|
1653 | PFOUR_BYTE _val2 = (PFOUR_BYTE)(Source); \
|
---|
1654 | _val1->Byte3 = _val2->Byte0; \
|
---|
1655 | _val1->Byte2 = _val2->Byte1; \
|
---|
1656 | _val1->Byte1 = _val2->Byte2; \
|
---|
1657 | _val1->Byte0 = _val2->Byte3; \
|
---|
1658 | }
|
---|
1659 |
|
---|
1660 | #define REVERSE_BYTES_SHORT(Destination, Source) { \
|
---|
1661 | PTWO_BYTE _val1 = (PTWO_BYTE)(Destination); \
|
---|
1662 | PTWO_BYTE _val2 = (PTWO_BYTE)(Source); \
|
---|
1663 | _val1->Byte1 = _val2->Byte0; \
|
---|
1664 | _val1->Byte0 = _val2->Byte1; \
|
---|
1665 | }
|
---|
1666 |
|
---|
1667 | #define REVERSE_SHORT(Short) { \
|
---|
1668 | UCHAR _val; \
|
---|
1669 | PTWO_BYTE _val2 = (PTWO_BYTE)(Short); \
|
---|
1670 | _val = _val2->Byte0; \
|
---|
1671 | _val2->Byte0 = _val2->Byte1; \
|
---|
1672 | _val2->Byte1 = _val; \
|
---|
1673 | }
|
---|
1674 |
|
---|
1675 | #define REVERSE_LONG(Long) { \
|
---|
1676 | UCHAR _val; \
|
---|
1677 | PFOUR_BYTE _val2 = (PFOUR_BYTE)(Long); \
|
---|
1678 | _val = _val2->Byte3; \
|
---|
1679 | _val2->Byte3 = _val2->Byte0; \
|
---|
1680 | _val2->Byte0 = _val; \
|
---|
1681 | _val = _val2->Byte2; \
|
---|
1682 | _val2->Byte2 = _val2->Byte1; \
|
---|
1683 | _val2->Byte1 = _val; \
|
---|
1684 | }
|
---|
1685 |
|
---|
1686 | #define WHICH_BIT(Data, Bit) { \
|
---|
1687 | UCHAR _val; \
|
---|
1688 | for (_val = 0; _val < 32; _val++) { \
|
---|
1689 | if (((Data) >> _val) == 1) { \
|
---|
1690 | break; \
|
---|
1691 | } \
|
---|
1692 | } \
|
---|
1693 | ASSERT(_val != 32); \
|
---|
1694 | (Bit) = _val; \
|
---|
1695 | }
|
---|
1696 |
|
---|
1697 | #ifdef __cplusplus
|
---|
1698 | }
|
---|
1699 | #endif
|
---|
1700 |
|
---|
1701 | #endif /* __SCSI_H */
|
---|