x86/mm: Move LDT remap out of KASLR region on 5-level paging
[GitHub/moto-9609/android_kernel_motorola_exynos9610.git] / Documentation / parport-lowlevel.txt
CommitLineData
be9d0411 1===============================
1da177e4 2PARPORT interface documentation
be9d0411 3===============================
1da177e4 4
be9d0411 5:Time-stamp: <2000-02-24 13:30:20 twaugh>
1da177e4
LT
6
7Described here are the following functions:
8
be9d0411 9Global functions::
1da177e4
LT
10 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
1da177e4
LT
29 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):
be9d0411
MCC
35
36 SPP::
1da177e4
LT
37 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
be9d0411 48 EPP::
1da177e4
LT
49 port->ops->epp_write_data
50 port->ops->epp_read_data
51 port->ops->epp_write_addr
52 port->ops->epp_read_addr
53
be9d0411 54 ECP::
1da177e4
LT
55 port->ops->ecp_write_data
56 port->ops->ecp_read_data
57 port->ops->ecp_write_addr
58
be9d0411 59 Other::
1da177e4
LT
60 port->ops->nibble_read_data
61 port->ops->byte_read_data
62 port->ops->compat_write_data
63
be9d0411 64The parport subsystem comprises ``parport`` (the core port-sharing
1da177e4
LT
65code), 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
be9d0411 75``generic`` functions for doing standard things that will work on any
1da177e4
LT
76IEEE 1284-capable architecture.
77
78The port functions are provided by the low-level drivers, although the
be9d0411 79core parport module provides generic ``defaults`` for some routines.
1da177e4
LT
80The port functions can be split into three groups: SPP, EPP, and ECP.
81
be9d0411 82SPP (Standard Parallel Port) functions modify so-called ``SPP``
1da177e4
LT
83registers: 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\f
be9d0411
MCC
100Global functions
101================
1da177e4
LT
102
103parport_register_driver - register a device driver with parport
be9d0411 104---------------------------------------------------------------
1da177e4
LT
105
106SYNOPSIS
be9d0411
MCC
107^^^^^^^^
108
109::
1da177e4 110
be9d0411 111 #include <linux/parport.h>
1da177e4 112
be9d0411
MCC
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);
1da177e4
LT
120
121DESCRIPTION
be9d0411 122^^^^^^^^^^^
1da177e4
LT
123
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
be9d0411 129A ``struct parport_driver`` contains the textual name of your driver,
1da177e4
LT
130a 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
be9d0411
MCC
135The visible parts of the ``struct parport *`` argument given to
136attach/detach are::
137
138 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 };
1da177e4
LT
149
150There are other members of the structure, but they should not be
151touched.
152
be9d0411 153The ``modes`` member summarises the capabilities of the underlying
1da177e4
LT
154hardware. It consists of flags which may be bitwise-ored together:
155
be9d0411 156 ============================= ===============================================
1da177e4
LT
157 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.
be9d0411 179 ============================= ===============================================
1da177e4 180
be9d0411 181There may be other flags in ``modes`` as well.
1da177e4 182
be9d0411
MCC
183The contents of ``modes`` is advisory only. For example, if the
184hardware is capable of DMA, and PARPORT_MODE_DMA is in ``modes``, it
1da177e4
LT
185doesn'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
be9d0411 190^^^^^^^^^^^^
1da177e4
LT
191
192Zero on success, otherwise an error code.
193
194ERRORS
be9d0411 195^^^^^^
1da177e4
LT
196
197None. (Can it fail? Why return int?)
198
199EXAMPLE
be9d0411 200^^^^^^^
1da177e4 201
be9d0411 202::
1da177e4 203
be9d0411
MCC
204 static void lp_attach (struct parport *port)
205 {
206 ...
207 private = kmalloc (...);
208 dev[count++] = parport_register_device (...);
209 ...
210 }
1da177e4 211
be9d0411
MCC
212 static void lp_detach (struct parport *port)
213 {
214 ...
215 }
1da177e4 216
be9d0411
MCC
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 ...
1da177e4 232 }
be9d0411 233
1da177e4
LT
234
235SEE ALSO
be9d0411 236^^^^^^^^
1da177e4
LT
237
238parport_unregister_driver, parport_register_device, parport_enumerate
be9d0411
MCC
239
240
241
1da177e4 242parport_unregister_driver - tell parport to forget about this driver
be9d0411 243--------------------------------------------------------------------
1da177e4
LT
244
245SYNOPSIS
be9d0411 246^^^^^^^^
1da177e4 247
be9d0411 248::
1da177e4 249
be9d0411
MCC
250 #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);
1da177e4
LT
259
260DESCRIPTION
be9d0411 261^^^^^^^^^^^
1da177e4
LT
262
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
be9d0411 268^^^^^^^
1da177e4 269
be9d0411 270::
1da177e4 271
be9d0411
MCC
272 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 }
1da177e4
LT
283
284SEE ALSO
be9d0411 285^^^^^^^^
1da177e4
LT
286
287parport_register_driver, parport_enumerate
be9d0411
MCC
288
289
290
1da177e4 291parport_enumerate - retrieve a list of parallel ports (DEPRECATED)
be9d0411 292------------------------------------------------------------------
1da177e4
LT
293
294SYNOPSIS
be9d0411 295^^^^^^^^
1da177e4 296
be9d0411 297::
1da177e4 298
be9d0411
MCC
299 #include <linux/parport.h>
300
301 struct parport *parport_enumerate (void);
1da177e4
LT
302
303DESCRIPTION
be9d0411 304^^^^^^^^^^^
1da177e4
LT
305
306Retrieve the first of a list of valid parallel ports for this machine.
be9d0411
MCC
307Successive parallel ports can be found using the ``struct parport
308*next`` element of the ``struct parport *`` that is returned. If ``next``
1da177e4
LT
309is 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
be9d0411 313^^^^^^^^^^^^
1da177e4 314
be9d0411 315A ``struct parport *`` describing a valid parallel port for the machine,
1da177e4
LT
316or NULL if there are none.
317
318ERRORS
be9d0411 319^^^^^^
1da177e4
LT
320
321This function can return NULL to indicate that there are no parallel
322ports to use.
323
324EXAMPLE
be9d0411
MCC
325^^^^^^^
326
327::
1da177e4 328
be9d0411
MCC
329 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 }
1da177e4 340
1da177e4 341 ...
1da177e4
LT
342 }
343
1da177e4 344NOTES
be9d0411 345^^^^^
1da177e4
LT
346
347parport_enumerate is deprecated; parport_register_driver should be
348used instead.
349
350SEE ALSO
be9d0411 351^^^^^^^^
1da177e4
LT
352
353parport_register_driver, parport_unregister_driver
be9d0411
MCC
354
355
356
1da177e4 357parport_register_device - register to use a port
be9d0411 358------------------------------------------------
1da177e4
LT
359
360SYNOPSIS
be9d0411 361^^^^^^^^
1da177e4 362
be9d0411 363::
1da177e4 364
be9d0411 365 #include <linux/parport.h>
1da177e4 366
be9d0411
MCC
367 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);
1da177e4
LT
378
379DESCRIPTION
be9d0411 380^^^^^^^^^^^
1da177e4
LT
381
382Use this function to register your device driver on a parallel port
be9d0411 383(``port``). Once you have done that, you will be able to use
1da177e4
LT
384parport_claim and parport_release in order to use the port.
385
be9d0411 386The (``name``) argument is the name of the device that appears in /proc
cdb32706
MP
387filesystem. The string must be valid for the whole lifetime of the
388device (until parport_unregister_device is called).
389
1da177e4 390This function will register three callbacks into your driver:
be9d0411 391``preempt``, ``wakeup`` and ``irq``. Each of these may be NULL in order to
1da177e4
LT
392indicate that you do not want a callback.
393
be9d0411
MCC
394When the ``preempt`` function is called, it is because another driver
395wishes to use the parallel port. The ``preempt`` function should return
1da177e4
LT
396non-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
be9d0411 400The ``wakeup`` function is called once another driver has released the
1da177e4 401port and no other driver has yet claimed it. You can claim the
be9d0411 402parallel port from within the ``wakeup`` function (in which case the
1da177e4
LT
403claim 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,
be9d0411 407the ``irq`` function will be called. (Write something about shared
1da177e4
LT
408interrupts here.)
409
be9d0411 410The ``handle`` is a pointer to driver-specific data, and is passed to
1da177e4
LT
411the callback functions.
412
be9d0411 413``flags`` may be a bitwise combination of the following flags:
1da177e4 414
be9d0411 415 ===================== =================================================
1da177e4 416 Flag Meaning
be9d0411 417 ===================== =================================================
1da177e4
LT
418 PARPORT_DEV_EXCL The device cannot share the parallel port at all.
419 Use this only when absolutely necessary.
be9d0411 420 ===================== =================================================
1da177e4
LT
421
422The typedefs are not actually defined -- they are only shown in order
423to make the function prototype more readable.
424
be9d0411 425The visible parts of the returned ``struct pardevice`` are::
1da177e4 426
be9d0411
MCC
427 struct pardevice {
428 struct parport *port; /* Associated port */
429 void *private; /* Device driver's 'handle' */
430 ...
431 };
1da177e4
LT
432
433RETURN VALUE
be9d0411 434^^^^^^^^^^^^
1da177e4 435
be9d0411 436A ``struct pardevice *``: a handle to the registered parallel port
1da177e4
LT
437device that can be used for parport_claim, parport_release, etc.
438
439ERRORS
be9d0411 440^^^^^^
1da177e4
LT
441
442A return value of NULL indicates that there was a problem registering
443a device on that port.
444
445EXAMPLE
be9d0411
MCC
446^^^^^^^
447
448::
449
450 static int preempt (void *handle)
451 {
452 if (busy_right_now)
453 return 1;
454
455 must_reclaim_port = 1;
456 return 0;
457 }
458
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;
1da177e4 477
1da177e4 478 must_reclaim_port = 0;
be9d0411
MCC
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 ...
1da177e4 491 }
1da177e4
LT
492
493SEE ALSO
be9d0411 494^^^^^^^^
1da177e4
LT
495
496parport_unregister_device, parport_claim
be9d0411
MCC
497
498
1da177e4
LT
499\f
500parport_unregister_device - finish using a port
be9d0411 501-----------------------------------------------
1da177e4
LT
502
503SYNPOPSIS
504
be9d0411
MCC
505::
506
507 #include <linux/parport.h>
1da177e4 508
be9d0411 509 void parport_unregister_device (struct pardevice *dev);
1da177e4
LT
510
511DESCRIPTION
be9d0411 512^^^^^^^^^^^
1da177e4
LT
513
514This function is the opposite of parport_register_device. After using
be9d0411 515parport_unregister_device, ``dev`` is no longer a valid device handle.
1da177e4
LT
516
517You should not unregister a device that is currently claimed, although
518if you do it will be released automatically.
519
520EXAMPLE
be9d0411
MCC
521^^^^^^^
522
523::
1da177e4
LT
524
525 ...
526 kfree (dev->private); /* before we lose the pointer */
527 parport_unregister_device (dev);
528 ...
529
530SEE ALSO
be9d0411
MCC
531^^^^^^^^
532
1da177e4
LT
533
534parport_unregister_driver
535\f
536parport_claim, parport_claim_or_block - claim the parallel port for a device
be9d0411 537----------------------------------------------------------------------------
1da177e4
LT
538
539SYNOPSIS
be9d0411
MCC
540^^^^^^^^
541
542::
1da177e4 543
be9d0411 544 #include <linux/parport.h>
1da177e4 545
be9d0411
MCC
546 int parport_claim (struct pardevice *dev);
547 int parport_claim_or_block (struct pardevice *dev);
1da177e4
LT
548
549DESCRIPTION
be9d0411 550^^^^^^^^^^^
1da177e4
LT
551
552These functions attempt to gain control of the parallel port on which
be9d0411
MCC
553``dev`` is registered. ``parport_claim`` does not block, but
554``parport_claim_or_block`` may do. (Put something here about blocking
1da177e4
LT
555interruptibly or non-interruptibly.)
556
557You should not try to claim a port that you have already claimed.
558
559RETURN VALUE
be9d0411 560^^^^^^^^^^^^
1da177e4
LT
561
562A return value of zero indicates that the port was successfully
563claimed, and the caller now has possession of the parallel port.
564
be9d0411 565If ``parport_claim_or_block`` blocks before returning successfully, the
1da177e4
LT
566return value is positive.
567
568ERRORS
be9d0411 569^^^^^^
1da177e4 570
be9d0411 571========== ==========================================================
1da177e4
LT
572 -EAGAIN The port is unavailable at the moment, but another attempt
573 to claim it may succeed.
be9d0411 574========== ==========================================================
1da177e4
LT
575
576SEE ALSO
be9d0411
MCC
577^^^^^^^^
578
1da177e4
LT
579
580parport_release
581\f
582parport_release - release the parallel port
be9d0411 583-------------------------------------------
1da177e4
LT
584
585SYNOPSIS
be9d0411
MCC
586^^^^^^^^
587
588::
1da177e4 589
be9d0411 590 #include <linux/parport.h>
1da177e4 591
be9d0411 592 void parport_release (struct pardevice *dev);
1da177e4
LT
593
594DESCRIPTION
be9d0411 595^^^^^^^^^^^
1da177e4
LT
596
597Once a parallel port device has been claimed, it can be released using
be9d0411 598``parport_release``. It cannot fail, but you should not release a
1da177e4
LT
599device that you do not have possession of.
600
601EXAMPLE
be9d0411 602^^^^^^^
1da177e4 603
be9d0411
MCC
604::
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 }
1da177e4
LT
615
616
617SEE ALSO
be9d0411 618^^^^^^^^
1da177e4
LT
619
620change_mode, parport_claim, parport_claim_or_block, parport_yield
be9d0411
MCC
621
622
623
1da177e4 624parport_yield, parport_yield_blocking - temporarily release a parallel port
be9d0411 625---------------------------------------------------------------------------
1da177e4
LT
626
627SYNOPSIS
be9d0411
MCC
628^^^^^^^^
629
630::
1da177e4 631
be9d0411 632 #include <linux/parport.h>
1da177e4 633
be9d0411
MCC
634 int parport_yield (struct pardevice *dev)
635 int parport_yield_blocking (struct pardevice *dev);
1da177e4
LT
636
637DESCRIPTION
be9d0411 638^^^^^^^^^^^
1da177e4
LT
639
640When a driver has control of a parallel port, it may allow another
be9d0411
MCC
641driver to temporarily ``borrow`` it. ``parport_yield`` does not block;
642``parport_yield_blocking`` may do.
1da177e4
LT
643
644RETURN VALUE
be9d0411 645^^^^^^^^^^^^
1da177e4
LT
646
647A return value of zero indicates that the caller still owns the port
648and the call did not block.
649
be9d0411 650A positive return value from ``parport_yield_blocking`` indicates that
1da177e4
LT
651the 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
be9d0411 657^^^^^^
1da177e4 658
be9d0411 659========= ==========================================================
1da177e4 660 -EAGAIN Ownership of the parallel port was given away.
be9d0411 661========= ==========================================================
1da177e4
LT
662
663SEE ALSO
be9d0411 664^^^^^^^^
1da177e4
LT
665
666parport_release
be9d0411
MCC
667
668
1da177e4
LT
669\f
670parport_wait_peripheral - wait for status lines, up to 35ms
be9d0411 671-----------------------------------------------------------
1da177e4
LT
672
673SYNOPSIS
be9d0411
MCC
674^^^^^^^^
675
676::
1da177e4 677
be9d0411 678 #include <linux/parport.h>
1da177e4 679
be9d0411
MCC
680 int parport_wait_peripheral (struct parport *port,
681 unsigned char mask,
682 unsigned char val);
1da177e4
LT
683
684DESCRIPTION
be9d0411 685^^^^^^^^^^^
1da177e4
LT
686
687Wait for the status lines in mask to match the values in val.
688
689RETURN VALUE
be9d0411 690^^^^^^^^^^^^
1da177e4 691
be9d0411 692======== ==========================================================
1da177e4
LT
693 -EINTR a signal is pending
694 0 the status lines in mask have values in val
695 1 timed out while waiting (35ms elapsed)
be9d0411 696======== ==========================================================
1da177e4
LT
697
698SEE ALSO
be9d0411 699^^^^^^^^
1da177e4
LT
700
701parport_poll_peripheral
be9d0411
MCC
702
703
1da177e4
LT
704\f
705parport_poll_peripheral - wait for status lines, in usec
be9d0411 706--------------------------------------------------------
1da177e4
LT
707
708SYNOPSIS
be9d0411
MCC
709^^^^^^^^
710
711::
1da177e4 712
be9d0411 713 #include <linux/parport.h>
1da177e4 714
be9d0411
MCC
715 int parport_poll_peripheral (struct parport *port,
716 unsigned char mask,
717 unsigned char val,
718 int usec);
1da177e4
LT
719
720DESCRIPTION
be9d0411 721^^^^^^^^^^^
1da177e4
LT
722
723Wait for the status lines in mask to match the values in val.
724
725RETURN VALUE
be9d0411 726^^^^^^^^^^^^
1da177e4 727
be9d0411 728======== ==========================================================
1da177e4
LT
729 -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)
be9d0411 732======== ==========================================================
1da177e4
LT
733
734SEE ALSO
be9d0411 735^^^^^^^^
1da177e4
LT
736
737parport_wait_peripheral
be9d0411
MCC
738
739
740
1da177e4 741parport_wait_event - wait for an event on a port
be9d0411 742------------------------------------------------
1da177e4
LT
743
744SYNOPSIS
be9d0411 745^^^^^^^^
1da177e4 746
be9d0411 747::
1da177e4 748
be9d0411
MCC
749 #include <linux/parport.h>
750
751 int parport_wait_event (struct parport *port, signed long timeout)
1da177e4
LT
752
753DESCRIPTION
be9d0411 754^^^^^^^^^^^
1da177e4
LT
755
756Wait for an event (e.g. interrupt) on a port. The timeout is in
757jiffies.
758
759RETURN VALUE
be9d0411 760^^^^^^^^^^^^
1da177e4 761
be9d0411 762======= ==========================================================
1da177e4
LT
763 0 success
764 <0 error (exit as soon as possible)
765 >0 timed out
be9d0411
MCC
766======= ==========================================================
767
1da177e4 768parport_negotiate - perform IEEE 1284 negotiation
be9d0411 769-------------------------------------------------
1da177e4
LT
770
771SYNOPSIS
be9d0411
MCC
772^^^^^^^^
773
774::
1da177e4 775
be9d0411 776 #include <linux/parport.h>
1da177e4 777
be9d0411 778 int parport_negotiate (struct parport *, int mode);
1da177e4
LT
779
780DESCRIPTION
be9d0411 781^^^^^^^^^^^
1da177e4
LT
782
783Perform IEEE 1284 negotiation.
784
785RETURN VALUE
be9d0411 786^^^^^^^^^^^^
1da177e4 787
be9d0411 788======= ==========================================================
1da177e4
LT
789 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
be9d0411 793======= ==========================================================
1da177e4
LT
794
795SEE ALSO
be9d0411 796^^^^^^^^
1da177e4
LT
797
798parport_read, parport_write
be9d0411
MCC
799
800
801
1da177e4 802parport_read - read data from device
be9d0411 803------------------------------------
1da177e4
LT
804
805SYNOPSIS
be9d0411
MCC
806^^^^^^^^
807
808::
1da177e4 809
be9d0411 810 #include <linux/parport.h>
1da177e4 811
be9d0411 812 ssize_t parport_read (struct parport *, void *buf, size_t len);
1da177e4
LT
813
814DESCRIPTION
be9d0411 815^^^^^^^^^^^
1da177e4
LT
816
817Read data from device in current IEEE 1284 transfer mode. This only
818works for modes that support reverse data transfer.
819
820RETURN VALUE
be9d0411 821^^^^^^^^^^^^
1da177e4
LT
822
823If negative, an error code; otherwise the number of bytes transferred.
824
825SEE ALSO
be9d0411 826^^^^^^^^
1da177e4
LT
827
828parport_write, parport_negotiate
be9d0411
MCC
829
830
831
1da177e4 832parport_write - write data to device
be9d0411 833------------------------------------
1da177e4
LT
834
835SYNOPSIS
be9d0411
MCC
836^^^^^^^^
837
838::
1da177e4 839
be9d0411 840 #include <linux/parport.h>
1da177e4 841
be9d0411 842 ssize_t parport_write (struct parport *, const void *buf, size_t len);
1da177e4
LT
843
844DESCRIPTION
be9d0411 845^^^^^^^^^^^
1da177e4
LT
846
847Write data to device in current IEEE 1284 transfer mode. This only
848works for modes that support forward data transfer.
849
850RETURN VALUE
be9d0411 851^^^^^^^^^^^^
1da177e4
LT
852
853If negative, an error code; otherwise the number of bytes transferred.
854
855SEE ALSO
be9d0411 856^^^^^^^^
1da177e4
LT
857
858parport_read, parport_negotiate
be9d0411
MCC
859
860
1da177e4
LT
861\f
862parport_open - register device for particular device number
be9d0411 863-----------------------------------------------------------
1da177e4
LT
864
865SYNOPSIS
be9d0411 866^^^^^^^^
1da177e4 867
be9d0411 868::
1da177e4 869
be9d0411
MCC
870 #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);
1da177e4
LT
878
879DESCRIPTION
be9d0411 880^^^^^^^^^^^
1da177e4
LT
881
882This is like parport_register_device but takes a device number instead
883of a pointer to a struct parport.
884
885RETURN VALUE
be9d0411 886^^^^^^^^^^^^
1da177e4
LT
887
888See parport_register_device. If no device is associated with devnum,
889NULL is returned.
890
891SEE ALSO
be9d0411 892^^^^^^^^
1da177e4 893
25398a15 894parport_register_device
be9d0411
MCC
895
896
897
1da177e4 898parport_close - unregister device for particular device number
be9d0411 899--------------------------------------------------------------
1da177e4
LT
900
901SYNOPSIS
be9d0411
MCC
902^^^^^^^^
903
904::
1da177e4 905
be9d0411 906 #include <linux/parport.h>
1da177e4 907
be9d0411 908 void parport_close (struct pardevice *dev);
1da177e4
LT
909
910DESCRIPTION
be9d0411 911^^^^^^^^^^^
1da177e4
LT
912
913This is the equivalent of parport_unregister_device for parport_open.
914
915SEE ALSO
be9d0411 916^^^^^^^^
1da177e4
LT
917
918parport_unregister_device, parport_open
be9d0411
MCC
919
920
921
1da177e4 922parport_device_id - obtain IEEE 1284 Device ID
be9d0411 923----------------------------------------------
1da177e4
LT
924
925SYNOPSIS
be9d0411
MCC
926^^^^^^^^
927
928::
1da177e4 929
be9d0411 930 #include <linux/parport.h>
1da177e4 931
be9d0411 932 ssize_t parport_device_id (int devnum, char *buffer, size_t len);
1da177e4
LT
933
934DESCRIPTION
be9d0411 935^^^^^^^^^^^
1da177e4
LT
936
937Obtains the IEEE 1284 Device ID associated with a given device.
938
939RETURN VALUE
be9d0411 940^^^^^^^^^^^^
1da177e4
LT
941
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
be9d0411 944follows::
1da177e4 945
be9d0411 946 [length][ID]
1da177e4
LT
947
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
be9d0411 950form::
1da177e4 951
be9d0411 952 key:value;
1da177e4
LT
953
954NOTES
be9d0411 955^^^^^
1da177e4
LT
956
957Many devices have ill-formed IEEE 1284 Device IDs.
958
959SEE ALSO
be9d0411 960^^^^^^^^
1da177e4 961
25398a15 962parport_find_class, parport_find_device
be9d0411
MCC
963
964
965
1da177e4 966parport_device_coords - convert device number to device coordinates
be9d0411 967-------------------------------------------------------------------
1da177e4
LT
968
969SYNOPSIS
be9d0411
MCC
970^^^^^^^^
971
972::
1da177e4 973
be9d0411 974 #include <linux/parport.h>
1da177e4 975
be9d0411
MCC
976 int parport_device_coords (int devnum, int *parport, int *mux,
977 int *daisy);
1da177e4
LT
978
979DESCRIPTION
be9d0411 980^^^^^^^^^^^
1da177e4
LT
981
982Convert between device number (zero-based) and device coordinates
983(port, multiplexor, daisy chain address).
984
985RETURN VALUE
be9d0411 986^^^^^^^^^^^^
1da177e4 987
be9d0411
MCC
988Zero on success, in which case the coordinates are (``*parport``, ``*mux``,
989``*daisy``).
1da177e4
LT
990
991SEE ALSO
be9d0411 992^^^^^^^^
1da177e4 993
25398a15 994parport_open, parport_device_id
be9d0411
MCC
995
996
997
1da177e4 998parport_find_class - find a device by its class
be9d0411 999-----------------------------------------------
1da177e4
LT
1000
1001SYNOPSIS
be9d0411
MCC
1002^^^^^^^^
1003
1004::
1005
1006 #include <linux/parport.h>
1007
1008 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);
1da177e4
LT
1026
1027DESCRIPTION
be9d0411 1028^^^^^^^^^^^
1da177e4
LT
1029
1030Find a device by class. The search starts from device number from+1.
1031
1032RETURN VALUE
be9d0411 1033^^^^^^^^^^^^
1da177e4
LT
1034
1035The device number of the next device in that class, or -1 if no such
1036device exists.
1037
1038NOTES
be9d0411 1039^^^^^
1da177e4 1040
be9d0411 1041Example usage::
1da177e4 1042
be9d0411
MCC
1043 int devnum = -1;
1044 while ((devnum = parport_find_class (PARPORT_CLASS_DIGCAM, devnum)) != -1) {
1045 struct pardevice *dev = parport_open (devnum, ...);
1046 ...
1047 }
1da177e4
LT
1048
1049SEE ALSO
be9d0411 1050^^^^^^^^
1da177e4
LT
1051
1052parport_find_device, parport_open, parport_device_id
be9d0411
MCC
1053
1054
1055
1da177e4 1056parport_find_device - find a device by its class
be9d0411 1057------------------------------------------------
1da177e4
LT
1058
1059SYNOPSIS
be9d0411 1060^^^^^^^^
1da177e4 1061
be9d0411 1062::
1da177e4 1063
be9d0411
MCC
1064 #include <linux/parport.h>
1065
1066 int parport_find_device (const char *mfg, const char *mdl, int from);
1da177e4
LT
1067
1068DESCRIPTION
be9d0411 1069^^^^^^^^^^^
1da177e4
LT
1070
1071Find a device by vendor and model. The search starts from device
1072number from+1.
1073
1074RETURN VALUE
be9d0411 1075^^^^^^^^^^^^
1da177e4
LT
1076
1077The device number of the next device matching the specifications, or
1078-1 if no such device exists.
1079
1080NOTES
be9d0411 1081^^^^^
1da177e4 1082
be9d0411 1083Example usage::
1da177e4 1084
be9d0411
MCC
1085 int devnum = -1;
1086 while ((devnum = parport_find_device ("IOMEGA", "ZIP+", devnum)) != -1) {
1087 struct pardevice *dev = parport_open (devnum, ...);
1088 ...
1089 }
1da177e4
LT
1090
1091SEE ALSO
be9d0411 1092^^^^^^^^
1da177e4
LT
1093
1094parport_find_class, parport_open, parport_device_id
be9d0411
MCC
1095
1096
1da177e4
LT
1097\f
1098parport_set_timeout - set the inactivity timeout
be9d0411 1099------------------------------------------------
1da177e4
LT
1100
1101SYNOPSIS
be9d0411
MCC
1102^^^^^^^^
1103
1104::
1da177e4 1105
be9d0411 1106 #include <linux/parport.h>
1da177e4 1107
be9d0411 1108 long parport_set_timeout (struct pardevice *dev, long inactivity);
1da177e4
LT
1109
1110DESCRIPTION
be9d0411 1111^^^^^^^^^^^
1da177e4
LT
1112
1113Set the inactivity timeout, in jiffies, for a registered device. The
1114previous timeout is returned.
1115
1116RETURN VALUE
be9d0411 1117^^^^^^^^^^^^
1da177e4
LT
1118
1119The previous timeout, in jiffies.
1120
1121NOTES
be9d0411 1122^^^^^
1da177e4
LT
1123
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
be9d0411 1126``inactivity`` jiffies, a timeout will occur and the blocking function
1da177e4
LT
1127will 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
be9d0411 1138^^^^^^^^
1da177e4
LT
1139
1140port->ops->xxx_read/write_yyy
be9d0411
MCC
1141
1142
1143
1144
1da177e4 1145PORT FUNCTIONS
be9d0411 1146==============
1da177e4
LT
1147
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
be9d0411 1152---------------------------------------------
1da177e4
LT
1153
1154SYNOPSIS
be9d0411 1155^^^^^^^^
1da177e4 1156
be9d0411 1157::
1da177e4 1158
be9d0411
MCC
1159 #include <linux/parport.h>
1160
1161 struct parport_operations {
1162 ...
1163 unsigned char (*read_data) (struct parport *port);
1164 ...
1165 };
1da177e4
LT
1166
1167DESCRIPTION
be9d0411 1168^^^^^^^^^^^
1da177e4
LT
1169
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
be9d0411 1178^^^^^^^^
1da177e4
LT
1179
1180write_data, read_status, write_control
be9d0411
MCC
1181
1182
1da177e4
LT
1183\f
1184port->ops->write_data - write the data register
be9d0411 1185-----------------------------------------------
1da177e4
LT
1186
1187SYNOPSIS
be9d0411 1188^^^^^^^^
1da177e4 1189
be9d0411 1190::
1da177e4 1191
be9d0411
MCC
1192 #include <linux/parport.h>
1193
1194 struct parport_operations {
1195 ...
1196 void (*write_data) (struct parport *port, unsigned char d);
1197 ...
1198 };
1da177e4
LT
1199
1200DESCRIPTION
be9d0411 1201^^^^^^^^^^^
1da177e4
LT
1202
1203Writes to the data register. May have side-effects (a STROBE pulse,
1204for instance).
1205
1206SEE ALSO
be9d0411 1207^^^^^^^^
1da177e4
LT
1208
1209read_data, read_status, write_control
be9d0411
MCC
1210
1211
1da177e4
LT
1212\f
1213port->ops->read_status - read the status register
be9d0411 1214-------------------------------------------------
1da177e4
LT
1215
1216SYNOPSIS
be9d0411 1217^^^^^^^^
1da177e4 1218
be9d0411 1219::
1da177e4 1220
be9d0411
MCC
1221 #include <linux/parport.h>
1222
1223 struct parport_operations {
1224 ...
1225 unsigned char (*read_status) (struct parport *port);
1226 ...
1227 };
1da177e4
LT
1228
1229DESCRIPTION
be9d0411 1230^^^^^^^^^^^
1da177e4
LT
1231
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
be9d0411 1243^^^^^^^^
1da177e4
LT
1244
1245read_data, write_data, write_control
be9d0411
MCC
1246
1247
1da177e4
LT
1248\f
1249port->ops->read_control - read the control register
be9d0411 1250---------------------------------------------------
1da177e4
LT
1251
1252SYNOPSIS
be9d0411 1253^^^^^^^^
1da177e4 1254
be9d0411 1255::
1da177e4 1256
be9d0411
MCC
1257 #include <linux/parport.h>
1258
1259 struct parport_operations {
1260 ...
1261 unsigned char (*read_control) (struct parport *port);
1262 ...
1263 };
1da177e4
LT
1264
1265DESCRIPTION
be9d0411 1266^^^^^^^^^^^
1da177e4
LT
1267
1268Returns the last value written to the control register (either from
1269write_control or frob_control). No port access is performed.
1270
1271SEE ALSO
be9d0411 1272^^^^^^^^
1da177e4
LT
1273
1274read_data, write_data, read_status, write_control
be9d0411
MCC
1275
1276
1da177e4
LT
1277\f
1278port->ops->write_control - write the control register
be9d0411 1279-----------------------------------------------------
1da177e4
LT
1280
1281SYNOPSIS
be9d0411 1282^^^^^^^^
1da177e4 1283
be9d0411 1284::
1da177e4 1285
be9d0411
MCC
1286 #include <linux/parport.h>
1287
1288 struct parport_operations {
1289 ...
1290 void (*write_control) (struct parport *port, unsigned char s);
1291 ...
1292 };
1da177e4
LT
1293
1294DESCRIPTION
be9d0411 1295^^^^^^^^^^^
1da177e4 1296
be9d0411
MCC
1297Writes 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)
1da177e4
LT
1307
1308SEE ALSO
be9d0411 1309^^^^^^^^
1da177e4
LT
1310
1311read_data, write_data, read_status, frob_control
be9d0411
MCC
1312
1313
1da177e4
LT
1314\f
1315port->ops->frob_control - write control register bits
be9d0411 1316-----------------------------------------------------
1da177e4
LT
1317
1318SYNOPSIS
be9d0411 1319^^^^^^^^
1da177e4 1320
be9d0411 1321::
1da177e4 1322
be9d0411
MCC
1323 #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 };
1da177e4
LT
1332
1333DESCRIPTION
be9d0411 1334^^^^^^^^^^^
1da177e4
LT
1335
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
be9d0411 1345^^^^^^^^
1da177e4
LT
1346
1347read_data, write_data, read_status, write_control
be9d0411
MCC
1348
1349
1da177e4
LT
1350\f
1351port->ops->enable_irq - enable interrupt generation
be9d0411 1352---------------------------------------------------
1da177e4
LT
1353
1354SYNOPSIS
be9d0411 1355^^^^^^^^
1da177e4 1356
be9d0411 1357::
1da177e4 1358
be9d0411
MCC
1359 #include <linux/parport.h>
1360
1361 struct parport_operations {
1362 ...
1363 void (*enable_irq) (struct parport *port);
1364 ...
1365 };
1da177e4
LT
1366
1367DESCRIPTION
be9d0411 1368^^^^^^^^^^^
1da177e4
LT
1369
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
be9d0411 1376^^^^^^^^
1da177e4
LT
1377
1378disable_irq
be9d0411
MCC
1379
1380
1da177e4
LT
1381\f
1382port->ops->disable_irq - disable interrupt generation
be9d0411 1383-----------------------------------------------------
1da177e4
LT
1384
1385SYNOPSIS
be9d0411 1386^^^^^^^^
1da177e4 1387
be9d0411 1388::
1da177e4 1389
be9d0411
MCC
1390 #include <linux/parport.h>
1391
1392 struct parport_operations {
1393 ...
1394 void (*disable_irq) (struct parport *port);
1395 ...
1396 };
1da177e4
LT
1397
1398DESCRIPTION
be9d0411 1399^^^^^^^^^^^
1da177e4
LT
1400
1401The parallel port hardware is instructed not to generate interrupts.
1402The interrupt itself is not masked.
1403
1404SEE ALSO
be9d0411 1405^^^^^^^^
1da177e4
LT
1406
1407enable_irq
1408\f
be9d0411
MCC
1409
1410
1da177e4 1411port->ops->data_forward - enable data drivers
be9d0411 1412---------------------------------------------
1da177e4
LT
1413
1414SYNOPSIS
be9d0411 1415^^^^^^^^
1da177e4 1416
be9d0411 1417::
1da177e4 1418
be9d0411
MCC
1419 #include <linux/parport.h>
1420
1421 struct parport_operations {
1422 ...
1423 void (*data_forward) (struct parport *port);
1424 ...
1425 };
1da177e4
LT
1426
1427DESCRIPTION
be9d0411 1428^^^^^^^^^^^
1da177e4
LT
1429
1430Enables the data line drivers, for 8-bit host-to-peripheral
1431communications.
1432
1433SEE ALSO
be9d0411 1434^^^^^^^^
1da177e4
LT
1435
1436data_reverse
be9d0411
MCC
1437
1438
1da177e4
LT
1439\f
1440port->ops->data_reverse - tristate the buffer
be9d0411 1441---------------------------------------------
1da177e4
LT
1442
1443SYNOPSIS
be9d0411 1444^^^^^^^^
1da177e4 1445
be9d0411 1446::
1da177e4 1447
be9d0411
MCC
1448 #include <linux/parport.h>
1449
1450 struct parport_operations {
1451 ...
1452 void (*data_reverse) (struct parport *port);
1453 ...
1454 };
1da177e4
LT
1455
1456DESCRIPTION
be9d0411 1457^^^^^^^^^^^
1da177e4
LT
1458
1459Places the data bus in a high impedance state, if port->modes has the
1460PARPORT_MODE_TRISTATE bit set.
1461
1462SEE ALSO
be9d0411 1463^^^^^^^^
1da177e4
LT
1464
1465data_forward
be9d0411
MCC
1466
1467
1468
1da177e4 1469port->ops->epp_write_data - write EPP data
be9d0411 1470------------------------------------------
1da177e4
LT
1471
1472SYNOPSIS
be9d0411 1473^^^^^^^^
1da177e4 1474
be9d0411 1475::
1da177e4 1476
be9d0411
MCC
1477 #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 };
1da177e4
LT
1485
1486DESCRIPTION
be9d0411 1487^^^^^^^^^^^
1da177e4
LT
1488
1489Writes data in EPP mode, and returns the number of bytes written.
1490
be9d0411 1491The ``flags`` parameter may be one or more of the following,
1da177e4
LT
1492bitwise-or'ed together:
1493
be9d0411 1494======================= =================================================
1da177e4
LT
1495PARPORT_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.
be9d0411 1498======================= =================================================
1da177e4
LT
1499
1500SEE ALSO
be9d0411 1501^^^^^^^^
1da177e4
LT
1502
1503epp_read_data, epp_write_addr, epp_read_addr
be9d0411
MCC
1504
1505
1da177e4
LT
1506\f
1507port->ops->epp_read_data - read EPP data
be9d0411 1508----------------------------------------
1da177e4
LT
1509
1510SYNOPSIS
be9d0411 1511^^^^^^^^
1da177e4 1512
be9d0411 1513::
1da177e4 1514
be9d0411
MCC
1515 #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 };
1da177e4
LT
1523
1524DESCRIPTION
be9d0411 1525^^^^^^^^^^^
1da177e4
LT
1526
1527Reads data in EPP mode, and returns the number of bytes read.
1528
be9d0411 1529The ``flags`` parameter may be one or more of the following,
1da177e4
LT
1530bitwise-or'ed together:
1531
be9d0411 1532======================= =================================================
1da177e4
LT
1533PARPORT_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.
be9d0411 1536======================= =================================================
1da177e4
LT
1537
1538SEE ALSO
be9d0411 1539^^^^^^^^
1da177e4
LT
1540
1541epp_write_data, epp_write_addr, epp_read_addr
be9d0411
MCC
1542
1543
1544
1da177e4 1545port->ops->epp_write_addr - write EPP address
be9d0411 1546---------------------------------------------
1da177e4
LT
1547
1548SYNOPSIS
be9d0411 1549^^^^^^^^
1da177e4 1550
be9d0411 1551::
1da177e4 1552
be9d0411
MCC
1553 #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 };
1da177e4
LT
1561
1562DESCRIPTION
be9d0411 1563^^^^^^^^^^^
1da177e4
LT
1564
1565Writes EPP addresses (8 bits each), and returns the number written.
1566
be9d0411 1567The ``flags`` parameter may be one or more of the following,
1da177e4
LT
1568bitwise-or'ed together:
1569
be9d0411 1570======================= =================================================
1da177e4
LT
1571PARPORT_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.
be9d0411 1574======================= =================================================
1da177e4
LT
1575
1576(Does PARPORT_EPP_FAST make sense for this function?)
1577
1578SEE ALSO
be9d0411 1579^^^^^^^^
1da177e4
LT
1580
1581epp_write_data, epp_read_data, epp_read_addr
be9d0411
MCC
1582
1583
1da177e4
LT
1584\f
1585port->ops->epp_read_addr - read EPP address
be9d0411 1586-------------------------------------------
1da177e4
LT
1587
1588SYNOPSIS
be9d0411 1589^^^^^^^^
1da177e4 1590
be9d0411 1591::
1da177e4 1592
be9d0411
MCC
1593 #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 };
1da177e4
LT
1601
1602DESCRIPTION
be9d0411 1603^^^^^^^^^^^
1da177e4
LT
1604
1605Reads EPP addresses (8 bits each), and returns the number read.
1606
be9d0411 1607The ``flags`` parameter may be one or more of the following,
1da177e4
LT
1608bitwise-or'ed together:
1609
be9d0411 1610======================= =================================================
1da177e4
LT
1611PARPORT_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.
be9d0411 1614======================= =================================================
1da177e4
LT
1615
1616(Does PARPORT_EPP_FAST make sense for this function?)
1617
1618SEE ALSO
be9d0411 1619^^^^^^^^
1da177e4
LT
1620
1621epp_write_data, epp_read_data, epp_write_addr
be9d0411
MCC
1622
1623
1da177e4
LT
1624\f
1625port->ops->ecp_write_data - write a block of ECP data
be9d0411 1626-----------------------------------------------------
1da177e4
LT
1627
1628SYNOPSIS
be9d0411 1629^^^^^^^^
1da177e4 1630
be9d0411 1631::
1da177e4 1632
be9d0411
MCC
1633 #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 };
1da177e4
LT
1641
1642DESCRIPTION
be9d0411 1643^^^^^^^^^^^
1da177e4 1644
be9d0411 1645Writes a block of ECP data. The ``flags`` parameter is ignored.
1da177e4
LT
1646
1647RETURN VALUE
be9d0411 1648^^^^^^^^^^^^
1da177e4
LT
1649
1650The number of bytes written.
1651
1652SEE ALSO
be9d0411 1653^^^^^^^^
1da177e4
LT
1654
1655ecp_read_data, ecp_write_addr
1656\f
be9d0411
MCC
1657
1658
1da177e4 1659port->ops->ecp_read_data - read a block of ECP data
be9d0411 1660---------------------------------------------------
1da177e4
LT
1661
1662SYNOPSIS
be9d0411 1663^^^^^^^^
1da177e4 1664
be9d0411 1665::
1da177e4 1666
be9d0411
MCC
1667 #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 };
1da177e4
LT
1675
1676DESCRIPTION
be9d0411 1677^^^^^^^^^^^
1da177e4 1678
be9d0411 1679Reads a block of ECP data. The ``flags`` parameter is ignored.
1da177e4
LT
1680
1681RETURN VALUE
be9d0411 1682^^^^^^^^^^^^
1da177e4
LT
1683
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
be9d0411 1688^^^^^^^^
1da177e4
LT
1689
1690ecp_write_block, ecp_write_addr
be9d0411
MCC
1691
1692
1693
1da177e4 1694port->ops->ecp_write_addr - write a block of ECP addresses
be9d0411 1695----------------------------------------------------------
1da177e4
LT
1696
1697SYNOPSIS
be9d0411 1698^^^^^^^^
1da177e4 1699
be9d0411 1700::
1da177e4 1701
be9d0411
MCC
1702 #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 };
1da177e4
LT
1710
1711DESCRIPTION
be9d0411 1712^^^^^^^^^^^
1da177e4 1713
be9d0411 1714Writes a block of ECP addresses. The ``flags`` parameter is ignored.
1da177e4
LT
1715
1716RETURN VALUE
be9d0411 1717^^^^^^^^^^^^
1da177e4
LT
1718
1719The number of bytes written.
1720
1721NOTES
be9d0411 1722^^^^^
1da177e4
LT
1723
1724This may use a FIFO, and if so shall not return until the FIFO is empty.
1725
1726SEE ALSO
be9d0411 1727^^^^^^^^
1da177e4
LT
1728
1729ecp_read_data, ecp_write_data
be9d0411
MCC
1730
1731
1732
1da177e4 1733port->ops->nibble_read_data - read a block of data in nibble mode
be9d0411 1734-----------------------------------------------------------------
1da177e4
LT
1735
1736SYNOPSIS
be9d0411 1737^^^^^^^^
1da177e4 1738
be9d0411 1739::
1da177e4 1740
be9d0411
MCC
1741 #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 };
1da177e4
LT
1749
1750DESCRIPTION
be9d0411 1751^^^^^^^^^^^
1da177e4 1752
be9d0411 1753Reads a block of data in nibble mode. The ``flags`` parameter is ignored.
1da177e4
LT
1754
1755RETURN VALUE
be9d0411 1756^^^^^^^^^^^^
1da177e4
LT
1757
1758The number of whole bytes read.
1759
1760SEE ALSO
be9d0411 1761^^^^^^^^
1da177e4
LT
1762
1763byte_read_data, compat_write_data
be9d0411
MCC
1764
1765
1da177e4
LT
1766\f
1767port->ops->byte_read_data - read a block of data in byte mode
be9d0411 1768-------------------------------------------------------------
1da177e4
LT
1769
1770SYNOPSIS
be9d0411 1771^^^^^^^^
1da177e4 1772
be9d0411 1773::
1da177e4 1774
be9d0411
MCC
1775 #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 };
1da177e4
LT
1783
1784DESCRIPTION
be9d0411 1785^^^^^^^^^^^
1da177e4 1786
be9d0411 1787Reads a block of data in byte mode. The ``flags`` parameter is ignored.
1da177e4
LT
1788
1789RETURN VALUE
be9d0411 1790^^^^^^^^^^^^
1da177e4
LT
1791
1792The number of bytes read.
1793
1794SEE ALSO
be9d0411 1795^^^^^^^^
1da177e4
LT
1796
1797nibble_read_data, compat_write_data
be9d0411
MCC
1798
1799
1da177e4
LT
1800\f
1801port->ops->compat_write_data - write a block of data in compatibility mode
be9d0411 1802--------------------------------------------------------------------------
1da177e4
LT
1803
1804SYNOPSIS
be9d0411 1805^^^^^^^^
1da177e4 1806
be9d0411 1807::
1da177e4 1808
be9d0411
MCC
1809 #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 };
1da177e4
LT
1817
1818DESCRIPTION
be9d0411 1819^^^^^^^^^^^
1da177e4 1820
be9d0411 1821Writes a block of data in compatibility mode. The ``flags`` parameter
1da177e4
LT
1822is ignored.
1823
1824RETURN VALUE
be9d0411 1825^^^^^^^^^^^^
1da177e4
LT
1826
1827The number of bytes written.
1828
1829SEE ALSO
be9d0411 1830^^^^^^^^
1da177e4
LT
1831
1832nibble_read_data, byte_read_data