ncr5390: fix reset behaviour (nw)

This commit is contained in:
Patrick Mackinlay 2019-01-23 15:54:35 +07:00
parent be3b997dd0
commit 1ad7331c41
2 changed files with 31 additions and 24 deletions

View File

@ -52,7 +52,7 @@ READ8_MEMBER(ncr5390_device::read)
case 6: return seq_step_r(space, 0);
case 7: return fifo_flags_r(space, 0);
case 8: return conf_r(space, 0);
default: return 0;
default: return 0xff;
}
}
@ -184,10 +184,7 @@ void ncr5390_device::device_start()
m_irq_handler.resolve_safe();
m_drq_handler.resolve_safe();
tcount = 0;
tcounter = 0;
config = 0;
status = 0;
bus_id = 0;
select_timeout = 0;
tm = timer_alloc(0);
@ -203,26 +200,28 @@ void ncr5390_device::device_reset()
sync_offset = 0;
seq = 0;
config &= 7;
status &= 0x90;
status = 0;
istatus = 0;
irq = false;
m_irq_handler(irq);
reset_soft();
}
void ncr5390_device::reset_soft()
{
state = IDLE;
scsi_bus->ctrl_wait(scsi_refid, S_SEL|S_BSY|S_RST, S_ALL);
status &= 0xef;
drq = false;
test_mode = false;
m_drq_handler(drq);
scsi_bus->ctrl_w(scsi_refid, 0, S_RST);
tcount = 0;
tcounter = 0;
reset_disconnect();
}
void ncr5390_device::reset_disconnect()
{
scsi_bus->ctrl_w(scsi_refid, 0, ~S_RST);
command_pos = 0;
command_length = 0;
memset(command, 0, sizeof(command));
@ -265,6 +264,17 @@ void ncr5390_device::step(bool timeout)
case IDLE:
break;
case BUSRESET_WAIT_INT:
state = IDLE;
scsi_bus->ctrl_w(scsi_refid, 0, S_RST);
reset_disconnect();
if (!(config & 0x40)) {
istatus |= I_SCSI_RESET;
check_irq();
}
break;
case ARB_COMPLETE << SUB_SHIFT: {
if(!timeout)
break;
@ -466,6 +476,8 @@ void ncr5390_device::step(bool timeout)
if((ctrl & S_PHASE_MASK) != S_PHASE_COMMAND) {
if(!command_length)
seq = 4;
else
seq = 2;
scsi_bus->ctrl_wait(scsi_refid, 0, S_REQ);
function_bus_complete();
break;
@ -858,13 +870,9 @@ void ncr5390_device::start_command()
case CM_RESET_BUS:
LOGMASKED(LOG_COMMAND, "Reset SCSI bus\n");
reset_soft();
// FIXME: this interrupt should be generated when the reset is reflected
// back into the device, and not when the device starts the scsi reset
if (!(config & 0x40)) {
istatus = I_SCSI_RESET;
check_irq();
}
state = BUSRESET_WAIT_INT;
scsi_bus->ctrl_w(scsi_refid, S_RST, S_RST);
delay(130);
break;
case CD_RESELECT:
@ -1162,11 +1170,11 @@ void ncr53c90a_device::device_start()
ncr5390_device::device_start();
}
void ncr53c90a_device::reset_soft()
void ncr53c90a_device::device_reset()
{
config2 = 0;
ncr5390_device::reset_soft();
ncr5390_device::device_reset();
}
READ8_MEMBER(ncr53c90a_device::status_r)
@ -1200,11 +1208,11 @@ void ncr53c94_device::device_start()
ncr53c90a_device::device_start();
}
void ncr53c94_device::reset_soft()
void ncr53c94_device::device_reset()
{
config3 = 0;
ncr53c90a_device::reset_soft();
ncr53c90a_device::device_reset();
}
u16 ncr53c94_device::dma16_r()

View File

@ -221,7 +221,6 @@ protected:
void command_pop_and_chain();
void check_irq();
virtual void reset_soft();
void reset_disconnect();
uint8_t fifo_pop();
@ -257,7 +256,7 @@ protected:
ncr53c90a_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
virtual void device_start() override;
virtual void reset_soft() override;
virtual void device_reset() override;
virtual bool check_valid_command(uint8_t cmd) override;
@ -317,7 +316,7 @@ protected:
};
virtual void device_start() override;
virtual void reset_soft() override;
virtual void device_reset() override;
virtual void check_drq() override;
private: