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