1141cc406Sopenharmony_ci/*............................................................................. 2141cc406Sopenharmony_ci * Project : SANE library for Plustek flatbed scanners. 3141cc406Sopenharmony_ci *............................................................................. 4141cc406Sopenharmony_ci */ 5141cc406Sopenharmony_ci 6141cc406Sopenharmony_ci/** @file plustek-usb.h 7141cc406Sopenharmony_ci * @brief Main defines for the USB devices. 8141cc406Sopenharmony_ci * 9141cc406Sopenharmony_ci * Based on sources acquired from Plustek Inc.<br> 10141cc406Sopenharmony_ci * Copyright (C) 2001-2013 Gerhard Jaeger <gerhard@gjaeger.de> 11141cc406Sopenharmony_ci * 12141cc406Sopenharmony_ci * History: 13141cc406Sopenharmony_ci * - 0.40 - starting version of the USB support 14141cc406Sopenharmony_ci * - 0.41 - added workaround flag to struct DevCaps 15141cc406Sopenharmony_ci * - 0.42 - added MODEL_NOPLUSTEK 16141cc406Sopenharmony_ci * - replaced fLM9831 by chip (valid entries: _LM9831, _LM9832, _LM9833) 17141cc406Sopenharmony_ci * - added _WAF_MISC_IO3_LAMP for UMAX 3400 18141cc406Sopenharmony_ci * - 0.43 - added _WAF_MISC_IOx_LAMP (x=1,2,4,5) 19141cc406Sopenharmony_ci * - added CLKDef 20141cc406Sopenharmony_ci * - 0.44 - added vendor and product ID to struct DeviceDef 21141cc406Sopenharmony_ci * - added _WAF_BYPASS_CALIBRATION 22141cc406Sopenharmony_ci * - added _WAF_INV_NEGATIVE_MAP 23141cc406Sopenharmony_ci * - 0.45 - added _WAF_SKIP_FINE for skipping fine calibration 24141cc406Sopenharmony_ci * - added _WAF_SKIP_WHITEFINE for skipping fine white calibration 25141cc406Sopenharmony_ci * - added MCLK setting for 16 bit modes 26141cc406Sopenharmony_ci * - added _WAF_FIX_GAIN and _WAF_FIX_OFS 27141cc406Sopenharmony_ci * - 0.46 - added UMAX1200 for 5400 model 28141cc406Sopenharmony_ci * - removed _WAF_FIX_GAIN and _WAF_FIX_OFS 29141cc406Sopenharmony_ci * - added skipCoarseCalib to ScanDef 30141cc406Sopenharmony_ci * - added additional defines for cis and epson-ccd sensor 31141cc406Sopenharmony_ci * - 0.47 - cleanup work 32141cc406Sopenharmony_ci * - added gamma to struct HWDefault 33141cc406Sopenharmony_ci * - 0.48 - added DEVCAPSFLAG_LargeTPA 34141cc406Sopenharmony_ci * - added _WAF_BIN_FROM_COLOR and _WAF_GRAY_FROM_COLOR 35141cc406Sopenharmony_ci * - added dHighSpeed to struct HwDefault 36141cc406Sopenharmony_ci * - 0.49 - added a_bRegs, fModFirstHome and fLastScanIsAdf 37141cc406Sopenharmony_ci * to struct DeviceDef 38141cc406Sopenharmony_ci * - added CRYSTAL_FREQ 39141cc406Sopenharmony_ci * - added IPCDef 40141cc406Sopenharmony_ci * - 0.50 - cleanup 41141cc406Sopenharmony_ci * - removed obsolete _WAF_BLACKFINE 42141cc406Sopenharmony_ci * - added MODEL_CANON_LIDE25 43141cc406Sopenharmony_ci * - 0.51 - added _WAF_MISC_IO_BUTTONS plus _BUTTON stuff 44141cc406Sopenharmony_ci * - added _WAF_USE_ALT_DESC 45141cc406Sopenharmony_ci * - added DEVCAPSFLAG_SheetFed 46141cc406Sopenharmony_ci * - added dpi_thresh and lineend to motor structure 47141cc406Sopenharmony_ci * - 0.52 - added MODEL_QSCAN 48141cc406Sopenharmony_ci * - added MODEL_QSCAN_A6 (thanks to Hiroshi Miura) 49141cc406Sopenharmony_ci * - changed DCapsDef, lamp -> misc_io 50141cc406Sopenharmony_ci * - bPCB is now ushort to be "missused" by non Plustek 51141cc406Sopenharmony_ci * devices (as threshold for resetting sensor order) 52141cc406Sopenharmony_ci * - added _WAF_LOFF_ON_START and _WAF_ONLY_8BIT 53141cc406Sopenharmony_ci * - added MODEL_TSCAN_A4 54141cc406Sopenharmony_ci * - added attribute packed for data access structs 55141cc406Sopenharmony_ci * - added _WAF_INC_DARKTGT 56141cc406Sopenharmony_ci * . 57141cc406Sopenharmony_ci * <hr> 58141cc406Sopenharmony_ci * This file is part of the SANE package. 59141cc406Sopenharmony_ci * 60141cc406Sopenharmony_ci * This program is free software; you can redistribute it and/or 61141cc406Sopenharmony_ci * modify it under the terms of the GNU General Public License as 62141cc406Sopenharmony_ci * published by the Free Software Foundation; either version 2 of the 63141cc406Sopenharmony_ci * License, or (at your option) any later version. 64141cc406Sopenharmony_ci * 65141cc406Sopenharmony_ci * This program is distributed in the hope that it will be useful, but 66141cc406Sopenharmony_ci * WITHOUT ANY WARRANTY; without even the implied warranty of 67141cc406Sopenharmony_ci * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 68141cc406Sopenharmony_ci * General Public License for more details. 69141cc406Sopenharmony_ci * 70141cc406Sopenharmony_ci * You should have received a copy of the GNU General Public License 71141cc406Sopenharmony_ci * along with this program. If not, see <https://www.gnu.org/licenses/>. 72141cc406Sopenharmony_ci * 73141cc406Sopenharmony_ci * As a special exception, the authors of SANE give permission for 74141cc406Sopenharmony_ci * additional uses of the libraries contained in this release of SANE. 75141cc406Sopenharmony_ci * 76141cc406Sopenharmony_ci * The exception is that, if you link a SANE library with other files 77141cc406Sopenharmony_ci * to produce an executable, this does not by itself cause the 78141cc406Sopenharmony_ci * resulting executable to be covered by the GNU General Public 79141cc406Sopenharmony_ci * License. Your use of that executable is in no way restricted on 80141cc406Sopenharmony_ci * account of linking the SANE library code into it. 81141cc406Sopenharmony_ci * 82141cc406Sopenharmony_ci * This exception does not, however, invalidate any other reasons why 83141cc406Sopenharmony_ci * the executable file might be covered by the GNU General Public 84141cc406Sopenharmony_ci * License. 85141cc406Sopenharmony_ci * 86141cc406Sopenharmony_ci * If you submit changes to SANE to the maintainers to be included in 87141cc406Sopenharmony_ci * a subsequent release, you agree by submitting the changes that 88141cc406Sopenharmony_ci * those changes may be distributed with this exception intact. 89141cc406Sopenharmony_ci * 90141cc406Sopenharmony_ci * If you write modifications of your own for SANE, it is your choice 91141cc406Sopenharmony_ci * whether to permit this exception to apply to your modifications. 92141cc406Sopenharmony_ci * If you do not wish that, delete this exception notice. 93141cc406Sopenharmony_ci * <hr> 94141cc406Sopenharmony_ci */ 95141cc406Sopenharmony_ci#ifndef __PLUSTEK_USB_H__ 96141cc406Sopenharmony_ci#define __PLUSTEK_USB_H__ 97141cc406Sopenharmony_ci 98141cc406Sopenharmony_ci/** CCD ID (PCB ID): total 3 bits (on Plustek devices) */ 99141cc406Sopenharmony_ci#define kNEC3799 0 100141cc406Sopenharmony_ci#define kSONY518 1 101141cc406Sopenharmony_ci#define kSONY548 2 102141cc406Sopenharmony_ci#define kNEC8861 3 103141cc406Sopenharmony_ci#define kNEC3778 4 104141cc406Sopenharmony_ci#define kNECSLIM 5 105141cc406Sopenharmony_ci#define kCIS650 6 106141cc406Sopenharmony_ci#define kCIS670 7 107141cc406Sopenharmony_ci#define kCIS1220 8 108141cc406Sopenharmony_ci#define kCIS1240 9 109141cc406Sopenharmony_ci#define kEPSON 10 110141cc406Sopenharmony_ci 111141cc406Sopenharmony_ci/** 48MHz Quartz */ 112141cc406Sopenharmony_ci#define CRYSTAL_FREQ 48000000UL 113141cc406Sopenharmony_ci 114141cc406Sopenharmony_ci/*********************************** plustek_types.h!!! ************************/ 115141cc406Sopenharmony_ci 116141cc406Sopenharmony_ci/* makes trouble with gcc3 117141cc406Sopenharmony_ci#define _SWAP(x,y) (x)^=(y)^=(x)^=(y) 118141cc406Sopenharmony_ci*/ 119141cc406Sopenharmony_ci#define _SWAP(x,y) { (x)^=(y); (x)^=((y)^=(x));} 120141cc406Sopenharmony_ci 121141cc406Sopenharmony_ci#define _LOWORD(x) ((u_short)(x & 0xffff)) 122141cc406Sopenharmony_ci#define _HIWORD(x) ((u_short)(x >> 16)) 123141cc406Sopenharmony_ci#define _LOBYTE(x) ((u_char)((x) & 0xFF)) 124141cc406Sopenharmony_ci#define _HIBYTE(x) ((u_char)((x) >> 8)) 125141cc406Sopenharmony_ci 126141cc406Sopenharmony_ci#define _HILO2WORD(x) ((u_short)x.bHi * 256U + x.bLo) 127141cc406Sopenharmony_ci#define _LOHI2WORD(x) ((u_short)x.bLo * 256U + x.bHi) 128141cc406Sopenharmony_ci 129141cc406Sopenharmony_ci#define _PHILO2WORD(x) ((u_short)x->bHi * 256U + x->bLo) 130141cc406Sopenharmony_ci#define _PLOHI2WORD(x) ((u_short)x->bLo * 256U + x->bHi) 131141cc406Sopenharmony_ci 132141cc406Sopenharmony_ci#define PACKED8 __attribute__ ((packed,aligned(1))) 133141cc406Sopenharmony_ci#define PACKED16 __attribute__ ((packed,aligned(2))) 134141cc406Sopenharmony_ci 135141cc406Sopenharmony_ci/* useful for RGB-values */ 136141cc406Sopenharmony_citypedef struct { 137141cc406Sopenharmony_ci u_char Red; 138141cc406Sopenharmony_ci u_char Green; 139141cc406Sopenharmony_ci u_char Blue; 140141cc406Sopenharmony_ci} PACKED8 RGBByteDef; 141141cc406Sopenharmony_ci 142141cc406Sopenharmony_citypedef struct { 143141cc406Sopenharmony_ci u_short Red; 144141cc406Sopenharmony_ci u_short Green; 145141cc406Sopenharmony_ci u_short Blue; 146141cc406Sopenharmony_ci} PACKED16 RGBUShortDef; 147141cc406Sopenharmony_ci 148141cc406Sopenharmony_citypedef struct { 149141cc406Sopenharmony_ci u_long Red; 150141cc406Sopenharmony_ci u_long Green; 151141cc406Sopenharmony_ci u_long Blue; 152141cc406Sopenharmony_ci} RGBULongDef; 153141cc406Sopenharmony_ci 154141cc406Sopenharmony_citypedef struct { 155141cc406Sopenharmony_ci u_char a_bColor[3]; 156141cc406Sopenharmony_ci} PACKED8 ColorByteDef; 157141cc406Sopenharmony_ci 158141cc406Sopenharmony_citypedef struct { 159141cc406Sopenharmony_ci u_char bHi; 160141cc406Sopenharmony_ci u_char bLo; 161141cc406Sopenharmony_ci} PACKED8 HiLoDef; 162141cc406Sopenharmony_ci 163141cc406Sopenharmony_citypedef union { 164141cc406Sopenharmony_ci HiLoDef HiLo[3]; 165141cc406Sopenharmony_ci u_short Colors[3]; 166141cc406Sopenharmony_ci} PACKED16 ColorWordDef; 167141cc406Sopenharmony_ci 168141cc406Sopenharmony_citypedef union { 169141cc406Sopenharmony_ci HiLoDef HiLo; 170141cc406Sopenharmony_ci u_short Mono; 171141cc406Sopenharmony_ci} PACKED16 MonoWordDef; 172141cc406Sopenharmony_ci 173141cc406Sopenharmony_citypedef union { 174141cc406Sopenharmony_ci 175141cc406Sopenharmony_ci u_char *pb; 176141cc406Sopenharmony_ci u_short *pw; 177141cc406Sopenharmony_ci MonoWordDef *pmw; 178141cc406Sopenharmony_ci ColorByteDef *pcb; 179141cc406Sopenharmony_ci ColorWordDef *pcw; 180141cc406Sopenharmony_ci RGBByteDef *pb_rgb; 181141cc406Sopenharmony_ci RGBUShortDef *pw_rgb; 182141cc406Sopenharmony_ci HiLoDef *philo; 183141cc406Sopenharmony_ci 184141cc406Sopenharmony_ci} __attribute__ ((aligned(4))) AnyPtr; 185141cc406Sopenharmony_ci 186141cc406Sopenharmony_citypedef struct { 187141cc406Sopenharmony_ci unsigned short x; 188141cc406Sopenharmony_ci unsigned short y; 189141cc406Sopenharmony_ci} XY; 190141cc406Sopenharmony_ci 191141cc406Sopenharmony_ci#define _VAR_NOT_USED(x) ((x)=(x)) 192141cc406Sopenharmony_ci 193141cc406Sopenharmony_ci/*****************************************************************************/ 194141cc406Sopenharmony_ci 195141cc406Sopenharmony_ci#define IDEAL_GainNormal 0xf000UL /* 240 */ 196141cc406Sopenharmony_ci#define IDEAL_GainPositive 0xfe00UL /* 254 */ 197141cc406Sopenharmony_ci#define IDEAL_Offset 0x1000UL /* 20 */ 198141cc406Sopenharmony_ci 199141cc406Sopenharmony_ci#define GAIN_Target 65535UL 200141cc406Sopenharmony_ci 201141cc406Sopenharmony_ci/** Chip-types */ 202141cc406Sopenharmony_citypedef enum _CHIPSET 203141cc406Sopenharmony_ci{ 204141cc406Sopenharmony_ci _LM9831, 205141cc406Sopenharmony_ci _LM9832, 206141cc406Sopenharmony_ci _LM9833 207141cc406Sopenharmony_ci} eChipDef; 208141cc406Sopenharmony_ci 209141cc406Sopenharmony_ci/** ScanParam.bCalibration */ 210141cc406Sopenharmony_cienum _SHADINGID 211141cc406Sopenharmony_ci{ 212141cc406Sopenharmony_ci PARAM_Scan, 213141cc406Sopenharmony_ci PARAM_Gain, 214141cc406Sopenharmony_ci PARAM_DarkShading, 215141cc406Sopenharmony_ci PARAM_WhiteShading, 216141cc406Sopenharmony_ci PARAM_Offset 217141cc406Sopenharmony_ci}; 218141cc406Sopenharmony_ci 219141cc406Sopenharmony_ci/** ScanParam.bDataType */ 220141cc406Sopenharmony_cienum _SCANDATATYPE 221141cc406Sopenharmony_ci{ 222141cc406Sopenharmony_ci SCANDATATYPE_BW, 223141cc406Sopenharmony_ci SCANDATATYPE_Gray, 224141cc406Sopenharmony_ci SCANDATATYPE_Color 225141cc406Sopenharmony_ci}; 226141cc406Sopenharmony_ci 227141cc406Sopenharmony_ci/** DCapsDef.bSensorColor */ 228141cc406Sopenharmony_cienum _SENSORCOLOR 229141cc406Sopenharmony_ci{ 230141cc406Sopenharmony_ci SENSORORDER_rgb, 231141cc406Sopenharmony_ci SENSORORDER_rbg, 232141cc406Sopenharmony_ci SENSORORDER_gbr, 233141cc406Sopenharmony_ci SENSORORDER_grb, 234141cc406Sopenharmony_ci SENSORORDER_brg, 235141cc406Sopenharmony_ci SENSORORDER_bgr 236141cc406Sopenharmony_ci}; 237141cc406Sopenharmony_ci 238141cc406Sopenharmony_ci/** DCapsDef.wFlags */ 239141cc406Sopenharmony_cienum _DEVCAPSFLAG 240141cc406Sopenharmony_ci{ 241141cc406Sopenharmony_ci DEVCAPSFLAG_Normal = 0x0001, 242141cc406Sopenharmony_ci DEVCAPSFLAG_Positive = 0x0002, 243141cc406Sopenharmony_ci DEVCAPSFLAG_Negative = 0x0004, 244141cc406Sopenharmony_ci DEVCAPSFLAG_TPA = 0x0006, 245141cc406Sopenharmony_ci DEVCAPSFLAG_Adf = 0x0008, 246141cc406Sopenharmony_ci DEVCAPSFLAG_LargeTPA = 0x0010, 247141cc406Sopenharmony_ci DEVCAPSFLAG_SheetFed = 0x0020 248141cc406Sopenharmony_ci}; 249141cc406Sopenharmony_ci 250141cc406Sopenharmony_ci/** to allow some workarounds */ 251141cc406Sopenharmony_cienum _WORKAROUNDS 252141cc406Sopenharmony_ci{ 253141cc406Sopenharmony_ci _WAF_NONE = 0x00000000, /* no fix anywhere needed */ 254141cc406Sopenharmony_ci _WAF_BSHIFT7_BUG = 0x00000001, /* to fix U12 bug in 14bit mode */ 255141cc406Sopenharmony_ci _WAF_MISC_IO_LAMPS = 0x00000002, /* special lamp switching */ 256141cc406Sopenharmony_ci _WAF_BLACKFINE = 0x00000004, /* use black calibration strip */ 257141cc406Sopenharmony_ci _WAF_BYPASS_CALIBRATION = 0x00000008, /* no calibration,use linear gamma */ 258141cc406Sopenharmony_ci _WAF_INV_NEGATIVE_MAP = 0x00000010, /* the backend does the neg. stuff */ 259141cc406Sopenharmony_ci _WAF_SKIP_FINE = 0x00000020, /* skip the fine calbration */ 260141cc406Sopenharmony_ci _WAF_SKIP_WHITEFINE = 0x00000040, /* skip the fine white calbration */ 261141cc406Sopenharmony_ci _WAF_BIN_FROM_COLOR = 0x00000080, /* generate binary & gray images */ 262141cc406Sopenharmony_ci _WAF_GRAY_FROM_COLOR = 0x00000100, /* from color scans */ 263141cc406Sopenharmony_ci _WAF_MISC_IO_BUTTONS = 0x00000200, /* special handling for buttons */ 264141cc406Sopenharmony_ci _WAF_USE_ALT_DESC = 0x00000400, /* use alternate manufacturer */ 265141cc406Sopenharmony_ci _WAF_RESET_SO_TO_RGB = 0x00000800, /* set sensororder to RGB(CIS only)*/ 266141cc406Sopenharmony_ci _WAF_LOFF_ON_START = 0x00001000, /* switch lamp off before scanning */ 267141cc406Sopenharmony_ci _WAF_ONLY_8BIT = 0x00002000, /* scanner allows only 8 bit modes */ 268141cc406Sopenharmony_ci _WAF_INC_DARKTGT = 0x00004000 /* allow tgt darklevel adjustment */ 269141cc406Sopenharmony_ci}; 270141cc406Sopenharmony_ci 271141cc406Sopenharmony_ci/** for lamps connected to the misc I/O pins*/ 272141cc406Sopenharmony_cienum _LAMPS 273141cc406Sopenharmony_ci{ 274141cc406Sopenharmony_ci _NO_MIO = 0, 275141cc406Sopenharmony_ci _MIO1 = 0x0001, 276141cc406Sopenharmony_ci _MIO2 = 0x0002, 277141cc406Sopenharmony_ci _MIO3 = 0x0004, 278141cc406Sopenharmony_ci _MIO4 = 0x0008, 279141cc406Sopenharmony_ci _MIO5 = 0x0010, 280141cc406Sopenharmony_ci _MIO6 = 0x0020 281141cc406Sopenharmony_ci}; 282141cc406Sopenharmony_ci 283141cc406Sopenharmony_ci#define _PSENSE_SHIFT 24 284141cc406Sopenharmony_ci#define _PSENSE_MASK 0xFF000000 285141cc406Sopenharmony_ci#define _BUTTON_SHIFT 16 286141cc406Sopenharmony_ci#define _BUTTON_MASK 0xFF0000 287141cc406Sopenharmony_ci#define _TPA_SHIFT 8 288141cc406Sopenharmony_ci#define _TPA_MASK 0xFF00 289141cc406Sopenharmony_ci 290141cc406Sopenharmony_cienum _BUTTONS 291141cc406Sopenharmony_ci{ 292141cc406Sopenharmony_ci _NO_BUTTON = 0, 293141cc406Sopenharmony_ci _PORT0 = ((_MIO1 | _MIO2) << _BUTTON_SHIFT), 294141cc406Sopenharmony_ci _PORT1 = ((_MIO3 | _MIO4) << _BUTTON_SHIFT), 295141cc406Sopenharmony_ci _PORT2 = ((_MIO5 | _MIO6) << _BUTTON_SHIFT) 296141cc406Sopenharmony_ci}; 297141cc406Sopenharmony_ci 298141cc406Sopenharmony_ci#define _PS_INP1 (0x01 << _PSENSE_SHIFT) 299141cc406Sopenharmony_ci#define _PS_INP2 (0x02 << _PSENSE_SHIFT) 300141cc406Sopenharmony_ci#define _PS_INP_MIO1 (_MIO1 << (_PSENSE_SHIFT+2)) 301141cc406Sopenharmony_ci#define _PS_INP_MIO2 (_MIO2 << (_PSENSE_SHIFT+2)) 302141cc406Sopenharmony_ci#define _PS_INP_MIO3 (_MIO3 << (_PSENSE_SHIFT+2)) 303141cc406Sopenharmony_ci#define _PS_INP_MIO4 (_MIO4 << (_PSENSE_SHIFT+2)) 304141cc406Sopenharmony_ci#define _PS_INP_MIO5 (_MIO5 << (_PSENSE_SHIFT+2)) 305141cc406Sopenharmony_ci#define _PS_INP_MIO6 (_MIO6 << (_PSENSE_SHIFT+2)) 306141cc406Sopenharmony_ci 307141cc406Sopenharmony_ci/** for encoding a misc I/O register as TPA */ 308141cc406Sopenharmony_ci#define _TPA(register) ((u_long)(register << _TPA_SHIFT)) 309141cc406Sopenharmony_ci 310141cc406Sopenharmony_ci/** Mask to check for available TPA */ 311141cc406Sopenharmony_ci#define _HAS_TPA(flag) (flag & _TPA_MASK) 312141cc406Sopenharmony_ci 313141cc406Sopenharmony_ci/** Get the TPA misc I/O register */ 314141cc406Sopenharmony_ci#define _GET_TPALAMP(flag) ((flag >> _TPA_SHIFT) & 0xFF) 315141cc406Sopenharmony_ci 316141cc406Sopenharmony_ci/** Get the Papersense port*/ 317141cc406Sopenharmony_ci#define _GET_PAPERSENSE_PORT(flag) ((flag >> _PSENSE_SHIFT) & 0xFF) 318141cc406Sopenharmony_ci 319141cc406Sopenharmony_ci/** motor types */ 320141cc406Sopenharmony_citypedef enum 321141cc406Sopenharmony_ci{ 322141cc406Sopenharmony_ci MODEL_KaoHsiung = 0, 323141cc406Sopenharmony_ci MODEL_HuaLien, 324141cc406Sopenharmony_ci MODEL_Tokyo600, 325141cc406Sopenharmony_ci MODEL_EPSON, /**< for EPSON1250/1260 */ 326141cc406Sopenharmony_ci MODEL_MUSTEK600, /**< for BearPaw 1200 */ 327141cc406Sopenharmony_ci MODEL_MUSTEK1200, /**< for BearPaw 2400 */ 328141cc406Sopenharmony_ci MODEL_HP, /**< for HP2x00 */ 329141cc406Sopenharmony_ci MODEL_CANON600 , /**< for CanoScan 600dpi models */ 330141cc406Sopenharmony_ci MODEL_CANON1200, /**< for Canon 1200dpi models */ 331141cc406Sopenharmony_ci MODEL_CANONCCD1200, /**< for Canon CCD 1200dpi models */ 332141cc406Sopenharmony_ci MODEL_CANON_LIDE25, /**< for CanoScan LiDE25 */ 333141cc406Sopenharmony_ci MODEL_UMAX, /**< for UMAX 3400/3450 */ 334141cc406Sopenharmony_ci MODEL_UMAX1200, /**< for UMAX 5400 */ 335141cc406Sopenharmony_ci MODEL_TSCAN, /**< for Syscan TravelScan A6 */ 336141cc406Sopenharmony_ci MODEL_TSCAN_A4, /**< for Syscan TravelScan A4 */ 337141cc406Sopenharmony_ci MODEL_QSCAN, /**< for PandP Q-Scan A4 */ 338141cc406Sopenharmony_ci MODEL_QSCAN_A6, /**< for PandP Q-Scan A6 */ 339141cc406Sopenharmony_ci MODEL_LAST 340141cc406Sopenharmony_ci} eModelDef; 341141cc406Sopenharmony_ci 342141cc406Sopenharmony_ci/** to distinguish between Plustek and other devices */ 343141cc406Sopenharmony_ci#define _IS_PLUSTEKMOTOR(x) (x<=MODEL_Tokyo600) 344141cc406Sopenharmony_ci 345141cc406Sopenharmony_ci/** Generic usage */ 346141cc406Sopenharmony_cienum _CHANNEL 347141cc406Sopenharmony_ci{ 348141cc406Sopenharmony_ci CHANNEL_red, 349141cc406Sopenharmony_ci CHANNEL_green, 350141cc406Sopenharmony_ci CHANNEL_blue, 351141cc406Sopenharmony_ci CHANNEL_rgb 352141cc406Sopenharmony_ci}; 353141cc406Sopenharmony_ci 354141cc406Sopenharmony_ci/** motor movement */ 355141cc406Sopenharmony_cienum MODULEMOVE 356141cc406Sopenharmony_ci{ 357141cc406Sopenharmony_ci MOVE_Forward, 358141cc406Sopenharmony_ci MOVE_Backward, 359141cc406Sopenharmony_ci MOVE_Both, 360141cc406Sopenharmony_ci MOVE_ToPaperSensor, 361141cc406Sopenharmony_ci MOVE_EjectAllPapers, 362141cc406Sopenharmony_ci MOVE_SkipPaperSensor, 363141cc406Sopenharmony_ci MOVE_ToShading 364141cc406Sopenharmony_ci}; 365141cc406Sopenharmony_ci 366141cc406Sopenharmony_ci/** SCANDEF.dwFlags */ 367141cc406Sopenharmony_cienum SCANFLAG 368141cc406Sopenharmony_ci{ 369141cc406Sopenharmony_ci SCANDEF_Transparency = 0x00000100, /* Scanning from transparency*/ 370141cc406Sopenharmony_ci SCANDEF_Negative = 0x00000200, /* Scanning from negative */ 371141cc406Sopenharmony_ci SCANDEF_QualityScan = 0x00000400, /* Scanning in quality mode */ 372141cc406Sopenharmony_ci SCANDEF_ContinuousScan = 0x00001000, 373141cc406Sopenharmony_ci SCANDEF_Adf = 0x00002000, /* Scan from ADF tray */ 374141cc406Sopenharmony_ci 375141cc406Sopenharmony_ci SCANFLAG_bgr = 0x00004000, 376141cc406Sopenharmony_ci SCANFLAG_BottomUp = 0x00008000, 377141cc406Sopenharmony_ci SCANFLAG_DWORDBoundary = 0x00020000, 378141cc406Sopenharmony_ci SCANFLAG_RightAlign = 0x00040000, 379141cc406Sopenharmony_ci SCANFLAG_StillModule = 0x00080000, 380141cc406Sopenharmony_ci SCANFLAG_Pseudo48 = 0x08000000, 381141cc406Sopenharmony_ci SCANFLAG_SampleY = 0x04000000, 382141cc406Sopenharmony_ci SCANFLAG_Calibration = 0x10000000, 383141cc406Sopenharmony_ci SCANFLAG_Scanning = 0x20020000, 384141cc406Sopenharmony_ci SCANFLAG_StartScan = 0x40000000 385141cc406Sopenharmony_ci}; 386141cc406Sopenharmony_ci 387141cc406Sopenharmony_citypedef struct Origins 388141cc406Sopenharmony_ci{ 389141cc406Sopenharmony_ci long lLeft; /* How many pix to move the scanning org left, in optic res */ 390141cc406Sopenharmony_ci long lUp; /* How many pix to move the scanning or up, in optic res */ 391141cc406Sopenharmony_ci} OrgDef; 392141cc406Sopenharmony_ci 393141cc406Sopenharmony_citypedef struct SrcAttr 394141cc406Sopenharmony_ci{ 395141cc406Sopenharmony_ci XY DataOrigin; /**< The origin x is from visible pixel not CCD */ 396141cc406Sopenharmony_ci /* pixel 0, in 300 DPI base. */ 397141cc406Sopenharmony_ci /* The origin y is from visible top */ 398141cc406Sopenharmony_ci /* (glass area), in 300 DPI */ 399141cc406Sopenharmony_ci short ShadingOriginY; /**< The origin y is from top of scanner body */ 400141cc406Sopenharmony_ci short DarkShadOrgY; /**< if the device has a dark calibration strip */ 401141cc406Sopenharmony_ci XY Size; /**< Scanning width/height, in 300 DPI base. */ 402141cc406Sopenharmony_ci XY MinDpi; /**< Minimum dpi supported for scanning */ 403141cc406Sopenharmony_ci 404141cc406Sopenharmony_ci} SrcAttrDef; 405141cc406Sopenharmony_ci 406141cc406Sopenharmony_citypedef struct DevCaps 407141cc406Sopenharmony_ci{ 408141cc406Sopenharmony_ci SrcAttrDef Normal; /**< Reflection */ 409141cc406Sopenharmony_ci SrcAttrDef Positive; /**< Positive film */ 410141cc406Sopenharmony_ci SrcAttrDef Negative; /**< Negative film */ 411141cc406Sopenharmony_ci SrcAttrDef Adf; /**< Adf device */ 412141cc406Sopenharmony_ci XY OpticDpi; /**< Maximum DPI */ 413141cc406Sopenharmony_ci u_short wFlags; /**< Flag to indicate what kinds of elements */ 414141cc406Sopenharmony_ci /* are available */ 415141cc406Sopenharmony_ci u_char bSensorOrder; /**< CCD color sequences, see _SENSORORDER */ 416141cc406Sopenharmony_ci u_char bSensorDistance; /**< CCD Color distance */ 417141cc406Sopenharmony_ci u_char bButtons; /**< Number of buttons */ 418141cc406Sopenharmony_ci u_char bCCD; /**< CCD ID */ 419141cc406Sopenharmony_ci u_short bPCB; /**< PCB ID/or threshold (only CIS) */ 420141cc406Sopenharmony_ci u_long workaroundFlag; /**< Flag to allow special work arounds, see */ 421141cc406Sopenharmony_ci /* _WORKAROUNDS */ 422141cc406Sopenharmony_ci u_long misc_io; /**< for lamp, papersense and buttons */ 423141cc406Sopenharmony_ci 424141cc406Sopenharmony_ci} DCapsDef; 425141cc406Sopenharmony_ci 426141cc406Sopenharmony_ci/** 427141cc406Sopenharmony_ci * for keeping initial illumination settings 428141cc406Sopenharmony_ci */ 429141cc406Sopenharmony_citypedef struct 430141cc406Sopenharmony_ci{ 431141cc406Sopenharmony_ci u_char mode; 432141cc406Sopenharmony_ci 433141cc406Sopenharmony_ci u_short red_lamp_on; 434141cc406Sopenharmony_ci u_short red_lamp_off; 435141cc406Sopenharmony_ci u_short green_lamp_on; 436141cc406Sopenharmony_ci u_short green_lamp_off; 437141cc406Sopenharmony_ci u_short blue_lamp_on; 438141cc406Sopenharmony_ci u_short blue_lamp_off; 439141cc406Sopenharmony_ci 440141cc406Sopenharmony_ci} IllumiDef; 441141cc406Sopenharmony_ci 442141cc406Sopenharmony_ci 443141cc406Sopenharmony_ci/** basic register settings 444141cc406Sopenharmony_ci */ 445141cc406Sopenharmony_citypedef struct HWDefault 446141cc406Sopenharmony_ci{ 447141cc406Sopenharmony_ci double dMaxMotorSpeed; /* Inches/second, max. scan speed */ 448141cc406Sopenharmony_ci double dMaxMoveSpeed; /* Inches/second, max. move speed */ 449141cc406Sopenharmony_ci double dHighSpeed; /* for speeding up the sensor */ 450141cc406Sopenharmony_ci double dIntegrationTimeLowLamp; 451141cc406Sopenharmony_ci double dIntegrationTimeHighLamp; 452141cc406Sopenharmony_ci u_short wMotorDpi; /* Full step DPI */ 453141cc406Sopenharmony_ci u_short wDRAMSize; /* in KB */ 454141cc406Sopenharmony_ci double dMinIntegrationTimeLowres; /*in ms. */ 455141cc406Sopenharmony_ci double dMinIntegrationTimeHighres; /* in ms. */ 456141cc406Sopenharmony_ci u_short wGreenPWMDutyCycleLow; 457141cc406Sopenharmony_ci u_short wGreenPWMDutyCycleHigh; 458141cc406Sopenharmony_ci /* Registers */ 459141cc406Sopenharmony_ci u_char bSensorConfiguration; /* 0x0b */ 460141cc406Sopenharmony_ci /* Sensor control settings */ 461141cc406Sopenharmony_ci u_char bReg_0x0c; 462141cc406Sopenharmony_ci u_char bReg_0x0d; 463141cc406Sopenharmony_ci u_char bReg_0x0e; 464141cc406Sopenharmony_ci u_char bReg_0x0f_Mono [10]; /* 0x0f to 0x18 */ 465141cc406Sopenharmony_ci u_char bReg_0x0f_Color [10]; /* 0x0f to 0x18 */ 466141cc406Sopenharmony_ci 467141cc406Sopenharmony_ci /* color mode settings */ 468141cc406Sopenharmony_ci u_char bReg_0x26; 469141cc406Sopenharmony_ci u_char bReg_0x27; 470141cc406Sopenharmony_ci 471141cc406Sopenharmony_ci /* illumination mode reg 0x29 (runtime) */ 472141cc406Sopenharmony_ci u_char bReg_0x29; 473141cc406Sopenharmony_ci 474141cc406Sopenharmony_ci /* initial illumination settings */ 475141cc406Sopenharmony_ci IllumiDef illu_mono; 476141cc406Sopenharmony_ci IllumiDef illu_color; 477141cc406Sopenharmony_ci 478141cc406Sopenharmony_ci /* 0x1a & 0x1b, remember the u_char order is not Intel 479141cc406Sopenharmony_ci * format, you have to pay your attention when you 480141cc406Sopenharmony_ci * write this value to register. 481141cc406Sopenharmony_ci */ 482141cc406Sopenharmony_ci u_short StepperPhaseCorrection; 483141cc406Sopenharmony_ci 484141cc406Sopenharmony_ci /* Sensor Pixel Configuration 485141cc406Sopenharmony_ci * Actually, the wActivePixelsStart will be set to 0 for shading purpose. 486141cc406Sopenharmony_ci * We have to keep these values to adjust the origins when user does the 487141cc406Sopenharmony_ci * scan. These settings are based on optic resolution. 488141cc406Sopenharmony_ci */ 489141cc406Sopenharmony_ci u_char bOpticBlackStart; /* 0x1c */ 490141cc406Sopenharmony_ci u_char bOpticBlackEnd; /* 0x1d */ 491141cc406Sopenharmony_ci u_short wActivePixelsStart; /* 0x1e & 0x1f */ 492141cc406Sopenharmony_ci u_short wLineEnd; /* 0x20 & 0x21 */ 493141cc406Sopenharmony_ci 494141cc406Sopenharmony_ci /* illumination settings (runtime) */ 495141cc406Sopenharmony_ci u_short red_lamp_on; /* 0x2c & 0x2d */ 496141cc406Sopenharmony_ci u_short red_lamp_off; /* 0x2e & 0x2f */ 497141cc406Sopenharmony_ci u_short green_lamp_on; /* 0x30 & 0x31 */ 498141cc406Sopenharmony_ci u_short green_lamp_off; /* 0x32 & 0x33 */ 499141cc406Sopenharmony_ci u_short blue_lamp_on; /* 0x34 & 0x35 */ 500141cc406Sopenharmony_ci u_short blue_lamp_off; /* 0x36 & 0x37 */ 501141cc406Sopenharmony_ci 502141cc406Sopenharmony_ci /* Misc */ 503141cc406Sopenharmony_ci u_char bReg_0x45; 504141cc406Sopenharmony_ci u_short wStepsAfterPaperSensor2;/* 0x4c & 0x4d */ 505141cc406Sopenharmony_ci u_char bStepsToReverse; /* 0x50 */ 506141cc406Sopenharmony_ci u_char bReg_0x51; 507141cc406Sopenharmony_ci u_char bReg_0x54; 508141cc406Sopenharmony_ci u_char bReg_0x55; 509141cc406Sopenharmony_ci u_char bReg_0x56; 510141cc406Sopenharmony_ci u_char bReg_0x57; 511141cc406Sopenharmony_ci u_char bReg_0x58; 512141cc406Sopenharmony_ci u_char bReg_0x59; 513141cc406Sopenharmony_ci u_char bReg_0x5a; 514141cc406Sopenharmony_ci u_char bReg_0x5b; 515141cc406Sopenharmony_ci u_char bReg_0x5c; 516141cc406Sopenharmony_ci u_char bReg_0x5d; 517141cc406Sopenharmony_ci u_char bReg_0x5e; 518141cc406Sopenharmony_ci 519141cc406Sopenharmony_ci eChipDef chip; /* chiptype */ 520141cc406Sopenharmony_ci eModelDef motorModel; /* to identify used motor */ 521141cc406Sopenharmony_ci double gamma; /* default gamma setting */ 522141cc406Sopenharmony_ci} HWDef; 523141cc406Sopenharmony_ci 524141cc406Sopenharmony_ci/** device description during runtime 525141cc406Sopenharmony_ci */ 526141cc406Sopenharmony_citypedef struct DeviceDef 527141cc406Sopenharmony_ci{ 528141cc406Sopenharmony_ci char* ModelStr; /**< pointer to our model string */ 529141cc406Sopenharmony_ci int vendor; /**< vendor ID */ 530141cc406Sopenharmony_ci int product; /**< product ID */ 531141cc406Sopenharmony_ci DCapsDef Caps; /**< pointer to the attribute of current dev */ 532141cc406Sopenharmony_ci HWDef HwSetting; /**< Pointer to the characteristics of device */ 533141cc406Sopenharmony_ci SrcAttrDef *pSource; /**< Scanning src, it's equal to Caps.Normal */ 534141cc406Sopenharmony_ci /**< on the source that the user specified. */ 535141cc406Sopenharmony_ci OrgDef Normal; /**< Reflection - Pix to adjust scanning orgs */ 536141cc406Sopenharmony_ci OrgDef Positive; /**< Pos film - Pix to adjust scanning orgs */ 537141cc406Sopenharmony_ci OrgDef Negative; /**< Neg film - Pix to adjust scanning orgs */ 538141cc406Sopenharmony_ci OrgDef Adf; /**< Adf - Pixels to adjust scanning origins */ 539141cc406Sopenharmony_ci u_long dwTicksLampOn; /**< The ticks when lamp turns on */ 540141cc406Sopenharmony_ci u_long dwLampOnPeriod;/**< How many seconds to keep lamp on */ 541141cc406Sopenharmony_ci SANE_Bool bLampOffOnEnd; /**< switch lamp off on end or keep cur. state*/ 542141cc406Sopenharmony_ci int currentLamp; /**< The lamp ID of the currently used lamp */ 543141cc406Sopenharmony_ci SANE_Bool fModFirstHome; /**< */ 544141cc406Sopenharmony_ci SANE_Bool fLastScanIsAdf;/**< */ 545141cc406Sopenharmony_ci u_char a_bRegs[0x80]; /**< our global register file */ 546141cc406Sopenharmony_ci 547141cc406Sopenharmony_ci} DeviceDef; 548141cc406Sopenharmony_ci 549141cc406Sopenharmony_ci 550141cc406Sopenharmony_citypedef struct Settings 551141cc406Sopenharmony_ci{ 552141cc406Sopenharmony_ci char *pIDString; 553141cc406Sopenharmony_ci DCapsDef *pDevCaps; 554141cc406Sopenharmony_ci HWDef *pHwDef; 555141cc406Sopenharmony_ci char *pModelString; 556141cc406Sopenharmony_ci 557141cc406Sopenharmony_ci} SetDef; 558141cc406Sopenharmony_ci 559141cc406Sopenharmony_ci/** 560141cc406Sopenharmony_ci */ 561141cc406Sopenharmony_citypedef struct 562141cc406Sopenharmony_ci{ 563141cc406Sopenharmony_ci /** User Information */ 564141cc406Sopenharmony_ci u_long dwBytes; /**< bytes per line */ 565141cc406Sopenharmony_ci u_long dwPixels; /**< pixels per line */ 566141cc406Sopenharmony_ci u_long dwLines; /**< lines */ 567141cc406Sopenharmony_ci 568141cc406Sopenharmony_ci /** Driver Info */ 569141cc406Sopenharmony_ci u_long dwValidPixels; /**< only valid pixels, not incl. pad pix(B/W,Gray)*/ 570141cc406Sopenharmony_ci u_long dwPhyPixels; /**< include pad pixels for ASIC (B/W, Gray) */ 571141cc406Sopenharmony_ci u_long dwPhyBytes; /**< bytes to read from ASIC */ 572141cc406Sopenharmony_ci u_long dwPhyLines; /**< should include the extra lines accord to the */ 573141cc406Sopenharmony_ci /* request dpi (CCD lines distance) */ 574141cc406Sopenharmony_ci u_long dwTotalBytes; /**< Total bytes per scan */ 575141cc406Sopenharmony_ci 576141cc406Sopenharmony_ci} WinInfo; 577141cc406Sopenharmony_ci 578141cc406Sopenharmony_ci/** 579141cc406Sopenharmony_ci */ 580141cc406Sopenharmony_citypedef struct 581141cc406Sopenharmony_ci{ 582141cc406Sopenharmony_ci /* OUTPUT - Driver returned area. All are based on physical 583141cc406Sopenharmony_ci * scanning conditions. */ 584141cc406Sopenharmony_ci WinInfo Size; /* i/p: 585141cc406Sopenharmony_ci * dwPixels, dwBytes(without u_long boundary factor) 586141cc406Sopenharmony_ci * dwLines in user specified dpi 587141cc406Sopenharmony_ci * o/p: 588141cc406Sopenharmony_ci * dwPhyPixels, dwPhyBytes, dwPhyLines 589141cc406Sopenharmony_ci * so after called, caller have to change it */ 590141cc406Sopenharmony_ci XY PhyDpi; /* Driver DPI */ 591141cc406Sopenharmony_ci 592141cc406Sopenharmony_ci /* INPUT - User info. All sizes and coordinates are specified in the 593141cc406Sopenharmony_ci * unit based on 300 DPI */ 594141cc406Sopenharmony_ci XY UserDpi; /**< User specified DPI */ 595141cc406Sopenharmony_ci XY Origin; /**< Scanning origin in optic dpi */ 596141cc406Sopenharmony_ci double dMCLK; /**< for positive & negative & Adf */ 597141cc406Sopenharmony_ci short brightness; 598141cc406Sopenharmony_ci short contrast; 599141cc406Sopenharmony_ci u_char bSource; /**< Reflection/Positive/Negative/Adf(SOURCE_xxx)*/ 600141cc406Sopenharmony_ci u_char bDataType; /**< Bw, Gray or Color (see _SCANDATATYPE) */ 601141cc406Sopenharmony_ci u_char bBitDepth; /**< 1/8/14 */ 602141cc406Sopenharmony_ci u_char bChannels; /**< Color or Gray */ 603141cc406Sopenharmony_ci u_char bCalibration; /**< 1 or 2: the origin.x is from CCD pixel 0 and 604141cc406Sopenharmony_ci * the origin.y is from Top of scanner. 605141cc406Sopenharmony_ci * In this case, the WININFO.dwPhyLines 606141cc406Sopenharmony_ci * will not included the extra lines for 607141cc406Sopenharmony_ci * color distance factor. 608141cc406Sopenharmony_ci * 0: normal scan, the both directions have to 609141cc406Sopenharmony_ci * add the distance */ 610141cc406Sopenharmony_ci int swOffset[3]; /**< for calibration adjustment */ 611141cc406Sopenharmony_ci int swGain[3]; /**< for calibration adjustment */ 612141cc406Sopenharmony_ci 613141cc406Sopenharmony_ci} ScanParam; 614141cc406Sopenharmony_ci 615141cc406Sopenharmony_cistruct Plustek_Device; 616141cc406Sopenharmony_ci 617141cc406Sopenharmony_ci/** structure to hold all necessary buffer information for current scan 618141cc406Sopenharmony_ci */ 619141cc406Sopenharmony_citypedef struct ScanDef 620141cc406Sopenharmony_ci{ 621141cc406Sopenharmony_ci SANE_Bool fCalibrated; /**< calibrated or not */ 622141cc406Sopenharmony_ci SANE_Bool skipCoarseCalib;/**< skip coarse calibration or not */ 623141cc406Sopenharmony_ci u_long dwFlag; /**< scan attributes */ 624141cc406Sopenharmony_ci 625141cc406Sopenharmony_ci ScanParam sParam; /**< all we need to scan */ 626141cc406Sopenharmony_ci 627141cc406Sopenharmony_ci AnyPtr UserBuf; /**< pointer to the user buffer */ 628141cc406Sopenharmony_ci u_long dwLinesUser; /**< Number of lines of user buffer */ 629141cc406Sopenharmony_ci u_long dwBytesLine; /**< Bytes per line of user buffer. */ 630141cc406Sopenharmony_ci u_long dwLinesToProcess; 631141cc406Sopenharmony_ci 632141cc406Sopenharmony_ci /** Image processing routine according to the scan mode */ 633141cc406Sopenharmony_ci void (*pfnProcess)(struct Plustek_Device*); 634141cc406Sopenharmony_ci 635141cc406Sopenharmony_ci u_long* pScanBuffer; /**< our scan buffer */ 636141cc406Sopenharmony_ci 637141cc406Sopenharmony_ci u_long dwLinesPerScanBufs; 638141cc406Sopenharmony_ci u_long dwNumberOfScanBufs; 639141cc406Sopenharmony_ci u_long dwLinesScanBuf; 640141cc406Sopenharmony_ci 641141cc406Sopenharmony_ci u_char* pbScanBufBegin; 642141cc406Sopenharmony_ci u_char* pbScanBufEnd; 643141cc406Sopenharmony_ci u_char* pbGetDataBuf; 644141cc406Sopenharmony_ci u_long dwBytesScanBuf; 645141cc406Sopenharmony_ci u_long dwLinesDiscard; 646141cc406Sopenharmony_ci 647141cc406Sopenharmony_ci u_long dwRedShift; 648141cc406Sopenharmony_ci u_long dwGreenShift; 649141cc406Sopenharmony_ci u_long dwBlueShift; 650141cc406Sopenharmony_ci 651141cc406Sopenharmony_ci AnyPtr Green; 652141cc406Sopenharmony_ci AnyPtr Red; 653141cc406Sopenharmony_ci AnyPtr Blue; 654141cc406Sopenharmony_ci 655141cc406Sopenharmony_ci long lBufAdjust; /**< bytes to adjust buffer pointer */ 656141cc406Sopenharmony_ci /* after a image line processed */ 657141cc406Sopenharmony_ci u_short wSumY; /**< for line sampling */ 658141cc406Sopenharmony_ci 659141cc406Sopenharmony_ci u_char bLineDistance; /**< Color offset in specific dpi y */ 660141cc406Sopenharmony_ci int fGrayFromColor; /**< channel to use for gray mode */ 661141cc406Sopenharmony_ci 662141cc406Sopenharmony_ci u_char bLinesToSkip; /**< how many lines to skip at start */ 663141cc406Sopenharmony_ci 664141cc406Sopenharmony_ci} ScanDef; 665141cc406Sopenharmony_ci 666141cc406Sopenharmony_ci 667141cc406Sopenharmony_ci/** max number of different colck settings */ 668141cc406Sopenharmony_ci#define _MAX_CLK 10 669141cc406Sopenharmony_ci 670141cc406Sopenharmony_ci/** structure to hold PWN settings 671141cc406Sopenharmony_ci */ 672141cc406Sopenharmony_citypedef struct 673141cc406Sopenharmony_ci{ 674141cc406Sopenharmony_ci u_char pwm; /**< PWM */ 675141cc406Sopenharmony_ci u_char pwm_duty; /**< PWM duty cycles */ 676141cc406Sopenharmony_ci u_char scan_lines_per_line; /**< lines to scan to obtain 1 real line 677141cc406Sopenharmony_ci will be used in 16bit color modes only */ 678141cc406Sopenharmony_ci} MDef; 679141cc406Sopenharmony_ci 680141cc406Sopenharmony_ci/** according to the CCD and motor, we provide various settings 681141cc406Sopenharmony_ci */ 682141cc406Sopenharmony_citypedef struct { 683141cc406Sopenharmony_ci 684141cc406Sopenharmony_ci eModelDef motorModel; /**< the motor ID */ 685141cc406Sopenharmony_ci 686141cc406Sopenharmony_ci u_char pwm_fast; /**< PWM during fast movement */ 687141cc406Sopenharmony_ci u_char pwm_duty_fast; /**< PWM duty during fast movement */ 688141cc406Sopenharmony_ci u_char mclk_fast; /**< MCLK during fast movement */ 689141cc406Sopenharmony_ci 690141cc406Sopenharmony_ci u_short dpi_thresh; 691141cc406Sopenharmony_ci u_short lineend; 692141cc406Sopenharmony_ci 693141cc406Sopenharmony_ci /** 694141cc406Sopenharmony_ci * here we define some ranges for better supporting 695141cc406Sopenharmony_ci * non-Plustek devices with it's different hardware 696141cc406Sopenharmony_ci * we can set the MCLK and the motor PWM stuff for color 697141cc406Sopenharmony_ci * and gray modes (8bit and 14/16bit modes) 698141cc406Sopenharmony_ci * 0 1 2 3 4 5 6 7 8 9 699141cc406Sopenharmony_ci * <= 75 <=100 <=150 <=200 <=300 <=400 <=600 <= 800 <=1200 <=2400DPI 700141cc406Sopenharmony_ci */ 701141cc406Sopenharmony_ci MDef motor_sets[_MAX_CLK]; /**< motor PWM settings during scan */ 702141cc406Sopenharmony_ci double color_mclk_8[_MAX_CLK]; /**< MCLK settings for color scan */ 703141cc406Sopenharmony_ci double color_mclk_16[_MAX_CLK]; /**< MCLK settings for color (16bit) scan*/ 704141cc406Sopenharmony_ci double gray_mclk_8[_MAX_CLK]; /**< MCLK settings for gray scan */ 705141cc406Sopenharmony_ci double gray_mclk_16[_MAX_CLK]; /**< MCLK settings for gray (16bit) scan */ 706141cc406Sopenharmony_ci 707141cc406Sopenharmony_ci} ClkMotorDef; 708141cc406Sopenharmony_ci 709141cc406Sopenharmony_ci/** for transferring some info between child and parent after calibration 710141cc406Sopenharmony_ci */ 711141cc406Sopenharmony_ci#define _MAX_SHAD 0x4000 712141cc406Sopenharmony_ci#define _SHADING_BUF (_MAX_SHAD*3) /**< max size of the shading buffer */ 713141cc406Sopenharmony_ci 714141cc406Sopenharmony_citypedef struct { 715141cc406Sopenharmony_ci u_long transferRate; 716141cc406Sopenharmony_ci} IPCDef; 717141cc406Sopenharmony_ci 718141cc406Sopenharmony_ci#endif /* guard __PLUSTEK_USB_H__ */ 719141cc406Sopenharmony_ci 720141cc406Sopenharmony_ci/* END PLUSTEK-USB.H ........................................................*/ 721