From 7c1b8b259dd7df8ed1dbd4534e58762dc3103eef Mon Sep 17 00:00:00 2001 From: Gerhard Jaeger Date: Wed, 29 Oct 2003 16:52:11 +0000 Subject: [PATCH] Added functions sanei_pp_set_datadir() and sanei_pp_uses_directio(). Added some documentation. --- include/sane/sanei_pp.h | 65 ++++++++++++++++++++++++++--------------- 1 file changed, 42 insertions(+), 23 deletions(-) diff --git a/include/sane/sanei_pp.h b/include/sane/sanei_pp.h index 5366b5cd5..37d26dbe8 100644 --- a/include/sane/sanei_pp.h +++ b/include/sane/sanei_pp.h @@ -58,70 +58,89 @@ enum sanei_pp_mode { SANEI_PP_MODE_ECP = (1<<8) }; +#define SANEI_PP_DATAIN 1 +#define SANEI_PP_DATAOUT 0 + /** Initialize sanei_pp. * * This function must be called before any other sanei_pp function. */ extern SANE_Status sanei_pp_init( void ); -/** - * Function to open a parport device. +/** Open a parport device. * - * @param dev - - * @param fd - + * @param dev - name of device to open. + * @param fd - pointer to variable that should revceive the handle. * @return */ extern SANE_Status sanei_pp_open( const char *dev, int *fd ); -/** - * Function to close a previously opened parport device. +/* Close a previously opened parport device. * * @param fd - handle of the device to close */ extern void sanei_pp_close( int fd ); -/** - * Function to claim a parport device +/** Claim a parport device * * @param fd - handle of the device to claim * @return */ extern SANE_Status sanei_pp_claim( int fd ); -/** - * Function to release a previously claimed device +/** Release a previously claimed device * * @param fd - handle of the device to release * @return */ extern SANE_Status sanei_pp_release( int fd ); -/** - * @param fd - - * @param mode - - * @return +/** Set the data direction + * + * @param fd - handle of the device, where to change the direction. + * @param rev - + * @return SANE_STATUS_GOOD on success */ -extern SANE_Status sanei_pp_getmode( int fd, int *mode ); +extern SANE_Status sanei_pp_set_datadir( int fd, int rev ); -/** - * @param fd - - * @param val - - * @return +/** Check whether for libieee1284 usage. + * + * This function can be used to check if the lib uses libieee1284 or + * in/out functions directly. + * + * @return SANE_TRUE if we use direct access, SANE_FALSE if the lib uses + * libieee1284 functions. + */ +extern SANE_Bool sanei_pp_uses_directio( void ); + +/** Determine the available parallel port modes for a given device. + * + * @param fd - handle of the device, whose modes shall be checked for. + * @param mode - pointer to variable, which should receive the modes. + * @return SANE_STATUS_GOOD on success. + */ +extern SANE_Status sanei_pp_getmodes( int fd, int *mode ); + +/** Write data to ports (spp-data, ctrl and epp-address) + * + * @param fd - handle of device to which shall be written to. + * @param val - data to write. + * @return SANE_STATUS_GOOD on success. */ extern SANE_Status sanei_pp_outb_data( int fd, SANE_Byte val ); extern SANE_Status sanei_pp_outb_ctrl( int fd, SANE_Byte val ); extern SANE_Status sanei_pp_outb_addr( int fd, SANE_Byte val ); -/** - * @param fd - - * @return +/** Read data from ports (spp-data, status, ctrl and epp-data) + * @param fd - handle of device who should be read from. + * @return value got from port */ extern SANE_Byte sanei_pp_inb_data( int fd ); extern SANE_Byte sanei_pp_inb_stat( int fd ); extern SANE_Byte sanei_pp_inb_ctrl( int fd ); extern SANE_Byte sanei_pp_inb_epp ( int fd ); -/** function to delay execution for some micro-seconds. +/** 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().