Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
ieee1284.c File Reference
#include <linux/module.h>
#include <linux/threads.h>
#include <linux/parport.h>
#include <linux/delay.h>
#include <linux/kernel.h>
#include <linux/interrupt.h>
#include <linux/timer.h>
#include <linux/sched.h>

Go to the source code of this file.

Macros

#define DPRINTK(stuff...)
 

Functions

int parport_wait_event (struct parport *port, signed long timeout)
 
int parport_poll_peripheral (struct parport *port, unsigned char mask, unsigned char result, int usec)
 
int parport_wait_peripheral (struct parport *port, unsigned char mask, unsigned char result)
 
int parport_negotiate (struct parport *port, int mode)
 
void parport_ieee1284_interrupt (void *handle)
 
ssize_t parport_write (struct parport *port, const void *buffer, size_t len)
 
ssize_t parport_read (struct parport *port, void *buffer, size_t len)
 
long parport_set_timeout (struct pardevice *dev, long inactivity)
 
 EXPORT_SYMBOL (parport_negotiate)
 
 EXPORT_SYMBOL (parport_write)
 
 EXPORT_SYMBOL (parport_read)
 
 EXPORT_SYMBOL (parport_wait_peripheral)
 
 EXPORT_SYMBOL (parport_wait_event)
 
 EXPORT_SYMBOL (parport_set_timeout)
 
 EXPORT_SYMBOL (parport_ieee1284_interrupt)
 

Macro Definition Documentation

#define DPRINTK (   stuff...)

Definition at line 37 of file ieee1284.c.

Function Documentation

EXPORT_SYMBOL ( parport_negotiate  )
EXPORT_SYMBOL ( parport_write  )
EXPORT_SYMBOL ( parport_read  )
EXPORT_SYMBOL ( parport_wait_peripheral  )
EXPORT_SYMBOL ( parport_wait_event  )
EXPORT_SYMBOL ( parport_set_timeout  )
EXPORT_SYMBOL ( parport_ieee1284_interrupt  )
void parport_ieee1284_interrupt ( void handle)

Definition at line 574 of file ieee1284.c.

int parport_negotiate ( struct parport port,
int  mode 
)

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

Returns
: desired values of chosen status lines : timeout

This function busy-waits until the masked status lines have the desired values, or until the timeout period elapses. The and

Returns
parameters are bitmasks, with the bits defined by the constants in parport.h: PARPORT_STATUS_BUSY, and so on.

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.

ssize_t parport_read ( struct parport port,
void buffer,
size_t  len 
)

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.

long parport_set_timeout ( struct pardevice dev,
long  inactivity 
)

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.

int parport_wait_event ( struct parport port,
signed long  timeout 
)

parport_wait_event - wait for an event on a parallel port : port to wait on : time to wait (in jiffies)

This function waits for up to jiffies for an interrupt to occur on a parallel port. If the port timeout is set to zero, it returns immediately.

If an interrupt occurs before the timeout period elapses, this function returns zero immediately. If it times out, it returns one. An error code less than zero indicates an error (most likely a pending signal), and the calling code should finish what it's doing as soon as it can.

Definition at line 69 of file ieee1284.c.

int parport_wait_peripheral ( struct parport port,
unsigned char  mask,
unsigned char  result 
)

parport_wait_peripheral - wait for status lines to change in 35ms : port to watch : status lines to watch

Returns
: desired values of chosen status lines

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

Returns
parameters are bitmasks, with the bits defined by the constants in parport.h: PARPORT_STATUS_BUSY, and so on.

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.

ssize_t parport_write ( struct parport port,
const void buffer,
size_t  len 
)

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.