TIMER: Add minimal tick based calibration APIs.
This commit is contained in:
parent
56ab8260f2
commit
da3f851d70
3 changed files with 21 additions and 4 deletions
BIN
doc/simh.doc
BIN
doc/simh.doc
Binary file not shown.
23
sim_timer.c
23
sim_timer.c
|
@ -840,6 +840,11 @@ return sim_rtcn_init_unit (NULL, time, tmr);
|
|||
|
||||
int32 sim_rtcn_init_unit (UNIT *uptr, int32 time, int32 tmr)
|
||||
{
|
||||
return sim_rtcn_init_unit_ticks (uptr, time, tmr, 0);
|
||||
}
|
||||
|
||||
int32 sim_rtcn_init_unit_ticks (UNIT *uptr, int32 time, int32 tmr, int32 ticksper)
|
||||
{
|
||||
if (time == 0)
|
||||
time = 1;
|
||||
if (tmr == SIM_INTERNAL_CLK)
|
||||
|
@ -851,7 +856,7 @@ else {
|
|||
/*
|
||||
* If we'd previously succeeded in calibrating a tick value, then use that
|
||||
* delay as a better default to setup when we're re-initialized.
|
||||
* Re-initializing happens on any boot or after any breakpoint/continue.
|
||||
* Re-initializing happens on any boot.
|
||||
*/
|
||||
if (rtc_currd[tmr])
|
||||
time = rtc_currd[tmr];
|
||||
|
@ -890,6 +895,11 @@ _rtcn_configure_calibrated_clock (tmr);
|
|||
return time;
|
||||
}
|
||||
|
||||
int32 sim_rtcn_calb_tick (int32 tmr)
|
||||
{
|
||||
return sim_rtcn_calb (rtc_hz[tmr], tmr);
|
||||
}
|
||||
|
||||
int32 sim_rtcn_calb (int32 ticksper, int32 tmr)
|
||||
{
|
||||
uint32 new_rtime, delta_rtime, last_idle_pct;
|
||||
|
@ -1181,11 +1191,11 @@ for (tmr=clocks=0; tmr<=SIM_NTIMERS; ++tmr) {
|
|||
if (sim_idle_calib_pct && (sim_idle_calib_pct != 100))
|
||||
fprintf (st, " Calib Skip when Idle >: %u%%\n", sim_idle_calib_pct);
|
||||
if (rtc_clock_calib_skip_idle[tmr])
|
||||
fprintf (st, " Calibs Skip While Idle: %u\n", rtc_clock_calib_skip_idle[tmr]);
|
||||
fprintf (st, " Calibs Skip While Idle: %s\n", sim_fmt_numeric ((double)rtc_clock_calib_skip_idle[tmr]));
|
||||
if (rtc_clock_calib_backwards[tmr])
|
||||
fprintf (st, " Calibs Skip Backwards: %u\n", rtc_clock_calib_backwards[tmr]);
|
||||
fprintf (st, " Calibs Skip Backwards: %s\n", sim_fmt_numeric ((double)rtc_clock_calib_backwards[tmr]));
|
||||
if (rtc_clock_calib_gap2big[tmr])
|
||||
fprintf (st, " Calibs Skip Gap Too Big: %u\n", rtc_clock_calib_gap2big[tmr]);
|
||||
fprintf (st, " Calibs Skip Gap Too Big: %s\n", sim_fmt_numeric ((double)rtc_clock_calib_gap2big[tmr]));
|
||||
}
|
||||
if (rtc_gtime[tmr])
|
||||
fprintf (st, " Instruction Time: %.0f\n", rtc_gtime[tmr]);
|
||||
|
@ -3290,4 +3300,9 @@ for (tmr=0; tmr<=SIM_NTIMERS; tmr++) {
|
|||
}
|
||||
reset_all_p (0);
|
||||
sim_run_boot_prep (RU_GO);
|
||||
for (tmr=0; tmr<=SIM_NTIMERS; tmr++) {
|
||||
if (rtc_calib_initializations[tmr])
|
||||
rtc_calib_initializations[tmr] = 1;
|
||||
}
|
||||
sim_inst_per_sec_last = sim_precalibrate_ips;
|
||||
}
|
||||
|
|
|
@ -108,10 +108,12 @@ void sim_timespec_diff (struct timespec *diff, struct timespec *min, struct time
|
|||
double sim_timenow_double (void);
|
||||
int32 sim_rtcn_init (int32 time, int32 tmr);
|
||||
int32 sim_rtcn_init_unit (UNIT *uptr, int32 time, int32 tmr);
|
||||
int32 sim_rtcn_init_unit_ticks (UNIT *uptr, int32 time, int32 tmr, int32 ticksper);
|
||||
void sim_rtcn_get_time (struct timespec *now, int tmr);
|
||||
t_stat sim_rtcn_tick_ack (uint32 time, int32 tmr);
|
||||
void sim_rtcn_init_all (void);
|
||||
int32 sim_rtcn_calb (int32 ticksper, int32 tmr);
|
||||
int32 sim_rtcn_calb_tick (int32 tmr);
|
||||
int32 sim_rtc_init (int32 time);
|
||||
int32 sim_rtc_calb (int32 ticksper);
|
||||
t_stat sim_set_timers (int32 arg, CONST char *cptr);
|
||||
|
|
Loading…
Add table
Reference in a new issue