ASPIW32.H
资源名称:fpdumpw.zip [点击查看]
上传用户:wandash
上传日期:2007-01-07
资源大小:79k
文件大小:7k
源码类别:
SCSI/ASPI
开发平台:
Visual C++
- #ifndef _H_ASPIW32_
- #define _H_ASPIW32_
- #include <windows.h>
- #define ASPI_MANAGER "wnaspi32.dll"
- #define SS_PENDING 0x00
- #define SS_COMP 0x01
- #define SS_ABORTED 0x02
- #define SS_ABORT_FAIL 0x03
- #define SS_ERR 0x04
- #define SS_INVALID_HA 0x81
- #define SS_INVALID_SRB 0xE0
- #define SS_BUFFER_ALIGN 0xE1
- #define SS_FAILED_INIT 0xE4
- #define SS_ASPI_IS_BUSY 0xE5
- #define SS_BUFFER_TO_BIG 0xE6
- // Max sense length
- #define SENSE_LEN 32
- #define SC_HA_INQUIRY 0x00
- #define SC_GET_DEV_TYPE 0x01
- #define SC_EXEC_SCSI_CMD 0x02
- #define SC_ABORT_SRB 0x03
- #define SC_RESET_DEV 0x04
- #define SC_GET_DISK_INFO 0x06
- // Peripheral device type
- #define DT_DIRECT_ACCESS 0x00
- #define DT_SEQUENTIAL_ACCESS 0x01
- #define DT_PRINTER 0x02
- #define DT_PROCESSOR 0x03
- #define DT_WRITE_ONCE 0x04
- #define DT_CD_ROM 0x05
- #define DT_SCANNER 0x06
- #define DT_OPTICAL_MEMORY 0x07
- #define DT_MEDIUM_CHANGER 0x08
- #define DT_COMMUNICATION 0x09
- // SCSI Request Flags
- #define SRB_POSTING 0x01
- #define SRB_ENABLE_RESIDUAL_COUNT 0x04
- #define SRB_DIR_IN 0x08
- #define SRB_DIR_OUT 0x10
- #define SRB_EVENT_NOTIFY 0x40
- // GENERAL I/O Operate Code
- #define OC_IO_ALL_TEST_UNIT_READY 0x00
- // TAPE I/O Operate Code
- #define OC_IO_TAPE_REWIND 0x01
- #define OC_IO_TAPE_LOAD 0x1B
- #define OC_IO_TAPE_READ_BLOCK_LIMIT 0x05
- #define OC_IO_TAPE_READ 0x08
- typedef struct
- {
- BYTE SRB_Cmd; // ASPI command code
- BYTE SRB_Status; // ASPI command status byte
- BYTE SRB_HaId; // ASPI host adapter number
- BYTE SRB_Flags; // ASPI request flags
- DWORD SRB_Hdr_Rsvd; // Reserved, MUST = 0
- } SRB,*LPSRB;
- typedef struct
- {
- BYTE SRB_Cmd; // ASPI command code = SC_HA_INQUIRY
- BYTE SRB_Status; // ASPI command status byte
- BYTE SRB_HaId; // ASPI host adapter number
- BYTE SRB_Flags; // ASPI request flags
- DWORD SRB_Hdr_Rsvd; // Reserved, MUST = 0
- BYTE HA_Count; // Number of host adapters present
- BYTE HA_SCSI_ID; // SCSI ID of host adapter
- BYTE HA_ManagerId[16]; // String describing the manager
- BYTE HA_Identifier[16]; // String describing the host adapter
- BYTE HA_Unique[16]; // Host Adapter Unique parameters
- WORD HA_Rsvd1;
- } SRB_HAInquiry, *PSRB_HAInquiry;
- typedef struct
- {
- BYTE SRB_Cmd; // ASPI command code = SC_GET_DEV_TYPE
- BYTE SRB_Status; // ASPI command status byte
- BYTE SRB_HaId; // ASPI host adapter number
- BYTE SRB_Flags; // Reserved
- DWORD SRB_Hdr_Rsvd; // Reserved
- BYTE SRB_Target; // Target's SCSI ID
- BYTE SRB_Lun; // Target's LUN number
- BYTE SRB_DeviceType; // Target's peripheral device type
- BYTE SRB_Rsvd1; // Reserved for alignment
- } SRB_GDEVBlock, *PSRB_GDEVBlock;
- typedef struct
- {
- BYTE SRB_Cmd; // ASPI command code = SC_EXEC_SCSI_CMD
- BYTE SRB_Status; // ASPI command status byte
- BYTE SRB_HaId; // ASPI host adapter number
- BYTE SRB_Flags; // ASPI request flags
- DWORD SRB_Hdr_Rsvd; // Reserved
- BYTE SRB_Target; // Target's SCSI ID
- BYTE SRB_Lun; // Target's LUN number
- WORD SRB_Rsvd1; // Reserved for Alignment
- DWORD SRB_BufLen; // Data Allocation Length
- BYTE *SRB_BufPointer; // Data Buffer Point
- BYTE SRB_SenseLen; // Sense Allocation Length
- BYTE SRB_CDBLen; // CDB Length
- BYTE SRB_HaStat; // Host Adapter Status
- BYTE SRB_TargStat; // Target Status
- void (*SRB_PostProc)(); // Post routine
- void *SRB_Rsvd2; // Reserved
- BYTE SRB_Rsvd3[16]; // Reserved for expansion
- BYTE CDBByte[16]; // SCSI CDB
- BYTE SenseArea[SENSE_LEN+2]; // Request Sense buffer
- } SRB_ExecSCSICmd, *PSRB_ExecSCSICmd;
- typedef struct
- {
- BYTE SRB_Cmd; // ASPI command code = SC_RESET_DEV
- BYTE SRB_Status; // ASPI command status byte
- BYTE SRB_HaId; // ASPI host adapter number
- BYTE SRB_Flags; // Reserved
- DWORD SRB_Hdr_Rsvd; // Reserved
- BYTE SRB_Target; // Target's SCSI ID
- BYTE SRB_Lun; // Target's LUN number
- BYTE SRB_Rsvd1[12]; // Reserved for Alignment
- BYTE SRB_HaStat; // Host Adapter Status
- BYTE SRB_TargStat; // Target Status
- void *SRB_PostProc; // Post routine
- void *SRB_Rsvd2; // Reserved
- BYTE SRB_Rsvd3[32]; // Reserved
- } SRB_BusDeviceReset, *PSRB_BusDeviceReset;
- extern DWORD (*GetASPI32SupportInfo)( void );
- extern DWORD (*SendASPI32Command)(LPSRB lpSRB );
- extern BOOLEAN LoadASPIManager(void);
- extern void ReleaseASPIManager(void);
- #define ASPI_STATUS(dwStatus) (HIBYTE(LOWORD(dwStatus)))
- #define ASPI_HOST_ADAPTER_NUM(dwStatus) (LOBYTE(LOWORD(dwStatus)))
- extern
- BYTE SCSI_HA_INQUERY(BYTE HostAdapterID,
- SRB_HAInquiry *lpsrb);
- extern
- BYTE SCSI_GET_DEV_TYPE(BYTE HostAdapterID,
- BYTE TargetID,
- BYTE LUN,
- BYTE *pbDeviceType);
- extern
- DWORD SCSI_EXEC_SCSI_CMD(SRB_ExecSCSICmd *lpsrb);
- extern BYTE SCSI_RESET_DEV(BYTE HostAdapterID,
- BYTE TargetID,
- BYTE LUN);
- extern
- BYTE IO_TAPE_REWIND(BYTE HostAdapterID,
- BYTE TargetID,
- BYTE LUN);
- extern
- BYTE IO_TAPE_LOAD(BYTE HostAdapterID,
- BYTE TargetID,
- BYTE LUN,
- BOOLEAN EOT,
- BOOLEAN ReTen,
- BOOLEAN LOAD);
- extern
- BYTE IO_ALL_TEST_UNIT_READY(BYTE HostAdapterID,
- BYTE TargetID,
- BYTE LUN);
- extern
- BYTE IO_TAPE_READ_BLOCK_LIMIT(BYTE HostAdapterID,
- BYTE TargetID,
- BYTE LUN,
- int *pnMaxBlockSize,
- int *pnMinBlockSize);
- extern
- BYTE IO_TAPE_READ(BYTE HostAdapterID,
- BYTE TargetID,
- BYTE LUN,
- DWORD dwBufLen,
- void *pvBuf,
- int *pnBlockLen, // 数据块的实际长度
- BOOLEAN *pbFileMark,
- BOOLEAN *pbEOM,
- BOOLEAN *pbILI,
- BOOLEAN *pbValid,
- BYTE *pbSensekey);
- #endif