2 .\" Copyright (c) 1997, Sun Microsystems, Inc.
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH ZSH 7D "Jan 1, 1997"
8 zsh \- On-board serial HDLC/SDLC interface
17 open(/dev/zsh\fIn, mode \fR\fB);\fR
22 open(/dev/zsh\fI, mode \fR\fB);\fR
28 The \fBzsh\fR module is a loadable \fBSTREAMS\fR driver that implements the
29 sending and receiving of data packets as \fBHDLC\fR frames over synchronous
30 serial lines. The module is not a standalone driver, but instead depends upon
31 the \fBzs\fR module for the hardware support required by all on-board serial
32 devices. When loaded this module acts as an extension to the \fBzs\fR driver,
33 providing access to an \fBHDLC\fR interface through character-special devices.
36 The \fBzsh\fR\fIn\fR devices provide what is known as a \fBdata path\fR which
37 supports the transfer of data via \fBread\fR(2) and \fBwrite\fR(2) system
38 calls, as well as \fBioctl\fR(2) calls. Data path opens are exclusive in order
39 to protect against injection or diversion of data by another process.
42 The \fBzsh\fR device provides a separate \fBcontrol path\fR for use by programs
43 that need to configure or monitor a connection independent of any exclusive
44 access restrictions imposed by data path opens. Up to three control paths may
45 be active on a particular serial channel at any one time. Control path
46 accesses are restricted to \fBioctl\fR(2) calls only; no data transfer is
50 When used in synchronous modes, the \fBZ8530 SCC\fR supports several options
51 for \fBclock sourcing\fR and \fBdata encoding\fR. Both the transmit and receive
52 clock sources can be set to be the external \fBT\fRransmit \fBC\fRlock
53 (\fBTRxC\fR), external \fBR\fReceive \fBC\fRlock (\fBRTxC\fR), the internal
54 \fBB\fRaud \fBR\fRate \fBG\fRenerator (\fBBRG\fR), or the output of the
55 \fBSCC\fR's \fBD\fRigital \fBP\fRhase-\fBL\fRock \fBL\fRoop (\fBDPLL\fR).
58 The \fBB\fRaud \fBR\fRate \fBG\fRenerator is a programmable divisor that
59 derives a clock frequency from the \fBPCLK\fR input signal to the \fBSCC\fR. A
60 programmed baud rate is translated into a 16-bit \fBtime\fR \fBconstant\fR that
61 is stored in the \fBSCC\fR. When using the \fBBRG\fR as a clock source the
62 driver may answer a query of its current speed with a value different from the
63 one specified. This is because baud rates translate into time constants in
64 discrete steps, and reverse translation shows the change. If an exact baud
65 rate is required that cannot be obtained with the \fBBRG\fR, an external clock
66 source must be selected.
69 Use of the \fBDPLL\fR option requires the selection of \fBNRZI\fR data encoding
70 and the setting of a non-zero value for the baud rate, because the \fBDPLL\fR
71 uses the \fBBRG\fR as its reference clock source.
74 A \fBlocal loopback mode\fR is available, primarily for use by the
75 \fBsyncloop\fR(1M) utility for testing purposes, and should not be confused
76 with \fBSDLC\fR loop mode, which is not supported on this interface. Also, an
77 \fBauto-echo\fR feature may be selected that causes all incoming data to be
78 routed to the transmit data line, allowing the port to act as the remote end of
79 a digital loop. Neither of these options should be selected casually, or left
80 in use when not needed.
83 The \fBzsh\fR driver keeps running totals of various hardware generated events
84 for each channel. These include numbers of packets and characters sent and
85 received, abort conditions detected by the receiver, receive \fBCRC\fR errors,
86 transmit underruns, receive overruns, input errors and output errors, and
87 message block allocation failures. Input errors are logged whenever an incoming
88 message must be discarded, such as when an abort or \fBCRC\fR error is
89 detected, a receive overrun occurs, or when no message block is available to
90 store incoming data. Output errors are logged when the data must be discarded
91 due to underruns, \fBCTS\fR drops during transmission, \fBCTS\fR timeouts, or
92 excessive watchdog timeouts caused by a cable break.
96 The \fBzsh\fR driver supports several \fBioctl()\fR commands, including:
100 \fB\fBS_IOCGETMODE\fR\fR
103 Return a \fBstruct scc_mode\fR containing parameters currently in use. These
104 include the transmit and receive clock sources, boolean loopback and
105 \fBNRZI\fR mode flags and the integer baud rate.
111 \fB\fBS_IOCSETMODE\fR\fR
114 The argument is a \fBstruct scc_mode\fR from which the \fBSCC\fR channel will
121 \fB\fBS_IOCGETSTATS\fR\fR
124 Return a \fBstruct sl_stats\fR containing the current totals of
125 hardware-generated events. These include numbers of packets and characters sent
126 and received by the driver, aborts and \fBCRC\fR errors detected, transmit
127 underruns, and receive overruns.
133 \fB\fBS_IOCCLRSTATS\fR\fR
136 Clear the hardware statistics for this channel.
142 \fB\fBS_IOCGETSPEED\fR\fR
145 Returns the currently set baud rate as an integer. This may not reflect the
146 actual data transfer rate if external clocks are used.
152 \fB\fBS_IOCGETMCTL\fR\fR
155 Returns the current state of the \fBCTS\fR and \fBDCD\fR incoming modem
156 interface signals as an integer.
161 The following structures are used with \fBzsh\fR \fBioctl()\fR commands:
166 char sm_txclock; /* transmit clock sources */
167 char sm_rxclock; /* receive clock sources */
168 char sm_iflags; /* data and clock inversion flags (non-zsh) */
169 uchar_t sm_config; /* boolean configuration options */
170 int sm_baudrate; /* real baud rate */
171 int sm_retval; /* reason codes for ioctl failures */
174 long ipack; /* input packets */
175 long opack; /* output packets */
176 long ichar; /* input bytes */
177 long ochar; /* output bytes */
178 long abort; /* abort received */
179 long crc; /* CRC error */
180 long cts; /* CTS timeouts */
181 long dcd; /* Carrier drops */
182 long overrun; /* receive overrun */
183 long underrun; /* transmit underrun */
184 long ierror; /* input error */
185 long oerror; /* output error */
186 long nobuffers; /* receive side memory allocation failure */
194 An \fBopen()\fR will fail if a \fBSTREAMS\fR message block cannot be allocated,
202 The unit being opened does not exist.
211 The device is in use by another serial protocol.
216 An \fBioctl()\fR will fail if:
223 An attempt was made to select an invalid clocking source.
232 The baud rate specified for use with the baud rate generator would translate to
233 a null time constant in the \fBSCC\fR's registers.
240 \fB\fB/dev/zsh[0-1]\fR,\fB/dev/zsh\fR\fR
244 character-special devices
250 \fB\fB/usr/include/sys/ser_sync.h\fR\fR
254 header file specifying synchronous serial communication definitions
260 See \fBattributes\fR(5) for descriptions of the following attributes:
268 ATTRIBUTE TYPE ATTRIBUTE VALUE
276 \fBsyncinit\fR(1M), \fBsyncloop\fR(1M), \fBsyncstat\fR(1M), \fBioctl\fR(2),
277 \fBopen\fR(2), \fBread\fR(2), \fBwrite\fR(2), \fBattributes\fR(5), \fBzs\fR(7D)
280 Refer to the \fIZilog Z8530 SCC Serial Communications Controller Technical
281 Manual\fR for details of the \fBSCC\fR's operation and capabilities.
286 \fB\fBzsh data open failed, no memory, rq=\fR\fInnn\fR\fR
296 \fB\fBzsh clone open failed, no memory, rq=\fR\fInnn\fR\fR
300 A kernel memory allocation failed for one of the private data structures. The
301 value of \fInnn\fR is the address of the read queue passed to \fBopen\fR(2).
307 \fB\fBzsh_open: can't alloc message block\fR\fR
311 The open could not proceed because an initial \fBSTREAMS\fR message block could
312 not be made available for incoming data.
318 \fB\fBzsh: clone device \fR\fId\fR\fB must be attached before use!\fR\fR
322 An operation was attempted through a control path before that path had been
323 attached to a particular serial channel.
329 \fB\fBzsh\fR\fIn\fR\fB: invalid operation for clone dev.\fR\fR
333 An inappropriate \fBSTREAMS\fR message type was passed through a control path.
334 Only \fBM_IOCTL\fR and \fBM_PROTO\fR message types are permitted.
340 \fB\fBzsh\fR\fIn\fR\fB: not initialized, can't send message\fR\fR
344 An \fBM_DATA\fR message was passed to the driver for a channel that had not
345 been programmed at least once since the driver was loaded. The \fBSCC\fR's
346 registers were in an unknown state. The \fBS_IOCSETMODE\fR ioctl command
347 performs the programming operation.
353 \fB\fBzsh\fR\fIn\fR\fB: transmit hung\fR\fR
357 The transmitter was not successfully restarted after the watchdog timer