trunk/src/emu/machine/idectrl.c
| r17899 | r17900 | |
| 26 | 26 | CONSTANTS |
| 27 | 27 | ***************************************************************************/ |
| 28 | 28 | |
| 29 | | #define MINIMUM_COMMAND_TIME (attotime::from_usec(10)) |
| 29 | #define MINIMUM_COMMAND_TIME (attotime::from_usec(10)) |
| 30 | 30 | |
| 31 | | #define TIME_PER_SECTOR (attotime::from_usec(100)) |
| 32 | | #define TIME_PER_ROTATION (attotime::from_hz(5400/60)) |
| 33 | | #define TIME_SECURITY_ERROR (attotime::from_msec(1000)) |
| 31 | #define TIME_PER_SECTOR (attotime::from_usec(100)) |
| 32 | #define TIME_PER_ROTATION (attotime::from_hz(5400/60)) |
| 33 | #define TIME_SECURITY_ERROR (attotime::from_msec(1000)) |
| 34 | 34 | |
| 35 | | #define TIME_SEEK_MULTISECTOR (attotime::from_msec(13)) |
| 36 | | #define TIME_NO_SEEK_MULTISECTOR (attotime::from_nsec(16300)) |
| 35 | #define TIME_SEEK_MULTISECTOR (attotime::from_msec(13)) |
| 36 | #define TIME_NO_SEEK_MULTISECTOR (attotime::from_nsec(16300)) |
| 37 | 37 | |
| 38 | | #define IDE_STATUS_ERROR 0x01 |
| 39 | | #define IDE_STATUS_HIT_INDEX 0x02 |
| 40 | | #define IDE_STATUS_BUFFER_READY 0x08 |
| 41 | | #define IDE_STATUS_SEEK_COMPLETE 0x10 |
| 42 | | #define IDE_STATUS_DRIVE_READY 0x40 |
| 43 | | #define IDE_STATUS_BUSY 0x80 |
| 38 | #define IDE_STATUS_ERROR 0x01 |
| 39 | #define IDE_STATUS_HIT_INDEX 0x02 |
| 40 | #define IDE_STATUS_BUFFER_READY 0x08 |
| 41 | #define IDE_STATUS_SEEK_COMPLETE 0x10 |
| 42 | #define IDE_STATUS_DRIVE_READY 0x40 |
| 43 | #define IDE_STATUS_BUSY 0x80 |
| 44 | 44 | |
| 45 | | #define IDE_CONFIG_REGISTERS 0x10 |
| 45 | #define IDE_CONFIG_REGISTERS 0x10 |
| 46 | 46 | |
| 47 | 47 | #define BANK(b, v) (((v) << 4) | (b)) |
| 48 | 48 | |
| 49 | | #define IDE_BANK0_DATA BANK(0, 0) |
| 50 | | #define IDE_BANK0_ERROR BANK(0, 1) |
| 51 | | #define IDE_BANK0_SECTOR_COUNT BANK(0, 2) |
| 52 | | #define IDE_BANK0_SECTOR_NUMBER BANK(0, 3) |
| 53 | | #define IDE_BANK0_CYLINDER_LSB BANK(0, 4) |
| 54 | | #define IDE_BANK0_CYLINDER_MSB BANK(0, 5) |
| 55 | | #define IDE_BANK0_HEAD_NUMBER BANK(0, 6) |
| 56 | | #define IDE_BANK0_STATUS_COMMAND BANK(0, 7) |
| 49 | #define IDE_BANK0_DATA BANK(0, 0) |
| 50 | #define IDE_BANK0_ERROR BANK(0, 1) |
| 51 | #define IDE_BANK0_SECTOR_COUNT BANK(0, 2) |
| 52 | #define IDE_BANK0_SECTOR_NUMBER BANK(0, 3) |
| 53 | #define IDE_BANK0_CYLINDER_LSB BANK(0, 4) |
| 54 | #define IDE_BANK0_CYLINDER_MSB BANK(0, 5) |
| 55 | #define IDE_BANK0_HEAD_NUMBER BANK(0, 6) |
| 56 | #define IDE_BANK0_STATUS_COMMAND BANK(0, 7) |
| 57 | 57 | |
| 58 | | #define IDE_BANK1_STATUS_CONTROL BANK(1, 6) |
| 58 | #define IDE_BANK1_STATUS_CONTROL BANK(1, 6) |
| 59 | 59 | |
| 60 | | #define IDE_BANK2_CONFIG_UNK BANK(2, 4) |
| 61 | | #define IDE_BANK2_CONFIG_REGISTER BANK(2, 8) |
| 62 | | #define IDE_BANK2_CONFIG_DATA BANK(2, 0xc) |
| 60 | #define IDE_BANK2_CONFIG_UNK BANK(2, 4) |
| 61 | #define IDE_BANK2_CONFIG_REGISTER BANK(2, 8) |
| 62 | #define IDE_BANK2_CONFIG_DATA BANK(2, 0xc) |
| 63 | 63 | |
| 64 | | #define IDE_COMMAND_READ_MULTIPLE 0x20 |
| 65 | | #define IDE_COMMAND_READ_MULTIPLE_ONCE 0x21 |
| 66 | | #define IDE_COMMAND_WRITE_MULTIPLE 0x30 |
| 67 | | #define IDE_COMMAND_DIAGNOSTIC 0x90 |
| 68 | | #define IDE_COMMAND_SET_CONFIG 0x91 |
| 69 | | #define IDE_COMMAND_READ_MULTIPLE_BLOCK 0xc4 |
| 70 | | #define IDE_COMMAND_WRITE_MULTIPLE_BLOCK 0xc5 |
| 71 | | #define IDE_COMMAND_SET_BLOCK_COUNT 0xc6 |
| 72 | | #define IDE_COMMAND_READ_DMA 0xc8 |
| 73 | | #define IDE_COMMAND_WRITE_DMA 0xca |
| 74 | | #define IDE_COMMAND_GET_INFO 0xec |
| 75 | | #define IDE_COMMAND_SET_FEATURES 0xef |
| 76 | | #define IDE_COMMAND_SECURITY_UNLOCK 0xf2 |
| 77 | | #define IDE_COMMAND_UNKNOWN_F9 0xf9 |
| 78 | | #define IDE_COMMAND_VERIFY_MULTIPLE 0x40 |
| 79 | | #define IDE_COMMAND_VERIFY_NORETRY 0x41 |
| 80 | | #define IDE_COMMAND_ATAPI_IDENTIFY 0xa1 |
| 81 | | #define IDE_COMMAND_RECALIBRATE 0x10 |
| 82 | | #define IDE_COMMAND_SEEK 0x70 |
| 83 | | #define IDE_COMMAND_IDLE_IMMEDIATE 0xe1 |
| 84 | | #define IDE_COMMAND_IDLE 0xe3 |
| 85 | | #define IDE_COMMAND_TAITO_GNET_UNLOCK_1 0xfe |
| 86 | | #define IDE_COMMAND_TAITO_GNET_UNLOCK_2 0xfc |
| 87 | | #define IDE_COMMAND_TAITO_GNET_UNLOCK_3 0x0f |
| 64 | #define IDE_COMMAND_READ_MULTIPLE 0x20 |
| 65 | #define IDE_COMMAND_READ_MULTIPLE_NORETRY 0x21 |
| 66 | #define IDE_COMMAND_WRITE_MULTIPLE 0x30 |
| 67 | #define IDE_COMMAND_WRITE_MULTIPLE_NORETRY 0x31 |
| 68 | #define IDE_COMMAND_DIAGNOSTIC 0x90 |
| 69 | #define IDE_COMMAND_SET_CONFIG 0x91 |
| 70 | #define IDE_COMMAND_READ_MULTIPLE_BLOCK 0xc4 |
| 71 | #define IDE_COMMAND_WRITE_MULTIPLE_BLOCK 0xc5 |
| 72 | #define IDE_COMMAND_SET_BLOCK_COUNT 0xc6 |
| 73 | #define IDE_COMMAND_READ_DMA 0xc8 |
| 74 | #define IDE_COMMAND_WRITE_DMA 0xca |
| 75 | #define IDE_COMMAND_GET_INFO 0xec |
| 76 | #define IDE_COMMAND_SET_FEATURES 0xef |
| 77 | #define IDE_COMMAND_SECURITY_UNLOCK 0xf2 |
| 78 | #define IDE_COMMAND_UNKNOWN_F9 0xf9 |
| 79 | #define IDE_COMMAND_VERIFY_MULTIPLE 0x40 |
| 80 | #define IDE_COMMAND_VERIFY_NORETRY 0x41 |
| 81 | #define IDE_COMMAND_ATAPI_IDENTIFY 0xa1 |
| 82 | #define IDE_COMMAND_RECALIBRATE 0x10 |
| 83 | #define IDE_COMMAND_SEEK 0x70 |
| 84 | #define IDE_COMMAND_IDLE_IMMEDIATE 0xe1 |
| 85 | #define IDE_COMMAND_IDLE 0xe3 |
| 86 | #define IDE_COMMAND_TAITO_GNET_UNLOCK_1 0xfe |
| 87 | #define IDE_COMMAND_TAITO_GNET_UNLOCK_2 0xfc |
| 88 | #define IDE_COMMAND_TAITO_GNET_UNLOCK_3 0x0f |
| 88 | 89 | |
| 89 | | #define IDE_ERROR_NONE 0x00 |
| 90 | | #define IDE_ERROR_DEFAULT 0x01 |
| 91 | | #define IDE_ERROR_TRACK0_NOT_FOUND 0x02 |
| 92 | | #define IDE_ERROR_UNKNOWN_COMMAND 0x04 |
| 93 | | #define IDE_ERROR_BAD_LOCATION 0x10 |
| 94 | | #define IDE_ERROR_BAD_SECTOR 0x80 |
| 90 | #define IDE_ERROR_NONE 0x00 |
| 91 | #define IDE_ERROR_DEFAULT 0x01 |
| 92 | #define IDE_ERROR_TRACK0_NOT_FOUND 0x02 |
| 93 | #define IDE_ERROR_UNKNOWN_COMMAND 0x04 |
| 94 | #define IDE_ERROR_BAD_LOCATION 0x10 |
| 95 | #define IDE_ERROR_BAD_SECTOR 0x80 |
| 95 | 96 | |
| 96 | | #define IDE_BUSMASTER_STATUS_ACTIVE 0x01 |
| 97 | | #define IDE_BUSMASTER_STATUS_ERROR 0x02 |
| 98 | | #define IDE_BUSMASTER_STATUS_IRQ 0x04 |
| 97 | #define IDE_BUSMASTER_STATUS_ACTIVE 0x01 |
| 98 | #define IDE_BUSMASTER_STATUS_ERROR 0x02 |
| 99 | #define IDE_BUSMASTER_STATUS_IRQ 0x04 |
| 99 | 100 | |
| 100 | 101 | |
| 101 | 102 | |
| r17899 | r17900 | |
| 1003 | 1004 | switch (command) |
| 1004 | 1005 | { |
| 1005 | 1006 | case IDE_COMMAND_READ_MULTIPLE: |
| 1006 | | case IDE_COMMAND_READ_MULTIPLE_ONCE: |
| 1007 | case IDE_COMMAND_READ_MULTIPLE_NORETRY: |
| 1007 | 1008 | LOGPRINT(("IDE Read multiple: C=%d H=%d S=%d LBA=%d count=%d\n", |
| 1008 | 1009 | ide->drive[ide->cur_drive].cur_cylinder, ide->drive[ide->cur_drive].cur_head, ide->drive[ide->cur_drive].cur_sector, lba_address(ide), ide->sector_count)); |
| 1009 | 1010 | |
| r17899 | r17900 | |
| 1062 | 1063 | break; |
| 1063 | 1064 | |
| 1064 | 1065 | case IDE_COMMAND_WRITE_MULTIPLE: |
| 1066 | case IDE_COMMAND_WRITE_MULTIPLE_NORETRY: |
| 1065 | 1067 | LOGPRINT(("IDE Write multiple: C=%d H=%d S=%d LBA=%d count=%d\n", |
| 1066 | 1068 | ide->drive[ide->cur_drive].cur_cylinder, ide->drive[ide->cur_drive].cur_head, ide->drive[ide->cur_drive].cur_sector, lba_address(ide), ide->sector_count)); |
| 1067 | 1069 | |