merge-requests/1/head
Gerhard Jaeger 2005-08-15 14:55:24 +00:00
rodzic b3d68531d4
commit 3290aae207
7 zmienionych plików z 190 dodań i 187 usunięć

Wyświetl plik

@ -37,6 +37,7 @@
* to struct DeviceDef * to struct DeviceDef
* - added CRYSTAL_FREQ * - added CRYSTAL_FREQ
* - added IPCDef * - added IPCDef
* - 0.50 - cleanup
* . * .
* <hr> * <hr>
* This file is part of the SANE package. * This file is part of the SANE package.
@ -117,56 +118,56 @@ typedef struct {
u_char Red; u_char Red;
u_char Green; u_char Green;
u_char Blue; u_char Blue;
} RGBByteDef, *pRGBByteDef; } RGBByteDef;
typedef struct { typedef struct {
u_short Red; u_short Red;
u_short Green; u_short Green;
u_short Blue; u_short Blue;
} RGBUShortDef, *pRGBUShortDef; } RGBUShortDef;
typedef struct { typedef struct {
u_long Red; u_long Red;
u_long Green; u_long Green;
u_long Blue; u_long Blue;
} RGBULongDef, *pRGBULongDef; } RGBULongDef;
typedef struct { typedef struct {
u_char a_bColor[3]; u_char a_bColor[3];
} ColorByteDef, *pColorByteDef; } ColorByteDef;
typedef struct { typedef struct {
u_char bHi; u_char bHi;
u_char bLo; u_char bLo;
} HiLoDef, *pHiLoDef; } HiLoDef;
typedef union { typedef union {
HiLoDef HiLo[3]; HiLoDef HiLo[3];
u_short Colors[3]; u_short Colors[3];
} ColorWordDef, *pColorWordDef; } ColorWordDef;
typedef union { typedef union {
HiLoDef HiLo; HiLoDef HiLo;
u_short Mono; u_short Mono;
} MonoWordDef, *pMonoWordDef; } MonoWordDef;
typedef union { typedef union {
u_char *pb; u_char *pb;
u_short *pw; u_short *pw;
pMonoWordDef pmw; MonoWordDef *pmw;
pColorByteDef pcb; ColorByteDef *pcb;
pColorWordDef pcw; ColorWordDef *pcw;
pRGBByteDef pb_rgb; RGBByteDef *pb_rgb;
pRGBUShortDef pw_rgb; RGBUShortDef *pw_rgb;
pHiLoDef philo; HiLoDef *philo;
} AnyPtr, *pAnyPtr; } AnyPtr;
typedef struct { typedef struct {
unsigned short x; unsigned short x;
unsigned short y; unsigned short y;
} XY, *pXY; } XY;
#define _VAR_NOT_USED(x) ((x)=(x)) #define _VAR_NOT_USED(x) ((x)=(x))
@ -331,7 +332,7 @@ typedef struct Origins
{ {
long lLeft; /* How many pix to move the scanning org left, in optic res */ long lLeft; /* How many pix to move the scanning org left, in optic res */
long lUp; /* How many pix to move the scanning or up, in optic res */ long lUp; /* How many pix to move the scanning or up, in optic res */
} OrgDef, *pOrgDef; } OrgDef;
typedef struct SrcAttr typedef struct SrcAttr
{ {
@ -345,7 +346,7 @@ typedef struct SrcAttr
XY MinDpi; /**< Minimum dpi supported for scanning */ XY MinDpi; /**< Minimum dpi supported for scanning */
u_char bMinDataType; /**< Minimum data type supports */ u_char bMinDataType; /**< Minimum data type supports */
} SrcAttrDef, *pSrcAttrDef; } SrcAttrDef;
typedef struct DevCaps typedef struct DevCaps
{ {
@ -365,7 +366,7 @@ typedef struct DevCaps
/* _WORKAROUNDS */ /* _WORKAROUNDS */
u_long lamp; /**< for lamp: loword: normal, hiword: tpa */ u_long lamp; /**< for lamp: loword: normal, hiword: tpa */
} DCapsDef, *pDCapsDef; } DCapsDef;
/** /**
* for keeping intial illumination settings * for keeping intial illumination settings
@ -381,7 +382,7 @@ typedef struct
u_short blue_lamp_on; u_short blue_lamp_on;
u_short blue_lamp_off; u_short blue_lamp_off;
} IllumiDef, *pIllumiDef; } IllumiDef;
/** basic register settings /** basic register settings
@ -463,7 +464,7 @@ typedef struct HWDefault
eChipDef chip; /* chiptype */ eChipDef chip; /* chiptype */
eModelDef motorModel; /* to identify used motor */ eModelDef motorModel; /* to identify used motor */
double gamma; /* gamma setting */ double gamma; /* gamma setting */
} HWDef, *pHWDef; } HWDef;
/** device description during runtime /** device description during runtime
*/ */
@ -474,7 +475,7 @@ typedef struct DeviceDef
int product; /**< product ID */ int product; /**< product ID */
DCapsDef Caps; /**< pointer to the attribute of current dev */ DCapsDef Caps; /**< pointer to the attribute of current dev */
HWDef HwSetting; /**< Pointer to the characteristics of device */ HWDef HwSetting; /**< Pointer to the characteristics of device */
pSrcAttrDef pSource; /**< Scanning src, it's equal to Caps.Normal */ SrcAttrDef *pSource; /**< Scanning src, it's equal to Caps.Normal */
/**< on the source that the user specified. */ /**< on the source that the user specified. */
OrgDef Normal; /**< Reflection - Pix to adjust scanning orgs */ OrgDef Normal; /**< Reflection - Pix to adjust scanning orgs */
OrgDef Positive; /**< Pos film - Pix to adjust scanning orgs */ OrgDef Positive; /**< Pos film - Pix to adjust scanning orgs */
@ -488,17 +489,17 @@ typedef struct DeviceDef
SANE_Bool fLastScanIsAdf;/**< */ SANE_Bool fLastScanIsAdf;/**< */
u_char a_bRegs[0x80]; /**< our global register file */ u_char a_bRegs[0x80]; /**< our global register file */
} DeviceDef, *pDeviceDef; } DeviceDef;
typedef struct Settings typedef struct Settings
{ {
char *pIDString; char *pIDString;
pDCapsDef pDevCaps; DCapsDef *pDevCaps;
pHWDef pHwDef; HWDef *pHwDef;
char *pModelString; char *pModelString;
} SetDef, *pSetDef; } SetDef;
/** /**
*/ */
@ -517,7 +518,7 @@ typedef struct
/* request dpi (CCD lines distance) */ /* request dpi (CCD lines distance) */
u_long dwTotalBytes; /**< Total bytes per scan */ u_long dwTotalBytes; /**< Total bytes per scan */
} WinInfo, *pWinInfo; } WinInfo;
/** /**
*/ */
@ -554,7 +555,7 @@ typedef struct
int swOffset[3]; /**< for calibration adjustment */ int swOffset[3]; /**< for calibration adjustment */
int swGain[3]; /**< for calibration adjustment */ int swGain[3]; /**< for calibration adjustment */
} ScanParam, *pScanParam; } ScanParam;
struct Plustek_Device; struct Plustek_Device;
@ -605,7 +606,7 @@ typedef struct ScanDef
u_char bLinesToSkip; /**< how many lines to skip at start */ u_char bLinesToSkip; /**< how many lines to skip at start */
} ScanDef, *pScanDef; } ScanDef;
/** max number of different colck settings */ /** max number of different colck settings */
@ -619,7 +620,7 @@ typedef struct
u_char pwm_duty; /**< PWM duty cycles */ u_char pwm_duty; /**< PWM duty cycles */
u_char scan_lines_per_line; /**< lines to scan to obtain 1 real line u_char scan_lines_per_line; /**< lines to scan to obtain 1 real line
will be used in 16bit color modes only */ will be used in 16bit color modes only */
} MDef, *pMDef; } MDef;
/** according to the CCD and motor, we provide various settings /** according to the CCD and motor, we provide various settings
*/ */
@ -645,7 +646,7 @@ typedef struct {
double gray_mclk_8[_MAX_CLK]; /**< MCLK settings for gray scan */ double gray_mclk_8[_MAX_CLK]; /**< MCLK settings for gray scan */
double gray_mclk_16[_MAX_CLK]; /**< MCLK settings for gray (16bit) scan */ double gray_mclk_16[_MAX_CLK]; /**< MCLK settings for gray (16bit) scan */
} ClkMotorDef, *pClkMotorDef; } ClkMotorDef;
/** for transferring some info between child and parent after calibration /** for transferring some info between child and parent after calibration
*/ */

Wyświetl plik

@ -13,6 +13,7 @@
* - 0.47 - no changes * - 0.47 - no changes
* - 0.48 - no changes * - 0.48 - no changes
* - 0.49 - a_bRegs is now part of the device structure * - 0.49 - a_bRegs is now part of the device structure
* - 0.50 - cleanup
* . * .
* <hr> * <hr>
* This file is part of the SANE package. * This file is part of the SANE package.
@ -205,11 +206,11 @@ static void usb_RestoreCalData( Plustek_Device *dev, CalData *cal )
/** /**
*/ */
static void usb_CreatePrefix( pPlustek_Device dev, char *pfx ) static void usb_CreatePrefix( Plustek_Device *dev, char *pfx )
{ {
char bd[5]; char bd[5];
pScanDef scanning = &dev->scanning; ScanDef *scanning = &dev->scanning;
pScanParam param = &scanning->sParam; ScanParam *param = &scanning->sParam;
switch( scanning->sParam.bSource ) { switch( scanning->sParam.bSource ) {
@ -332,7 +333,7 @@ static void usb_PrepCalData( Plustek_Device *dev, CalData *cal )
/** function to save/update the calibration data /** function to save/update the calibration data
*/ */
static void usb_SaveCalData( pPlustek_Device dev ) static void usb_SaveCalData( Plustek_Device *dev )
{ {
char pfx[20]; char pfx[20];
char tmp[1024]; char tmp[1024];
@ -341,7 +342,7 @@ static void usb_SaveCalData( pPlustek_Device dev )
u_short version; u_short version;
FILE *fp; FILE *fp;
CalData cal; CalData cal;
pScanDef scanning = &dev->scanning; ScanDef *scanning = &dev->scanning;
DBG( _DBG_INFO, "usb_SaveCalData()\n" ); DBG( _DBG_INFO, "usb_SaveCalData()\n" );

Wyświetl plik

@ -51,6 +51,7 @@
* - cleanup * - cleanup
* - 0.49 - tweaked motor settings for EPSON and CANON1200 * - 0.49 - tweaked motor settings for EPSON and CANON1200
* - added support for CanoScan LiDE25 * - added support for CanoScan LiDE25
* - 0.50 - cleanup
* . * .
* <hr> * <hr>
* This file is part of the SANE package. * This file is part of the SANE package.

Wyświetl plik

@ -29,6 +29,7 @@
* - added usb_BWScaleFromColor() and usb_BWDuplicateFromColor * - added usb_BWScaleFromColor() and usb_BWDuplicateFromColor
* - cleanup * - cleanup
* - 0.49 - a_bRegs is now part of the device structure * - 0.49 - a_bRegs is now part of the device structure
* - 0.50 - cleanup
* . * .
* <hr> * <hr>
* This file is part of the SANE package. * This file is part of the SANE package.
@ -200,7 +201,7 @@ static void usb_ReverseBitStream( u_char *pSrc, u_char *pTar, int iPixels,
static void usb_AverageColorByte( Plustek_Device *dev ) static void usb_AverageColorByte( Plustek_Device *dev )
{ {
u_long dw; u_long dw;
pScanDef scan = &dev->scanning; ScanDef *scan = &dev->scanning;
if((scan->sParam.bSource == SOURCE_Negative || if((scan->sParam.bSource == SOURCE_Negative ||
scan->sParam.bSource == SOURCE_Transparency) && scan->sParam.bSource == SOURCE_Transparency) &&
@ -229,7 +230,7 @@ static void usb_AverageColorWord( Plustek_Device *dev )
{ {
u_char ls = 2; u_char ls = 2;
u_long dw; u_long dw;
pScanDef scan = &dev->scanning; ScanDef *scan = &dev->scanning;
if((scan->sParam.bSource == SOURCE_Negative || if((scan->sParam.bSource == SOURCE_Negative ||
scan->sParam.bSource == SOURCE_Transparency) && scan->sParam.bSource == SOURCE_Transparency) &&
@ -268,7 +269,7 @@ static void usb_AverageColorWord( Plustek_Device *dev )
static void usb_AverageGrayByte( Plustek_Device *dev ) static void usb_AverageGrayByte( Plustek_Device *dev )
{ {
u_long dw; u_long dw;
pScanDef scan = &dev->scanning; ScanDef *scan = &dev->scanning;
if((scan->sParam.bSource == SOURCE_Negative || if((scan->sParam.bSource == SOURCE_Negative ||
scan->sParam.bSource == SOURCE_Transparency) && scan->sParam.bSource == SOURCE_Transparency) &&
@ -285,7 +286,7 @@ static void usb_AverageGrayByte( Plustek_Device *dev )
static void usb_AverageGrayWord( Plustek_Device *dev ) static void usb_AverageGrayWord( Plustek_Device *dev )
{ {
u_long dw; u_long dw;
pScanDef scan = &dev->scanning; ScanDef *scan = &dev->scanning;
if((scan->sParam.bSource == SOURCE_Negative || if((scan->sParam.bSource == SOURCE_Negative ||
scan->sParam.bSource == SOURCE_Transparency) && scan->sParam.bSource == SOURCE_Transparency) &&
@ -442,13 +443,13 @@ static void usb_ColorDuplicate16_2( Plustek_Device *dev )
for( dw = 0; dw < scan->sParam.Size.dwPixels; dw++, pixels += next) { for( dw = 0; dw < scan->sParam.Size.dwPixels; dw++, pixels += next) {
if( swap ) { if( swap ) {
tmp = *((pHiLoDef)&scan->Red.pw[dw]); tmp = *((HiLoDef*)&scan->Red.pw[dw]);
scan->UserBuf.pw_rgb[pixels].Red = _HILO2WORD(tmp) >> ls; scan->UserBuf.pw_rgb[pixels].Red = _HILO2WORD(tmp) >> ls;
tmp = *((pHiLoDef)&scan->Green.pw[dw]); tmp = *((HiLoDef*)&scan->Green.pw[dw]);
scan->UserBuf.pw_rgb[pixels].Green = _HILO2WORD(tmp) >> ls; scan->UserBuf.pw_rgb[pixels].Green = _HILO2WORD(tmp) >> ls;
tmp = *((pHiLoDef)&scan->Blue.pw[dw]); tmp = *((HiLoDef*)&scan->Blue.pw[dw]);
scan->UserBuf.pw_rgb[pixels].Blue = _HILO2WORD(tmp) >> ls; scan->UserBuf.pw_rgb[pixels].Blue = _HILO2WORD(tmp) >> ls;
} else { } else {
@ -721,7 +722,7 @@ static void usb_GrayDuplicatePseudo16( Plustek_Device *dev )
*/ */
static void usb_BWDuplicate( Plustek_Device *dev ) static void usb_BWDuplicate( Plustek_Device *dev )
{ {
pScanDef scan = &dev->scanning; ScanDef *scan = &dev->scanning;
if(scan->sParam.bSource == SOURCE_ADF) if(scan->sParam.bSource == SOURCE_ADF)
{ {
@ -1126,13 +1127,13 @@ static void usb_ColorScale16_2( Plustek_Device *dev )
if( swap ) { if( swap ) {
tmp = *((pHiLoDef)&scan->Red.pw[bitsput]); tmp = *((HiLoDef*)&scan->Red.pw[bitsput]);
scan->UserBuf.pw_rgb[pixels].Red = _HILO2WORD(tmp) >> ls; scan->UserBuf.pw_rgb[pixels].Red = _HILO2WORD(tmp) >> ls;
tmp = *((pHiLoDef)&scan->Green.pw[bitsput]); tmp = *((HiLoDef*)&scan->Green.pw[bitsput]);
scan->UserBuf.pw_rgb[pixels].Green = _HILO2WORD(tmp) >> ls; scan->UserBuf.pw_rgb[pixels].Green = _HILO2WORD(tmp) >> ls;
tmp = *((pHiLoDef)&scan->Blue.pw[bitsput]); tmp = *((HiLoDef*)&scan->Blue.pw[bitsput]);
scan->UserBuf.pw_rgb[pixels].Blue = _HILO2WORD(tmp) >> ls; scan->UserBuf.pw_rgb[pixels].Blue = _HILO2WORD(tmp) >> ls;
} else { } else {

Wyświetl plik

@ -20,6 +20,7 @@
* - 0.47 - cleanup work * - 0.47 - cleanup work
* - 0.48 - added support for binary from color scans * - 0.48 - added support for binary from color scans
* - 0.49 - changed usb_MapDownload * - 0.49 - changed usb_MapDownload
* - 0.50 - cleanup
* . * .
* <hr> * <hr>
* This file is part of the SANE package. * This file is part of the SANE package.
@ -115,8 +116,8 @@ static void usb_MapAdjust( Plustek_Device *dev )
*/ */
static SANE_Bool usb_MapDownload( Plustek_Device *dev ) static SANE_Bool usb_MapDownload( Plustek_Device *dev )
{ {
pScanDef scanning = &dev->scanning; ScanDef *scanning = &dev->scanning;
pDCapsDef sc = &dev->usbDev.Caps; DCapsDef *sc = &dev->usbDev.Caps;
int color; int color;
int i, threshold; int i, threshold;

Wyświetl plik

@ -27,6 +27,7 @@
* - 0.49 - a_bRegs is now part of the device structure * - 0.49 - a_bRegs is now part of the device structure
* - using now PhyDpi.y as selector for the motor MCLK range * - using now PhyDpi.y as selector for the motor MCLK range
* - changed usb_MapDownload prototype * - changed usb_MapDownload prototype
* - 0.50 - cleanup
* . * .
* <hr> * <hr>
* This file is part of the SANE package. * This file is part of the SANE package.
@ -79,7 +80,7 @@ static SANE_Bool m_fAutoPark;
static SANE_Bool m_fFirst; static SANE_Bool m_fFirst;
static double m_dHDPIDivider; static double m_dHDPIDivider;
static double m_dMCLKDivider; static double m_dMCLKDivider;
static pScanParam m_pParam; static ScanParam *m_pParam;
static u_char m_bLineRateColor; static u_char m_bLineRateColor;
static u_char m_bCM; static u_char m_bCM;
static u_char m_bIntTimeAdjust; static u_char m_bIntTimeAdjust;
@ -103,7 +104,6 @@ static u_long usb_min( u_long val1, u_long val2 )
{ {
if( val1 > val2 ) if( val1 > val2 )
return val2; return val2;
return val1; return val1;
} }
@ -116,7 +116,6 @@ static u_long usb_max( u_long val1, u_long val2 )
{ {
if( val1 > val2 ) if( val1 > val2 )
return val1; return val1;
return val2; return val2;
} }
@ -132,12 +131,11 @@ static u_long usb_max( u_long val1, u_long val2 )
static u_short usb_SetAsicDpiX( Plustek_Device *dev, u_short xdpi ) static u_short usb_SetAsicDpiX( Plustek_Device *dev, u_short xdpi )
{ {
u_short res; u_short res;
pScanDef scanning = &dev->scanning; ScanDef *scanning = &dev->scanning;
pDCapsDef scaps = &dev->usbDev.Caps; DCapsDef *scaps = &dev->usbDev.Caps;
u_char *regs = dev->usbDev.a_bRegs; u_char *regs = dev->usbDev.a_bRegs;
/* /* limit xdpi to lower value for certain devices...
* limit xdpi to lower value for certain devices...
*/ */
if( scaps->OpticDpi.x == 1200 && if( scaps->OpticDpi.x == 1200 &&
scanning->sParam.bDataType != SCANDATATYPE_Color && scanning->sParam.bDataType != SCANDATATYPE_Color &&
@ -198,7 +196,6 @@ static u_short usb_SetAsicDpiX( Plustek_Device *dev, u_short xdpi )
res = (u_short)((double)scaps->OpticDpi.x / m_dHDPIDivider); res = (u_short)((double)scaps->OpticDpi.x / m_dHDPIDivider);
DBG( _DBG_INFO2, "* XDPI=%u, HDPI=%.3f\n", res, m_dHDPIDivider ); DBG( _DBG_INFO2, "* XDPI=%u, HDPI=%.3f\n", res, m_dHDPIDivider );
return res; return res;
} }
@ -210,9 +207,9 @@ static u_short usb_SetAsicDpiX( Plustek_Device *dev, u_short xdpi )
*/ */
static u_short usb_SetAsicDpiY( Plustek_Device *dev, u_short ydpi ) static u_short usb_SetAsicDpiY( Plustek_Device *dev, u_short ydpi )
{ {
pScanDef scanning = &dev->scanning; ScanDef *scanning = &dev->scanning;
pDCapsDef sCaps = &dev->usbDev.Caps; DCapsDef *sCaps = &dev->usbDev.Caps;
pHWDef hw = &dev->usbDev.HwSetting; HWDef *hw = &dev->usbDev.HwSetting;
u_short wMinDpi, wDpi; u_short wMinDpi, wDpi;
@ -260,14 +257,12 @@ static u_short usb_SetAsicDpiY( Plustek_Device *dev, u_short ydpi )
* @param pParam - pointer to the current scan parameters * @param pParam - pointer to the current scan parameters
* @return - Nothing * @return - Nothing
*/ */
static void usb_SetColorAndBits( Plustek_Device *dev, pScanParam pParam ) static void usb_SetColorAndBits( Plustek_Device *dev, ScanParam *pParam )
{ {
pHWDef hw = &dev->usbDev.HwSetting; HWDef *hw = &dev->usbDev.HwSetting;
u_char *regs = dev->usbDev.a_bRegs; u_char *regs = dev->usbDev.a_bRegs;
/* /* Set pixel packing, data mode and AFE operation */
* Set pixel packing, data mode and AFE operation
*/
switch( pParam->bDataType ) { switch( pParam->bDataType ) {
case SCANDATATYPE_Color: case SCANDATATYPE_Color:
m_bCM = 3; m_bCM = 3;
@ -318,12 +313,12 @@ static void usb_SetColorAndBits( Plustek_Device *dev, pScanParam pParam )
* @param pParam - pointer to the current scan parameters * @param pParam - pointer to the current scan parameters
* @return - Nothing * @return - Nothing
*/ */
static void usb_GetScanRect( Plustek_Device *dev, pScanParam pParam ) static void usb_GetScanRect( Plustek_Device *dev, ScanParam *pParam )
{ {
u_short wDataPixelStart, wLineEnd; u_short wDataPixelStart, wLineEnd;
pDCapsDef sCaps = &dev->usbDev.Caps; DCapsDef *sCaps = &dev->usbDev.Caps;
pHWDef hw = &dev->usbDev.HwSetting; HWDef *hw = &dev->usbDev.HwSetting;
u_char *regs = dev->usbDev.a_bRegs; u_char *regs = dev->usbDev.a_bRegs;
/* Convert pixels to physical dpi based */ /* Convert pixels to physical dpi based */
@ -479,7 +474,8 @@ static void usb_GetScanRect( Plustek_Device *dev, pScanParam pParam )
if( hw->motorModel == MODEL_HuaLien && sCaps->OpticDpi.x == 600) if( hw->motorModel == MODEL_HuaLien && sCaps->OpticDpi.x == 600)
pParam->Origin.y = pParam->Origin.y * 297 / 298; pParam->Origin.y = pParam->Origin.y * 297 / 298;
DBG(_DBG_INFO2,"* Full Steps to Skip at Start = 0x%04x\n",pParam->Origin.y); DBG(_DBG_INFO2,"* Full Steps to Skip at Start = 0x%04x\n",
pParam->Origin.y);
regs[0x4a] = _HIBYTE( pParam->Origin.y ); regs[0x4a] = _HIBYTE( pParam->Origin.y );
regs[0x4b] = _LOBYTE( pParam->Origin.y ); regs[0x4b] = _LOBYTE( pParam->Origin.y );
@ -487,11 +483,11 @@ static void usb_GetScanRect( Plustek_Device *dev, pScanParam pParam )
/** preset scan stepsize and fastfeed stepsize /** preset scan stepsize and fastfeed stepsize
*/ */
static void usb_PresetStepSize( Plustek_Device *dev, pScanParam pParam ) static void usb_PresetStepSize( Plustek_Device *dev, ScanParam *pParam )
{ {
u_short ssize; u_short ssize;
double mclkdiv = pParam->dMCLK; double mclkdiv = pParam->dMCLK;
pHWDef hw = &dev->usbDev.HwSetting; HWDef *hw = &dev->usbDev.HwSetting;
u_char *regs = dev->usbDev.a_bRegs; u_char *regs = dev->usbDev.a_bRegs;
ssize = (u_short)((double)CRYSTAL_FREQ / ( mclkdiv * 8.0 * ssize = (u_short)((double)CRYSTAL_FREQ / ( mclkdiv * 8.0 *
@ -515,7 +511,7 @@ static void usb_GetDPD( Plustek_Device *dev )
int dpd; /* calculated dpd reg 52:53 */ int dpd; /* calculated dpd reg 52:53 */
int st; /* step size reg 46:47 */ int st; /* step size reg 46:47 */
pHWDef hw = &dev->usbDev.HwSetting; HWDef *hw = &dev->usbDev.HwSetting;
u_char *regs = dev->usbDev.a_bRegs; u_char *regs = dev->usbDev.a_bRegs;
qtcnt = (regs[0x51] & 0x30) >> 4; /* quarter speed count */ qtcnt = (regs[0x51] & 0x30) >> 4; /* quarter speed count */
@ -631,13 +627,13 @@ static int usb_GetMCLKDiv( Plustek_Device *dev )
* at least we give the master clock divider and adjust the step size * at least we give the master clock divider and adjust the step size
* and integration time (for 14/16 bit modes) * and integration time (for 14/16 bit modes)
*/ */
static double usb_GetMCLKDivider( Plustek_Device *dev, pScanParam pParam ) static double usb_GetMCLKDivider( Plustek_Device *dev, ScanParam *pParam )
{ {
double dMaxIntegrationTime; double dMaxIntegrationTime;
double dMaxMCLKDivider; double dMaxMCLKDivider;
pDCapsDef sCaps = &dev->usbDev.Caps; DCapsDef *sCaps = &dev->usbDev.Caps;
pHWDef hw = &dev->usbDev.HwSetting; HWDef *hw = &dev->usbDev.HwSetting;
u_char *regs = dev->usbDev.a_bRegs; u_char *regs = dev->usbDev.a_bRegs;
DBG( _DBG_INFO, "usb_GetMCLKDivider()\n" ); DBG( _DBG_INFO, "usb_GetMCLKDivider()\n" );
@ -733,9 +729,9 @@ static double usb_GetMCLKDivider( Plustek_Device *dev, pScanParam pParam )
/** calculate the step size of each scan step /** calculate the step size of each scan step
*/ */
static void usb_GetStepSize( Plustek_Device *dev, pScanParam pParam ) static void usb_GetStepSize( Plustek_Device *dev, ScanParam *pParam )
{ {
pHWDef hw = &dev->usbDev.HwSetting; HWDef *hw = &dev->usbDev.HwSetting;
u_char *regs = dev->usbDev.a_bRegs; u_char *regs = dev->usbDev.a_bRegs;
/* Compute step size using equation 1 */ /* Compute step size using equation 1 */
@ -784,7 +780,7 @@ static void usb_GetLineLength( Plustek_Device *dev )
int tradj; /* ITA */ int tradj; /* ITA */
int en_tradj; int en_tradj;
pHWDef hw = &dev->usbDev.HwSetting; HWDef *hw = &dev->usbDev.HwSetting;
u_char *regs = dev->usbDev.a_bRegs; u_char *regs = dev->usbDev.a_bRegs;
tpspd = (regs[0x0a] & 0x0c) >> 2; /* turbo/preview mode speed */ tpspd = (regs[0x0a] & 0x0c) >> 2; /* turbo/preview mode speed */
@ -867,13 +863,13 @@ static void usb_GetLineLength( Plustek_Device *dev )
/** usb_GetMotorParam /** usb_GetMotorParam
* registers 0x56, 0x57 * registers 0x56, 0x57
*/ */
static void usb_GetMotorParam( Plustek_Device *dev, pScanParam pParam ) static void usb_GetMotorParam( Plustek_Device *dev, ScanParam *pParam )
{ {
int idx, i; int idx, i;
pClkMotorDef clk; ClkMotorDef *clk;
pMDef md; MDef *md;
pDCapsDef sCaps = &dev->usbDev.Caps; DCapsDef *sCaps = &dev->usbDev.Caps;
pHWDef hw = &dev->usbDev.HwSetting; HWDef *hw = &dev->usbDev.HwSetting;
u_char *regs = dev->usbDev.a_bRegs; u_char *regs = dev->usbDev.a_bRegs;
if( !_IS_PLUSTEKMOTOR(hw->motorModel)) { if( !_IS_PLUSTEKMOTOR(hw->motorModel)) {
@ -1018,10 +1014,10 @@ static void usb_GetMotorParam( Plustek_Device *dev, pScanParam pParam )
/** /**
*/ */
static void usb_GetPauseLimit( Plustek_Device *dev, pScanParam pParam ) static void usb_GetPauseLimit( Plustek_Device *dev, ScanParam *pParam )
{ {
int coeffsize, scaler; int coeffsize, scaler;
pHWDef hw = &dev->usbDev.HwSetting; HWDef *hw = &dev->usbDev.HwSetting;
u_char *regs = dev->usbDev.a_bRegs; u_char *regs = dev->usbDev.a_bRegs;
scaler = 1; scaler = 1;
@ -1078,9 +1074,9 @@ static void usb_GetPauseLimit( Plustek_Device *dev, pScanParam pParam )
/** usb_GetScanLinesAndSize /** usb_GetScanLinesAndSize
*/ */
static void usb_GetScanLinesAndSize( Plustek_Device *dev, pScanParam pParam ) static void usb_GetScanLinesAndSize( Plustek_Device *dev, ScanParam *pParam )
{ {
pDCapsDef sCaps = &dev->usbDev.Caps; DCapsDef *sCaps = &dev->usbDev.Caps;
pParam->Size.dwPhyLines = (u_long)ceil((double) pParam->Size.dwLines * pParam->Size.dwPhyLines = (u_long)ceil((double) pParam->Size.dwLines *
pParam->PhyDpi.y / pParam->UserDpi.y); pParam->PhyDpi.y / pParam->UserDpi.y);
@ -1104,12 +1100,12 @@ static void usb_GetScanLinesAndSize( Plustek_Device *dev, pScanParam pParam )
/** function to preset/reset the merlin registers /** function to preset/reset the merlin registers
*/ */
static SANE_Bool usb_SetScanParameters( Plustek_Device *dev, pScanParam pParam ) static SANE_Bool usb_SetScanParameters( Plustek_Device *dev, ScanParam *pParam )
{ {
static u_char reg8, reg38[6], reg48[2]; static u_char reg8, reg38[6], reg48[2];
pScanParam pdParam = &dev->scanning.sParam; ScanParam *pdParam = &dev->scanning.sParam;
pHWDef hw = &dev->usbDev.HwSetting; HWDef *hw = &dev->usbDev.HwSetting;
u_char *regs = dev->usbDev.a_bRegs; u_char *regs = dev->usbDev.a_bRegs;
m_pParam = pParam; m_pParam = pParam;
@ -1248,16 +1244,17 @@ static SANE_Bool usb_SetScanParameters( Plustek_Device *dev, pScanParam pParam )
memset( &regs[0x03], 0, 3 ); memset( &regs[0x03], 0, 3 );
memset( &regs[0x5f], 0, 0x7f-0x5f+1 ); memset( &regs[0x5f], 0, 0x7f-0x5f+1 );
/* we limit the possible scansteps to avoid, that the sensors bumps
* against the scanbed
*/
if(pParam->bCalibration == PARAM_Scan && pParam->bSource != SOURCE_ADF) { if(pParam->bCalibration == PARAM_Scan && pParam->bSource != SOURCE_ADF) {
u_short scansteps = (u_short)ceil((double)(pParam->Size.dwPhyLines + 10)* u_short scansteps = (u_short)ceil((double)(pParam->Size.dwPhyLines + 10)*
hw->wMotorDpi / pParam->PhyDpi.y); hw->wMotorDpi / pParam->PhyDpi.y);
DBG( _DBG_INFO, "* Scansteps=%u (%lu*%u/%u)\n", scansteps, DBG( _DBG_INFO, "* Scansteps=%u (%lu*%u/%u)\n", scansteps,
pParam->Size.dwPhyLines, hw->wMotorDpi, pParam->PhyDpi.y ); pParam->Size.dwPhyLines, hw->wMotorDpi, pParam->PhyDpi.y );
#if 1
regs[0x4c] = _HIBYTE(scansteps); regs[0x4c] = _HIBYTE(scansteps);
regs[0x4d] = _LOBYTE(scansteps); regs[0x4d] = _LOBYTE(scansteps);
#endif
} }
/* set the merlin registers */ /* set the merlin registers */
@ -1279,8 +1276,8 @@ static SANE_Bool usb_ScanBegin( Plustek_Device *dev, SANE_Bool auto_park )
{ {
u_char value; u_char value;
u_short inches; u_short inches;
pHWDef hw = &dev->usbDev.HwSetting; HWDef *hw = &dev->usbDev.HwSetting;
pDCapsDef sc = &dev->usbDev.Caps; DCapsDef *sc = &dev->usbDev.Caps;
u_char *regs = dev->usbDev.a_bRegs; u_char *regs = dev->usbDev.a_bRegs;
DBG( _DBG_INFO, "usb_ScanBegin()\n" ); DBG( _DBG_INFO, "usb_ScanBegin()\n" );
@ -1328,10 +1325,10 @@ static SANE_Bool usb_ScanBegin( Plustek_Device *dev, SANE_Bool auto_park )
} }
/* Download map & Shading data */ /* Download map & Shading data */
if(( m_pParam->bCalibration == PARAM_Scan && if(( m_pParam->bCalibration == PARAM_Scan && !usb_MapDownload( dev )) ||
!usb_MapDownload( dev )) || !usb_DownloadShadingData( dev, m_pParam->bCalibration )) {
!usb_DownloadShadingData( dev, m_pParam->bCalibration ))
return SANE_FALSE; return SANE_FALSE;
}
/* Move chassis and start to read image data */ /* Move chassis and start to read image data */
if (!usbio_WriteReg( dev->fd, 0x07, 3 )) if (!usbio_WriteReg( dev->fd, 0x07, 3 ))
@ -1525,7 +1522,7 @@ static SANE_Bool usb_ScanReadImage( Plustek_Device *dev,
/** calculate the number of pixels per line and lines out of a given /** calculate the number of pixels per line and lines out of a given
* crop-area. The size of the area is given on a 300dpi base! * crop-area. The size of the area is given on a 300dpi base!
*/ */
static void usb_GetImageInfo( Plustek_Device *dev, pImgDef pInfo, pWinInfo pSize ) static void usb_GetImageInfo( Plustek_Device *dev, ImgDef *pInfo, WinInfo *pSize )
{ {
DBG( _DBG_INFO, "usb_GetImageInfo()\n" ); DBG( _DBG_INFO, "usb_GetImageInfo()\n" );
@ -1566,7 +1563,7 @@ static void usb_GetImageInfo( Plustek_Device *dev, pImgDef pInfo, pWinInfo pSize
/** /**
*/ */
static void usb_SaveImageInfo( Plustek_Device *dev, pImgDef pInfo ) static void usb_SaveImageInfo( Plustek_Device *dev, ImgDef *pInfo )
{ {
HWDef *hw = &dev->usbDev.HwSetting; HWDef *hw = &dev->usbDev.HwSetting;
ScanParam *pParam = &dev->scanning.sParam; ScanParam *pParam = &dev->scanning.sParam;

Wyświetl plik

@ -55,6 +55,7 @@
* - 0.49 - added typedef struct DevList * - 0.49 - added typedef struct DevList
* - added button stuff * - added button stuff
* - added transferRate to struct Plustek_Device * - added transferRate to struct Plustek_Device
* - 0.50 - cleanup
* . * .
* <hr> * <hr>
* This file is part of the SANE package. * This file is part of the SANE package.
@ -291,40 +292,40 @@ typedef struct {
double graygamma; double graygamma;
} AdjDef, *pAdjDef; } AdjDef;
typedef struct { typedef struct {
unsigned short x; unsigned short x;
unsigned short y; unsigned short y;
unsigned short cx; unsigned short cx;
unsigned short cy; unsigned short cy;
} CropRect, *pCropRect; } CropRect;
typedef struct image { typedef struct image {
unsigned long dwFlag; unsigned long dwFlag;
CropRect crArea; CropRect crArea;
XY xyDpi; XY xyDpi;
unsigned short wDataType; unsigned short wDataType;
} ImgDef, *pImgDef; } ImgDef;
typedef struct { typedef struct {
unsigned long dwPixelsPerLine; unsigned long dwPixelsPerLine;
unsigned long dwBytesPerLine; unsigned long dwBytesPerLine;
unsigned long dwLinesPerArea; unsigned long dwLinesPerArea;
ImgDef ImgDef; ImgDef ImgDef;
} CropInfo, *pCropInfo; } CropInfo;
typedef struct { typedef struct {
ImgDef ImgDef; ImgDef ImgDef;
short siBrightness; short siBrightness;
short siContrast; short siContrast;
} ScanInfo, *pScanInfo; } ScanInfo;
typedef struct { typedef struct {
unsigned long dwFlag; unsigned long dwFlag;
unsigned short wMaxExtentX; /**< scanarea width */ unsigned short wMaxExtentX; /**< scanarea width */
unsigned short wMaxExtentY; /**< scanarea height */ unsigned short wMaxExtentY; /**< scanarea height */
} ScannerCaps, *pScannerCaps; } ScannerCaps;
typedef struct Plustek_Device typedef struct Plustek_Device
{ {
@ -355,7 +356,7 @@ typedef struct Plustek_Device
struct itimerval saveSettings; /* for lamp timer */ struct itimerval saveSettings; /* for lamp timer */
#endif #endif
} Plustek_Device, *pPlustek_Device; } Plustek_Device;
#ifndef SANE_OPTION #ifndef SANE_OPTION
/* for compatibility with older versions */ /* for compatibility with older versions */
@ -390,7 +391,7 @@ typedef struct Plustek_Scanner
SANE_Option_Descriptor opt[NUM_OPTIONS]; SANE_Option_Descriptor opt[NUM_OPTIONS];
} Plustek_Scanner, *pPlustek_Scanner; } Plustek_Scanner;
/** for collecting configuration info... /** for collecting configuration info...
*/ */
@ -402,7 +403,7 @@ typedef struct {
/* contains the stuff to adjust... */ /* contains the stuff to adjust... */
AdjDef adj; AdjDef adj;
} CnfDef, *pCnfDef; } CnfDef;
/** for supported device list /** for supported device list
*/ */