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

1.1       root        1: /*
                      2:   Hatari
                      3:   
                      4:   This file contains definitios used for hardware-level
                      5:   harddrive emulation
                      6: 
                      7: */
                      8: 
                      9: 
                     10: /* HD Command packet macros */
                     11: #define HD_OPCODE(a) (a.command[0] & 0x1F)             /* get opcode (bit 0-4) */
                     12: #define HD_CONTROLLER(a) ((a.command[0] & 0xE0)>>5)    /* get HD controller # (5-7) */
                     13: #define HD_DRIVENUM(a) ((a.command[1] & 0xE0) >>5)     /* get drive # (5-7) */
                     14: 
                     15: #define HD_LBA_MSB(a) ((unsigned) a.command[1] & 0x1F) /* Logical Block adress, MSB */
                     16: #define HD_LBA_MID(a) ((unsigned) a.command[2])        /* Logical Block adress */
                     17: #define HD_LBA_LSB(a) ((unsigned) a.command[3])        /* Logical Block adress, LSB */
                     18: 
                     19: #define HD_SECTORCOUNT(a) (a.command[4] & 0xFF)        /* get sector count */
                     20: #define HD_CONTROL(a) (a.command[5] & 0xFF)            /* get control byte */
                     21: 
                     22: 
                     23: /* Opcodes */
                     24: /* The following are multi-sector transfers with seek implied */
                     25: #define HD_VERIFY_TRACK    0x05               /* Verify track */
                     26: #define HD_FORMAT_TRACK    0x06               /* Format track */
                     27: #define HD_READ_SECTOR     0x08               /* Read sector */
                     28: #define HD_WRITE_SECTOR    0x0A               /* Write sector */
                     29: 
                     30: /* other codes */
                     31: #define HD_SEEK            0x0B               /* Seek */
                     32: #define HD_CORRECTION      0x0D               /* Correction */
                     33: #define HD_INQUIRY         0x12               /* Inquiry */
                     34: #define HD_MODESENSE       0x1A               /* Mode sense */
                     35: #define HD_REQ_SENSE       0x03               /* Request sense */
                     36: #define HD_SHIP            0x1B               /* Ship drive */
                     37: 
                     38: #define HD_STATUS_OK          0               /* OK return status */
                     39: #define HD_STATUS_NODRIVE  0x25               /* Invalid drive */
                     40: #define HD_STATUS_OPCODE   0x20               /* Opcode not supported */
                     41: 
                     42: #define ACSI_EMU_ON         (nPartitions != 0) 
                     43: /* do we have hdc emulation */
                     44: /* 
                     45:    Structure representing an ACSI command block.
                     46: */
                     47: typedef struct {
                     48:   int byteCount;         /* count of number of command bytes written */
                     49:   unsigned char command[6]; 
                     50:   short int returnCode;  /* return code from the HDC operation */
                     51: } HDCOMMAND;
                     52: 
                     53: extern FILE *hd_image_file;
                     54: extern HDCOMMAND HDCCommand;
                     55: extern short int HDCSectorCount;
                     56: extern int nPartitions;
                     57: 
                     58: extern void HDC_WriteCommandPacket();
                     59: extern void HDC_DebugCommandPacket();
                     60: extern void HDC_EmulateCommandPacket();

unix.superglobalmegacorp.com

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