SPC/S(4S)
NAME
SPC/S − Serial Parallel Communications driver for SBus (stc)
DESCRIPTION
The SPC/S SBus communications board consists of 8 asynchronous serial ports and one IBM PS/2-compatiable parallel port. The stc driver supports up to 8 SPC/S boards in an SBus system. Each serial port has full modem control; the CD, DTR, DSR, RTS and CTS modem control lines are provided, plus flow control is supported in hardware for either RTS/CTS hardware flow control or DC1/DC3 software flow control. The parallel port is unidirectional with support for the ACK, STROBE, BUSY, PAPER OUT, SELECT and ERROR interface signals. Both the serial and parallel ports support those termio(4) device control functions specified by flags in the c_cflag word of the termios(4) structure; in addition, the serial ports support the IGNPAR, PARMRK, INPCK, IXON, IXANY and IXOFF flags in the c_iflag word of the termios(4) structure. The latter c_iflag functions are performed by the stc driver for the serial ports; since the parallel port is a unidirectional, output-only port, no input termios(4) (c_iflag) parameters apply to it. Trying to execute a nonsensical ioctl() on the parallel port is dicey at best. All other termios(4) functions are performed by STREAMS modules pushed atop the driver; when an stc device is opened, the ldterm(4M) and ttcompat(4M) STREAMS modules are automatically pushed on top of the stream if they are specified in the /etc/iu.ap file (the default condition), providing the standard termios(4) interface. Driver-specific ioctl()’s can be found in /opt/SUNWstc/examples/stcio.h
The device names of the form /dev/ttyyn or /dev/term/n specify the serial I/O ports provided on the SPC/S board, conventionally as incoming lines; the device names of the form /dev/ttyzn or /dev/cua/n specify the serial I/O ports provided on the SPC/S board, conventionally as outgoing lines; the device names of the form /dev/stclpn or /dev/printers/n specify the parallel port, and the device names of the form /dev/stcn or /dev/sad/stcn specify a special control port per board.
To allow a single tty line to be connected to a modem and used for both incoming and outgoing calls, a special feature, controlled by the minor device number, has been added. Minor device numbers in the range 128 − 191 correspond to the same physical lines as those in the range 0 - 63 (that is, the same line as the minor device number minus 128).
A dial-in line has a minor device in the range 0 − 63 and is conventionally named /dev/ttyyn, where n is a number indicating which dial-in line it is (so that /dev/ttyy00 is the first dial-in line), and the dial-out line corresponding to that dial-in line has a minor device number 128 greater than the minor device number of the dial-in line and is conventionally named /dev/ttyzn, where n is the number of the dial-in line. The /dev/ttyzn devices correspond to the UNIX convention of /dev/cuan naming for "outgoing" (or call-unit) lines.
The /dev/ttyzn lines are special in that they can be opened even when there is no carrier on the line. Once a /dev/ttyzn line is opened, the corresponding /dev/ttyyn line can not be opened until the /dev/ttyzn line is closed; a blocking open will wait until the /dev/ttyzn line is closed (which will drop DTR, after which DCD will usually drop as well) and carrier is detected again, and a non-blocking open will return an error. Also, if the /dev/ttyyn line has been opened successfully (usually only when carrier is recognized on the modem) the corresponding /dev/ttyzn line can not be opened. This allows a modem to be attached to e.g. /dev/ttyy00 and used for dial-in (by enabling the line for login in /etc/ttytab) and also used for dial-out (by tip(1C) or uucp(1C)) as /dev/ttyz00 when no one is logged in on the line.
MINOR NUMBERS
o p u u | u l l l - these correspond to bits in the minor number
o - set if this device is an outgoing serial line
p - set if this is a parallel port device
u - device unit number
l - device line number
if this is the parallel port line, ’p’ should be 1 and ’lll’ should be all 0’s
if this is the control line, both ’p’ and ’lll’ should be set to all 1’s
IOCTLS
The standard set of termio ioctl() calls are supported by the stc driver on both the serial and parallel ports.
If the CRTSCTS flag in the c_cflag is set, output will be generated only if CTS is high; if CTS is low, output will be frozen. If the CRTSCTS flag is clear, the state of CTS has no effect. Breaks can be generated by the TCSBRK, TIOCSBRK and TIOCCBRK ioctl() calls. The modem control lines TIOCM_CAR, TIOCM_CTS, TIOCM_RTS, TIOCM_DSR and TIOCM_DTR are provided for the serial ports, although the TIOCMGET ioctl() call will not return the state of the TIOCM_RTS or TIOCM_DSR lines, which are output-only signals.
The serial port input and output line speeds may be set to any of the speeds supported by termio(4).
DEVICE SPECIFIC IOCTLS
The following additional ioctl()’s are supported by the stc driver. They and the corresponding structures are defined in /opt/SUNWstc/examples/stcio.h:
STC_DCONTROL(struct stc_defaults_t ∗)
sets/gets default parameters for any line; flushes write queues for any line; process’s uid must be root to set; operates only on /dev/stcn port
STC_SDEFAULTS(struct stc_defaults_t ∗)
sets default parameters for line that take effect on next open(); process’s uid must be root to set
STC_GDEFAULTS(struct stc_defaults_t ∗)
get default parameters (may not be active yet)
STC_SPPC(struct ppc_params_t ∗)
set parallel port parameters (valid until changed or close())
STC_GPPC(struct ppc_params_t ∗)
get parallel port parameters (valid until changed or close())
ERRORS
An open() will fail with errno set to:
ENXIO The unit being opened does not exist.
EBUSY The dial-out device is being opened and the dial-in device is already open, the dial-in device is being opened with a no-delay open and the dial-out device is already open or the unit has been marked as exclusive-use by another process with a TIOCEXCL ioctl() call.
EINTR The open was interrupted by the delivery of a signal.
EPERM The control port for the board was opened by a process whose uid was not root.
An ioctl() will fail with errno set to:
ENOSR A STREAMS data block couldn’t be allocated to return data to the caller.
EINVAL An invalid value was passed as the data argument to the ioctl() call or an invalid argument or op-field was passed in one of the driver-specific ioctl()’s.
EPERM An STC_DCONTROL or STC_SDEFAULTS ioctl() was requested by a process whose uid was not root.
ENOTTY An unrecognized ioctl() command was received.
FILES
/dev/ttyy[00-3f] /dev/term/[00-3f] hardwired and dial-in tty lines
/dev/ttyz[00-3f] /dev/cua/[00-3f] dial-out tty lines
/dev/stclp[0-7] /dev/printers/[0-7] parallel port lines
/dev/stc[0-7] /dev/sad/stc[0-7] control port (see /opt/SUNWstc/examples/stcio.h for more info)
/opt/SUNWstc/examples/stcio.h
header file with ioctl()’s supported by this driver
/opt/SUNWstc/stc_defaults
port defaults data file
/opt/SUNWstc/stc_defs
program to set port defaults
/opt/SUNWstc/stc_config
configuration script to force load or unload driver and make device nodes
EXAMPLES
Check out the /opt/SUNWstc/examples directory.
SOFTCAR, DTR and CTS/RTS FLOW CONTROL
Several methods may be used to specify that a particular serial line is to have soft carrier either enabled or disabled. The non-programmatic method is to edit the /opt/SUNWstc/stc_defaults file after which you run the /opt/SUNWstc/stc_defs program; see the next section, DEFAULTING OTHER LINE PARAMETERS, for more information on this method. From within an application program, you can enable or disable the recognition of carrier on a particular line by issuing the TIOCGSOFTCAR ioctl() to the driver, or by issuing the STC_SDEFAULTS ioctl() using the flags field bit SOFT_CARR (the latter is the preferred method). The default mode of operation for the DTR signal is to assert it on the first open() of a serial line and, if HUPCL is set, to deassert it on the last close(). To change the operation of this feature, issue the STC_SDEFAULTS ioctl() using the flags field bit DTR_ASSERT. To control the default actions of the CTS and RTS hardware handshaking lines, issue the STC_SDEFAULTS ioctl() using the CRTSCTS bit of the cflag field in the termios structure.
DEFAULTING OTHER LINE PARAMETERS
Many other default parameters of the serial and parallel ports can be changed using the STC_SDEFAULTS ioctl() on the particular line or via the /opt/SUNWstc/stc_defs program. See the /opt/SUNWstc/examples/stcio.h header file for a programmatic way to change a line’s defaults, or look at /opt/SUNWstc/stc_defaults.doc for more information on the /opt/SUNWstc/stc_defs program.
PARALLEL PORT PARAMETERS
The default values of certain parallel port parameters that govern data transfer between the SPC/S board and the device attached to the parallel port will usually work well with most devices, however some devices don’t strictly adhere to the IBM PS/2-compatiable (Centronics-compatiable) data transfer and device control/status protocol, and may require modification of one or more of the default parallel port parameters. Some printers, for example, have brain-dead timing on their SELECT line, which manifests itself if you start sending data to the printer and then take it off line; when you put it back on line, the printer does not assert it’s SELECT line until after the next character is sent to the printer. Since the stc driver will not send data to the device if it’s SELECT line is deasserted, a deadlock condition occurs. To remedy this situation, you can change the default signal list that the stc driver will monitor on the parallel port by removing the SELECT signal from the list. This can be done either through the /opt/SUNWstc/stc_defs program or programmatically through the STC_SDEFAULTS ioctl() call. The file /opt/SUNWstc/stc_defaults contains an example of an entry for this type of printer, as well as more information on the format of this file.
LOADABLE ISSUES
If you try to unload the driver and one or more of the ports on one or more of the SPC/S boards is in use (i.e. open()) by a process, the driver will not be unloaded and all lines on all SPC/S boards, with the exception of the control ports, will be marked with an open inhibit flag to prevent further opens until the driver is sucessfully unloaded. If you unload and then re-load the driver, you should re-run the /opt/SUNWstc/stc_defs program to re-establish the default parameters of the ports; this information is not retained between unloading and loading the driver. If you use the stc_config script to re-load the driver, the script will run the /opt/SUNWstc/stc_defs program as the last step in the driver loading process, which will reestablish any default port parameters that you have set up in the /opt/SUNWstc/stc_defaults file.
FLUSHING WRITE QUEUES
In some instances it is is desirable to flush the downstream write queues maintained by STREAMS; this is especially true if a serial port has blocked the transfer of outgoing data due to flow control taking effect and the process sending data on that port decides to close() that port. Due to a STREAMS bug, the close() will wait indefinitely for any remaining data to be removed from the STREAMS queues by the driver and sent to the device. Since the attached device has asserted flow control to stop the transfer of data from the SPC/S driver to the device, and the possibility exists that the attached device may never deassert flow control, the STC_DCONTROL ioctl() has an op-field operation that will flush the write queues on any of the SPC/S’s ports by sinking the data from the STREAMS queues and depositing it into a bit bucket. This can be carried out by the SFLUSH operation. For example code that does this, refer to /opt/SUNWstc/examples/sflush.c.
SEE ALSO
tip(1C), uucp(1C), mcp(4S), mti(4S), termio(4), ldterm(4M), ttcompat(4M)
DIAGNOSTICS
All diagnostic messages from the driver appear on the system console. There are three severity levels of messages displayed:
FATAL - the device driver does not get loaded and any SPC/S boards installed in the system are inacessable (usually occurs during the process of modload’ing the driver)
ERROR - some condition has caused the normal operation of the board and/or device driver to be disrupted; data loss may or may not occur; this class of message might indicate an impending hardware failure
ADVISORY - the device driver has detected a condition that may be of interest to the user of the system; usually this is a transient condition that clears itself
messages during initialization of driver/board:
stc_attach: can’t allocate memory for unit structs
FATAL. kmem_zalloc() failed to allocate memory for the driver’s internal data structures
stc_attach: board revision undeterminable
FATAL. the driver did not get a hardware revision level from the board’s onboard FCode PROM
stc_attach: board revision 0x%x not supported by driver
FATAL. this revision of the board is not supported by the driver
stc_attach: oscillator revision undeterminable
FATAL. the driver did not get an oscillator revision level from the board’s onboard FCode PROM
stc_attach: wierd oscillarot revision (0x%x), assuming 10Mhz
ADVISORY. the board’s onboard FCode PROM returned an unanticipated baud-rate oscillator value, so the driver assumes that a 10Mhz oscillator is installed
stc_attach: error initializing stc%d
FATAL. some error occured while trying to initialize the board; perhaps a memory access failed
stc_attach: bad number of interrupts: %d
FATAL. an incorrect number of interrupts was read from the board’s onboard FCode PROM
stc_attach: bad number of register sets: %d
FATAL. an incorrect number of register sets was read from the board’s onboard FCode PROM
stc_init: stc%d GIVR was not 0x0ff, was: 0x%x
FATAL. the cd-180 8-channel UART failed to initialize properly or a memory fault occured while trying to access the chip
cd180_init: stc%d GIVR was not 0x0ff, was: 0x%x
FATAL. the cd-180 8-channel UART failed to initialize properly or a memory fault occured while trying to access the chip
stc%d: board revision: 0x%x should be updated
ADVISORY. Two versions of the FCode PROM that is on the SPC/S card have been released; V1.0 (0x4) and V1.1 (0x5). The V1.1 PROM fixes some incompatabilities between the V1.0 FCode PROM (on the SPC/S) and the V2.0 OpenBOOT PROM (on your system) and is required on an SPC/S card to be used in a system running Solaris 2.X
stc%d: system boot PROM revision V%d.%d should be updated
ADVISORY. Your system’s BOOT PROM should be updated to at least V1.3 because prior versions of the BOOT PROM did not map the SBus interrupt levels that the SPC/S uses correctly
messages releated to the serial ports:
SET_CCR: CCR timeout
ERROR. the cd-180’s CCR register did not return to zero within the specified timeout period after it was issued a command
PUTSILO: unit %d line %d soft silo overflow
ERROR. the driver’s internal receive data silo for the enunciated line has overflowed because the system has not gotten around to pulling data out of the silo; check that you are using the correct flow control; all data in the silo is flushed; this message may also frequently appear due to a hardware crosstalk problem that was fixed in later releases of the board
stc_rcvex: unit %d line %d receiver overrun, char: 0x%x
ERROR. the driver could not get around to service the cd-180 receive data interrupt before the cd-180’s receive data fifo filled up; this message may also frequently appear due to a hardware crosstalk problem that was fixed in later releases of the board
stc_drainsilo: unit %d line %d can’t allocate streams buffer
ERROR. the driver could not get a STREAMS message buffer from bufcall(); all data in the driver’s receive data silo is flushed
stc_drainsilo: unit %d line %d punting put retries
ERROR. after trying several times to send data down the stream from the driver to the application and finding the path blocked, the driver gives up; all data in the driver’s receive data silo is flushed
stc_modem: unit %d line %d interesting modem control
ADVISORY. the cd-180 posted a modem control line change interrupt but upon examination by the driver, no modem control lines had changed state since the last time a scan was conducted; if you see this problem frequently, it is likely that your data cables are either too long or picking up induced noise
messages releated to the parallel port:
ppc_stat: unit %d PAPER OUT
ADVISORY. the device connected to the parallel port on the enumerated board has signalled that it’s out of paper (PAPER OUT line asserted)
ppc_stat: unit %d PAPER OUT condition cleared
ADVISORY. the previously-detected paper out condition has been cleared by the device connected to the parallel port on the enumerated board (PAPER OUT line deasserted)
ppc_stat: unit %d OFFLINE
ADVISORY. the device connected to the parallel port on the enumerated board has signalled that it is off-line (SLCT line deasserted)
ppc_stat: unit %d OFFLINE condition cleared
ADVISORY. the previously-detected off line condition has been cleared by the device connected to the parallel port on the enumerated board (SLCT line asserted)
ppc_stat: unit %d ERROR
ADVISORY. the device connected to the parallel port on the enumerated board has signalled that it has encountered an error of some sort (ERROR line asserted)
ppc_stat: unit %d ERROR condition cleared
ADVISORY. the previously-detected error condition has been cleared by the device connected to the parallel port on the enumerated board (ERROR line deasserted)
ppc_acktimeout: unit %d ACK timeout
ERROR. the ACK line from the device connected to the parallel port did not assert itself within the configurable timeout period; check to be sure that the device is connected and powered on
ppc_acktimeout: unit %d BUSY timeout
ERROR. the BUSY line from the device connected to the parallel port did not deassert itself within the configurable timeout period; check to be sure that the device is connected and powered on
ppc_int: unit %d stray interrupt
ADVISORY. the parallel port controller (ppc) chip generated an interrupt while the device was closed; this was unexpected and if you see it frequently, your parallel cable might be picking up induced noise causing the ppc to generate an unwanted interrupt, or this could indicate that the ppc might have an internal problem
ppc_acktimeout: unit %d can’t get pointer to read q
ERROR. somehow the driver’s internal ppc data structure has gotten corrupted; this should not happen
ppc_acktimeout: unit %d can’t send M_ERROR message
ERROR. the driver can’t send an M_ERROR STREAMS message to the application; this should not happen either
ppc_signal: unit %d can’t get pointer to read q
ERROR. somehow the driver’s internal ppc data structure has gotten corrupted; this should also not happen
ppc_signal: unit %d can’t send M_PCSIG(PP_SIGTYPE 0x%x) message
ERROR. the driver can’t send an M_PCSIG STREAMS message to the application (which could cause a signal to be posted); this should also not happen either
messages related to STREAMS processing:
stc_wput: unit %d trying to M_STARTI on ppc or control device
ADVISORY. an M_STARTI STREAMS message was sent to the parallel port or the board control device; this should only happen if an application explictly sends this message
stc_wput: unit %d line %d unknown message: 0x%x
ADVISORY. an unknown STREAMS message was sent to the driver; check your application coding
stc_start: unit %d line %d unknown message: 0x%x
ADVISORY. an unknown STREAMS message was sent to the driver; check your application coding
messages related to serial port control:
stc_ioctl: unit %d line %d can’t allocate streams buffer for ioctl
ERROR. the driver could not get a STREAMS message buffer from bufcall() for the requested ioctl; the ioctl will not be executed
stc_ioctl: unit %d line %d can’t allocate STC_DCONTROL block
ERROR. the driver could not allocate a data block from allocb() for the STC_DCONTROL return value; the ioctl does not get executed
stc_ioctl: unit %d line %d can’t allocate STC_GDEFAULTS block
ERROR. the driver could not allocate a data block from allocb() for the STC_GDEFAULTS return value; the ioctl does not get executed
stc_ioctl: unit %d line %d can’t allocate STC_GPPC block
ERROR. the driver could not allocate a data block from allocb() for the STC_GPPC return value; the ioctl does not get executed
stc_ioctl: unit %d line %d can’t allocate TIOCMGET block
ERROR. the driver could not allocate a data block from allocb() for the TIOCMGET return value; the ioctl does not get executed
stc_vdcmd: unit %d cd-180 firmware revision: 0x%x
ADVISORY. the firmware revision level of the cd-180, displayed when the driver is first loaded
SunOS 2.0 — Last change: 10 Feb 1993