| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
#ifndef __WNASPI32_H__ |
| 18 |
#define __WNASPI32_H__ |
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
#ifdef __BORLANDC__ |
| 25 |
#pragma option -a1 |
| 26 |
#endif |
| 27 |
|
| 28 |
#ifdef _MSC_VER |
| 29 |
#pragma pack(1) |
| 30 |
#endif |
| 31 |
|
| 32 |
#ifdef __cplusplus |
| 33 |
extern "C" { |
| 34 |
#endif |
| 35 |
|
| 36 |
|
| 37 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 113 |
|
| 114 |
|
| 115 |
typedef struct |
| 116 |
{ |
| 117 |
BYTE SRB_Cmd; |
| 118 |
BYTE SRB_Status; |
| 119 |
BYTE SRB_HaId; |
| 120 |
BYTE SRB_Flags; |
| 121 |
DWORD SRB_Hdr_Rsvd; |
| 122 |
BYTE HA_Count; |
| 123 |
BYTE HA_SCSI_ID; |
| 124 |
BYTE HA_ManagerId[16]; |
| 125 |
BYTE HA_Identifier[16]; |
| 126 |
BYTE HA_Unique[16]; |
| 127 |
WORD HA_Rsvd1; |
| 128 |
} |
| 129 |
SRB_HAInquiry, *PSRB_HAInquiry, FAR *LPSRB_HAInquiry; |
| 130 |
|
| 131 |
|
| 132 |
|
| 133 |
|
| 134 |
|
| 135 |
typedef struct |
| 136 |
{ |
| 137 |
BYTE SRB_Cmd; |
| 138 |
BYTE SRB_Status; |
| 139 |
BYTE SRB_HaId; |
| 140 |
BYTE SRB_Flags; |
| 141 |
DWORD SRB_Hdr_Rsvd; |
| 142 |
BYTE SRB_Target; |
| 143 |
BYTE SRB_Lun; |
| 144 |
BYTE SRB_DeviceType; |
| 145 |
BYTE SRB_Rsvd1; |
| 146 |
} |
| 147 |
SRB_GDEVBlock, *PSRB_GDEVBlock, FAR *LPSRB_GDEVBlock; |
| 148 |
|
| 149 |
|
| 150 |
|
| 151 |
|
| 152 |
|
| 153 |
typedef struct |
| 154 |
{ |
| 155 |
BYTE SRB_Cmd; |
| 156 |
BYTE SRB_Status; |
| 157 |
BYTE SRB_HaId; |
| 158 |
BYTE SRB_Flags; |
| 159 |
DWORD SRB_Hdr_Rsvd; |
| 160 |
BYTE SRB_Target; |
| 161 |
BYTE SRB_Lun; |
| 162 |
WORD SRB_Rsvd1; |
| 163 |
DWORD SRB_BufLen; |
| 164 |
BYTE FAR *SRB_BufPointer; |
| 165 |
BYTE SRB_SenseLen; |
| 166 |
BYTE SRB_CDBLen; |
| 167 |
BYTE SRB_HaStat; |
| 168 |
BYTE SRB_TargStat; |
| 169 |
VOID FAR *SRB_PostProc; |
| 170 |
BYTE SRB_Rsvd2[20]; |
| 171 |
BYTE CDBByte[16]; |
| 172 |
BYTE SenseArea[SENSE_LEN+2]; |
| 173 |
} |
| 174 |
SRB_ExecSCSICmd, *PSRB_ExecSCSICmd, FAR *LPSRB_ExecSCSICmd; |
| 175 |
|
| 176 |
|
| 177 |
|
| 178 |
|
| 179 |
|
| 180 |
typedef struct |
| 181 |
{ |
| 182 |
BYTE SRB_Cmd; |
| 183 |
BYTE SRB_Status; |
| 184 |
BYTE SRB_HaId; |
| 185 |
BYTE SRB_Flags; |
| 186 |
DWORD SRB_Hdr_Rsvd; |
| 187 |
VOID FAR *SRB_ToAbort; |
| 188 |
} |
| 189 |
SRB_Abort, *PSRB_Abort, FAR *LPSRB_Abort; |
| 190 |
|
| 191 |
|
| 192 |
|
| 193 |
|
| 194 |
|
| 195 |
typedef struct |
| 196 |
{ |
| 197 |
BYTE SRB_Cmd; |
| 198 |
BYTE SRB_Status; |
| 199 |
BYTE SRB_HaId; |
| 200 |
BYTE SRB_Flags; |
| 201 |
DWORD SRB_Hdr_Rsvd; |
| 202 |
BYTE SRB_Target; |
| 203 |
BYTE SRB_Lun; |
| 204 |
BYTE SRB_Rsvd1[12]; |
| 205 |
BYTE SRB_HaStat; |
| 206 |
BYTE SRB_TargStat; |
| 207 |
VOID FAR *SRB_PostProc; |
| 208 |
BYTE SRB_Rsvd2[36]; |
| 209 |
} |
| 210 |
SRB_BusDeviceReset, *PSRB_BusDeviceReset, FAR *LPSRB_BusDeviceReset; |
| 211 |
|
| 212 |
|
| 213 |
|
| 214 |
|
| 215 |
|
| 216 |
typedef struct |
| 217 |
{ |
| 218 |
BYTE SRB_Cmd; |
| 219 |
BYTE SRB_Status; |
| 220 |
BYTE SRB_HaId; |
| 221 |
BYTE SRB_Flags; |
| 222 |
DWORD SRB_Hdr_Rsvd; |
| 223 |
BYTE SRB_Target; |
| 224 |
BYTE SRB_Lun; |
| 225 |
BYTE SRB_DriveFlags; |
| 226 |
BYTE SRB_Int13HDriveInfo; |
| 227 |
BYTE SRB_Heads; |
| 228 |
BYTE SRB_Sectors; |
| 229 |
BYTE SRB_Rsvd1[10]; |
| 230 |
} |
| 231 |
SRB_GetDiskInfo, *PSRB_GetDiskInfo, FAR *LPSRB_GetDiskInfo; |
| 232 |
|
| 233 |
|
| 234 |
|
| 235 |
|
| 236 |
|
| 237 |
typedef struct |
| 238 |
{ |
| 239 |
BYTE SRB_Cmd; |
| 240 |
BYTE SRB_Status; |
| 241 |
BYTE SRB_HaId; |
| 242 |
BYTE SRB_Flags; |
| 243 |
DWORD SRB_Hdr_Rsvd; |
| 244 |
} |
| 245 |
SRB_RescanPort, *PSRB_RescanPort, FAR *LPSRB_RescanPort; |
| 246 |
|
| 247 |
|
| 248 |
|
| 249 |
|
| 250 |
|
| 251 |
typedef struct |
| 252 |
{ |
| 253 |
BYTE SRB_Cmd; |
| 254 |
BYTE SRB_Status; |
| 255 |
BYTE SRB_HaId; |
| 256 |
BYTE SRB_Flags; |
| 257 |
DWORD SRB_Hdr_Rsvd; |
| 258 |
BYTE SRB_Target; |
| 259 |
BYTE SRB_Lun; |
| 260 |
DWORD SRB_Timeout; |
| 261 |
} |
| 262 |
SRB_GetSetTimeouts, *PSRB_GetSetTimeouts, FAR *LPSRB_GetSetTimeouts; |
| 263 |
|
| 264 |
|
| 265 |
|
| 266 |
|
| 267 |
|
| 268 |
typedef struct tag_ASPI32BUFF |
| 269 |
{ |
| 270 |
PBYTE AB_BufPointer; |
| 271 |
DWORD AB_BufLen; |
| 272 |
DWORD AB_ZeroFill; |
| 273 |
DWORD AB_Reserved; |
| 274 |
} |
| 275 |
ASPI32BUFF, *PASPI32BUFF, FAR *LPASPI32BUFF; |
| 276 |
|
| 277 |
|
| 278 |
|
| 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 |
|
| 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 |
|
| 340 |
|
| 341 |
|
| 342 |
#ifdef __BORLANDC__ |
| 343 |
#pragma option -a. |
| 344 |
#endif |
| 345 |
|
| 346 |
#ifdef _MSC_VER |
| 347 |
#pragma pack() |
| 348 |
#endif |
| 349 |
|
| 350 |
#ifdef __cplusplus |
| 351 |
} |
| 352 |
#endif |
| 353 |
|
| 354 |
#endif |