Commit graph

68 commits

Author SHA1 Message Date
Mark Pizzolato
bb9f9155f2 Arranged sequencing of Modem RING and DCD bits to be presented together if DTR is not on and DCD only if DTR is on. 2013-01-25 12:00:53 -08:00
Mark Pizzolato
ab25ad54e8 Fix potential for crash if tmxr_set_get_modem_bits is called without the multiplexer device being attached 2013-01-24 12:09:40 -08:00
Mark Pizzolato
f7b2f44c9c Fixed tmxr xmte and rcve management to be consistent with original behavior 2013-01-24 07:07:39 -08:00
Mark Pizzolato
f4dd30709f Fix DZ issue which didn't report modem bits to the host unless the attach was made with -M. 2013-01-23 19:33:42 -08:00
Mark Pizzolato
e3207c2009 Compiler suggested cleanups 2013-01-23 05:07:44 -08:00
Mark Pizzolato
b661f6c2bd Fix sim_tmxr flag settings to avoid an overwrite which was introduced when the dynflags was added 2013-01-22 16:03:18 -08:00
Mark Pizzolato
83c1d80194 Merge branch 'master' into AsyncTmxr
Conflicts merged and missing changes in new modules added as needed for clock co-scheduling.
2013-01-21 16:52:42 -08:00
Mark Pizzolato
d46ebc7d49 Untangle circular include references between tmxr serial and sock include files. 2013-01-21 11:29:27 -08:00
Mark Pizzolato
19c4ccbf10 Added dynflags to the unit structure to track dynamic flags used by scp & libraries. This avoids expanding the set of unit flags and encroaching on the available user flags . 2013-01-18 09:46:13 -08:00
Mark Pizzolato
4f19d08869 Initial merge of Asynchronous Multiplexer and Asynchronous Clock support 2013-01-17 11:34:51 -08:00
Mark Pizzolato
6eb3804620 Standardized scp command formatting in help output 2013-01-15 06:21:32 -08:00
Mark Pizzolato
1213f098e2 Fixed Buffered Console behavior which ended up flushing buffer contents once a second and clearing the buffer. We were also incorrectly flushing buffer contents when a connection dropped. 2013-01-11 16:34:05 -08:00
Mark Pizzolato
744f65a36c Fleshed out the tmxr help and set the HP2100 to use the mux help by default 2013-01-10 17:51:25 -08:00
Mark Pizzolato
dac73b9381 Migrating scp and library global variables to be declared as extern in the appropriate library include file and remove repetitive declarations in referencing modules. 2013-01-10 13:29:15 -08:00
Mark Pizzolato
784ae24324 - Fixed asynchronous i/o hangs introduced when asynchronous cancel support was added
- Added event debug support to scp and the vax simulator
- Moved external declarations into include files related to modules which define them and removed random externs from modules which referenced them
- Fixed typos in sim_ether
- Fixed sim_disk and sim_tape to properly manage asynchronous threads on an i/o flush
2013-01-09 17:02:58 -08:00
Mark Pizzolato
df4cc945bb Changed the tmxr_attach parsing code to allow more natural specification for the configuration of different information for multiple lines as per Dave Bryan's suggestion. 2013-01-06 05:53:41 -08:00
Mark Pizzolato
b78c91b4db Fixed error paths during attach/detach and fixed a per line listen detach bug 2013-01-05 16:57:04 -08:00
Mark Pizzolato
ba0f331fa5 Added framework to support per device help commands 2012-12-30 13:12:15 -08:00
Mark Pizzolato
53c537b8dd Cleanup the mux attach string for single line multiplexers 2012-12-29 07:40:21 -08:00
Mark Pizzolato
122ca9b7cd Fix potential attach order bug when attaching a serial port to a single line mux found by Dave Bryan 2012-12-29 06:26:47 -08:00
Mark Pizzolato
33a2ec9e35 Fixed missing ipad setup for outgoing connections 2012-12-26 10:55:35 -08:00
Mark Pizzolato
af93ca96c3 Added /dev/ttyAMAn devices as possible serial port lines on *nix systems.
Fixed reset disconnect logic for serial lines
2012-12-26 10:51:19 -08:00
Mark Pizzolato
6862041eca Properly shutdown prior connecting socket when establishing a new one 2012-12-22 11:57:22 -08:00
Mark Pizzolato
2a89d9bdc6 Behave more consistently and only tear down prior listening sockets if a replacement will actually work. 2012-12-22 10:19:13 -08:00
Mark Pizzolato
afd09eee2e Made parsing of MUX attach arguments more robust and tolerant of inconsistent sequences of arguments.
Fixed memory leaks in error paths
2012-12-22 07:10:17 -08:00
Mark Pizzolato
11cc564f0c Fix proper cleanup when a mux telnet session terminates. 2012-12-21 13:55:30 -08:00
Mark Pizzolato
1370ad6a2c Fixed console serial port connection checking 2012-12-18 15:41:34 -08:00
Mark Pizzolato
a72d85b2bd Fix TMXR for devices which reference the TMLN conn variable as a connection state flag 2012-12-18 09:53:01 -08:00
Mark Pizzolato
beeb5ae09e Cleaned up the formatting of SHOW MULTIPLEXER output based on input from Dave Bryan 2012-12-16 06:23:18 -08:00
Mark Pizzolato
6cabdb9f9f Fixed duplicate logging output when output buffers are full and potential pauses in console output (reported by Mark Benson) 2012-12-15 11:40:20 -08:00
Mark Pizzolato
60a0881c71 Fixes after Dave Bryan's testing. 2012-12-15 07:58:11 -08:00
Mark Pizzolato
59afee3128 Serial Multiplexer cleanup after review by Dave Bryan
- Added functionality to return the lines with attached serial ports by calling tmxr_poll_conn one time after a serial port is attached.
- Added the ability to close a serial port from the sim> prompt if a device implements a SET dev DISCONNECT=line command.  A serial port is closed if the -C switch is specified on the DISCONNECT command line.
- Cleaned up the multiplexer status display based on Dave's recommendations.
2012-12-13 13:46:43 -08:00
Mark Pizzolato
7f6a1af5bf Added an optional validation argument to sim_parse_addr for callers which need to confirm incoming connections come from expected sources 2012-12-09 12:12:09 -08:00
Mark Pizzolato
7c7df669ad Asynchronous Support
scp.c, scp.h
	- added sim_uname (Unit Name) API to simplify places which might want to display it (mostly debug messages).
	- added support for clock co-scheduling
	- added debugging to trace event queue activities

    sim_defs.h
	- added support for clock co-scheduling
	- added support for sim_uname (Thread local storage macro)
	- added support for debugging to trace event queue activities
	- simplified debug code by using sim_uname
	- fixed support macro for sim_is_active when asynch timers are in use

   sim_rev.h
	- fixed nested comments

    sim_tmxr.c, sim_tmxr.h
	- added support for clock co-scheduling
	- simplified debug code by using sim_uname
	- added support for devices which poll for output on different units

    sim_timer.c, sim_timer.h
	- added support for clock co-scheduling
	- fixed asynchronous clock calibration to smooth out calibration adjustments
	- simplified debug code by using sim_uname
	- added ability (when running with asynchronous support) to explicitly disable or enable asynchronous timer support.
	- changed sim_timer_inst_per_sec to return a double value since the result is always used in a double expression and integer overflow could occur under strange timing conditions

    vax/vax_stddev.c
	- converted from simulator specific clock co-scheduling to generic clock co-scheduling.

    vax/vax_cpu.c
	- added EVENT and ACTIVATE debug flag (SET CPU DEBUG=EVENT;ACTIVATE) support

    pdp11/pdp11_dz.c
	- converted from simulator specific clock co-scheduling to generic clock co-scheduling.

    pdp11/pdp11_vh.c
	- converted from simulator specific clock co-scheduling to generic clock co-scheduling.

    pdp11/pdp11_xq.c
	- converted from simulator specific clock co-scheduling to generic clock co-scheduling.
2012-11-12 15:33:35 -08:00
Mark Pizzolato
fbb74de9b7 TMXR fixes to support Virtual Null Modem Connections
sim_tmxr.c
sim_defs.h
	- Fixed parsing issues with NOTELNET option.
	- Fixed line closing logic to drop buffered contents when line errors occur before closing link.
	- Fixed logic to allow bidirectional line connections (i.e. listen=1234;connect=ip:2345 on both sides of a a virtual null modem).
2012-11-08 15:45:43 -08:00
Mark Pizzolato
f8ae8d2741 Periodically flush buffered console mux data. This is necessary to cover the situation when data was buffered and sending data out the connection stalled due to OS/network buffering and no more output traffic happens to be generated. 2012-11-07 14:26:07 -08:00
Mark Pizzolato
faa5c61fe4 Added validation of an incoming connection's IP address when a mux line is configured both with a listening port and an outbound connection destination. In this case, connections will only be accepted from the IP address of the target destination. 2012-11-07 05:18:14 -08:00
Mark Pizzolato
8b59f2a12a sim_tmxr.c - Fixed behavior when I/O errors happen on serial port connections. Now a message is displayed and the serial port is closed as opposed to the prior behavior where messages would be spewed incessantly with no benefit. 2012-10-27 12:50:50 -07:00
Mark Pizzolato
15e648f560 sim_tmxr.c Fixed console behaviors the console is directed to a serial port. 2012-10-23 14:40:56 -07:00
Mark Pizzolato
757969ef40 Fixed bugs found during testing by Mark Benson
sim_serial.c

    - Fixed error message printing when retry is merely needed

sim_tmxr.c
     - Fixed parsing to properly recognize a listen port argument of "nnn;notelnet".
     - Fixed buffer wrap output condition.
2012-10-20 07:46:29 -07:00
Mark Pizzolato
0a46da5aa0 Changed pdp11_dz to leverage the tmxr library's pass thru modem control capabilities.
Fixed reporting of DCD for dz lines beyond the first 4.
2012-10-17 14:17:14 -07:00
Mark Pizzolato
02cb620c9b Change to support serial ports on multiplexer devices without any changes to existing multiplexer device emulation code.
Added support for per line tcp listen ports.
Added support for per line outgoing tcp/telnet connections.

Removed DEV_NET from pdp11_dz and pdp11_vh emulators to allow proper restore of
2012-10-17 08:40:01 -07:00
Mark Pizzolato
24696892fd Merge branch 'DMC11' into SerialMux
Conflicts:
	scp.c
	sim_ether.c
	sim_ether.h
	sim_tmxr.c
2012-10-16 15:50:38 -07:00
Mark Pizzolato
30ce7fdbaa Revised the socket library sim_sock(.c & .h) to support both IPv4 and IPv6 leveraging the RFC3493 APIs.
All dependent code has been updated to use the revised interfaces.
2012-09-28 15:34:55 -07:00
Mark Pizzolato
030d790b4c Asynchronous Timer Support
scp.c, scp.h
	- Change the sim_clock_queue event list to be terminated by the value QUEUE_LIST_END instead of NULL.  This allows easy determination of whether a unit is on a list since when it is not on a list the next pointer is NULL.
	- standardized the usage of UPDATE_SIM_TIME
	- Added support for internal/pseudo devices to support the TIMER and CON-TEL pseudo devices (to enable and disable debugging)
	- Reverted to the prior "SET CONSOLE DEBUG" command semantics since the console debug can be manipulated via the generic "SET <dev> DEBUG" command (i.e. SET CON-TEL DEBUG=TRC;XMT;RCV)
	- Changed "SHOW TIMERS" to "SHOW CLOCKS" to display the current calibrated timer information
	- Added sim_is_active_bool API to return the boolean active status avoiding the potential work walking the list when most callers aren't interested in the event firing time
	- Fixed run_boot_prep to properly record the not queued status of any units which are removed from the sim_clock_queue during initialization
	- Added display of DEBUG, NODEBUG options to the SHOW SHOW command

    sim_timer.c, sim_timer.h
	- Added asynchronous timer capabilities with support for calibration and idling
	- Added internal/pseudo device to support debugging of Idle, Calibration and asynch timer activites.
	- Added suppression of timer calibration when idling has occurred

    sim_tmxr.c, sim_tmxr.h
	- Added tmxr_activate_after and macro definition for sim_activate_after to invoke it for proper behavior with multiplexer devices
	- Added all polling units to the standard timer queue when dropping back to the simulator command prompt to accommodate the potential to disable asynch mode
	- Fixed synchronization to operate with pthread synchronized asynch queue and proper stopping of poll when dropping back to the simulator command prompt
	- Fixed calls to select to have a timeout with properly ranged tv_usec values and dealt with possible EINTR return from select

    sim_console.c, sim_console.h
	- Changed internal/pseudo console telnet device name to CON=TEL
	- Reverted to the prior "SET CONSOLE DEBUG" command semantics since the console debug can be manipulated via the generic "SET <dev> DEBUG" command (i.e. SET CON-TEL DEBUG=TRC;XMT;RCV)
	- Fixed synchronization to operate with pthread synchronized asynch queue and proper stopping of poll when dropping back to the simulator command prompt
	- Fixed calls to select to have a timeout with properly ranged tv_usec values

    sim_defs.h
	- Added necessary unit fields to support asynchronous timing activities
	- Added asynchronous macros to support async timing activities
	- Fixed asynch pthread only macros (not using AIO_INTRINSICS).
	- Fixed the definition of the UDATA macro which was never adjusted to accommodate the insertion of 2 extra fields in the unit structure and thus made the initialization of the unit wait field meaningless.
	- Changed the NOQUEUE_WAIT value from 10000 to 1000000.  This is only used when the sim_clock_queue is empty, which normally never happens on any simulator since they all have clocks and/or other frequently polling devices.  With asynchronous multiplexer and timing support the queue is often empty and this value is then used when calculating idling delays.  If it is too small, idling will be inefficient.  Being large should not be a problem otherwise.

    Interdata/id16_cpu.c
	- removed test of sim_idle_enab before calling sim_idle

    Interdata/id32_cpu.c
	- removed test of sim_idle_enab before calling sim_idle

    vax/vax_cpu.c
	- removed test of sim_idle_enab before calling sim_idle

    vax/vax_stddev.c
	- converted CLK device to use the internal timer service API sim_activate_after to leverage asynchronous timing when available
2012-05-26 07:16:04 -07:00
Mark Pizzolato
7c38b83d7c Asynchronous Multiplexer and Console Support
scp.c, scp.h, sim_defs.h
     - Added commands:
          SHOW MULTIPLEXER (MUX)
          SHOW TIMERS
     - Added facilities/APIs:
          sim_activate_after - time specific event scheduling (vs instruction scheduling) API visible, optional separate thread implementation in a later revision
     - Changed Commands:
          SET CONSOLE DEBUG no longer affects global debugging, but merely debugging for the console subsystem.  Use SET DEBUG and SET NODEBUG to affect global debugging.
     - Added Asynchronous polling support

sim_tmxr.h, sim_tmxr.c
     - Added Asynchronous capabilities to the multiplexer subsystem to avoid polling for input and to deliver input data instantly when it arrives instead of delaying for up to one or more full simulated clock ticks.
     - Added debug trace support
     - Added statistic tracking of total bytes transmitted on each line
     - Added more aggressive attempts to flush transmit buffers when they fill before dropping tranmitted characters
     - Fixed status return of tmxr_putc_ln to return SCPE_LOST if the transmitting line isn't connected or buffered.

sim_console.h, sim_console.c
     - Fixed issue where connections to console telnet sessions would succeed for the first connection, but hang indefinitely for additional connects without rejecting due to all lines being busy.  This is handled by using an internal device and unit to hang the required polling on.  Connection polls happen once per second.
     - Added console debugging/trace support.
     - Added Asynchronous capabilities to the console subsystem to avoid polling for input and to deliver input data instantly when it arrives instead of delaying for up to one or more full simulated clock ticks.
     - Added tmxr_set_console_input_unit() API to support asynchronous simulator console I/O

sim_timer.h, sim_timer.c
     - Added SHOW TIMERS support
     - Added mechanism to capture the timer the simulator uses for its clock tick and make this timer globally available for other uses

PDP11/pdp11_dz.c
     - Added debug trace support

PDP11/pdp11_vh.c
     - Added debug trace support
     - Changed timing mechanisms to not assume that the count unit service routine calls measures the passage of time, and created a separate unit to measure time.

VAX/vax_stddev.c
     - Added call to tmxr_set_console_input_unit to leverage Asynchronous console I/O
2012-05-12 13:42:44 -07:00
Mark Pizzolato
c77bdb20f1 Added scp SHOW SERIAL command
Fixed Ethernet formatting of open device names
Fixed serial generic naming to accomodate for the fact that an OS list of serial devices might not include devices which are already opened.
2012-04-25 17:04:48 -07:00
Mark Pizzolato
b2ebd56f9c Generalized serial port naming syntax to refer to host serial ports by the name 'serN' while continuing to allow the use of specific host device names.
Fixed some parsing issues in tmxr_attach_line.
2012-04-22 16:46:10 -07:00
Mark Pizzolato
6912ad167e Fixed tmxr Buffering functionality broken in the Serial merge from Dave 2012-04-20 17:58:21 -07:00
Mark Pizzolato
bc36e9dde5 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.
2012-04-19 19:18:15 -07:00