/[pcsx2_0.9.7]/trunk/plugins/CDVDpeops/scsidefs.h
ViewVC logotype

Contents of /trunk/plugins/CDVDpeops/scsidefs.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 31 - (show annotations) (download)
Tue Sep 7 03:24:11 2010 UTC (9 years, 11 months ago) by william
File MIME type: text/plain
File size: 24076 byte(s)
committing r3113 initial commit again...
1 //***************************************************************************
2 //
3 // Name: SCSIDEFS.H
4 //
5 // Description: SCSI definitions ('C' Language)
6 //
7 //***************************************************************************
8
9 //***************************************************************************
10 // %%% TARGET STATUS VALUES %%%
11 //***************************************************************************
12 #define STATUS_GOOD 0x00 // Status Good
13 #define STATUS_CHKCOND 0x02 // Check Condition
14 #define STATUS_CONDMET 0x04 // Condition Met
15 #define STATUS_BUSY 0x08 // Busy
16 #define STATUS_INTERM 0x10 // Intermediate
17 #define STATUS_INTCDMET 0x14 // Intermediate-condition met
18 #define STATUS_RESCONF 0x18 // Reservation conflict
19 #define STATUS_COMTERM 0x22 // Command Terminated
20 #define STATUS_QFULL 0x28 // Queue full
21
22 //***************************************************************************
23 // %%% SCSI MISCELLANEOUS EQUATES %%%
24 //***************************************************************************
25 #define MAXLUN 7 // Maximum Logical Unit Id
26 #define MAXTARG 7 // Maximum Target Id
27 #define MAX_SCSI_LUNS 64 // Maximum Number of SCSI LUNs
28 #define MAX_NUM_HA 8 // Maximum Number of SCSI HA's
29
30 //\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
31 //
32 // %%% SCSI COMMAND OPCODES %%%
33 //
34 ///\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
35
36 //***************************************************************************
37 // %%% Commands for all Device Types %%%
38 //***************************************************************************
39 #define SCSI_CHANGE_DEF 0x40 // Change Definition (Optional)
40 #define SCSI_COMPARE 0x39 // Compare (O)
41 #define SCSI_COPY 0x18 // Copy (O)
42 #define SCSI_COP_VERIFY 0x3A // Copy and Verify (O)
43 #define SCSI_INQUIRY 0x12 // Inquiry (MANDATORY)
44 #define SCSI_LOG_SELECT 0x4C // Log Select (O)
45 #define SCSI_LOG_SENSE 0x4D // Log Sense (O)
46 #define SCSI_MODE_SEL6 0x15 // Mode Select 6-byte (Device Specific)
47 #define SCSI_MODE_SEL10 0x55 // Mode Select 10-byte (Device Specific)
48 #define SCSI_MODE_SEN6 0x1A // Mode Sense 6-byte (Device Specific)
49 #define SCSI_MODE_SEN10 0x5A // Mode Sense 10-byte (Device Specific)
50 #define SCSI_READ_BUFF 0x3C // Read Buffer (O)
51 #define SCSI_REQ_SENSE 0x03 // Request Sense (MANDATORY)
52 #define SCSI_SEND_DIAG 0x1D // Send Diagnostic (O)
53 #define SCSI_TST_U_RDY 0x00 // Test Unit Ready (MANDATORY)
54 #define SCSI_WRITE_BUFF 0x3B // Write Buffer (O)
55
56 //***************************************************************************
57 // %%% Commands Unique to Direct Access Devices %%%
58 //***************************************************************************
59 #define SCSI_COMPARE 0x39 // Compare (O)
60 #define SCSI_FORMAT 0x04 // Format Unit (MANDATORY)
61 #define SCSI_LCK_UN_CAC 0x36 // Lock Unlock Cache (O)
62 #define SCSI_PREFETCH 0x34 // Prefetch (O)
63 #define SCSI_MED_REMOVL 0x1E // Prevent/Allow medium Removal (O)
64 #define SCSI_READ6 0x08 // Read 6-byte (MANDATORY)
65 #define SCSI_READ10 0x28 // Read 10-byte (MANDATORY)
66 #define SCSI_RD_CAPAC 0x25 // Read Capacity (MANDATORY)
67 #define SCSI_RD_DEFECT 0x37 // Read Defect Data (O)
68 #define SCSI_READ_LONG 0x3E // Read Long (O)
69 #define SCSI_REASS_BLK 0x07 // Reassign Blocks (O)
70 #define SCSI_RCV_DIAG 0x1C // Receive Diagnostic Results (O)
71 #define SCSI_RELEASE 0x17 // Release Unit (MANDATORY)
72 #define SCSI_REZERO 0x01 // Rezero Unit (O)
73 #define SCSI_SRCH_DAT_E 0x31 // Search Data Equal (O)
74 #define SCSI_SRCH_DAT_H 0x30 // Search Data High (O)
75 #define SCSI_SRCH_DAT_L 0x32 // Search Data Low (O)
76 #define SCSI_SEEK6 0x0B // Seek 6-Byte (O)
77 #define SCSI_SEEK10 0x2B // Seek 10-Byte (O)
78 #define SCSI_SEND_DIAG 0x1D // Send Diagnostics (MANDATORY)
79 #define SCSI_SET_LIMIT 0x33 // Set Limits (O)
80 #define SCSI_START_STP 0x1B // Start/Stop Unit (O)
81 #define SCSI_SYNC_CACHE 0x35 // Synchronize Cache (O)
82 #define SCSI_VERIFY 0x2F // Verify (O)
83 #define SCSI_WRITE6 0x0A // Write 6-Byte (MANDATORY)
84 #define SCSI_WRITE10 0x2A // Write 10-Byte (MANDATORY)
85 #define SCSI_WRT_VERIFY 0x2E // Write and Verify (O)
86 #define SCSI_WRITE_LONG 0x3F // Write Long (O)
87 #define SCSI_WRITE_SAME 0x41 // Write Same (O)
88
89 //***************************************************************************
90 // %%% Commands Unique to Sequential Access Devices %%%
91 //***************************************************************************
92 #define SCSI_ERASE 0x19 // Erase (MANDATORY)
93 #define SCSI_LOAD_UN 0x1B // Load/Unload (O)
94 #define SCSI_LOCATE 0x2B // Locate (O)
95 #define SCSI_RD_BLK_LIM 0x05 // Read Block Limits (MANDATORY)
96 #define SCSI_READ_POS 0x34 // Read Position (O)
97 #define SCSI_READ_REV 0x0F // Read Reverse (O)
98 #define SCSI_REC_BF_DAT 0x14 // Recover Buffer Data (O)
99 #define SCSI_RESERVE 0x16 // Reserve Unit (MANDATORY)
100 #define SCSI_REWIND 0x01 // Rewind (MANDATORY)
101 #define SCSI_SPACE 0x11 // Space (MANDATORY)
102 #define SCSI_VERIFY_T 0x13 // Verify (Tape) (O)
103 #define SCSI_WRT_FILE 0x10 // Write Filemarks (MANDATORY)
104
105 //***************************************************************************
106 // %%% Commands Unique to Printer Devices %%%
107 //***************************************************************************
108 #define SCSI_PRINT 0x0A // Print (MANDATORY)
109 #define SCSI_SLEW_PNT 0x0B // Slew and Print (O)
110 #define SCSI_STOP_PNT 0x1B // Stop Print (O)
111 #define SCSI_SYNC_BUFF 0x10 // Synchronize Buffer (O)
112
113 //***************************************************************************
114 // %%% Commands Unique to Processor Devices %%%
115 //***************************************************************************
116 #define SCSI_RECEIVE 0x08 // Receive (O)
117 #define SCSI_SEND 0x0A // Send (O)
118
119 //***************************************************************************
120 // %%% Commands Unique to Write-Once Devices %%%
121 //***************************************************************************
122 #define SCSI_MEDIUM_SCN 0x38 // Medium Scan (O)
123 #define SCSI_SRCHDATE10 0x31 // Search Data Equal 10-Byte (O)
124 #define SCSI_SRCHDATE12 0xB1 // Search Data Equal 12-Byte (O)
125 #define SCSI_SRCHDATH10 0x30 // Search Data High 10-Byte (O)
126 #define SCSI_SRCHDATH12 0xB0 // Search Data High 12-Byte (O)
127 #define SCSI_SRCHDATL10 0x32 // Search Data Low 10-Byte (O)
128 #define SCSI_SRCHDATL12 0xB2 // Search Data Low 12-Byte (O)
129 #define SCSI_SET_LIM_10 0x33 // Set Limits 10-Byte (O)
130 #define SCSI_SET_LIM_12 0xB3 // Set Limits 10-Byte (O)
131 #define SCSI_VERIFY10 0x2F // Verify 10-Byte (O)
132 #define SCSI_VERIFY12 0xAF // Verify 12-Byte (O)
133 #define SCSI_WRITE12 0xAA // Write 12-Byte (O)
134 #define SCSI_WRT_VER10 0x2E // Write and Verify 10-Byte (O)
135 #define SCSI_WRT_VER12 0xAE // Write and Verify 12-Byte (O)
136
137 //***************************************************************************
138 // %%% Commands Unique to CD-ROM Devices %%%
139 //***************************************************************************
140 #define SCSI_PLAYAUD_10 0x45 // Play Audio 10-Byte (O)
141 #define SCSI_PLAYAUD_12 0xA5 // Play Audio 12-Byte 12-Byte (O)
142 #define SCSI_PLAYAUDMSF 0x47 // Play Audio MSF (O)
143 #define SCSI_PLAYA_TKIN 0x48 // Play Audio Track/Index (O)
144 #define SCSI_PLYTKREL10 0x49 // Play Track Relative 10-Byte (O)
145 #define SCSI_PLYTKREL12 0xA9 // Play Track Relative 12-Byte (O)
146 #define SCSI_READCDCAP 0x25 // Read CD-ROM Capacity (MANDATORY)
147 #define SCSI_READHEADER 0x44 // Read Header (O)
148 #define SCSI_SUBCHANNEL 0x42 // Read Subchannel (O)
149 #define SCSI_READ_TOC 0x43 // Read TOC (O)
150
151 //***************************************************************************
152 // %%% Commands Unique to Scanner Devices %%%
153 //***************************************************************************
154 #define SCSI_GETDBSTAT 0x34 // Get Data Buffer Status (O)
155 #define SCSI_GETWINDOW 0x25 // Get Window (O)
156 #define SCSI_OBJECTPOS 0x31 // Object Postion (O)
157 #define SCSI_SCAN 0x1B // Scan (O)
158 #define SCSI_SETWINDOW 0x24 // Set Window (MANDATORY)
159
160 //***************************************************************************
161 // %%% Commands Unique to Optical Memory Devices %%%
162 //***************************************************************************
163 #define SCSI_UpdateBlk 0x3D // Update Block (O)
164
165 //***************************************************************************
166 // %%% Commands Unique to Medium Changer Devices %%%
167 //***************************************************************************
168 #define SCSI_EXCHMEDIUM 0xA6 // Exchange Medium (O)
169 #define SCSI_INITELSTAT 0x07 // Initialize Element Status (O)
170 #define SCSI_POSTOELEM 0x2B // Position to Element (O)
171 #define SCSI_REQ_VE_ADD 0xB5 // Request Volume Element Address (O)
172 #define SCSI_SENDVOLTAG 0xB6 // Send Volume Tag (O)
173
174 //***************************************************************************
175 // %%% Commands Unique to Communication Devices %%%
176 //***************************************************************************
177 #define SCSI_GET_MSG_6 0x08 // Get Message 6-Byte (MANDATORY)
178 #define SCSI_GET_MSG_10 0x28 // Get Message 10-Byte (O)
179 #define SCSI_GET_MSG_12 0xA8 // Get Message 12-Byte (O)
180 #define SCSI_SND_MSG_6 0x0A // Send Message 6-Byte (MANDATORY)
181 #define SCSI_SND_MSG_10 0x2A // Send Message 10-Byte (O)
182 #define SCSI_SND_MSG_12 0xAA // Send Message 12-Byte (O)
183
184 //\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
185 //
186 // %%% END OF SCSI COMMAND OPCODES %%%
187 //
188 ///\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
189
190 //***************************************************************************
191 // %%% Request Sense Data Format %%%
192 //***************************************************************************
193 typedef struct {
194
195 BYTE ErrorCode; // Error Code (70H or 71H)
196 BYTE SegmentNum; // Number of current segment descriptor
197 BYTE SenseKey; // Sense Key(See bit definitions too)
198 BYTE InfoByte0; // Information MSB
199 BYTE InfoByte1; // Information MID
200 BYTE InfoByte2; // Information MID
201 BYTE InfoByte3; // Information LSB
202 BYTE AddSenLen; // Additional Sense Length
203 BYTE ComSpecInf0; // Command Specific Information MSB
204 BYTE ComSpecInf1; // Command Specific Information MID
205 BYTE ComSpecInf2; // Command Specific Information MID
206 BYTE ComSpecInf3; // Command Specific Information LSB
207 BYTE AddSenseCode; // Additional Sense Code
208 BYTE AddSenQual; // Additional Sense Code Qualifier
209 BYTE FieldRepUCode; // Field Replaceable Unit Code
210 BYTE SenKeySpec15; // Sense Key Specific 15th byte
211 BYTE SenKeySpec16; // Sense Key Specific 16th byte
212 BYTE SenKeySpec17; // Sense Key Specific 17th byte
213 BYTE AddSenseBytes; // Additional Sense Bytes
214
215 } SENSE_DATA_FMT;
216
217 //***************************************************************************
218 // %%% REQUEST SENSE ERROR CODE %%%
219 //***************************************************************************
220 #define SERROR_CURRENT 0x70 // Current Errors
221 #define SERROR_DEFERED 0x71 // Deferred Errors
222
223 //***************************************************************************
224 // %%% REQUEST SENSE BIT DEFINITIONS %%%
225 //***************************************************************************
226 #define SENSE_VALID 0x80 // Byte 0 Bit 7
227 #define SENSE_FILEMRK 0x80 // Byte 2 Bit 7
228 #define SENSE_EOM 0x40 // Byte 2 Bit 6
229 #define SENSE_ILI 0x20 // Byte 2 Bit 5
230
231 //***************************************************************************
232 // %%% REQUEST SENSE SENSE KEY DEFINITIONS %%%
233 //***************************************************************************
234 #define KEY_NOSENSE 0x00 // No Sense
235 #define KEY_RECERROR 0x01 // Recovered Error
236 #define KEY_NOTREADY 0x02 // Not Ready
237 #define KEY_MEDIUMERR 0x03 // Medium Error
238 #define KEY_HARDERROR 0x04 // Hardware Error
239 #define KEY_ILLGLREQ 0x05 // Illegal Request
240 #define KEY_UNITATT 0x06 // Unit Attention
241 #define KEY_DATAPROT 0x07 // Data Protect
242 #define KEY_BLANKCHK 0x08 // Blank Check
243 #define KEY_VENDSPEC 0x09 // Vendor Specific
244 #define KEY_COPYABORT 0x0A // Copy Abort
245 #define KEY_EQUAL 0x0C // Equal (Search)
246 #define KEY_VOLOVRFLW 0x0D // Volume Overflow
247 #define KEY_MISCOMP 0x0E // Miscompare (Search)
248 #define KEY_RESERVED 0x0F // Reserved
249
250 //***************************************************************************
251 // %%% PERIPHERAL DEVICE TYPE DEFINITIONS %%%
252 //***************************************************************************
253 #define DTYPE_DASD 0x00 // Disk Device
254 #define DTYPE_SEQD 0x01 // Tape Device
255 #define DTYPE_PRNT 0x02 // Printer
256 #define DTYPE_PROC 0x03 // Processor
257 #define DTYPE_WORM 0x04 // Write-once read-multiple
258 #define DTYPE_CROM 0x05 // CD-ROM device
259 #define DTYPE_CDROM 0x05 // CD-ROM device
260 #define DTYPE_SCAN 0x06 // Scanner device
261 #define DTYPE_OPTI 0x07 // Optical memory device
262 #define DTYPE_JUKE 0x08 // Medium Changer device
263 #define DTYPE_COMM 0x09 // Communications device
264 #define DTYPE_RESL 0x0A // Reserved (low)
265 #define DTYPE_RESH 0x1E // Reserved (high)
266 #define DTYPE_UNKNOWN 0x1F // Unknown or no device type
267
268 //***************************************************************************
269 // %%% ANSI APPROVED VERSION DEFINITIONS %%%
270 //***************************************************************************
271 #define ANSI_MAYBE 0x0 // Device may or may not be ANSI approved stand
272 #define ANSI_SCSI1 0x1 // Device complies to ANSI X3.131-1986 (SCSI-1)
273 #define ANSI_SCSI2 0x2 // Device complies to SCSI-2
274 #define ANSI_RESLO 0x3 // Reserved (low)
275 #define ANSI_RESHI 0x7 // Reserved (high)
276
277
278 ////////////////////////////////////////////////////////////////
279
280 typedef struct {
281 USHORT Length;
282 UCHAR ScsiStatus;
283 UCHAR PathId;
284 UCHAR TargetId;
285 UCHAR Lun;
286 UCHAR CdbLength;
287 UCHAR SenseInfoLength;
288 UCHAR DataIn;
289 ULONG DataTransferLength;
290 ULONG TimeOutValue;
291 ULONG DataBufferOffset;
292 ULONG SenseInfoOffset;
293 UCHAR Cdb[16];
294 } SCSI_PASS_THROUGH, *PSCSI_PASS_THROUGH;
295
296
297 typedef struct {
298 USHORT Length;
299 UCHAR ScsiStatus;
300 UCHAR PathId;
301 UCHAR TargetId;
302 UCHAR Lun;
303 UCHAR CdbLength;
304 UCHAR SenseInfoLength;
305 UCHAR DataIn;
306 ULONG DataTransferLength;
307 ULONG TimeOutValue;
308 PVOID DataBuffer;
309 ULONG SenseInfoOffset;
310 UCHAR Cdb[16];
311 } SCSI_PASS_THROUGH_DIRECT, *PSCSI_PASS_THROUGH_DIRECT;
312
313
314 typedef struct {
315 SCSI_PASS_THROUGH spt;
316 ULONG Filler;
317 UCHAR ucSenseBuf[32];
318 UCHAR ucDataBuf[512];
319 } SCSI_PASS_THROUGH_WITH_BUFFERS, *PSCSI_PASS_THROUGH_WITH_BUFFERS;
320
321
322 typedef struct {
323 SCSI_PASS_THROUGH_DIRECT spt;
324 ULONG Filler;
325 UCHAR ucSenseBuf[32];
326 } SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER, *PSCSI_PASS_THROUGH_DIRECT_WITH_BUFFER;
327
328
329
330 typedef struct {
331 UCHAR NumberOfLogicalUnits;
332 UCHAR InitiatorBusId;
333 ULONG InquiryDataOffset;
334 } SCSI_BUS_DATA, *PSCSI_BUS_DATA;
335
336
337 typedef struct {
338 UCHAR NumberOfBusses;
339 SCSI_BUS_DATA BusData[1];
340 } SCSI_ADAPTER_BUS_INFO, *PSCSI_ADAPTER_BUS_INFO;
341
342
343 typedef struct {
344 UCHAR PathId;
345 UCHAR TargetId;
346 UCHAR Lun;
347 BOOLEAN DeviceClaimed;
348 ULONG InquiryDataLength;
349 ULONG NextInquiryDataOffset;
350 UCHAR InquiryData[1];
351 } SCSI_INQUIRY_DATA, *PSCSI_INQUIRY_DATA;
352
353
354 typedef struct {
355 ULONG Length;
356 UCHAR PortNumber;
357 UCHAR PathId;
358 UCHAR TargetId;
359 UCHAR Lun;
360 } SCSI_ADDRESS, *PSCSI_ADDRESS;
361
362
363 /*
364 * method codes
365 */
366 #define METHOD_BUFFERED 0
367 #define METHOD_IN_DIRECT 1
368 #define METHOD_OUT_DIRECT 2
369 #define METHOD_NEITHER 3
370
371 /*
372 * file access values
373 */
374 #define FILE_ANY_ACCESS 0
375 #define FILE_READ_ACCESS (0x0001)
376 #define FILE_WRITE_ACCESS (0x0002)
377
378
379 #define IOCTL_SCSI_BASE 0x00000004
380
381 /*
382 * constants for DataIn member of SCSI_PASS_THROUGH* structures
383 */
384 #define SCSI_IOCTL_DATA_OUT 0
385 #define SCSI_IOCTL_DATA_IN 1
386 #define SCSI_IOCTL_DATA_UNSPECIFIED 2
387
388 /*
389 * Standard IOCTL define
390 */
391 #define CTL_CODE( DevType, Function, Method, Access ) ( \
392 ((DevType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method) \
393 )
394
395 #define IOCTL_SCSI_PASS_THROUGH CTL_CODE( IOCTL_SCSI_BASE, 0x0401, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS )
396 #define IOCTL_SCSI_MINIPORT CTL_CODE( IOCTL_SCSI_BASE, 0x0402, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS )
397 #define IOCTL_SCSI_GET_INQUIRY_DATA CTL_CODE( IOCTL_SCSI_BASE, 0x0403, METHOD_BUFFERED, FILE_ANY_ACCESS)
398 #define IOCTL_SCSI_GET_CAPABILITIES CTL_CODE( IOCTL_SCSI_BASE, 0x0404, METHOD_BUFFERED, FILE_ANY_ACCESS)
399 #define IOCTL_SCSI_PASS_THROUGH_DIRECT CTL_CODE( IOCTL_SCSI_BASE, 0x0405, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS )
400 #define IOCTL_SCSI_GET_ADDRESS CTL_CODE( IOCTL_SCSI_BASE, 0x0406, METHOD_BUFFERED, FILE_ANY_ACCESS )
401
402 #define FILE_DEVICE_MASS_STORAGE 0x0000002d
403 #define IOCTL_STORAGE_BASE FILE_DEVICE_MASS_STORAGE
404
405 #define IOCTL_STORAGE_CHECK_VERIFY CTL_CODE(IOCTL_STORAGE_BASE, 0x0200, METHOD_BUFFERED, FILE_READ_ACCESS)
406 #define IOCTL_STORAGE_CHECK_VERIFY2 CTL_CODE(IOCTL_STORAGE_BASE, 0x0200, METHOD_BUFFERED, FILE_ANY_ACCESS)
407 #define IOCTL_STORAGE_MEDIA_REMOVAL CTL_CODE(IOCTL_STORAGE_BASE, 0x0201, METHOD_BUFFERED, FILE_READ_ACCESS)
408 #define IOCTL_STORAGE_EJECT_MEDIA CTL_CODE(IOCTL_STORAGE_BASE, 0x0202, METHOD_BUFFERED, FILE_READ_ACCESS)
409 #define IOCTL_STORAGE_LOAD_MEDIA CTL_CODE(IOCTL_STORAGE_BASE, 0x0203, METHOD_BUFFERED, FILE_READ_ACCESS)
410 #define IOCTL_STORAGE_LOAD_MEDIA2 CTL_CODE(IOCTL_STORAGE_BASE, 0x0203, METHOD_BUFFERED, FILE_ANY_ACCESS)
411 #define IOCTL_STORAGE_RESERVE CTL_CODE(IOCTL_STORAGE_BASE, 0x0204, METHOD_BUFFERED, FILE_READ_ACCESS)
412 #define IOCTL_STORAGE_RELEASE CTL_CODE(IOCTL_STORAGE_BASE, 0x0205, METHOD_BUFFERED, FILE_READ_ACCESS)
413 #define IOCTL_STORAGE_FIND_NEW_DEVICES CTL_CODE(IOCTL_STORAGE_BASE, 0x0206, METHOD_BUFFERED, FILE_READ_ACCESS)
414
415 #define FILE_DEVICE_CD_ROM 0x00000002
416 #define IOCTL_CDROM_BASE FILE_DEVICE_CD_ROM
417 #define IOCTL_CDROM_RAW_READ CTL_CODE(IOCTL_CDROM_BASE, 0x000F, METHOD_OUT_DIRECT, FILE_READ_ACCESS)
418 #define IOCTL_CDROM_READ_Q_CHANNEL CTL_CODE(IOCTL_CDROM_BASE, 0x000B, METHOD_BUFFERED, FILE_READ_ACCESS)
419 #define IOCTL_CDROM_SEEK_AUDIO_MSF CTL_CODE(IOCTL_CDROM_BASE, 0x0001, METHOD_BUFFERED, FILE_READ_ACCESS)
420
421 typedef struct _CDROM_SEEK_AUDIO_MSF {
422 UCHAR M;
423 UCHAR S;
424 UCHAR F;
425 } CDROM_SEEK_AUDIO_MSF, *PCDROM_SEEK_AUDIO_MSF;
426
427 //
428 // CD ROM Sub-Q Channel Data Format
429 //
430
431 #define IOCTL_CDROM_SUB_Q_CHANNEL 0x00
432 #define IOCTL_CDROM_CURRENT_POSITION 0x01
433 #define IOCTL_CDROM_MEDIA_CATALOG 0x02
434 #define IOCTL_CDROM_TRACK_ISRC 0x03
435
436 typedef struct _CDROM_SUB_Q_DATA_FORMAT {
437 UCHAR Format;
438 UCHAR Track;
439 } CDROM_SUB_Q_DATA_FORMAT, *PCDROM_SUB_Q_DATA_FORMAT;
440
441 typedef struct _SUB_Q_HEADER {
442 UCHAR Reserved;
443 UCHAR AudioStatus;
444 UCHAR DataLength[2];
445 } SUB_Q_HEADER, *PSUB_Q_HEADER;
446
447 typedef struct _SUB_Q_CURRENT_POSITION {
448 SUB_Q_HEADER Header;
449 UCHAR FormatCode;
450 UCHAR Control : 4;
451 UCHAR ADR : 4;
452 UCHAR TrackNumber;
453 UCHAR IndexNumber;
454 UCHAR AbsoluteAddress[4];
455 UCHAR TrackRelativeAddress[4];
456 } SUB_Q_CURRENT_POSITION, *PSUB_Q_CURRENT_POSITION;
457
458 typedef struct _SUB_Q_MEDIA_CATALOG_NUMBER {
459 SUB_Q_HEADER Header;
460 UCHAR FormatCode;
461 UCHAR Reserved[3];
462 UCHAR Reserved1 : 7;
463 UCHAR Mcval : 1;
464 UCHAR MediaCatalog[15];
465 } SUB_Q_MEDIA_CATALOG_NUMBER, *PSUB_Q_MEDIA_CATALOG_NUMBER;
466
467 typedef struct _SUB_Q_TRACK_ISRC {
468 SUB_Q_HEADER Header;
469 UCHAR FormatCode;
470 UCHAR Reserved0;
471 UCHAR Track;
472 UCHAR Reserved1;
473 UCHAR Reserved2 : 7;
474 UCHAR Tcval : 1;
475 UCHAR TrackIsrc[15];
476 } SUB_Q_TRACK_ISRC, *PSUB_Q_TRACK_ISRC;
477
478 typedef union _SUB_Q_CHANNEL_DATA {
479 SUB_Q_CURRENT_POSITION CurrentPosition;
480 SUB_Q_MEDIA_CATALOG_NUMBER MediaCatalog;
481 SUB_Q_TRACK_ISRC TrackIsrc;
482 } SUB_Q_CHANNEL_DATA, *PSUB_Q_CHANNEL_DATA;
483
484
485 // IOCTL_DISK_SET_CACHE allows the caller to get or set the state of the disk
486 // read/write caches.
487 //
488 // If the structure is provided as the input buffer for the ioctl the read &
489 // write caches will be enabled or disabled depending on the parameters
490 // provided.
491 //
492 // If the structure is provided as an output buffer for the ioctl the state
493 // of the read & write caches will be returned. If both input and outut buffers
494 // are provided the output buffer will contain the cache state BEFORE any
495 // changes are made
496
497
498 typedef enum {
499 EqualPriority,
500 KeepPrefetchedData,
501 KeepReadData
502 } DISK_CACHE_RETENTION_PRIORITY;
503
504 #define FILE_DEVICE_DISK 0x00000007
505 #define IOCTL_DISK_BASE FILE_DEVICE_DISK
506 #define IOCTL_DISK_GET_CACHE_INFORMATION CTL_CODE(IOCTL_DISK_BASE, 0x0035, METHOD_BUFFERED, FILE_READ_ACCESS)
507 #define IOCTL_DISK_SET_CACHE_INFORMATION CTL_CODE(IOCTL_DISK_BASE, 0x0036, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
508
509 typedef struct _DISK_CACHE_INFORMATION {
510
511 //
512 // on return indicates that the device is capable of saving any parameters
513 // in non-volatile storage. On send indicates that the device should
514 // save the state in non-volatile storage.
515 //
516
517 BOOLEAN ParametersSavable;
518
519 //
520 // Indicates whether the write and read caches are enabled.
521 //
522
523 BOOLEAN ReadCacheEnabled;
524 BOOLEAN WriteCacheEnabled;
525
526 //
527 // Controls the likelyhood of data remaining in the cache depending on how
528 // it got there. Data cached from a READ or WRITE operation may be given
529 // higher, lower or equal priority to data entered into the cache for other
530 // means (like prefetch)
531 //
532
533 DISK_CACHE_RETENTION_PRIORITY ReadRetentionPriority;
534 DISK_CACHE_RETENTION_PRIORITY WriteRetentionPriority;
535
536 //
537 // Requests for a larger number of blocks than this may have prefetching
538 // disabled. If this value is set to 0 prefetch will be disabled.
539 //
540
541 USHORT DisablePrefetchTransferLength;
542
543 //
544 // If TRUE then ScalarPrefetch (below) will be valid. If FALSE then
545 // the minimum and maximum values should be treated as a block count
546 // (BlockPrefetch)
547 //
548
549 BOOLEAN PrefetchScalar;
550
551 //
552 // Contains the minimum and maximum amount of data which will be
553 // will be prefetched into the cache on a disk operation. This value
554 // may either be a scalar multiplier of the transfer length of the request,
555 // or an abolute number of disk blocks. PrefetchScalar (above) indicates
556 // which interpretation is used.
557 //
558
559 union {
560 struct {
561 USHORT Minimum;
562 USHORT Maximum;
563
564 //
565 // The maximum number of blocks which will be prefetched - useful
566 // with the scalar limits to set definite upper limits.
567 //
568
569 USHORT MaximumBlocks;
570 } ScalarPrefetch;
571
572 struct {
573 USHORT Minimum;
574 USHORT Maximum;
575 } BlockPrefetch;
576 };
577
578 } DISK_CACHE_INFORMATION, *PDISK_CACHE_INFORMATION;
579

  ViewVC Help
Powered by ViewVC 1.1.22