sanei_pp.h File Reference

This file implements an interface for accessing the parallel-port. More...

Go to the source code of this file.

Defines

#define SANEI_PP_CTRL_STROBE   0x01
 Parallelport Control-Register definitions.
#define SANEI_PP_CTRL_AUTOLF   0x02
 Parallelport Control-Register definitions.
#define SANEI_PP_CTRL_NOT_INIT   0x04
 Parallelport Control-Register definitions.
#define SANEI_PP_CTRL_SELECT_IN   0x08
 Parallelport Control-Register definitions.
#define SANEI_PP_CTRL_ENABLE_IRQ   0x10
 Parallelport Control-Register definitions.
#define SANEI_PP_CTRL_DIRECTION   0x20
 Parallelport Control-Register definitions.
#define SANEI_PP_CTRL_RESERVED   0xc0
 Parallelport Control-Register definitions.

Enumerations

enum  sanei_pp_mode { SANEI_PP_MODE_SPP = (1<<1), SANEI_PP_MODE_BIDI = (1<<2), SANEI_PP_MODE_EPP = (1<<4), SANEI_PP_MODE_ECP = (1<<8) }
 some modes, we'd like to see/use. More...

Functions

SANE_Status sanei_pp_init (void)
 Initialize sanei_pp.
SANE_Status sanei_pp_open (const char *dev, int *fd)
 Open a parport device.
SANE_Status sanei_pp_claim (int fd)
 Claim a parport device.
SANE_Status sanei_pp_release (int fd)
 Release a previously claimed device.
SANE_Status sanei_pp_set_datadir (int fd, int rev)
 Set the data direction.
SANE_Bool sanei_pp_uses_directio (void)
 Check whether for libieee1284 usage.
SANE_Status sanei_pp_getmodes (int fd, int *mode)
 Determine the available parallel port modes for a given device.
SANE_Status sanei_pp_setmode (int fd, int mode)
 Set the operation mode for a given device.
SANE_Status sanei_pp_outb_data (int fd, SANE_Byte val)
 Write data to ports (spp-data, ctrl, epp-address and epp-data).
SANE_Byte sanei_pp_inb_data (int fd)
 Read data from ports (spp-data, status, ctrl and epp-data).
void sanei_pp_udelay (unsigned long usec)
 Delay execution for some micro-seconds.


Detailed Description

This file implements an interface for accessing the parallel-port.

See also:
sanei_pp.h

Enumeration Type Documentation

some modes, we'd like to see/use.

Enumerator:
SANEI_PP_MODE_SPP  SPP.
SANEI_PP_MODE_BIDI  BIDI.
SANEI_PP_MODE_EPP  EPP.
SANEI_PP_MODE_ECP  ECP.


Function Documentation

SANE_Status sanei_pp_init ( void   ) 

Initialize sanei_pp.

This function must be called before any other sanei_pp function.

SANE_Status sanei_pp_open ( const char *  dev,
int *  fd 
)

Open a parport device.

Parameters:
dev - name of device to open.
fd - pointer to variable that should revceive the handle.
Returns:

SANE_Status sanei_pp_claim ( int  fd  ) 

Claim a parport device.

Parameters:
fd - handle of the device to claim
Returns:

SANE_Status sanei_pp_release ( int  fd  ) 

Release a previously claimed device.

Parameters:
fd - handle of the device to release
Returns:

SANE_Status sanei_pp_set_datadir ( int  fd,
int  rev 
)

Set the data direction.

Parameters:
fd - handle of the device, where to change the direction.
rev -
Returns:
SANE_STATUS_GOOD on success

SANE_Bool sanei_pp_uses_directio ( void   ) 

Check whether for libieee1284 usage.

This function can be used to check if the lib uses libieee1284 or in/out functions directly.

Returns:
SANE_TRUE if we use direct access, SANE_FALSE if the lib uses libieee1284 functions.

SANE_Status sanei_pp_getmodes ( int  fd,
int *  mode 
)

Determine the available parallel port modes for a given device.

Parameters:
fd - handle of the device, whose modes shall be checked for.
mode - pointer to variable, which should receive the modes.
Returns:
SANE_STATUS_GOOD on success.

SANE_Status sanei_pp_setmode ( int  fd,
int  mode 
)

Set the operation mode for a given device.

Parameters:
fd - handle of the device, whose modes shall be set.
mode - mode to set, see sanei_pp_mode.
Returns:
SANE_STATUS_GOOD on success.

SANE_Status sanei_pp_outb_data ( int  fd,
SANE_Byte  val 
)

Write data to ports (spp-data, ctrl, epp-address and epp-data).

Parameters:
fd - handle of device to which shall be written to.
val - data to write.
Returns:
SANE_STATUS_GOOD on success.

SANE_Byte sanei_pp_inb_data ( int  fd  ) 

Read data from ports (spp-data, status, ctrl and epp-data).

Parameters:
fd - handle of device who should be read from.
Returns:
value got from port

void sanei_pp_udelay ( unsigned long  usec  ) 

Delay execution for some micro-seconds.

Please not, that the accuracy highly depends on your system architechture and the time to delay. It is internally implemented as system calls to gettimeofday().

Parameters:
usec - number of micro-seconds to delay


Generated on Mon Jan 31 21:43:30 2011 for SANEI by  doxygen 1.5.6