kopia lustrzana https://gitlab.com/sane-project/backends
Cleanup.
rodzic
b3d68531d4
commit
3290aae207
|
@ -37,6 +37,7 @@
|
|||
* to struct DeviceDef
|
||||
* - added CRYSTAL_FREQ
|
||||
* - added IPCDef
|
||||
* - 0.50 - cleanup
|
||||
* .
|
||||
* <hr>
|
||||
* This file is part of the SANE package.
|
||||
|
@ -117,56 +118,56 @@ typedef struct {
|
|||
u_char Red;
|
||||
u_char Green;
|
||||
u_char Blue;
|
||||
} RGBByteDef, *pRGBByteDef;
|
||||
} RGBByteDef;
|
||||
|
||||
typedef struct {
|
||||
u_short Red;
|
||||
u_short Green;
|
||||
u_short Blue;
|
||||
} RGBUShortDef, *pRGBUShortDef;
|
||||
} RGBUShortDef;
|
||||
|
||||
typedef struct {
|
||||
u_long Red;
|
||||
u_long Green;
|
||||
u_long Blue;
|
||||
} RGBULongDef, *pRGBULongDef;
|
||||
} RGBULongDef;
|
||||
|
||||
typedef struct {
|
||||
u_char a_bColor[3];
|
||||
} ColorByteDef, *pColorByteDef;
|
||||
} ColorByteDef;
|
||||
|
||||
typedef struct {
|
||||
u_char bHi;
|
||||
u_char bLo;
|
||||
} HiLoDef, *pHiLoDef;
|
||||
} HiLoDef;
|
||||
|
||||
typedef union {
|
||||
HiLoDef HiLo[3];
|
||||
u_short Colors[3];
|
||||
} ColorWordDef, *pColorWordDef;
|
||||
} ColorWordDef;
|
||||
|
||||
typedef union {
|
||||
HiLoDef HiLo;
|
||||
u_short Mono;
|
||||
} MonoWordDef, *pMonoWordDef;
|
||||
} MonoWordDef;
|
||||
|
||||
typedef union {
|
||||
|
||||
u_char *pb;
|
||||
u_short *pw;
|
||||
pMonoWordDef pmw;
|
||||
pColorByteDef pcb;
|
||||
pColorWordDef pcw;
|
||||
pRGBByteDef pb_rgb;
|
||||
pRGBUShortDef pw_rgb;
|
||||
pHiLoDef philo;
|
||||
MonoWordDef *pmw;
|
||||
ColorByteDef *pcb;
|
||||
ColorWordDef *pcw;
|
||||
RGBByteDef *pb_rgb;
|
||||
RGBUShortDef *pw_rgb;
|
||||
HiLoDef *philo;
|
||||
|
||||
} AnyPtr, *pAnyPtr;
|
||||
} AnyPtr;
|
||||
|
||||
typedef struct {
|
||||
unsigned short x;
|
||||
unsigned short y;
|
||||
} XY, *pXY;
|
||||
} XY;
|
||||
|
||||
#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 lUp; /* How many pix to move the scanning or up, in optic res */
|
||||
} OrgDef, *pOrgDef;
|
||||
} OrgDef;
|
||||
|
||||
typedef struct SrcAttr
|
||||
{
|
||||
|
@ -345,7 +346,7 @@ typedef struct SrcAttr
|
|||
XY MinDpi; /**< Minimum dpi supported for scanning */
|
||||
u_char bMinDataType; /**< Minimum data type supports */
|
||||
|
||||
} SrcAttrDef, *pSrcAttrDef;
|
||||
} SrcAttrDef;
|
||||
|
||||
typedef struct DevCaps
|
||||
{
|
||||
|
@ -365,7 +366,7 @@ typedef struct DevCaps
|
|||
/* _WORKAROUNDS */
|
||||
u_long lamp; /**< for lamp: loword: normal, hiword: tpa */
|
||||
|
||||
} DCapsDef, *pDCapsDef;
|
||||
} DCapsDef;
|
||||
|
||||
/**
|
||||
* for keeping intial illumination settings
|
||||
|
@ -381,7 +382,7 @@ typedef struct
|
|||
u_short blue_lamp_on;
|
||||
u_short blue_lamp_off;
|
||||
|
||||
} IllumiDef, *pIllumiDef;
|
||||
} IllumiDef;
|
||||
|
||||
|
||||
/** basic register settings
|
||||
|
@ -463,7 +464,7 @@ typedef struct HWDefault
|
|||
eChipDef chip; /* chiptype */
|
||||
eModelDef motorModel; /* to identify used motor */
|
||||
double gamma; /* gamma setting */
|
||||
} HWDef, *pHWDef;
|
||||
} HWDef;
|
||||
|
||||
/** device description during runtime
|
||||
*/
|
||||
|
@ -474,7 +475,7 @@ typedef struct DeviceDef
|
|||
int product; /**< product ID */
|
||||
DCapsDef Caps; /**< pointer to the attribute of current dev */
|
||||
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. */
|
||||
OrgDef Normal; /**< Reflection - Pix to adjust scanning orgs */
|
||||
OrgDef Positive; /**< Pos film - Pix to adjust scanning orgs */
|
||||
|
@ -488,17 +489,17 @@ typedef struct DeviceDef
|
|||
SANE_Bool fLastScanIsAdf;/**< */
|
||||
u_char a_bRegs[0x80]; /**< our global register file */
|
||||
|
||||
} DeviceDef, *pDeviceDef;
|
||||
} DeviceDef;
|
||||
|
||||
|
||||
typedef struct Settings
|
||||
{
|
||||
char *pIDString;
|
||||
pDCapsDef pDevCaps;
|
||||
pHWDef pHwDef;
|
||||
DCapsDef *pDevCaps;
|
||||
HWDef *pHwDef;
|
||||
char *pModelString;
|
||||
|
||||
} SetDef, *pSetDef;
|
||||
} SetDef;
|
||||
|
||||
/**
|
||||
*/
|
||||
|
@ -517,7 +518,7 @@ typedef struct
|
|||
/* request dpi (CCD lines distance) */
|
||||
u_long dwTotalBytes; /**< Total bytes per scan */
|
||||
|
||||
} WinInfo, *pWinInfo;
|
||||
} WinInfo;
|
||||
|
||||
/**
|
||||
*/
|
||||
|
@ -554,7 +555,7 @@ typedef struct
|
|||
int swOffset[3]; /**< for calibration adjustment */
|
||||
int swGain[3]; /**< for calibration adjustment */
|
||||
|
||||
} ScanParam, *pScanParam;
|
||||
} ScanParam;
|
||||
|
||||
struct Plustek_Device;
|
||||
|
||||
|
@ -605,7 +606,7 @@ typedef struct ScanDef
|
|||
|
||||
u_char bLinesToSkip; /**< how many lines to skip at start */
|
||||
|
||||
} ScanDef, *pScanDef;
|
||||
} ScanDef;
|
||||
|
||||
|
||||
/** max number of different colck settings */
|
||||
|
@ -619,7 +620,7 @@ typedef struct
|
|||
u_char pwm_duty; /**< PWM duty cycles */
|
||||
u_char scan_lines_per_line; /**< lines to scan to obtain 1 real line
|
||||
will be used in 16bit color modes only */
|
||||
} MDef, *pMDef;
|
||||
} MDef;
|
||||
|
||||
/** 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_16[_MAX_CLK]; /**< MCLK settings for gray (16bit) scan */
|
||||
|
||||
} ClkMotorDef, *pClkMotorDef;
|
||||
} ClkMotorDef;
|
||||
|
||||
/** for transferring some info between child and parent after calibration
|
||||
*/
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
* - 0.47 - no changes
|
||||
* - 0.48 - no changes
|
||||
* - 0.49 - a_bRegs is now part of the device structure
|
||||
* - 0.50 - cleanup
|
||||
* .
|
||||
* <hr>
|
||||
* 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];
|
||||
pScanDef scanning = &dev->scanning;
|
||||
pScanParam param = &scanning->sParam;
|
||||
ScanDef *scanning = &dev->scanning;
|
||||
ScanParam *param = &scanning->sParam;
|
||||
|
||||
switch( scanning->sParam.bSource ) {
|
||||
|
||||
|
@ -332,7 +333,7 @@ static void usb_PrepCalData( Plustek_Device *dev, CalData *cal )
|
|||
|
||||
/** 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 tmp[1024];
|
||||
|
@ -341,7 +342,7 @@ static void usb_SaveCalData( pPlustek_Device dev )
|
|||
u_short version;
|
||||
FILE *fp;
|
||||
CalData cal;
|
||||
pScanDef scanning = &dev->scanning;
|
||||
ScanDef *scanning = &dev->scanning;
|
||||
|
||||
DBG( _DBG_INFO, "usb_SaveCalData()\n" );
|
||||
|
||||
|
|
|
@ -51,6 +51,7 @@
|
|||
* - cleanup
|
||||
* - 0.49 - tweaked motor settings for EPSON and CANON1200
|
||||
* - added support for CanoScan LiDE25
|
||||
* - 0.50 - cleanup
|
||||
* .
|
||||
* <hr>
|
||||
* This file is part of the SANE package.
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
* - added usb_BWScaleFromColor() and usb_BWDuplicateFromColor
|
||||
* - cleanup
|
||||
* - 0.49 - a_bRegs is now part of the device structure
|
||||
* - 0.50 - cleanup
|
||||
* .
|
||||
* <hr>
|
||||
* 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 )
|
||||
{
|
||||
u_long dw;
|
||||
pScanDef scan = &dev->scanning;
|
||||
ScanDef *scan = &dev->scanning;
|
||||
|
||||
if((scan->sParam.bSource == SOURCE_Negative ||
|
||||
scan->sParam.bSource == SOURCE_Transparency) &&
|
||||
|
@ -229,7 +230,7 @@ static void usb_AverageColorWord( Plustek_Device *dev )
|
|||
{
|
||||
u_char ls = 2;
|
||||
u_long dw;
|
||||
pScanDef scan = &dev->scanning;
|
||||
ScanDef *scan = &dev->scanning;
|
||||
|
||||
if((scan->sParam.bSource == SOURCE_Negative ||
|
||||
scan->sParam.bSource == SOURCE_Transparency) &&
|
||||
|
@ -268,7 +269,7 @@ static void usb_AverageColorWord( Plustek_Device *dev )
|
|||
static void usb_AverageGrayByte( Plustek_Device *dev )
|
||||
{
|
||||
u_long dw;
|
||||
pScanDef scan = &dev->scanning;
|
||||
ScanDef *scan = &dev->scanning;
|
||||
|
||||
if((scan->sParam.bSource == SOURCE_Negative ||
|
||||
scan->sParam.bSource == SOURCE_Transparency) &&
|
||||
|
@ -285,7 +286,7 @@ static void usb_AverageGrayByte( Plustek_Device *dev )
|
|||
static void usb_AverageGrayWord( Plustek_Device *dev )
|
||||
{
|
||||
u_long dw;
|
||||
pScanDef scan = &dev->scanning;
|
||||
ScanDef *scan = &dev->scanning;
|
||||
|
||||
if((scan->sParam.bSource == SOURCE_Negative ||
|
||||
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) {
|
||||
|
||||
if( swap ) {
|
||||
tmp = *((pHiLoDef)&scan->Red.pw[dw]);
|
||||
tmp = *((HiLoDef*)&scan->Red.pw[dw]);
|
||||
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;
|
||||
|
||||
tmp = *((pHiLoDef)&scan->Blue.pw[dw]);
|
||||
tmp = *((HiLoDef*)&scan->Blue.pw[dw]);
|
||||
scan->UserBuf.pw_rgb[pixels].Blue = _HILO2WORD(tmp) >> ls;
|
||||
|
||||
} else {
|
||||
|
@ -721,7 +722,7 @@ static void usb_GrayDuplicatePseudo16( Plustek_Device *dev )
|
|||
*/
|
||||
static void usb_BWDuplicate( Plustek_Device *dev )
|
||||
{
|
||||
pScanDef scan = &dev->scanning;
|
||||
ScanDef *scan = &dev->scanning;
|
||||
|
||||
if(scan->sParam.bSource == SOURCE_ADF)
|
||||
{
|
||||
|
@ -1126,13 +1127,13 @@ static void usb_ColorScale16_2( Plustek_Device *dev )
|
|||
|
||||
if( swap ) {
|
||||
|
||||
tmp = *((pHiLoDef)&scan->Red.pw[bitsput]);
|
||||
tmp = *((HiLoDef*)&scan->Red.pw[bitsput]);
|
||||
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;
|
||||
|
||||
tmp = *((pHiLoDef)&scan->Blue.pw[bitsput]);
|
||||
tmp = *((HiLoDef*)&scan->Blue.pw[bitsput]);
|
||||
scan->UserBuf.pw_rgb[pixels].Blue = _HILO2WORD(tmp) >> ls;
|
||||
|
||||
} else {
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
* - 0.47 - cleanup work
|
||||
* - 0.48 - added support for binary from color scans
|
||||
* - 0.49 - changed usb_MapDownload
|
||||
* - 0.50 - cleanup
|
||||
* .
|
||||
* <hr>
|
||||
* 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 )
|
||||
{
|
||||
pScanDef scanning = &dev->scanning;
|
||||
pDCapsDef sc = &dev->usbDev.Caps;
|
||||
ScanDef *scanning = &dev->scanning;
|
||||
DCapsDef *sc = &dev->usbDev.Caps;
|
||||
|
||||
int color;
|
||||
int i, threshold;
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
* - 0.49 - a_bRegs is now part of the device structure
|
||||
* - using now PhyDpi.y as selector for the motor MCLK range
|
||||
* - changed usb_MapDownload prototype
|
||||
* - 0.50 - cleanup
|
||||
* .
|
||||
* <hr>
|
||||
* This file is part of the SANE package.
|
||||
|
@ -79,7 +80,7 @@ static SANE_Bool m_fAutoPark;
|
|||
static SANE_Bool m_fFirst;
|
||||
static double m_dHDPIDivider;
|
||||
static double m_dMCLKDivider;
|
||||
static pScanParam m_pParam;
|
||||
static ScanParam *m_pParam;
|
||||
static u_char m_bLineRateColor;
|
||||
static u_char m_bCM;
|
||||
static u_char m_bIntTimeAdjust;
|
||||
|
@ -103,7 +104,6 @@ static u_long usb_min( u_long val1, u_long val2 )
|
|||
{
|
||||
if( val1 > val2 )
|
||||
return val2;
|
||||
|
||||
return val1;
|
||||
}
|
||||
|
||||
|
@ -116,7 +116,6 @@ static u_long usb_max( u_long val1, u_long val2 )
|
|||
{
|
||||
if( val1 > val2 )
|
||||
return val1;
|
||||
|
||||
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 )
|
||||
{
|
||||
u_short res;
|
||||
pScanDef scanning = &dev->scanning;
|
||||
pDCapsDef scaps = &dev->usbDev.Caps;
|
||||
ScanDef *scanning = &dev->scanning;
|
||||
DCapsDef *scaps = &dev->usbDev.Caps;
|
||||
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 &&
|
||||
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);
|
||||
|
||||
DBG( _DBG_INFO2, "* XDPI=%u, HDPI=%.3f\n", res, m_dHDPIDivider );
|
||||
|
||||
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 )
|
||||
{
|
||||
pScanDef scanning = &dev->scanning;
|
||||
pDCapsDef sCaps = &dev->usbDev.Caps;
|
||||
pHWDef hw = &dev->usbDev.HwSetting;
|
||||
ScanDef *scanning = &dev->scanning;
|
||||
DCapsDef *sCaps = &dev->usbDev.Caps;
|
||||
HWDef *hw = &dev->usbDev.HwSetting;
|
||||
|
||||
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
|
||||
* @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;
|
||||
|
||||
/*
|
||||
* Set pixel packing, data mode and AFE operation
|
||||
*/
|
||||
/* Set pixel packing, data mode and AFE operation */
|
||||
switch( pParam->bDataType ) {
|
||||
case SCANDATATYPE_Color:
|
||||
m_bCM = 3;
|
||||
|
@ -318,12 +313,12 @@ static void usb_SetColorAndBits( Plustek_Device *dev, pScanParam pParam )
|
|||
* @param pParam - pointer to the current scan parameters
|
||||
* @return - Nothing
|
||||
*/
|
||||
static void usb_GetScanRect( Plustek_Device *dev, pScanParam pParam )
|
||||
static void usb_GetScanRect( Plustek_Device *dev, ScanParam *pParam )
|
||||
{
|
||||
u_short wDataPixelStart, wLineEnd;
|
||||
|
||||
pDCapsDef sCaps = &dev->usbDev.Caps;
|
||||
pHWDef hw = &dev->usbDev.HwSetting;
|
||||
DCapsDef *sCaps = &dev->usbDev.Caps;
|
||||
HWDef *hw = &dev->usbDev.HwSetting;
|
||||
u_char *regs = dev->usbDev.a_bRegs;
|
||||
|
||||
/* 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)
|
||||
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[0x4b] = _LOBYTE( pParam->Origin.y );
|
||||
|
@ -487,11 +483,11 @@ static void usb_GetScanRect( Plustek_Device *dev, pScanParam pParam )
|
|||
|
||||
/** 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;
|
||||
double mclkdiv = pParam->dMCLK;
|
||||
pHWDef hw = &dev->usbDev.HwSetting;
|
||||
HWDef *hw = &dev->usbDev.HwSetting;
|
||||
u_char *regs = dev->usbDev.a_bRegs;
|
||||
|
||||
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 st; /* step size reg 46:47 */
|
||||
|
||||
pHWDef hw = &dev->usbDev.HwSetting;
|
||||
HWDef *hw = &dev->usbDev.HwSetting;
|
||||
u_char *regs = dev->usbDev.a_bRegs;
|
||||
|
||||
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
|
||||
* 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 dMaxMCLKDivider;
|
||||
|
||||
pDCapsDef sCaps = &dev->usbDev.Caps;
|
||||
pHWDef hw = &dev->usbDev.HwSetting;
|
||||
DCapsDef *sCaps = &dev->usbDev.Caps;
|
||||
HWDef *hw = &dev->usbDev.HwSetting;
|
||||
u_char *regs = dev->usbDev.a_bRegs;
|
||||
|
||||
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
|
||||
*/
|
||||
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;
|
||||
|
||||
/* Compute step size using equation 1 */
|
||||
|
@ -784,7 +780,7 @@ static void usb_GetLineLength( Plustek_Device *dev )
|
|||
int tradj; /* ITA */
|
||||
int en_tradj;
|
||||
|
||||
pHWDef hw = &dev->usbDev.HwSetting;
|
||||
HWDef *hw = &dev->usbDev.HwSetting;
|
||||
u_char *regs = dev->usbDev.a_bRegs;
|
||||
|
||||
tpspd = (regs[0x0a] & 0x0c) >> 2; /* turbo/preview mode speed */
|
||||
|
@ -867,13 +863,13 @@ static void usb_GetLineLength( Plustek_Device *dev )
|
|||
/** usb_GetMotorParam
|
||||
* registers 0x56, 0x57
|
||||
*/
|
||||
static void usb_GetMotorParam( Plustek_Device *dev, pScanParam pParam )
|
||||
static void usb_GetMotorParam( Plustek_Device *dev, ScanParam *pParam )
|
||||
{
|
||||
int idx, i;
|
||||
pClkMotorDef clk;
|
||||
pMDef md;
|
||||
pDCapsDef sCaps = &dev->usbDev.Caps;
|
||||
pHWDef hw = &dev->usbDev.HwSetting;
|
||||
ClkMotorDef *clk;
|
||||
MDef *md;
|
||||
DCapsDef *sCaps = &dev->usbDev.Caps;
|
||||
HWDef *hw = &dev->usbDev.HwSetting;
|
||||
u_char *regs = dev->usbDev.a_bRegs;
|
||||
|
||||
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;
|
||||
pHWDef hw = &dev->usbDev.HwSetting;
|
||||
HWDef *hw = &dev->usbDev.HwSetting;
|
||||
u_char *regs = dev->usbDev.a_bRegs;
|
||||
|
||||
scaler = 1;
|
||||
|
@ -1078,9 +1074,9 @@ static void usb_GetPauseLimit( Plustek_Device *dev, pScanParam pParam )
|
|||
|
||||
/** 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->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
|
||||
*/
|
||||
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];
|
||||
|
||||
pScanParam pdParam = &dev->scanning.sParam;
|
||||
pHWDef hw = &dev->usbDev.HwSetting;
|
||||
ScanParam *pdParam = &dev->scanning.sParam;
|
||||
HWDef *hw = &dev->usbDev.HwSetting;
|
||||
u_char *regs = dev->usbDev.a_bRegs;
|
||||
|
||||
m_pParam = pParam;
|
||||
|
@ -1248,16 +1244,17 @@ static SANE_Bool usb_SetScanParameters( Plustek_Device *dev, pScanParam pParam )
|
|||
memset( ®s[0x03], 0, 3 );
|
||||
memset( ®s[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) {
|
||||
|
||||
u_short scansteps = (u_short)ceil((double)(pParam->Size.dwPhyLines + 10)*
|
||||
hw->wMotorDpi / pParam->PhyDpi.y);
|
||||
DBG( _DBG_INFO, "* Scansteps=%u (%lu*%u/%u)\n", scansteps,
|
||||
pParam->Size.dwPhyLines, hw->wMotorDpi, pParam->PhyDpi.y );
|
||||
#if 1
|
||||
regs[0x4c] = _HIBYTE(scansteps);
|
||||
regs[0x4d] = _LOBYTE(scansteps);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* set the merlin registers */
|
||||
|
@ -1279,8 +1276,8 @@ static SANE_Bool usb_ScanBegin( Plustek_Device *dev, SANE_Bool auto_park )
|
|||
{
|
||||
u_char value;
|
||||
u_short inches;
|
||||
pHWDef hw = &dev->usbDev.HwSetting;
|
||||
pDCapsDef sc = &dev->usbDev.Caps;
|
||||
HWDef *hw = &dev->usbDev.HwSetting;
|
||||
DCapsDef *sc = &dev->usbDev.Caps;
|
||||
u_char *regs = dev->usbDev.a_bRegs;
|
||||
|
||||
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 */
|
||||
if(( m_pParam->bCalibration == PARAM_Scan &&
|
||||
!usb_MapDownload( dev )) ||
|
||||
!usb_DownloadShadingData( dev, m_pParam->bCalibration ))
|
||||
if(( m_pParam->bCalibration == PARAM_Scan && !usb_MapDownload( dev )) ||
|
||||
!usb_DownloadShadingData( dev, m_pParam->bCalibration )) {
|
||||
return SANE_FALSE;
|
||||
}
|
||||
|
||||
/* Move chassis and start to read image data */
|
||||
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
|
||||
* 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" );
|
||||
|
||||
|
@ -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;
|
||||
ScanParam *pParam = &dev->scanning.sParam;
|
||||
|
|
|
@ -55,6 +55,7 @@
|
|||
* - 0.49 - added typedef struct DevList
|
||||
* - added button stuff
|
||||
* - added transferRate to struct Plustek_Device
|
||||
* - 0.50 - cleanup
|
||||
* .
|
||||
* <hr>
|
||||
* This file is part of the SANE package.
|
||||
|
@ -291,40 +292,40 @@ typedef struct {
|
|||
|
||||
double graygamma;
|
||||
|
||||
} AdjDef, *pAdjDef;
|
||||
} AdjDef;
|
||||
|
||||
typedef struct {
|
||||
unsigned short x;
|
||||
unsigned short y;
|
||||
unsigned short cx;
|
||||
unsigned short cy;
|
||||
} CropRect, *pCropRect;
|
||||
} CropRect;
|
||||
|
||||
typedef struct image {
|
||||
unsigned long dwFlag;
|
||||
CropRect crArea;
|
||||
XY xyDpi;
|
||||
unsigned short wDataType;
|
||||
} ImgDef, *pImgDef;
|
||||
} ImgDef;
|
||||
|
||||
typedef struct {
|
||||
unsigned long dwPixelsPerLine;
|
||||
unsigned long dwBytesPerLine;
|
||||
unsigned long dwLinesPerArea;
|
||||
ImgDef ImgDef;
|
||||
} CropInfo, *pCropInfo;
|
||||
} CropInfo;
|
||||
|
||||
typedef struct {
|
||||
ImgDef ImgDef;
|
||||
short siBrightness;
|
||||
short siContrast;
|
||||
} ScanInfo, *pScanInfo;
|
||||
} ScanInfo;
|
||||
|
||||
typedef struct {
|
||||
unsigned long dwFlag;
|
||||
unsigned short wMaxExtentX; /**< scanarea width */
|
||||
unsigned short wMaxExtentY; /**< scanarea height */
|
||||
} ScannerCaps, *pScannerCaps;
|
||||
} ScannerCaps;
|
||||
|
||||
typedef struct Plustek_Device
|
||||
{
|
||||
|
@ -355,7 +356,7 @@ typedef struct Plustek_Device
|
|||
struct itimerval saveSettings; /* for lamp timer */
|
||||
#endif
|
||||
|
||||
} Plustek_Device, *pPlustek_Device;
|
||||
} Plustek_Device;
|
||||
|
||||
#ifndef SANE_OPTION
|
||||
/* for compatibility with older versions */
|
||||
|
@ -390,7 +391,7 @@ typedef struct Plustek_Scanner
|
|||
|
||||
SANE_Option_Descriptor opt[NUM_OPTIONS];
|
||||
|
||||
} Plustek_Scanner, *pPlustek_Scanner;
|
||||
} Plustek_Scanner;
|
||||
|
||||
/** for collecting configuration info...
|
||||
*/
|
||||
|
@ -402,7 +403,7 @@ typedef struct {
|
|||
/* contains the stuff to adjust... */
|
||||
AdjDef adj;
|
||||
|
||||
} CnfDef, *pCnfDef;
|
||||
} CnfDef;
|
||||
|
||||
/** for supported device list
|
||||
*/
|
||||
|
|
Ładowanie…
Reference in New Issue