TMXR: Make transmitted data consider the configured line speed factor
As discussed in #566
This commit is contained in:
parent
13cb294274
commit
ce390bbae4
3 changed files with 25 additions and 24 deletions
|
@ -2155,8 +2155,8 @@ t_stat sim_show_cons_speed (FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag, CONS
|
|||
{
|
||||
if (sim_con_ldsc.rxbps) {
|
||||
fprintf (st, "Speed = %d", sim_con_ldsc.rxbps);
|
||||
if (sim_con_ldsc.rxbpsfactor != TMXR_RX_BPS_UNIT_SCALE)
|
||||
fprintf (st, "*%.0f", sim_con_ldsc.rxbpsfactor/TMXR_RX_BPS_UNIT_SCALE);
|
||||
if (sim_con_ldsc.bpsfactor != TMXR_BPS_UNIT_SCALE)
|
||||
fprintf (st, "*%.0f", sim_con_ldsc.bpsfactor / TMXR_BPS_UNIT_SCALE);
|
||||
fprintf (st, " bps\n");
|
||||
}
|
||||
return SCPE_OK;
|
||||
|
@ -2799,7 +2799,7 @@ if (!sim_rem_master_mode) {
|
|||
(sim_con_ldsc.serport == 0)) { /* and not serial? */
|
||||
if (c && sim_con_ldsc.rxbps) /* got something && rate limiting? */
|
||||
sim_con_ldsc.rxnexttime = /* compute next input time */
|
||||
floor (sim_gtime () + ((sim_con_ldsc.rxdelta * sim_timer_inst_per_sec ())/sim_con_ldsc.rxbpsfactor));
|
||||
floor (sim_gtime () + ((sim_con_ldsc.rxdelta * sim_timer_inst_per_sec ()) / sim_con_ldsc.bpsfactor));
|
||||
if (c)
|
||||
sim_debug (DBG_RCV, &sim_con_telnet, "sim_poll_kbd() returning: '%c' (0x%02X)\n", sim_isprint (c & 0xFF) ? c & 0xFF : '.', c);
|
||||
return c; /* in-window */
|
||||
|
|
39
sim_tmxr.c
39
sim_tmxr.c
|
@ -735,7 +735,7 @@ else {
|
|||
}
|
||||
}
|
||||
if ((written > 0) && (lp->txbps) && (sim_is_running))
|
||||
lp->txnexttime = floor (sim_gtime () + ((written * lp->txdelta * sim_timer_inst_per_sec ()) / TMXR_RX_BPS_UNIT_SCALE));
|
||||
lp->txnexttime = floor (sim_gtime () + ((written * lp->txdelta * sim_timer_inst_per_sec ()) / lp->bpsfactor));
|
||||
return written;
|
||||
}
|
||||
|
||||
|
@ -1784,9 +1784,9 @@ if (lp->rxbpi == lp->rxbpr) /* empty? zero ptrs */
|
|||
lp->rxbpi = lp->rxbpr = 0;
|
||||
if (val) { /* Got something? */
|
||||
if (lp->rxbps)
|
||||
lp->rxnexttime = floor (sim_gtime () + ((lp->rxdelta * sim_timer_inst_per_sec ()) / lp->rxbpsfactor));
|
||||
lp->rxnexttime = floor (sim_gtime () + ((lp->rxdelta * sim_timer_inst_per_sec ()) / lp->bpsfactor));
|
||||
else
|
||||
lp->rxnexttime = floor (sim_gtime () + ((lp->mp->uptr->wait * sim_timer_inst_per_sec ()) / TMXR_RX_BPS_UNIT_SCALE));
|
||||
lp->rxnexttime = floor (sim_gtime () + ((lp->mp->uptr->wait * sim_timer_inst_per_sec ()) / TMXR_BPS_UNIT_SCALE));
|
||||
}
|
||||
tmxr_debug_return(lp, val);
|
||||
return val;
|
||||
|
@ -2473,13 +2473,14 @@ if (_tmln_speed_delta (speed) < 0)
|
|||
return SCPE_ARG;
|
||||
lp->rxbps = (uint32)strtotv (speed, &cptr, 10);
|
||||
if (*cptr == '*') {
|
||||
uint32 rxbpsfactor = (uint32) get_uint (cptr+1, 10, 32, &r);
|
||||
uint32 bpsfactor = (uint32) get_uint (cptr+1, 10, 32, &r);
|
||||
|
||||
if (r != SCPE_OK)
|
||||
return r;
|
||||
lp->rxbpsfactor = TMXR_RX_BPS_UNIT_SCALE * rxbpsfactor;
|
||||
lp->bpsfactor = TMXR_BPS_UNIT_SCALE * bpsfactor;
|
||||
}
|
||||
if ((lp->serport) && (lp->rxbpsfactor != 0.0))
|
||||
lp->rxbpsfactor = TMXR_RX_BPS_UNIT_SCALE;
|
||||
if ((lp->serport) && (lp->bpsfactor != 0.0))
|
||||
lp->bpsfactor = TMXR_BPS_UNIT_SCALE;
|
||||
lp->rxdelta = _tmln_speed_delta (speed);
|
||||
lp->rxnexttime = 0.0;
|
||||
uptr = lp->uptr;
|
||||
|
@ -2487,8 +2488,8 @@ if ((!uptr) && (lp->mp))
|
|||
uptr = lp->mp->uptr;
|
||||
if (uptr)
|
||||
uptr->wait = lp->rxdelta;
|
||||
if (lp->rxbpsfactor == 0.0)
|
||||
lp->rxbpsfactor = TMXR_RX_BPS_UNIT_SCALE;
|
||||
if (lp->bpsfactor == 0.0)
|
||||
lp->bpsfactor = TMXR_BPS_UNIT_SCALE;
|
||||
lp->txbps = lp->rxbps;
|
||||
lp->txdelta = lp->rxdelta;
|
||||
lp->txnexttime = lp->rxnexttime;
|
||||
|
@ -2530,8 +2531,8 @@ for (i = 0; i < mp->lines; i++) { /* initialize lines */
|
|||
lp = mp->ldsc + i;
|
||||
lp->mp = mp; /* set the back pointer */
|
||||
lp->modem_control = mp->modem_control;
|
||||
if (lp->rxbpsfactor == 0.0)
|
||||
lp->rxbpsfactor = TMXR_RX_BPS_UNIT_SCALE;
|
||||
if (lp->bpsfactor == 0.0)
|
||||
lp->bpsfactor = TMXR_BPS_UNIT_SCALE;
|
||||
}
|
||||
mp->ring_sock = INVALID_SOCKET;
|
||||
free (mp->ring_ipad);
|
||||
|
@ -3914,8 +3915,8 @@ else {
|
|||
if (mp->lines == 1) {
|
||||
if (mp->ldsc->rxbps) {
|
||||
fprintf(st, ", Speed=%d", mp->ldsc->rxbps);
|
||||
if (mp->ldsc->rxbpsfactor != TMXR_RX_BPS_UNIT_SCALE)
|
||||
fprintf(st, "*%.0f", mp->ldsc->rxbpsfactor/TMXR_RX_BPS_UNIT_SCALE);
|
||||
if (mp->ldsc->bpsfactor != TMXR_BPS_UNIT_SCALE)
|
||||
fprintf(st, "*%.0f", mp->ldsc->bpsfactor / TMXR_BPS_UNIT_SCALE);
|
||||
fprintf(st, " bps");
|
||||
}
|
||||
}
|
||||
|
@ -3943,13 +3944,13 @@ else {
|
|||
fprintf(st, ", Loopback");
|
||||
if (lp->rxbps) {
|
||||
fprintf(st, ", Speed=%d", lp->rxbps);
|
||||
if (lp->rxbpsfactor != TMXR_RX_BPS_UNIT_SCALE)
|
||||
fprintf(st, "*%.0f", lp->rxbpsfactor/TMXR_RX_BPS_UNIT_SCALE);
|
||||
if (lp->bpsfactor != TMXR_BPS_UNIT_SCALE)
|
||||
fprintf(st, "*%.0f", lp->bpsfactor / TMXR_BPS_UNIT_SCALE);
|
||||
fprintf(st, " bps");
|
||||
}
|
||||
else {
|
||||
if (lp->rxbpsfactor != TMXR_RX_BPS_UNIT_SCALE)
|
||||
fprintf(st, ", Speed=*%.0f bps", lp->rxbpsfactor/TMXR_RX_BPS_UNIT_SCALE);
|
||||
if (lp->bpsfactor != TMXR_BPS_UNIT_SCALE)
|
||||
fprintf(st, ", Speed=*%.0f bps", lp->bpsfactor / TMXR_BPS_UNIT_SCALE);
|
||||
}
|
||||
fprintf (st, "\n");
|
||||
}
|
||||
|
@ -4650,8 +4651,8 @@ else {
|
|||
fprintf (st, " speed = %u", lp->rxbps);
|
||||
else
|
||||
fprintf (st, " speed = %u/%u", lp->rxbps, lp->txbps);
|
||||
if (lp->rxbpsfactor / TMXR_RX_BPS_UNIT_SCALE > 1.0)
|
||||
fprintf (st, "*%.0f", lp->rxbpsfactor / TMXR_RX_BPS_UNIT_SCALE);
|
||||
if (lp->bpsfactor / TMXR_BPS_UNIT_SCALE > 1.0)
|
||||
fprintf (st, "*%.0f", lp->bpsfactor / TMXR_BPS_UNIT_SCALE);
|
||||
fprintf (st, " bps\n");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -169,8 +169,8 @@ struct tmln {
|
|||
uint32 rxpbsize; /* rcv packet buffer size */
|
||||
uint32 rxpboffset; /* rcv packet buffer offset */
|
||||
uint32 rxbps; /* rcv bps speed (0 - unlimited) */
|
||||
double rxbpsfactor; /* receive speed factor (scaled to usecs) */
|
||||
#define TMXR_RX_BPS_UNIT_SCALE 1000000.0
|
||||
double bpsfactor; /* receive speed factor (scaled to usecs) */
|
||||
#define TMXR_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) */
|
||||
|
|
Loading…
Add table
Reference in a new issue