Previous 199869 Revisions Next

r23669 Thursday 13th June, 2013 at 11:35:50 UTC by smf
error register moved across (nw)
[src/emu/machine]idectrl.c idectrl.h idehd.c idehd.h

trunk/src/emu/machine/idectrl.c
r23668r23669
8383#define IDE_COMMAND_TAITO_GNET_UNLOCK_2     0xfc
8484#define IDE_COMMAND_TAITO_GNET_UNLOCK_3     0x0f
8585
86#define IDE_ERROR_NONE                      0x00
87#define IDE_ERROR_DEFAULT                   0x01
88#define IDE_ERROR_TRACK0_NOT_FOUND          0x02
89#define IDE_ERROR_UNKNOWN_COMMAND           0x04
90#define IDE_ERROR_BAD_LOCATION              0x10
91#define IDE_ERROR_BAD_SECTOR                0x80
9286
93
9487void ide_controller_device::set_irq(int state)
9588{
9689   ide_device_interface *dev = slot[cur_drive]->dev();
r23668r23669
283276   /* clear the buffer ready and busy flag */
284277   status &= ~IDE_STATUS_BUFFER_READY;
285278   status &= ~IDE_STATUS_BUSY;
286   error = IDE_ERROR_DEFAULT;
279   dev->error = IDE_ERROR_DEFAULT;
287280   set_dmarq(0);
288281
289282   if (dev->master_password_enable || dev->user_password_enable)
r23668r23669
336329         next_sector();
337330
338331      /* clear the error value */
339      error = IDE_ERROR_NONE;
332      dev->error = IDE_ERROR_NONE;
340333
341334      /* signal an interrupt */
342335      if (!dev->verify_only)
r23668r23669
361354   {
362355      /* set the error flag and the error */
363356      status |= IDE_STATUS_ERROR;
364      error = IDE_ERROR_BAD_SECTOR;
357      dev->error = IDE_ERROR_BAD_SECTOR;
365358
366359      /* signal an interrupt */
367360      set_irq(ASSERT_LINE);
r23668r23669
547540         next_sector();
548541
549542      /* clear the error value */
550      error = IDE_ERROR_NONE;
543      dev->error = IDE_ERROR_NONE;
551544
552545      /* signal an interrupt */
553546      if (--dev->sectors_until_int == 0 || dev->sector_count == 1)
r23668r23669
574567   {
575568      /* set the error flag and the error */
576569      status |= IDE_STATUS_ERROR;
577      error = IDE_ERROR_BAD_SECTOR;
570      dev->error = IDE_ERROR_BAD_SECTOR;
578571
579572      /* signal an interrupt */
580573      set_irq(ASSERT_LINE);
r23668r23669
731724         status &= ~IDE_STATUS_BUSY;
732725
733726         /* clear the error too */
734         error = IDE_ERROR_NONE;
727         dev->error = IDE_ERROR_NONE;
735728
736729         /* signal an interrupt */
737730         signal_delayed_interrupt(MINIMUM_COMMAND_TIME, 1);
738731         break;
739732
740733      case IDE_COMMAND_DIAGNOSTIC:
741         error = IDE_ERROR_DEFAULT;
734         dev->error = IDE_ERROR_DEFAULT;
742735
743736         /* signal an interrupt */
744737         signal_delayed_interrupt(MINIMUM_COMMAND_TIME, 0);
r23668r23669
746739
747740      case IDE_COMMAND_RECALIBRATE:
748741         /* clear the error too */
749         error = IDE_ERROR_NONE;
742         dev->error = IDE_ERROR_NONE;
750743         /* signal an interrupt */
751744         signal_delayed_interrupt(MINIMUM_COMMAND_TIME, 0);
752745         break;
753746
754747      case IDE_COMMAND_IDLE:
755748         /* clear the error too */
756         error = IDE_ERROR_NONE;
749         dev->error = IDE_ERROR_NONE;
757750
758751         /* for timeout disabled value is 0 */
759752         dev->sector_count = 0;
r23668r23669
764757      case IDE_COMMAND_SET_CONFIG:
765758         LOGPRINT(("IDE Set configuration (%d heads, %d sectors)\n", dev->cur_head + 1, dev->sector_count));
766759         status &= ~IDE_STATUS_ERROR;
767         error = IDE_ERROR_NONE;
760         dev->error = IDE_ERROR_NONE;
768761         dev->set_geometry(dev->sector_count,dev->cur_head + 1);
769762
770763         /* signal an interrupt */
r23668r23669
842835             so that implements actual seek
843836         */
844837         /* clear the error too */
845         error = IDE_ERROR_NONE;
838         dev->error = IDE_ERROR_NONE;
846839
847840         /* for timeout disabled value is 0 */
848841         dev->sector_count = 0;
r23668r23669
854847      default:
855848         LOGPRINT(("IDE unknown command (%02X)\n", command));
856849         status |= IDE_STATUS_ERROR;
857         error = IDE_ERROR_UNKNOWN_COMMAND;
850         dev->error = IDE_ERROR_UNKNOWN_COMMAND;
858851         set_irq(ASSERT_LINE);
859852         //debugger_break(device->machine());
860853         break;
r23668r23669
983976
984977      /* return the current error */
985978      case IDE_BANK0_ERROR:
986         result = error;
979         result = dev->error;
987980         break;
988981
989982      /* return the current sector count */
r23668r23669
11451138{
11461139   ide_device_interface *dev = slot[cur_drive]->dev();
11471140
1141   if (dev == NULL)
1142      return;
1143
11481144   dev->buffer[dev->buffer_offset++] = data;
11491145   dev->buffer[dev->buffer_offset++] = data >> 8;
11501146
r23668r23669
11681164   }
11691165
11701166   ide_device_interface *dev = slot[cur_drive]->dev();
1167
11711168   if (dev == NULL)
11721169      return;
11731170
r23668r23669
12841281ide_controller_device::ide_controller_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock) :
12851282   device_t(mconfig, type, name, tag, owner, clock),
12861283   status(0),
1287   error(0),
12881284   command(0),
12891285   config_unknown(0),
12901286   config_register_num(0),
r23668r23669
12981294
12991295ide_controller_device::ide_controller_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
13001296   device_t(mconfig, IDE_CONTROLLER, "IDE Controller", tag, owner, clock),
1301   error(0),
13021297   command(0),
13031298   config_unknown(0),
13041299   config_register_num(0),
r23668r23669
13251320
13261321   /* register ide states */
13271322   save_item(NAME(status));
1328   save_item(NAME(error));
13291323   save_item(NAME(command));
13301324
13311325   save_item(NAME(config_unknown));
r23668r23669
13431337   /* reset the drive state */
13441338   cur_drive = 0;
13451339   status = IDE_STATUS_DRIVE_READY | IDE_STATUS_SEEK_COMPLETE;
1346   error = IDE_ERROR_DEFAULT;
13471340   set_irq(CLEAR_LINE);
13481341   set_dmarq(0);
13491342}
trunk/src/emu/machine/idectrl.h
r23668r23669
127127   void write_buffer_full();
128128
129129   UINT8           status;
130   UINT8           error;
131130   UINT8           command;
132131
133132   UINT8           config_unknown;
trunk/src/emu/machine/idehd.c
r23668r23669
253253   save_item(NAME(buffer));
254254   save_item(NAME(buffer_offset));
255255
256   save_item(NAME(error));
257
256258   save_item(NAME(adapter_control));
257259   save_item(NAME(precomp_offset));
258260   save_item(NAME(sector_count));
r23668r23669
309311   gnetreadlock = 0;
310312   master_password_enable = (master_password != NULL);
311313   user_password_enable = (user_password != NULL);
314   error = IDE_ERROR_DEFAULT;
312315}
313316
314317//-------------------------------------------------
trunk/src/emu/machine/idehd.h
r23668r23669
33
44#define IDE_DISK_SECTOR_SIZE            512
55
6#define IDE_ERROR_NONE                      0x00
7#define IDE_ERROR_DEFAULT                   0x01
8#define IDE_ERROR_TRACK0_NOT_FOUND          0x02
9#define IDE_ERROR_UNKNOWN_COMMAND           0x04
10#define IDE_ERROR_BAD_LOCATION              0x10
11#define IDE_ERROR_BAD_SECTOR                0x80
12
613// ======================> ide_device_interface
714
815class ide_device_interface : public device_slot_card_interface
r23668r23669
2835   UINT8           cur_head_reg;
2936   UINT32          cur_lba;
3037
38   UINT8           error;
39
3140   UINT8           buffer[IDE_DISK_SECTOR_SIZE];
3241   UINT16          buffer_offset;
3342

Previous 199869 Revisions Next


© 1997-2024 The MAME Team