--- hatari/src/includes/hdc.h 2019/04/09 08:54:31 1.1.1.10 +++ hatari/src/includes/hdc.h 2019/04/09 08:59:28 1.1.1.13 @@ -47,9 +47,46 @@ #define HD_REQSENS_INVARG 0x24 /* Invalid argument */ #define HD_REQSENS_INVLUN 0x25 /* Invalid LUN */ +/** + * Information about a ACSI/SCSI drive + */ +typedef struct scsi_data { + bool enabled; + FILE *image_file; + Uint32 nLastBlockAddr; /* The specified sector number */ + bool bSetLastBlockAddr; + Uint8 nLastError; + unsigned long hdSize; /* Size of the hard disk in sectors */ + unsigned long blockSize; /* Size of a sector in bytes */ + /* For NCR5380 emulation: */ + int direction; + Uint8 msgout[4]; + Uint8 cmd[16]; + int cmd_len; +} SCSI_DEV; + +/** + * Status of the ACSI/SCSI bus/controller including the current command block. + */ +typedef struct { + const char *typestr; /* "ACSI" or "SCSI" */ + int target; + int byteCount; /* number of command bytes received */ + Uint8 command[16]; + Uint8 opcode; + bool bDmaError; + short int status; /* return code from the HDC operation */ + Uint8 *buffer; /* Response buffer */ + int buffer_size; + int data_len; + int offset; /* Current offset into data buffer */ + FILE *dmawrite_to_fh; + SCSI_DEV devs[8]; +} SCSI_CTRLR; + #define ACSI_EMU_ON bAcsiEmuOn /* Do we have HDC emulation? */ -extern int nPartitions; +extern int nAcsiPartitions; extern bool bAcsiEmuOn; /** @@ -57,10 +94,13 @@ extern bool bAcsiEmuOn; */ extern bool HDC_Init(void); extern void HDC_UnInit(void); +extern int HDC_InitDevice(SCSI_DEV *dev, char *filename, unsigned long blockSize); extern void HDC_ResetCommandStatus(void); extern short int HDC_ReadCommandByte(int addr); extern void HDC_WriteCommandByte(int addr, Uint8 byte); - -void Ncr5380_Reset(void); +extern int HDC_PartitionCount(FILE *fp, const Uint64 tracelevel, int *pIsByteSwapped); +extern off_t HDC_CheckAndGetSize(const char *filename, unsigned long blockSize); +extern bool HDC_WriteCommandPacket(SCSI_CTRLR *ctr, Uint8 b); +extern void HDC_DmaTransfer(void); #endif /* HATARI_HDC_H */