Back to home page

LXR

 
 

    


0001 PARPORT interface documentation
0002 -------------------------------
0003 
0004 Time-stamp: <2000-02-24 13:30:20 twaugh>
0005 
0006 Described here are the following functions:
0007 
0008 Global functions:
0009   parport_register_driver
0010   parport_unregister_driver
0011   parport_enumerate
0012   parport_register_device
0013   parport_unregister_device
0014   parport_claim
0015   parport_claim_or_block
0016   parport_release
0017   parport_yield
0018   parport_yield_blocking
0019   parport_wait_peripheral
0020   parport_poll_peripheral
0021   parport_wait_event
0022   parport_negotiate
0023   parport_read
0024   parport_write
0025   parport_open
0026   parport_close
0027   parport_device_id
0028   parport_device_coords
0029   parport_find_class
0030   parport_find_device
0031   parport_set_timeout
0032 
0033 Port functions (can be overridden by low-level drivers):
0034   SPP:
0035     port->ops->read_data
0036     port->ops->write_data
0037     port->ops->read_status
0038     port->ops->read_control
0039     port->ops->write_control
0040     port->ops->frob_control
0041     port->ops->enable_irq
0042     port->ops->disable_irq
0043     port->ops->data_forward
0044     port->ops->data_reverse
0045 
0046   EPP:
0047     port->ops->epp_write_data
0048     port->ops->epp_read_data
0049     port->ops->epp_write_addr
0050     port->ops->epp_read_addr
0051 
0052   ECP:
0053     port->ops->ecp_write_data
0054     port->ops->ecp_read_data
0055     port->ops->ecp_write_addr
0056 
0057   Other:
0058     port->ops->nibble_read_data
0059     port->ops->byte_read_data
0060     port->ops->compat_write_data
0061 
0062 The parport subsystem comprises 'parport' (the core port-sharing
0063 code), and a variety of low-level drivers that actually do the port
0064 accesses.  Each low-level driver handles a particular style of port
0065 (PC, Amiga, and so on).
0066 
0067 The parport interface to the device driver author can be broken down
0068 into global functions and port functions.
0069 
0070 The global functions are mostly for communicating between the device
0071 driver and the parport subsystem: acquiring a list of available ports,
0072 claiming a port for exclusive use, and so on.  They also include
0073 'generic' functions for doing standard things that will work on any
0074 IEEE 1284-capable architecture.
0075 
0076 The port functions are provided by the low-level drivers, although the
0077 core parport module provides generic 'defaults' for some routines.
0078 The port functions can be split into three groups: SPP, EPP, and ECP.
0079 
0080 SPP (Standard Parallel Port) functions modify so-called 'SPP'
0081 registers: data, status, and control.  The hardware may not actually
0082 have registers exactly like that, but the PC does and this interface is
0083 modelled after common PC implementations.  Other low-level drivers may
0084 be able to emulate most of the functionality.
0085 
0086 EPP (Enhanced Parallel Port) functions are provided for reading and
0087 writing in IEEE 1284 EPP mode, and ECP (Extended Capabilities Port)
0088 functions are used for IEEE 1284 ECP mode. (What about BECP? Does
0089 anyone care?)
0090 
0091 Hardware assistance for EPP and/or ECP transfers may or may not be
0092 available, and if it is available it may or may not be used.  If
0093 hardware is not used, the transfer will be software-driven.  In order
0094 to cope with peripherals that only tenuously support IEEE 1284, a
0095 low-level driver specific function is provided, for altering 'fudge
0096 factors'.
0097 
0098 GLOBAL FUNCTIONS
0099 ----------------
0100 
0101 parport_register_driver - register a device driver with parport
0102 -----------------------
0103 
0104 SYNOPSIS
0105 
0106 #include <linux/parport.h>
0107 
0108 struct parport_driver {
0109         const char *name;
0110         void (*attach) (struct parport *);
0111         void (*detach) (struct parport *);
0112         struct parport_driver *next;
0113 };
0114 int parport_register_driver (struct parport_driver *driver);
0115 
0116 DESCRIPTION
0117 
0118 In order to be notified about parallel ports when they are detected,
0119 parport_register_driver should be called.  Your driver will
0120 immediately be notified of all ports that have already been detected,
0121 and of each new port as low-level drivers are loaded.
0122 
0123 A 'struct parport_driver' contains the textual name of your driver,
0124 a pointer to a function to handle new ports, and a pointer to a
0125 function to handle ports going away due to a low-level driver
0126 unloading.  Ports will only be detached if they are not being used
0127 (i.e. there are no devices registered on them).
0128 
0129 The visible parts of the 'struct parport *' argument given to
0130 attach/detach are:
0131 
0132 struct parport
0133 {
0134         struct parport *next; /* next parport in list */
0135         const char *name;     /* port's name */
0136         unsigned int modes;   /* bitfield of hardware modes */
0137         struct parport_device_info probe_info;
0138                               /* IEEE1284 info */
0139         int number;           /* parport index */
0140         struct parport_operations *ops;
0141         ...
0142 };
0143 
0144 There are other members of the structure, but they should not be
0145 touched.
0146 
0147 The 'modes' member summarises the capabilities of the underlying
0148 hardware.  It consists of flags which may be bitwise-ored together:
0149 
0150   PARPORT_MODE_PCSPP            IBM PC registers are available,
0151                                 i.e. functions that act on data,
0152                                 control and status registers are
0153                                 probably writing directly to the
0154                                 hardware.
0155   PARPORT_MODE_TRISTATE         The data drivers may be turned off.
0156                                 This allows the data lines to be used
0157                                 for reverse (peripheral to host)
0158                                 transfers.
0159   PARPORT_MODE_COMPAT           The hardware can assist with
0160                                 compatibility-mode (printer)
0161                                 transfers, i.e. compat_write_block.
0162   PARPORT_MODE_EPP              The hardware can assist with EPP
0163                                 transfers.
0164   PARPORT_MODE_ECP              The hardware can assist with ECP
0165                                 transfers.
0166   PARPORT_MODE_DMA              The hardware can use DMA, so you might
0167                                 want to pass ISA DMA-able memory
0168                                 (i.e. memory allocated using the
0169                                 GFP_DMA flag with kmalloc) to the
0170                                 low-level driver in order to take
0171                                 advantage of it.
0172 
0173 There may be other flags in 'modes' as well.
0174 
0175 The contents of 'modes' is advisory only.  For example, if the
0176 hardware is capable of DMA, and PARPORT_MODE_DMA is in 'modes', it
0177 doesn't necessarily mean that DMA will always be used when possible.
0178 Similarly, hardware that is capable of assisting ECP transfers won't
0179 necessarily be used.
0180 
0181 RETURN VALUE
0182 
0183 Zero on success, otherwise an error code.
0184 
0185 ERRORS
0186 
0187 None. (Can it fail? Why return int?)
0188 
0189 EXAMPLE
0190 
0191 static void lp_attach (struct parport *port)
0192 {
0193         ...
0194         private = kmalloc (...);
0195         dev[count++] = parport_register_device (...);
0196         ...
0197 }
0198 
0199 static void lp_detach (struct parport *port)
0200 {
0201         ...
0202 }
0203 
0204 static struct parport_driver lp_driver = {
0205         "lp",
0206         lp_attach,
0207         lp_detach,
0208         NULL /* always put NULL here */
0209 };
0210 
0211 int lp_init (void)
0212 {
0213         ...
0214         if (parport_register_driver (&lp_driver)) {
0215                 /* Failed; nothing we can do. */
0216                 return -EIO;
0217         }
0218         ...
0219 }
0220 
0221 SEE ALSO
0222 
0223 parport_unregister_driver, parport_register_device, parport_enumerate
0224 
0225 parport_unregister_driver - tell parport to forget about this driver
0226 -------------------------
0227 
0228 SYNOPSIS
0229 
0230 #include <linux/parport.h>
0231 
0232 struct parport_driver {
0233         const char *name;
0234         void (*attach) (struct parport *);
0235         void (*detach) (struct parport *);
0236         struct parport_driver *next;
0237 };
0238 void parport_unregister_driver (struct parport_driver *driver);
0239 
0240 DESCRIPTION
0241 
0242 This tells parport not to notify the device driver of new ports or of
0243 ports going away.  Registered devices belonging to that driver are NOT
0244 unregistered: parport_unregister_device must be used for each one.
0245 
0246 EXAMPLE
0247 
0248 void cleanup_module (void)
0249 {
0250         ...
0251         /* Stop notifications. */
0252         parport_unregister_driver (&lp_driver);
0253 
0254         /* Unregister devices. */
0255         for (i = 0; i < NUM_DEVS; i++)
0256                 parport_unregister_device (dev[i]);
0257         ...
0258 }
0259 
0260 SEE ALSO
0261 
0262 parport_register_driver, parport_enumerate
0263 
0264 parport_enumerate - retrieve a list of parallel ports (DEPRECATED)
0265 -----------------
0266 
0267 SYNOPSIS
0268 
0269 #include <linux/parport.h>
0270 
0271 struct parport *parport_enumerate (void);
0272 
0273 DESCRIPTION
0274 
0275 Retrieve the first of a list of valid parallel ports for this machine.
0276 Successive parallel ports can be found using the 'struct parport
0277 *next' element of the 'struct parport *' that is returned.  If 'next'
0278 is NULL, there are no more parallel ports in the list.  The number of
0279 ports in the list will not exceed PARPORT_MAX.
0280 
0281 RETURN VALUE
0282 
0283 A 'struct parport *' describing a valid parallel port for the machine,
0284 or NULL if there are none.
0285 
0286 ERRORS
0287 
0288 This function can return NULL to indicate that there are no parallel
0289 ports to use.
0290 
0291 EXAMPLE
0292 
0293 int detect_device (void)
0294 {
0295         struct parport *port;
0296 
0297         for (port = parport_enumerate ();
0298              port != NULL;
0299              port = port->next) {
0300                 /* Try to detect a device on the port... */
0301                 ...
0302              }
0303         }
0304 
0305         ...
0306 }
0307 
0308 NOTES
0309 
0310 parport_enumerate is deprecated; parport_register_driver should be
0311 used instead.
0312 
0313 SEE ALSO
0314 
0315 parport_register_driver, parport_unregister_driver
0316 
0317 parport_register_device - register to use a port
0318 -----------------------
0319 
0320 SYNOPSIS
0321 
0322 #include <linux/parport.h>
0323 
0324 typedef int (*preempt_func) (void *handle);
0325 typedef void (*wakeup_func) (void *handle);
0326 typedef int (*irq_func) (int irq, void *handle, struct pt_regs *);
0327 
0328 struct pardevice *parport_register_device(struct parport *port,
0329                                           const char *name,
0330                                           preempt_func preempt,
0331                                           wakeup_func wakeup,
0332                                           irq_func irq,
0333                                           int flags,
0334                                           void *handle);
0335 
0336 DESCRIPTION
0337 
0338 Use this function to register your device driver on a parallel port
0339 ('port').  Once you have done that, you will be able to use
0340 parport_claim and parport_release in order to use the port.
0341 
0342 The ('name') argument is the name of the device that appears in /proc
0343 filesystem. The string must be valid for the whole lifetime of the
0344 device (until parport_unregister_device is called).
0345 
0346 This function will register three callbacks into your driver:
0347 'preempt', 'wakeup' and 'irq'.  Each of these may be NULL in order to
0348 indicate that you do not want a callback.
0349 
0350 When the 'preempt' function is called, it is because another driver
0351 wishes to use the parallel port.  The 'preempt' function should return
0352 non-zero if the parallel port cannot be released yet -- if zero is
0353 returned, the port is lost to another driver and the port must be
0354 re-claimed before use.
0355 
0356 The 'wakeup' function is called once another driver has released the
0357 port and no other driver has yet claimed it.  You can claim the
0358 parallel port from within the 'wakeup' function (in which case the
0359 claim is guaranteed to succeed), or choose not to if you don't need it
0360 now.
0361 
0362 If an interrupt occurs on the parallel port your driver has claimed,
0363 the 'irq' function will be called. (Write something about shared
0364 interrupts here.)
0365 
0366 The 'handle' is a pointer to driver-specific data, and is passed to
0367 the callback functions.
0368 
0369 'flags' may be a bitwise combination of the following flags:
0370 
0371         Flag            Meaning
0372   PARPORT_DEV_EXCL      The device cannot share the parallel port at all.
0373                         Use this only when absolutely necessary.
0374 
0375 The typedefs are not actually defined -- they are only shown in order
0376 to make the function prototype more readable.
0377 
0378 The visible parts of the returned 'struct pardevice' are:
0379 
0380 struct pardevice {
0381         struct parport *port;   /* Associated port */
0382         void *private;          /* Device driver's 'handle' */
0383         ...
0384 };
0385 
0386 RETURN VALUE
0387 
0388 A 'struct pardevice *': a handle to the registered parallel port
0389 device that can be used for parport_claim, parport_release, etc.
0390 
0391 ERRORS
0392 
0393 A return value of NULL indicates that there was a problem registering
0394 a device on that port.
0395 
0396 EXAMPLE
0397 
0398 static int preempt (void *handle)
0399 {
0400         if (busy_right_now)
0401                 return 1;
0402 
0403         must_reclaim_port = 1;
0404         return 0;
0405 }
0406 
0407 static void wakeup (void *handle)
0408 {
0409         struct toaster *private = handle;
0410         struct pardevice *dev = private->dev;
0411         if (!dev) return; /* avoid races */
0412 
0413         if (want_port)
0414                 parport_claim (dev);
0415 }
0416 
0417 static int toaster_detect (struct toaster *private, struct parport *port)
0418 {
0419         private->dev = parport_register_device (port, "toaster", preempt,
0420                                                 wakeup, NULL, 0,
0421                                                 private);
0422         if (!private->dev)
0423                 /* Couldn't register with parport. */
0424                 return -EIO;
0425 
0426         must_reclaim_port = 0;
0427         busy_right_now = 1;
0428         parport_claim_or_block (private->dev);
0429         ...
0430         /* Don't need the port while the toaster warms up. */
0431         busy_right_now = 0;
0432         ...
0433         busy_right_now = 1;
0434         if (must_reclaim_port) {
0435                 parport_claim_or_block (private->dev);
0436                 must_reclaim_port = 0;
0437         }
0438         ...
0439 }
0440 
0441 SEE ALSO
0442 
0443 parport_unregister_device, parport_claim
0444 
0445 parport_unregister_device - finish using a port
0446 -------------------------
0447 
0448 SYNPOPSIS
0449 
0450 #include <linux/parport.h>
0451 
0452 void parport_unregister_device (struct pardevice *dev);
0453 
0454 DESCRIPTION
0455 
0456 This function is the opposite of parport_register_device.  After using
0457 parport_unregister_device, 'dev' is no longer a valid device handle.
0458 
0459 You should not unregister a device that is currently claimed, although
0460 if you do it will be released automatically.
0461 
0462 EXAMPLE
0463 
0464         ...
0465         kfree (dev->private); /* before we lose the pointer */
0466         parport_unregister_device (dev);
0467         ...
0468 
0469 SEE ALSO
0470 
0471 parport_unregister_driver
0472 
0473 parport_claim, parport_claim_or_block - claim the parallel port for a device
0474 -------------------------------------
0475 
0476 SYNOPSIS
0477 
0478 #include <linux/parport.h>
0479 
0480 int parport_claim (struct pardevice *dev);
0481 int parport_claim_or_block (struct pardevice *dev);
0482 
0483 DESCRIPTION
0484 
0485 These functions attempt to gain control of the parallel port on which
0486 'dev' is registered.  'parport_claim' does not block, but
0487 'parport_claim_or_block' may do. (Put something here about blocking
0488 interruptibly or non-interruptibly.)
0489 
0490 You should not try to claim a port that you have already claimed.
0491 
0492 RETURN VALUE
0493 
0494 A return value of zero indicates that the port was successfully
0495 claimed, and the caller now has possession of the parallel port.
0496 
0497 If 'parport_claim_or_block' blocks before returning successfully, the
0498 return value is positive.
0499 
0500 ERRORS
0501 
0502   -EAGAIN  The port is unavailable at the moment, but another attempt
0503            to claim it may succeed.
0504 
0505 SEE ALSO
0506 
0507 parport_release
0508 
0509 parport_release - release the parallel port
0510 ---------------
0511 
0512 SYNOPSIS
0513 
0514 #include <linux/parport.h>
0515 
0516 void parport_release (struct pardevice *dev);
0517 
0518 DESCRIPTION
0519 
0520 Once a parallel port device has been claimed, it can be released using
0521 'parport_release'.  It cannot fail, but you should not release a
0522 device that you do not have possession of.
0523 
0524 EXAMPLE
0525 
0526 static size_t write (struct pardevice *dev, const void *buf,
0527                      size_t len)
0528 {
0529         ...
0530         written = dev->port->ops->write_ecp_data (dev->port, buf,
0531                                                   len);
0532         parport_release (dev);
0533         ...
0534 }
0535 
0536 
0537 SEE ALSO
0538 
0539 change_mode, parport_claim, parport_claim_or_block, parport_yield
0540 
0541 parport_yield, parport_yield_blocking - temporarily release a parallel port
0542 -------------------------------------
0543 
0544 SYNOPSIS
0545 
0546 #include <linux/parport.h>
0547 
0548 int parport_yield (struct pardevice *dev)
0549 int parport_yield_blocking (struct pardevice *dev);
0550 
0551 DESCRIPTION
0552 
0553 When a driver has control of a parallel port, it may allow another
0554 driver to temporarily 'borrow' it.  'parport_yield' does not block;
0555 'parport_yield_blocking' may do.
0556 
0557 RETURN VALUE
0558 
0559 A return value of zero indicates that the caller still owns the port
0560 and the call did not block.
0561 
0562 A positive return value from 'parport_yield_blocking' indicates that
0563 the caller still owns the port and the call blocked.
0564 
0565 A return value of -EAGAIN indicates that the caller no longer owns the
0566 port, and it must be re-claimed before use.
0567 
0568 ERRORS
0569 
0570   -EAGAIN  Ownership of the parallel port was given away.
0571 
0572 SEE ALSO
0573 
0574 parport_release
0575 
0576 parport_wait_peripheral - wait for status lines, up to 35ms
0577 -----------------------
0578 
0579 SYNOPSIS
0580 
0581 #include <linux/parport.h>
0582 
0583 int parport_wait_peripheral (struct parport *port,
0584                              unsigned char mask,
0585                              unsigned char val);
0586 
0587 DESCRIPTION
0588 
0589 Wait for the status lines in mask to match the values in val.
0590 
0591 RETURN VALUE
0592 
0593  -EINTR  a signal is pending
0594       0  the status lines in mask have values in val
0595       1  timed out while waiting (35ms elapsed)
0596 
0597 SEE ALSO
0598 
0599 parport_poll_peripheral
0600 
0601 parport_poll_peripheral - wait for status lines, in usec
0602 -----------------------
0603 
0604 SYNOPSIS
0605 
0606 #include <linux/parport.h>
0607 
0608 int parport_poll_peripheral (struct parport *port,
0609                              unsigned char mask,
0610                              unsigned char val,
0611                              int usec);
0612 
0613 DESCRIPTION
0614 
0615 Wait for the status lines in mask to match the values in val.
0616 
0617 RETURN VALUE
0618 
0619  -EINTR  a signal is pending
0620       0  the status lines in mask have values in val
0621       1  timed out while waiting (usec microseconds have elapsed)
0622 
0623 SEE ALSO
0624 
0625 parport_wait_peripheral
0626 
0627 parport_wait_event - wait for an event on a port
0628 ------------------
0629 
0630 SYNOPSIS
0631 
0632 #include <linux/parport.h>
0633 
0634 int parport_wait_event (struct parport *port, signed long timeout)
0635 
0636 DESCRIPTION
0637 
0638 Wait for an event (e.g. interrupt) on a port.  The timeout is in
0639 jiffies.
0640 
0641 RETURN VALUE
0642 
0643       0  success
0644      <0  error (exit as soon as possible)
0645      >0  timed out
0646 
0647 parport_negotiate - perform IEEE 1284 negotiation
0648 -----------------
0649 
0650 SYNOPSIS
0651 
0652 #include <linux/parport.h>
0653 
0654 int parport_negotiate (struct parport *, int mode);
0655 
0656 DESCRIPTION
0657 
0658 Perform IEEE 1284 negotiation.
0659 
0660 RETURN VALUE
0661 
0662      0  handshake OK; IEEE 1284 peripheral and mode available
0663     -1  handshake failed; peripheral not compliant (or none present)
0664      1  handshake OK; IEEE 1284 peripheral present but mode not
0665         available
0666 
0667 SEE ALSO
0668 
0669 parport_read, parport_write
0670 
0671 parport_read - read data from device
0672 ------------
0673 
0674 SYNOPSIS
0675 
0676 #include <linux/parport.h>
0677 
0678 ssize_t parport_read (struct parport *, void *buf, size_t len);
0679 
0680 DESCRIPTION
0681 
0682 Read data from device in current IEEE 1284 transfer mode.  This only
0683 works for modes that support reverse data transfer.
0684 
0685 RETURN VALUE
0686 
0687 If negative, an error code; otherwise the number of bytes transferred.
0688 
0689 SEE ALSO
0690 
0691 parport_write, parport_negotiate
0692 
0693 parport_write - write data to device
0694 -------------
0695 
0696 SYNOPSIS
0697 
0698 #include <linux/parport.h>
0699 
0700 ssize_t parport_write (struct parport *, const void *buf, size_t len);
0701 
0702 DESCRIPTION
0703 
0704 Write data to device in current IEEE 1284 transfer mode.  This only
0705 works for modes that support forward data transfer.
0706 
0707 RETURN VALUE
0708 
0709 If negative, an error code; otherwise the number of bytes transferred.
0710 
0711 SEE ALSO
0712 
0713 parport_read, parport_negotiate
0714 
0715 parport_open - register device for particular device number
0716 ------------
0717 
0718 SYNOPSIS
0719 
0720 #include <linux/parport.h>
0721 
0722 struct pardevice *parport_open (int devnum, const char *name,
0723                                 int (*pf) (void *),
0724                                 void (*kf) (void *),
0725                                 void (*irqf) (int, void *,
0726                                               struct pt_regs *),
0727                                 int flags, void *handle);
0728 
0729 DESCRIPTION
0730 
0731 This is like parport_register_device but takes a device number instead
0732 of a pointer to a struct parport.
0733 
0734 RETURN VALUE
0735 
0736 See parport_register_device.  If no device is associated with devnum,
0737 NULL is returned.
0738 
0739 SEE ALSO
0740 
0741 parport_register_device
0742 
0743 parport_close - unregister device for particular device number
0744 -------------
0745 
0746 SYNOPSIS
0747 
0748 #include <linux/parport.h>
0749 
0750 void parport_close (struct pardevice *dev);
0751 
0752 DESCRIPTION
0753 
0754 This is the equivalent of parport_unregister_device for parport_open.
0755 
0756 SEE ALSO
0757 
0758 parport_unregister_device, parport_open
0759 
0760 parport_device_id - obtain IEEE 1284 Device ID
0761 -----------------
0762 
0763 SYNOPSIS
0764 
0765 #include <linux/parport.h>
0766 
0767 ssize_t parport_device_id (int devnum, char *buffer, size_t len);
0768 
0769 DESCRIPTION
0770 
0771 Obtains the IEEE 1284 Device ID associated with a given device.
0772 
0773 RETURN VALUE
0774 
0775 If negative, an error code; otherwise, the number of bytes of buffer
0776 that contain the device ID.  The format of the device ID is as
0777 follows:
0778 
0779 [length][ID]
0780 
0781 The first two bytes indicate the inclusive length of the entire Device
0782 ID, and are in big-endian order.  The ID is a sequence of pairs of the
0783 form:
0784 
0785 key:value;
0786 
0787 NOTES
0788 
0789 Many devices have ill-formed IEEE 1284 Device IDs.
0790 
0791 SEE ALSO
0792 
0793 parport_find_class, parport_find_device
0794 
0795 parport_device_coords - convert device number to device coordinates
0796 ------------------
0797 
0798 SYNOPSIS
0799 
0800 #include <linux/parport.h>
0801 
0802 int parport_device_coords (int devnum, int *parport, int *mux,
0803                            int *daisy);
0804 
0805 DESCRIPTION
0806 
0807 Convert between device number (zero-based) and device coordinates
0808 (port, multiplexor, daisy chain address).
0809 
0810 RETURN VALUE
0811 
0812 Zero on success, in which case the coordinates are (*parport, *mux,
0813 *daisy).
0814 
0815 SEE ALSO
0816 
0817 parport_open, parport_device_id
0818 
0819 parport_find_class - find a device by its class
0820 ------------------
0821 
0822 SYNOPSIS
0823 
0824 #include <linux/parport.h>
0825 
0826 typedef enum {
0827         PARPORT_CLASS_LEGACY = 0,       /* Non-IEEE1284 device */
0828         PARPORT_CLASS_PRINTER,
0829         PARPORT_CLASS_MODEM,
0830         PARPORT_CLASS_NET,
0831         PARPORT_CLASS_HDC,              /* Hard disk controller */
0832         PARPORT_CLASS_PCMCIA,
0833         PARPORT_CLASS_MEDIA,            /* Multimedia device */
0834         PARPORT_CLASS_FDC,              /* Floppy disk controller */
0835         PARPORT_CLASS_PORTS,
0836         PARPORT_CLASS_SCANNER,
0837         PARPORT_CLASS_DIGCAM,
0838         PARPORT_CLASS_OTHER,            /* Anything else */
0839         PARPORT_CLASS_UNSPEC,           /* No CLS field in ID */
0840         PARPORT_CLASS_SCSIADAPTER
0841 } parport_device_class;
0842 
0843 int parport_find_class (parport_device_class cls, int from);
0844 
0845 DESCRIPTION
0846 
0847 Find a device by class.  The search starts from device number from+1.
0848 
0849 RETURN VALUE
0850 
0851 The device number of the next device in that class, or -1 if no such
0852 device exists.
0853 
0854 NOTES
0855 
0856 Example usage:
0857 
0858 int devnum = -1;
0859 while ((devnum = parport_find_class (PARPORT_CLASS_DIGCAM, devnum)) != -1) {
0860     struct pardevice *dev = parport_open (devnum, ...);
0861     ...
0862 }
0863 
0864 SEE ALSO
0865 
0866 parport_find_device, parport_open, parport_device_id
0867 
0868 parport_find_device - find a device by its class
0869 ------------------
0870 
0871 SYNOPSIS
0872 
0873 #include <linux/parport.h>
0874 
0875 int parport_find_device (const char *mfg, const char *mdl, int from);
0876 
0877 DESCRIPTION
0878 
0879 Find a device by vendor and model.  The search starts from device
0880 number from+1.
0881 
0882 RETURN VALUE
0883 
0884 The device number of the next device matching the specifications, or
0885 -1 if no such device exists.
0886 
0887 NOTES
0888 
0889 Example usage:
0890 
0891 int devnum = -1;
0892 while ((devnum = parport_find_device ("IOMEGA", "ZIP+", devnum)) != -1) {
0893     struct pardevice *dev = parport_open (devnum, ...);
0894     ...
0895 }
0896 
0897 SEE ALSO
0898 
0899 parport_find_class, parport_open, parport_device_id
0900 
0901 parport_set_timeout - set the inactivity timeout
0902 -------------------
0903 
0904 SYNOPSIS
0905 
0906 #include <linux/parport.h>
0907 
0908 long parport_set_timeout (struct pardevice *dev, long inactivity);
0909 
0910 DESCRIPTION
0911 
0912 Set the inactivity timeout, in jiffies, for a registered device.  The
0913 previous timeout is returned.
0914 
0915 RETURN VALUE
0916 
0917 The previous timeout, in jiffies.
0918 
0919 NOTES
0920 
0921 Some of the port->ops functions for a parport may take time, owing to
0922 delays at the peripheral.  After the peripheral has not responded for
0923 'inactivity' jiffies, a timeout will occur and the blocking function
0924 will return.
0925 
0926 A timeout of 0 jiffies is a special case: the function must do as much
0927 as it can without blocking or leaving the hardware in an unknown
0928 state.  If port operations are performed from within an interrupt
0929 handler, for instance, a timeout of 0 jiffies should be used.
0930 
0931 Once set for a registered device, the timeout will remain at the set
0932 value until set again.
0933 
0934 SEE ALSO
0935 
0936 port->ops->xxx_read/write_yyy
0937 
0938 PORT FUNCTIONS
0939 --------------
0940 
0941 The functions in the port->ops structure (struct parport_operations)
0942 are provided by the low-level driver responsible for that port.
0943 
0944 port->ops->read_data - read the data register
0945 --------------------
0946 
0947 SYNOPSIS
0948 
0949 #include <linux/parport.h>
0950 
0951 struct parport_operations {
0952         ...
0953         unsigned char (*read_data) (struct parport *port);
0954         ...
0955 };
0956 
0957 DESCRIPTION
0958 
0959 If port->modes contains the PARPORT_MODE_TRISTATE flag and the
0960 PARPORT_CONTROL_DIRECTION bit in the control register is set, this
0961 returns the value on the data pins.  If port->modes contains the
0962 PARPORT_MODE_TRISTATE flag and the PARPORT_CONTROL_DIRECTION bit is
0963 not set, the return value _may_ be the last value written to the data
0964 register.  Otherwise the return value is undefined.
0965 
0966 SEE ALSO
0967 
0968 write_data, read_status, write_control
0969 
0970 port->ops->write_data - write the data register
0971 ---------------------
0972 
0973 SYNOPSIS
0974 
0975 #include <linux/parport.h>
0976 
0977 struct parport_operations {
0978         ...
0979         void (*write_data) (struct parport *port, unsigned char d);
0980         ...
0981 };
0982 
0983 DESCRIPTION
0984 
0985 Writes to the data register.  May have side-effects (a STROBE pulse,
0986 for instance).
0987 
0988 SEE ALSO
0989 
0990 read_data, read_status, write_control
0991 
0992 port->ops->read_status - read the status register
0993 ----------------------
0994 
0995 SYNOPSIS
0996 
0997 #include <linux/parport.h>
0998 
0999 struct parport_operations {
1000         ...
1001         unsigned char (*read_status) (struct parport *port);
1002         ...
1003 };
1004 
1005 DESCRIPTION
1006 
1007 Reads from the status register.  This is a bitmask:
1008 
1009 - PARPORT_STATUS_ERROR (printer fault, "nFault")
1010 - PARPORT_STATUS_SELECT (on-line, "Select")
1011 - PARPORT_STATUS_PAPEROUT (no paper, "PError")
1012 - PARPORT_STATUS_ACK (handshake, "nAck")
1013 - PARPORT_STATUS_BUSY (busy, "Busy")
1014 
1015 There may be other bits set.
1016 
1017 SEE ALSO
1018 
1019 read_data, write_data, write_control
1020 
1021 port->ops->read_control - read the control register
1022 -----------------------
1023 
1024 SYNOPSIS
1025 
1026 #include <linux/parport.h>
1027 
1028 struct parport_operations {
1029         ...
1030         unsigned char (*read_control) (struct parport *port);
1031         ...
1032 };
1033 
1034 DESCRIPTION
1035 
1036 Returns the last value written to the control register (either from
1037 write_control or frob_control).  No port access is performed.
1038 
1039 SEE ALSO
1040 
1041 read_data, write_data, read_status, write_control
1042 
1043 port->ops->write_control - write the control register
1044 ------------------------
1045 
1046 SYNOPSIS
1047 
1048 #include <linux/parport.h>
1049 
1050 struct parport_operations {
1051         ...
1052         void (*write_control) (struct parport *port, unsigned char s);
1053         ...
1054 };
1055 
1056 DESCRIPTION
1057 
1058 Writes to the control register. This is a bitmask:
1059                           _______
1060 - PARPORT_CONTROL_STROBE (nStrobe)
1061                           _______
1062 - PARPORT_CONTROL_AUTOFD (nAutoFd)
1063                         _____
1064 - PARPORT_CONTROL_INIT (nInit)
1065                           _________
1066 - PARPORT_CONTROL_SELECT (nSelectIn)
1067 
1068 SEE ALSO
1069 
1070 read_data, write_data, read_status, frob_control
1071 
1072 port->ops->frob_control - write control register bits
1073 -----------------------
1074 
1075 SYNOPSIS
1076 
1077 #include <linux/parport.h>
1078 
1079 struct parport_operations {
1080         ...
1081         unsigned char (*frob_control) (struct parport *port,
1082                                        unsigned char mask,
1083                                        unsigned char val);
1084         ...
1085 };
1086 
1087 DESCRIPTION
1088 
1089 This is equivalent to reading from the control register, masking out
1090 the bits in mask, exclusive-or'ing with the bits in val, and writing
1091 the result to the control register.
1092 
1093 As some ports don't allow reads from the control port, a software copy
1094 of its contents is maintained, so frob_control is in fact only one
1095 port access.
1096 
1097 SEE ALSO
1098 
1099 read_data, write_data, read_status, write_control
1100 
1101 port->ops->enable_irq - enable interrupt generation
1102 ---------------------
1103 
1104 SYNOPSIS
1105 
1106 #include <linux/parport.h>
1107 
1108 struct parport_operations {
1109         ...
1110         void (*enable_irq) (struct parport *port);
1111         ...
1112 };
1113 
1114 DESCRIPTION
1115 
1116 The parallel port hardware is instructed to generate interrupts at
1117 appropriate moments, although those moments are
1118 architecture-specific.  For the PC architecture, interrupts are
1119 commonly generated on the rising edge of nAck.
1120 
1121 SEE ALSO
1122 
1123 disable_irq
1124 
1125 port->ops->disable_irq - disable interrupt generation
1126 ----------------------
1127 
1128 SYNOPSIS
1129 
1130 #include <linux/parport.h>
1131 
1132 struct parport_operations {
1133         ...
1134         void (*disable_irq) (struct parport *port);
1135         ...
1136 };
1137 
1138 DESCRIPTION
1139 
1140 The parallel port hardware is instructed not to generate interrupts.
1141 The interrupt itself is not masked.
1142 
1143 SEE ALSO
1144 
1145 enable_irq
1146 
1147 port->ops->data_forward - enable data drivers
1148 -----------------------
1149 
1150 SYNOPSIS
1151 
1152 #include <linux/parport.h>
1153 
1154 struct parport_operations {
1155         ...
1156         void (*data_forward) (struct parport *port);
1157         ...
1158 };
1159 
1160 DESCRIPTION
1161 
1162 Enables the data line drivers, for 8-bit host-to-peripheral
1163 communications.
1164 
1165 SEE ALSO
1166 
1167 data_reverse
1168 
1169 port->ops->data_reverse - tristate the buffer
1170 -----------------------
1171 
1172 SYNOPSIS
1173 
1174 #include <linux/parport.h>
1175 
1176 struct parport_operations {
1177         ...
1178         void (*data_reverse) (struct parport *port);
1179         ...
1180 };
1181 
1182 DESCRIPTION
1183 
1184 Places the data bus in a high impedance state, if port->modes has the
1185 PARPORT_MODE_TRISTATE bit set.
1186 
1187 SEE ALSO
1188 
1189 data_forward
1190 
1191 port->ops->epp_write_data - write EPP data
1192 -------------------------
1193 
1194 SYNOPSIS
1195 
1196 #include <linux/parport.h>
1197 
1198 struct parport_operations {
1199         ...
1200         size_t (*epp_write_data) (struct parport *port, const void *buf,
1201                                   size_t len, int flags);
1202         ...
1203 };
1204 
1205 DESCRIPTION
1206 
1207 Writes data in EPP mode, and returns the number of bytes written.
1208 
1209 The 'flags' parameter may be one or more of the following,
1210 bitwise-or'ed together:
1211 
1212 PARPORT_EPP_FAST        Use fast transfers. Some chips provide 16-bit and
1213                         32-bit registers.  However, if a transfer
1214                         times out, the return value may be unreliable.
1215 
1216 SEE ALSO
1217 
1218 epp_read_data, epp_write_addr, epp_read_addr
1219 
1220 port->ops->epp_read_data - read EPP data
1221 ------------------------
1222 
1223 SYNOPSIS
1224 
1225 #include <linux/parport.h>
1226 
1227 struct parport_operations {
1228         ...
1229         size_t (*epp_read_data) (struct parport *port, void *buf,
1230                                  size_t len, int flags);
1231         ...
1232 };
1233 
1234 DESCRIPTION
1235 
1236 Reads data in EPP mode, and returns the number of bytes read.
1237 
1238 The 'flags' parameter may be one or more of the following,
1239 bitwise-or'ed together:
1240 
1241 PARPORT_EPP_FAST        Use fast transfers. Some chips provide 16-bit and
1242                         32-bit registers.  However, if a transfer
1243                         times out, the return value may be unreliable.
1244 
1245 SEE ALSO
1246 
1247 epp_write_data, epp_write_addr, epp_read_addr
1248 
1249 port->ops->epp_write_addr - write EPP address
1250 -------------------------
1251 
1252 SYNOPSIS
1253 
1254 #include <linux/parport.h>
1255 
1256 struct parport_operations {
1257         ...
1258         size_t (*epp_write_addr) (struct parport *port,
1259                                   const void *buf, size_t len, int flags);
1260         ...
1261 };
1262 
1263 DESCRIPTION
1264 
1265 Writes EPP addresses (8 bits each), and returns the number written.
1266 
1267 The 'flags' parameter may be one or more of the following,
1268 bitwise-or'ed together:
1269 
1270 PARPORT_EPP_FAST        Use fast transfers. Some chips provide 16-bit and
1271                         32-bit registers.  However, if a transfer
1272                         times out, the return value may be unreliable.
1273 
1274 (Does PARPORT_EPP_FAST make sense for this function?)
1275 
1276 SEE ALSO
1277 
1278 epp_write_data, epp_read_data, epp_read_addr
1279 
1280 port->ops->epp_read_addr - read EPP address
1281 ------------------------
1282 
1283 SYNOPSIS
1284 
1285 #include <linux/parport.h>
1286 
1287 struct parport_operations {
1288         ...
1289         size_t (*epp_read_addr) (struct parport *port, void *buf,
1290                                  size_t len, int flags);
1291         ...
1292 };
1293 
1294 DESCRIPTION
1295 
1296 Reads EPP addresses (8 bits each), and returns the number read.
1297 
1298 The 'flags' parameter may be one or more of the following,
1299 bitwise-or'ed together:
1300 
1301 PARPORT_EPP_FAST        Use fast transfers. Some chips provide 16-bit and
1302                         32-bit registers.  However, if a transfer
1303                         times out, the return value may be unreliable.
1304 
1305 (Does PARPORT_EPP_FAST make sense for this function?)
1306 
1307 SEE ALSO
1308 
1309 epp_write_data, epp_read_data, epp_write_addr
1310 
1311 port->ops->ecp_write_data - write a block of ECP data
1312 -------------------------
1313 
1314 SYNOPSIS
1315 
1316 #include <linux/parport.h>
1317 
1318 struct parport_operations {
1319         ...
1320         size_t (*ecp_write_data) (struct parport *port,
1321                                   const void *buf, size_t len, int flags);
1322         ...
1323 };
1324 
1325 DESCRIPTION
1326 
1327 Writes a block of ECP data.  The 'flags' parameter is ignored.
1328 
1329 RETURN VALUE
1330 
1331 The number of bytes written.
1332 
1333 SEE ALSO
1334 
1335 ecp_read_data, ecp_write_addr
1336 
1337 port->ops->ecp_read_data - read a block of ECP data
1338 ------------------------
1339 
1340 SYNOPSIS
1341 
1342 #include <linux/parport.h>
1343 
1344 struct parport_operations {
1345         ...
1346         size_t (*ecp_read_data) (struct parport *port,
1347                                  void *buf, size_t len, int flags);
1348         ...
1349 };
1350 
1351 DESCRIPTION
1352 
1353 Reads a block of ECP data.  The 'flags' parameter is ignored.
1354 
1355 RETURN VALUE
1356 
1357 The number of bytes read.  NB. There may be more unread data in a
1358 FIFO.  Is there a way of stunning the FIFO to prevent this?
1359 
1360 SEE ALSO
1361 
1362 ecp_write_block, ecp_write_addr
1363 
1364 port->ops->ecp_write_addr - write a block of ECP addresses
1365 -------------------------
1366 
1367 SYNOPSIS
1368 
1369 #include <linux/parport.h>
1370 
1371 struct parport_operations {
1372         ...
1373         size_t (*ecp_write_addr) (struct parport *port,
1374                                   const void *buf, size_t len, int flags);
1375         ...
1376 };
1377 
1378 DESCRIPTION
1379 
1380 Writes a block of ECP addresses.  The 'flags' parameter is ignored.
1381 
1382 RETURN VALUE
1383 
1384 The number of bytes written.
1385 
1386 NOTES
1387 
1388 This may use a FIFO, and if so shall not return until the FIFO is empty.
1389 
1390 SEE ALSO
1391 
1392 ecp_read_data, ecp_write_data
1393 
1394 port->ops->nibble_read_data - read a block of data in nibble mode
1395 ---------------------------
1396 
1397 SYNOPSIS
1398 
1399 #include <linux/parport.h>
1400 
1401 struct parport_operations {
1402         ...
1403         size_t (*nibble_read_data) (struct parport *port,
1404                                     void *buf, size_t len, int flags);
1405         ...
1406 };
1407 
1408 DESCRIPTION
1409 
1410 Reads a block of data in nibble mode.  The 'flags' parameter is ignored.
1411 
1412 RETURN VALUE
1413 
1414 The number of whole bytes read.
1415 
1416 SEE ALSO
1417 
1418 byte_read_data, compat_write_data
1419 
1420 port->ops->byte_read_data - read a block of data in byte mode
1421 -------------------------
1422 
1423 SYNOPSIS
1424 
1425 #include <linux/parport.h>
1426 
1427 struct parport_operations {
1428         ...
1429         size_t (*byte_read_data) (struct parport *port,
1430                                   void *buf, size_t len, int flags);
1431         ...
1432 };
1433 
1434 DESCRIPTION
1435 
1436 Reads a block of data in byte mode.  The 'flags' parameter is ignored.
1437 
1438 RETURN VALUE
1439 
1440 The number of bytes read.
1441 
1442 SEE ALSO
1443 
1444 nibble_read_data, compat_write_data
1445 
1446 port->ops->compat_write_data - write a block of data in compatibility mode
1447 ----------------------------
1448 
1449 SYNOPSIS
1450 
1451 #include <linux/parport.h>
1452 
1453 struct parport_operations {
1454         ...
1455         size_t (*compat_write_data) (struct parport *port,
1456                                      const void *buf, size_t len, int flags);
1457         ...
1458 };
1459 
1460 DESCRIPTION
1461 
1462 Writes a block of data in compatibility mode.  The 'flags' parameter
1463 is ignored.
1464 
1465 RETURN VALUE
1466 
1467 The number of bytes written.
1468 
1469 SEE ALSO
1470 
1471 nibble_read_data, byte_read_data