xref: /dragonfly/share/man/man4/lp.4 (revision 9c600e7d)
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: src/share/man/man4/lp.4,v 1.5.2.3 2000/12/29 10:18:00 ru Exp $
36.\" $DragonFly: src/share/man/man4/lp.4,v 1.2 2003/06/17 04:36:59 dillon Exp $
37.\"
38.Dd March 4, 1996
39.Os
40.Dt LP 4
41.Sh NAME
42.Nm lp
43.Nd printer port Internet Protocol driver
44.Sh SYNOPSIS
45.Nm ifconfig
46.Ar lp0
47.Ar myaddress hisaddress
48.Op Fl link0
49.Pp
50.Cd "device ppbus"
51.Cd "device plip"
52.Cd "device ppc0 at isa? port? irq 7"
53.Sh DESCRIPTION
54The
55.Nm
56driver allows a PC parallel printer port to be used as a
57point-to-point network interface between two similarly configured systems.
58Data is transferred 4 bits at a time, using the printer status lines for
59input: hence there is no requirement for special bidirectional hardware
60and any standard AT-compatible printer port with working interrupts may be used.
61.Pp
62During the boot process, for each
63.Nm plip
64device which is probed and has an interrupt assigned, a corresponding
65.Nm network
66device is created.
67.Pp
68Configuring an
69.Nm
70device with
71.Xr ifconfig 8
72causes the corresponding
73.Nm parallel port bus
74to be reserved for PLIP until the network interface is configured 'down'.
75.Pp
76The communication protocol is selected by the
77.Cm link0
78flag:
79.Bl -tag -width Fl
80.It Fl link0
81(default) Use
82.Fx
83mode (LPIP).  This is the simpler of the two modes
84and therefore slightly more efficient.
85.It Cm link0
86Use Crynwr/Linux compatible mode (CLPIP).  This mode has a simulated ethernet
87packet header, and is easier to interface to other types of equipment.
88.El
89.Pp
90The interface MTU defaults to 1500, but may be set to any value.  Both ends
91of the link must be configured with the same MTU.
92.Ss Cable Connections
93The cable connecting the two parallel ports should be wired as follows:
94.Bd -literal
95	Pin	Pin	Description
96	2	15	Data0 -> ERROR*
97	3	13	Data1 -> SLCT
98	4	12	Data2 -> PE
99	5	10	Data3 -> ACK*
100	6	11	Data4 -> BUSY
101	15	2	ERROR* -> Data0
102	13	3	SLCT   -> Data1
103	12	4	PE     -> Data2
104	10	5	ACK*   -> Data3
105	11	6	BUSY   -> Data4
106	18-25	18-25	Ground
107.Ed
108.Pp
109Cables with this wiring are widely available as 'Laplink' cables, and
110are often coloured yellow.
111.Pp
112The connections are symmetric, and provide 5 lines in each direction (four
113data plus one handshake).  The two modes use the same wiring, but make a
114different choice of which line to use as handshake.
115.Ss FreeBSD LPIP mode
116The signal lines are used as follows:
117.Bl -tag -width dataxxxx(Pinxx)
118.It Em Data0 (Pin 2)
119Data out, bit 0.
120.It Em Data1 (Pin 3)
121Data out, bit 1.
122.It Em Data2 (Pin 4)
123Data out, bit 2.
124.It Em Data3 (Pin 5)
125Handshake out.
126.It Em Data4 (Pin 6)
127Data out, bit 3.
128.It Em ERROR* (pin 15)
129Data in, bit 0.
130.It Em SLCT (pin 13)
131Data in, bit 1.
132.It Em PE (pin 12)
133Data in, bit 2.
134.It Em BUSY (pin 11)
135Data in, bit 3.
136.It Em ACK* (pin 10)
137Handshake in.
138.El
139.Pp
140When idle, all data lines are at zero.  Each byte is signalled in four steps:
141sender writes the 4 most significant bits and raises the handshake line;
142receiver reads the 4 bits and raises its handshake to acknowledge;
143sender places the 4 least significant bits on the data lines and lowers
144the handshake; receiver reads the data and lowers its handshake.
145.Pp
146The packet format has a two-byte header, comprising the fixed values 0x08,
1470x00, immediately followed by the IP header and data.
148.Pp
149The start of a packet is indicated by simply signalling the first byte
150of the header.  The end of the packet is indicated by inverting
151the data lines (ie. 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.  This is not a problem for the PC printer port,
158but requires care when implementing this protocol on other equipment.
159.Ss Crynwr/Linux CLPIP mode
160The signal lines are used as follows:
161.Bl -tag -width dataxxxx(Pinxx)
162.It Em Data0 (Pin 2)
163Data out, bit 0.
164.It Em Data1 (Pin 3)
165Data out, bit 1.
166.It Em Data2 (Pin 4)
167Data out, bit 2.
168.It Em Data3 (Pin 5)
169Data out, bit 3.
170.It Em Data4 (Pin 6)
171Handshake out.
172.It Em ERROR* (pin 15)
173Data in, bit 0.
174.It Em SLCT (pin 13)
175Data in, bit 1.
176.It Em PE (pin 12)
177Data in, bit 2.
178.It Em ACK* (pin 10)
179Data in, bit 3.
180.It Em BUSY (pin 11)
181Handshake in.
182.El
183.Pp
184When idle, all data lines are at zero.  Each byte is signalled in four steps:
185sender writes the 4 least significant bits and raises the handshake line;
186receiver reads the 4 bits and raises its handshake to acknowledge;
187sender places the 4 most significant bits on the data lines and lowers
188the handshake; receiver reads the data and lowers its handshake.
189[Note that this is the opposite nibble order to LPIP mode].
190.Pp
191Packet format is:
192.Bd -literal
193Length (least significant byte)
194Length (most significant byte)
19512 bytes of supposed MAC addresses (ignored by FreeBSD).
196Fixed byte 0x08
197Fixed byte 0x00
198<IP datagram>
199Checksum byte.
200.Ed
201.Pp
202The length includes the 14 header bytes, but not the length bytes themselves
203nor the checksum byte.
204.Pp
205The checksum is a simple arithmetic sum of all the bytes (again, including
206the header but not checksum or length bytes).
207.Fx
208calculates
209outgoing checksums, but does not validate incoming ones.
210.Pp
211The start of packet has to be signalled specially, since the line chosen
212for handshake-in cannot be used to generate an interrupt.  The sender
213writes the value 0x08 to the data lines, and waits for the receiver
214to respond by writing 0x01 to its data lines.  The sender then starts
215signalling the first byte of the packet (the length byte).
216.Pp
217End of packet is deduced from the packet length and is not signalled
218specially (although the data lines are restored to the zero, idle
219state to avoid spuriously indicating the start of the next packet).
220.Sh SEE ALSO
221.Xr ppbus 4 ,
222.Xr ppc 4 ,
223.Xr ifconfig 8
224.Sh BUGS
225Busy-waiting loops are used while handshaking bytes, (and worse still when
226waiting for the receiving system to respond to an interrupt for the start
227of a packet).  Hence a fast system talking to a slow one will consume
228excessive amounts of CPU.  This is unavoidable in the case of CLPIP mode
229due to the choice of handshake lines; it could theoretically be improved
230in the case of LPIP mode.
231.Pp
232Polling timeouts are controlled by counting loop iterations rather than
233timers, and so are dependent on CPU speed.  This is somewhat stabilised
234by the need to perform (slow) ISA bus cycles to actually read the port.
235