x86: fix compiler warnings in arch/x86/kernel/early-quirks.c
[linux-2.6/cjktty.git] / Documentation / parport-lowlevel.txt
blob265fcdcb8e5f3cdc4a0826697be57ae7ebda3c54
1 PARPORT interface documentation
2 -------------------------------
4 Time-stamp: <2000-02-24 13:30:20 twaugh>
6 Described here are the following functions:
8 Global functions:
9   parport_register_driver
10   parport_unregister_driver
11   parport_enumerate
12   parport_register_device
13   parport_unregister_device
14   parport_claim
15   parport_claim_or_block
16   parport_release
17   parport_yield
18   parport_yield_blocking
19   parport_wait_peripheral
20   parport_poll_peripheral
21   parport_wait_event
22   parport_negotiate
23   parport_read
24   parport_write
25   parport_open
26   parport_close
27   parport_device_id
28   parport_device_coords
29   parport_find_class
30   parport_find_device
31   parport_set_timeout
33 Port functions (can be overridden by low-level drivers):
34   SPP:
35     port->ops->read_data
36     port->ops->write_data
37     port->ops->read_status
38     port->ops->read_control
39     port->ops->write_control
40     port->ops->frob_control
41     port->ops->enable_irq
42     port->ops->disable_irq
43     port->ops->data_forward
44     port->ops->data_reverse
46   EPP:
47     port->ops->epp_write_data
48     port->ops->epp_read_data
49     port->ops->epp_write_addr
50     port->ops->epp_read_addr
52   ECP:
53     port->ops->ecp_write_data
54     port->ops->ecp_read_data
55     port->ops->ecp_write_addr
57   Other:
58     port->ops->nibble_read_data
59     port->ops->byte_read_data
60     port->ops->compat_write_data
62 The parport subsystem comprises 'parport' (the core port-sharing
63 code), and a variety of low-level drivers that actually do the port
64 accesses.  Each low-level driver handles a particular style of port
65 (PC, Amiga, and so on).
67 The parport interface to the device driver author can be broken down
68 into global functions and port functions.
70 The global functions are mostly for communicating between the device
71 driver and the parport subsystem: acquiring a list of available ports,
72 claiming a port for exclusive use, and so on.  They also include
73 'generic' functions for doing standard things that will work on any
74 IEEE 1284-capable architecture.
76 The port functions are provided by the low-level drivers, although the
77 core parport module provides generic 'defaults' for some routines.
78 The port functions can be split into three groups: SPP, EPP, and ECP.
80 SPP (Standard Parallel Port) functions modify so-called 'SPP'
81 registers: data, status, and control.  The hardware may not actually
82 have registers exactly like that, but the PC does and this interface is
83 modelled after common PC implementations.  Other low-level drivers may
84 be able to emulate most of the functionality.
86 EPP (Enhanced Parallel Port) functions are provided for reading and
87 writing in IEEE 1284 EPP mode, and ECP (Extended Capabilities Port)
88 functions are used for IEEE 1284 ECP mode. (What about BECP? Does
89 anyone care?)
91 Hardware assistance for EPP and/or ECP transfers may or may not be
92 available, and if it is available it may or may not be used.  If
93 hardware is not used, the transfer will be software-driven.  In order
94 to cope with peripherals that only tenuously support IEEE 1284, a
95 low-level driver specific function is provided, for altering 'fudge
96 factors'.
98 GLOBAL FUNCTIONS
99 ----------------
101 parport_register_driver - register a device driver with parport
102 -----------------------
104 SYNOPSIS
106 #include <linux/parport.h>
108 struct parport_driver {
109         const char *name;
110         void (*attach) (struct parport *);
111         void (*detach) (struct parport *);
112         struct parport_driver *next;
114 int parport_register_driver (struct parport_driver *driver);
116 DESCRIPTION
118 In order to be notified about parallel ports when they are detected,
119 parport_register_driver should be called.  Your driver will
120 immediately be notified of all ports that have already been detected,
121 and of each new port as low-level drivers are loaded.
123 A 'struct parport_driver' contains the textual name of your driver,
124 a pointer to a function to handle new ports, and a pointer to a
125 function to handle ports going away due to a low-level driver
126 unloading.  Ports will only be detached if they are not being used
127 (i.e. there are no devices registered on them).
129 The visible parts of the 'struct parport *' argument given to
130 attach/detach are:
132 struct parport
134         struct parport *next; /* next parport in list */
135         const char *name;     /* port's name */
136         unsigned int modes;   /* bitfield of hardware modes */
137         struct parport_device_info probe_info;
138                               /* IEEE1284 info */
139         int number;           /* parport index */
140         struct parport_operations *ops;
141         ...
144 There are other members of the structure, but they should not be
145 touched.
147 The 'modes' member summarises the capabilities of the underlying
148 hardware.  It consists of flags which may be bitwise-ored together:
150   PARPORT_MODE_PCSPP            IBM PC registers are available,
151                                 i.e. functions that act on data,
152                                 control and status registers are
153                                 probably writing directly to the
154                                 hardware.
155   PARPORT_MODE_TRISTATE         The data drivers may be turned off.
156                                 This allows the data lines to be used
157                                 for reverse (peripheral to host)
158                                 transfers.
159   PARPORT_MODE_COMPAT           The hardware can assist with
160                                 compatibility-mode (printer)
161                                 transfers, i.e. compat_write_block.
162   PARPORT_MODE_EPP              The hardware can assist with EPP
163                                 transfers.
164   PARPORT_MODE_ECP              The hardware can assist with ECP
165                                 transfers.
166   PARPORT_MODE_DMA              The hardware can use DMA, so you might
167                                 want to pass ISA DMA-able memory
168                                 (i.e. memory allocated using the
169                                 GFP_DMA flag with kmalloc) to the
170                                 low-level driver in order to take
171                                 advantage of it.
173 There may be other flags in 'modes' as well.
175 The contents of 'modes' is advisory only.  For example, if the
176 hardware is capable of DMA, and PARPORT_MODE_DMA is in 'modes', it
177 doesn't necessarily mean that DMA will always be used when possible.
178 Similarly, hardware that is capable of assisting ECP transfers won't
179 necessarily be used.
181 RETURN VALUE
183 Zero on success, otherwise an error code.
185 ERRORS
187 None. (Can it fail? Why return int?)
189 EXAMPLE
191 static void lp_attach (struct parport *port)
193         ...
194         private = kmalloc (...);
195         dev[count++] = parport_register_device (...);
196         ...
199 static void lp_detach (struct parport *port)
201         ...
204 static struct parport_driver lp_driver = {
205         "lp",
206         lp_attach,
207         lp_detach,
208         NULL /* always put NULL here */
211 int lp_init (void)
213         ...
214         if (parport_register_driver (&lp_driver)) {
215                 /* Failed; nothing we can do. */
216                 return -EIO;
217         }
218         ...
221 SEE ALSO
223 parport_unregister_driver, parport_register_device, parport_enumerate
225 parport_unregister_driver - tell parport to forget about this driver
226 -------------------------
228 SYNOPSIS
230 #include <linux/parport.h>
232 struct parport_driver {
233         const char *name;
234         void (*attach) (struct parport *);
235         void (*detach) (struct parport *);
236         struct parport_driver *next;
238 void parport_unregister_driver (struct parport_driver *driver);
240 DESCRIPTION
242 This tells parport not to notify the device driver of new ports or of
243 ports going away.  Registered devices belonging to that driver are NOT
244 unregistered: parport_unregister_device must be used for each one.
246 EXAMPLE
248 void cleanup_module (void)
250         ...
251         /* Stop notifications. */
252         parport_unregister_driver (&lp_driver);
254         /* Unregister devices. */
255         for (i = 0; i < NUM_DEVS; i++)
256                 parport_unregister_device (dev[i]);
257         ...
260 SEE ALSO
262 parport_register_driver, parport_enumerate
264 parport_enumerate - retrieve a list of parallel ports (DEPRECATED)
265 -----------------
267 SYNOPSIS
269 #include <linux/parport.h>
271 struct parport *parport_enumerate (void);
273 DESCRIPTION
275 Retrieve the first of a list of valid parallel ports for this machine.
276 Successive parallel ports can be found using the 'struct parport
277 *next' element of the 'struct parport *' that is returned.  If 'next'
278 is NULL, there are no more parallel ports in the list.  The number of
279 ports in the list will not exceed PARPORT_MAX.
281 RETURN VALUE
283 A 'struct parport *' describing a valid parallel port for the machine,
284 or NULL if there are none.
286 ERRORS
288 This function can return NULL to indicate that there are no parallel
289 ports to use.
291 EXAMPLE
293 int detect_device (void)
295         struct parport *port;
297         for (port = parport_enumerate ();
298              port != NULL;
299              port = port->next) {
300                 /* Try to detect a device on the port... */
301                 ...
302              }
303         }
305         ...
308 NOTES
310 parport_enumerate is deprecated; parport_register_driver should be
311 used instead.
313 SEE ALSO
315 parport_register_driver, parport_unregister_driver
317 parport_register_device - register to use a port
318 -----------------------
320 SYNOPSIS
322 #include <linux/parport.h>
324 typedef int (*preempt_func) (void *handle);
325 typedef void (*wakeup_func) (void *handle);
326 typedef int (*irq_func) (int irq, void *handle, struct pt_regs *);
328 struct pardevice *parport_register_device(struct parport *port,
329                                           const char *name,
330                                           preempt_func preempt,
331                                           wakeup_func wakeup,
332                                           irq_func irq,
333                                           int flags,
334                                           void *handle);
336 DESCRIPTION
338 Use this function to register your device driver on a parallel port
339 ('port').  Once you have done that, you will be able to use
340 parport_claim and parport_release in order to use the port.
342 This function will register three callbacks into your driver:
343 'preempt', 'wakeup' and 'irq'.  Each of these may be NULL in order to
344 indicate that you do not want a callback.
346 When the 'preempt' function is called, it is because another driver
347 wishes to use the parallel port.  The 'preempt' function should return
348 non-zero if the parallel port cannot be released yet -- if zero is
349 returned, the port is lost to another driver and the port must be
350 re-claimed before use.
352 The 'wakeup' function is called once another driver has released the
353 port and no other driver has yet claimed it.  You can claim the
354 parallel port from within the 'wakeup' function (in which case the
355 claim is guaranteed to succeed), or choose not to if you don't need it
356 now.
358 If an interrupt occurs on the parallel port your driver has claimed,
359 the 'irq' function will be called. (Write something about shared
360 interrupts here.)
362 The 'handle' is a pointer to driver-specific data, and is passed to
363 the callback functions.
365 'flags' may be a bitwise combination of the following flags:
367         Flag            Meaning
368   PARPORT_DEV_EXCL      The device cannot share the parallel port at all.
369                         Use this only when absolutely necessary.
371 The typedefs are not actually defined -- they are only shown in order
372 to make the function prototype more readable.
374 The visible parts of the returned 'struct pardevice' are:
376 struct pardevice {
377         struct parport *port;   /* Associated port */
378         void *private;          /* Device driver's 'handle' */
379         ...
382 RETURN VALUE
384 A 'struct pardevice *': a handle to the registered parallel port
385 device that can be used for parport_claim, parport_release, etc.
387 ERRORS
389 A return value of NULL indicates that there was a problem registering
390 a device on that port.
392 EXAMPLE
394 static int preempt (void *handle)
396         if (busy_right_now)
397                 return 1;
399         must_reclaim_port = 1;
400         return 0;
403 static void wakeup (void *handle)
405         struct toaster *private = handle;
406         struct pardevice *dev = private->dev;
407         if (!dev) return; /* avoid races */
409         if (want_port)
410                 parport_claim (dev);
413 static int toaster_detect (struct toaster *private, struct parport *port)
415         private->dev = parport_register_device (port, "toaster", preempt,
416                                                 wakeup, NULL, 0,
417                                                 private);
418         if (!private->dev)
419                 /* Couldn't register with parport. */
420                 return -EIO;
422         must_reclaim_port = 0;
423         busy_right_now = 1;
424         parport_claim_or_block (private->dev);
425         ...
426         /* Don't need the port while the toaster warms up. */
427         busy_right_now = 0;
428         ...
429         busy_right_now = 1;
430         if (must_reclaim_port) {
431                 parport_claim_or_block (private->dev);
432                 must_reclaim_port = 0;
433         }
434         ...
437 SEE ALSO
439 parport_unregister_device, parport_claim
441 parport_unregister_device - finish using a port
442 -------------------------
444 SYNPOPSIS
446 #include <linux/parport.h>
448 void parport_unregister_device (struct pardevice *dev);
450 DESCRIPTION
452 This function is the opposite of parport_register_device.  After using
453 parport_unregister_device, 'dev' is no longer a valid device handle.
455 You should not unregister a device that is currently claimed, although
456 if you do it will be released automatically.
458 EXAMPLE
460         ...
461         kfree (dev->private); /* before we lose the pointer */
462         parport_unregister_device (dev);
463         ...
465 SEE ALSO
467 parport_unregister_driver
469 parport_claim, parport_claim_or_block - claim the parallel port for a device
470 -------------------------------------
472 SYNOPSIS
474 #include <linux/parport.h>
476 int parport_claim (struct pardevice *dev);
477 int parport_claim_or_block (struct pardevice *dev);
479 DESCRIPTION
481 These functions attempt to gain control of the parallel port on which
482 'dev' is registered.  'parport_claim' does not block, but
483 'parport_claim_or_block' may do. (Put something here about blocking
484 interruptibly or non-interruptibly.)
486 You should not try to claim a port that you have already claimed.
488 RETURN VALUE
490 A return value of zero indicates that the port was successfully
491 claimed, and the caller now has possession of the parallel port.
493 If 'parport_claim_or_block' blocks before returning successfully, the
494 return value is positive.
496 ERRORS
498   -EAGAIN  The port is unavailable at the moment, but another attempt
499            to claim it may succeed.
501 SEE ALSO
503 parport_release
505 parport_release - release the parallel port
506 ---------------
508 SYNOPSIS
510 #include <linux/parport.h>
512 void parport_release (struct pardevice *dev);
514 DESCRIPTION
516 Once a parallel port device has been claimed, it can be released using
517 'parport_release'.  It cannot fail, but you should not release a
518 device that you do not have possession of.
520 EXAMPLE
522 static size_t write (struct pardevice *dev, const void *buf,
523                      size_t len)
525         ...
526         written = dev->port->ops->write_ecp_data (dev->port, buf,
527                                                   len);
528         parport_release (dev);
529         ...
533 SEE ALSO
535 change_mode, parport_claim, parport_claim_or_block, parport_yield
537 parport_yield, parport_yield_blocking - temporarily release a parallel port
538 -------------------------------------
540 SYNOPSIS
542 #include <linux/parport.h>
544 int parport_yield (struct pardevice *dev)
545 int parport_yield_blocking (struct pardevice *dev);
547 DESCRIPTION
549 When a driver has control of a parallel port, it may allow another
550 driver to temporarily 'borrow' it.  'parport_yield' does not block;
551 'parport_yield_blocking' may do.
553 RETURN VALUE
555 A return value of zero indicates that the caller still owns the port
556 and the call did not block.
558 A positive return value from 'parport_yield_blocking' indicates that
559 the caller still owns the port and the call blocked.
561 A return value of -EAGAIN indicates that the caller no longer owns the
562 port, and it must be re-claimed before use.
564 ERRORS
566   -EAGAIN  Ownership of the parallel port was given away.
568 SEE ALSO
570 parport_release
572 parport_wait_peripheral - wait for status lines, up to 35ms
573 -----------------------
575 SYNOPSIS
577 #include <linux/parport.h>
579 int parport_wait_peripheral (struct parport *port,
580                              unsigned char mask,
581                              unsigned char val);
583 DESCRIPTION
585 Wait for the status lines in mask to match the values in val.
587 RETURN VALUE
589  -EINTR  a signal is pending
590       0  the status lines in mask have values in val
591       1  timed out while waiting (35ms elapsed)
593 SEE ALSO
595 parport_poll_peripheral
597 parport_poll_peripheral - wait for status lines, in usec
598 -----------------------
600 SYNOPSIS
602 #include <linux/parport.h>
604 int parport_poll_peripheral (struct parport *port,
605                              unsigned char mask,
606                              unsigned char val,
607                              int usec);
609 DESCRIPTION
611 Wait for the status lines in mask to match the values in val.
613 RETURN VALUE
615  -EINTR  a signal is pending
616       0  the status lines in mask have values in val
617       1  timed out while waiting (usec microseconds have elapsed)
619 SEE ALSO
621 parport_wait_peripheral
623 parport_wait_event - wait for an event on a port
624 ------------------
626 SYNOPSIS
628 #include <linux/parport.h>
630 int parport_wait_event (struct parport *port, signed long timeout)
632 DESCRIPTION
634 Wait for an event (e.g. interrupt) on a port.  The timeout is in
635 jiffies.
637 RETURN VALUE
639       0  success
640      <0  error (exit as soon as possible)
641      >0  timed out
643 parport_negotiate - perform IEEE 1284 negotiation
644 -----------------
646 SYNOPSIS
648 #include <linux/parport.h>
650 int parport_negotiate (struct parport *, int mode);
652 DESCRIPTION
654 Perform IEEE 1284 negotiation.
656 RETURN VALUE
658      0  handshake OK; IEEE 1284 peripheral and mode available
659     -1  handshake failed; peripheral not compliant (or none present)
660      1  handshake OK; IEEE 1284 peripheral present but mode not
661         available
663 SEE ALSO
665 parport_read, parport_write
667 parport_read - read data from device
668 ------------
670 SYNOPSIS
672 #include <linux/parport.h>
674 ssize_t parport_read (struct parport *, void *buf, size_t len);
676 DESCRIPTION
678 Read data from device in current IEEE 1284 transfer mode.  This only
679 works for modes that support reverse data transfer.
681 RETURN VALUE
683 If negative, an error code; otherwise the number of bytes transferred.
685 SEE ALSO
687 parport_write, parport_negotiate
689 parport_write - write data to device
690 -------------
692 SYNOPSIS
694 #include <linux/parport.h>
696 ssize_t parport_write (struct parport *, const void *buf, size_t len);
698 DESCRIPTION
700 Write data to device in current IEEE 1284 transfer mode.  This only
701 works for modes that support forward data transfer.
703 RETURN VALUE
705 If negative, an error code; otherwise the number of bytes transferred.
707 SEE ALSO
709 parport_read, parport_negotiate
711 parport_open - register device for particular device number
712 ------------
714 SYNOPSIS
716 #include <linux/parport.h>
718 struct pardevice *parport_open (int devnum, const char *name,
719                                 int (*pf) (void *),
720                                 void (*kf) (void *),
721                                 void (*irqf) (int, void *,
722                                               struct pt_regs *),
723                                 int flags, void *handle);
725 DESCRIPTION
727 This is like parport_register_device but takes a device number instead
728 of a pointer to a struct parport.
730 RETURN VALUE
732 See parport_register_device.  If no device is associated with devnum,
733 NULL is returned.
735 SEE ALSO
737 parport_register_device
739 parport_close - unregister device for particular device number
740 -------------
742 SYNOPSIS
744 #include <linux/parport.h>
746 void parport_close (struct pardevice *dev);
748 DESCRIPTION
750 This is the equivalent of parport_unregister_device for parport_open.
752 SEE ALSO
754 parport_unregister_device, parport_open
756 parport_device_id - obtain IEEE 1284 Device ID
757 -----------------
759 SYNOPSIS
761 #include <linux/parport.h>
763 ssize_t parport_device_id (int devnum, char *buffer, size_t len);
765 DESCRIPTION
767 Obtains the IEEE 1284 Device ID associated with a given device.
769 RETURN VALUE
771 If negative, an error code; otherwise, the number of bytes of buffer
772 that contain the device ID.  The format of the device ID is as
773 follows:
775 [length][ID]
777 The first two bytes indicate the inclusive length of the entire Device
778 ID, and are in big-endian order.  The ID is a sequence of pairs of the
779 form:
781 key:value;
783 NOTES
785 Many devices have ill-formed IEEE 1284 Device IDs.
787 SEE ALSO
789 parport_find_class, parport_find_device
791 parport_device_coords - convert device number to device coordinates
792 ------------------
794 SYNOPSIS
796 #include <linux/parport.h>
798 int parport_device_coords (int devnum, int *parport, int *mux,
799                            int *daisy);
801 DESCRIPTION
803 Convert between device number (zero-based) and device coordinates
804 (port, multiplexor, daisy chain address).
806 RETURN VALUE
808 Zero on success, in which case the coordinates are (*parport, *mux,
809 *daisy).
811 SEE ALSO
813 parport_open, parport_device_id
815 parport_find_class - find a device by its class
816 ------------------
818 SYNOPSIS
820 #include <linux/parport.h>
822 typedef enum {
823         PARPORT_CLASS_LEGACY = 0,       /* Non-IEEE1284 device */
824         PARPORT_CLASS_PRINTER,
825         PARPORT_CLASS_MODEM,
826         PARPORT_CLASS_NET,
827         PARPORT_CLASS_HDC,              /* Hard disk controller */
828         PARPORT_CLASS_PCMCIA,
829         PARPORT_CLASS_MEDIA,            /* Multimedia device */
830         PARPORT_CLASS_FDC,              /* Floppy disk controller */
831         PARPORT_CLASS_PORTS,
832         PARPORT_CLASS_SCANNER,
833         PARPORT_CLASS_DIGCAM,
834         PARPORT_CLASS_OTHER,            /* Anything else */
835         PARPORT_CLASS_UNSPEC,           /* No CLS field in ID */
836         PARPORT_CLASS_SCSIADAPTER
837 } parport_device_class;
839 int parport_find_class (parport_device_class cls, int from);
841 DESCRIPTION
843 Find a device by class.  The search starts from device number from+1.
845 RETURN VALUE
847 The device number of the next device in that class, or -1 if no such
848 device exists.
850 NOTES
852 Example usage:
854 int devnum = -1;
855 while ((devnum = parport_find_class (PARPORT_CLASS_DIGCAM, devnum)) != -1) {
856     struct pardevice *dev = parport_open (devnum, ...);
857     ...
860 SEE ALSO
862 parport_find_device, parport_open, parport_device_id
864 parport_find_device - find a device by its class
865 ------------------
867 SYNOPSIS
869 #include <linux/parport.h>
871 int parport_find_device (const char *mfg, const char *mdl, int from);
873 DESCRIPTION
875 Find a device by vendor and model.  The search starts from device
876 number from+1.
878 RETURN VALUE
880 The device number of the next device matching the specifications, or
881 -1 if no such device exists.
883 NOTES
885 Example usage:
887 int devnum = -1;
888 while ((devnum = parport_find_device ("IOMEGA", "ZIP+", devnum)) != -1) {
889     struct pardevice *dev = parport_open (devnum, ...);
890     ...
893 SEE ALSO
895 parport_find_class, parport_open, parport_device_id
897 parport_set_timeout - set the inactivity timeout
898 -------------------
900 SYNOPSIS
902 #include <linux/parport.h>
904 long parport_set_timeout (struct pardevice *dev, long inactivity);
906 DESCRIPTION
908 Set the inactivity timeout, in jiffies, for a registered device.  The
909 previous timeout is returned.
911 RETURN VALUE
913 The previous timeout, in jiffies.
915 NOTES
917 Some of the port->ops functions for a parport may take time, owing to
918 delays at the peripheral.  After the peripheral has not responded for
919 'inactivity' jiffies, a timeout will occur and the blocking function
920 will return.
922 A timeout of 0 jiffies is a special case: the function must do as much
923 as it can without blocking or leaving the hardware in an unknown
924 state.  If port operations are performed from within an interrupt
925 handler, for instance, a timeout of 0 jiffies should be used.
927 Once set for a registered device, the timeout will remain at the set
928 value until set again.
930 SEE ALSO
932 port->ops->xxx_read/write_yyy
934 PORT FUNCTIONS
935 --------------
937 The functions in the port->ops structure (struct parport_operations)
938 are provided by the low-level driver responsible for that port.
940 port->ops->read_data - read the data register
941 --------------------
943 SYNOPSIS
945 #include <linux/parport.h>
947 struct parport_operations {
948         ...
949         unsigned char (*read_data) (struct parport *port);
950         ...
953 DESCRIPTION
955 If port->modes contains the PARPORT_MODE_TRISTATE flag and the
956 PARPORT_CONTROL_DIRECTION bit in the control register is set, this
957 returns the value on the data pins.  If port->modes contains the
958 PARPORT_MODE_TRISTATE flag and the PARPORT_CONTROL_DIRECTION bit is
959 not set, the return value _may_ be the last value written to the data
960 register.  Otherwise the return value is undefined.
962 SEE ALSO
964 write_data, read_status, write_control
966 port->ops->write_data - write the data register
967 ---------------------
969 SYNOPSIS
971 #include <linux/parport.h>
973 struct parport_operations {
974         ...
975         void (*write_data) (struct parport *port, unsigned char d);
976         ...
979 DESCRIPTION
981 Writes to the data register.  May have side-effects (a STROBE pulse,
982 for instance).
984 SEE ALSO
986 read_data, read_status, write_control
988 port->ops->read_status - read the status register
989 ----------------------
991 SYNOPSIS
993 #include <linux/parport.h>
995 struct parport_operations {
996         ...
997         unsigned char (*read_status) (struct parport *port);
998         ...
1001 DESCRIPTION
1003 Reads from the status register.  This is a bitmask:
1005 - PARPORT_STATUS_ERROR (printer fault, "nFault")
1006 - PARPORT_STATUS_SELECT (on-line, "Select")
1007 - PARPORT_STATUS_PAPEROUT (no paper, "PError")
1008 - PARPORT_STATUS_ACK (handshake, "nAck")
1009 - PARPORT_STATUS_BUSY (busy, "Busy")
1011 There may be other bits set.
1013 SEE ALSO
1015 read_data, write_data, write_control
1017 port->ops->read_control - read the control register
1018 -----------------------
1020 SYNOPSIS
1022 #include <linux/parport.h>
1024 struct parport_operations {
1025         ...
1026         unsigned char (*read_control) (struct parport *port);
1027         ...
1030 DESCRIPTION
1032 Returns the last value written to the control register (either from
1033 write_control or frob_control).  No port access is performed.
1035 SEE ALSO
1037 read_data, write_data, read_status, write_control
1039 port->ops->write_control - write the control register
1040 ------------------------
1042 SYNOPSIS
1044 #include <linux/parport.h>
1046 struct parport_operations {
1047         ...
1048         void (*write_control) (struct parport *port, unsigned char s);
1049         ...
1052 DESCRIPTION
1054 Writes to the control register. This is a bitmask:
1055                           _______
1056 - PARPORT_CONTROL_STROBE (nStrobe)
1057                           _______
1058 - PARPORT_CONTROL_AUTOFD (nAutoFd)
1059                         _____
1060 - PARPORT_CONTROL_INIT (nInit)
1061                           _________
1062 - PARPORT_CONTROL_SELECT (nSelectIn)
1064 SEE ALSO
1066 read_data, write_data, read_status, frob_control
1068 port->ops->frob_control - write control register bits
1069 -----------------------
1071 SYNOPSIS
1073 #include <linux/parport.h>
1075 struct parport_operations {
1076         ...
1077         unsigned char (*frob_control) (struct parport *port,
1078                                        unsigned char mask,
1079                                        unsigned char val);
1080         ...
1083 DESCRIPTION
1085 This is equivalent to reading from the control register, masking out
1086 the bits in mask, exclusive-or'ing with the bits in val, and writing
1087 the result to the control register.
1089 As some ports don't allow reads from the control port, a software copy
1090 of its contents is maintained, so frob_control is in fact only one
1091 port access.
1093 SEE ALSO
1095 read_data, write_data, read_status, write_control
1097 port->ops->enable_irq - enable interrupt generation
1098 ---------------------
1100 SYNOPSIS
1102 #include <linux/parport.h>
1104 struct parport_operations {
1105         ...
1106         void (*enable_irq) (struct parport *port);
1107         ...
1110 DESCRIPTION
1112 The parallel port hardware is instructed to generate interrupts at
1113 appropriate moments, although those moments are
1114 architecture-specific.  For the PC architecture, interrupts are
1115 commonly generated on the rising edge of nAck.
1117 SEE ALSO
1119 disable_irq
1121 port->ops->disable_irq - disable interrupt generation
1122 ----------------------
1124 SYNOPSIS
1126 #include <linux/parport.h>
1128 struct parport_operations {
1129         ...
1130         void (*disable_irq) (struct parport *port);
1131         ...
1134 DESCRIPTION
1136 The parallel port hardware is instructed not to generate interrupts.
1137 The interrupt itself is not masked.
1139 SEE ALSO
1141 enable_irq
1143 port->ops->data_forward - enable data drivers
1144 -----------------------
1146 SYNOPSIS
1148 #include <linux/parport.h>
1150 struct parport_operations {
1151         ...
1152         void (*data_forward) (struct parport *port);
1153         ...
1156 DESCRIPTION
1158 Enables the data line drivers, for 8-bit host-to-peripheral
1159 communications.
1161 SEE ALSO
1163 data_reverse
1165 port->ops->data_reverse - tristate the buffer
1166 -----------------------
1168 SYNOPSIS
1170 #include <linux/parport.h>
1172 struct parport_operations {
1173         ...
1174         void (*data_reverse) (struct parport *port);
1175         ...
1178 DESCRIPTION
1180 Places the data bus in a high impedance state, if port->modes has the
1181 PARPORT_MODE_TRISTATE bit set.
1183 SEE ALSO
1185 data_forward
1187 port->ops->epp_write_data - write EPP data
1188 -------------------------
1190 SYNOPSIS
1192 #include <linux/parport.h>
1194 struct parport_operations {
1195         ...
1196         size_t (*epp_write_data) (struct parport *port, const void *buf,
1197                                   size_t len, int flags);
1198         ...
1201 DESCRIPTION
1203 Writes data in EPP mode, and returns the number of bytes written.
1205 The 'flags' parameter may be one or more of the following,
1206 bitwise-or'ed together:
1208 PARPORT_EPP_FAST        Use fast transfers. Some chips provide 16-bit and
1209                         32-bit registers.  However, if a transfer
1210                         times out, the return value may be unreliable.
1212 SEE ALSO
1214 epp_read_data, epp_write_addr, epp_read_addr
1216 port->ops->epp_read_data - read EPP data
1217 ------------------------
1219 SYNOPSIS
1221 #include <linux/parport.h>
1223 struct parport_operations {
1224         ...
1225         size_t (*epp_read_data) (struct parport *port, void *buf,
1226                                  size_t len, int flags);
1227         ...
1230 DESCRIPTION
1232 Reads data in EPP mode, and returns the number of bytes read.
1234 The 'flags' parameter may be one or more of the following,
1235 bitwise-or'ed together:
1237 PARPORT_EPP_FAST        Use fast transfers. Some chips provide 16-bit and
1238                         32-bit registers.  However, if a transfer
1239                         times out, the return value may be unreliable.
1241 SEE ALSO
1243 epp_write_data, epp_write_addr, epp_read_addr
1245 port->ops->epp_write_addr - write EPP address
1246 -------------------------
1248 SYNOPSIS
1250 #include <linux/parport.h>
1252 struct parport_operations {
1253         ...
1254         size_t (*epp_write_addr) (struct parport *port,
1255                                   const void *buf, size_t len, int flags);
1256         ...
1259 DESCRIPTION
1261 Writes EPP addresses (8 bits each), and returns the number written.
1263 The 'flags' parameter may be one or more of the following,
1264 bitwise-or'ed together:
1266 PARPORT_EPP_FAST        Use fast transfers. Some chips provide 16-bit and
1267                         32-bit registers.  However, if a transfer
1268                         times out, the return value may be unreliable.
1270 (Does PARPORT_EPP_FAST make sense for this function?)
1272 SEE ALSO
1274 epp_write_data, epp_read_data, epp_read_addr
1276 port->ops->epp_read_addr - read EPP address
1277 ------------------------
1279 SYNOPSIS
1281 #include <linux/parport.h>
1283 struct parport_operations {
1284         ...
1285         size_t (*epp_read_addr) (struct parport *port, void *buf,
1286                                  size_t len, int flags);
1287         ...
1290 DESCRIPTION
1292 Reads EPP addresses (8 bits each), and returns the number read.
1294 The 'flags' parameter may be one or more of the following,
1295 bitwise-or'ed together:
1297 PARPORT_EPP_FAST        Use fast transfers. Some chips provide 16-bit and
1298                         32-bit registers.  However, if a transfer
1299                         times out, the return value may be unreliable.
1301 (Does PARPORT_EPP_FAST make sense for this function?)
1303 SEE ALSO
1305 epp_write_data, epp_read_data, epp_write_addr
1307 port->ops->ecp_write_data - write a block of ECP data
1308 -------------------------
1310 SYNOPSIS
1312 #include <linux/parport.h>
1314 struct parport_operations {
1315         ...
1316         size_t (*ecp_write_data) (struct parport *port,
1317                                   const void *buf, size_t len, int flags);
1318         ...
1321 DESCRIPTION
1323 Writes a block of ECP data.  The 'flags' parameter is ignored.
1325 RETURN VALUE
1327 The number of bytes written.
1329 SEE ALSO
1331 ecp_read_data, ecp_write_addr
1333 port->ops->ecp_read_data - read a block of ECP data
1334 ------------------------
1336 SYNOPSIS
1338 #include <linux/parport.h>
1340 struct parport_operations {
1341         ...
1342         size_t (*ecp_read_data) (struct parport *port,
1343                                  void *buf, size_t len, int flags);
1344         ...
1347 DESCRIPTION
1349 Reads a block of ECP data.  The 'flags' parameter is ignored.
1351 RETURN VALUE
1353 The number of bytes read.  NB. There may be more unread data in a
1354 FIFO.  Is there a way of stunning the FIFO to prevent this?
1356 SEE ALSO
1358 ecp_write_block, ecp_write_addr
1360 port->ops->ecp_write_addr - write a block of ECP addresses
1361 -------------------------
1363 SYNOPSIS
1365 #include <linux/parport.h>
1367 struct parport_operations {
1368         ...
1369         size_t (*ecp_write_addr) (struct parport *port,
1370                                   const void *buf, size_t len, int flags);
1371         ...
1374 DESCRIPTION
1376 Writes a block of ECP addresses.  The 'flags' parameter is ignored.
1378 RETURN VALUE
1380 The number of bytes written.
1382 NOTES
1384 This may use a FIFO, and if so shall not return until the FIFO is empty.
1386 SEE ALSO
1388 ecp_read_data, ecp_write_data
1390 port->ops->nibble_read_data - read a block of data in nibble mode
1391 ---------------------------
1393 SYNOPSIS
1395 #include <linux/parport.h>
1397 struct parport_operations {
1398         ...
1399         size_t (*nibble_read_data) (struct parport *port,
1400                                     void *buf, size_t len, int flags);
1401         ...
1404 DESCRIPTION
1406 Reads a block of data in nibble mode.  The 'flags' parameter is ignored.
1408 RETURN VALUE
1410 The number of whole bytes read.
1412 SEE ALSO
1414 byte_read_data, compat_write_data
1416 port->ops->byte_read_data - read a block of data in byte mode
1417 -------------------------
1419 SYNOPSIS
1421 #include <linux/parport.h>
1423 struct parport_operations {
1424         ...
1425         size_t (*byte_read_data) (struct parport *port,
1426                                   void *buf, size_t len, int flags);
1427         ...
1430 DESCRIPTION
1432 Reads a block of data in byte mode.  The 'flags' parameter is ignored.
1434 RETURN VALUE
1436 The number of bytes read.
1438 SEE ALSO
1440 nibble_read_data, compat_write_data
1442 port->ops->compat_write_data - write a block of data in compatibility mode
1443 ----------------------------
1445 SYNOPSIS
1447 #include <linux/parport.h>
1449 struct parport_operations {
1450         ...
1451         size_t (*compat_write_data) (struct parport *port,
1452                                      const void *buf, size_t len, int flags);
1453         ...
1456 DESCRIPTION
1458 Writes a block of data in compatibility mode.  The 'flags' parameter
1459 is ignored.
1461 RETURN VALUE
1463 The number of bytes written.
1465 SEE ALSO
1467 nibble_read_data, byte_read_data