Annotation of hatari/src/includes/hdc.h, revision 1.1.1.13

1.1       root        1: /*
1.1.1.3   root        2:   Hatari - hdc.h
                      3: 
1.1.1.9   root        4:   This file is distributed under the GNU General Public License, version 2
                      5:   or at your option any later version. Read the file gpl.txt for details.
1.1       root        6: 
1.1.1.4   root        7:   This file contains definitions which are used for hardware-level
1.1.1.3   root        8:   harddrive emulation.
1.1       root        9: */
                     10: 
1.1.1.3   root       11: #ifndef HATARI_HDC_H
                     12: #define HATARI_HDC_H
                     13: 
1.1       root       14: 
                     15: /* Opcodes */
                     16: /* The following are multi-sector transfers with seek implied */
                     17: #define HD_VERIFY_TRACK    0x05               /* Verify track */
                     18: #define HD_FORMAT_TRACK    0x06               /* Format track */
                     19: #define HD_READ_SECTOR     0x08               /* Read sector */
1.1.1.8   root       20: #define HD_READ_SECTOR1    0x28               /* Read sector (class 1) */
1.1       root       21: #define HD_WRITE_SECTOR    0x0A               /* Write sector */
1.1.1.8   root       22: #define HD_WRITE_SECTOR1   0x2A               /* Write sector (class 1) */
1.1       root       23: 
                     24: /* other codes */
1.1.1.7   root       25: #define HD_TEST_UNIT_RDY   0x00               /* Test unit ready */
1.1.1.4   root       26: #define HD_FORMAT_DRIVE    0x04               /* Format the whole drive */
1.1       root       27: #define HD_SEEK            0x0B               /* Seek */
                     28: #define HD_CORRECTION      0x0D               /* Correction */
                     29: #define HD_INQUIRY         0x12               /* Inquiry */
1.1.1.4   root       30: #define HD_MODESELECT      0x15               /* Mode select */
1.1       root       31: #define HD_MODESENSE       0x1A               /* Mode sense */
                     32: #define HD_REQ_SENSE       0x03               /* Request sense */
                     33: #define HD_SHIP            0x1B               /* Ship drive */
1.1.1.8   root       34: #define HD_READ_CAPACITY1  0x25               /* Read capacity (class 1) */
1.1       root       35: 
1.1.1.4   root       36: /* Status codes */
                     37: #define HD_STATUS_OK       0x00
                     38: #define HD_STATUS_ERROR    0x02
                     39: #define HD_STATUS_BUSY     0x08
                     40: 
                     41: /* Error codes for REQUEST SENSE: */
1.1.1.6   root       42: #define HD_REQSENS_OK       0x00              /* OK return status */
                     43: #define HD_REQSENS_NOSECTOR 0x01              /* No index or sector */
                     44: #define HD_REQSENS_WRITEERR 0x03              /* Write fault */
                     45: #define HD_REQSENS_OPCODE   0x20              /* Opcode not supported */
                     46: #define HD_REQSENS_INVADDR  0x21              /* Invalid block address */
                     47: #define HD_REQSENS_INVARG   0x24              /* Invalid argument */
1.1.1.10  root       48: #define HD_REQSENS_INVLUN   0x25              /* Invalid LUN */
1.1.1.4   root       49: 
1.1.1.13! root       50: /**
        !            51:  * Information about a ACSI/SCSI drive
        !            52:  */
        !            53: typedef struct scsi_data {
        !            54:        bool enabled;
        !            55:        FILE *image_file;
        !            56:        Uint32 nLastBlockAddr;      /* The specified sector number */
        !            57:        bool bSetLastBlockAddr;
        !            58:        Uint8 nLastError;
        !            59:        unsigned long hdSize;       /* Size of the hard disk in sectors */
        !            60:        unsigned long blockSize;    /* Size of a sector in bytes */
        !            61:        /* For NCR5380 emulation: */
        !            62:        int direction;
        !            63:        Uint8 msgout[4];
        !            64:        Uint8 cmd[16];
        !            65:        int cmd_len;
        !            66: } SCSI_DEV;
        !            67: 
        !            68: /**
        !            69:  * Status of the ACSI/SCSI bus/controller including the current command block.
        !            70:  */
        !            71: typedef struct {
        !            72:        const char *typestr;        /* "ACSI" or "SCSI" */
        !            73:        int target;
        !            74:        int byteCount;              /* number of command bytes received */
        !            75:        Uint8 command[16];
        !            76:        Uint8 opcode;
        !            77:        bool bDmaError;
        !            78:        short int status;           /* return code from the HDC operation */
        !            79:        Uint8 *buffer;              /* Response buffer */
        !            80:        int buffer_size;
        !            81:        int data_len;
        !            82:        int offset;                 /* Current offset into data buffer */
        !            83:        FILE *dmawrite_to_fh;
        !            84:        SCSI_DEV devs[8];
        !            85: } SCSI_CTRLR;
        !            86: 
1.1.1.4   root       87: #define ACSI_EMU_ON        bAcsiEmuOn         /* Do we have HDC emulation? */
1.1       root       88: 
1.1.1.11  root       89: extern int nAcsiPartitions;
1.1.1.5   root       90: extern bool bAcsiEmuOn;
1.1       root       91: 
1.1.1.8   root       92: /**
                     93:  * API.
                     94:  */
1.1.1.7   root       95: extern bool HDC_Init(void);
1.1.1.3   root       96: extern void HDC_UnInit(void);
1.1.1.13! root       97: extern int HDC_InitDevice(SCSI_DEV *dev, char *filename, unsigned long blockSize);
1.1.1.8   root       98: extern void HDC_ResetCommandStatus(void);
1.1.1.10  root       99: extern short int HDC_ReadCommandByte(int addr);
                    100: extern void HDC_WriteCommandByte(int addr, Uint8 byte);
1.1.1.13! root      101: extern int HDC_PartitionCount(FILE *fp, const Uint64 tracelevel, int *pIsByteSwapped);
        !           102: extern off_t HDC_CheckAndGetSize(const char *filename, unsigned long blockSize);
        !           103: extern bool HDC_WriteCommandPacket(SCSI_CTRLR *ctr, Uint8 b);
        !           104: extern void HDC_DmaTransfer(void);
1.1.1.3   root      105: 
                    106: #endif /* HATARI_HDC_H */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.