SANEI 1.3.1.76-0750
Macros | Enumerations | Functions
sanei_pp.h File Reference

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

Go to the source code of this file.

Macros

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

Detailed Description

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

See also
sanei_pp.h

Enumeration Type Documentation

◆ sanei_pp_mode

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

◆ sanei_pp_init()

SANE_Status sanei_pp_init ( void  )

Initialize sanei_pp.

This function must be called before any other sanei_pp function.

◆ sanei_pp_open()

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

◆ sanei_pp_claim()

SANE_Status sanei_pp_claim ( int  fd)

Claim a parport device.

Parameters
fd- handle of the device to claim
Returns

◆ sanei_pp_release()

SANE_Status sanei_pp_release ( int  fd)

Release a previously claimed device.

Parameters
fd- handle of the device to release
Returns

◆ sanei_pp_set_datadir()

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

◆ sanei_pp_uses_directio()

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.

◆ sanei_pp_getmodes()

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.

◆ sanei_pp_setmode()

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.

◆ sanei_pp_outb_data()

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.

◆ sanei_pp_inb_data()

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

◆ sanei_pp_udelay()

void sanei_pp_udelay ( unsigned long  usec)

Delay execution for some micro-seconds.

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

Parameters
usec- number of micro-seconds to delay