blob: 0633d70ffda7fab17bd8cb0f740647a541a56818 [file] [log] [blame]
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001===============================
Linus Torvalds1da177e2005-04-16 15:20:36 -07002PARPORT interface documentation
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03003===============================
Linus Torvalds1da177e2005-04-16 15:20:36 -07004
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03005:Time-stamp: <2000-02-24 13:30:20 twaugh>
Linus Torvalds1da177e2005-04-16 15:20:36 -07006
7Described here are the following functions:
8
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03009Global functions::
Linus Torvalds1da177e2005-04-16 15:20:36 -070010 parport_register_driver
11 parport_unregister_driver
12 parport_enumerate
13 parport_register_device
14 parport_unregister_device
15 parport_claim
16 parport_claim_or_block
17 parport_release
18 parport_yield
19 parport_yield_blocking
20 parport_wait_peripheral
21 parport_poll_peripheral
22 parport_wait_event
23 parport_negotiate
24 parport_read
25 parport_write
26 parport_open
27 parport_close
28 parport_device_id
Linus Torvalds1da177e2005-04-16 15:20:36 -070029 parport_device_coords
30 parport_find_class
31 parport_find_device
32 parport_set_timeout
33
34Port functions (can be overridden by low-level drivers):
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -030035
36 SPP::
Linus Torvalds1da177e2005-04-16 15:20:36 -070037 port->ops->read_data
38 port->ops->write_data
39 port->ops->read_status
40 port->ops->read_control
41 port->ops->write_control
42 port->ops->frob_control
43 port->ops->enable_irq
44 port->ops->disable_irq
45 port->ops->data_forward
46 port->ops->data_reverse
47
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -030048 EPP::
Linus Torvalds1da177e2005-04-16 15:20:36 -070049 port->ops->epp_write_data
50 port->ops->epp_read_data
51 port->ops->epp_write_addr
52 port->ops->epp_read_addr
53
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -030054 ECP::
Linus Torvalds1da177e2005-04-16 15:20:36 -070055 port->ops->ecp_write_data
56 port->ops->ecp_read_data
57 port->ops->ecp_write_addr
58
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -030059 Other::
Linus Torvalds1da177e2005-04-16 15:20:36 -070060 port->ops->nibble_read_data
61 port->ops->byte_read_data
62 port->ops->compat_write_data
63
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -030064The parport subsystem comprises ``parport`` (the core port-sharing
Linus Torvalds1da177e2005-04-16 15:20:36 -070065code), and a variety of low-level drivers that actually do the port
66accesses. Each low-level driver handles a particular style of port
67(PC, Amiga, and so on).
68
69The parport interface to the device driver author can be broken down
70into global functions and port functions.
71
72The global functions are mostly for communicating between the device
73driver and the parport subsystem: acquiring a list of available ports,
74claiming a port for exclusive use, and so on. They also include
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -030075``generic`` functions for doing standard things that will work on any
Linus Torvalds1da177e2005-04-16 15:20:36 -070076IEEE 1284-capable architecture.
77
78The port functions are provided by the low-level drivers, although the
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -030079core parport module provides generic ``defaults`` for some routines.
Linus Torvalds1da177e2005-04-16 15:20:36 -070080The port functions can be split into three groups: SPP, EPP, and ECP.
81
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -030082SPP (Standard Parallel Port) functions modify so-called ``SPP``
Linus Torvalds1da177e2005-04-16 15:20:36 -070083registers: data, status, and control. The hardware may not actually
84have registers exactly like that, but the PC does and this interface is
85modelled after common PC implementations. Other low-level drivers may
86be able to emulate most of the functionality.
87
88EPP (Enhanced Parallel Port) functions are provided for reading and
89writing in IEEE 1284 EPP mode, and ECP (Extended Capabilities Port)
90functions are used for IEEE 1284 ECP mode. (What about BECP? Does
91anyone care?)
92
93Hardware assistance for EPP and/or ECP transfers may or may not be
94available, and if it is available it may or may not be used. If
95hardware is not used, the transfer will be software-driven. In order
96to cope with peripherals that only tenuously support IEEE 1284, a
97low-level driver specific function is provided, for altering 'fudge
98factors'.
99
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300100Global functions
101================
Linus Torvalds1da177e2005-04-16 15:20:36 -0700102
103parport_register_driver - register a device driver with parport
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300104---------------------------------------------------------------
Linus Torvalds1da177e2005-04-16 15:20:36 -0700105
106SYNOPSIS
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300107^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -0700108
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300109::
Linus Torvalds1da177e2005-04-16 15:20:36 -0700110
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300111 #include <linux/parport.h>
112
113 struct parport_driver {
114 const char *name;
115 void (*attach) (struct parport *);
116 void (*detach) (struct parport *);
117 struct parport_driver *next;
118 };
119 int parport_register_driver (struct parport_driver *driver);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700120
121DESCRIPTION
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300122^^^^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -0700123
124In order to be notified about parallel ports when they are detected,
125parport_register_driver should be called. Your driver will
126immediately be notified of all ports that have already been detected,
127and of each new port as low-level drivers are loaded.
128
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300129A ``struct parport_driver`` contains the textual name of your driver,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700130a pointer to a function to handle new ports, and a pointer to a
131function to handle ports going away due to a low-level driver
132unloading. Ports will only be detached if they are not being used
133(i.e. there are no devices registered on them).
134
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300135The visible parts of the ``struct parport *`` argument given to
136attach/detach are::
Linus Torvalds1da177e2005-04-16 15:20:36 -0700137
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300138 struct parport
139 {
140 struct parport *next; /* next parport in list */
141 const char *name; /* port's name */
142 unsigned int modes; /* bitfield of hardware modes */
143 struct parport_device_info probe_info;
144 /* IEEE1284 info */
145 int number; /* parport index */
146 struct parport_operations *ops;
147 ...
148 };
Linus Torvalds1da177e2005-04-16 15:20:36 -0700149
150There are other members of the structure, but they should not be
151touched.
152
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300153The ``modes`` member summarises the capabilities of the underlying
Linus Torvalds1da177e2005-04-16 15:20:36 -0700154hardware. It consists of flags which may be bitwise-ored together:
155
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300156 ============================= ===============================================
Linus Torvalds1da177e2005-04-16 15:20:36 -0700157 PARPORT_MODE_PCSPP IBM PC registers are available,
158 i.e. functions that act on data,
159 control and status registers are
160 probably writing directly to the
161 hardware.
162 PARPORT_MODE_TRISTATE The data drivers may be turned off.
163 This allows the data lines to be used
164 for reverse (peripheral to host)
165 transfers.
166 PARPORT_MODE_COMPAT The hardware can assist with
167 compatibility-mode (printer)
168 transfers, i.e. compat_write_block.
169 PARPORT_MODE_EPP The hardware can assist with EPP
170 transfers.
171 PARPORT_MODE_ECP The hardware can assist with ECP
172 transfers.
173 PARPORT_MODE_DMA The hardware can use DMA, so you might
174 want to pass ISA DMA-able memory
175 (i.e. memory allocated using the
176 GFP_DMA flag with kmalloc) to the
177 low-level driver in order to take
178 advantage of it.
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300179 ============================= ===============================================
Linus Torvalds1da177e2005-04-16 15:20:36 -0700180
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300181There may be other flags in ``modes`` as well.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700182
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300183The contents of ``modes`` is advisory only. For example, if the
184hardware is capable of DMA, and PARPORT_MODE_DMA is in ``modes``, it
Linus Torvalds1da177e2005-04-16 15:20:36 -0700185doesn't necessarily mean that DMA will always be used when possible.
186Similarly, hardware that is capable of assisting ECP transfers won't
187necessarily be used.
188
189RETURN VALUE
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300190^^^^^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -0700191
192Zero on success, otherwise an error code.
193
194ERRORS
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300195^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -0700196
197None. (Can it fail? Why return int?)
198
199EXAMPLE
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300200^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -0700201
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300202::
Linus Torvalds1da177e2005-04-16 15:20:36 -0700203
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300204 static void lp_attach (struct parport *port)
205 {
206 ...
207 private = kmalloc (...);
208 dev[count++] = parport_register_device (...);
209 ...
Linus Torvalds1da177e2005-04-16 15:20:36 -0700210 }
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300211
212 static void lp_detach (struct parport *port)
213 {
214 ...
215 }
216
217 static struct parport_driver lp_driver = {
218 "lp",
219 lp_attach,
220 lp_detach,
221 NULL /* always put NULL here */
222 };
223
224 int lp_init (void)
225 {
226 ...
227 if (parport_register_driver (&lp_driver)) {
228 /* Failed; nothing we can do. */
229 return -EIO;
230 }
231 ...
232 }
233
Linus Torvalds1da177e2005-04-16 15:20:36 -0700234
235SEE ALSO
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300236^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -0700237
238parport_unregister_driver, parport_register_device, parport_enumerate
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300239
240
241
Linus Torvalds1da177e2005-04-16 15:20:36 -0700242parport_unregister_driver - tell parport to forget about this driver
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300243--------------------------------------------------------------------
Linus Torvalds1da177e2005-04-16 15:20:36 -0700244
245SYNOPSIS
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300246^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -0700247
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300248::
Linus Torvalds1da177e2005-04-16 15:20:36 -0700249
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300250 #include <linux/parport.h>
251
252 struct parport_driver {
253 const char *name;
254 void (*attach) (struct parport *);
255 void (*detach) (struct parport *);
256 struct parport_driver *next;
257 };
258 void parport_unregister_driver (struct parport_driver *driver);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700259
260DESCRIPTION
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300261^^^^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -0700262
263This tells parport not to notify the device driver of new ports or of
264ports going away. Registered devices belonging to that driver are NOT
265unregistered: parport_unregister_device must be used for each one.
266
267EXAMPLE
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300268^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -0700269
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300270::
Linus Torvalds1da177e2005-04-16 15:20:36 -0700271
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300272 void cleanup_module (void)
273 {
274 ...
275 /* Stop notifications. */
276 parport_unregister_driver (&lp_driver);
277
278 /* Unregister devices. */
279 for (i = 0; i < NUM_DEVS; i++)
280 parport_unregister_device (dev[i]);
281 ...
282 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700283
284SEE ALSO
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300285^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -0700286
287parport_register_driver, parport_enumerate
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300288
289
290
Linus Torvalds1da177e2005-04-16 15:20:36 -0700291parport_enumerate - retrieve a list of parallel ports (DEPRECATED)
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300292------------------------------------------------------------------
Linus Torvalds1da177e2005-04-16 15:20:36 -0700293
294SYNOPSIS
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300295^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -0700296
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300297::
Linus Torvalds1da177e2005-04-16 15:20:36 -0700298
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300299 #include <linux/parport.h>
300
301 struct parport *parport_enumerate (void);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700302
303DESCRIPTION
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300304^^^^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -0700305
306Retrieve the first of a list of valid parallel ports for this machine.
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300307Successive parallel ports can be found using the ``struct parport
308*next`` element of the ``struct parport *`` that is returned. If ``next``
Linus Torvalds1da177e2005-04-16 15:20:36 -0700309is NULL, there are no more parallel ports in the list. The number of
310ports in the list will not exceed PARPORT_MAX.
311
312RETURN VALUE
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300313^^^^^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -0700314
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300315A ``struct parport *`` describing a valid parallel port for the machine,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700316or NULL if there are none.
317
318ERRORS
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300319^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -0700320
321This function can return NULL to indicate that there are no parallel
322ports to use.
323
324EXAMPLE
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300325^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -0700326
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300327::
Linus Torvalds1da177e2005-04-16 15:20:36 -0700328
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300329 int detect_device (void)
330 {
331 struct parport *port;
332
333 for (port = parport_enumerate ();
334 port != NULL;
335 port = port->next) {
336 /* Try to detect a device on the port... */
337 ...
338 }
339 }
340
Linus Torvalds1da177e2005-04-16 15:20:36 -0700341 ...
Linus Torvalds1da177e2005-04-16 15:20:36 -0700342 }
343
Linus Torvalds1da177e2005-04-16 15:20:36 -0700344NOTES
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300345^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -0700346
347parport_enumerate is deprecated; parport_register_driver should be
348used instead.
349
350SEE ALSO
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300351^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -0700352
353parport_register_driver, parport_unregister_driver
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300354
355
356
Linus Torvalds1da177e2005-04-16 15:20:36 -0700357parport_register_device - register to use a port
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300358------------------------------------------------
Linus Torvalds1da177e2005-04-16 15:20:36 -0700359
360SYNOPSIS
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300361^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -0700362
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300363::
Linus Torvalds1da177e2005-04-16 15:20:36 -0700364
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300365 #include <linux/parport.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -0700366
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300367 typedef int (*preempt_func) (void *handle);
368 typedef void (*wakeup_func) (void *handle);
369 typedef int (*irq_func) (int irq, void *handle, struct pt_regs *);
370
371 struct pardevice *parport_register_device(struct parport *port,
372 const char *name,
373 preempt_func preempt,
374 wakeup_func wakeup,
375 irq_func irq,
376 int flags,
377 void *handle);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700378
379DESCRIPTION
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300380^^^^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -0700381
382Use this function to register your device driver on a parallel port
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300383(``port``). Once you have done that, you will be able to use
Linus Torvalds1da177e2005-04-16 15:20:36 -0700384parport_claim and parport_release in order to use the port.
385
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300386The (``name``) argument is the name of the device that appears in /proc
Mikulas Patockacdb32702007-11-22 21:26:01 +0100387filesystem. The string must be valid for the whole lifetime of the
388device (until parport_unregister_device is called).
389
Linus Torvalds1da177e2005-04-16 15:20:36 -0700390This function will register three callbacks into your driver:
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300391``preempt``, ``wakeup`` and ``irq``. Each of these may be NULL in order to
Linus Torvalds1da177e2005-04-16 15:20:36 -0700392indicate that you do not want a callback.
393
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300394When the ``preempt`` function is called, it is because another driver
395wishes to use the parallel port. The ``preempt`` function should return
Linus Torvalds1da177e2005-04-16 15:20:36 -0700396non-zero if the parallel port cannot be released yet -- if zero is
397returned, the port is lost to another driver and the port must be
398re-claimed before use.
399
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300400The ``wakeup`` function is called once another driver has released the
Linus Torvalds1da177e2005-04-16 15:20:36 -0700401port and no other driver has yet claimed it. You can claim the
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300402parallel port from within the ``wakeup`` function (in which case the
Linus Torvalds1da177e2005-04-16 15:20:36 -0700403claim is guaranteed to succeed), or choose not to if you don't need it
404now.
405
406If an interrupt occurs on the parallel port your driver has claimed,
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300407the ``irq`` function will be called. (Write something about shared
Linus Torvalds1da177e2005-04-16 15:20:36 -0700408interrupts here.)
409
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300410The ``handle`` is a pointer to driver-specific data, and is passed to
Linus Torvalds1da177e2005-04-16 15:20:36 -0700411the callback functions.
412
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300413``flags`` may be a bitwise combination of the following flags:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700414
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300415 ===================== =================================================
Linus Torvalds1da177e2005-04-16 15:20:36 -0700416 Flag Meaning
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300417 ===================== =================================================
Linus Torvalds1da177e2005-04-16 15:20:36 -0700418 PARPORT_DEV_EXCL The device cannot share the parallel port at all.
419 Use this only when absolutely necessary.
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300420 ===================== =================================================
Linus Torvalds1da177e2005-04-16 15:20:36 -0700421
422The typedefs are not actually defined -- they are only shown in order
423to make the function prototype more readable.
424
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300425The visible parts of the returned ``struct pardevice`` are::
Linus Torvalds1da177e2005-04-16 15:20:36 -0700426
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300427 struct pardevice {
428 struct parport *port; /* Associated port */
429 void *private; /* Device driver's 'handle' */
430 ...
431 };
Linus Torvalds1da177e2005-04-16 15:20:36 -0700432
433RETURN VALUE
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300434^^^^^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -0700435
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300436A ``struct pardevice *``: a handle to the registered parallel port
Linus Torvalds1da177e2005-04-16 15:20:36 -0700437device that can be used for parport_claim, parport_release, etc.
438
439ERRORS
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300440^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -0700441
442A return value of NULL indicates that there was a problem registering
443a device on that port.
444
445EXAMPLE
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300446^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -0700447
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300448::
Linus Torvalds1da177e2005-04-16 15:20:36 -0700449
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300450 static int preempt (void *handle)
451 {
452 if (busy_right_now)
453 return 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700454
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300455 must_reclaim_port = 1;
456 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700457 }
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300458
459 static void wakeup (void *handle)
460 {
461 struct toaster *private = handle;
462 struct pardevice *dev = private->dev;
463 if (!dev) return; /* avoid races */
464
465 if (want_port)
466 parport_claim (dev);
467 }
468
469 static int toaster_detect (struct toaster *private, struct parport *port)
470 {
471 private->dev = parport_register_device (port, "toaster", preempt,
472 wakeup, NULL, 0,
473 private);
474 if (!private->dev)
475 /* Couldn't register with parport. */
476 return -EIO;
477
478 must_reclaim_port = 0;
479 busy_right_now = 1;
480 parport_claim_or_block (private->dev);
481 ...
482 /* Don't need the port while the toaster warms up. */
483 busy_right_now = 0;
484 ...
485 busy_right_now = 1;
486 if (must_reclaim_port) {
487 parport_claim_or_block (private->dev);
488 must_reclaim_port = 0;
489 }
490 ...
491 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700492
493SEE ALSO
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300494^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -0700495
496parport_unregister_device, parport_claim
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300497
498
Linus Torvalds1da177e2005-04-16 15:20:36 -0700499
500parport_unregister_device - finish using a port
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300501-----------------------------------------------
Linus Torvalds1da177e2005-04-16 15:20:36 -0700502
503SYNPOPSIS
504
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300505::
Linus Torvalds1da177e2005-04-16 15:20:36 -0700506
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300507 #include <linux/parport.h>
508
509 void parport_unregister_device (struct pardevice *dev);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700510
511DESCRIPTION
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300512^^^^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -0700513
514This function is the opposite of parport_register_device. After using
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300515parport_unregister_device, ``dev`` is no longer a valid device handle.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700516
517You should not unregister a device that is currently claimed, although
518if you do it will be released automatically.
519
520EXAMPLE
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300521^^^^^^^
522
523::
Linus Torvalds1da177e2005-04-16 15:20:36 -0700524
525 ...
526 kfree (dev->private); /* before we lose the pointer */
527 parport_unregister_device (dev);
528 ...
529
530SEE ALSO
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300531^^^^^^^^
532
Linus Torvalds1da177e2005-04-16 15:20:36 -0700533
534parport_unregister_driver
535
536parport_claim, parport_claim_or_block - claim the parallel port for a device
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300537----------------------------------------------------------------------------
Linus Torvalds1da177e2005-04-16 15:20:36 -0700538
539SYNOPSIS
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300540^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -0700541
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300542::
Linus Torvalds1da177e2005-04-16 15:20:36 -0700543
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300544 #include <linux/parport.h>
545
546 int parport_claim (struct pardevice *dev);
547 int parport_claim_or_block (struct pardevice *dev);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700548
549DESCRIPTION
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300550^^^^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -0700551
552These functions attempt to gain control of the parallel port on which
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300553``dev`` is registered. ``parport_claim`` does not block, but
554``parport_claim_or_block`` may do. (Put something here about blocking
Linus Torvalds1da177e2005-04-16 15:20:36 -0700555interruptibly or non-interruptibly.)
556
557You should not try to claim a port that you have already claimed.
558
559RETURN VALUE
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300560^^^^^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -0700561
562A return value of zero indicates that the port was successfully
563claimed, and the caller now has possession of the parallel port.
564
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300565If ``parport_claim_or_block`` blocks before returning successfully, the
Linus Torvalds1da177e2005-04-16 15:20:36 -0700566return value is positive.
567
568ERRORS
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300569^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -0700570
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300571========== ==========================================================
Linus Torvalds1da177e2005-04-16 15:20:36 -0700572 -EAGAIN The port is unavailable at the moment, but another attempt
573 to claim it may succeed.
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300574========== ==========================================================
Linus Torvalds1da177e2005-04-16 15:20:36 -0700575
576SEE ALSO
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300577^^^^^^^^
578
Linus Torvalds1da177e2005-04-16 15:20:36 -0700579
580parport_release
581
582parport_release - release the parallel port
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300583-------------------------------------------
Linus Torvalds1da177e2005-04-16 15:20:36 -0700584
585SYNOPSIS
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300586^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -0700587
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300588::
Linus Torvalds1da177e2005-04-16 15:20:36 -0700589
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300590 #include <linux/parport.h>
591
592 void parport_release (struct pardevice *dev);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700593
594DESCRIPTION
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300595^^^^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -0700596
597Once a parallel port device has been claimed, it can be released using
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300598``parport_release``. It cannot fail, but you should not release a
Linus Torvalds1da177e2005-04-16 15:20:36 -0700599device that you do not have possession of.
600
601EXAMPLE
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300602^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -0700603
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300604::
605
606 static size_t write (struct pardevice *dev, const void *buf,
607 size_t len)
608 {
609 ...
610 written = dev->port->ops->write_ecp_data (dev->port, buf,
611 len);
612 parport_release (dev);
613 ...
614 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700615
616
617SEE ALSO
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300618^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -0700619
620change_mode, parport_claim, parport_claim_or_block, parport_yield
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300621
622
623
Linus Torvalds1da177e2005-04-16 15:20:36 -0700624parport_yield, parport_yield_blocking - temporarily release a parallel port
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300625---------------------------------------------------------------------------
Linus Torvalds1da177e2005-04-16 15:20:36 -0700626
627SYNOPSIS
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300628^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -0700629
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300630::
Linus Torvalds1da177e2005-04-16 15:20:36 -0700631
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300632 #include <linux/parport.h>
633
634 int parport_yield (struct pardevice *dev)
635 int parport_yield_blocking (struct pardevice *dev);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700636
637DESCRIPTION
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300638^^^^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -0700639
640When a driver has control of a parallel port, it may allow another
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300641driver to temporarily ``borrow`` it. ``parport_yield`` does not block;
642``parport_yield_blocking`` may do.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700643
644RETURN VALUE
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300645^^^^^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -0700646
647A return value of zero indicates that the caller still owns the port
648and the call did not block.
649
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300650A positive return value from ``parport_yield_blocking`` indicates that
Linus Torvalds1da177e2005-04-16 15:20:36 -0700651the caller still owns the port and the call blocked.
652
653A return value of -EAGAIN indicates that the caller no longer owns the
654port, and it must be re-claimed before use.
655
656ERRORS
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300657^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -0700658
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300659========= ==========================================================
Linus Torvalds1da177e2005-04-16 15:20:36 -0700660 -EAGAIN Ownership of the parallel port was given away.
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300661========= ==========================================================
Linus Torvalds1da177e2005-04-16 15:20:36 -0700662
663SEE ALSO
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300664^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -0700665
666parport_release
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300667
668
Linus Torvalds1da177e2005-04-16 15:20:36 -0700669
670parport_wait_peripheral - wait for status lines, up to 35ms
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300671-----------------------------------------------------------
Linus Torvalds1da177e2005-04-16 15:20:36 -0700672
673SYNOPSIS
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300674^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -0700675
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300676::
Linus Torvalds1da177e2005-04-16 15:20:36 -0700677
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300678 #include <linux/parport.h>
679
680 int parport_wait_peripheral (struct parport *port,
681 unsigned char mask,
682 unsigned char val);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700683
684DESCRIPTION
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300685^^^^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -0700686
687Wait for the status lines in mask to match the values in val.
688
689RETURN VALUE
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300690^^^^^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -0700691
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300692======== ==========================================================
Linus Torvalds1da177e2005-04-16 15:20:36 -0700693 -EINTR a signal is pending
694 0 the status lines in mask have values in val
695 1 timed out while waiting (35ms elapsed)
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300696======== ==========================================================
Linus Torvalds1da177e2005-04-16 15:20:36 -0700697
698SEE ALSO
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300699^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -0700700
701parport_poll_peripheral
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300702
703
Linus Torvalds1da177e2005-04-16 15:20:36 -0700704
705parport_poll_peripheral - wait for status lines, in usec
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300706--------------------------------------------------------
Linus Torvalds1da177e2005-04-16 15:20:36 -0700707
708SYNOPSIS
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300709^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -0700710
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300711::
Linus Torvalds1da177e2005-04-16 15:20:36 -0700712
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300713 #include <linux/parport.h>
714
715 int parport_poll_peripheral (struct parport *port,
716 unsigned char mask,
717 unsigned char val,
718 int usec);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700719
720DESCRIPTION
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300721^^^^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -0700722
723Wait for the status lines in mask to match the values in val.
724
725RETURN VALUE
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300726^^^^^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -0700727
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300728======== ==========================================================
Linus Torvalds1da177e2005-04-16 15:20:36 -0700729 -EINTR a signal is pending
730 0 the status lines in mask have values in val
731 1 timed out while waiting (usec microseconds have elapsed)
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300732======== ==========================================================
Linus Torvalds1da177e2005-04-16 15:20:36 -0700733
734SEE ALSO
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300735^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -0700736
737parport_wait_peripheral
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300738
739
740
Linus Torvalds1da177e2005-04-16 15:20:36 -0700741parport_wait_event - wait for an event on a port
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300742------------------------------------------------
Linus Torvalds1da177e2005-04-16 15:20:36 -0700743
744SYNOPSIS
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300745^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -0700746
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300747::
Linus Torvalds1da177e2005-04-16 15:20:36 -0700748
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300749 #include <linux/parport.h>
750
751 int parport_wait_event (struct parport *port, signed long timeout)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700752
753DESCRIPTION
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300754^^^^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -0700755
756Wait for an event (e.g. interrupt) on a port. The timeout is in
757jiffies.
758
759RETURN VALUE
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300760^^^^^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -0700761
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300762======= ==========================================================
Linus Torvalds1da177e2005-04-16 15:20:36 -0700763 0 success
764 <0 error (exit as soon as possible)
765 >0 timed out
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300766======= ==========================================================
767
Linus Torvalds1da177e2005-04-16 15:20:36 -0700768parport_negotiate - perform IEEE 1284 negotiation
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300769-------------------------------------------------
Linus Torvalds1da177e2005-04-16 15:20:36 -0700770
771SYNOPSIS
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300772^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -0700773
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300774::
Linus Torvalds1da177e2005-04-16 15:20:36 -0700775
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300776 #include <linux/parport.h>
777
778 int parport_negotiate (struct parport *, int mode);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700779
780DESCRIPTION
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300781^^^^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -0700782
783Perform IEEE 1284 negotiation.
784
785RETURN VALUE
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300786^^^^^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -0700787
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300788======= ==========================================================
Linus Torvalds1da177e2005-04-16 15:20:36 -0700789 0 handshake OK; IEEE 1284 peripheral and mode available
790 -1 handshake failed; peripheral not compliant (or none present)
791 1 handshake OK; IEEE 1284 peripheral present but mode not
792 available
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300793======= ==========================================================
Linus Torvalds1da177e2005-04-16 15:20:36 -0700794
795SEE ALSO
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300796^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -0700797
798parport_read, parport_write
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300799
800
801
Linus Torvalds1da177e2005-04-16 15:20:36 -0700802parport_read - read data from device
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300803------------------------------------
Linus Torvalds1da177e2005-04-16 15:20:36 -0700804
805SYNOPSIS
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300806^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -0700807
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300808::
Linus Torvalds1da177e2005-04-16 15:20:36 -0700809
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300810 #include <linux/parport.h>
811
812 ssize_t parport_read (struct parport *, void *buf, size_t len);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700813
814DESCRIPTION
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300815^^^^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -0700816
817Read data from device in current IEEE 1284 transfer mode. This only
818works for modes that support reverse data transfer.
819
820RETURN VALUE
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300821^^^^^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -0700822
823If negative, an error code; otherwise the number of bytes transferred.
824
825SEE ALSO
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300826^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -0700827
828parport_write, parport_negotiate
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300829
830
831
Linus Torvalds1da177e2005-04-16 15:20:36 -0700832parport_write - write data to device
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300833------------------------------------
Linus Torvalds1da177e2005-04-16 15:20:36 -0700834
835SYNOPSIS
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300836^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -0700837
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300838::
Linus Torvalds1da177e2005-04-16 15:20:36 -0700839
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300840 #include <linux/parport.h>
841
842 ssize_t parport_write (struct parport *, const void *buf, size_t len);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700843
844DESCRIPTION
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300845^^^^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -0700846
847Write data to device in current IEEE 1284 transfer mode. This only
848works for modes that support forward data transfer.
849
850RETURN VALUE
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300851^^^^^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -0700852
853If negative, an error code; otherwise the number of bytes transferred.
854
855SEE ALSO
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300856^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -0700857
858parport_read, parport_negotiate
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300859
860
Linus Torvalds1da177e2005-04-16 15:20:36 -0700861
862parport_open - register device for particular device number
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300863-----------------------------------------------------------
Linus Torvalds1da177e2005-04-16 15:20:36 -0700864
865SYNOPSIS
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300866^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -0700867
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300868::
Linus Torvalds1da177e2005-04-16 15:20:36 -0700869
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300870 #include <linux/parport.h>
871
872 struct pardevice *parport_open (int devnum, const char *name,
873 int (*pf) (void *),
874 void (*kf) (void *),
875 void (*irqf) (int, void *,
876 struct pt_regs *),
877 int flags, void *handle);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700878
879DESCRIPTION
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300880^^^^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -0700881
882This is like parport_register_device but takes a device number instead
883of a pointer to a struct parport.
884
885RETURN VALUE
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300886^^^^^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -0700887
888See parport_register_device. If no device is associated with devnum,
889NULL is returned.
890
891SEE ALSO
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300892^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -0700893
Eric W. Biederman25398a12007-10-18 03:05:30 -0700894parport_register_device
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300895
896
897
Linus Torvalds1da177e2005-04-16 15:20:36 -0700898parport_close - unregister device for particular device number
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300899--------------------------------------------------------------
Linus Torvalds1da177e2005-04-16 15:20:36 -0700900
901SYNOPSIS
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300902^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -0700903
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300904::
Linus Torvalds1da177e2005-04-16 15:20:36 -0700905
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300906 #include <linux/parport.h>
907
908 void parport_close (struct pardevice *dev);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700909
910DESCRIPTION
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300911^^^^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -0700912
913This is the equivalent of parport_unregister_device for parport_open.
914
915SEE ALSO
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300916^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -0700917
918parport_unregister_device, parport_open
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300919
920
921
Linus Torvalds1da177e2005-04-16 15:20:36 -0700922parport_device_id - obtain IEEE 1284 Device ID
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300923----------------------------------------------
Linus Torvalds1da177e2005-04-16 15:20:36 -0700924
925SYNOPSIS
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300926^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -0700927
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300928::
Linus Torvalds1da177e2005-04-16 15:20:36 -0700929
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300930 #include <linux/parport.h>
931
932 ssize_t parport_device_id (int devnum, char *buffer, size_t len);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700933
934DESCRIPTION
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300935^^^^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -0700936
937Obtains the IEEE 1284 Device ID associated with a given device.
938
939RETURN VALUE
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300940^^^^^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -0700941
942If negative, an error code; otherwise, the number of bytes of buffer
943that contain the device ID. The format of the device ID is as
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300944follows::
Linus Torvalds1da177e2005-04-16 15:20:36 -0700945
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300946 [length][ID]
Linus Torvalds1da177e2005-04-16 15:20:36 -0700947
948The first two bytes indicate the inclusive length of the entire Device
949ID, and are in big-endian order. The ID is a sequence of pairs of the
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300950form::
Linus Torvalds1da177e2005-04-16 15:20:36 -0700951
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300952 key:value;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700953
954NOTES
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300955^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -0700956
957Many devices have ill-formed IEEE 1284 Device IDs.
958
959SEE ALSO
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300960^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -0700961
Eric W. Biederman25398a12007-10-18 03:05:30 -0700962parport_find_class, parport_find_device
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300963
964
965
Linus Torvalds1da177e2005-04-16 15:20:36 -0700966parport_device_coords - convert device number to device coordinates
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300967-------------------------------------------------------------------
Linus Torvalds1da177e2005-04-16 15:20:36 -0700968
969SYNOPSIS
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300970^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -0700971
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300972::
Linus Torvalds1da177e2005-04-16 15:20:36 -0700973
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300974 #include <linux/parport.h>
975
976 int parport_device_coords (int devnum, int *parport, int *mux,
977 int *daisy);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700978
979DESCRIPTION
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300980^^^^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -0700981
982Convert between device number (zero-based) and device coordinates
983(port, multiplexor, daisy chain address).
984
985RETURN VALUE
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300986^^^^^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -0700987
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300988Zero on success, in which case the coordinates are (``*parport``, ``*mux``,
989``*daisy``).
Linus Torvalds1da177e2005-04-16 15:20:36 -0700990
991SEE ALSO
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300992^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -0700993
Eric W. Biederman25398a12007-10-18 03:05:30 -0700994parport_open, parport_device_id
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300995
996
997
Linus Torvalds1da177e2005-04-16 15:20:36 -0700998parport_find_class - find a device by its class
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -0300999-----------------------------------------------
Linus Torvalds1da177e2005-04-16 15:20:36 -07001000
1001SYNOPSIS
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001002^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001003
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001004::
Linus Torvalds1da177e2005-04-16 15:20:36 -07001005
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001006 #include <linux/parport.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -07001007
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001008 typedef enum {
1009 PARPORT_CLASS_LEGACY = 0, /* Non-IEEE1284 device */
1010 PARPORT_CLASS_PRINTER,
1011 PARPORT_CLASS_MODEM,
1012 PARPORT_CLASS_NET,
1013 PARPORT_CLASS_HDC, /* Hard disk controller */
1014 PARPORT_CLASS_PCMCIA,
1015 PARPORT_CLASS_MEDIA, /* Multimedia device */
1016 PARPORT_CLASS_FDC, /* Floppy disk controller */
1017 PARPORT_CLASS_PORTS,
1018 PARPORT_CLASS_SCANNER,
1019 PARPORT_CLASS_DIGCAM,
1020 PARPORT_CLASS_OTHER, /* Anything else */
1021 PARPORT_CLASS_UNSPEC, /* No CLS field in ID */
1022 PARPORT_CLASS_SCSIADAPTER
1023 } parport_device_class;
1024
1025 int parport_find_class (parport_device_class cls, int from);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001026
1027DESCRIPTION
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001028^^^^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001029
1030Find a device by class. The search starts from device number from+1.
1031
1032RETURN VALUE
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001033^^^^^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001034
1035The device number of the next device in that class, or -1 if no such
1036device exists.
1037
1038NOTES
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001039^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001040
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001041Example usage::
Linus Torvalds1da177e2005-04-16 15:20:36 -07001042
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001043 int devnum = -1;
1044 while ((devnum = parport_find_class (PARPORT_CLASS_DIGCAM, devnum)) != -1) {
1045 struct pardevice *dev = parport_open (devnum, ...);
1046 ...
1047 }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001048
1049SEE ALSO
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001050^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001051
1052parport_find_device, parport_open, parport_device_id
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001053
1054
1055
Linus Torvalds1da177e2005-04-16 15:20:36 -07001056parport_find_device - find a device by its class
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001057------------------------------------------------
Linus Torvalds1da177e2005-04-16 15:20:36 -07001058
1059SYNOPSIS
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001060^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001061
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001062::
Linus Torvalds1da177e2005-04-16 15:20:36 -07001063
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001064 #include <linux/parport.h>
1065
1066 int parport_find_device (const char *mfg, const char *mdl, int from);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001067
1068DESCRIPTION
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001069^^^^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001070
1071Find a device by vendor and model. The search starts from device
1072number from+1.
1073
1074RETURN VALUE
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001075^^^^^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001076
1077The device number of the next device matching the specifications, or
1078-1 if no such device exists.
1079
1080NOTES
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001081^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001082
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001083Example usage::
Linus Torvalds1da177e2005-04-16 15:20:36 -07001084
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001085 int devnum = -1;
1086 while ((devnum = parport_find_device ("IOMEGA", "ZIP+", devnum)) != -1) {
1087 struct pardevice *dev = parport_open (devnum, ...);
1088 ...
1089 }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001090
1091SEE ALSO
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001092^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001093
1094parport_find_class, parport_open, parport_device_id
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001095
1096
Linus Torvalds1da177e2005-04-16 15:20:36 -07001097
1098parport_set_timeout - set the inactivity timeout
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001099------------------------------------------------
Linus Torvalds1da177e2005-04-16 15:20:36 -07001100
1101SYNOPSIS
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001102^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001103
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001104::
Linus Torvalds1da177e2005-04-16 15:20:36 -07001105
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001106 #include <linux/parport.h>
1107
1108 long parport_set_timeout (struct pardevice *dev, long inactivity);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001109
1110DESCRIPTION
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001111^^^^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001112
1113Set the inactivity timeout, in jiffies, for a registered device. The
1114previous timeout is returned.
1115
1116RETURN VALUE
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001117^^^^^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001118
1119The previous timeout, in jiffies.
1120
1121NOTES
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001122^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001123
1124Some of the port->ops functions for a parport may take time, owing to
1125delays at the peripheral. After the peripheral has not responded for
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001126``inactivity`` jiffies, a timeout will occur and the blocking function
Linus Torvalds1da177e2005-04-16 15:20:36 -07001127will return.
1128
1129A timeout of 0 jiffies is a special case: the function must do as much
1130as it can without blocking or leaving the hardware in an unknown
1131state. If port operations are performed from within an interrupt
1132handler, for instance, a timeout of 0 jiffies should be used.
1133
1134Once set for a registered device, the timeout will remain at the set
1135value until set again.
1136
1137SEE ALSO
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001138^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001139
1140port->ops->xxx_read/write_yyy
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001141
1142
1143
1144
Linus Torvalds1da177e2005-04-16 15:20:36 -07001145PORT FUNCTIONS
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001146==============
Linus Torvalds1da177e2005-04-16 15:20:36 -07001147
1148The functions in the port->ops structure (struct parport_operations)
1149are provided by the low-level driver responsible for that port.
1150
1151port->ops->read_data - read the data register
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001152---------------------------------------------
Linus Torvalds1da177e2005-04-16 15:20:36 -07001153
1154SYNOPSIS
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001155^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001156
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001157::
Linus Torvalds1da177e2005-04-16 15:20:36 -07001158
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001159 #include <linux/parport.h>
1160
1161 struct parport_operations {
1162 ...
1163 unsigned char (*read_data) (struct parport *port);
1164 ...
1165 };
Linus Torvalds1da177e2005-04-16 15:20:36 -07001166
1167DESCRIPTION
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001168^^^^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001169
1170If port->modes contains the PARPORT_MODE_TRISTATE flag and the
1171PARPORT_CONTROL_DIRECTION bit in the control register is set, this
1172returns the value on the data pins. If port->modes contains the
1173PARPORT_MODE_TRISTATE flag and the PARPORT_CONTROL_DIRECTION bit is
1174not set, the return value _may_ be the last value written to the data
1175register. Otherwise the return value is undefined.
1176
1177SEE ALSO
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001178^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001179
1180write_data, read_status, write_control
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001181
1182
Linus Torvalds1da177e2005-04-16 15:20:36 -07001183
1184port->ops->write_data - write the data register
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001185-----------------------------------------------
Linus Torvalds1da177e2005-04-16 15:20:36 -07001186
1187SYNOPSIS
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001188^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001189
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001190::
Linus Torvalds1da177e2005-04-16 15:20:36 -07001191
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001192 #include <linux/parport.h>
1193
1194 struct parport_operations {
1195 ...
1196 void (*write_data) (struct parport *port, unsigned char d);
1197 ...
1198 };
Linus Torvalds1da177e2005-04-16 15:20:36 -07001199
1200DESCRIPTION
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001201^^^^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001202
1203Writes to the data register. May have side-effects (a STROBE pulse,
1204for instance).
1205
1206SEE ALSO
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001207^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001208
1209read_data, read_status, write_control
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001210
1211
Linus Torvalds1da177e2005-04-16 15:20:36 -07001212
1213port->ops->read_status - read the status register
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001214-------------------------------------------------
Linus Torvalds1da177e2005-04-16 15:20:36 -07001215
1216SYNOPSIS
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001217^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001218
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001219::
Linus Torvalds1da177e2005-04-16 15:20:36 -07001220
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001221 #include <linux/parport.h>
1222
1223 struct parport_operations {
1224 ...
1225 unsigned char (*read_status) (struct parport *port);
1226 ...
1227 };
Linus Torvalds1da177e2005-04-16 15:20:36 -07001228
1229DESCRIPTION
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001230^^^^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001231
1232Reads from the status register. This is a bitmask:
1233
1234- PARPORT_STATUS_ERROR (printer fault, "nFault")
1235- PARPORT_STATUS_SELECT (on-line, "Select")
1236- PARPORT_STATUS_PAPEROUT (no paper, "PError")
1237- PARPORT_STATUS_ACK (handshake, "nAck")
1238- PARPORT_STATUS_BUSY (busy, "Busy")
1239
1240There may be other bits set.
1241
1242SEE ALSO
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001243^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001244
1245read_data, write_data, write_control
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001246
1247
Linus Torvalds1da177e2005-04-16 15:20:36 -07001248
1249port->ops->read_control - read the control register
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001250---------------------------------------------------
Linus Torvalds1da177e2005-04-16 15:20:36 -07001251
1252SYNOPSIS
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001253^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001254
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001255::
Linus Torvalds1da177e2005-04-16 15:20:36 -07001256
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001257 #include <linux/parport.h>
1258
1259 struct parport_operations {
1260 ...
1261 unsigned char (*read_control) (struct parport *port);
1262 ...
1263 };
Linus Torvalds1da177e2005-04-16 15:20:36 -07001264
1265DESCRIPTION
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001266^^^^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001267
1268Returns the last value written to the control register (either from
1269write_control or frob_control). No port access is performed.
1270
1271SEE ALSO
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001272^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001273
1274read_data, write_data, read_status, write_control
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001275
1276
Linus Torvalds1da177e2005-04-16 15:20:36 -07001277
1278port->ops->write_control - write the control register
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001279-----------------------------------------------------
Linus Torvalds1da177e2005-04-16 15:20:36 -07001280
1281SYNOPSIS
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001282^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001283
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001284::
Linus Torvalds1da177e2005-04-16 15:20:36 -07001285
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001286 #include <linux/parport.h>
1287
1288 struct parport_operations {
1289 ...
1290 void (*write_control) (struct parport *port, unsigned char s);
1291 ...
1292 };
Linus Torvalds1da177e2005-04-16 15:20:36 -07001293
1294DESCRIPTION
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001295^^^^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001296
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001297Writes to the control register. This is a bitmask::
1298
1299 _______
1300 - PARPORT_CONTROL_STROBE (nStrobe)
1301 _______
1302 - PARPORT_CONTROL_AUTOFD (nAutoFd)
1303 _____
1304 - PARPORT_CONTROL_INIT (nInit)
1305 _________
1306 - PARPORT_CONTROL_SELECT (nSelectIn)
Linus Torvalds1da177e2005-04-16 15:20:36 -07001307
1308SEE ALSO
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001309^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001310
1311read_data, write_data, read_status, frob_control
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001312
1313
Linus Torvalds1da177e2005-04-16 15:20:36 -07001314
1315port->ops->frob_control - write control register bits
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001316-----------------------------------------------------
Linus Torvalds1da177e2005-04-16 15:20:36 -07001317
1318SYNOPSIS
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001319^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001320
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001321::
Linus Torvalds1da177e2005-04-16 15:20:36 -07001322
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001323 #include <linux/parport.h>
1324
1325 struct parport_operations {
1326 ...
1327 unsigned char (*frob_control) (struct parport *port,
1328 unsigned char mask,
1329 unsigned char val);
1330 ...
1331 };
Linus Torvalds1da177e2005-04-16 15:20:36 -07001332
1333DESCRIPTION
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001334^^^^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001335
1336This is equivalent to reading from the control register, masking out
1337the bits in mask, exclusive-or'ing with the bits in val, and writing
1338the result to the control register.
1339
1340As some ports don't allow reads from the control port, a software copy
1341of its contents is maintained, so frob_control is in fact only one
1342port access.
1343
1344SEE ALSO
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001345^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001346
1347read_data, write_data, read_status, write_control
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001348
1349
Linus Torvalds1da177e2005-04-16 15:20:36 -07001350
1351port->ops->enable_irq - enable interrupt generation
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001352---------------------------------------------------
Linus Torvalds1da177e2005-04-16 15:20:36 -07001353
1354SYNOPSIS
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001355^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001356
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001357::
Linus Torvalds1da177e2005-04-16 15:20:36 -07001358
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001359 #include <linux/parport.h>
1360
1361 struct parport_operations {
1362 ...
1363 void (*enable_irq) (struct parport *port);
1364 ...
1365 };
Linus Torvalds1da177e2005-04-16 15:20:36 -07001366
1367DESCRIPTION
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001368^^^^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001369
1370The parallel port hardware is instructed to generate interrupts at
1371appropriate moments, although those moments are
1372architecture-specific. For the PC architecture, interrupts are
1373commonly generated on the rising edge of nAck.
1374
1375SEE ALSO
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001376^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001377
1378disable_irq
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001379
1380
Linus Torvalds1da177e2005-04-16 15:20:36 -07001381
1382port->ops->disable_irq - disable interrupt generation
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001383-----------------------------------------------------
Linus Torvalds1da177e2005-04-16 15:20:36 -07001384
1385SYNOPSIS
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001386^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001387
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001388::
Linus Torvalds1da177e2005-04-16 15:20:36 -07001389
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001390 #include <linux/parport.h>
1391
1392 struct parport_operations {
1393 ...
1394 void (*disable_irq) (struct parport *port);
1395 ...
1396 };
Linus Torvalds1da177e2005-04-16 15:20:36 -07001397
1398DESCRIPTION
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001399^^^^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001400
1401The parallel port hardware is instructed not to generate interrupts.
1402The interrupt itself is not masked.
1403
1404SEE ALSO
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001405^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001406
1407enable_irq
1408
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001409
1410
Linus Torvalds1da177e2005-04-16 15:20:36 -07001411port->ops->data_forward - enable data drivers
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001412---------------------------------------------
Linus Torvalds1da177e2005-04-16 15:20:36 -07001413
1414SYNOPSIS
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001415^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001416
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001417::
Linus Torvalds1da177e2005-04-16 15:20:36 -07001418
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001419 #include <linux/parport.h>
1420
1421 struct parport_operations {
1422 ...
1423 void (*data_forward) (struct parport *port);
1424 ...
1425 };
Linus Torvalds1da177e2005-04-16 15:20:36 -07001426
1427DESCRIPTION
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001428^^^^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001429
1430Enables the data line drivers, for 8-bit host-to-peripheral
1431communications.
1432
1433SEE ALSO
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001434^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001435
1436data_reverse
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001437
1438
Linus Torvalds1da177e2005-04-16 15:20:36 -07001439
1440port->ops->data_reverse - tristate the buffer
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001441---------------------------------------------
Linus Torvalds1da177e2005-04-16 15:20:36 -07001442
1443SYNOPSIS
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001444^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001445
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001446::
Linus Torvalds1da177e2005-04-16 15:20:36 -07001447
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001448 #include <linux/parport.h>
1449
1450 struct parport_operations {
1451 ...
1452 void (*data_reverse) (struct parport *port);
1453 ...
1454 };
Linus Torvalds1da177e2005-04-16 15:20:36 -07001455
1456DESCRIPTION
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001457^^^^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001458
1459Places the data bus in a high impedance state, if port->modes has the
1460PARPORT_MODE_TRISTATE bit set.
1461
1462SEE ALSO
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001463^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001464
1465data_forward
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001466
1467
1468
Linus Torvalds1da177e2005-04-16 15:20:36 -07001469port->ops->epp_write_data - write EPP data
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001470------------------------------------------
Linus Torvalds1da177e2005-04-16 15:20:36 -07001471
1472SYNOPSIS
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001473^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001474
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001475::
Linus Torvalds1da177e2005-04-16 15:20:36 -07001476
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001477 #include <linux/parport.h>
1478
1479 struct parport_operations {
1480 ...
1481 size_t (*epp_write_data) (struct parport *port, const void *buf,
1482 size_t len, int flags);
1483 ...
1484 };
Linus Torvalds1da177e2005-04-16 15:20:36 -07001485
1486DESCRIPTION
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001487^^^^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001488
1489Writes data in EPP mode, and returns the number of bytes written.
1490
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001491The ``flags`` parameter may be one or more of the following,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001492bitwise-or'ed together:
1493
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001494======================= =================================================
Linus Torvalds1da177e2005-04-16 15:20:36 -07001495PARPORT_EPP_FAST Use fast transfers. Some chips provide 16-bit and
1496 32-bit registers. However, if a transfer
1497 times out, the return value may be unreliable.
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001498======================= =================================================
Linus Torvalds1da177e2005-04-16 15:20:36 -07001499
1500SEE ALSO
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001501^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001502
1503epp_read_data, epp_write_addr, epp_read_addr
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001504
1505
Linus Torvalds1da177e2005-04-16 15:20:36 -07001506
1507port->ops->epp_read_data - read EPP data
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001508----------------------------------------
Linus Torvalds1da177e2005-04-16 15:20:36 -07001509
1510SYNOPSIS
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001511^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001512
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001513::
Linus Torvalds1da177e2005-04-16 15:20:36 -07001514
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001515 #include <linux/parport.h>
1516
1517 struct parport_operations {
1518 ...
1519 size_t (*epp_read_data) (struct parport *port, void *buf,
1520 size_t len, int flags);
1521 ...
1522 };
Linus Torvalds1da177e2005-04-16 15:20:36 -07001523
1524DESCRIPTION
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001525^^^^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001526
1527Reads data in EPP mode, and returns the number of bytes read.
1528
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001529The ``flags`` parameter may be one or more of the following,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001530bitwise-or'ed together:
1531
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001532======================= =================================================
Linus Torvalds1da177e2005-04-16 15:20:36 -07001533PARPORT_EPP_FAST Use fast transfers. Some chips provide 16-bit and
1534 32-bit registers. However, if a transfer
1535 times out, the return value may be unreliable.
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001536======================= =================================================
Linus Torvalds1da177e2005-04-16 15:20:36 -07001537
1538SEE ALSO
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001539^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001540
1541epp_write_data, epp_write_addr, epp_read_addr
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001542
1543
1544
Linus Torvalds1da177e2005-04-16 15:20:36 -07001545port->ops->epp_write_addr - write EPP address
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001546---------------------------------------------
Linus Torvalds1da177e2005-04-16 15:20:36 -07001547
1548SYNOPSIS
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001549^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001550
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001551::
Linus Torvalds1da177e2005-04-16 15:20:36 -07001552
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001553 #include <linux/parport.h>
1554
1555 struct parport_operations {
1556 ...
1557 size_t (*epp_write_addr) (struct parport *port,
1558 const void *buf, size_t len, int flags);
1559 ...
1560 };
Linus Torvalds1da177e2005-04-16 15:20:36 -07001561
1562DESCRIPTION
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001563^^^^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001564
1565Writes EPP addresses (8 bits each), and returns the number written.
1566
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001567The ``flags`` parameter may be one or more of the following,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001568bitwise-or'ed together:
1569
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001570======================= =================================================
Linus Torvalds1da177e2005-04-16 15:20:36 -07001571PARPORT_EPP_FAST Use fast transfers. Some chips provide 16-bit and
1572 32-bit registers. However, if a transfer
1573 times out, the return value may be unreliable.
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001574======================= =================================================
Linus Torvalds1da177e2005-04-16 15:20:36 -07001575
1576(Does PARPORT_EPP_FAST make sense for this function?)
1577
1578SEE ALSO
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001579^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001580
1581epp_write_data, epp_read_data, epp_read_addr
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001582
1583
Linus Torvalds1da177e2005-04-16 15:20:36 -07001584
1585port->ops->epp_read_addr - read EPP address
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001586-------------------------------------------
Linus Torvalds1da177e2005-04-16 15:20:36 -07001587
1588SYNOPSIS
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001589^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001590
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001591::
Linus Torvalds1da177e2005-04-16 15:20:36 -07001592
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001593 #include <linux/parport.h>
1594
1595 struct parport_operations {
1596 ...
1597 size_t (*epp_read_addr) (struct parport *port, void *buf,
1598 size_t len, int flags);
1599 ...
1600 };
Linus Torvalds1da177e2005-04-16 15:20:36 -07001601
1602DESCRIPTION
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001603^^^^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001604
1605Reads EPP addresses (8 bits each), and returns the number read.
1606
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001607The ``flags`` parameter may be one or more of the following,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001608bitwise-or'ed together:
1609
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001610======================= =================================================
Linus Torvalds1da177e2005-04-16 15:20:36 -07001611PARPORT_EPP_FAST Use fast transfers. Some chips provide 16-bit and
1612 32-bit registers. However, if a transfer
1613 times out, the return value may be unreliable.
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001614======================= =================================================
Linus Torvalds1da177e2005-04-16 15:20:36 -07001615
1616(Does PARPORT_EPP_FAST make sense for this function?)
1617
1618SEE ALSO
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001619^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001620
1621epp_write_data, epp_read_data, epp_write_addr
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001622
1623
Linus Torvalds1da177e2005-04-16 15:20:36 -07001624
1625port->ops->ecp_write_data - write a block of ECP data
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001626-----------------------------------------------------
Linus Torvalds1da177e2005-04-16 15:20:36 -07001627
1628SYNOPSIS
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001629^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001630
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001631::
Linus Torvalds1da177e2005-04-16 15:20:36 -07001632
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001633 #include <linux/parport.h>
1634
1635 struct parport_operations {
1636 ...
1637 size_t (*ecp_write_data) (struct parport *port,
1638 const void *buf, size_t len, int flags);
1639 ...
1640 };
Linus Torvalds1da177e2005-04-16 15:20:36 -07001641
1642DESCRIPTION
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001643^^^^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001644
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001645Writes a block of ECP data. The ``flags`` parameter is ignored.
Linus Torvalds1da177e2005-04-16 15:20:36 -07001646
1647RETURN VALUE
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001648^^^^^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001649
1650The number of bytes written.
1651
1652SEE ALSO
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001653^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001654
1655ecp_read_data, ecp_write_addr
1656
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001657
1658
Linus Torvalds1da177e2005-04-16 15:20:36 -07001659port->ops->ecp_read_data - read a block of ECP data
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001660---------------------------------------------------
Linus Torvalds1da177e2005-04-16 15:20:36 -07001661
1662SYNOPSIS
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001663^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001664
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001665::
Linus Torvalds1da177e2005-04-16 15:20:36 -07001666
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001667 #include <linux/parport.h>
1668
1669 struct parport_operations {
1670 ...
1671 size_t (*ecp_read_data) (struct parport *port,
1672 void *buf, size_t len, int flags);
1673 ...
1674 };
Linus Torvalds1da177e2005-04-16 15:20:36 -07001675
1676DESCRIPTION
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001677^^^^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001678
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001679Reads a block of ECP data. The ``flags`` parameter is ignored.
Linus Torvalds1da177e2005-04-16 15:20:36 -07001680
1681RETURN VALUE
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001682^^^^^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001683
1684The number of bytes read. NB. There may be more unread data in a
1685FIFO. Is there a way of stunning the FIFO to prevent this?
1686
1687SEE ALSO
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001688^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001689
1690ecp_write_block, ecp_write_addr
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001691
1692
1693
Linus Torvalds1da177e2005-04-16 15:20:36 -07001694port->ops->ecp_write_addr - write a block of ECP addresses
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001695----------------------------------------------------------
Linus Torvalds1da177e2005-04-16 15:20:36 -07001696
1697SYNOPSIS
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001698^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001699
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001700::
Linus Torvalds1da177e2005-04-16 15:20:36 -07001701
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001702 #include <linux/parport.h>
1703
1704 struct parport_operations {
1705 ...
1706 size_t (*ecp_write_addr) (struct parport *port,
1707 const void *buf, size_t len, int flags);
1708 ...
1709 };
Linus Torvalds1da177e2005-04-16 15:20:36 -07001710
1711DESCRIPTION
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001712^^^^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001713
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001714Writes a block of ECP addresses. The ``flags`` parameter is ignored.
Linus Torvalds1da177e2005-04-16 15:20:36 -07001715
1716RETURN VALUE
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001717^^^^^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001718
1719The number of bytes written.
1720
1721NOTES
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001722^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001723
1724This may use a FIFO, and if so shall not return until the FIFO is empty.
1725
1726SEE ALSO
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001727^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001728
1729ecp_read_data, ecp_write_data
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001730
1731
1732
Linus Torvalds1da177e2005-04-16 15:20:36 -07001733port->ops->nibble_read_data - read a block of data in nibble mode
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001734-----------------------------------------------------------------
Linus Torvalds1da177e2005-04-16 15:20:36 -07001735
1736SYNOPSIS
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001737^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001738
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001739::
Linus Torvalds1da177e2005-04-16 15:20:36 -07001740
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001741 #include <linux/parport.h>
1742
1743 struct parport_operations {
1744 ...
1745 size_t (*nibble_read_data) (struct parport *port,
1746 void *buf, size_t len, int flags);
1747 ...
1748 };
Linus Torvalds1da177e2005-04-16 15:20:36 -07001749
1750DESCRIPTION
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001751^^^^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001752
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001753Reads a block of data in nibble mode. The ``flags`` parameter is ignored.
Linus Torvalds1da177e2005-04-16 15:20:36 -07001754
1755RETURN VALUE
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001756^^^^^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001757
1758The number of whole bytes read.
1759
1760SEE ALSO
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001761^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001762
1763byte_read_data, compat_write_data
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001764
1765
Linus Torvalds1da177e2005-04-16 15:20:36 -07001766
1767port->ops->byte_read_data - read a block of data in byte mode
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001768-------------------------------------------------------------
Linus Torvalds1da177e2005-04-16 15:20:36 -07001769
1770SYNOPSIS
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001771^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001772
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001773::
Linus Torvalds1da177e2005-04-16 15:20:36 -07001774
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001775 #include <linux/parport.h>
1776
1777 struct parport_operations {
1778 ...
1779 size_t (*byte_read_data) (struct parport *port,
1780 void *buf, size_t len, int flags);
1781 ...
1782 };
Linus Torvalds1da177e2005-04-16 15:20:36 -07001783
1784DESCRIPTION
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001785^^^^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001786
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001787Reads a block of data in byte mode. The ``flags`` parameter is ignored.
Linus Torvalds1da177e2005-04-16 15:20:36 -07001788
1789RETURN VALUE
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001790^^^^^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001791
1792The number of bytes read.
1793
1794SEE ALSO
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001795^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001796
1797nibble_read_data, compat_write_data
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001798
1799
Linus Torvalds1da177e2005-04-16 15:20:36 -07001800
1801port->ops->compat_write_data - write a block of data in compatibility mode
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001802--------------------------------------------------------------------------
Linus Torvalds1da177e2005-04-16 15:20:36 -07001803
1804SYNOPSIS
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001805^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001806
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001807::
Linus Torvalds1da177e2005-04-16 15:20:36 -07001808
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001809 #include <linux/parport.h>
1810
1811 struct parport_operations {
1812 ...
1813 size_t (*compat_write_data) (struct parport *port,
1814 const void *buf, size_t len, int flags);
1815 ...
1816 };
Linus Torvalds1da177e2005-04-16 15:20:36 -07001817
1818DESCRIPTION
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001819^^^^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001820
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001821Writes a block of data in compatibility mode. The ``flags`` parameter
Linus Torvalds1da177e2005-04-16 15:20:36 -07001822is ignored.
1823
1824RETURN VALUE
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001825^^^^^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001826
1827The number of bytes written.
1828
1829SEE ALSO
Mauro Carvalho Chehabbe9d0412017-05-17 11:21:45 -03001830^^^^^^^^
Linus Torvalds1da177e2005-04-16 15:20:36 -07001831
1832nibble_read_data, byte_read_data