mirror of
https://github.com/simh/simh.git
synced 2026-01-27 12:32:24 +00:00
Adds serial port support to the multiplexer library.
It also modifies the HP 2100 and PDP11 multiplexers to add serial support as demonstrations of the capability that, one day, might be extended to all simulators. I have tested the HP support, but I relied on Holger Veit to test the DEC stuff, so I can't guarantee that it works. I also relied on Holger to test under Linux, so the same caveat applies.
The changes needed in the device simulators are relatively small. For example, if you look at the patches for "hp2100_baci.c", you'll note that most of them are documentation changes. The only things of note are:
- an expansion of the TMXR initializer
- additional code in the "attach" routine to try attaching a serial port
if attaching a socket fails
- additional code in the "detach" routine for the same reasons
The HP MPX device (hp2100_mpx.c) needs a tiny bit of additional support from the ATTACH and DETACH commands. Specifically, SCP was modified to set a flag ("sim_unit_ref") to indicate whether ATTACH MPX or ATTACH MPX0 was done, i.e., to differentiate between a device and a unit attach (recall that SCP treats these as both referring to unit 0). This is needed because the socket attaches (logically) to the device, whereas a serial port attaches to a line. Without this flag, the attach routine cannot differentiate between ATTACH MPX and ATTACH MPX0, as the distinction is lost by the time the VM's attach routine is called. This support isn't needed for the HP MUX device because the socket attaches to a different device than the lines do.
MPX also requires a bit more work due to the capability to mix serial and Telnet lines on the same multiplexer (BACI is a single-line terminal device).
The attached PDF contains revisions to the "Writing a Simulator for the SIMH System" publication that documents the additions and changes to the multiplexer library for serial port support. User documentation for serial port support currently exists only in the initial comments in "sim_tmxr.c"; I will add the appropriate text to the "SIMH User's Guide" if we decide to add this to the release version.
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
dci,dco DC11 terminal input/output
|
||||
|
||||
17-Aug-2011 RMS Added AUTOCONFIGURE modifier
|
||||
26-Nov-2008 JDB [serial] Added serial port support
|
||||
19-Nov-2008 RMS Revised for common TMXR show routines
|
||||
Revised to autoconfigure vectors
|
||||
|
||||
@@ -130,6 +131,7 @@ t_stat dci_svc (UNIT *uptr);
|
||||
t_stat dco_svc (UNIT *uptr);
|
||||
t_stat dcx_attach (UNIT *uptr, char *cptr);
|
||||
t_stat dcx_detach (UNIT *uptr);
|
||||
t_stat dcl_detach (UNIT *uptr);
|
||||
t_stat dcx_set_lines (UNIT *uptr, int32 val, char *cptr, void *desc);
|
||||
void dcx_enbdis (int32 dis);
|
||||
void dci_clr_int (int32 ln);
|
||||
@@ -251,7 +253,7 @@ DEVICE dco_dev = {
|
||||
"DCO", dco_unit, dco_reg, dco_mod,
|
||||
DCX_LINES, 10, 31, 1, 8, 8,
|
||||
NULL, NULL, &dcx_reset,
|
||||
NULL, NULL, NULL,
|
||||
NULL, &dcx_attach, &dcl_detach,
|
||||
NULL, DEV_UBUS | DEV_DISABLE | DEV_DIS
|
||||
};
|
||||
|
||||
@@ -365,8 +367,6 @@ t_stat dci_svc (UNIT *uptr)
|
||||
{
|
||||
int32 ln, c, temp;
|
||||
|
||||
if ((uptr->flags & UNIT_ATT) == 0) /* attached? */
|
||||
return SCPE_OK;
|
||||
sim_activate (uptr, tmxr_poll); /* continue poll */
|
||||
ln = tmxr_poll_conn (&dcx_desc); /* look for connect */
|
||||
if (ln >= 0) { /* got one? */
|
||||
@@ -509,9 +509,12 @@ t_stat dcx_reset (DEVICE *dptr)
|
||||
int32 ln;
|
||||
|
||||
dcx_enbdis (dptr->flags & DEV_DIS); /* sync enables */
|
||||
sim_cancel (&dci_unit); /* assume stop */
|
||||
if (dci_unit.flags & UNIT_ATT) /* if attached, */
|
||||
sim_activate (&dci_unit, tmxr_poll); /* activate */
|
||||
//
|
||||
if (tmxr_mux_free (&dcx_desc)) /* any lines attached? */
|
||||
sim_cancel (&dci_unit); /* no, so stop poll */
|
||||
else /* attached or listening */
|
||||
sim_activate (&dci_unit, tmxr_poll); /* start poll immediately */
|
||||
//
|
||||
for (ln = 0; ln < DCX_LINES; ln++) /* for all lines */
|
||||
dcx_reset_ln (ln);
|
||||
return auto_config (dci_dev.name, dcx_desc.lines); /* auto config */
|
||||
@@ -531,16 +534,22 @@ dco_clr_int (ln);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Attach master unit */
|
||||
/* Attach master unit or line */
|
||||
|
||||
t_stat dcx_attach (UNIT *uptr, char *cptr)
|
||||
{
|
||||
t_stat r;
|
||||
|
||||
r = tmxr_attach (&dcx_desc, uptr, cptr); /* attach */
|
||||
//
|
||||
if (uptr == &dci_unit) /* master unit? */
|
||||
r = tmxr_attach (&dcx_desc, uptr, cptr); /* attach socket */
|
||||
else
|
||||
r = tmxr_attach_line (uptr, 0, cptr, &dcx_desc); /* attach line */
|
||||
//
|
||||
|
||||
if (r != SCPE_OK) /* error? */
|
||||
return r;
|
||||
sim_activate (uptr, tmxr_poll); /* start poll */
|
||||
sim_activate (&dci_unit, tmxr_poll); /* start poll */
|
||||
return SCPE_OK;
|
||||
}
|
||||
|
||||
@@ -550,14 +559,48 @@ t_stat dcx_detach (UNIT *uptr)
|
||||
{
|
||||
int32 i;
|
||||
t_stat r;
|
||||
t_bool free = TRUE;
|
||||
|
||||
r = tmxr_detach (&dcx_desc, uptr); /* detach */
|
||||
for (i = 0; i < DCX_LINES; i++) /* all lines, */
|
||||
dcx_ldsc[i].rcve = 0; /* disable rcv */
|
||||
sim_cancel (uptr); /* stop poll */
|
||||
|
||||
//
|
||||
if (r == SCPE_OK) {
|
||||
for (i = 0; i < DCX_LINES; i++) /* loop through lines */
|
||||
if (tmxr_line_free (&dcx_ldsc[i])) /* is line free? */
|
||||
dcx_ldsc[i].rcve = 0; /* yes, so disable rcv as line was reset */
|
||||
else
|
||||
free = FALSE; /* mux isn't free if line is in use */
|
||||
|
||||
if (free) /* all lines free? */
|
||||
sim_cancel (uptr); /* stop poll */
|
||||
}
|
||||
//
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
/* Detach line */
|
||||
|
||||
//
|
||||
t_stat dcl_detach (UNIT *uptr)
|
||||
{
|
||||
uint32 ln;
|
||||
t_stat status;
|
||||
|
||||
status = tmxr_detach_line (uptr, 0, NULL, &dcx_desc); /* detach line */
|
||||
|
||||
if (status == SCPE_OK) {
|
||||
ln = uptr - dco_unit; /* determine line number */
|
||||
dcx_ldsc[ln].rcve = 0; /* disable line reception */
|
||||
|
||||
if (tmxr_mux_free (&dcx_desc)) /* all lines free and not listening? */
|
||||
sim_cancel (&dci_unit); /* stop poll */
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
//
|
||||
|
||||
/* Enable/disable device */
|
||||
|
||||
void dcx_enbdis (int32 dis)
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
dz DZ11 terminal multiplexor
|
||||
|
||||
29-Dec-08 RMS Added MTAB_NC to SET LOG command (Walter Mueller)
|
||||
24-Nov-08 JDB [serial] Added serial port support
|
||||
19-Nov-08 RMS Revised for common TMXR show routines
|
||||
18-Jun-07 RMS Added UNIT_IDLE flag
|
||||
29-Oct-06 RMS Synced poll and clock
|
||||
@@ -231,8 +232,12 @@ MTAB dz_mod[] = {
|
||||
{ TT_MODE, TT_MODE_7B, "7b", "7B", NULL },
|
||||
{ TT_MODE, TT_MODE_8B, "8b", "8B", NULL },
|
||||
{ TT_MODE, TT_MODE_7P, "7p", "7P", NULL },
|
||||
//
|
||||
{ MTAB_XTD | MTAB_VDV | MTAB_NC, ':', NULL, "CONNECT",
|
||||
&tmxr_attach_line, NULL, &dz_desc },
|
||||
{ MTAB_XTD | MTAB_VDV, 1, NULL, "DISCONNECT",
|
||||
&tmxr_dscln, NULL, &dz_desc },
|
||||
&tmxr_detach_line, NULL, &dz_desc },
|
||||
//
|
||||
{ UNIT_ATT, UNIT_ATT, "summary", NULL,
|
||||
NULL, &tmxr_show_summ, (void *) &dz_desc },
|
||||
{ MTAB_XTD | MTAB_VDV | MTAB_NMO, 1, "CONNECTIONS", NULL,
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
of lines available to be 8, 16, 24, or 32.
|
||||
Fixed performance issue avoiding redundant polling
|
||||
03-Jan-10 JAD Eliminate gcc warnings
|
||||
24-Nov-08 JDB Removed tmxr_send_buffered_data declaration (now in sim_tmxr.h)
|
||||
19-Nov-08 RMS Revised for common TMXR show routines
|
||||
18-Jun-07 RMS Added UNIT_IDLE flag
|
||||
29-Oct-06 RMS Synced poll and clock
|
||||
@@ -324,8 +325,6 @@ static t_stat vh_set_log (UNIT *uptr, int32 val, char *cptr, void *desc);
|
||||
static t_stat vh_set_nolog (UNIT *uptr, int32 val, char *cptr, void *desc);
|
||||
static t_stat vh_show_log (FILE *st, UNIT *uptr, int32 val, void *desc);
|
||||
|
||||
int32 tmxr_send_buffered_data (TMLN *lp);
|
||||
|
||||
/* SIMH I/O Structures */
|
||||
|
||||
static DIB vh_dib = {
|
||||
|
||||
Reference in New Issue
Block a user