TMXR: Reworked output to physical serial ports to avoid host OS buffering

This commit is contained in:
Mark Pizzolato 2016-07-15 03:55:21 -07:00
parent c3496e4aa6
commit a9e17075ce
3 changed files with 15 additions and 4 deletions

View file

@ -1740,7 +1740,7 @@ t_stat sim_set_noserial (int32 flag, CONST char *cptr)
{ {
if (cptr && (*cptr != 0)) /* too many arguments? */ if (cptr && (*cptr != 0)) /* too many arguments? */
return SCPE_2MARG; return SCPE_2MARG;
if (sim_con_ldsc.serport == 0) /* ignore if already closed */ if (sim_con_ldsc.serport == 0) /* ignore if already closed */
return SCPE_OK; return SCPE_OK;
return tmxr_close_master (&sim_con_tmxr); /* close master socket */ return tmxr_close_master (&sim_con_tmxr); /* close master socket */
} }

View file

@ -696,9 +696,14 @@ int32 i = lp->txbpr;
if (lp->loopback) if (lp->loopback)
return loop_write (lp, &(lp->txb[i]), length); return loop_write (lp, &(lp->txb[i]), length);
if (lp->serport) /* serial port connection? */ if (lp->serport) { /* serial port connection? */
return sim_write_serial (lp->serport, &(lp->txb[i]), length); if (sim_gtime () < lp->txnexttime)
return 0;
written = sim_write_serial (lp->serport, &(lp->txb[i]), length);
if (written > 0)
lp->txnexttime = floor (sim_gtime () + (lp->txdelta * sim_timer_inst_per_sec ()));
return written;
}
else { /* Telnet connection */ else { /* Telnet connection */
written = sim_write_sock (lp->sock, &(lp->txb[i]), length); written = sim_write_sock (lp->sock, &(lp->txb[i]), length);
@ -2347,6 +2352,9 @@ if (uptr)
uptr->wait = lp->rxdelta; uptr->wait = lp->rxdelta;
if (lp->rxbpsfactor == 0.0) if (lp->rxbpsfactor == 0.0)
lp->rxbpsfactor = TMXR_RX_BPS_UNIT_SCALE; lp->rxbpsfactor = TMXR_RX_BPS_UNIT_SCALE;
lp->txbps = lp->rxbps;
lp->txdelta = lp->rxdelta;
lp->txnexttime = lp->rxnexttime;
return SCPE_OK; return SCPE_OK;
} }

View file

@ -171,6 +171,9 @@ struct tmln {
#define TMXR_RX_BPS_UNIT_SCALE 1000000.0 #define TMXR_RX_BPS_UNIT_SCALE 1000000.0
uint32 rxdelta; /* rcv inter character min time (usecs) */ uint32 rxdelta; /* rcv inter character min time (usecs) */
double rxnexttime; /* min time for next receive character */ double rxnexttime; /* min time for next receive character */
uint32 txbps; /* xmt bps speed (0 - unlimited) */
uint32 txdelta; /* xmt inter character min time (usecs) */
double txnexttime; /* min time for next transmit character */
uint8 *txpb; /* xmt packet buffer */ uint8 *txpb; /* xmt packet buffer */
uint32 txpbsize; /* xmt packet buffer size */ uint32 txpbsize; /* xmt packet buffer size */
uint32 txppsize; /* xmt packet packet size */ uint32 txppsize; /* xmt packet packet size */