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:
parent
df80f22152
commit
89e372ba92
5 changed files with 14 additions and 1 deletions
2
scp.c
2
scp.c
|
@ -8899,6 +8899,8 @@ return reason;
|
|||
|
||||
t_stat sim_activate (UNIT *uptr, int32 event_time)
|
||||
{
|
||||
if (uptr->dynflags & UNIT_TMR_UNIT)
|
||||
return sim_timer_activate (uptr, event_time);
|
||||
return _sim_activate (uptr, event_time);
|
||||
}
|
||||
|
||||
|
|
|
@ -595,7 +595,8 @@ struct UNIT {
|
|||
#define UNIT_TM_POLL 0000002 /* TMXR Polling unit */
|
||||
#define UNIT_NO_FIO 0000004 /* fileref is NOT a FILE * */
|
||||
#define UNIT_DISK_CHK 0000010 /* disk data debug checking (sim_disk) */
|
||||
#define UNIT_V_DF_TAPE 4 /* Bit offset for Tape Density reservation */
|
||||
#define UNIT_TMR_UNIT 0000020 /* Unit registered as a calibrated timer */
|
||||
#define UNIT_V_DF_TAPE 5 /* Bit offset for Tape Density reservation */
|
||||
#define UNIT_S_DF_TAPE 3 /* Bits Reserved for Tape Density */
|
||||
|
||||
struct BITFIELD {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -128,6 +128,7 @@ uint32 sim_os_ms_sleep_init (void);
|
|||
void sim_start_timer_services (void);
|
||||
void sim_stop_timer_services (void);
|
||||
t_stat sim_timer_change_asynch (void);
|
||||
t_stat sim_timer_activate (UNIT *uptr, int32 interval);
|
||||
t_stat sim_timer_activate_after (UNIT *uptr, uint32 usec_delay);
|
||||
int32 sim_timer_activate_time (UNIT *uptr);
|
||||
t_stat sim_register_clock_unit (UNIT *uptr);
|
||||
|
|
|
@ -3849,6 +3849,8 @@ return SCPE_OK;
|
|||
|
||||
t_stat tmxr_activate (UNIT *uptr, int32 interval)
|
||||
{
|
||||
if (uptr->dynflags & UNIT_TMR_UNIT)
|
||||
return sim_timer_activate (uptr, interval);
|
||||
#if defined(SIM_ASYNCH_MUX)
|
||||
if ((!(uptr->dynflags & UNIT_TM_POLL)) ||
|
||||
(!sim_asynch_enabled)) {
|
||||
|
|
Loading…
Add table
Reference in a new issue