mirror of
https://github.com/simh/simh.git
synced 2026-01-25 19:56:25 +00:00
TIMER: Add support for catchup clock ticks and cleaned up asynchronous clocks
Asynchronous clocks are now built for all simulators which are built with SIM_ASYNCH_IO defined. The default behavior has asynchronous clocks disabled since this is still experimental, but it can be enabled with SET TIMER ASYNC. Catchup clock ticks are now available, but since they're experimental, they aren't enabled by default. Catchup ticks are only available if the simulators clock device calls sim_rtcn_tick_ack to acknowledge processing of clock ticks. The VAX simulators have been modified to leverage this. Catchup clock ticks can be enabled with SET TIMER CATCHUP Additionally, an idle threshold is provided which can be used to influence when clock calibration may be suppressed. The default is not to suppress calibration activities. The various timer behaviors are visible with the SHOW TIMER command. The state of the operating timer facilities is visible with: SHOW CLOCK Timer events which are queued are visible with the SHOW QUEUE command.
This commit is contained in:
15
sim_timer.h
15
sim_timer.h
@@ -64,7 +64,7 @@ extern "C" {
|
||||
#if !defined(_TIMESPEC_DEFINED)
|
||||
#define _TIMESPEC_DEFINED
|
||||
struct timespec {
|
||||
long tv_sec;
|
||||
time_t tv_sec;
|
||||
long tv_nsec;
|
||||
};
|
||||
#endif /* !defined(_TIMESPEC_DEFINED) */
|
||||
@@ -80,7 +80,6 @@ int clock_gettime(int clock_id, struct timespec *tp);
|
||||
/* about instructions per second */
|
||||
|
||||
#define SIM_IDLE_CAL 10 /* ms to calibrate */
|
||||
#define SIM_IDLE_MAX 10 /* max granularity idle */
|
||||
#define SIM_IDLE_STMIN 2 /* min sec for stability */
|
||||
#define SIM_IDLE_STDFLT 20 /* dft sec for stability */
|
||||
#define SIM_IDLE_STMAX 600 /* max sec for stability */
|
||||
@@ -103,11 +102,11 @@ int clock_gettime(int clock_id, struct timespec *tp);
|
||||
|
||||
t_bool sim_timer_init (void);
|
||||
void sim_timespec_diff (struct timespec *diff, struct timespec *min, struct timespec *sub);
|
||||
#if defined(SIM_ASYNCH_CLOCKS)
|
||||
double sim_timenow_double (void);
|
||||
#endif
|
||||
int32 sim_rtcn_init (int32 time, int32 tmr);
|
||||
int32 sim_rtcn_init_unit (UNIT *uptr, int32 time, int32 tmr);
|
||||
void sim_rtcn_get_time (struct timespec *now, int tmr);
|
||||
t_stat sim_rtcn_tick_ack (int32 time, int32 tmr);
|
||||
void sim_rtcn_init_all (void);
|
||||
int32 sim_rtcn_calb (int32 ticksper, int32 tmr);
|
||||
int32 sim_rtc_init (int32 time);
|
||||
@@ -130,13 +129,15 @@ void sim_start_timer_services (void);
|
||||
void sim_stop_timer_services (void);
|
||||
t_stat sim_timer_change_asynch (void);
|
||||
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);
|
||||
t_stat sim_register_clock_unit_tmr (UNIT *uptr, int32 tmr);
|
||||
t_stat sim_clock_coschedule (UNIT *uptr, int32 interval);
|
||||
t_stat sim_clock_coschedule_abs (UNIT *uptr, int32 interval);
|
||||
t_stat sim_clock_coschedule_tmr (UNIT *uptr, int32 tmr, int32 interval);
|
||||
t_stat sim_clock_coschedule_tmr_abs (UNIT *uptr, int32 tmr, int32 interval);
|
||||
t_stat sim_clock_coschedule_tmr (UNIT *uptr, int32 tmr, int32 ticks);
|
||||
t_stat sim_clock_coschedule_tmr_abs (UNIT *uptr, int32 tmr, int32 ticks);
|
||||
double sim_timer_inst_per_sec (void);
|
||||
int32 sim_rtcn_tick_size (int32 tmr);
|
||||
t_bool sim_timer_idle_capable (uint32 *host_ms_sleep_1, uint32 *host_tick_ms);
|
||||
#define PRIORITY_BELOW_NORMAL -1
|
||||
#define PRIORITY_NORMAL 0
|
||||
@@ -147,7 +148,7 @@ extern t_bool sim_idle_enab; /* idle enabled flag */
|
||||
extern volatile t_bool sim_idle_wait; /* idle waiting flag */
|
||||
extern t_bool sim_asynch_timer;
|
||||
extern DEVICE sim_timer_dev;
|
||||
extern UNIT * volatile sim_clock_cosched_queue[SIM_NTIMERS];
|
||||
extern UNIT * volatile sim_clock_cosched_queue[SIM_NTIMERS+1];
|
||||
extern const t_bool rtc_avail;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
Reference in New Issue
Block a user