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

1.1       root        1: /*
1.1.1.3   root        2:   Hatari - hdc.h
                      3: 
                      4:   This file is distributed under the GNU Public License, version 2 or at
                      5:   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: /* HD Command packet macros */
                     16: #define HD_OPCODE(a) (a.command[0] & 0x1F)             /* get opcode (bit 0-4) */
1.1.1.7 ! root       17: #define HD_TARGET(a) ((a.command[0] & 0xE0)>>5)        /* get HD target # (5-7) */
        !            18: #define HD_DEVICE(a) ((a.command[1] & 0xE0) >>5)       /* get device # (5-7) */
1.1       root       19: 
                     20: #define HD_LBA_MSB(a) ((unsigned) a.command[1] & 0x1F) /* Logical Block adress, MSB */
                     21: #define HD_LBA_MID(a) ((unsigned) a.command[2])        /* Logical Block adress */
                     22: #define HD_LBA_LSB(a) ((unsigned) a.command[3])        /* Logical Block adress, LSB */
                     23: 
                     24: #define HD_SECTORCOUNT(a) (a.command[4] & 0xFF)        /* get sector count */
                     25: #define HD_CONTROL(a) (a.command[5] & 0xFF)            /* get control byte */
                     26: 
                     27: 
                     28: /* Opcodes */
                     29: /* The following are multi-sector transfers with seek implied */
                     30: #define HD_VERIFY_TRACK    0x05               /* Verify track */
                     31: #define HD_FORMAT_TRACK    0x06               /* Format track */
                     32: #define HD_READ_SECTOR     0x08               /* Read sector */
                     33: #define HD_WRITE_SECTOR    0x0A               /* Write sector */
                     34: 
                     35: /* other codes */
1.1.1.7 ! root       36: #define HD_TEST_UNIT_RDY   0x00               /* Test unit ready */
1.1.1.4   root       37: #define HD_FORMAT_DRIVE    0x04               /* Format the whole drive */
1.1       root       38: #define HD_SEEK            0x0B               /* Seek */
                     39: #define HD_CORRECTION      0x0D               /* Correction */
                     40: #define HD_INQUIRY         0x12               /* Inquiry */
1.1.1.4   root       41: #define HD_MODESELECT      0x15               /* Mode select */
1.1       root       42: #define HD_MODESENSE       0x1A               /* Mode sense */
                     43: #define HD_REQ_SENSE       0x03               /* Request sense */
                     44: #define HD_SHIP            0x1B               /* Ship drive */
                     45: 
1.1.1.4   root       46: /* Status codes */
                     47: #define HD_STATUS_OK       0x00
                     48: #define HD_STATUS_ERROR    0x02
                     49: #define HD_STATUS_BUSY     0x08
                     50: 
                     51: /* Error codes for REQUEST SENSE: */
1.1.1.6   root       52: #define HD_REQSENS_OK       0x00              /* OK return status */
                     53: #define HD_REQSENS_NOSECTOR 0x01              /* No index or sector */
                     54: #define HD_REQSENS_WRITEERR 0x03              /* Write fault */
                     55: #define HD_REQSENS_OPCODE   0x20              /* Opcode not supported */
                     56: #define HD_REQSENS_INVADDR  0x21              /* Invalid block address */
                     57: #define HD_REQSENS_INVARG   0x24              /* Invalid argument */
                     58: #define HD_REQSENS_NODRIVE  0x25              /* Invalid drive */
1.1.1.4   root       59: 
                     60: #define ACSI_EMU_ON        bAcsiEmuOn         /* Do we have HDC emulation? */
1.1       root       61: 
                     62: /* 
                     63:    Structure representing an ACSI command block.
                     64: */
                     65: typedef struct {
                     66:   int byteCount;         /* count of number of command bytes written */
                     67:   unsigned char command[6]; 
                     68:   short int returnCode;  /* return code from the HDC operation */
                     69: } HDCOMMAND;
                     70: 
                     71: extern HDCOMMAND HDCCommand;
                     72: extern short int HDCSectorCount;
                     73: extern int nPartitions;
1.1.1.5   root       74: extern bool bAcsiEmuOn;
1.1       root       75: 
1.1.1.7 ! root       76: extern bool HDC_Init(void);
1.1.1.3   root       77: extern void HDC_UnInit(void);
                     78: extern void HDC_WriteCommandPacket(void);
                     79: 
                     80: #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.