--- hatari/src/includes/hdc.h 2019/04/01 07:10:03 1.1.1.1 +++ hatari/src/includes/hdc.h 2019/04/01 07:13:09 1.1.1.4 @@ -1,11 +1,16 @@ /* - Hatari - - This file contains definitios used for hardware-level - harddrive emulation + Hatari - hdc.h + This file is distributed under the GNU Public License, version 2 or at + your option any later version. Read the file gpl.txt for details. + + This file contains definitions which are used for hardware-level + harddrive emulation. */ +#ifndef HATARI_HDC_H +#define HATARI_HDC_H + /* HD Command packet macros */ #define HD_OPCODE(a) (a.command[0] & 0x1F) /* get opcode (bit 0-4) */ @@ -28,19 +33,29 @@ #define HD_WRITE_SECTOR 0x0A /* Write sector */ /* other codes */ +#define HD_FORMAT_DRIVE 0x04 /* Format the whole drive */ #define HD_SEEK 0x0B /* Seek */ #define HD_CORRECTION 0x0D /* Correction */ #define HD_INQUIRY 0x12 /* Inquiry */ +#define HD_MODESELECT 0x15 /* Mode select */ #define HD_MODESENSE 0x1A /* Mode sense */ #define HD_REQ_SENSE 0x03 /* Request sense */ #define HD_SHIP 0x1B /* Ship drive */ -#define HD_STATUS_OK 0 /* OK return status */ -#define HD_STATUS_NODRIVE 0x25 /* Invalid drive */ -#define HD_STATUS_OPCODE 0x20 /* Opcode not supported */ +/* Status codes */ +#define HD_STATUS_OK 0x00 +#define HD_STATUS_ERROR 0x02 +#define HD_STATUS_BUSY 0x08 + +/* Error codes for REQUEST SENSE: */ +#define HD_REQSENS_OK 0x00 /* OK return status */ +#define HD_REQSENS_OPCODE 0x20 /* Opcode not supported */ +#define HD_REQSENS_INVADDR 0x21 /* Invalid block address */ +#define HD_REQSENS_INVARG 0x24 /* Invalid argument */ +#define HD_REQSENS_NODRIVE 0x25 /* Invalid drive */ + +#define ACSI_EMU_ON bAcsiEmuOn /* Do we have HDC emulation? */ -#define ACSI_EMU_ON (nPartitions != 0) -/* do we have hdc emulation */ /* Structure representing an ACSI command block. */ @@ -54,7 +69,12 @@ extern FILE *hd_image_file; extern HDCOMMAND HDCCommand; extern short int HDCSectorCount; extern int nPartitions; +extern BOOL bAcsiEmuOn; + +extern BOOL HDC_Init(char *filename); +extern void HDC_UnInit(void); +extern void HDC_WriteCommandPacket(void); +extern void HDC_DebugCommandPacket(FILE *hdlogFile); +extern void HDC_EmulateCommandPacket(void); -extern void HDC_WriteCommandPacket(); -extern void HDC_DebugCommandPacket(); -extern void HDC_EmulateCommandPacket(); +#endif /* HATARI_HDC_H */