| version 1.1, 2004/03/19 03:36:52 | version 1.7, 2005/03/05 11:58:02 | 
| Line 1 | Line 1 | 
 |  |  | 
 |  | #define IDEIO_MULTIPLE_MAX      0 | 
 |  | #define IDEIO_BUFSIZE_MAX       4096 | 
 |  |  | 
 |  | #define IDEIO_MEDIA_EJECTABLE   (1 << 7) | 
 |  | #define IDEIO_MEDIA_PREVENT             (1 << 6) | 
 |  | #define IDEIO_MEDIA_PERSIST             (1 << 5) | 
 |  | #define IDEIO_MEDIA_CHANGED             (1 << 1) | 
 |  | #define IDEIO_MEDIA_LOADED              (1 << 0) | 
 |  |  | 
 | typedef struct { | typedef struct { | 
 | UINT8   sxsidrv; | UINT8   sxsidrv; | 
 |  |  | 
 | UINT8   wp; | UINT8   wp; | 
 | UINT8   dr; | UINT8   dr; | 
 | UINT8   hd; | UINT8   hd; | 
| Line 17  typedef struct { | Line 27  typedef struct { | 
 | UINT8   surfaces; | UINT8   surfaces; | 
 | UINT8   sectors; | UINT8   sectors; | 
 | UINT8   bufdir; | UINT8   bufdir; | 
 |  | UINT8   buftc; | 
 |  |  | 
 |  | // for ATA multiple mode | 
 |  | UINT8   mulcnt; | 
 |  | UINT8   multhr; | 
 |  | UINT8   mulmode; | 
 |  |  | 
 |  | // for ATAPI | 
 |  | UINT8   media; | 
 |  | UINT8   sk;             // sense key | 
 |  | UINT16  asc;    // additional sense code (LSB) & qualifer (MSB) | 
 |  |  | 
 |  | UINT32  sector;         // アクセスセクタ (LBA) | 
 |  | UINT32  nsectors;       // 総セクタ数 | 
 |  | UINT16  secsize;        // セクタサイズ | 
 |  | UINT16  dmy; | 
 |  |  | 
 |  | // buffer management | 
 | UINT    bufpos; | UINT    bufpos; | 
 | UINT    bufsize; | UINT    bufsize; | 
| BYTE    buf[512]; | UINT8   buf[IDEIO_BUFSIZE_MAX]; | 
 | } _IDEDRV, *IDEDRV; | } _IDEDRV, *IDEDRV; | 
 |  |  | 
 | typedef struct { | typedef struct { | 
| Line 44  enum { | Line 71  enum { | 
 |  |  | 
 | IDEDIR_NONE                     = 0, | IDEDIR_NONE                     = 0, | 
 | IDEDIR_OUT                      = 1, | IDEDIR_OUT                      = 1, | 
| IDEDIR_IN                       = 2 | IDEDIR_IN                       = 2, | 
|  |  | 
|  | IDETC_TRANSFEREND       = 0, | 
|  | IDETC_ATAPIREAD         = 1 | 
 | }; | }; | 
 |  |  | 
 | // error | // error | 
| //      bit7: Bad Block detected | //  bit7: Bad Block detected | 
 | //  bit6: Data ECC error | //  bit6: Data ECC error | 
 | //  bit4: ID Not Found | //  bit4: ID Not Found | 
 | //  bit2: Aborted command | //  bit2: Aborted command | 
| Line 64  enum { | Line 94  enum { | 
 | IDEERR_AMNF                     = 0x01 | IDEERR_AMNF                     = 0x01 | 
 | }; | }; | 
 |  |  | 
| enum { | // interrupt reason (sector count) | 
| IDEINTR_IO                      = 0x02, | //  bit7-3: tag | 
| IDEINTR_CD                      = 0x01 | //  bit2: bus release | 
|  | //  bit1: input/output | 
|  | //  bit0: command/data | 
|  | // | 
|  | enum { | 
|  | IDEINTR_REL                     = 0x04, | 
|  | IDEINTR_IO                      = 0x02, // 0: host->device, 1: device->host | 
|  | IDEINTR_CD                      = 0x01  // 0: data, 1: command | 
 | }; | }; | 
 |  |  | 
 | // status | // status | 
| //      bit7: Busy | //  bit7: Busy | 
 | //  bit6: Drive Ready | //  bit6: Drive Ready | 
 | //  bit5: Drive Write Fault | //  bit5: Drive Write Fault | 
 | //  bit4: Drive Seek Complete | //  bit4: Drive Seek Complete | 
| Line 88  enum { | Line 125  enum { | 
 | IDESTAT_CORR            = 0x04, | IDESTAT_CORR            = 0x04, | 
 | IDESTAT_INDX            = 0x02, | IDESTAT_INDX            = 0x02, | 
 | IDESTAT_ERR                     = 0x01, | IDESTAT_ERR                     = 0x01, | 
 |  |  | 
 |  | // for ATAPI PACKET | 
 |  | IDESTAT_DMRD            = 0x20,         // DMA Ready | 
 |  | IDESTAT_SERV            = 0x10,         // Service | 
 |  | IDESTAT_CHK                     = 0x01 | 
 | }; | }; | 
 |  |  | 
 |  | // device/head | 
 |  | //  bit6: LBA (for read/write sector(s)/multiple) | 
 |  | //  bit4: master/slave device select | 
 |  |  | 
 | enum { | enum { | 
 | IDEDEV_LBA                      = 0x40, | IDEDEV_LBA                      = 0x40, | 
 | IDEDEV_DEV                      = 0x10 | IDEDEV_DEV                      = 0x10 | 
 | }; | }; | 
 |  |  | 
 | // control | // control | 
| //      bit2: Software Reset | //  bit2: Software Reset | 
 | //  bit1: ~Interrupt Enable | //  bit1: ~Interrupt Enable | 
 |  |  | 
 | enum { | enum { | 
| Line 105  enum { | Line 151  enum { | 
 | }; | }; | 
 |  |  | 
 |  |  | 
 |  |  | 
 | #ifdef __cplusplus | #ifdef __cplusplus | 
 | extern "C" { | extern "C" { | 
 | #endif | #endif | 
| Line 113  extern "C" { | Line 158  extern "C" { | 
 | extern  IDEIO   ideio; | extern  IDEIO   ideio; | 
 |  |  | 
 | void IOOUTCALL ideio_w16(UINT port, REG16 value); | void IOOUTCALL ideio_w16(UINT port, REG16 value); | 
| REG16 IOOUTCALL ideio_r16(UINT port); | REG16 IOINPCALL ideio_r16(UINT port); | 
 |  |  | 
 | void ideio_reset(void); | void ideio_reset(void); | 
 | void ideio_bind(void); | void ideio_bind(void); | 
 |  | void ideio_notify(REG8 sxsidrv, UINT action); | 
 |  |  | 
 | #ifdef __cplusplus | #ifdef __cplusplus | 
 | } | } |