Fix several timing problems:

* suspend-until-time was broken (CPU would be suspended and never resumed)
 * timer devices would fire an initial callback even if not set up with a time yet
 * triggers requested after a time would fire twice; once right away and once at the target time

Fixes many regressions.
This commit is contained in:
Aaron Giles 2010-06-10 08:01:06 +00:00
parent f7e04794ca
commit f26b6fd08c
3 changed files with 15 additions and 9 deletions

View File

@ -427,7 +427,7 @@ void device_execute_interface::spin_until_time(attotime duration)
suspend_until_trigger(TRIGGER_SUSPENDTIME + timetrig, true);
// then set a timer for it
timer_set(&m_machine, duration, this, timetrig, static_timed_trigger_callback);
timer_set(&m_machine, duration, this, TRIGGER_SUSPENDTIME + timetrig, static_timed_trigger_callback);
timetrig = (timetrig + 1) % 256;
}
@ -868,6 +868,8 @@ void device_execute_interface::device_input::set_state_synced(int state, int vec
{
LOG(("set_state_synced('%s',%d,%d,%02x)\n", m_device->tag(), m_linenum, state, vector));
assert(state == ASSERT_LINE || state == HOLD_LINE || state == CLEAR_LINE || state == PULSE_LINE);
// treat PULSE_LINE as ASSERT+CLEAR
if (state == PULSE_LINE)
{

View File

@ -288,8 +288,9 @@ void device_scheduler::trigger(int trigid, attotime after)
timer_set(&m_machine, after, (void *)this, trigid, static_timed_trigger);
// send the trigger to everyone who cares
for (device_execute_interface *exec = m_execute_list; exec != NULL; exec = exec->m_nextexec)
exec->trigger(trigid);
else
for (device_execute_interface *exec = m_execute_list; exec != NULL; exec = exec->m_nextexec)
exec->trigger(trigid);
}

View File

@ -34,6 +34,7 @@
#define DEFAULT_MINIMUM_QUANTUM ATTOSECONDS_IN_MSEC(100)
/***************************************************************************
TYPE DEFINITIONS
***************************************************************************/
@ -1096,15 +1097,17 @@ void timer_device::device_reset()
// convert the period into attotime
attotime period = attotime_never;
if (m_config.m_period > 0)
{
period = UINT64_ATTOTIME_TO_ATTOTIME(m_config.m_period);
// convert the start_delay into attotime
attotime start_delay = attotime_zero;
if (m_config.m_start_delay > 0)
start_delay = UINT64_ATTOTIME_TO_ATTOTIME(m_config.m_start_delay);
// convert the start_delay into attotime
attotime start_delay = attotime_zero;
if (m_config.m_start_delay > 0)
start_delay = UINT64_ATTOTIME_TO_ATTOTIME(m_config.m_start_delay);
// allocate and start the backing timer
timer_adjust_periodic(m_timer, start_delay, m_config.m_param, period);
// allocate and start the backing timer
timer_adjust_periodic(m_timer, start_delay, m_config.m_param, period);
}
break;
}