#ifndef __FREEBSDSCSI_H__ #define __FREEBSDSCSI_H__ #include #include #include #include #include #include #include #include #include /* File control definitions */ #include /* Error number definitions */ #include /* fork() */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "commdef.h" #include "interface.h" #include "arclib.h" #define SCSI_INQUIRY 0x12 #define SCSI_WRITE_BUF 0x3B #define SCSI_READ_BUF 0x3C #define SENSE_LEN 14 #define CDB_SIZE 10 #define BUF_SIZE 2048 typedef struct { BYTE ErrorCode; // Error Code (70H or 71H) BYTE SegmentNum; // Number of current segment descriptor BYTE SenseKey; // Sense Key(See bit definitions too) BYTE InfoByte0; // Information MSB BYTE InfoByte1; // Information MID BYTE InfoByte2; // Information MID BYTE InfoByte3; // Information LSB BYTE AddSenLen; // Additional Sense Length BYTE ComSpecInf0; // Command Specific Information MSB BYTE ComSpecInf1; // Command Specific Information MID BYTE ComSpecInf2; // Command Specific Information MID BYTE ComSpecInf3; // Command Specific Information LSB BYTE AddSenseCode; // Additional Sense Code BYTE AddSenQual; // Additional Sense Code Qualifier BYTE FieldRepUCode; // Field Replaceable Unit Code BYTE SenKeySpec15; // Sense Key Specific 15th byte BYTE SenKeySpec16; // Sense Key Specific 16th byte BYTE SenKeySpec17; // Sense Key Specific 17th byte BYTE AddSenseBytes; // Additional Sense Bytes } sSENSE_DATA_FMT, *pSENSE_DATA_FMT; class FreeBSDSCSIInterface : public ArcInterface { public: FreeBSDSCSIInterface(); ~FreeBSDSCSIInterface(); bool init(const int nScsiPort); int send(sIF_CMD_BLOCK *ifData); int recv(sIF_CMD_BLOCK *ifData); int syncSend(sIF_CMD_BLOCK *ifData); int syncSend(const char *outBuf, int outLen, char *inBuf, int inLen, void *extdata = 0); void requirelock(); void releaselock(); int getMTU(); void *getDeviceHandle(); private: HANDLE m_hScsi; cam_device *arc_device; int fd; pthread_mutex_t mut; }; #endif