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