diff --git a/doc/simh.doc b/doc/simh.doc index 83ad8393..3de34966 100644 Binary files a/doc/simh.doc and b/doc/simh.doc differ diff --git a/sim_tmxr.c b/sim_tmxr.c index 2377de8c..5475c133 100644 --- a/sim_tmxr.c +++ b/sim_tmxr.c @@ -721,6 +721,7 @@ else { written = sim_write_sock (lp->sock, &(lp->txb[i]), length); if (written == SOCKET_ERROR) { /* did an error occur? */ + lp->txdone = TRUE; if (lp->datagram) return written; /* ignore errors on datagram sockets */ else @@ -736,8 +737,11 @@ else { } } } -if ((written > 0) && (lp->txbps) && (sim_is_running)) - lp->txnexttime = floor (sim_gtime () + ((written * lp->txdeltausecs * sim_timer_inst_per_sec ()) / USECS_PER_SECOND)); +if (written > 0) { + lp->txdone = FALSE; + if ((lp->txbps) && (sim_is_running)) + lp->txnexttime = floor (sim_gtime () + ((written * lp->txdeltausecs * sim_timer_inst_per_sec ()) / USECS_PER_SECOND)); + } return written; } @@ -2372,6 +2376,22 @@ t_bool tmxr_tpbusyln (const TMLN *lp) return (0 != (lp->txppsize - lp->txppoffset)); } +/* Return transmitted data complete status */ +/* 0 – not done, 1 – just now done, -1 – previously done. */ + +int32 tmxr_txdone_ln (TMLN *lp) +{ +if (lp->txdone) + return -1; /* previously done */ +if ((lp->conn == 0) || + (lp->txbps == 0) || + (lp->txnexttime <= sim_gtime ())) { + lp->txdone = TRUE; /* done now */ + return 1; + } +return 0; /* not done */ +} + static void _mux_detach_line (TMLN *lp, t_bool close_listener, t_bool close_connecting) { if (close_listener && lp->master) { @@ -5370,9 +5390,9 @@ if ((dptr) && (dbits & dptr->dctrl)) { } if ((lp->rxnexttime != 0.0) || (lp->txnexttime != 0.0)) { if (lp->rxnexttime != 0.0) - sim_debug (dbits, dptr, " rxnexttime=%.0f", lp->rxnexttime); + sim_debug (dbits, dptr, " rxnexttime=%.0f (%.0f usecs)", lp->rxnexttime, ((lp->rxnexttime - sim_gtime ()) / sim_timer_inst_per_sec ()) * 1000000.0); if (lp->txnexttime != 0.0) - sim_debug (dbits, dptr, " txnexttime=%.0f", lp->txnexttime); + sim_debug (dbits, dptr, " txnexttime=%.0f (%.0f usecs)", lp->txnexttime, ((lp->txnexttime - sim_gtime ()) / sim_timer_inst_per_sec ()) * 1000000.0); sim_debug (dbits, dptr, "\n"); } } diff --git a/sim_tmxr.h b/sim_tmxr.h index f80dd6e0..f9bf277a 100644 --- a/sim_tmxr.h +++ b/sim_tmxr.h @@ -176,6 +176,7 @@ struct tmln { uint32 txbps; /* xmt bps speed (0 - unlimited) */ uint32 txdeltausecs; /* xmt inter character min time (usecs) */ double txnexttime; /* min time for next transmit character */ + t_bool txdone; /* sent data complete indicator - private */ uint8 *txpb; /* xmt packet buffer */ uint32 txpbsize; /* xmt packet buffer size */ uint32 txppsize; /* xmt packet packet size */ @@ -277,6 +278,7 @@ t_stat tmxr_dscln (UNIT *uptr, int32 val, CONST char *cptr, void *desc); int32 tmxr_rqln (const TMLN *lp); int32 tmxr_tqln (const TMLN *lp); int32 tmxr_tpqln (const TMLN *lp); +int32 tmxr_txdone_ln (TMLN *lp); t_bool tmxr_tpbusyln (const TMLN *lp); t_stat tmxr_set_lnorder (UNIT *uptr, int32 val, CONST char *cptr, void *desc); t_stat tmxr_show_lnorder (FILE *st, UNIT *uptr, int32 val, CONST void *desc);