xref: /dragonfly/share/man/man4/ppbus.4 (revision f746689a)
1.\" Copyright (c) 1998, 1999 Nicolas Souchu
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\"
13.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23.\" SUCH DAMAGE.
24.\"
25.\" $FreeBSD: src/share/man/man4/ppbus.4,v 1.14.2.5 2001/08/17 13:08:39 ru Exp $
26.\" $DragonFly: src/share/man/man4/ppbus.4,v 1.4 2006/03/26 22:56:57 swildner Exp $
27.\"
28.Dd March 1, 1998
29.Dt PPBUS 4
30.Os
31.Sh NAME
32.Nm ppbus
33.Nd Parallel Port Bus system
34.Sh SYNOPSIS
35.Cd "device ppbus"
36.Pp
37.Cd "device vpo"
38.Pp
39.Cd "device lpt"
40.Cd "device plip"
41.Cd "device ppi"
42.Cd "device pps"
43.Cd "device lpbb"
44.Sh DESCRIPTION
45The
46.Em ppbus
47system provides a uniform, modular and architecture-independent
48system for the implementation of drivers to control various parallel devices,
49and to utilize different parallel port chipsets.
50.Sh DEVICE DRIVERS
51In order to write new drivers or port existing drivers, the ppbus system
52provides the following facilities:
53.Bl -bullet -offset indent
54.It
55architecture-independent macros or functions to access parallel ports
56.It
57mechanism to allow various devices to share the same parallel port
58.It
59a user interface named
60.Xr ppi 4
61that allows parallel port access from outside the kernel without conflicting
62with kernel-in drivers.
63.El
64.Ss Developing new drivers
65The ppbus system has been designed to support the development of standard
66and non-standard software:
67.Pp
68.Bl -column "Driver" -compact
69.It Em Driver Ta Em Description
70.It Sy vpo Ta "VPI0 parallel to Adaptec AIC-7110 SCSI controller driver" .
71It uses standard and non-standard parallel port accesses.
72.It Sy ppi Ta "Parallel port interface for general I/O"
73.It Sy pps Ta "Pulse per second Timing Interface"
74.It Sy lpbb Ta "Philips official parallel port I2C bit-banging interface"
75.El
76.Ss Porting existing drivers
77Another approach to the ppbus system is to port existing drivers.
78Various drivers have already been ported:
79.Pp
80.Bl -column "Driver" -compact
81.It Em Driver Ta Em Description
82.It Sy lpt Ta "lpt printer driver"
83.It Sy plip Ta "lp parallel network interface driver"
84.El
85.Pp
86ppbus should let you port any other software even from other operating systems
87that provide similar services.
88.Sh PARALLEL PORT CHIPSETS
89Parallel port chipset support is provided by
90.Xr ppc 4 .
91.Pp
92The ppbus system provides functions and macros to allocate a new
93parallel port bus, then initialize it and upper peripheral device drivers.
94.Pp
95ppc makes chipset detection and initialization and then calls ppbus attach
96functions to initialize the ppbus system.
97.Sh PARALLEL PORT MODEL
98The logical parallel port model chosen for the ppbus system is the PC's
99parallel port model.
100Consequently, for the i386 implementation of ppbus,
101most of the services provided by ppc are macros for inb()
102and outb() calls.
103But, for an other architecture, accesses to one of our logical
104registers (data, status, control...) may require more than one I/O access.
105.Ss Description
106The parallel port may operate in the following modes:
107.Bl -bullet -offset indent
108.It
109compatible mode, also called Centronics mode
110.It
111bidirectional 8/4-bits mode, also called NIBBLE mode
112.It
113byte mode, also called PS/2 mode
114.It
115Extended Capability Port mode, ECP
116.It
117Enhanced Parallel Port mode, EPP
118.It
119mixed ECP+EPP or ECP+PS/2 modes
120.El
121.Ss Compatible mode
122This mode defines the protocol used by most PCs to transfer data to a printer.
123In this mode, data is placed on the port's data lines, the printer status is
124checked for no errors and that it is not busy, and then a data Strobe is
125generated by the software to clock the data to the printer.
126.Pp
127Many I/O controllers have implemented a mode that uses a FIFO buffer to
128transfer data with the Compatibility mode protocol.
129This mode is referred to as
130"Fast Centronics" or "Parallel Port FIFO mode".
131.Ss Bidirectional mode
132The NIBBLE mode is the most common way to get reverse channel data from a
133printer or peripheral.
134Combined with the standard host to printer mode, it
135provides a complete bidirectional channel.
136.Pp
137In this mode, outputs are 8-bits long.
138Inputs are accomplished by reading
1394 of the 8 bits of the status register.
140.Ss Byte mode
141In this mode, the data register is used either for outputs and inputs.
142Then,
143any transfer is 8-bits long.
144.Ss Extended Capability Port mode
145The ECP protocol was proposed as an advanced mode for communication with
146printer and scanner type peripherals.
147Like the EPP protocol, ECP mode provides
148for a high performance bidirectional communication path between the host
149adapter and the peripheral.
150.Pp
151ECP protocol features include:
152.Bl -item -offset indent
153.It
154Run_Length_Encoding (RLE) data compression for host adapters
155.It
156FIFOs for both the forward and reverse channels
157.It
158DMA as well as programmed I/O for the host register interface.
159.El
160.Ss Enhanced Parallel Port mode
161The EPP protocol was originally developed as a means to provide a high
162performance parallel port link that would still be compatible with the
163standard parallel port.
164.Pp
165The EPP mode has two types of cycle: address and data.
166What makes the
167difference at hardware level is the strobe of the byte placed on the data
168lines.
169Data are strobed with nAutofeed, addresses are strobed with
170nSelectin signals.
171.Pp
172A particularity of the ISA implementation of the EPP protocol is that an
173EPP cycle fits in an ISA cycle.
174In this fashion, parallel port peripherals can
175operate at close to the same performance levels as an equivalent ISA plug-in
176card.
177.Pp
178At software level, you may implement the protocol you wish, using data and
179address cycles as you want.
180This is for the IEEE1284 compatible part.
181Then,
182peripheral vendors may implement protocol handshake with the following
183status lines: PError, nFault and Select.
184Try to know how these lines toggle
185with your peripheral, allowing the peripheral to request more data, stop the
186transfer and so on.
187.Pp
188At any time, the peripheral may interrupt the host with the nAck signal without
189disturbing the current transfer.
190.Ss Mixed modes
191Some manufacturers, like SMC, have implemented chipsets that support mixed
192modes.
193With such chipsets, mode switching is available at any time by
194accessing the extended control register.
195.Sh IEEE1284-1994 Standard
196.Ss Background
197This standard is also named "IEEE Standard Signaling Method for a
198Bidirectional Parallel Peripheral Interface for Personal Computers". It
199defines a signaling method for asynchronous, fully interlocked, bidirectional
200parallel communications between hosts and printers or other peripherals.
201It
202also specifies a format for a peripheral identification string and a method of
203returning this string to the host outside of the bidirectional data stream.
204.Pp
205This standard is architecture independent and only specifies dialog handshake
206at signal level.
207One should refer to architecture specific documentation in
208order to manipulate machine dependent registers, mapped memory or other
209methods to control these signals.
210.Pp
211The IEEE1284 protocol is fully oriented with all supported parallel port
212modes.
213The computer acts as master and the peripheral as slave.
214.Pp
215Any transfer is defined as a finite state automate.
216It allows software to
217properly manage the fully interlocked scheme of the signaling method.
218The compatible mode is supported "as is" without any negotiation because it
219is compatible.
220Any other mode must be firstly negotiated by the host to check
221it is supported by the peripheral, then to enter one of the forward idle
222states.
223.Pp
224At any time, the slave may want to send data to the host.
225This is only
226possible from forward idle states (nibble, byte, ecp...).
227So, the
228host must have previously negotiated to permit the peripheral to
229request transfer.
230Interrupt lines may be dedicated to the requesting signals
231to prevent time consuming polling methods.
232.Pp
233But peripheral requests are only a hint to the master host.
234If the host
235accepts the transfer, it must firstly negotiate the reverse mode and then
236starts the transfer.
237At any time during reverse transfer, the host may
238terminate the transfer or the slave may drive wires to signal that no more
239data is available.
240.Ss Implementation
241IEEE1284 Standard support has been implemented at the top of the ppbus system
242as a set of procedures that perform high level functions like negotiation,
243termination, transfer in any mode without bothering you with low level
244characteristics of the standard.
245.Pp
246IEEE1284 interacts with the ppbus system as least as possible.
247That means
248you still have to request the ppbus when you want to access it, the negotiate
249function doesn't do it for you.
250And of course, release it later.
251.Sh ARCHITECTURE
252.Ss adapter, ppbus and device layers
253First, there is the
254.Em adapter
255layer, the lowest of the ppbus system.
256It provides
257chipset abstraction throw a set of low level functions that maps the logical
258model to the underlying hardware.
259.Pp
260Secondly, there is the
261.Em ppbus
262layer that provides functions to:
263.Bl -enum -offset indent
264.It
265share the parallel port bus among the daisy-chain like connected devices
266.It
267manage devices linked to ppbus
268.It
269propose an arch-independent interface to access the hardware layer.
270.El
271.Pp
272Finally, the
273.Em device
274layer gathers the parallel peripheral device drivers.
275.Ss Parallel modes management
276We have to differentiate operating modes at various ppbus system layers.
277Actually, ppbus and adapter operating modes on one hands and for each
278one, current and available modes are separated.
279.Pp
280With this level of abstraction a particular chipset may commute from any
281native mode the any other mode emulated with extended modes without
282disturbing upper layers.
283For example, most chipsets support NIBBLE mode as
284native and emulated with ECP and/or EPP.
285.Pp
286This architecture should support IEEE1284-1994 modes.
287.Sh FEATURES
288.Ss The boot process
289The boot process starts with the probe phasis of the
290.Xr ppc 4
291driver during ISA bus (PC architecture) initialization.
292During attachment of
293the ppc driver, a new ppbus structure is allocated, then probe and attachment
294for this new bus node are called.
295.Pp
296ppbus attachment tries to detect any PnP parallel peripheral (according to
297.%T "Plug and Play Parallel Port Devices"
298draft from (c)1993-4 Microsoft Corporation)
299then probes and attaches known device drivers.
300.Pp
301During probe, device drivers are supposed to request the ppbus and try to
302set their operating mode.
303This mode will be saved in the context structure and
304returned each time the driver requests the ppbus.
305.Ss Bus allocation and interrupts
306ppbus allocation is mandatory not to corrupt I/O of other devices.
307An other
308usage of ppbus allocation is to reserve the port and receive incoming
309interrupts.
310.Pp
311High level interrupt handlers are connected to the ppbus system thanks to the
312newbus
313.Fn BUS_SETUP_INTR
314and
315.Fn BUS_TEARDOWN_INTR
316functions.
317But, in order to attach a handler, drivers must
318own the bus.
319Consequently, a ppbus request is mandatory in order to call the above
320functions (see existing drivers for more info). Note that the interrupt handler
321is automatically released when the ppbus is released.
322.Ss Microsequences
323.Em Microsequences
324is a general purpose mechanism to allow fast low-level
325manipulation of the parallel port.
326Microsequences may be used to do either
327standard (in IEEE1284 modes) or non-standard transfers.
328The philosophy of
329microsequences is to avoid the overhead of the ppbus layer and do most of
330the job at adapter level.
331.Pp
332A microsequence is an array of opcodes and parameters.
333Each opcode codes an
334operation (opcodes are described in
335.Xr microseq 9 ) .
336Standard I/O operations are implemented at ppbus level whereas basic I/O
337operations and microseq language are coded at adapter level for efficiency.
338.Pp
339As an example, the
340.Xr vpo 4
341driver uses microsequences to implement:
342.Bl -bullet -offset indent
343.It
344a modified version of the NIBBLE transfer mode
345.It
346various I/O sequences to initialize, select and allocate the peripheral
347.El
348.Sh SEE ALSO
349.Xr lpt 4 ,
350.Xr plip 4 ,
351.Xr ppc 4 ,
352.Xr ppi 4 ,
353.Xr vpo 4
354.Sh HISTORY
355The
356.Nm
357manual page first appeared in
358.Fx 3.0 .
359.Sh AUTHORS
360This
361manual page was written by
362.An Nicolas Souchu .
363