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

Contents of /trunk/plugins/CDVDpeops/wnaspi32.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: 18749 byte(s)
committing r3113 initial commit again...
1 /******************************************************************************
2 **
3 ** Module Name: wnaspi32.h
4 **
5 ** Description: Header file for ASPI for Win32. This header includes
6 ** macro and type declarations, and can be included without
7 ** modification when using Borland C++ or Microsoft Visual
8 ** C++ with 32-bit compilation. If you are using a different
9 ** compiler then you MUST ensure that structures are packed
10 ** onto byte alignments, and that C++ name mangling is turned
11 ** off.
12 **
13 ** Notes: This file created using 4 spaces per tab.
14 **
15 ******************************************************************************/
16
17 #ifndef __WNASPI32_H__
18 #define __WNASPI32_H__
19
20 /*
21 ** Make sure structures are packed and undecorated.
22 */
23
24 #ifdef __BORLANDC__
25 #pragma option -a1
26 #endif //__BORLANDC__
27
28 #ifdef _MSC_VER
29 #pragma pack(1)
30 #endif //__MSC_VER
31
32 #ifdef __cplusplus
33 extern "C" {
34 #endif //__cplusplus
35
36 //*****************************************************************************
37 // %%% SCSI MISCELLANEOUS EQUATES %%%
38 //*****************************************************************************
39
40 #define SENSE_LEN 14 // Default sense buffer length
41 #define SRB_DIR_SCSI 0x00 // Direction determined by SCSI
42 #define SRB_POSTING 0x01 // Enable ASPI posting
43 #define SRB_ENABLE_RESIDUAL_COUNT 0x04 // Enable residual byte count reporting
44 #define SRB_DIR_IN 0x08 // Transfer from SCSI target to host
45 #define SRB_DIR_OUT 0x10 // Transfer from host to SCSI target
46 #define SRB_EVENT_NOTIFY 0x40 // Enable ASPI event notification
47
48 #define RESIDUAL_COUNT_SUPPORTED 0x02 // Extended buffer flag
49 #define MAX_SRB_TIMEOUT 108000lu // 30 hour maximum timeout in s
50 #define DEFAULT_SRB_TIMEOUT 108000lu // Max timeout by default
51
52
53 //*****************************************************************************
54 // %%% ASPI Command Definitions %%%
55 //*****************************************************************************
56
57 #define SC_HA_INQUIRY 0x00 // Host adapter inquiry
58 #define SC_GET_DEV_TYPE 0x01 // Get device type
59 #define SC_EXEC_SCSI_CMD 0x02 // Execute SCSI command
60 #define SC_ABORT_SRB 0x03 // Abort an SRB
61 #define SC_RESET_DEV 0x04 // SCSI bus device reset
62 #define SC_SET_HA_PARMS 0x05 // Set HA parameters
63 #define SC_GET_DISK_INFO 0x06 // Get Disk information
64 #define SC_RESCAN_SCSI_BUS 0x07 // ReBuild SCSI device map
65 #define SC_GETSET_TIMEOUTS 0x08 // Get/Set target timeouts
66
67 //*****************************************************************************
68 // %%% SRB Status %%%
69 //*****************************************************************************
70
71 #define SS_PENDING 0x00 // SRB being processed
72 #define SS_COMP 0x01 // SRB completed without error
73 #define SS_ABORTED 0x02 // SRB aborted
74 #define SS_ABORT_FAIL 0x03 // Unable to abort SRB
75 #define SS_ERR 0x04 // SRB completed with error
76
77 #define SS_INVALID_CMD 0x80 // Invalid ASPI command
78 #define SS_INVALID_HA 0x81 // Invalid host adapter number
79 #define SS_NO_DEVICE 0x82 // SCSI device not installed
80
81 #define SS_INVALID_SRB 0xE0 // Invalid parameter set in SRB
82 #define SS_OLD_MANAGER 0xE1 // ASPI manager doesn't support Windows
83 #define SS_BUFFER_ALIGN 0xE1 // Buffer not aligned (replaces OLD_MANAGER in Win32)
84 #define SS_ILLEGAL_MODE 0xE2 // Unsupported Windows mode
85 #define SS_NO_ASPI 0xE3 // No ASPI managers resident
86 #define SS_FAILED_INIT 0xE4 // ASPI for windows failed init
87 #define SS_ASPI_IS_BUSY 0xE5 // No resources available to execute cmd
88 #define SS_BUFFER_TO_BIG 0xE6 // Buffer size to big to handle!
89 #define SS_MISMATCHED_COMPONENTS 0xE7 // The DLLs/EXEs of ASPI don't version check
90 #define SS_NO_ADAPTERS 0xE8 // No host adapters to manage
91 #define SS_INSUFFICIENT_RESOURCES 0xE9 // Couldn't allocate resources needed to init
92 #define SS_ASPI_IS_SHUTDOWN 0xEA // Call came to ASPI after PROCESS_DETACH
93 #define SS_BAD_INSTALL 0xEB // The DLL or other components are installed wrong
94
95 //*****************************************************************************
96 // %%% Host Adapter Status %%%
97 //*****************************************************************************
98
99 #define HASTAT_OK 0x00 // Host adapter did not detect an // error
100 #define HASTAT_SEL_TO 0x11 // Selection Timeout
101 #define HASTAT_DO_DU 0x12 // Data overrun data underrun
102 #define HASTAT_BUS_FREE 0x13 // Unexpected bus free
103 #define HASTAT_PHASE_ERR 0x14 // Target bus phase sequence // failure
104 #define HASTAT_TIMEOUT 0x09 // Timed out while SRB was waiting to beprocessed.
105 #define HASTAT_COMMAND_TIMEOUT 0x0B // Adapter timed out processing SRB.
106 #define HASTAT_MESSAGE_REJECT 0x0D // While processing SRB, the // adapter received a MESSAGE
107 #define HASTAT_BUS_RESET 0x0E // A bus reset was detected.
108 #define HASTAT_PARITY_ERROR 0x0F // A parity error was detected.
109 #define HASTAT_REQUEST_SENSE_FAILED 0x10 // The adapter failed in issuing
110
111 //*****************************************************************************
112 // %%% SRB - HOST ADAPTER INQUIRY - SC_HA_INQUIRY (0) %%%
113 //*****************************************************************************
114
115 typedef struct // Offset
116 { // HX/DEC
117 BYTE SRB_Cmd; // 00/000 ASPI command code = SC_HA_INQUIRY
118 BYTE SRB_Status; // 01/001 ASPI command status byte
119 BYTE SRB_HaId; // 02/002 ASPI host adapter number
120 BYTE SRB_Flags; // 03/003 ASPI request flags
121 DWORD SRB_Hdr_Rsvd; // 04/004 Reserved, MUST = 0
122 BYTE HA_Count; // 08/008 Number of host adapters present
123 BYTE HA_SCSI_ID; // 09/009 SCSI ID of host adapter
124 BYTE HA_ManagerId[16]; // 0A/010 String describing the manager
125 BYTE HA_Identifier[16]; // 1A/026 String describing the host adapter
126 BYTE HA_Unique[16]; // 2A/042 Host Adapter Unique parameters
127 WORD HA_Rsvd1; // 3A/058 Reserved, MUST = 0
128 }
129 SRB_HAInquiry, *PSRB_HAInquiry, FAR *LPSRB_HAInquiry;
130
131 //*****************************************************************************
132 // %%% SRB - GET DEVICE TYPE - SC_GET_DEV_TYPE (1) %%%
133 //*****************************************************************************
134
135 typedef struct
136 {
137 BYTE SRB_Cmd; /* 00/000 ASPI cmd code == SC_GET_DEV_TYPE */
138 BYTE SRB_Status; /* 01/001 ASPI command status byte */
139 BYTE SRB_HaID; /* 02/002 ASPI host adapter number */
140 BYTE SRB_Flags; /* 03/003 Reserved, must = 0 */
141 DWORD SRB_Hdr_Rsvd; /* 04/004 Reserved, must = 0 */
142 BYTE SRB_Target; /* 08/008 Target's SCSI ID */
143 BYTE SRB_Lun; /* 09/009 Target's LUN number */
144 BYTE SRB_DeviceType; /* 0a/010 Target's peripheral device type */
145 BYTE SRB_Rsvd1; /* 0b/011 Reserved, must = 0 */
146 BYTE pad[68];
147 } SRB_GDEVBlock, *PSRB_GDEVBlock, FAR *LPSRB_GDEVBlock;
148
149 //*****************************************************************************
150 // %%% SRB - EXECUTE SCSI COMMAND - SC_EXEC_SCSI_CMD (2) %%%
151 //*****************************************************************************
152
153 typedef struct // Offset
154 { // HX/DEC
155 BYTE SRB_Cmd; // 00/000 ASPI command code = SC_EXEC_SCSI_CMD
156 BYTE SRB_Status; // 01/001 ASPI command status byte
157 BYTE SRB_HaId; // 02/002 ASPI host adapter number
158 BYTE SRB_Flags; // 03/003 ASPI request flags
159 DWORD SRB_Hdr_Rsvd; // 04/004 Reserved
160 BYTE SRB_Target; // 08/008 Target's SCSI ID
161 BYTE SRB_Lun; // 09/009 Target's LUN number
162 WORD SRB_Rsvd1; // 0A/010 Reserved for Alignment
163 DWORD SRB_BufLen; // 0C/012 Data Allocation Length
164 BYTE FAR *SRB_BufPointer; // 10/016 Data Buffer Pointer
165 BYTE SRB_SenseLen; // 14/020 Sense Allocation Length
166 BYTE SRB_CDBLen; // 15/021 CDB Length
167 BYTE SRB_HaStat; // 16/022 Host Adapter Status
168 BYTE SRB_TargStat; // 17/023 Target Status
169 VOID FAR *SRB_PostProc; // 18/024 Post routine
170 BYTE SRB_Rsvd2[20]; // 1C/028 Reserved, MUST = 0
171 BYTE CDBByte[16]; // 30/048 SCSI CDB
172 BYTE SenseArea[SENSE_LEN+2]; // 50/064 Request Sense buffer
173 }
174 SRB_ExecSCSICmd, *PSRB_ExecSCSICmd, FAR *LPSRB_ExecSCSICmd;
175
176 //*****************************************************************************
177 // %%% SRB - ABORT AN SRB - SC_ABORT_SRB (3) %%%
178 //*****************************************************************************
179
180 typedef struct // Offset
181 { // HX/DEC
182 BYTE SRB_Cmd; // 00/000 ASPI command code = SC_ABORT_SRB
183 BYTE SRB_Status; // 01/001 ASPI command status byte
184 BYTE SRB_HaId; // 02/002 ASPI host adapter number
185 BYTE SRB_Flags; // 03/003 Reserved
186 DWORD SRB_Hdr_Rsvd; // 04/004 Reserved
187 VOID FAR *SRB_ToAbort; // 08/008 Pointer to SRB to abort
188 }
189 SRB_Abort, *PSRB_Abort, FAR *LPSRB_Abort;
190
191 //*****************************************************************************
192 // %%% SRB - BUS DEVICE RESET - SC_RESET_DEV (4) %%%
193 //*****************************************************************************
194
195 typedef struct // Offset
196 { // HX/DEC
197 BYTE SRB_Cmd; // 00/000 ASPI command code = SC_RESET_DEV
198 BYTE SRB_Status; // 01/001 ASPI command status byte
199 BYTE SRB_HaId; // 02/002 ASPI host adapter number
200 BYTE SRB_Flags; // 03/003 ASPI request flags
201 DWORD SRB_Hdr_Rsvd; // 04/004 Reserved
202 BYTE SRB_Target; // 08/008 Target's SCSI ID
203 BYTE SRB_Lun; // 09/009 Target's LUN number
204 BYTE SRB_Rsvd1[12]; // 0A/010 Reserved for Alignment
205 BYTE SRB_HaStat; // 16/022 Host Adapter Status
206 BYTE SRB_TargStat; // 17/023 Target Status
207 VOID FAR *SRB_PostProc; // 18/024 Post routine
208 BYTE SRB_Rsvd2[36]; // 1C/028 Reserved, MUST = 0
209 }
210 SRB_BusDeviceReset, *PSRB_BusDeviceReset, FAR *LPSRB_BusDeviceReset;
211
212 //*****************************************************************************
213 // %%% SRB - GET DISK INFORMATION - SC_GET_DISK_INFO %%%
214 //*****************************************************************************
215
216 typedef struct // Offset
217 { // HX/DEC
218 BYTE SRB_Cmd; // 00/000 ASPI command code = SC_GET_DISK_INFO
219 BYTE SRB_Status; // 01/001 ASPI command status byte
220 BYTE SRB_HaId; // 02/002 ASPI host adapter number
221 BYTE SRB_Flags; // 03/003 Reserved, MUST = 0
222 DWORD SRB_Hdr_Rsvd; // 04/004 Reserved, MUST = 0
223 BYTE SRB_Target; // 08/008 Target's SCSI ID
224 BYTE SRB_Lun; // 09/009 Target's LUN number
225 BYTE SRB_DriveFlags; // 0A/010 Driver flags
226 BYTE SRB_Int13HDriveInfo; // 0B/011 Host Adapter Status
227 BYTE SRB_Heads; // 0C/012 Preferred number of heads translation
228 BYTE SRB_Sectors; // 0D/013 Preferred number of sectors translation
229 BYTE SRB_Rsvd1[10]; // 0E/014 Reserved, MUST = 0
230 }
231 SRB_GetDiskInfo, *PSRB_GetDiskInfo, FAR *LPSRB_GetDiskInfo;
232
233 //*****************************************************************************
234 // %%% SRB - RESCAN SCSI BUS(ES) ON SCSIPORT %%%
235 //*****************************************************************************
236
237 typedef struct // Offset
238 { // HX/DEC
239 BYTE SRB_Cmd; // 00/000 ASPI command code = SC_RESCAN_SCSI_BUS
240 BYTE SRB_Status; // 01/001 ASPI command status byte
241 BYTE SRB_HaId; // 02/002 ASPI host adapter number
242 BYTE SRB_Flags; // 03/003 Reserved, MUST = 0
243 DWORD SRB_Hdr_Rsvd; // 04/004 Reserved, MUST = 0
244 }
245 SRB_RescanPort, *PSRB_RescanPort, FAR *LPSRB_RescanPort;
246
247 //*****************************************************************************
248 // %%% SRB - GET/SET TARGET TIMEOUTS %%%
249 //*****************************************************************************
250
251 typedef struct // Offset
252 { // HX/DEC
253 BYTE SRB_Cmd; // 00/000 ASPI command code = SC_GETSET_TIMEOUTS
254 BYTE SRB_Status; // 01/001 ASPI command status byte
255 BYTE SRB_HaId; // 02/002 ASPI host adapter number
256 BYTE SRB_Flags; // 03/003 ASPI request flags
257 DWORD SRB_Hdr_Rsvd; // 04/004 Reserved, MUST = 0
258 BYTE SRB_Target; // 08/008 Target's SCSI ID
259 BYTE SRB_Lun; // 09/009 Target's LUN number
260 DWORD SRB_Timeout; // 0A/010 Timeout in half seconds
261 }
262 SRB_GetSetTimeouts, *PSRB_GetSetTimeouts, FAR *LPSRB_GetSetTimeouts;
263
264 //*****************************************************************************
265 // %%% ASPIBUFF - Structure For Controllng I/O Buffers %%%
266 //*****************************************************************************
267
268 typedef struct tag_ASPI32BUFF // Offset
269 { // HX/DEC
270 PBYTE AB_BufPointer; // 00/000 Pointer to the ASPI allocated buffer
271 DWORD AB_BufLen; // 04/004 Length in bytes of the buffer
272 DWORD AB_ZeroFill; // 08/008 Flag set to 1 if buffer should be zeroed
273 DWORD AB_Reserved; // 0C/012 Reserved
274 }
275 ASPI32BUFF, *PASPI32BUFF, FAR *LPASPI32BUFF;
276
277 //*****************************************************************************
278 // %%% TOC structures %%%
279 //*****************************************************************************
280
281 typedef struct
282 {
283 unsigned char reserved1;
284 unsigned char cAdrCtrl;
285 unsigned char cTrackNum;
286 unsigned char reserved2;
287 unsigned long lAddr;
288 } TOC_TRACK;
289
290 typedef struct
291 {
292 unsigned short usTocDataLen;
293 unsigned char cFirstTrack;
294 unsigned char cLastTrack;
295 TOC_TRACK tracks[100];
296 } TOC, *PTOC, FAR *LPTOC;
297
298 //*****************************************************************************
299 // %%% PROTOTYPES - User Callable ASPI for Win32 Functions %%%
300 //*****************************************************************************
301
302 typedef struct
303 {
304 BYTE SRB_Cmd;
305 BYTE SRB_Status;
306 BYTE SRB_HaId;
307 BYTE SRB_Flags;
308 DWORD SRB_Hdr_Rsvd;
309 } SRB, *PSRB, FAR *LPSRB;
310
311
312 #if defined(__BORLANDC__)
313
314 DWORD _import GetASPI32SupportInfo( void );
315 DWORD _import SendASPI32Command( LPSRB );
316 BOOL _import GetASPI32Buffer( PASPI32BUFF );
317 BOOL _import FreeASPI32Buffer( PASPI32BUFF );
318 BOOL _import TranslateASPI32Address( PDWORD, PDWORD );
319
320 #elif defined(_MSC_VER)
321
322 __declspec(dllimport) DWORD GetASPI32SupportInfo( void );
323 __declspec(dllimport) DWORD SendASPI32Command( LPSRB );
324 __declspec(dllimport) BOOL GetASPI32Buffer( PASPI32BUFF );
325 __declspec(dllimport) BOOL FreeASPI32Buffer( PASPI32BUFF );
326 __declspec(dllimport) BOOL TranslateASPI32Address( PDWORD, PDWORD );
327
328 #else
329
330 extern DWORD GetASPI32SupportInfo( void );
331 extern DWORD GetASPI32Command( LPSRB );
332 extern BOOL GetASPI32Buffer( PASPI32BUFF );
333 extern BOOL FreeASPI32Buffer( PASPI32BUFF );
334 extern BOOL TranslateASPI32Address( PDWORD, PDWORD );
335
336 #endif
337
338 /*
339 ** Restore compiler default packing and close off the C declarations.
340 */
341
342 #ifdef __BORLANDC__
343 #pragma option -a.
344 #endif //__BORLANDC__
345
346 #ifdef _MSC_VER
347 #pragma pack()
348 #endif //_MSC_VER
349
350 #ifdef __cplusplus
351 }
352 #endif //__cplusplus
353
354 #endif //__WNASPI32_H__

  ViewVC Help
Powered by ViewVC 1.1.22