derive chihiro's baseboard ide from ide mass storage device (nw)

This commit is contained in:
smf- 2013-06-14 04:48:44 +00:00
parent c37de741f1
commit 1a3ad96f3a
3 changed files with 41 additions and 42 deletions

View File

@ -159,7 +159,7 @@ static void swap_strncpy(UINT8 *dst, const char *src, int field_size_in_words)
}
void ide_hdd_device::ide_build_features()
void ide_mass_storage_device::ide_build_features()
{
memset(m_features, 0, IDE_DISK_SECTOR_SIZE);
int total_sectors = m_num_cylinders * m_num_heads * m_num_sectors;
@ -376,6 +376,41 @@ void ide_mass_storage_device::device_reset()
set_dmarq(CLEAR_LINE);
}
void ide_mass_storage_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
switch(id)
{
case TID_DELAYED_INTERRUPT:
m_status &= ~IDE_STATUS_BUSY;
set_irq(ASSERT_LINE);
break;
case TID_DELAYED_INTERRUPT_BUFFER_READY:
m_status &= ~IDE_STATUS_BUSY;
m_status |= IDE_STATUS_BUFFER_READY;
set_irq(ASSERT_LINE);
break;
case TID_RESET_CALLBACK:
reset();
break;
case TID_SECURITY_ERROR_DONE:
/* clear error state */
m_status &= ~IDE_STATUS_ERROR;
m_status |= IDE_STATUS_DRIVE_READY;
break;
case TID_READ_SECTOR_DONE_CALLBACK:
read_sector_done();
break;
case TID_WRITE_SECTOR_DONE_CALLBACK:
write_sector_done();
break;
}
}
void ide_mass_storage_device::signal_delayed_interrupt(attotime time, int buffer_ready)
{
/* clear buffer ready and set the busy flag */
@ -1368,41 +1403,6 @@ void ide_hdd_device::device_reset()
}
}
void ide_mass_storage_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
switch(id)
{
case TID_DELAYED_INTERRUPT:
m_status &= ~IDE_STATUS_BUSY;
set_irq(ASSERT_LINE);
break;
case TID_DELAYED_INTERRUPT_BUFFER_READY:
m_status &= ~IDE_STATUS_BUSY;
m_status |= IDE_STATUS_BUFFER_READY;
set_irq(ASSERT_LINE);
break;
case TID_RESET_CALLBACK:
reset();
break;
case TID_SECURITY_ERROR_DONE:
/* clear error state */
m_status &= ~IDE_STATUS_ERROR;
m_status |= IDE_STATUS_DRIVE_READY;
break;
case TID_READ_SECTOR_DONE_CALLBACK:
read_sector_done();
break;
case TID_WRITE_SECTOR_DONE_CALLBACK:
write_sector_done();
break;
}
}
//-------------------------------------------------
// read device key
//-------------------------------------------------

View File

@ -77,6 +77,7 @@ protected:
void set_irq(int state);
void set_dmarq(int state);
void ide_build_features();
UINT8 m_gnetreadlock;
@ -142,8 +143,8 @@ public:
ide_hdd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
ide_hdd_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source);
virtual int read_sector(UINT32 lba, void *buffer) { return hard_disk_read(m_disk, lba, buffer); }
virtual int write_sector(UINT32 lba, const void *buffer) { return hard_disk_write(m_disk, lba, buffer); }
virtual int read_sector(UINT32 lba, void *buffer) { return hard_disk_read(m_disk, lba, buffer); }
virtual int write_sector(UINT32 lba, const void *buffer) { return hard_disk_write(m_disk, lba, buffer); }
protected:
// device-level overrides
@ -155,8 +156,6 @@ protected:
virtual bool is_ready() { return (m_disk != NULL); }
virtual void read_key(UINT8 key[]);
void ide_build_features();
chd_file *m_handle;
hard_disk_file *m_disk;
};

View File

@ -2656,7 +2656,7 @@ WRITE32_MEMBER( chihiro_state::dummy_w )
// ======================> ide_baseboard_device
class ide_baseboard_device : public ide_hdd_device
class ide_baseboard_device : public ide_mass_storage_device
{
public:
// construction/destruction
@ -2684,7 +2684,7 @@ const device_type IDE_BASEBOARD = &device_creator<ide_baseboard_device>;
//-------------------------------------------------
ide_baseboard_device::ide_baseboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: ide_hdd_device(mconfig, IDE_BASEBOARD, "IDE Baseboard", tag, owner, clock, "ide_baseboard", __FILE__)
: ide_mass_storage_device(mconfig, IDE_BASEBOARD, "IDE Baseboard", tag, owner, clock, "ide_baseboard", __FILE__)
{
}