TIMER: Don't consider idle calibration skipping with internal timer

As discussed in #699
This commit is contained in:
Mark Pizzolato 2019-05-30 03:23:38 -07:00
parent 0195bbda4b
commit 564ce2b3f4

View file

@ -972,6 +972,7 @@ if (delta_rtime > 30000) { /* gap too big? */
sim_debug (DBG_CAL, &sim_timer_dev, "gap too big: delta = %d - result: %d\n", delta_rtime, rtc_currd[tmr]); sim_debug (DBG_CAL, &sim_timer_dev, "gap too big: delta = %d - result: %d\n", delta_rtime, rtc_currd[tmr]);
return rtc_currd[tmr]; /* can't calibr */ return rtc_currd[tmr]; /* can't calibr */
} }
if (tmr != SIM_NTIMERS) {
if (delta_rtime == 0) /* avoid divide by zero */ if (delta_rtime == 0) /* avoid divide by zero */
last_idle_pct = 0; /* force calibration */ last_idle_pct = 0; /* force calibration */
else else
@ -985,6 +986,7 @@ if (last_idle_pct > (100 - sim_idle_calib_pct)) {
sim_debug (DBG_CAL, &sim_timer_dev, "skipping calibration due to idling (%d%%) - result: %d\n", last_idle_pct, rtc_currd[tmr]); sim_debug (DBG_CAL, &sim_timer_dev, "skipping calibration due to idling (%d%%) - result: %d\n", last_idle_pct, rtc_currd[tmr]);
return rtc_currd[tmr]; /* avoid calibrating idle checks */ return rtc_currd[tmr]; /* avoid calibrating idle checks */
} }
}
new_gtime = sim_gtime(); new_gtime = sim_gtime();
if ((last_idle_pct == 0) && (delta_rtime != 0)) { if ((last_idle_pct == 0) && (delta_rtime != 0)) {
sim_idle_cyc_ms = (uint32)((new_gtime - rtc_gtime[tmr]) / delta_rtime); sim_idle_cyc_ms = (uint32)((new_gtime - rtc_gtime[tmr]) / delta_rtime);