| 
									
										
										
										
											2000-08-12 15:11:46 +00:00
										 |  |  | /* sane - Scanner Access Now Easy.
 | 
					
						
							| 
									
										
										
										
											2003-06-06 09:52:04 +00:00
										 |  |  |    Copyright (C) 2000-2003 Jochen Eisinger <jochen.eisinger@gmx.net> | 
					
						
							| 
									
										
										
										
											2000-08-12 15:11:46 +00:00
										 |  |  |    This file is part of the SANE package. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    This program is free software; you can redistribute it and/or | 
					
						
							|  |  |  |    modify it under the terms of the GNU General Public License as | 
					
						
							|  |  |  |    published by the Free Software Foundation; either version 2 of the | 
					
						
							|  |  |  |    License, or (at your option) any later version. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    This program is distributed in the hope that it will be useful, but | 
					
						
							|  |  |  |    WITHOUT ANY WARRANTY; without even the implied warranty of | 
					
						
							|  |  |  |    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU | 
					
						
							|  |  |  |    General Public License for more details. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    You should have received a copy of the GNU General Public License | 
					
						
							|  |  |  |    along with this program; if not, write to the Free Software | 
					
						
							|  |  |  |    Foundation, Inc., 59 Temple Place - Suite 330, Boston, | 
					
						
							|  |  |  |    MA 02111-1307, USA. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    As a special exception, the authors of SANE give permission for | 
					
						
							|  |  |  |    additional uses of the libraries contained in this release of SANE. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    The exception is that, if you link a SANE library with other files | 
					
						
							|  |  |  |    to produce an executable, this does not by itself cause the | 
					
						
							|  |  |  |    resulting executable to be covered by the GNU General Public | 
					
						
							|  |  |  |    License.  Your use of that executable is in no way restricted on | 
					
						
							|  |  |  |    account of linking the SANE library code into it. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    This exception does not, however, invalidate any other reasons why | 
					
						
							|  |  |  |    the executable file might be covered by the GNU General Public | 
					
						
							|  |  |  |    License. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    If you submit changes to SANE to the maintainers to be included in | 
					
						
							|  |  |  |    a subsequent release, you agree by submitting the changes that | 
					
						
							|  |  |  |    those changes may be distributed with this exception intact. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    If you write modifications of your own for SANE, it is your choice | 
					
						
							|  |  |  |    whether to permit this exception to apply to your modifications. | 
					
						
							|  |  |  |    If you do not wish that, delete this exception notice.  | 
					
						
							| 
									
										
										
										
											2002-04-11 19:46:31 +00:00
										 |  |  | */ | 
					
						
							| 
									
										
										
										
											2000-08-12 15:11:46 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2002-04-11 19:46:31 +00:00
										 |  |  | /** @file sanei_pa4s2.h
 | 
					
						
							|  |  |  |  * This file implements an interface for the Mustek PP chipset A4S2  | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @sa sanei_usb.h, sanei_ab306.h, sanei_lm983x.h, sanei_scsi.h, sanei_pio.h | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2000-08-12 15:11:46 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | #ifndef sanei_pa4s2_h
 | 
					
						
							|  |  |  | #define sanei_pa4s2_h
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <sys/types.h>
 | 
					
						
							|  |  |  | #include <sane/sane.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2002-04-11 19:46:31 +00:00
										 |  |  | /** @name Options to control interface operations */ | 
					
						
							|  |  |  | /* @{ */ | 
					
						
							| 
									
										
										
										
											2000-08-12 15:11:46 +00:00
										 |  |  | #define SANEI_PA4S2_OPT_DEFAULT		0	/* normal mode */
 | 
					
						
							|  |  |  | #define SANEI_PA4S2_OPT_TRY_MODE_UNI	1	/* enable UNI protocoll */
 | 
					
						
							|  |  |  | #define SANEI_PA4S2_OPT_ALT_LOCK	2	/* use alternative lock cmd */
 | 
					
						
							| 
									
										
										
										
											2005-04-10 11:53:16 +00:00
										 |  |  | #define SANEI_PA4S2_OPT_NO_EPP		4	/* do not try to use EPP */
 | 
					
						
							| 
									
										
										
										
											2002-04-11 19:46:31 +00:00
										 |  |  | /* @} */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-06-06 09:52:04 +00:00
										 |  |  | /** Get list of possibly available devices
 | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Returns a list of arguments accepted as *dev by sanei_pa4s2_open | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @return | 
					
						
							|  |  |  |  *  - array of known *devs. The last entry is marked as NULL pointer. The | 
					
						
							|  |  |  |  *    user has to make sure, the array, but not the entries are freed. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @sa sanei_pa4s2_open | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2004-04-06 18:02:57 +00:00
										 |  |  | extern const char ** sanei_pa4s2_devices(void); | 
					
						
							| 
									
										
										
										
											2003-06-06 09:52:04 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2002-04-11 19:46:31 +00:00
										 |  |  | /** Open pa4s2 device 
 | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Opens *dev as pa4s2 device. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @param dev IO port address ("0x378", "0x278", or "0x3BC") | 
					
						
							|  |  |  |  * @param fd file descriptor | 
					
						
							|  |  |  |  *  | 
					
						
							|  |  |  |  * @return  | 
					
						
							|  |  |  |  * - SANE_STATUS_GOOD - on success | 
					
						
							|  |  |  |  * - SANE_STATUS_INVAL - if no scanner was found or the port number was wrong | 
					
						
							|  |  |  |  * - SANE_STATUS_DEVICE_BUSY - if the device is already in use | 
					
						
							|  |  |  |  * - SANE_STATUS_IO_ERROR - if the port couldn't be accessed | 
					
						
							|  |  |  |  *  | 
					
						
							| 
									
										
										
										
											2000-08-12 15:11:46 +00:00
										 |  |  |  */ | 
					
						
							|  |  |  | extern SANE_Status sanei_pa4s2_open (const char *dev, int *fd); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-12-25 20:27:49 +00:00
										 |  |  | /** Open pa4s2 SCSI-over-parallel device 
 | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Opens *dev as pa4s2 SCSI-over-parallel device. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @param dev IO port address ("0x378", "0x278", or "0x3BC") | 
					
						
							|  |  |  |  * @param fd file descriptor | 
					
						
							|  |  |  |  *  | 
					
						
							|  |  |  |  * @return  | 
					
						
							|  |  |  |  * - SANE_STATUS_GOOD - on success | 
					
						
							|  |  |  |  * - SANE_STATUS_INVAL - if no scanner was found or the port number was wrong | 
					
						
							|  |  |  |  * - SANE_STATUS_DEVICE_BUSY - if the device is already in use | 
					
						
							|  |  |  |  * - SANE_STATUS_IO_ERROR - if the port couldn't be accessed | 
					
						
							|  |  |  |  *  | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | extern SANE_Status sanei_pa4s2_scsi_pp_open (const char *dev, int *fd); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2002-04-11 19:46:31 +00:00
										 |  |  | /** Close pa4s2 device 
 | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @param fd file descriptor | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2000-08-12 15:11:46 +00:00
										 |  |  | extern void sanei_pa4s2_close (int fd); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2002-04-11 19:46:31 +00:00
										 |  |  | /** Set/get options
 | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Sets/gets interface options. Options will be taken over, when set is | 
					
						
							|  |  |  |  * SANE_TRUE. These options should be set before the first device is opened | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @param options pointer to options | 
					
						
							|  |  |  |  * @param set set (SANE_TRUE) or get (SANE_FALSE) options | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @return | 
					
						
							|  |  |  |  * - SANE_STATUS_GOOD - on success | 
					
						
							| 
									
										
										
										
											2000-08-12 15:11:46 +00:00
										 |  |  |  */ | 
					
						
							|  |  |  | extern SANE_Status sanei_pa4s2_options (u_int * options, int set); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2002-04-11 19:46:31 +00:00
										 |  |  | /** Enables/disable device
 | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * When the device is disabled, the printer can be accessed, when it's enabled | 
					
						
							|  |  |  |  * data can be read/written. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @param fd file descriptor | 
					
						
							|  |  |  |  * @param enable enable (SANE_TRUE) or disable (SANE_FALSE) device | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @return | 
					
						
							|  |  |  |  * - SANE_STATUS_GOOD - on success | 
					
						
							|  |  |  |  * - SANE_STATUS_INVAL - if fd is invalid or device not in use | 
					
						
							| 
									
										
										
										
											2000-08-12 15:11:46 +00:00
										 |  |  |  */ | 
					
						
							|  |  |  | extern SANE_Status sanei_pa4s2_enable (int fd, int enable); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2002-04-11 19:46:31 +00:00
										 |  |  | /** Select a register
 | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * The function to read a register is split up in three parts, so a register | 
					
						
							|  |  |  |  * can be read more than once. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @param fd file descriptor | 
					
						
							|  |  |  |  * @param reg register | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @return | 
					
						
							|  |  |  |  * - SANE_STATUS_GOOD - on success | 
					
						
							|  |  |  |  * - SANE_STATUS_INVAL - if fd is invalid or device not in use | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @sa sanei_pa4s2_readbyte(), sanei_pa4s2_readend() | 
					
						
							| 
									
										
										
										
											2000-08-12 15:11:46 +00:00
										 |  |  |  */ | 
					
						
							|  |  |  | extern SANE_Status sanei_pa4s2_readbegin (int fd, u_char reg); | 
					
						
							| 
									
										
										
										
											2002-04-11 19:46:31 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-12-25 20:27:49 +00:00
										 |  |  | /** Return port status information
 | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @param fd file descriptor | 
					
						
							|  |  |  |  * @param status variable to receive status | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @return | 
					
						
							|  |  |  |  * - SANE_STATUS_GOOD - on success | 
					
						
							|  |  |  |  * - SANE_STATUS_INVAL - if fd is invalid or device not in use | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | extern SANE_Status sanei_pa4s2_scsi_pp_get_status (int fd, u_char *status); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /** Selects a register number on a SCSI-over-parallel scanner
 | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @param fd file descriptor | 
					
						
							|  |  |  |  * @param reg register number | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @return | 
					
						
							|  |  |  |  * - SANE_STATUS_GOOD - on success | 
					
						
							|  |  |  |  * - SANE_STATUS_INVAL - if fd is invalid | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | extern SANE_Status sanei_pa4s2_scsi_pp_reg_select (int fd, int reg); | 
					
						
							| 
									
										
										
										
											2002-04-11 19:46:31 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | /** Read a register 
 | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * The function to read a register is split up in three parts, so a register | 
					
						
							|  |  |  |  * can be read more than once. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @param fd file descriptor | 
					
						
							|  |  |  |  * @param val pointer to value | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @return | 
					
						
							|  |  |  |  * - SANE_STATUS_GOOD - on success | 
					
						
							|  |  |  |  * - SANE_STATUS_INVAL - if fd is invalid or device not in use | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @sa sanei_pa4s2_readbegin(), sanei_pa4s2_readend() | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2000-08-12 15:11:46 +00:00
										 |  |  | extern SANE_Status sanei_pa4s2_readbyte (int fd, u_char * val); | 
					
						
							| 
									
										
										
										
											2002-04-11 19:46:31 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | /** Terminate reading sequence 
 | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * The function to read a register is split up in three parts, so a register | 
					
						
							|  |  |  |  * can be read more than once. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @param fd file descriptor | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @return | 
					
						
							|  |  |  |  * - SANE_STATUS_GOOD - on success | 
					
						
							|  |  |  |  * - SANE_STATUS_INVAL - if fd is invalid or device not in use | 
					
						
							|  |  |  |  * @sa sanei_pa4s2_readbegin(), sanei_pa4s2_readbyte() | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2000-08-12 15:11:46 +00:00
										 |  |  | extern SANE_Status sanei_pa4s2_readend (int fd); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2002-04-11 19:46:31 +00:00
										 |  |  | /** Write a register
 | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @param fd file descriptor | 
					
						
							|  |  |  |  * @param reg register | 
					
						
							|  |  |  |  * @param val value to be written | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @return | 
					
						
							|  |  |  |  * - SANE_STATUS_GOOD - on success | 
					
						
							|  |  |  |  * - SANE_STATUS_INVAL - if fd is invalid or device not in use | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2000-08-12 15:11:46 +00:00
										 |  |  | extern SANE_Status sanei_pa4s2_writebyte (int fd, u_char reg, u_char val); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #endif
 |