mirror of
https://github.com/simh/simh.git
synced 2026-02-05 16:05:45 +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:
10
scp.c
10
scp.c
@@ -57,6 +57,7 @@
|
||||
08-Feb-09 RMS Fixed warnings in help printouts
|
||||
29-Dec-08 RMS Fixed implementation of MTAB_NC
|
||||
24-Nov-08 RMS Revised RESTORE unit logic for consistency
|
||||
21-Oct-08 JDB [serial] Added sim_unit_ref global to indicate type of reference
|
||||
05-Sep-08 JDB "detach_all" ignores error status returns if shutting down
|
||||
17-Aug-08 RMS Revert RUN/BOOT to standard, rather than powerup, reset
|
||||
25-Jul-08 JDB DO cmd missing params now default to null string
|
||||
@@ -414,6 +415,7 @@ t_stat do_cmd_label (int32 flag, char *cptr, char *label);
|
||||
|
||||
/* Global data */
|
||||
|
||||
UNITREF sim_unit_ref;
|
||||
DEVICE *sim_dflt_dev = NULL;
|
||||
UNIT *sim_clock_queue = NULL;
|
||||
int32 sim_interval = 0;
|
||||
@@ -2817,6 +2819,7 @@ DEVICE *dptr;
|
||||
UNIT *uptr;
|
||||
t_stat r;
|
||||
|
||||
sim_unit_ref = ref_unit_all; /* we will reference all units */
|
||||
if ((start < 0) || (start > 1))
|
||||
return SCPE_IERR;
|
||||
for (i = start; (dptr = sim_devices[i]) != NULL; i++) { /* loop thru dev */
|
||||
@@ -3134,6 +3137,8 @@ t_bool force_restore = sim_switches & SWMASK ('F');
|
||||
#define READ_I(xx) if (sim_fread (&xx, sizeof (xx), 1, rfile) == 0) \
|
||||
return SCPE_IOERR;
|
||||
|
||||
sim_unit_ref = ref_unit_all; /* we will reference all units */
|
||||
|
||||
fstat (fileno (rfile), &rstat);
|
||||
READ_S (buf); /* [V2.5+] read version */
|
||||
v35 = v32 = FALSE;
|
||||
@@ -4579,6 +4584,9 @@ return NULL;
|
||||
Outputs:
|
||||
result = pointer to device (null if no dev)
|
||||
*iptr = pointer to unit (null if nx unit)
|
||||
|
||||
The "sim_unit_ref" global is set to the type of reference specified by cptr
|
||||
(device or unit).
|
||||
*/
|
||||
|
||||
DEVICE *find_unit (char *cptr, UNIT **uptr)
|
||||
@@ -4588,11 +4596,13 @@ char *nptr, *tptr;
|
||||
t_stat r;
|
||||
DEVICE *dptr;
|
||||
|
||||
sim_unit_ref = ref_unit; /* assume unit reference */
|
||||
if (uptr == NULL) /* arg error? */
|
||||
return NULL;
|
||||
if (dptr = find_dev (cptr)) { /* exact match? */
|
||||
if (qdisable (dptr)) /* disabled? */
|
||||
return NULL;
|
||||
sim_unit_ref = ref_dev; /* flag device reference */
|
||||
*uptr = dptr->units; /* unit 0 */
|
||||
return dptr;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user