Linux Kernel
3.7.1
|
#include <linux/jiffies.h>
#include <linux/proc_fs.h>
#include <linux/spinlock.h>
#include <linux/wait.h>
#include <linux/irqreturn.h>
#include <linux/semaphore.h>
#include <asm/ptrace.h>
#include <uapi/linux/parport.h>
#include <linux/parport_pc.h>
Go to the source code of this file.
Data Structures | |
struct | pc_parport_state |
struct | ax_parport_state |
struct | amiga_parport_state |
struct | ax88796_parport_state |
struct | ip32_parport_state |
struct | parport_state |
struct | parport_operations |
struct | parport_device_info |
struct | pardevice |
struct | ieee1284_info |
struct | parport |
struct | parport_driver |
Macros | |
#define | PARPORT_DEVPROC_REGISTERED 0 |
#define | DEFAULT_SPIN_TIME 500 /* us */ |
#define | PARPORT_DEV_TRAN 0 /* WARNING !! DEPRECATED !! */ |
#define | PARPORT_DEV_LURK (1<<0) /* WARNING !! DEPRECATED !! */ |
#define | PARPORT_DEV_EXCL (1<<1) /* Need exclusive access. */ |
#define | PARPORT_FLAG_EXCL (1<<1) /* EXCL driver registered. */ |
#define | PARPORT_INACTIVITY_O_NONBLOCK 1 |
#define | parport_write_data(p, x) parport_pc_write_data(p,x) |
#define | parport_read_data(p) parport_pc_read_data(p) |
#define | parport_write_control(p, x) parport_pc_write_control(p,x) |
#define | parport_read_control(p) parport_pc_read_control(p) |
#define | parport_frob_control(p, m, v) parport_pc_frob_control(p,m,v) |
#define | parport_read_status(p) parport_pc_read_status(p) |
#define | parport_enable_irq(p) parport_pc_enable_irq(p) |
#define | parport_disable_irq(p) parport_pc_disable_irq(p) |
#define | parport_data_forward(p) parport_pc_data_forward(p) |
#define | parport_data_reverse(p) parport_pc_data_reverse(p) |
Variables | |
unsigned long | parport_default_timeslice |
int | parport_default_spintime |
#define PARPORT_DEV_EXCL (1<<1) /* Need exclusive access. */ |
#define PARPORT_DEV_LURK (1<<0) /* WARNING !! DEPRECATED !! */ |
#define PARPORT_FLAG_EXCL (1<<1) /* EXCL driver registered. */ |
enum ieee1284_phase |
parport_announce_port - tell device drivers about a parallel port : parallel port to announce
After a port driver has registered a parallel port with parport_register_port, and performed any necessary initialisation or adjustments, it should call parport_announce_port() in order to notify all device drivers that have called parport_register_driver(). Their attach() functions will be called, with as the parameter.
parport_claim - claim access to a parallel port device : pointer to structure representing a device on the port
This function will not block and so can be used from interrupt context. If parport_claim() succeeds in claiming access to the port it returns zero and the port is available to use. It may fail (returning non-zero) if the port is in use by another driver and that driver is not willing to relinquish control of the port.
parport_claim_or_block - claim access to a parallel port device : pointer to structure representing a device on the port
This behaves like parport_claim(), but will block if necessary to wait for the port to be free. A return value of 1 indicates that it slept; 0 means that it succeeded without needing to sleep. A negative error code indicates failure.
parport_close - close a device opened with parport_open() : device to close
This is to parport_open() as parport_unregister_device() is to parport_register_device().
parport_find_base - find a parallel port by base address : base I/O address
This returns the parallel port with the specified base address, or NULL if there is none.
There is an implicit parport_get_port() done already; to throw away the reference to the port that parport_find_base() gives you, use parport_put_port().
parport_find_number - find a parallel port by number : parallel port number
This returns the parallel port with the specified number, or NULL if there is none.
There is an implicit parport_get_port() done already; to throw away the reference to the port that parport_find_number() gives you, use parport_put_port().
Definition at line 490 of file ieee1284_ops.c.
Definition at line 638 of file ieee1284_ops.c.
Definition at line 403 of file ieee1284_ops.c.
Definition at line 862 of file ieee1284_ops.c.
Definition at line 774 of file ieee1284_ops.c.
Definition at line 818 of file ieee1284_ops.c.
Definition at line 730 of file ieee1284_ops.c.
Definition at line 574 of file ieee1284.c.
Definition at line 240 of file ieee1284_ops.c.
Definition at line 149 of file ieee1284_ops.c.
Definition at line 40 of file ieee1284_ops.c.
irqreturn_t parport_irq_handler | ( | int | irq, |
void * | dev_id | ||
) |
parport_negotiate - negotiate an IEEE 1284 mode : port to use : mode to negotiate to
Use this to negotiate to a particular IEEE 1284 transfer mode. The parameter should be one of the constants in parport.h starting IEEE1284_MODE_xxx.
The return value is 0 if the peripheral has accepted the negotiation to the mode specified, -1 if the peripheral is not IEEE 1284 compliant (or not present), or 1 if the peripheral has rejected the negotiation.
Definition at line 334 of file ieee1284.c.
int parport_poll_peripheral | ( | struct parport * | port, |
unsigned char | mask, | ||
unsigned char | result, | ||
int | usec | ||
) |
parport_poll_peripheral - poll status lines : port to watch : status lines to watch
This function busy-waits until the masked status lines have the desired values, or until the timeout period elapses. The and
This function does not call schedule(); instead it busy-waits using udelay(). It currently has a resolution of 5usec.
If the status lines take on the desired values before the timeout period elapses, parport_poll_peripheral() returns zero immediately. A return value greater than zero indicates a timeout. An error code (less than zero) indicates an error, most likely a signal that arrived, and the caller should finish what it is doing as soon as possible.
Definition at line 120 of file ieee1284.c.
parport_put_port - decrement a port's reference count : the port
This should be called once for each call to parport_get_port(), once the port is no longer needed.
parport_read - read a block of data from a parallel port : port to read from : data buffer (in kernel space) : number of bytes of data to transfer
This will read up to bytes of to the port specified, using the IEEE 1284 transfer mode most recently negotiated to (using parport_negotiate()), as long as that mode supports reverse transfers (peripheral to host).
It is the caller's responsibility to ensure that the first bytes of are available to write to.
This function returns the number of bytes transferred (if zero or positive), or else an error code.
Definition at line 700 of file ieee1284.c.
int parport_register_driver | ( | struct parport_driver * | drv | ) |
parport_register_driver - register a parallel port device driver : structure describing the driver
This can be called by a parallel port device driver in order to receive notifications about ports being found in the system, as well as ports no longer available.
The structure is allocated by the caller and must not be deallocated until after calling parport_unregister_driver().
The driver's attach() function may block. The port that attach() is given will be valid for the duration of the callback, but if the driver wants to take a copy of the pointer it must call parport_get_port() to do so. Calling parport_register_device() on that port will do this for you.
The driver's detach() function may block. The port that detach() is given will be valid for the duration of the callback, but if the driver wants to take a copy of the pointer it must call parport_get_port() to do so.
Returns 0 on success. Currently it always succeeds.
|
read |
parport_register_port - register a parallel port : base I/O address : IRQ line : DMA channel : pointer to the port driver's port operations structure
When a parallel port (lowlevel) driver finds a port that should be made available to parallel port device drivers, it should call parport_register_port(). The , , and parameters are for the convenience of port drivers, and for ports where they aren't meaningful needn't be set to anything special. They can be altered afterwards by adjusting the relevant members of the parport structure that is returned and represents the port. They should not be tampered with after calling parport_announce_port, however.
If there are parallel port device drivers in the system that have registered themselves using parport_register_driver(), they are not told about the port at this time; that is done by parport_announce_port().
The structure is allocated by the caller, and must not be deallocated before calling parport_remove_port().
If there is no memory to allocate a new parport structure, this function will return NULL.
parport_remove_port - deregister a parallel port : parallel port to deregister
When a parallel port driver is forcibly unloaded, or a parallel port becomes inaccessible, the port driver must call this function in order to deal with device drivers that still want to use it.
The parport structure associated with the port has its operations structure replaced with one containing 'null' operations that return errors or just don't do anything.
Any drivers that have registered themselves using parport_register_driver() are notified that the port is no longer accessible by having their detach() routines called with as the parameter.
parport_set_timeout - set the inactivity timeout for a device : device on a port : inactivity timeout (in jiffies)
This sets the inactivity timeout for a particular device on a port. This affects functions like parport_wait_peripheral(). The special value 0 means not to call schedule() while dealing with this device.
The return value is the previous inactivity timeout.
Any callers of parport_wait_event() for this device are woken up.
Definition at line 797 of file ieee1284.c.
parport_unregister_device - deregister a device on a parallel port : pointer to structure representing device
This undoes the effect of parport_register_device().
void parport_unregister_driver | ( | struct parport_driver * | drv | ) |
parport_unregister_driver - deregister a parallel port device driver : structure describing the driver that was given to parport_register_driver()
This should be called by a parallel port device driver that has registered itself using parport_register_driver() when it is about to be unloaded.
When it returns, the driver's attach() routine will no longer be called, and for each port that attach() was called for, the detach() routine will have been called.
All the driver's attach() and detach() calls are guaranteed to have finished by the time this function returns.
parport_wait_peripheral - wait for status lines to change in 35ms : port to watch : status lines to watch
This function waits until the masked status lines have the desired values, or until 35ms have elapsed (see IEEE 1284-1994 page 24 to 25 for why this value in particular is hardcoded). The and
The port is polled quickly to start off with, in anticipation of a fast response from the peripheral. This fast polling time is configurable (using /proc), and defaults to 500usec. If the timeout for this port (see parport_set_timeout()) is zero, the fast polling time is 35ms, and this function does not call schedule().
If the timeout for this port is non-zero, after the fast polling fails it uses parport_wait_event() to wait for up to 10ms, waking up if an interrupt occurs.
Definition at line 169 of file ieee1284.c.
parport_write - write a block of data to a parallel port : port to write to : data buffer (in kernel space) : number of bytes of data to transfer
This will write up to bytes of to the port specified, using the IEEE 1284 transfer mode most recently negotiated to (using parport_negotiate()), as long as that mode supports forward transfers (host to peripheral).
It is the caller's responsibility to ensure that the first bytes of are valid.
This function returns the number of bytes transferred (if zero or positive), or else an error code.
Definition at line 607 of file ieee1284.c.