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

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

View file

@ -171,6 +171,9 @@ struct tmln {
#define TMXR_RX_BPS_UNIT_SCALE 1000000.0
uint32 rxdelta; /* rcv inter character min time (usecs) */
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 */
uint32 txpbsize; /* xmt packet buffer size */
uint32 txppsize; /* xmt packet packet size */