xref: /freebsd/share/man/man4/lp.4 (revision 61ba55bcf70f2340f9c943c9571113b3fd8eda69)
1.\" -*- nroff -*-
2.\"
3.\" Copyright (c) 1996 A.R.Gordon, andrew.gordon@net-tel.co.uk
4.\" All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\" 3. Neither the name of the University nor the names of its contributors
15.\"    may be used to endorse or promote products derived from this software
16.\"    without specific prior written permission.
17.\"
18.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
22.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28.\" SUCH DAMAGE.
29.\"
30.\"	Id: man4.i386/lp.4,v 1.9 1999/02/14 12:06:16 nsouch Exp
31.\"
32.Dd March 4, 1996
33.Dt LP 4
34.Os
35.Sh NAME
36.Nm lp
37.Nd printer port Internet Protocol driver
38.Sh SYNOPSIS
39.Nm ifconfig
40.Ar plip0
41.Ar myaddress hisaddress
42.Op Fl link0
43.Pp
44.Cd "device ppbus"
45.Cd "device plip"
46.Cd "device ppc"
47.Sh DESCRIPTION
48The
49.Nm
50driver allows a PC parallel printer port to be used as a
51point-to-point network interface between two similarly configured systems.
52Data is transferred 4 bits at a time, using the printer status lines for
53input: hence there is no requirement for special bidirectional hardware
54and any standard AT-compatible printer port with working interrupts may be used.
55.Pp
56During the boot process, for each
57.Nm plip
58device which is probed and has an interrupt assigned, a corresponding
59.Nm network
60device is created.
61.Pp
62Configuring an
63.Nm
64device with
65.Xr ifconfig 8
66causes the corresponding
67.Nm parallel port bus
68to be reserved for PLIP until the network interface is configured 'down'.
69.Pp
70The communication protocol is selected by the
71.Cm link0
72flag:
73.Bl -tag -width Fl
74.It Fl link0
75(default) Use
76.Fx
77mode (LPIP).
78This is the simpler of the two modes
79and therefore slightly more efficient.
80.It Cm link0
81Use Crynwr/Linux compatible mode (CLPIP).
82This mode has a simulated Ethernet
83packet header, and is easier to interface to other types of equipment.
84.El
85.Pp
86The interface MTU defaults to 1500, but may be set to any value.
87Both ends
88of the link must be configured with the same MTU.
89.Ss Cable Connections
90The cable connecting the two parallel ports should be wired as follows:
91.Bd -literal
92	Pin	Pin	Description
93	2	15	Data0 -> ERROR*
94	3	13	Data1 -> SLCT
95	4	12	Data2 -> PE
96	5	10	Data3 -> ACK*
97	6	11	Data4 -> BUSY
98	15	2	ERROR* -> Data0
99	13	3	SLCT   -> Data1
100	12	4	PE     -> Data2
101	10	5	ACK*   -> Data3
102	11	6	BUSY   -> Data4
103	18-25	18-25	Ground
104.Ed
105.Pp
106Cables with this wiring are widely available as 'Laplink' cables, and
107are often coloured yellow.
108.Pp
109The connections are symmetric, and provide 5 lines in each direction (four
110data plus one handshake).
111The two modes use the same wiring, but make a
112different choice of which line to use as handshake.
113.Ss FreeBSD LPIP mode
114The signal lines are used as follows:
115.Bl -tag -width dataxxxx(Pinxx)
116.It Em Data0 (Pin 2)
117Data out, bit 0.
118.It Em Data1 (Pin 3)
119Data out, bit 1.
120.It Em Data2 (Pin 4)
121Data out, bit 2.
122.It Em Data3 (Pin 5)
123Handshake out.
124.It Em Data4 (Pin 6)
125Data out, bit 3.
126.It Em ERROR* (pin 15)
127Data in, bit 0.
128.It Em SLCT (pin 13)
129Data in, bit 1.
130.It Em PE (pin 12)
131Data in, bit 2.
132.It Em BUSY (pin 11)
133Data in, bit 3.
134.It Em ACK* (pin 10)
135Handshake in.
136.El
137.Pp
138When idle, all data lines are at zero.
139Each byte is signalled in four steps:
140sender writes the 4 most significant bits and raises the handshake line;
141receiver reads the 4 bits and raises its handshake to acknowledge;
142sender places the 4 least significant bits on the data lines and lowers
143the handshake; receiver reads the data and lowers its handshake.
144.Pp
145The packet format has a two-byte header, comprising the fixed values 0x08,
1460x00, immediately followed by the IP header and data.
147.Pp
148The start of a packet is indicated by simply signalling the first byte
149of the header.
150The end of the packet is indicated by inverting
151the data lines (i.e., writing the ones-complement of the previous nibble
152to be transmitted) without changing the state of the handshake.
153.Pp
154Note that the end-of-packet marker assumes that the handshake signal and
155the data-out bits can be written in a single instruction - otherwise
156certain byte values in the packet data would falsely be interpreted
157as end-of-packet.
158This is not a problem for the PC printer port,
159but requires care when implementing this protocol on other equipment.
160.Ss Crynwr/Linux CLPIP mode
161The signal lines are used as follows:
162.Bl -tag -width dataxxxx(Pinxx)
163.It Em Data0 (Pin 2)
164Data out, bit 0.
165.It Em Data1 (Pin 3)
166Data out, bit 1.
167.It Em Data2 (Pin 4)
168Data out, bit 2.
169.It Em Data3 (Pin 5)
170Data out, bit 3.
171.It Em Data4 (Pin 6)
172Handshake out.
173.It Em ERROR* (pin 15)
174Data in, bit 0.
175.It Em SLCT (pin 13)
176Data in, bit 1.
177.It Em PE (pin 12)
178Data in, bit 2.
179.It Em ACK* (pin 10)
180Data in, bit 3.
181.It Em BUSY (pin 11)
182Handshake in.
183.El
184.Pp
185When idle, all data lines are at zero.
186Each byte is signalled in four steps:
187sender writes the 4 least significant bits and raises the handshake line;
188receiver reads the 4 bits and raises its handshake to acknowledge;
189sender places the 4 most significant bits on the data lines and lowers
190the handshake; receiver reads the data and lowers its handshake.
191[Note that this is the opposite nibble order to LPIP mode].
192.Pp
193Packet format is:
194.Bd -literal
195Length (least significant byte)
196Length (most significant byte)
19712 bytes of supposed MAC addresses (ignored by FreeBSD).
198Fixed byte 0x08
199Fixed byte 0x00
200<IP datagram>
201Checksum byte.
202.Ed
203.Pp
204The length includes the 14 header bytes, but not the length bytes themselves
205nor the checksum byte.
206.Pp
207The checksum is a simple arithmetic sum of all the bytes (again, including
208the header but not checksum or length bytes).
209.Fx
210calculates
211outgoing checksums, but does not validate incoming ones.
212.Pp
213The start of packet has to be signalled specially, since the line chosen
214for handshake-in cannot be used to generate an interrupt.
215The sender writes the value 0x08 to the data lines, and waits for the receiver
216to respond by writing 0x01 to its data lines.
217The sender then starts
218signalling the first byte of the packet (the length byte).
219.Pp
220End of packet is deduced from the packet length and is not signalled
221specially (although the data lines are restored to the zero, idle
222state to avoid spuriously indicating the start of the next packet).
223.Sh SEE ALSO
224.Xr ppbus 4 ,
225.Xr ppc 4 ,
226.Xr ifconfig 8
227.Sh BUGS
228Busy-waiting loops are used while handshaking bytes, (and worse still when
229waiting for the receiving system to respond to an interrupt for the start
230of a packet).
231Hence a fast system talking to a slow one will consume
232excessive amounts of CPU.
233This is unavoidable in the case of CLPIP mode
234due to the choice of handshake lines; it could theoretically be improved
235in the case of LPIP mode.
236.Pp
237Polling timeouts are controlled by counting loop iterations rather than
238timers, and so are dependent on CPU speed.
239This is somewhat stabilised
240by the need to perform (slow) ISA bus cycles to actually read the port.
241