mirror of
https://github.com/holub/mame
synced 2025-10-06 09:00:04 +03:00
converted to device_timer() (nw)
This commit is contained in:
parent
3efebdaa7e
commit
18a537031e
@ -107,26 +107,50 @@ void ide_controller_device::set_dmarq(int state)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum
|
||||||
|
|
||||||
/***************************************************************************
|
|
||||||
DELAYED INTERRUPT HANDLING
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
static TIMER_CALLBACK( delayed_interrupt )
|
|
||||||
{
|
{
|
||||||
ide_controller_device *ide = (ide_controller_device *)ptr;
|
TID_NULL,
|
||||||
ide->status &= ~IDE_STATUS_BUSY;
|
TID_DELAYED_INTERRUPT,
|
||||||
ide->set_irq(ASSERT_LINE);
|
TID_DELAYED_INTERRUPT_BUFFER_READY,
|
||||||
}
|
TID_RESET_CALLBACK,
|
||||||
|
TID_SECURITY_ERROR_DONE,
|
||||||
|
TID_READ_SECTOR_DONE_CALLBACK,
|
||||||
|
TID_WRITE_SECTOR_DONE_CALLBACK
|
||||||
|
};
|
||||||
|
|
||||||
|
void ide_controller_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
|
||||||
static TIMER_CALLBACK( delayed_interrupt_buffer_ready )
|
|
||||||
{
|
{
|
||||||
ide_controller_device *ide = (ide_controller_device *)ptr;
|
switch(id)
|
||||||
ide->status &= ~IDE_STATUS_BUSY;
|
{
|
||||||
ide->status |= IDE_STATUS_BUFFER_READY;
|
case TID_DELAYED_INTERRUPT:
|
||||||
ide->set_irq(ASSERT_LINE);
|
status &= ~IDE_STATUS_BUSY;
|
||||||
|
set_irq(ASSERT_LINE);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TID_DELAYED_INTERRUPT_BUFFER_READY:
|
||||||
|
status &= ~IDE_STATUS_BUSY;
|
||||||
|
status |= IDE_STATUS_BUFFER_READY;
|
||||||
|
set_irq(ASSERT_LINE);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TID_RESET_CALLBACK:
|
||||||
|
reset();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TID_SECURITY_ERROR_DONE:
|
||||||
|
/* clear error state */
|
||||||
|
status &= ~IDE_STATUS_ERROR;
|
||||||
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -138,9 +162,9 @@ void ide_controller_device::signal_delayed_interrupt(attotime time, int buffer_r
|
|||||||
|
|
||||||
/* set a timer */
|
/* set a timer */
|
||||||
if (buffer_ready)
|
if (buffer_ready)
|
||||||
machine().scheduler().timer_set(time, FUNC(delayed_interrupt_buffer_ready), 0, this);
|
timer_set(time, TID_DELAYED_INTERRUPT_BUFFER_READY);
|
||||||
else
|
else
|
||||||
machine().scheduler().timer_set(time, FUNC(delayed_interrupt), 0, this);
|
timer_set(time, TID_DELAYED_INTERRUPT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -173,12 +197,6 @@ void ide_controller_device::ide_set_user_password(const UINT8 *password)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static TIMER_CALLBACK( reset_callback )
|
|
||||||
{
|
|
||||||
reinterpret_cast<device_t *>(ptr)->reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************
|
/*************************************
|
||||||
*
|
*
|
||||||
@ -230,15 +248,6 @@ void ide_controller_device::next_sector()
|
|||||||
*
|
*
|
||||||
*************************************/
|
*************************************/
|
||||||
|
|
||||||
static TIMER_CALLBACK( security_error_done )
|
|
||||||
{
|
|
||||||
ide_controller_device *ide = (ide_controller_device *)ptr;
|
|
||||||
|
|
||||||
/* clear error state */
|
|
||||||
ide->status &= ~IDE_STATUS_ERROR;
|
|
||||||
ide->status |= IDE_STATUS_DRIVE_READY;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ide_controller_device::security_error()
|
void ide_controller_device::security_error()
|
||||||
{
|
{
|
||||||
/* set error state */
|
/* set error state */
|
||||||
@ -246,7 +255,7 @@ void ide_controller_device::security_error()
|
|||||||
status &= ~IDE_STATUS_DRIVE_READY;
|
status &= ~IDE_STATUS_DRIVE_READY;
|
||||||
|
|
||||||
/* just set a timer and mark ourselves error */
|
/* just set a timer and mark ourselves error */
|
||||||
machine().scheduler().timer_set(TIME_SECURITY_ERROR, FUNC(security_error_done), 0, this);
|
timer_set(TIME_SECURITY_ERROR, TID_SECURITY_ERROR_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -350,14 +359,6 @@ void ide_controller_device::read_sector_done()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static TIMER_CALLBACK( read_sector_done_callback )
|
|
||||||
{
|
|
||||||
ide_controller_device *ide = (ide_controller_device *)ptr;
|
|
||||||
|
|
||||||
ide->read_sector_done();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ide_controller_device::read_first_sector()
|
void ide_controller_device::read_first_sector()
|
||||||
{
|
{
|
||||||
ide_device_interface *dev = slot[cur_drive]->dev();
|
ide_device_interface *dev = slot[cur_drive]->dev();
|
||||||
@ -376,10 +377,10 @@ void ide_controller_device::read_first_sector()
|
|||||||
seek_time = TIME_SEEK_MULTISECTOR;
|
seek_time = TIME_SEEK_MULTISECTOR;
|
||||||
|
|
||||||
dev->cur_lba = new_lba;
|
dev->cur_lba = new_lba;
|
||||||
machine().scheduler().timer_set(seek_time, FUNC(read_sector_done_callback), 0, this);
|
timer_set(seek_time, TID_READ_SECTOR_DONE_CALLBACK);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
machine().scheduler().timer_set(TIME_PER_SECTOR, FUNC(read_sector_done_callback), 0, this);
|
timer_set(TIME_PER_SECTOR, TID_READ_SECTOR_DONE_CALLBACK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -395,11 +396,11 @@ void ide_controller_device::read_next_sector()
|
|||||||
read_sector_done();
|
read_sector_done();
|
||||||
else
|
else
|
||||||
/* just set a timer */
|
/* just set a timer */
|
||||||
machine().scheduler().timer_set(attotime::from_usec(1), FUNC(read_sector_done_callback), 0, this);
|
timer_set(attotime::from_usec(1), TID_READ_SECTOR_DONE_CALLBACK);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
/* just set a timer */
|
/* just set a timer */
|
||||||
machine().scheduler().timer_set(TIME_PER_SECTOR, FUNC(read_sector_done_callback), 0, this);
|
timer_set(TIME_PER_SECTOR, TID_READ_SECTOR_DONE_CALLBACK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -410,8 +411,6 @@ void ide_controller_device::read_next_sector()
|
|||||||
*
|
*
|
||||||
*************************************/
|
*************************************/
|
||||||
|
|
||||||
static TIMER_CALLBACK( write_sector_done_callback );
|
|
||||||
|
|
||||||
void ide_controller_device::continue_write()
|
void ide_controller_device::continue_write()
|
||||||
{
|
{
|
||||||
/* reset the totals */
|
/* reset the totals */
|
||||||
@ -431,13 +430,13 @@ void ide_controller_device::continue_write()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* set a timer to do the write */
|
/* set a timer to do the write */
|
||||||
machine().scheduler().timer_set(TIME_PER_SECTOR, FUNC(write_sector_done_callback), 0, this);
|
timer_set(TIME_PER_SECTOR, TID_WRITE_SECTOR_DONE_CALLBACK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* set a timer to do the write */
|
/* set a timer to do the write */
|
||||||
machine().scheduler().timer_set(TIME_PER_SECTOR, FUNC(write_sector_done_callback), 0, this);
|
timer_set(TIME_PER_SECTOR, TID_WRITE_SECTOR_DONE_CALLBACK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -569,13 +568,6 @@ void ide_controller_device::write_sector_done()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static TIMER_CALLBACK( write_sector_done_callback )
|
|
||||||
{
|
|
||||||
ide_controller_device *ide = (ide_controller_device *)ptr;
|
|
||||||
ide->write_sector_done();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************
|
/*************************************
|
||||||
*
|
*
|
||||||
@ -1330,8 +1322,8 @@ void ide_controller_device::device_start()
|
|||||||
slot[1] = owner()->subdevice<ide_slot_device>("drive_1");
|
slot[1] = owner()->subdevice<ide_slot_device>("drive_1");
|
||||||
|
|
||||||
/* create a timer for timing status */
|
/* create a timer for timing status */
|
||||||
last_status_timer = machine().scheduler().timer_alloc(FUNC_NULL);
|
last_status_timer = timer_alloc(TID_NULL);
|
||||||
reset_timer = machine().scheduler().timer_alloc(FUNC(reset_callback), this);
|
reset_timer = timer_alloc(TID_RESET_CALLBACK);
|
||||||
|
|
||||||
/* register ide states */
|
/* register ide states */
|
||||||
save_item(NAME(adapter_control));
|
save_item(NAME(adapter_control));
|
||||||
|
@ -112,6 +112,7 @@ protected:
|
|||||||
// device-level overrides
|
// device-level overrides
|
||||||
virtual void device_start();
|
virtual void device_start();
|
||||||
virtual void device_reset();
|
virtual void device_reset();
|
||||||
|
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
|
||||||
|
|
||||||
void read_next_sector();
|
void read_next_sector();
|
||||||
void continue_write();
|
void continue_write();
|
||||||
|
Loading…
Reference in New Issue
Block a user