Change the semantics of sim_is_active to return a t_bool (which was 98% of how it was used), and added new sim_activate_time to return the time a unit will be activated (the value previously returned). This affected a handful of used of sim_is_active in device implementations which were adjusted to use the sim_activate_time API.

This commit is contained in:
Mark Pizzolato 2012-12-12 11:01:00 -08:00
parent 2b5ceae2be
commit a3b0dc38fd
19 changed files with 20 additions and 20 deletions

View file

@ -695,7 +695,7 @@ void dp_goc (int32 fnc, int32 drv, int32 time)
{ {
int32 t; int32 t;
t = sim_is_active (&dpc_unit[drv]); t = sim_activate_time (&dpc_unit[drv]);
if (t) { /* still seeking? */ if (t) { /* still seeking? */
sim_cancel (&dpc_unit[drv]); /* stop seek */ sim_cancel (&dpc_unit[drv]); /* stop seek */
dpc_sta[drv] = dpc_sta[drv] & ~STA_BSY; /* clear busy */ dpc_sta[drv] = dpc_sta[drv] & ~STA_BSY; /* clear busy */

View file

@ -531,7 +531,7 @@ void dq_goc (int32 fnc, int32 drv, int32 time)
{ {
int32 t; int32 t;
t = sim_is_active (&dqc_unit[drv]); t = sim_activate_time (&dqc_unit[drv]);
if (t) { /* still seeking? */ if (t) { /* still seeking? */
sim_cancel (&dqc_unit[drv]); /* cancel */ sim_cancel (&dqc_unit[drv]); /* cancel */

View file

@ -1021,7 +1021,7 @@ int32 sync_poll (POLLMODE poll_mode)
int32 poll_time; int32 poll_time;
if (poll_mode == INITIAL) { if (poll_mode == INITIAL) {
poll_time = sim_is_active (&tty_unit[TTI]); poll_time = sim_activate_time (&tty_unit[TTI]);
if (poll_time) if (poll_time)
return poll_time; return poll_time;

View file

@ -772,7 +772,7 @@ else if (uptr) { /* otherwise, we have a
uptr->wait = cvptr->cmd_time; /* most commands use the command delay */ uptr->wait = cvptr->cmd_time; /* most commands use the command delay */
if (props->unit_access) { /* does the command access the unit? */ if (props->unit_access) { /* does the command access the unit? */
is_seeking = sim_is_active (uptr) != 0; /* see if the unit is busy */ is_seeking = sim_activate_time (uptr) != 0; /* see if the unit is busy */
if (is_seeking) /* if a seek is in progress, */ if (is_seeking) /* if a seek is in progress, */
uptr->wait = 0; /* set for no unit activation */ uptr->wait = 0; /* set for no unit activation */

View file

@ -358,7 +358,7 @@ int32 lfc_cosched (int32 wait)
{ {
int32 t; int32 t;
t = sim_is_active (&lfc_unit); t = sim_activate_time (&lfc_unit);
return (t? t - 1: wait); return (t? t - 1: wait);
} }

View file

@ -89,7 +89,7 @@ int32 used, incr;
if (clk_dev.flags & DEV_DIS) /* disabled? */ if (clk_dev.flags & DEV_DIS) /* disabled? */
return (stop_inst << IOT_V_REASON) | dat; /* illegal inst */ return (stop_inst << IOT_V_REASON) | dat; /* illegal inst */
used = tmxr_poll - (sim_is_active (&clk_unit) - 1); used = tmxr_poll - (sim_activate_time (&clk_unit) - 1);
incr = (used * CLK_CNTS) / tmxr_poll; incr = (used * CLK_CNTS) / tmxr_poll;
return clk_cntr + incr; return clk_cntr + incr;
} }

View file

@ -154,7 +154,7 @@ tempbase[1] = tim_base[1];
if (tim_mult != TIM_MULT_T20) { /* interpolate? */ if (tim_mult != TIM_MULT_T20) { /* interpolate? */
int32 used; int32 used;
d10 incr; d10 incr;
used = tmr_poll - (sim_is_active (&tim_unit) - 1); used = tmr_poll - (sim_activate_time (&tim_unit) - 1);
incr = (d10) (((double) used * TIM_HW_FREQ) / incr = (d10) (((double) used * TIM_HW_FREQ) /
((double) tmr_poll * (double) clk_tps)); ((double) tmr_poll * (double) clk_tps));
tim_incr_base (tempbase, incr); tim_incr_base (tempbase, incr);
@ -219,7 +219,7 @@ int32 t;
if (tim_mult == TIM_MULT_T20) if (tim_mult == TIM_MULT_T20)
return wait; return wait;
t = sim_is_active (&tim_unit); t = sim_activate_time (&tim_unit);
return (t? t - 1: wait); return (t? t - 1: wait);
} }

View file

@ -1015,7 +1015,7 @@ return;
void update_tucs (int32 flag, int32 drv) void update_tucs (int32 flag, int32 drv)
{ {
int32 act = sim_is_active (&tu_unit[drv]); int32 act = sim_activate_time (&tu_unit[drv]);
if ((flag & ~tucs1) & CS1_DONE) /* DONE 0 to 1? */ if ((flag & ~tucs1) & CS1_DONE) /* DONE 0 to 1? */
tuiff = (tucs1 & CS1_IE)? 1: 0; /* CSTB INTR <- IE */ tuiff = (tucs1 & CS1_IE)? 1: 0; /* CSTB INTR <- IE */

View file

@ -1093,7 +1093,7 @@ t_stat rl_show_dstate (FILE *st, UNIT *uptr, int32 val, void *desc)
(uptr->STAT & RLDS_WGE) ? '1' : '0', (uptr->STAT & RLDS_WGE) ? '1' : '0',
(uptr->STAT & RLDS_SPE) ? '1' : '0'); (uptr->STAT & RLDS_SPE) ? '1' : '0');
if (uptr->flags & UNIT_ATT) { if (uptr->flags & UNIT_ATT) {
if ((cnt = sim_is_active (uptr)) != 0) if ((cnt = sim_activate_time (uptr)) != 0)
fprintf (st, "FNC: %d, %d\n", uptr->FNC, cnt); fprintf (st, "FNC: %d, %d\n", uptr->FNC, cnt);
else else
fputs ("FNC: none\n", st); fputs ("FNC: none\n", st);

View file

@ -462,7 +462,7 @@ int32 clk_cosched (int32 wait)
{ {
int32 t; int32 t;
t = sim_is_active (&clk_unit); t = sim_activate_time (&clk_unit);
return (t? t - 1: wait); return (t? t - 1: wait);
} }

View file

@ -822,7 +822,7 @@ return;
void tu_update_fs (int32 flg, int32 drv) void tu_update_fs (int32 flg, int32 drv)
{ {
int32 act = sim_is_active (&tu_unit[drv]); int32 act = sim_activate_time (&tu_unit[drv]);
tufs = (tufs & ~FS_DYN) | FS_FPR | flg; tufs = (tufs & ~FS_DYN) | FS_FPR | flg;
if (tu_unit[drv].flags & UNIT_ATT) { if (tu_unit[drv].flags & UNIT_ATT) {

View file

@ -402,7 +402,7 @@ int32 clk_cosched (int32 wait)
{ {
int32 t; int32 t;
t = sim_is_active (&clk_unit); t = sim_activate_time (&clk_unit);
return (t? t - 1: wait); return (t? t - 1: wait);
} }

View file

@ -338,7 +338,7 @@ int32 clk_cosched (int32 wait)
{ {
int32 t; int32 t;
t = sim_is_active (&clk_unit); t = sim_activate_time (&clk_unit);
return (t? t - 1: wait); return (t? t - 1: wait);
} }

View file

@ -854,7 +854,7 @@ int32 clk_cosched (int32 wait)
{ {
int32 t; int32 t;
t = sim_is_active (&clk_unit); t = sim_activate_time (&clk_unit);
return (t? t - 1: wait); return (t? t - 1: wait);
} }

View file

@ -855,7 +855,7 @@ int32 clk_cosched (int32 wait)
{ {
int32 t; int32 t;
t = sim_is_active (&clk_unit); t = sim_activate_time (&clk_unit);
return (t? t - 1: wait); return (t? t - 1: wait);
} }

View file

@ -672,7 +672,7 @@ int32 clk_cosched (int32 wait)
{ {
int32 t; int32 t;
t = sim_is_active (&clk_unit); t = sim_activate_time (&clk_unit);
return (t? t - 1: wait); return (t? t - 1: wait);
} }

View file

@ -410,7 +410,7 @@ int32 clk_cosched (int32 wait)
{ {
int32 t; int32 t;
t = sim_is_active (&clk_unit); t = sim_activate_time (&clk_unit);
return (t? t - 1: wait); return (t? t - 1: wait);
} }

View file

@ -1464,7 +1464,7 @@ return;
void tmr_sched (int32 tmr) void tmr_sched (int32 tmr)
{ {
int32 clk_time = sim_is_active (&clk_unit) - 1; int32 clk_time = sim_activate_time (&clk_unit) - 1;
int32 tmr_time; int32 tmr_time;
tmr_sav[tmr] = sim_grtime (); /* save intvl base */ tmr_sav[tmr] = sim_grtime (); /* save intvl base */

View file

@ -278,7 +278,7 @@ t_mtrlnt tbc;
t_stat r; t_stat r;
if (cmd == MCM_INIT) { /* init state */ if (cmd == MCM_INIT) { /* init state */
if ((t = sim_is_active (uptr + MT_REW)) != 0) { /* rewinding? */ if ((t = sim_activate_time (uptr + MT_REW)) != 0) { /* rewinding? */
sim_activate (uptr, t); /* retry later */ sim_activate (uptr, t); /* retry later */
return SCPE_OK; return SCPE_OK;
} }