1 /* 2 Copyright (C) 2001 Bertrik Sikken (bertrik@zonnet.nl) 3 4 This program is free software; you can redistribute it and/or 5 modify it under the terms of the GNU General Public License 6 as published by the Free Software Foundation; either version 2 7 of the License, or (at your option) any later version. 8 9 This program is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 GNU General Public License for more details. 13 14 You should have received a copy of the GNU General Public License 15 along with this program. If not, see <https://www.gnu.org/licenses/>. 16 */ 17 18 /* 19 Provides a simple interface to read and write data from the scanner, 20 without any knowledge whether it's a parallel or USB scanner 21 */ 22 23 #ifndef _NIASH_XFER_H_ 24 #define _NIASH_XFER_H_ 25 26 #include <stdio.h> /* for FILE * */ 27 28 /* register codes for the USB - IEEE1284 bridge */ 29 #define USB_SETUP 0x82 30 #define EPP_ADDR 0x83 31 #define EPP_DATA_READ 0x84 32 #define EPP_DATA_WRITE 0x85 33 #define SPP_STATUS 0x86 34 #define SPP_CONTROL 0x87 35 #define SPP_DATA 0x88 36 37 38 typedef enum 39 { 40 eUnknownModel = 0, 41 eHp3300c, 42 eHp3400c, 43 eHp4300c, 44 eAgfaTouch 45 } EScannerModel; 46 47 48 typedef struct 49 { 50 char *pszVendor; 51 char *pszName; 52 int iVendor; 53 int iProduct; 54 EScannerModel eModel; 55 } TScannerModel; 56 57 58 typedef int (TFnReportDevice) (TScannerModel * pModel, 59 const char *pszDeviceName); 60 61 62 /* Creates our own DBG definitions, externs are define in main.c*/ 63 #ifndef WITH_NIASH 64 #define DBG fprintf 65 extern FILE *DBG_MSG; 66 extern FILE *DBG_ERR; 67 extern FILE *BG_ASSERT; 68 #endif /* NO WITH_NIASH */ 69 70 /* we do not make data prototypes */ 71 #ifndef WITH_NIASH 72 /* list of supported models, the actual list is in niash_xfer.c */ 73 extern TScannerModel ScannerModels[]; 74 #endif /* NO WITH_NIASH */ 75 76 STATIC void NiashXferInit (TFnReportDevice * pfnReport); 77 STATIC int NiashXferOpen (const char *pszName, EScannerModel * peModel); 78 STATIC void NiashXferClose (int iXferHandle); 79 80 STATIC void NiashWriteReg (int iXferHandle, unsigned char bReg, 81 unsigned char bData); 82 STATIC void NiashReadReg (int iXferHandle, unsigned char bReg, 83 unsigned char *pbData); 84 STATIC void NiashWriteBulk (int iXferHandle, unsigned char *pabBuf, 85 int iSize); 86 STATIC void NiashReadBulk (int iXferHandle, unsigned char *pabBuf, int iSize); 87 STATIC void NiashWakeup (int iXferHandle); 88 89 STATIC SANE_Bool MatchUsbDevice (int iVendor, int iProduct, 90 TScannerModel ** ppeModel); 91 92 #endif /* _NIASH_XFER_H_ */ 93