From be47d8539f625e9d4176a28d74e22fc0f0640099 Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Tue, 22 Nov 2016 22:06:25 -0800 Subject: [PATCH] TIMER: Fix Idling when transitioning betwen multiple calibrated clocks --- sim_console.c | 4 ++-- sim_timer.c | 49 ++++++++++++++++++++++++++++++++++++++----------- 2 files changed, 40 insertions(+), 13 deletions(-) diff --git a/sim_console.c b/sim_console.c index 746a0d29..5beebbea 100644 --- a/sim_console.c +++ b/sim_console.c @@ -386,8 +386,8 @@ t_stat sim_rem_con_poll_svc (UNIT *uptr); /* remote console connec t_stat sim_rem_con_data_svc (UNIT *uptr); /* remote console connection data routine */ t_stat sim_rem_con_reset (DEVICE *dptr); /* remote console reset routine */ UNIT sim_rem_con_unit[2] = { - { UDATA (&sim_rem_con_poll_svc, 0, 0) }, /* remote console connection polling unit */ - { UDATA (&sim_rem_con_data_svc, 0, 0) }}; /* console data handling unit */ + { UDATA (&sim_rem_con_poll_svc, UNIT_IDLE, 0) }, /* remote console connection polling unit */ + { UDATA (&sim_rem_con_data_svc, UNIT_IDLE, 0) }}; /* console data handling unit */ DEBTAB sim_rem_con_debug[] = { {"TRC", DBG_TRC}, diff --git a/sim_timer.c b/sim_timer.c index 8271039b..e173ca81 100644 --- a/sim_timer.c +++ b/sim_timer.c @@ -723,7 +723,6 @@ static uint32 rtc_clock_time_idled_last[SIM_NTIMERS+1] = { 0 };/* total time idl UNIT sim_timer_units[SIM_NTIMERS+1]; /* one for each timer and one for an */ /* internal clock if no clocks are registered */ -UNIT sim_tick_units[SIM_NTIMERS]; /* one for each timer to schedule asynchronously */ UNIT sim_throttle_unit; /* one for throttle */ /* Forward device declarations */ @@ -1898,22 +1897,41 @@ int32 tmr; sim_int_clk_tps = MIN(CLK_TPS, sim_os_tick_hz); for (tmr=0; tmrdynflags |= UNIT_TMR_UNIT; -sim_timer_units[tmr].flags = (sim_clock_unit[tmr] ? 0 : UNIT_DIS | UNIT_IDLE); -sim_tick_units[tmr].flags = (sim_clock_unit[tmr] ? 0 : UNIT_DIS); +sim_timer_units[tmr].flags = UNIT_DIS | (sim_clock_unit[tmr] ? UNIT_IDLE : 0); return SCPE_OK; }