TMXR: Change rx and tx delta values to be usecs including the speed factor
This commit is contained in:
parent
a3d8cc6118
commit
0a7c9de1e1
6 changed files with 31 additions and 31 deletions
|
@ -728,7 +728,7 @@ void iu_write(uint32 pa, uint32 val, size_t size)
|
||||||
break;
|
break;
|
||||||
case THRB: /* TX/RX Buf B */
|
case THRB: /* TX/RX Buf B */
|
||||||
iu_tx(PORT_B, bval);
|
iu_tx(PORT_B, bval);
|
||||||
sim_activate_abs(contty_xmt_unit, contty_ldsc[0].txdelta);
|
sim_activate_abs(contty_xmt_unit, contty_ldsc[0].txdeltausecs);
|
||||||
break;
|
break;
|
||||||
case OPCR:
|
case OPCR:
|
||||||
iu_state.opcr = bval;
|
iu_state.opcr = bval;
|
||||||
|
|
|
@ -762,7 +762,7 @@ t_stat ports_xmt_svc(UNIT *uptr)
|
||||||
(ports_state[ln].oflag & ONLCR) &&
|
(ports_state[ln].oflag & ONLCR) &&
|
||||||
!(ports_state[ln].crlf)) {
|
!(ports_state[ln].crlf)) {
|
||||||
if (tmxr_putc_ln(&ports_ldsc[ln], 0xd) == SCPE_OK) {
|
if (tmxr_putc_ln(&ports_ldsc[ln], 0xd) == SCPE_OK) {
|
||||||
wait = MIN(wait, ports_ldsc[ln].txdelta);
|
wait = MIN(wait, ports_ldsc[ln].txdeltausecs);
|
||||||
sim_debug(IO_DBG, &ports_dev,
|
sim_debug(IO_DBG, &ports_dev,
|
||||||
"[%08x] [ports_xmt_svc] [LINE %d] XMIT (crlf): %02x (%c)\n",
|
"[%08x] [ports_xmt_svc] [LINE %d] XMIT (crlf): %02x (%c)\n",
|
||||||
R[NUM_PC], ln, 0xd, 0xd);
|
R[NUM_PC], ln, 0xd, 0xd);
|
||||||
|
@ -776,7 +776,7 @@ t_stat ports_xmt_svc(UNIT *uptr)
|
||||||
ports_state[ln].crlf = FALSE;
|
ports_state[ln].crlf = FALSE;
|
||||||
|
|
||||||
if (tmxr_putc_ln(&ports_ldsc[ln], c) == SCPE_OK) {
|
if (tmxr_putc_ln(&ports_ldsc[ln], c) == SCPE_OK) {
|
||||||
wait = MIN(wait, ports_ldsc[ln].txdelta);
|
wait = MIN(wait, ports_ldsc[ln].txdeltausecs);
|
||||||
ports_state[ln].tx_chars--;
|
ports_state[ln].tx_chars--;
|
||||||
ports_state[ln].tx_addr++;
|
ports_state[ln].tx_addr++;
|
||||||
sim_debug(IO_DBG, &ports_dev,
|
sim_debug(IO_DBG, &ports_dev,
|
||||||
|
|
|
@ -536,7 +536,7 @@ switch ((PA >> 1) & 03) { /* case on PA<2:1> */
|
||||||
if (c >= 0) { /* store char */
|
if (c >= 0) { /* store char */
|
||||||
tmxr_putc_ln (lp, c);
|
tmxr_putc_ln (lp, c);
|
||||||
dz_update_xmti ();
|
dz_update_xmti ();
|
||||||
sim_activate_after_abs (&dz_unit[1], lp->txdelta);/* */
|
sim_activate_after_abs (&dz_unit[1], lp->txdeltausecs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -2155,8 +2155,8 @@ t_stat sim_show_cons_speed (FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag, CONS
|
||||||
{
|
{
|
||||||
if (sim_con_ldsc.rxbps) {
|
if (sim_con_ldsc.rxbps) {
|
||||||
fprintf (st, "Speed = %d", sim_con_ldsc.rxbps);
|
fprintf (st, "Speed = %d", sim_con_ldsc.rxbps);
|
||||||
if (sim_con_ldsc.bpsfactor != TMXR_BPS_UNIT_SCALE)
|
if (sim_con_ldsc.bpsfactor != 1.0)
|
||||||
fprintf (st, "*%.0f", sim_con_ldsc.bpsfactor / TMXR_BPS_UNIT_SCALE);
|
fprintf (st, "*%.0f", sim_con_ldsc.bpsfactor);
|
||||||
fprintf (st, " bps\n");
|
fprintf (st, " bps\n");
|
||||||
}
|
}
|
||||||
return SCPE_OK;
|
return SCPE_OK;
|
||||||
|
@ -2799,7 +2799,7 @@ if (!sim_rem_master_mode) {
|
||||||
(sim_con_ldsc.serport == 0)) { /* and not serial? */
|
(sim_con_ldsc.serport == 0)) { /* and not serial? */
|
||||||
if (c && sim_con_ldsc.rxbps) /* got something && rate limiting? */
|
if (c && sim_con_ldsc.rxbps) /* got something && rate limiting? */
|
||||||
sim_con_ldsc.rxnexttime = /* compute next input time */
|
sim_con_ldsc.rxnexttime = /* compute next input time */
|
||||||
floor (sim_gtime () + ((sim_con_ldsc.rxdelta * sim_timer_inst_per_sec ()) / sim_con_ldsc.bpsfactor));
|
floor (sim_gtime () + ((sim_con_ldsc.rxdeltausecs * sim_timer_inst_per_sec ()) / USECS_PER_SECOND));
|
||||||
if (c)
|
if (c)
|
||||||
sim_debug (DBG_RCV, &sim_con_telnet, "sim_poll_kbd() returning: '%c' (0x%02X)\n", sim_isprint (c & 0xFF) ? c & 0xFF : '.', 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 */
|
return c; /* in-window */
|
||||||
|
|
42
sim_tmxr.c
42
sim_tmxr.c
|
@ -735,7 +735,7 @@ else {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((written > 0) && (lp->txbps) && (sim_is_running))
|
if ((written > 0) && (lp->txbps) && (sim_is_running))
|
||||||
lp->txnexttime = floor (sim_gtime () + ((written * lp->txdelta * sim_timer_inst_per_sec ()) / lp->bpsfactor));
|
lp->txnexttime = floor (sim_gtime () + ((written * lp->txdeltausecs * sim_timer_inst_per_sec ()) / USECS_PER_SECOND));
|
||||||
return written;
|
return written;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1784,9 +1784,9 @@ if (lp->rxbpi == lp->rxbpr) /* empty? zero ptrs */
|
||||||
lp->rxbpi = lp->rxbpr = 0;
|
lp->rxbpi = lp->rxbpr = 0;
|
||||||
if (val) { /* Got something? */
|
if (val) { /* Got something? */
|
||||||
if (lp->rxbps)
|
if (lp->rxbps)
|
||||||
lp->rxnexttime = floor (sim_gtime () + ((lp->rxdelta * sim_timer_inst_per_sec ()) / lp->bpsfactor));
|
lp->rxnexttime = floor (sim_gtime () + ((lp->rxdeltausecs * sim_timer_inst_per_sec ()) / USECS_PER_SECOND));
|
||||||
else
|
else
|
||||||
lp->rxnexttime = floor (sim_gtime () + ((lp->mp->uptr->wait * sim_timer_inst_per_sec ()) / TMXR_BPS_UNIT_SCALE));
|
lp->rxnexttime = floor (sim_gtime () + ((lp->mp->uptr->wait * sim_timer_inst_per_sec ()) / USECS_PER_SECOND));
|
||||||
}
|
}
|
||||||
tmxr_debug_return(lp, val);
|
tmxr_debug_return(lp, val);
|
||||||
return val;
|
return val;
|
||||||
|
@ -2173,8 +2173,8 @@ if ((lp->txbfd && !lp->notelnet) || (TXBUF_AVAIL(lp) > 1)) {/* room for char (+
|
||||||
sim_exp_check (&lp->expect, chr); /* process expect rules as needed */
|
sim_exp_check (&lp->expect, chr); /* process expect rules as needed */
|
||||||
if (!sim_is_running) { /* attach message or other non simulation time message? */
|
if (!sim_is_running) { /* attach message or other non simulation time message? */
|
||||||
tmxr_send_buffered_data (lp); /* put data on wire */
|
tmxr_send_buffered_data (lp); /* put data on wire */
|
||||||
sim_os_ms_sleep(((lp->txbps) && (lp->txdelta > 1000)) ? /* rate limiting output slower than 1000 cps */
|
sim_os_ms_sleep(((lp->txbps) && (lp->txdeltausecs > 1000)) ? /* rate limiting output slower than 1000 cps */
|
||||||
(lp->txdelta - 1000) / 1000 :
|
(lp->txdeltausecs - 1000) / 1000 :
|
||||||
10); /* wait an approximate character delay */
|
10); /* wait an approximate character delay */
|
||||||
}
|
}
|
||||||
return SCPE_OK; /* char sent */
|
return SCPE_OK; /* char sent */
|
||||||
|
@ -2477,24 +2477,24 @@ if (*cptr == '*') {
|
||||||
|
|
||||||
if (r != SCPE_OK)
|
if (r != SCPE_OK)
|
||||||
return r;
|
return r;
|
||||||
lp->bpsfactor = TMXR_BPS_UNIT_SCALE * bpsfactor;
|
lp->bpsfactor = bpsfactor;
|
||||||
}
|
}
|
||||||
if ((lp->serport) && (lp->bpsfactor != 0.0))
|
if ((lp->serport) && (lp->bpsfactor != 0.0))
|
||||||
lp->bpsfactor = TMXR_BPS_UNIT_SCALE;
|
lp->bpsfactor = 1.0;
|
||||||
lp->rxdelta = _tmln_speed_delta (speed);
|
lp->rxdeltausecs = (uint32)(_tmln_speed_delta (speed) / lp->bpsfactor);
|
||||||
lp->rxnexttime = 0.0;
|
lp->rxnexttime = 0.0;
|
||||||
uptr = lp->uptr;
|
uptr = lp->uptr;
|
||||||
if ((!uptr) && (lp->mp))
|
if ((!uptr) && (lp->mp))
|
||||||
uptr = lp->mp->uptr;
|
uptr = lp->mp->uptr;
|
||||||
if (uptr)
|
if (uptr)
|
||||||
uptr->wait = lp->rxdelta;
|
uptr->wait = lp->rxdeltausecs;
|
||||||
if (lp->bpsfactor == 0.0)
|
if (lp->bpsfactor == 0.0)
|
||||||
lp->bpsfactor = TMXR_BPS_UNIT_SCALE;
|
lp->bpsfactor = 1.0;
|
||||||
lp->txbps = lp->rxbps;
|
lp->txbps = lp->rxbps;
|
||||||
lp->txdelta = lp->rxdelta;
|
lp->txdeltausecs = lp->rxdeltausecs;
|
||||||
lp->txnexttime = lp->rxnexttime;
|
lp->txnexttime = lp->rxnexttime;
|
||||||
if (lp->o_uptr)
|
if (lp->o_uptr)
|
||||||
lp->o_uptr->wait = lp->txdelta;
|
lp->o_uptr->wait = lp->txdeltausecs;
|
||||||
return SCPE_OK;
|
return SCPE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2532,7 +2532,7 @@ for (i = 0; i < mp->lines; i++) { /* initialize lines */
|
||||||
lp->mp = mp; /* set the back pointer */
|
lp->mp = mp; /* set the back pointer */
|
||||||
lp->modem_control = mp->modem_control;
|
lp->modem_control = mp->modem_control;
|
||||||
if (lp->bpsfactor == 0.0)
|
if (lp->bpsfactor == 0.0)
|
||||||
lp->bpsfactor = TMXR_BPS_UNIT_SCALE;
|
lp->bpsfactor = 1.0;
|
||||||
}
|
}
|
||||||
mp->ring_sock = INVALID_SOCKET;
|
mp->ring_sock = INVALID_SOCKET;
|
||||||
free (mp->ring_ipad);
|
free (mp->ring_ipad);
|
||||||
|
@ -3938,8 +3938,8 @@ else {
|
||||||
if (mp->lines == 1) {
|
if (mp->lines == 1) {
|
||||||
if (mp->ldsc->rxbps) {
|
if (mp->ldsc->rxbps) {
|
||||||
fprintf(st, ", Speed=%d", mp->ldsc->rxbps);
|
fprintf(st, ", Speed=%d", mp->ldsc->rxbps);
|
||||||
if (mp->ldsc->bpsfactor != TMXR_BPS_UNIT_SCALE)
|
if (mp->ldsc->bpsfactor != 1.0)
|
||||||
fprintf(st, "*%.0f", mp->ldsc->bpsfactor / TMXR_BPS_UNIT_SCALE);
|
fprintf(st, "*%.0f", mp->ldsc->bpsfactor);
|
||||||
fprintf(st, " bps");
|
fprintf(st, " bps");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3967,13 +3967,13 @@ else {
|
||||||
fprintf(st, ", Loopback");
|
fprintf(st, ", Loopback");
|
||||||
if (lp->rxbps) {
|
if (lp->rxbps) {
|
||||||
fprintf(st, ", Speed=%d", lp->rxbps);
|
fprintf(st, ", Speed=%d", lp->rxbps);
|
||||||
if (lp->bpsfactor != TMXR_BPS_UNIT_SCALE)
|
if (lp->bpsfactor != 1.0)
|
||||||
fprintf(st, "*%.0f", lp->bpsfactor / TMXR_BPS_UNIT_SCALE);
|
fprintf(st, "*%.0f", lp->bpsfactor);
|
||||||
fprintf(st, " bps");
|
fprintf(st, " bps");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (lp->bpsfactor != TMXR_BPS_UNIT_SCALE)
|
if (lp->bpsfactor != 1.0)
|
||||||
fprintf(st, ", Speed=*%.0f bps", lp->bpsfactor / TMXR_BPS_UNIT_SCALE);
|
fprintf(st, ", Speed=*%.0f bps", lp->bpsfactor);
|
||||||
}
|
}
|
||||||
fprintf (st, "\n");
|
fprintf (st, "\n");
|
||||||
}
|
}
|
||||||
|
@ -4679,8 +4679,8 @@ else {
|
||||||
fprintf (st, " speed = %u", lp->rxbps);
|
fprintf (st, " speed = %u", lp->rxbps);
|
||||||
else
|
else
|
||||||
fprintf (st, " speed = %u/%u", lp->rxbps, lp->txbps);
|
fprintf (st, " speed = %u/%u", lp->rxbps, lp->txbps);
|
||||||
if (lp->bpsfactor / TMXR_BPS_UNIT_SCALE > 1.0)
|
if (lp->bpsfactor > 1.0)
|
||||||
fprintf (st, "*%.0f", lp->bpsfactor / TMXR_BPS_UNIT_SCALE);
|
fprintf (st, "*%.0f", lp->bpsfactor);
|
||||||
fprintf (st, " bps\n");
|
fprintf (st, " bps\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -170,11 +170,11 @@ struct tmln {
|
||||||
uint32 rxpboffset; /* rcv packet buffer offset */
|
uint32 rxpboffset; /* rcv packet buffer offset */
|
||||||
uint32 rxbps; /* rcv bps speed (0 - unlimited) */
|
uint32 rxbps; /* rcv bps speed (0 - unlimited) */
|
||||||
double bpsfactor; /* receive speed factor (scaled to usecs) */
|
double bpsfactor; /* receive speed factor (scaled to usecs) */
|
||||||
#define TMXR_BPS_UNIT_SCALE 1000000.0
|
#define USECS_PER_SECOND 1000000.0
|
||||||
uint32 rxdelta; /* rcv inter character min time (usecs) */
|
uint32 rxdeltausecs; /* 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 txbps; /* xmt bps speed (0 - unlimited) */
|
||||||
uint32 txdelta; /* xmt inter character min time (usecs) */
|
uint32 txdeltausecs; /* xmt inter character min time (usecs) */
|
||||||
double txnexttime; /* min time for next transmit character */
|
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 */
|
||||||
|
|
Loading…
Add table
Reference in a new issue