1 .\" $NetBSD: ppbus.4,v 1.14 2009/08/19 20:45:23 mbalmer Exp $
3 .\" Copyright (c) 1998, 1999 Nicolas Souchu
4 .\" All rights reserved.
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
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.
15 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 .\" $FreeBSD: src/share/man/man4/ppbus.4,v 1.14.2.5 2001/08/17 13:08:39 ru Exp $
34 .Nd Parallel Port Bus system with GPIO
36 .Cd "ppbus* at atppc?"
37 .Cd "options PPBUS_VERBOSE"
38 .Cd "options PPBUS_DEBUG"
39 .Cd "options DEBUG_1284"
45 .\" Cd "lpbb* at ppbus?"
46 .\" Cd "vpo* at ppbus?"
50 system provides a uniform, modular, and architecture-independent
51 system for the implementation of drivers to control various parallel
52 devices, and to use different parallel port chip sets.
54 In order to write new drivers or port existing drivers, the
56 system provides the following facilities:
57 .Bl -bullet -offset indent
59 architecture-independent macros or functions to access parallel ports
61 mechanism to allow various devices to share the same parallel port
65 interface to access the individual pins
67 a user interface named
69 that allows parallel port access from outside the kernel without
70 conflicting with kernel-in drivers.
72 .Ss Developing new drivers
75 system has been designed to support the development of standard
76 and non-standard software:
78 .Bl -column "Driver" -compact
79 .It Em Driver Ta Em Description
80 .\" It Sy vpo Ta "VPI0 parallel to Adaptec AIC-7110 SCSI controller driver" .
81 It uses standard and non-standard parallel port accesses.
82 .It Sy ppi Ta "Parallel port interface for general I/O"
83 .It Sy pps Ta "Pulse per second Timing Interface"
84 .\" It Sy lpbb Ta "Philips official parallel port I2C bit-banging interface"
86 .Ss Porting existing drivers
87 Another approach to the
89 system is to port existing drivers.
90 Various drivers have already been ported:
92 .Bl -column "Driver" -compact
93 .It Em Driver Ta Em Description
94 .It Sy lpt Ta "lpt printer driver"
95 .It Sy lp Ta "plip network interface driver"
99 should let you port any other software even from other operating
100 systems that provide similar services.
101 .Sh PARALLEL PORT CHIP SETS
102 Parallel port chip set support is provided by
107 system provides functions and macros to request service from the
109 including reads, writes, setting of parameters, and bus requests/releases.
112 detects chip set and capabilities and sets up interrupt handling.
114 methods available for use to the
117 .Sh PARALLEL PORT MODEL
118 The logical parallel port model chosen for the
122 Consequently, for the
126 most of the services provided by
129 translate into I/O instructions on actual registers.
130 However, other parallel port implementations may require more than
131 one I/O instruction to do a single logical register operation on
132 data, status and control virtual registers.
134 The parallel port may operate in the following modes:
135 .Bl -bullet -offset indent
137 Compatible (Centronics -- the standard parallel port mode) mode,
140 Nibble mode, input 4-bits
142 Byte (PS/2) mode, input byte
144 Extended Capability Port (ECP) mode, bidirectional byte
146 Enhanced Parallel Port (EPP) mode, bidirectional byte
149 This mode defines the protocol used by most PCs to transfer data
151 In this mode, data is placed on the port's data lines, the printer
152 status is checked for no errors and that it is not busy, and then
153 a data Strobe is generated by the software to clock the data to
156 Many I/O controllers have implemented a mode that uses a FIFO buffer
157 to transfer data with the Compatibility mode protocol.
158 This mode is referred to as
161 .Dq Parallel Port FIFO mode .
163 The Nibble mode is the most common way to get reverse channel data
164 from a printer or peripheral.
165 When combined with the standard host to printer mode, a bidirectional
166 data channel is created.
167 Inputs are accomplished by reading 4 of the 8 bits of the status
170 In this mode, the data register is used either for outputs and inputs.
171 All transfers are 8-bits long.
172 Channel direction must be negotiated when doing
174 compliant operations.
175 .Ss Extended Capability Port mode
176 The ECP protocol was proposed as an advanced mode for communication
177 with printer and scanner type peripherals.
178 Like the EPP protocol, ECP mode provides for a high performance
179 bidirectional communication path between the host adapter and the
182 ECP protocol features include:
183 .Bl -item -offset indent
185 Run_Length_Encoding (RLE) data compression for host adapters (not
186 supported in these drivers)
188 FIFO's for both the forward and reverse channels
190 DMA or programmed I/O for the host register interface.
192 .Ss Enhanced Parallel Port mode
193 The EPP protocol was originally developed as a means to provide a
194 high performance parallel port link that would still be compatible
195 with the standard parallel port.
197 The EPP mode has two types of cycle: address and data.
198 What makes the difference at hardware level is the strobe of the
199 byte placed on the data lines.
200 Data are strobed with nAutofeed, addresses are strobed with nSelectin
203 A particularity of the ISA implementation of the EPP protocol is
204 that an EPP cycle fits in an ISA cycle.
205 In this fashion, parallel port peripherals can operate at close to
206 the same performance levels as an equivalent ISA plug-in card.
208 At software level, you may implement the protocol you wish, using
209 data and address cycles as you want.
213 Peripheral vendors may implement protocol handshake with the
214 following status lines: PError, nFault and Select.
215 Try to know how these lines toggle with your peripheral, allowing
216 the peripheral to request more data, stop the transfer and so on.
218 At any time, the peripheral may interrupt the host with the nAck
219 signal without disturbing the current transfer.
221 Some manufacturers, like SMC, have implemented chip sets that
223 With such chip sets, mode switching is available at any time by
224 accessing the extended control register.
225 All ECP-capable chip sets can switch between standard, byte, fast
226 centronics, and ECP modes.
227 Some ECP chip sets also support switching to EPP mode.
228 .Sh IEEE 1284 1994 Standard
230 This standard is also named
232 IEEE Standard Signaling Method for a Bidirectional Parallel Peripheral
233 Interface for Personal Computers
235 It defines a signaling method for asynchronous, fully interlocked,
236 bidirectional parallel communications between hosts and printers
237 or other peripherals.
238 It also specifies a format for a peripheral identification string
239 and a method of returning this string to the host.
241 This standard is architecture independent and only specifies dialog
242 handshake at signal level.
243 One should refer to architecture specific documentation in order
244 to manipulate machine dependent registers, mapped memory or other
245 methods to control these signals.
249 protocol is fully oriented with all supported parallel port modes.
250 The computer acts as master and the peripheral as slave.
252 Any transfer is defined as a finite state automate.
253 It allows software to properly manage the fully interlocked scheme
254 of the signaling method.
255 The compatible mode is supported
257 without any negotiation because it is the default, backward-compatible
259 Any other mode must be firstly negotiated by the host to check it
260 is supported by the peripheral, then to enter one of the forward
263 At any time, the slave may want to send data to the host.
264 The host must negotiate to permit the peripheral to complete the
266 Interrupt lines may be dedicated to the requesting signals
267 to prevent time consuming polling methods.
269 If the host accepts the transfer, it must firstly negotiate the
270 reverse mode and then start the transfer.
271 At any time during reverse transfer, the host may terminate the
272 transfer or the slave may drive wires to signal that no more data
275 .Tn IEEE 1284 Standard
276 support has been implemented at the top of the
278 system as a set of procedures that perform high level functions
279 like negotiation, termination, transfer in any mode without bothering
280 you with low level characteristics of the standard.
285 system as little as possible.
286 That means you still have to request the
288 when you want to access it, and of course, release it when finished.
290 .Ss Chip set, ppbus and device layers
293 layer, the lowest of the
296 It provides chip set abstraction through a set of low level functions
297 that maps the logical model to the underlying hardware.
299 Secondly, there is the
301 layer that provides functions to:
302 .Bl -enum -offset indent
304 share the parallel port bus among the daisy-chain like connected
307 manage devices linked to
310 propose an arch-independent interface to access the hardware layer.
315 layer represents the traditional device drivers such as
317 which now use an abstraction instead of real hardware.
318 .Ss Parallel port mode management
319 Operating modes are differentiated at various
322 There is a difference between a
326 A chip set may have a combination of capabilities, but at any one
329 system operates in a single mode.
333 mode: the actual chip set would be in standard mode and the driver
334 would change its behavior to drive the right lines on the parallel
339 must set its operating mode and other parameters whenever it requests
340 and gets access to its parent
345 attachment tries to detect any PnP parallel peripheral (according to
346 .%T "Plug and Play Parallel Port Devices" draft from (c)1993-4
347 .Tn Microsoft Corporation )
348 then probes and attaches known device drivers.
350 During probe, device drivers should request the
352 and try to determine if the right capabilities are present in the
354 .Ss Bus request and interrupts
356 reservation via a bus request is mandatory not to corrupt I/O of
358 For example, when the
360 device is opened, the bus will be
362 to the device driver and attempts to reserve the bus for another
363 device will fail until the
365 driver releases the bus.
367 Child devices can also register interrupt handlers to be called
368 when a hardware interrupt occurs.
369 In order to attach a handler, drivers must own the bus.
370 Drivers should have interrupt handlers that check to see if the
371 device still owns the bus when they are called and/or ensure that
372 these handlers are removed whenever the device does not own the
376 are a general purpose mechanism to allow fast low-level manipulation
377 of the parallel port.
378 Micro-sequences may be used to do either standard (in
380 modes) or non-standard transfers.
381 The philosophy of micro-sequences is to avoid the overhead of the
383 layer for a sequence of operations and do most of the job at the
386 A micro-sequence is an array of opcodes and parameters.
387 Each opcode codes an operation (opcodes are described in
389 Standard I/O operations are implemented at ppbus level whereas
390 basic I/O operations and microseq language are coded at adapter
391 level for efficiency.
393 .\" As an example, the
395 .\" driver uses micro-sequences to implement:
396 .\" .Bl -bullet -offset indent
398 .\" a modified version of the Nibble transfer mode
400 .\" various I/O sequences to initialize, select and allocate the
404 Pins 1 through 17 of the parallel port can be controlled through the
406 interface, pins 18 through 25 are hardwired to ground.
407 Pins 10 through 13 and pin 15 are input pins, the others are output
409 Some of the pins are inverted by the hardware, the values read or
410 written are adjusted accordingly.
413 interface starts at 0 when numbering pins.
425 system first appeared in
428 This manual page is based on the
432 The information has been updated for the
438 framework is still experimental and not enabled by default yet.