1
0
mirror of https://github.com/simh/simh.git synced 2026-01-25 19:56:25 +00:00

TIMER: Restore functionality for clocks devices that don't use sim_activate_after

Clock devices which call sim_register_clock_unit or sim_register_clock_unit_tmr
are best behaved if they use sim_activate_after to schedule their tick events.
This commit is contained in:
Mark Pizzolato
2016-11-22 01:24:26 -08:00
parent df80f22152
commit 89e372ba92
5 changed files with 14 additions and 1 deletions

View File

@@ -2033,6 +2033,12 @@ if (0 == inst_per_sec)
return inst_per_sec;
}
t_stat sim_timer_activate (UNIT *uptr, int32 interval)
{
AIO_VALIDATE;
return sim_timer_activate_after (uptr, (uint32)((interval * 1000000.0) / sim_timer_inst_per_sec ()));
}
t_stat sim_timer_activate_after (UNIT *uptr, uint32 usec_delay)
{
int inst_delay, tmr;
@@ -2109,6 +2115,7 @@ t_stat sim_register_clock_unit_tmr (UNIT *uptr, int32 tmr)
if (NULL == sim_clock_unit[tmr])
sim_clock_cosched_queue[tmr] = QUEUE_LIST_END;
sim_clock_unit[tmr] = uptr;
uptr->dynflags |= 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);
return SCPE_OK;