Use SANE_Status and SANE_TRUE/SANE_FALSE consistently.

merge-requests/1/head
Jan Hauffa 2011-03-13 21:07:55 +01:00 zatwierdzone przez m. allan noah
rodzic 8b3c78838a
commit d7b4e02780
7 zmienionych plików z 576 dodań i 587 usunięć

Wyświetl plik

@ -139,8 +139,8 @@ static Scanner_Model mustek_A2nu2_model = {
static SANE_Byte * g_lpNegImageData = NULL;
static SANE_Bool g_bIsFirstGetNegData = TRUE;
static SANE_Bool g_bIsMallocNegData = FALSE;
static SANE_Bool g_bIsFirstGetNegData = SANE_TRUE;
static SANE_Bool g_bIsMallocNegData = SANE_FALSE;
static unsigned int g_dwAlreadyGetNegLines = 0;
@ -472,7 +472,7 @@ init_options (Mustek_Scanner * s)
Parameters:
pSetParameters: the information of scaning
Return value:
TRUE if the operation success, FALSE otherwise
SANE_TRUE if the operation success, SANE_FALSE otherwise
***********************************************************************/
static SANE_Bool
SetParameters (LPSETPARAMETERS pSetParameters)
@ -514,29 +514,29 @@ SetParameters (LPSETPARAMETERS pSetParameters)
else
{
DBG (DBG_ERR, "SetParameters: ScanSource error\n");
return FALSE;
return SANE_FALSE;
}
/*4. Scan area */
if (pSetParameters->fmArea.x1 >= pSetParameters->fmArea.x2)
{
DBG (DBG_ERR, "SetParameters: x1 >= x2, error\n");
return FALSE;
return SANE_FALSE;
}
if (pSetParameters->fmArea.y1 >= pSetParameters->fmArea.y2)
{
DBG (DBG_ERR, "SetParameters: y1 >= y2, error\n");
return FALSE;
return SANE_FALSE;
}
if (pSetParameters->fmArea.x2 > MAX_SCANNING_WIDTH) /* Just for A4 size */
{
DBG (DBG_ERR, "SetParameters: x2 > MAX_SCANNING_WIDTH, error\n");
return FALSE;
return SANE_FALSE;
}
if (pSetParameters->fmArea.y2 > MAX_SCANNING_HEIGHT) /* Just for A4 size */
{
DBG (DBG_ERR, "SetParameters: y2 > MAX_SCANNING_HEIGHT, error\n");
return FALSE;
return SANE_FALSE;
}
X1inTargetDpi =
@ -566,10 +566,10 @@ SetParameters (LPSETPARAMETERS pSetParameters)
g_tiTarget.wHeight);
/*5.Prepare */
if (FALSE == MustScanner_Prepare (g_tiTarget.ssScanSource))
if (SANE_FALSE == MustScanner_Prepare (g_tiTarget.ssScanSource))
{
DBG (DBG_ERR, "SetParameters: MustScanner_Prepare fail\n");
return FALSE;
return SANE_FALSE;
}
/*6. Linear threshold */
@ -577,7 +577,7 @@ SetParameters (LPSETPARAMETERS pSetParameters)
&& pSetParameters->cmColorMode == CM_TEXT)
{
DBG (DBG_ERR, "SetParameters: LinearThreshold error\n");
return FALSE;
return SANE_FALSE;
}
g_wLineartThreshold = pSetParameters->wLinearThreshold;
@ -586,7 +586,7 @@ SetParameters (LPSETPARAMETERS pSetParameters)
{
DBG (DBG_INFO, "SetParameters: IN gamma table not NULL\n");
g_pGammaTable = pSetParameters->pGammaTable;
g_isSelfGamma = FALSE;
g_isSelfGamma = SANE_FALSE;
}
else if (pSetParameters->cmColorMode == CM_GRAY8
|| pSetParameters->cmColorMode == CM_RGB24)
@ -606,9 +606,9 @@ SetParameters (LPSETPARAMETERS pSetParameters)
if (NULL == g_pGammaTable)
{
DBG (DBG_ERR, "SetParameters: gamma table malloc fail\n");
return FALSE;
return SANE_FALSE;
}
g_isSelfGamma = TRUE;
g_isSelfGamma = SANE_TRUE;
for (i = 0; i < 4096; i++)
{
@ -630,9 +630,9 @@ SetParameters (LPSETPARAMETERS pSetParameters)
if (g_pGammaTable == NULL)
{
DBG (DBG_ERR, "SetParameters: gamma table malloc fail\n");
return FALSE;
return SANE_FALSE;
}
g_isSelfGamma = TRUE;
g_isSelfGamma = SANE_TRUE;
for (i = 0; i < 65536; i++)
{
@ -652,7 +652,7 @@ SetParameters (LPSETPARAMETERS pSetParameters)
}
DBG (DBG_FUNC, "SetParameters: exit\n");
return TRUE;
return SANE_TRUE;
}
/**********************************************************************
@ -660,16 +660,16 @@ SetParameters (LPSETPARAMETERS pSetParameters)
Parameters:
pGetParameters: the information of scan
Return value:
TRUE if the operation is success, FALSE otherwise
SANE_TRUE if the operation is success, SANE_FALSE otherwise
***********************************************************************/
static SANE_Bool
GetParameters (LPGETPARAMETERS pGetParameters)
{
DBG (DBG_FUNC, "GetParameters: start\n");
if (FALSE == MustScanner_ScanSuggest (&g_tiTarget, &g_ssSuggest))
if (SANE_FALSE == MustScanner_ScanSuggest (&g_tiTarget, &g_ssSuggest))
{
DBG (DBG_ERR, "GetParameters: MustScanner_ScanSuggest error\n");
return FALSE;
return SANE_FALSE;
}
pGetParameters->dwLength = (unsigned int) g_ssSuggest.wHeight;
@ -677,13 +677,13 @@ GetParameters (LPGETPARAMETERS pGetParameters)
DBG (DBG_FUNC, "GetParameters: exit\n");
return TRUE;
return SANE_TRUE;
}
/**********************************************************************
start scan image
Return value:
TRUE if operation is success, FALSE otherwise
SANE_TRUE if operation is success, SANE_FALSE otherwise
***********************************************************************/
static SANE_Bool
StartScan (void)
@ -720,7 +720,7 @@ StartScan (void)
Parameters:
pImageRows: the information of the data
Return value:
TRUE if the operation is success, FALSE otherwise
SANE_TRUE if the operation is success, SANE_FALSE otherwise
***********************************************************************/
static SANE_Bool
ReadScannedData (LPIMAGEROWS pImageRows)
@ -734,16 +734,16 @@ ReadScannedData (LPIMAGEROWS pImageRows)
DBG (DBG_FUNC, "ReadScannedData: start\n");
if (pImageRows->roRgbOrder == RO_RGB)
isRGBInvert = FALSE;
isRGBInvert = SANE_FALSE;
else
isRGBInvert = TRUE;
isRGBInvert = SANE_TRUE;
Rows = pImageRows->wWantedLineNum;
DBG (DBG_INFO, "ReadScannedData: wanted Rows = %d\n", Rows);
if (FALSE == MustScanner_GetRows (lpBlock, &Rows, isRGBInvert))
return FALSE;
if (SANE_FALSE == MustScanner_GetRows (lpBlock, &Rows, isRGBInvert))
return SANE_FALSE;
pImageRows->wXferedLineNum = Rows;
@ -767,10 +767,10 @@ ReadScannedData (LPIMAGEROWS pImageRows)
SANE_Byte * lpTempData = g_lpNegImageData;
DBG (DBG_INFO,
"ReadScannedData: malloc the negative data is success!\n");
g_bIsMallocNegData = TRUE;
g_bIsMallocNegData = SANE_TRUE;
if (!MustScanner_GetRows
(g_lpNegImageData, &g_SWHeight, isRGBInvert))
return FALSE;
return SANE_FALSE;
DBG (DBG_INFO, "ReadScannedData: get image data is over!\n");
@ -781,7 +781,7 @@ ReadScannedData (LPIMAGEROWS pImageRows)
g_ssSuggest.dwBytesPerRow);
DBG (DBG_INFO, "ReadScannedData: autolevel is ok\n");
}
g_bIsFirstGetNegData = FALSE;
g_bIsFirstGetNegData = SANE_FALSE;
}
if (g_bIsMallocNegData)
@ -799,9 +799,9 @@ ReadScannedData (LPIMAGEROWS pImageRows)
DBG (DBG_INFO, "ReadScannedData: free the image data!\n");
free (g_lpNegImageData);
g_lpNegImageData = NULL;
g_bIsFirstGetNegData = TRUE;
g_bIsFirstGetNegData = SANE_TRUE;
g_dwAlreadyGetNegLines = 0;
g_bIsMallocNegData = FALSE;
g_bIsMallocNegData = SANE_FALSE;
}
}
else
@ -810,7 +810,7 @@ ReadScannedData (LPIMAGEROWS pImageRows)
DBG (DBG_INFO,
"ReadScannedData: malloc the negative data is fail!\n");
if (!MustScanner_GetRows (lpReturnData, &Rows, isRGBInvert))
return FALSE;
return SANE_FALSE;
for (i = 0; i < TotalSize; i++)
*(lpReturnData++) ^= 0xff;
@ -819,9 +819,9 @@ ReadScannedData (LPIMAGEROWS pImageRows)
g_dwAlreadyGetNegLines += Rows;
if (g_dwAlreadyGetNegLines >= g_SWHeight)
{
g_bIsFirstGetNegData = TRUE;
g_bIsFirstGetNegData = SANE_TRUE;
g_dwAlreadyGetNegLines = 0;
g_bIsMallocNegData = FALSE;
g_bIsMallocNegData = SANE_FALSE;
}
}
@ -829,13 +829,13 @@ ReadScannedData (LPIMAGEROWS pImageRows)
DBG (DBG_FUNC, "ReadScannedData: leave ReadScannedData\n");
return TRUE;
return SANE_TRUE;
}
/**********************************************************************
Stop scan
Return value:
TRUE if operation is success, FALSE otherwise
SANE_TRUE if operation is success, SANE_FALSE otherwise
***********************************************************************/
static SANE_Bool
StopScan (void)
@ -880,7 +880,7 @@ StopScan (void)
/**********************************************************************
Check the status of TA
Return value:
TRUE if TA is connected, FALSE otherwise
SANE_TRUE if TA is connected, SANE_FALSE otherwise
***********************************************************************/
static SANE_Bool
IsTAConnected (void)
@ -889,15 +889,15 @@ IsTAConnected (void)
DBG (DBG_FUNC, "IsTAConnected: start\n");
if (Asic_Open (&g_chip) != STATUS_GOOD)
if (Asic_Open (&g_chip) != SANE_STATUS_GOOD)
{
return FALSE;
return SANE_FALSE;
}
if (Asic_IsTAConnected (&g_chip, &hasTA) != STATUS_GOOD)
if (Asic_IsTAConnected (&g_chip, &hasTA) != SANE_STATUS_GOOD)
{
Asic_Close (&g_chip);
return FALSE;
return SANE_FALSE;
}
Asic_Close (&g_chip);
@ -912,7 +912,7 @@ IsTAConnected (void)
Parameters:
pKey: the status of key
Return value:
TRUE if the operation is success, FALSE otherwise
SANE_TRUE if the operation is success, SANE_FALSE otherwise
***********************************************************************/
static SANE_Bool
GetKeyStatus (SANE_Byte * pKey)
@ -920,16 +920,16 @@ GetKeyStatus (SANE_Byte * pKey)
SANE_Byte pKeyTemp;
DBG (DBG_FUNC, "GetKeyStatus: start\n");
if (STATUS_GOOD != Asic_Open (&g_chip))
if (SANE_STATUS_GOOD != Asic_Open (&g_chip))
{
DBG (DBG_ERR, "GetKeyStatus: Asic_Open is fail\n");
return FALSE;
return SANE_FALSE;
}
if (STATUS_GOOD != Asic_CheckFunctionKey (&g_chip, &pKeyTemp))
if (SANE_STATUS_GOOD != Asic_CheckFunctionKey (&g_chip, &pKeyTemp))
{
DBG (DBG_ERR, "GetKeyStatus: Asic_CheckFunctionKey is fail\n");
return FALSE;
return SANE_FALSE;
}
if (0x01 == pKeyTemp)
@ -943,14 +943,14 @@ GetKeyStatus (SANE_Byte * pKey)
else if (0x10 == pKeyTemp)
*pKey = 0x05; /* Panel key pressed */
if (STATUS_GOOD != Asic_Close (&g_chip))
if (SANE_STATUS_GOOD != Asic_Close (&g_chip))
{
DBG (DBG_ERR, "GetKeyStatus: Asic_Close is fail\n");
return FALSE;
return SANE_FALSE;
}
DBG (DBG_FUNC, "GetKeyStatus: exit\n");
return TRUE;
return SANE_TRUE;
}
#endif
@ -1632,7 +1632,7 @@ sane_start (SANE_Handle handle)
s->params.bytes_per_line = s->getpara.dwLineByteWidth;
s->params.lines = s->getpara.dwLength;
s->params.last_frame = TRUE;
s->params.last_frame = SANE_TRUE;
s->read_rows = s->getpara.dwLength;

Wyświetl plik

@ -65,17 +65,6 @@
#define BYTE3(x) (SANE_Byte)(((unsigned int)(x) >> 24) & 0xff)
typedef enum
{
STATUS_GOOD = 0,
STATUS_CANCELLED,
STATUS_EOF,
STATUS_DEVICE_BUSY,
STATUS_INVAL,
STATUS_MEM_ERROR,
STATUS_IO_ERROR
} STATUS;
typedef enum
{
FS_ATTACHED = 1,
@ -214,12 +203,6 @@ typedef struct
#define DBG_DBG 10 /* useful only for tracing bugs */
#define DMA_BLOCK_SIZE (32 * 1024)
#define DRAM_TEST_SIZE 64
#define DRAM_1Mx16_SIZE (1024 * 1024)
#define PackAreaStartAddress ((DRAM_1Mx16_SIZE / 4) * 3)
#define ACTION_MODE_ACCDEC_MOVE 0
#define ACTION_MODE_UNIFORM_SPEED_MOVE 1
@ -238,14 +221,18 @@ typedef struct
#define SCAN_TYPE_CALIBRATE_LIGHT 1
#define SCAN_TYPE_CALIBRATE_DARK 2
#define BANK_SIZE (64)
#define DMA_BLOCK_SIZE (32 * 1024)
#define WaitBufferOneLineSize 11000*6
#define DRAM_TEST_SIZE 64
#define DRAM_1Mx16_SIZE (1024 * 1024)
#define PackAreaStartAddress ((DRAM_1Mx16_SIZE / 4) * 3)
#define ShadingTableSize(x) (((x + 10) * 6) + (((x + 10) * 6) / 240) * 16)
#define WaitBufferOneLineSize (11000 * 6)
#define BANK_SIZE 64
#define MOTOR_TABLE_SIZE (512 * 8)
#define TABLE_OFFSET_BASE 14
#define TABLE_BASE_SIZE (1 << TABLE_OFFSET_BASE)
#define ShadingTableSize(x) (((x + 10) * 6) + (((x + 10) * 6) / 240) * 16)
#define MOTOR_TABLE_SIZE (512 * 8)
#define TABLE_OFFSET_BASE 14
#define TABLE_BASE_SIZE (1 << TABLE_OFFSET_BASE)
#define LAMP0_PWM_DEFAULT 255
#define LAMP1_PWM_DEFAULT 255
@ -970,38 +957,40 @@ typedef struct
#define ES01_2CF_VALID_PIXEL_PARAMETER_OF_SEGMENT16 0x2CF
static STATUS WriteIOControl (PAsic chip, unsigned short wValue,
unsigned short wIndex, unsigned short wLength,
SANE_Byte * lpbuf);
static STATUS ReadIOControl (PAsic chip, unsigned short wValue,
unsigned short wIndex, unsigned short wLength,
SANE_Byte * lpbuf);
static STATUS Mustek_ClearFIFO (PAsic chip);
static STATUS SwitchBank (PAsic chip, unsigned short reg);
static STATUS Mustek_SendData (PAsic chip, unsigned short reg, SANE_Byte data);
static STATUS Mustek_ReceiveData (PAsic chip, SANE_Byte * reg);
static STATUS Mustek_WriteAddressLineForRegister (PAsic chip, SANE_Byte x);
static STATUS SetRWSize (PAsic chip, SANE_Byte ReadWrite, unsigned int size);
static STATUS Mustek_DMARead (PAsic chip, unsigned int size,
SANE_Byte * lpData);
static STATUS Mustek_DMAWrite (PAsic chip, unsigned int size,
SANE_Byte * lpData);
static STATUS Mustek_SendData2Byte (PAsic chip, unsigned short reg,
static SANE_Status WriteIOControl (PAsic chip, unsigned short wValue,
unsigned short wIndex,
unsigned short wLength, SANE_Byte * lpBuf);
static SANE_Status ReadIOControl (PAsic chip, unsigned short wValue,
unsigned short wIndex, unsigned short wLength,
SANE_Byte * lpBuf);
static SANE_Status Mustek_ClearFIFO (PAsic chip);
static SANE_Status SwitchBank (PAsic chip, unsigned short reg);
static SANE_Status Mustek_SendData (PAsic chip, unsigned short reg,
SANE_Byte data);
static SANE_Status Mustek_ReceiveData (PAsic chip, SANE_Byte * reg);
static SANE_Status Mustek_WriteAddressLineForRegister (PAsic chip, SANE_Byte x);
static SANE_Status SetRWSize (PAsic chip, SANE_Byte ReadWrite,
unsigned int size);
static SANE_Status Mustek_DMARead (PAsic chip, unsigned int size,
SANE_Byte * lpData);
static SANE_Status Mustek_DMAWrite (PAsic chip, unsigned int size,
SANE_Byte * lpData);
static SANE_Status Mustek_SendData2Byte (PAsic chip, unsigned short reg,
SANE_Byte data);
static STATUS LLFSetRamAddress (PAsic chip, unsigned int dwStartAddr,
unsigned int dwEndAddr,
SANE_Byte byAccessTarget);
static STATUS LLFRamAccess (PAsic chip, LLF_RAMACCESS * RamAccess);
static SANE_Status LLFSetRamAddress (PAsic chip, unsigned int dwStartAddr,
unsigned int dwEndAddr,
SANE_Byte byAccessTarget);
static SANE_Status LLFRamAccess (PAsic chip, LLF_RAMACCESS * RamAccess);
static void LLFSetMotorCurrentAndPhase (PAsic chip,
LLF_MOTOR_CURRENT_AND_PHASE *
MotorCurrentAndPhase);
static STATUS LLFSetMotorTable (PAsic chip, unsigned int dwTableBaseAddr,
unsigned short *MotorTablePtr);
static STATUS LLFSetShadingTable (PAsic chip, unsigned int dwTableBaseAddr,
unsigned int dwTableSize,
unsigned short *ShadingTablePtr);
static STATUS LLFMotorMove (PAsic chip, LLF_MOTORMOVE * LLF_MotorMove);
static SANE_Status LLFSetMotorTable (PAsic chip, unsigned int dwTableBaseAddr,
unsigned short *MotorTablePtr);
static SANE_Status LLFSetShadingTable (PAsic chip, unsigned int dwTableBaseAddr,
unsigned int dwTableSize,
unsigned short *ShadingTablePtr);
static SANE_Status LLFMotorMove (PAsic chip, LLF_MOTORMOVE * LLF_MotorMove);
static void SetMotorStepTable (PAsic chip, LLF_MOTORMOVE * MotorStepsTable,
unsigned short wStartY,
unsigned int dwScanImageSteps,
@ -1014,22 +1003,23 @@ static void CalculateScanMotorTable (LLF_CALCULATEMOTORTABLE *
static void CalculateMoveMotorTable (LLF_CALCULATEMOTORTABLE *
lpCalculateMotorTable);
static SANE_Byte CalculateMotorCurrent (unsigned short dwMotorSpeed);
static STATUS MotorMove (PAsic chip,
unsigned short wStartSpeed, unsigned short wEndSpeed,
unsigned int dwFixMoveSpeed, SANE_Byte bMotorCurrent,
unsigned int dwTotalSteps, SANE_Byte bActionType);
static SANE_Status MotorMove (PAsic chip, unsigned short wStartSpeed,
unsigned short wEndSpeed,
unsigned int dwFixMoveSpeed,
SANE_Byte bMotorCurrent,
unsigned int dwTotalSteps, SANE_Byte bActionType);
static void InitTiming (PAsic chip);
static STATUS OpenScanChip (PAsic chip);
static STATUS CloseScanChip (PAsic chip);
static STATUS PrepareScanChip (PAsic chip);
static STATUS SafeInitialChip (PAsic chip);
static STATUS DRAM_Test (PAsic chip);
static STATUS GetChipStatus (PAsic chip, SANE_Byte Selector,
SANE_Byte * ChipStatus);
static STATUS IsCarriageHome (PAsic chip, SANE_Bool * LampHome);
static STATUS WaitCarriageHome (PAsic chip);
static STATUS WaitUnitReady (PAsic chip);
static SANE_Status OpenScanChip (PAsic chip);
static SANE_Status CloseScanChip (PAsic chip);
static SANE_Status PrepareScanChip (PAsic chip);
static SANE_Status SafeInitialChip (PAsic chip);
static SANE_Status DRAM_Test (PAsic chip);
static SANE_Status GetChipStatus (PAsic chip, SANE_Byte Selector,
SANE_Byte * ChipStatus);
static SANE_Status IsCarriageHome (PAsic chip, SANE_Bool * LampHome);
static SANE_Status WaitCarriageHome (PAsic chip);
static SANE_Status WaitUnitReady (PAsic chip);
static void SetCCDTiming (PAsic chip);
static void SetLineTimeAndExposure (PAsic chip);
@ -1044,38 +1034,40 @@ static void SetExtraSettings (PAsic chip, unsigned short wXResolution,
unsigned short wCCD_PixelNumber,
SANE_Bool bypassShading);
static STATUS Asic_Open (PAsic chip);
static STATUS Asic_Close (PAsic chip);
static SANE_Status Asic_Open (PAsic chip);
static SANE_Status Asic_Close (PAsic chip);
static void Asic_Initialize (PAsic chip);
static STATUS Asic_TurnLamp (PAsic chip, SANE_Bool isLampOn);
static STATUS Asic_TurnTA (PAsic chip, SANE_Bool isTAOn);
static STATUS Asic_SetWindow (PAsic chip,
SANE_Byte bScanType, SANE_Byte bScanBits,
unsigned short wXResolution,
unsigned short wYResolution,
unsigned short wX, unsigned short wY,
unsigned short wWidth, unsigned short wLength);
static SANE_Status Asic_TurnLamp (PAsic chip, SANE_Bool isLampOn);
static SANE_Status Asic_TurnTA (PAsic chip, SANE_Bool isTAOn);
static SANE_Status Asic_SetWindow (PAsic chip,
SANE_Byte bScanType, SANE_Byte bScanBits,
unsigned short wXResolution,
unsigned short wYResolution,
unsigned short wX, unsigned short wY,
unsigned short wWidth,
unsigned short wLength);
static void Asic_ResetADParameters (PAsic chip, LIGHTSOURCE lsLightSource);
static STATUS Asic_ScanStart (PAsic chip);
static STATUS Asic_ScanStop (PAsic chip);
static STATUS Asic_ReadImage (PAsic chip, SANE_Byte * pBuffer,
unsigned short LinesCount);
static SANE_Status Asic_ScanStart (PAsic chip);
static SANE_Status Asic_ScanStop (PAsic chip);
static SANE_Status Asic_ReadImage (PAsic chip, SANE_Byte * pBuffer,
unsigned short LinesCount);
#if SANE_UNUSED
static STATUS Asic_CheckFunctionKey (PAsic chip, SANE_Byte * key);
static SANE_Status Asic_CheckFunctionKey (PAsic chip, SANE_Byte * key);
#endif
static STATUS Asic_IsTAConnected (PAsic chip, SANE_Bool *hasTA);
static SANE_Status Asic_IsTAConnected (PAsic chip, SANE_Bool *hasTA);
/* called by AdjustAD and FindTopLeft */
static STATUS Asic_ReadCalibrationData (PAsic chip, SANE_Byte * pBuffer,
unsigned int dwXferBytes,
SANE_Byte bScanBits);
static SANE_Status Asic_ReadCalibrationData (PAsic chip, SANE_Byte * pBuffer,
unsigned int dwXferBytes,
SANE_Byte bScanBits);
static STATUS Asic_MotorMove (PAsic chip, SANE_Bool isForward,
unsigned int dwTotalSteps);
static STATUS Asic_CarriageHome (PAsic chip);
static STATUS Asic_SetShadingTable (PAsic chip, unsigned short * lpWhiteShading,
unsigned short * lpDarkShading,
unsigned short wXResolution,
unsigned short wWidth);
static SANE_Status Asic_MotorMove (PAsic chip, SANE_Bool isForward,
unsigned int dwTotalSteps);
static SANE_Status Asic_CarriageHome (PAsic chip);
static SANE_Status Asic_SetShadingTable (PAsic chip,
unsigned short * lpWhiteShading,
unsigned short * lpDarkShading,
unsigned short wXResolution,
unsigned short wWidth);
#endif

Wyświetl plik

@ -113,7 +113,7 @@ static pthread_mutex_t g_readyLinesMutex = PTHREAD_MUTEX_INITIALIZER;
/* for modifying the last point */
static SANE_Byte * g_lpBefLineImageData = NULL;
static SANE_Bool g_bIsFirstReadBefData = TRUE;
static SANE_Bool g_bIsFirstReadBefData = SANE_TRUE;
static unsigned int g_dwAlreadyGetLines = 0;
static SANE_Byte QBET4 (SANE_Byte A, SANE_Byte B);
@ -144,13 +144,13 @@ MustScanner_Init (void)
g_dwCalibrationSize = 64L * 1024L;
g_lpReadImageHead = NULL;
g_isCanceled = FALSE;
g_bFirstReadImage = TRUE;
g_bOpened = FALSE;
g_bPrepared = FALSE;
g_isCanceled = SANE_FALSE;
g_bFirstReadImage = SANE_TRUE;
g_bOpened = SANE_FALSE;
g_bPrepared = SANE_FALSE;
g_isScanning = FALSE;
g_isSelfGamma = FALSE;
g_isScanning = SANE_FALSE;
g_isSelfGamma = SANE_FALSE;
g_pGammaTable = NULL;
g_ssScanSource = SS_Reflective;
@ -161,14 +161,14 @@ MustScanner_Init (void)
static SANE_Bool
MustScanner_GetScannerState (void)
{
if (STATUS_GOOD != Asic_Open (&g_chip))
if (SANE_STATUS_GOOD != Asic_Open (&g_chip))
{
DBG (DBG_FUNC, "MustScanner_GetScannerState: Asic_Open return error\n");
return FALSE;
return SANE_FALSE;
}
Asic_Close (&g_chip);
return TRUE;
return SANE_TRUE;
}
static SANE_Bool
@ -176,33 +176,33 @@ MustScanner_PowerControl (SANE_Bool isLampOn, SANE_Bool isTALampOn)
{
SANE_Bool hasTA;
DBG (DBG_FUNC, "MustScanner_PowerControl: Call in\n");
if (STATUS_GOOD != Asic_Open (&g_chip))
if (SANE_STATUS_GOOD != Asic_Open (&g_chip))
{
DBG (DBG_FUNC, "MustScanner_PowerControl: Asic_Open return error\n");
return FALSE;
return SANE_FALSE;
}
if (STATUS_GOOD != Asic_TurnLamp (&g_chip, isLampOn))
if (SANE_STATUS_GOOD != Asic_TurnLamp (&g_chip, isLampOn))
{
DBG (DBG_FUNC,
"MustScanner_PowerControl: Asic_TurnLamp return error\n");
return FALSE;
return SANE_FALSE;
}
if (STATUS_GOOD != Asic_IsTAConnected (&g_chip, &hasTA))
if (SANE_STATUS_GOOD != Asic_IsTAConnected (&g_chip, &hasTA))
{
DBG (DBG_FUNC,
"MustScanner_PowerControl: Asic_IsTAConnected return error\n");
return FALSE;
return SANE_FALSE;
}
if (hasTA)
{
if (STATUS_GOOD != Asic_TurnTA (&g_chip, isTALampOn))
if (SANE_STATUS_GOOD != Asic_TurnTA (&g_chip, isTALampOn))
{
DBG (DBG_FUNC,
"MustScanner_PowerControl: Asic_TurnTA return error\n");
return FALSE;
return SANE_FALSE;
}
}
@ -210,7 +210,7 @@ MustScanner_PowerControl (SANE_Bool isLampOn, SANE_Bool isTALampOn)
DBG (DBG_FUNC,
"MustScanner_PowerControl: leave MustScanner_PowerControl\n");
return TRUE;
return SANE_TRUE;
}
static SANE_Bool
@ -218,23 +218,23 @@ MustScanner_BackHome (void)
{
DBG (DBG_FUNC, "MustScanner_BackHome: call in\n");
if (STATUS_GOOD != Asic_Open (&g_chip))
if (SANE_STATUS_GOOD != Asic_Open (&g_chip))
{
DBG (DBG_FUNC, "MustScanner_BackHome: Asic_Open return error\n");
return FALSE;
return SANE_FALSE;
}
if (STATUS_GOOD != Asic_CarriageHome (&g_chip))
if (SANE_STATUS_GOOD != Asic_CarriageHome (&g_chip))
{
DBG (DBG_FUNC,
"MustScanner_BackHome: Asic_CarriageHome return error\n");
return FALSE;
return SANE_FALSE;
}
Asic_Close (&g_chip);
DBG (DBG_FUNC, "MustScanner_BackHome: leave MustScanner_BackHome\n");
return TRUE;
return SANE_TRUE;
}
static SANE_Bool
@ -242,19 +242,19 @@ MustScanner_Prepare (SCANSOURCE ssScanSource)
{
DBG (DBG_FUNC, "MustScanner_Prepare: call in\n");
if (STATUS_GOOD != Asic_Open (&g_chip))
if (SANE_STATUS_GOOD != Asic_Open (&g_chip))
{
DBG (DBG_FUNC, "MustScanner_Prepare: Asic_Open return error\n");
return FALSE;
return SANE_FALSE;
}
if (SS_Reflective == ssScanSource)
{
DBG (DBG_FUNC, "MustScanner_Prepare:ScanSource is SS_Reflective\n");
if (STATUS_GOOD != Asic_TurnLamp (&g_chip, TRUE))
if (SANE_STATUS_GOOD != Asic_TurnLamp (&g_chip, SANE_TRUE))
{
DBG (DBG_FUNC, "MustScanner_Prepare: Asic_TurnLamp return error\n");
return FALSE;
return SANE_FALSE;
}
g_chip.lsLightSource = LS_REFLECTIVE;
@ -262,10 +262,10 @@ MustScanner_Prepare (SCANSOURCE ssScanSource)
else if (SS_Positive == ssScanSource)
{
DBG (DBG_FUNC, "MustScanner_Prepare:ScanSource is SS_Positive\n");
if (STATUS_GOOD != Asic_TurnTA (&g_chip, TRUE))
if (SANE_STATUS_GOOD != Asic_TurnTA (&g_chip, SANE_TRUE))
{
DBG (DBG_FUNC, "MustScanner_Prepare: Asic_TurnTA return error\n");
return FALSE;
return SANE_FALSE;
}
g_chip.lsLightSource = LS_POSITIVE;
@ -273,20 +273,20 @@ MustScanner_Prepare (SCANSOURCE ssScanSource)
else if (SS_Negative == ssScanSource)
{
DBG (DBG_FUNC, "MustScanner_Prepare:ScanSource is SS_Negative\n");
if (STATUS_GOOD != Asic_TurnTA (&g_chip, TRUE))
if (SANE_STATUS_GOOD != Asic_TurnTA (&g_chip, SANE_TRUE))
{
DBG (DBG_FUNC, "MustScanner_Prepare: Asic_TurnTA return error\n");
return FALSE;
return SANE_FALSE;
}
g_chip.lsLightSource = LS_NEGATIVE;
}
Asic_Close (&g_chip);
g_bPrepared = TRUE;
g_bPrepared = SANE_TRUE;
DBG (DBG_FUNC, "MustScanner_Prepare: leave MustScanner_Prepare\n");
return TRUE;
return SANE_TRUE;
}
static unsigned short
@ -333,8 +333,8 @@ MustScanner_GetRgb48BitLine (SANE_Byte * lpLine, SANE_Bool isOrderInvert,
DBG (DBG_FUNC, "MustScanner_GetRgb48BitLine: call in\n");
g_isCanceled = FALSE;
g_isScanning = TRUE;
g_isCanceled = SANE_FALSE;
g_isScanning = SANE_TRUE;
wWantedTotalLines = *wLinesCount;
TotalXferLines = 0;
@ -343,7 +343,7 @@ MustScanner_GetRgb48BitLine (SANE_Byte * lpLine, SANE_Bool isOrderInvert,
pthread_create (&g_threadid_readimage, NULL,
MustScanner_ReadDataFromScanner, NULL);
DBG (DBG_FUNC, "MustScanner_GetRgb48BitLine: thread create\n");
g_bFirstReadImage = FALSE;
g_bFirstReadImage = SANE_FALSE;
}
if (!isOrderInvert)
@ -357,8 +357,8 @@ MustScanner_GetRgb48BitLine (SANE_Byte * lpLine, SANE_Bool isOrderInvert,
DBG (DBG_FUNC, "MustScanner_GetRgb48BitLine: thread exit\n");
*wLinesCount = TotalXferLines;
g_isScanning = FALSE;
return TRUE;
g_isScanning = SANE_FALSE;
return SANE_TRUE;
}
if (GetScannedLines () > g_wtheReadyLines)
@ -429,8 +429,8 @@ MustScanner_GetRgb48BitLine (SANE_Byte * lpLine, SANE_Bool isOrderInvert,
*wLinesCount = TotalXferLines;
g_isScanning = FALSE;
return TRUE;
g_isScanning = SANE_FALSE;
return SANE_TRUE;
}
if (GetScannedLines () > g_wtheReadyLines)
@ -491,11 +491,11 @@ MustScanner_GetRgb48BitLine (SANE_Byte * lpLine, SANE_Bool isOrderInvert,
}
*wLinesCount = TotalXferLines;
g_isScanning = FALSE;
g_isScanning = SANE_FALSE;
DBG (DBG_FUNC,
"MustScanner_GetRgb48BitLine: leave MustScanner_GetRgb48BitLine\n");
return TRUE;
return SANE_TRUE;
}
static SANE_Bool
@ -522,15 +522,15 @@ MustScanner_GetRgb48BitLine1200DPI (SANE_Byte * lpLine, SANE_Bool isOrderInvert,
TotalXferLines = 0;
wWantedTotalLines = *wLinesCount;
g_isCanceled = FALSE;
g_isScanning = TRUE;
g_isCanceled = SANE_FALSE;
g_isScanning = SANE_TRUE;
if (g_bFirstReadImage)
{
pthread_create (&g_threadid_readimage, NULL,
MustScanner_ReadDataFromScanner, NULL);
DBG (DBG_FUNC, "MustScanner_GetRgb48BitLine1200DPI: thread create\n");
g_bFirstReadImage = FALSE;
g_bFirstReadImage = SANE_FALSE;
}
if (!isOrderInvert)
@ -545,8 +545,8 @@ MustScanner_GetRgb48BitLine1200DPI (SANE_Byte * lpLine, SANE_Bool isOrderInvert,
"MustScanner_GetRgb48BitLine1200DPI: thread exit\n");
*wLinesCount = TotalXferLines;
g_isScanning = FALSE;
return TRUE;
g_isScanning = SANE_FALSE;
return SANE_TRUE;
}
if (GetScannedLines () > g_wtheReadyLines)
@ -739,8 +739,8 @@ MustScanner_GetRgb48BitLine1200DPI (SANE_Byte * lpLine, SANE_Bool isOrderInvert,
"MustScanner_GetRgb48BitLine1200DPI: thread exit\n");
*wLinesCount = TotalXferLines;
g_isScanning = FALSE;
return TRUE;
g_isScanning = SANE_FALSE;
return SANE_TRUE;
}
if (GetScannedLines () > g_wtheReadyLines)
@ -921,11 +921,11 @@ MustScanner_GetRgb48BitLine1200DPI (SANE_Byte * lpLine, SANE_Bool isOrderInvert,
}
*wLinesCount = TotalXferLines;
g_isScanning = FALSE;
g_isScanning = SANE_FALSE;
DBG (DBG_FUNC, "MustScanner_GetRgb48BitLine1200DPI: " \
"leave MustScanner_GetRgb48BitLine1200DPI\n");
return TRUE;
return SANE_TRUE;
}
static SANE_Bool
@ -947,8 +947,8 @@ MustScanner_GetRgb24BitLine (SANE_Byte * lpLine, SANE_Bool isOrderInvert,
DBG (DBG_FUNC, "MustScanner_GetRgb24BitLine: call in\n");
g_isCanceled = FALSE;
g_isScanning = TRUE;
g_isCanceled = SANE_FALSE;
g_isScanning = SANE_TRUE;
wWantedTotalLines = *wLinesCount;
DBG (DBG_FUNC,
@ -963,7 +963,7 @@ MustScanner_GetRgb24BitLine (SANE_Byte * lpLine, SANE_Bool isOrderInvert,
MustScanner_ReadDataFromScanner, NULL);
DBG (DBG_FUNC, "MustScanner_GetRgb24BitLine: thread create\n");
g_bFirstReadImage = FALSE;
g_bFirstReadImage = SANE_FALSE;
}
if (!isOrderInvert)
@ -979,8 +979,8 @@ MustScanner_GetRgb24BitLine (SANE_Byte * lpLine, SANE_Bool isOrderInvert,
DBG (DBG_FUNC, "MustScanner_GetRgb24BitLine: thread exit\n");
*wLinesCount = TotalXferLines;
g_isScanning = FALSE;
return TRUE;
g_isScanning = SANE_FALSE;
return SANE_TRUE;
}
if (GetScannedLines () > g_wtheReadyLines)
@ -1061,7 +1061,7 @@ MustScanner_GetRgb24BitLine (SANE_Byte * lpLine, SANE_Bool isOrderInvert,
}
else
{
DBG (DBG_FUNC, "MustScanner_GetRgb24BitLine: isOrderInvert is TRUE\n");
DBG (DBG_FUNC, "MustScanner_GetRgb24BitLine: isOrderInvert is SANE_TRUE\n");
while (TotalXferLines < wWantedTotalLines)
{
if (g_dwTotalTotalXferLines >= g_SWHeight)
@ -1071,8 +1071,8 @@ MustScanner_GetRgb24BitLine (SANE_Byte * lpLine, SANE_Bool isOrderInvert,
DBG (DBG_FUNC, "MustScanner_GetRgb24BitLine: thread exit\n");
*wLinesCount = TotalXferLines;
g_isScanning = FALSE;
return TRUE;
g_isScanning = SANE_FALSE;
return SANE_TRUE;
}
if (GetScannedLines () > g_wtheReadyLines)
@ -1164,11 +1164,11 @@ MustScanner_GetRgb24BitLine (SANE_Byte * lpLine, SANE_Bool isOrderInvert,
}
*wLinesCount = TotalXferLines;
g_isScanning = FALSE;
g_isScanning = SANE_FALSE;
DBG (DBG_FUNC,
"MustScanner_GetRgb24BitLine: leave MustScanner_GetRgb24BitLine\n");
return TRUE;
return SANE_TRUE;
}
static SANE_Bool
@ -1192,8 +1192,8 @@ MustScanner_GetRgb24BitLine1200DPI (SANE_Byte * lpLine, SANE_Bool isOrderInvert,
DBG (DBG_FUNC, "MustScanner_GetRgb24BitLine1200DPI: call in\n");
g_isCanceled = FALSE;
g_isScanning = TRUE;
g_isCanceled = SANE_FALSE;
g_isScanning = SANE_TRUE;
TotalXferLines = 0;
wWantedTotalLines = *wLinesCount;
lpTemp = lpLine;
@ -1204,7 +1204,7 @@ MustScanner_GetRgb24BitLine1200DPI (SANE_Byte * lpLine, SANE_Bool isOrderInvert,
MustScanner_ReadDataFromScanner, NULL);
DBG (DBG_FUNC, "MustScanner_GetRgb24BitLine1200DPI: thread create\n");
g_bFirstReadImage = FALSE;
g_bFirstReadImage = SANE_FALSE;
}
if (!isOrderInvert)
@ -1226,8 +1226,8 @@ MustScanner_GetRgb24BitLine1200DPI (SANE_Byte * lpLine, SANE_Bool isOrderInvert,
"MustScanner_GetRgb24BitLine1200DPI: thread exit\n");
*wLinesCount = TotalXferLines;
g_isScanning = FALSE;
return TRUE;
g_isScanning = SANE_FALSE;
return SANE_TRUE;
}
if (GetScannedLines () > g_wtheReadyLines)
@ -1414,8 +1414,8 @@ MustScanner_GetRgb24BitLine1200DPI (SANE_Byte * lpLine, SANE_Bool isOrderInvert,
"MustScanner_GetRgb24BitLine1200DPI: thread exit\n");
*wLinesCount = TotalXferLines;
g_isScanning = FALSE;
return TRUE;
g_isScanning = SANE_FALSE;
return SANE_TRUE;
}
if (GetScannedLines () > g_wtheReadyLines)
@ -1583,11 +1583,11 @@ MustScanner_GetRgb24BitLine1200DPI (SANE_Byte * lpLine, SANE_Bool isOrderInvert,
}
*wLinesCount = TotalXferLines;
g_isScanning = FALSE;
g_isScanning = SANE_FALSE;
DBG (DBG_FUNC, "MustScanner_GetRgb24BitLine1200DPI: " \
"leave MustScanner_GetRgb24BitLine1200DPI\n");
return TRUE;
return SANE_TRUE;
}
static SANE_Bool
@ -1603,8 +1603,8 @@ MustScanner_GetMono16BitLine (SANE_Byte * lpLine, unsigned short * wLinesCount)
DBG (DBG_FUNC, "MustScanner_GetMono16BitLine: call in\n");
TotalXferLines = 0;
g_isCanceled = FALSE;
g_isScanning = TRUE;
g_isCanceled = SANE_FALSE;
g_isScanning = SANE_TRUE;
wWantedTotalLines = *wLinesCount;
if (g_bFirstReadImage)
@ -1612,7 +1612,7 @@ MustScanner_GetMono16BitLine (SANE_Byte * lpLine, unsigned short * wLinesCount)
pthread_create (&g_threadid_readimage, NULL,
MustScanner_ReadDataFromScanner, NULL);
DBG (DBG_FUNC, "MustScanner_GetMono16BitLine: thread create\n");
g_bFirstReadImage = FALSE;
g_bFirstReadImage = SANE_FALSE;
}
while (TotalXferLines < wWantedTotalLines)
@ -1625,8 +1625,8 @@ MustScanner_GetMono16BitLine (SANE_Byte * lpLine, unsigned short * wLinesCount)
DBG (DBG_FUNC, "MustScanner_GetMono16BitLine: thread exit\n");
*wLinesCount = TotalXferLines;
g_isScanning = FALSE;
return TRUE;
g_isScanning = SANE_FALSE;
return SANE_TRUE;
}
if (GetScannedLines () > g_wtheReadyLines)
@ -1660,11 +1660,11 @@ MustScanner_GetMono16BitLine (SANE_Byte * lpLine, unsigned short * wLinesCount)
}
*wLinesCount = TotalXferLines;
g_isScanning = FALSE;
g_isScanning = SANE_FALSE;
DBG (DBG_FUNC,
"MustScanner_GetMono16BitLine: leave MustScanner_GetMono16BitLine\n");
return TRUE;
return SANE_TRUE;
}
static SANE_Bool
@ -1682,8 +1682,8 @@ MustScanner_GetMono16BitLine1200DPI (SANE_Byte * lpLine,
DBG (DBG_FUNC, "MustScanner_GetMono16BitLine1200DPI: call in\n");
TotalXferLines = 0;
g_isCanceled = FALSE;
g_isScanning = TRUE;
g_isCanceled = SANE_FALSE;
g_isScanning = SANE_TRUE;
wWantedTotalLines = *wLinesCount;
if (g_bFirstReadImage)
@ -1691,7 +1691,7 @@ MustScanner_GetMono16BitLine1200DPI (SANE_Byte * lpLine,
pthread_create (&g_threadid_readimage, NULL,
MustScanner_ReadDataFromScanner, NULL);
DBG (DBG_FUNC, "MustScanner_GetMono16BitLine1200DPI: thread create\n");
g_bFirstReadImage = FALSE;
g_bFirstReadImage = SANE_FALSE;
}
while (TotalXferLines < wWantedTotalLines)
@ -1704,8 +1704,8 @@ MustScanner_GetMono16BitLine1200DPI (SANE_Byte * lpLine,
"MustScanner_GetMono16BitLine1200DPI: thread exit\n");
*wLinesCount = TotalXferLines;
g_isScanning = FALSE;
return TRUE;
g_isScanning = SANE_FALSE;
return SANE_TRUE;
}
if (GetScannedLines () > g_wtheReadyLines)
@ -1795,7 +1795,7 @@ MustScanner_GetMono16BitLine1200DPI (SANE_Byte * lpLine,
}
*wLinesCount = TotalXferLines;
g_isScanning = FALSE;
g_isScanning = SANE_FALSE;
/* modify the last point */
if (g_bIsFirstReadBefData)
@ -1803,11 +1803,11 @@ MustScanner_GetMono16BitLine1200DPI (SANE_Byte * lpLine,
g_lpBefLineImageData = malloc (g_SWBytesPerRow);
if (NULL == g_lpBefLineImageData)
{
return FALSE;
return SANE_FALSE;
}
memset (g_lpBefLineImageData, 0, g_SWBytesPerRow);
memcpy (g_lpBefLineImageData, lpTemp, g_SWBytesPerRow);
g_bIsFirstReadBefData = FALSE;
g_bIsFirstReadBefData = SANE_FALSE;
}
ModifyLinePoint (lpTemp, g_lpBefLineImageData, g_SWBytesPerRow,
@ -1824,12 +1824,12 @@ MustScanner_GetMono16BitLine1200DPI (SANE_Byte * lpLine,
free (g_lpBefLineImageData);
g_lpBefLineImageData = NULL;
g_dwAlreadyGetLines = 0;
g_bIsFirstReadBefData = TRUE;
g_bIsFirstReadBefData = SANE_TRUE;
}
DBG (DBG_FUNC, "MustScanner_GetMono16BitLine1200DPI: " \
"leave MustScanner_GetMono16BitLine1200DPI\n");
return TRUE;
return SANE_TRUE;
}
static SANE_Bool
@ -1844,8 +1844,8 @@ MustScanner_GetMono8BitLine (SANE_Byte * lpLine, unsigned short * wLinesCount)
DBG (DBG_FUNC, "MustScanner_GetMono8BitLine: call in\n");
TotalXferLines = 0;
g_isCanceled = FALSE;
g_isScanning = TRUE;
g_isCanceled = SANE_FALSE;
g_isScanning = SANE_TRUE;
wWantedTotalLines = *wLinesCount;
if (g_bFirstReadImage)
@ -1853,7 +1853,7 @@ MustScanner_GetMono8BitLine (SANE_Byte * lpLine, unsigned short * wLinesCount)
pthread_create (&g_threadid_readimage, NULL,
MustScanner_ReadDataFromScanner, NULL);
DBG (DBG_FUNC, "MustScanner_GetMono8BitLine: thread create\n");
g_bFirstReadImage = FALSE;
g_bFirstReadImage = SANE_FALSE;
}
while (TotalXferLines < wWantedTotalLines)
@ -1865,8 +1865,8 @@ MustScanner_GetMono8BitLine (SANE_Byte * lpLine, unsigned short * wLinesCount)
DBG (DBG_FUNC, "MustScanner_GetMono8BitLine: thread exit\n");
*wLinesCount = TotalXferLines;
g_isScanning = FALSE;
return TRUE;
g_isScanning = SANE_FALSE;
return SANE_TRUE;
}
if (GetScannedLines () > g_wtheReadyLines)
@ -1899,11 +1899,11 @@ MustScanner_GetMono8BitLine (SANE_Byte * lpLine, unsigned short * wLinesCount)
}
*wLinesCount = TotalXferLines;
g_isScanning = FALSE;
g_isScanning = SANE_FALSE;
DBG (DBG_FUNC,
"MustScanner_GetMono8BitLine: leave MustScanner_GetMono8BitLine\n");
return TRUE;
return SANE_TRUE;
}
static SANE_Bool
@ -1923,8 +1923,8 @@ MustScanner_GetMono8BitLine1200DPI (SANE_Byte * lpLine,
DBG (DBG_FUNC, "MustScanner_GetMono8BitLine1200DPI: call in\n");
TotalXferLines = 0;
g_isCanceled = FALSE;
g_isScanning = TRUE;
g_isCanceled = SANE_FALSE;
g_isScanning = SANE_TRUE;
wWantedTotalLines = *wLinesCount;
lpTemp = lpLine;
@ -1933,7 +1933,7 @@ MustScanner_GetMono8BitLine1200DPI (SANE_Byte * lpLine,
pthread_create (&g_threadid_readimage, NULL,
MustScanner_ReadDataFromScanner, NULL);
DBG (DBG_FUNC, "MustScanner_GetMono8BitLine1200DPI: thread create\n");
g_bFirstReadImage = FALSE;
g_bFirstReadImage = SANE_FALSE;
}
while (TotalXferLines < wWantedTotalLines)
@ -1945,8 +1945,8 @@ MustScanner_GetMono8BitLine1200DPI (SANE_Byte * lpLine,
DBG (DBG_FUNC, "MustScanner_GetMono8BitLine1200DPI: thread exit\n");
*wLinesCount = TotalXferLines;
g_isScanning = FALSE;
return TRUE;
g_isScanning = SANE_FALSE;
return SANE_TRUE;
}
if (GetScannedLines () > g_wtheReadyLines)
@ -2014,17 +2014,17 @@ MustScanner_GetMono8BitLine1200DPI (SANE_Byte * lpLine,
*wLinesCount = TotalXferLines;
g_isScanning = FALSE;
g_isScanning = SANE_FALSE;
/* modify the last point */
if (g_bIsFirstReadBefData)
{
g_lpBefLineImageData = malloc (g_SWBytesPerRow);
if (NULL == g_lpBefLineImageData)
return FALSE;
return SANE_FALSE;
memset (g_lpBefLineImageData, 0, g_SWBytesPerRow);
memcpy (g_lpBefLineImageData, lpTemp, g_SWBytesPerRow);
g_bIsFirstReadBefData = FALSE;
g_bIsFirstReadBefData = SANE_FALSE;
}
ModifyLinePoint (lpTemp, g_lpBefLineImageData, g_SWBytesPerRow,
@ -2041,12 +2041,12 @@ MustScanner_GetMono8BitLine1200DPI (SANE_Byte * lpLine,
free (g_lpBefLineImageData);
g_lpBefLineImageData = NULL;
g_dwAlreadyGetLines = 0;
g_bIsFirstReadBefData = TRUE;
g_bIsFirstReadBefData = SANE_TRUE;
}
DBG (DBG_FUNC, "MustScanner_GetMono8BitLine1200DPI: " \
"leave MustScanner_GetMono8BitLine1200DPI\n");
return TRUE;
return SANE_TRUE;
}
static SANE_Bool
@ -2059,8 +2059,8 @@ MustScanner_GetMono1BitLine (SANE_Byte * lpLine, unsigned short * wLinesCount)
DBG (DBG_FUNC, "MustScanner_GetMono1BitLine: call in\n");
g_isCanceled = FALSE;
g_isScanning = TRUE;
g_isCanceled = SANE_FALSE;
g_isScanning = SANE_TRUE;
wWantedTotalLines = *wLinesCount;
if (g_bFirstReadImage)
@ -2068,7 +2068,7 @@ MustScanner_GetMono1BitLine (SANE_Byte * lpLine, unsigned short * wLinesCount)
pthread_create (&g_threadid_readimage, NULL,
MustScanner_ReadDataFromScanner, NULL);
DBG (DBG_FUNC, "MustScanner_GetMono1BitLine: thread create\n");
g_bFirstReadImage = FALSE;
g_bFirstReadImage = SANE_FALSE;
}
memset (lpLine, 0, wWantedTotalLines * g_SWWidth / 8);
@ -2082,8 +2082,8 @@ MustScanner_GetMono1BitLine (SANE_Byte * lpLine, unsigned short * wLinesCount)
DBG (DBG_FUNC, "MustScanner_GetMono1BitLine: thread exit\n");
*wLinesCount = TotalXferLines;
g_isScanning = FALSE;
return TRUE;
g_isScanning = SANE_FALSE;
return SANE_TRUE;
}
if (GetScannedLines () > g_wtheReadyLines)
@ -2112,11 +2112,11 @@ MustScanner_GetMono1BitLine (SANE_Byte * lpLine, unsigned short * wLinesCount)
}
*wLinesCount = TotalXferLines;
g_isScanning = FALSE;
g_isScanning = SANE_FALSE;
DBG (DBG_FUNC,
"MustScanner_GetMono1BitLine: leave MustScanner_GetMono1BitLine\n");
return TRUE;
return SANE_TRUE;
}
static SANE_Bool
@ -2131,8 +2131,8 @@ MustScanner_GetMono1BitLine1200DPI (SANE_Byte * lpLine,
DBG (DBG_FUNC, "MustScanner_GetMono1BitLine1200DPI: call in\n");
g_isCanceled = FALSE;
g_isScanning = TRUE;
g_isCanceled = SANE_FALSE;
g_isScanning = SANE_TRUE;
wWantedTotalLines = *wLinesCount;
if (g_bFirstReadImage)
@ -2140,7 +2140,7 @@ MustScanner_GetMono1BitLine1200DPI (SANE_Byte * lpLine,
pthread_create (&g_threadid_readimage, NULL,
MustScanner_ReadDataFromScanner, NULL);
DBG (DBG_FUNC, "MustScanner_GetMono1BitLine1200DPI: thread create\n");
g_bFirstReadImage = FALSE;
g_bFirstReadImage = SANE_FALSE;
}
memset (lpLine, 0, wWantedTotalLines * g_SWWidth / 8);
@ -2154,8 +2154,8 @@ MustScanner_GetMono1BitLine1200DPI (SANE_Byte * lpLine,
DBG (DBG_FUNC, "MustScanner_GetMono1BitLine1200DPI: thread exit\n");
*wLinesCount = TotalXferLines;
g_isScanning = FALSE;
return TRUE;
g_isScanning = SANE_FALSE;
return SANE_TRUE;
}
if (GetScannedLines () > g_wtheReadyLines)
@ -2206,11 +2206,11 @@ MustScanner_GetMono1BitLine1200DPI (SANE_Byte * lpLine,
} /* end for */
*wLinesCount = TotalXferLines;
g_isScanning = FALSE;
g_isScanning = SANE_FALSE;
DBG (DBG_FUNC, "MustScanner_GetMono1BitLine1200DPI: " \
"leave MustScanner_GetMono1BitLine1200DPI\n");
return TRUE;
return SANE_TRUE;
}
static void
@ -2312,7 +2312,7 @@ MustScanner_ReadDataFromScanner (void __sane_unused__ * dummy)
unsigned short wTotalReadImageLines = 0;
unsigned short wWantedLines = g_Height;
SANE_Byte * lpReadImage = g_lpReadImageHead;
SANE_Bool isWaitImageLineDiff = FALSE;
SANE_Bool isWaitImageLineDiff = SANE_FALSE;
unsigned int wMaxScanLines = g_wMaxScanLines;
unsigned short wReadImageLines = 0;
unsigned short wScanLinesThisBlock;
@ -2336,7 +2336,7 @@ MustScanner_ReadDataFromScanner (void __sane_unused__ * dummy)
"MustScanner_ReadDataFromScanner: wScanLinesThisBlock=%d\n",
wScanLinesThisBlock);
if (STATUS_GOOD !=
if (SANE_STATUS_GOOD !=
Asic_ReadImage (&g_chip, lpReadImage, wScanLinesThisBlock))
{
DBG (DBG_FUNC, "MustScanner_ReadDataFromScanner: Asic_ReadImage" \
@ -2362,13 +2362,13 @@ MustScanner_ReadDataFromScanner (void __sane_unused__ * dummy)
(wMaxScanLines - (wBufferLines + g_wScanLinesPerBlock)) &&
g_dwScannedTotalLines > GetReadyLines ())
{
isWaitImageLineDiff = TRUE;
isWaitImageLineDiff = SANE_TRUE;
}
}
else if (g_dwScannedTotalLines <=
GetReadyLines () + wBufferLines + g_wScanLinesPerBlock)
{
isWaitImageLineDiff = FALSE;
isWaitImageLineDiff = SANE_FALSE;
}
pthread_testcancel ();
@ -2490,7 +2490,7 @@ MustScanner_ScanSuggest (PTARGETIMAGE pTarget, PSUGGESTSETTING pSuggest)
if (NULL == pTarget || NULL == pSuggest)
{
DBG (DBG_FUNC, "MustScanner_ScanSuggest: parameters error\n");
return FALSE;
return SANE_FALSE;
}
/* 1. Look up optical Y resolution */
@ -2603,13 +2603,13 @@ MustScanner_ScanSuggest (PTARGETIMAGE pTarget, PSUGGESTSETTING pSuggest)
pSuggest->dwBytesPerRow = (unsigned int) (pSuggest->wWidth / 8);
break;
default:
return FALSE;
return SANE_FALSE;
}
DBG (DBG_FUNC, "MustScanner_ScanSuggest: pSuggest->dwBytesPerRow = %d\n",
pSuggest->dwBytesPerRow);
DBG (DBG_FUNC, "MustScanner_ScanSuggest: leave MustScanner_ScanSuggest\n");
return TRUE;
return SANE_TRUE;
}
static SANE_Bool
@ -2619,10 +2619,10 @@ MustScanner_StopScan (void)
if (!g_bOpened || !g_bPrepared)
{
DBG (DBG_FUNC, "MustScanner_StopScan: scanner not opened or prepared\n");
return FALSE;
return SANE_FALSE;
}
g_isCanceled = TRUE; /* tell parent process to stop reading image data */
g_isCanceled = SANE_TRUE; /* tell parent process to stop reading image data */
pthread_cancel (g_threadid_readimage);
pthread_join (g_threadid_readimage, NULL);
@ -2632,10 +2632,10 @@ MustScanner_StopScan (void)
Asic_ScanStop (&g_chip);
Asic_Close (&g_chip);
g_bOpened = FALSE;
g_bOpened = SANE_FALSE;
DBG (DBG_FUNC, "MustScanner_StopScan: leave MustScanner_StopScan\n");
return TRUE;
return SANE_TRUE;
}
static SANE_Bool
@ -2648,7 +2648,7 @@ MustScanner_PrepareScan (void)
g_wMaxScanLines =
(g_wMaxScanLines / g_wScanLinesPerBlock) * g_wScanLinesPerBlock;
g_isCanceled = FALSE;
g_isCanceled = SANE_FALSE;
g_dwScannedTotalLines = 0;
@ -2667,7 +2667,7 @@ MustScanner_PrepareScan (void)
default:
g_wtheReadyLines = 0;
return FALSE;
return SANE_FALSE;
}
DBG (DBG_FUNC, "MustScanner_PrepareScan: g_wtheReadyLines=%d\n",
@ -2680,13 +2680,13 @@ MustScanner_PrepareScan (void)
{
DBG (DBG_FUNC, "MustScanner_PrepareScan: g_lpReadImageHead malloc " \
"error\n");
return FALSE;
return SANE_FALSE;
}
Asic_ScanStart (&g_chip);
DBG (DBG_FUNC, "MustScanner_PrepareScan: leave MustScanner_PrepareScan\n");
return TRUE;
return SANE_TRUE;
}
static SANE_Bool
@ -2697,7 +2697,7 @@ MustScanner_GetRows (SANE_Byte * lpBlock, unsigned short * Rows,
if (!g_bOpened || !g_bPrepared)
{
DBG (DBG_FUNC, "MustScanner_GetRows: scanner not opened or prepared\n");
return FALSE;
return SANE_FALSE;
}
switch (g_ScanMode)
@ -2739,5 +2739,5 @@ MustScanner_GetRows (SANE_Byte * lpBlock, unsigned short * Rows,
}
DBG (DBG_FUNC, "MustScanner_GetRows: leave MustScanner_GetRows\n");
return FALSE;
return SANE_FALSE;
}

Wyświetl plik

@ -48,9 +48,6 @@
#ifndef MUSTEK_USB2_HIGH_H
#define MUSTEK_USB2_HIGH_H
#define TRUE 1
#define FALSE 0
typedef SANE_Byte SCANSOURCE;
#define SS_Reflective 0x00
#define SS_Positive 0x01

Wyświetl plik

@ -58,7 +58,7 @@ static SANE_Bool Reflective_LineCalibration16Bits (void);
/**********************************************************************
reset the scanner
Return value:
TRUE if operation is success, FALSE otherwise
SANE_TRUE if operation is success, SANE_FALSE otherwise
***********************************************************************/
static SANE_Bool
Reflective_Reset (void)
@ -68,27 +68,27 @@ Reflective_Reset (void)
if (g_bOpened)
{
DBG (DBG_FUNC, "Reflective_Reset: scanner has been opened\n");
return FALSE;
return SANE_FALSE;
}
if (STATUS_GOOD != Asic_Open (&g_chip))
if (SANE_STATUS_GOOD != Asic_Open (&g_chip))
{
DBG (DBG_FUNC, "Reflective_Reset: Asic_Open return error\n");
return FALSE;
return SANE_FALSE;
}
Asic_ResetADParameters (&g_chip, LS_REFLECTIVE);
if (STATUS_GOOD != Asic_TurnLamp (&g_chip, TRUE))
if (SANE_STATUS_GOOD != Asic_TurnLamp (&g_chip, SANE_TRUE))
{
DBG (DBG_FUNC, "Reflective_Reset: Asic_TurnLamp return error\n");
return FALSE;
return SANE_FALSE;
}
if (STATUS_GOOD != Asic_Close (&g_chip))
if (SANE_STATUS_GOOD != Asic_Close (&g_chip))
{
DBG (DBG_FUNC, "Reflective_Reset: Asic_Close return error\n");
return FALSE;
return SANE_FALSE;
}
g_Y = 0;
@ -100,12 +100,12 @@ Reflective_Reset (void)
g_wLineartThreshold = 128;
g_dwTotalTotalXferLines = 0;
g_bFirstReadImage = TRUE;
g_bFirstReadImage = SANE_TRUE;
g_pGammaTable = NULL;
DBG (DBG_FUNC, "Reflective_Reset: exit\n");
return TRUE;
return SANE_TRUE;
}
/**********************************************************************
@ -120,7 +120,7 @@ Parameters:
Width: Width of Scan Image
Height: Height of Scan Image
Return value:
TRUE if the operation is success, FALSE otherwise
SANE_TRUE if the operation is success, SANE_FALSE otherwise
***********************************************************************/
static SANE_Bool
Reflective_SetupScan (COLORMODE ColorMode,
@ -133,13 +133,13 @@ Reflective_SetupScan (COLORMODE ColorMode,
if (g_bOpened)
{
DBG (DBG_FUNC, "Reflective_SetupScan: scanner has been opened\n");
return FALSE;
return SANE_FALSE;
}
if (!g_bPrepared)
{
DBG (DBG_FUNC, "Reflective_SetupScan: scanner not prepared\n");
return FALSE;
return SANE_FALSE;
}
g_ScanMode = ColorMode;
@ -205,35 +205,35 @@ Reflective_SetupScan (COLORMODE ColorMode,
break;
}
if (Asic_Open (&g_chip) != STATUS_GOOD)
if (Asic_Open (&g_chip) != SANE_STATUS_GOOD)
{
DBG (DBG_FUNC, "Reflective_SetupScan: Asic_Open return error\n");
return FALSE;
return SANE_FALSE;
}
DBG (DBG_FUNC, "Reflective_SetupScan: Asic_Open successfully\n");
g_bOpened = TRUE;
g_bOpened = SANE_TRUE;
Asic_TurnLamp (&g_chip, FALSE);
Asic_TurnTA (&g_chip, FALSE);
Asic_TurnLamp (&g_chip, TRUE);
Asic_TurnLamp (&g_chip, SANE_FALSE);
Asic_TurnTA (&g_chip, SANE_FALSE);
Asic_TurnLamp (&g_chip, SANE_TRUE);
if (1200 == g_XDpi)
{
g_XDpi = 600;
if (Reflective_AdjustAD () == FALSE)
if (Reflective_AdjustAD () == SANE_FALSE)
{
DBG (DBG_FUNC,
"Reflective_SetupScan: Reflective_AdjustAD return error\n");
return FALSE;
return SANE_FALSE;
}
DBG (DBG_FUNC,
"Reflective_SetupScan: Reflective_AdjustAD successfully\n");
if (Reflective_FindTopLeft (&g_X, &g_Y) == FALSE)
if (Reflective_FindTopLeft (&g_X, &g_Y) == SANE_FALSE)
{
g_X = 187;
g_Y = 43;
@ -241,26 +241,26 @@ Reflective_SetupScan (COLORMODE ColorMode,
g_XDpi = 1200;
if (Reflective_AdjustAD () == FALSE)
if (Reflective_AdjustAD () == SANE_FALSE)
{
DBG (DBG_FUNC,
"Reflective_SetupScan: Reflective_AdjustAD return error\n");
return FALSE;
return SANE_FALSE;
}
DBG (DBG_FUNC,
"Reflective_SetupScan: Reflective_AdjustAD successfully\n");
}
else
{
if (Reflective_AdjustAD () == FALSE)
if (Reflective_AdjustAD () == SANE_FALSE)
{
DBG (DBG_FUNC,
"Reflective_SetupScan: Reflective_AdjustAD return error\n");
return FALSE;
return SANE_FALSE;
}
DBG (DBG_FUNC,
"Reflective_SetupScan: Reflective_AdjustAD successfully\n");
if (Reflective_FindTopLeft (&g_X, &g_Y) == FALSE)
if (Reflective_FindTopLeft (&g_X, &g_Y) == SANE_FALSE)
{
g_X = 187;
g_Y = 43;
@ -295,11 +295,11 @@ Reflective_SetupScan (COLORMODE ColorMode,
DBG (DBG_FUNC, "before line calibration,g_X=%d,g_Y=%d\n", g_X, g_Y);
if (Reflective_LineCalibration16Bits () == FALSE)
if (Reflective_LineCalibration16Bits () == SANE_FALSE)
{
DBG (DBG_FUNC,
"Reflective_SetupScan: Reflective_LineCalibration16Bits return error\n");
return FALSE;
return SANE_FALSE;
}
DBG (DBG_FUNC,
@ -314,11 +314,11 @@ Reflective_SetupScan (COLORMODE ColorMode,
if (g_Y > 300)
{
Asic_MotorMove (&g_chip, TRUE, g_Y - 300);
Asic_MotorMove (&g_chip, SANE_TRUE, g_Y - 300);
}
else
{
Asic_MotorMove (&g_chip, FALSE, 300 - g_Y);
Asic_MotorMove (&g_chip, SANE_FALSE, 300 - g_Y);
}
g_Y = 300;
@ -332,7 +332,7 @@ Reflective_SetupScan (COLORMODE ColorMode,
/**********************************************************************
To adjust the value of offset gain of R/G/B
Return value:
TRUE if operation is success, FALSE otherwise
SANE_TRUE if operation is success, SANE_FALSE otherwise
***********************************************************************/
static SANE_Bool
Reflective_AdjustAD (void)
@ -360,12 +360,12 @@ Reflective_AdjustAD (void)
if (!g_bOpened)
{
DBG (DBG_FUNC, "Reflective_AdjustAD: scanner has been opened\n");
return FALSE;
return SANE_FALSE;
}
if (!g_bPrepared)
{
DBG (DBG_FUNC, "Reflective_AdjustAD: scanner not prepared\n");
return FALSE;
return SANE_FALSE;
}
@ -393,7 +393,7 @@ Reflective_AdjustAD (void)
if (lpCalData == NULL)
{
DBG (DBG_FUNC, "Reflective_AdjustAD: lpCalData malloc error\n");
return FALSE;
return SANE_FALSE;
}
Asic_SetWindow (&g_chip, SCAN_TYPE_CALIBRATE_DARK, 24,
@ -411,7 +411,7 @@ Reflective_AdjustAD (void)
SANE_Byte * lpBuf = malloc (50);
if (NULL == lpBuf)
{
return FALSE;
return SANE_FALSE;
}
memset (lpBuf, 0, 50);
@ -849,7 +849,7 @@ Reflective_AdjustAD (void)
free (lpCalData);
DBG (DBG_FUNC, "Reflective_AdjustAD: leave Reflective_AdjustAD\n");
return TRUE;
return SANE_TRUE;
}
/**********************************************************************
@ -858,7 +858,7 @@ Parameters:
lpwStartX: the left side
lpwStartY: the top side
Return value:
TRUE if operation is success, FALSE otherwise
SANE_TRUE if operation is success, SANE_FALSE otherwise
***********************************************************************/
static SANE_Bool
Reflective_FindTopLeft (unsigned short * lpwStartX, unsigned short * lpwStartY)
@ -878,12 +878,12 @@ Reflective_FindTopLeft (unsigned short * lpwStartX, unsigned short * lpwStartY)
if (!g_bOpened)
{
DBG (DBG_FUNC, "Reflective_FindTopLeft: scanner has been opened\n");
return FALSE;
return SANE_FALSE;
}
if (!g_bPrepared)
{
DBG (DBG_FUNC, "Reflective_FindTopLeft: scanner not prepared\n");
return FALSE;
return SANE_FALSE;
}
wXResolution = wYResolution = FIND_LEFT_TOP_CALIBRATE_RESOLUTION;
@ -892,7 +892,7 @@ Reflective_FindTopLeft (unsigned short * lpwStartX, unsigned short * lpwStartY)
if (lpCalData == NULL)
{
DBG (DBG_FUNC, "Reflective_FindTopLeft: lpCalData malloc error\n");
return FALSE;
return SANE_FALSE;
}
dwTotalSize = wCalWidth * wCalHeight;
@ -901,16 +901,16 @@ Reflective_FindTopLeft (unsigned short * lpwStartX, unsigned short * lpwStartY)
Asic_SetWindow (&g_chip, SCAN_TYPE_CALIBRATE_LIGHT, 8,
wXResolution, wYResolution, 0, 0, wCalWidth, wCalHeight);
SetAFEGainOffset (&g_chip);
if (Asic_ScanStart (&g_chip) != STATUS_GOOD)
if (Asic_ScanStart (&g_chip) != SANE_STATUS_GOOD)
{
DBG (DBG_FUNC, "Reflective_FindTopLeft: Asic_ScanStart return error\n");
free (lpCalData);
return FALSE;
return SANE_FALSE;
}
for (i = 0; i < nScanBlock; i++)
{
if (STATUS_GOOD !=
if (SANE_STATUS_GOOD !=
Asic_ReadCalibrationData (&g_chip,
lpCalData + i * g_dwCalibrationSize,
g_dwCalibrationSize, 8))
@ -918,11 +918,11 @@ Reflective_FindTopLeft (unsigned short * lpwStartX, unsigned short * lpwStartY)
DBG (DBG_FUNC,
"Reflective_FindTopLeft: Asic_ReadCalibrationData return error\n");
free (lpCalData);
return FALSE;
return SANE_FALSE;
}
}
if (STATUS_GOOD !=
if (SANE_STATUS_GOOD !=
Asic_ReadCalibrationData (&g_chip,
lpCalData +
(nScanBlock) * g_dwCalibrationSize,
@ -933,7 +933,7 @@ Reflective_FindTopLeft (unsigned short * lpwStartX, unsigned short * lpwStartY)
DBG (DBG_FUNC,
"Reflective_FindTopLeft: Asic_ReadCalibrationData return error\n");
free (lpCalData);
return FALSE;
return SANE_FALSE;
}
Asic_ScanStop (&g_chip);
@ -944,7 +944,7 @@ Reflective_FindTopLeft (unsigned short * lpwStartX, unsigned short * lpwStartY)
SANE_Byte * lpBuf = malloc (50);
if (NULL == lpBuf)
{
return FALSE;
return SANE_FALSE;
}
memset (lpBuf, 0, 50);
sprintf (lpBuf, "P5\n%d %d\n255\n", wCalWidth, wCalHeight);
@ -1016,7 +1016,7 @@ Reflective_FindTopLeft (unsigned short * lpwStartX, unsigned short * lpwStartY)
DBG (DBG_FUNC,
"Reflective_FindTopLeft: *lpwStartY = %d, *lpwStartX = %d\n",
*lpwStartY, *lpwStartX);
Asic_MotorMove (&g_chip, FALSE,
Asic_MotorMove (&g_chip, SANE_FALSE,
(wCalHeight - *lpwStartY +
BEFORE_SCANNING_MOTOR_FORWARD_PIXEL) * 1200 /
wYResolution);
@ -1024,19 +1024,19 @@ Reflective_FindTopLeft (unsigned short * lpwStartX, unsigned short * lpwStartY)
free (lpCalData);
DBG (DBG_FUNC, "Reflective_FindTopLeft: leave Reflective_FindTopLeft\n");
return TRUE;
return SANE_TRUE;
}
/**********************************************************************
Get the calibration data
Return value:
TRUE if the operation is success, FALSE otherwise
SANE_TRUE if the operation is success, SANE_FALSE otherwise
***********************************************************************/
static SANE_Bool
Reflective_LineCalibration16Bits (void)
{
STATUS status;
SANE_Status status;
SANE_Byte * lpWhiteData;
SANE_Byte * lpDarkData;
unsigned int dwWhiteTotalSize;
@ -1069,14 +1069,14 @@ Reflective_LineCalibration16Bits (void)
DBG (DBG_FUNC,
"Reflective_LineCalibration16Bits: scanner not opened\n");
return FALSE;
return SANE_FALSE;
}
if (!g_bPrepared)
{
DBG (DBG_FUNC,
"Reflective_LineCalibration16Bits: scanner not prepared\n");
return FALSE;
return SANE_FALSE;
}
wCalWidth = g_Width;
@ -1091,13 +1091,13 @@ Reflective_LineCalibration16Bits (void)
DBG (DBG_FUNC,
"Reflective_LineCalibration16Bits: lpWhiteData or lpDarkData malloc error\n");
return FALSE;
return SANE_FALSE;
}
SetAFEGainOffset (&g_chip);
status = Asic_SetWindow (&g_chip, SCAN_TYPE_CALIBRATE_LIGHT, 48, g_XDpi, 600,
g_X, 0, wCalWidth, wCalHeight);
if (status != STATUS_GOOD)
if (status != SANE_STATUS_GOOD)
{
DBG (DBG_FUNC,
"Reflective_LineCalibration16Bits: Asic_SetWindow return error\n");
@ -1105,27 +1105,27 @@ Reflective_LineCalibration16Bits (void)
free (lpWhiteData);
free (lpDarkData);
return FALSE;
return SANE_FALSE;
}
status = Asic_ScanStart (&g_chip);
if (status != STATUS_GOOD)
if (status != SANE_STATUS_GOOD)
{
DBG (DBG_FUNC,
"Reflective_LineCalibration16Bits: Asic_ScanStart return error\n");
free (lpWhiteData);
free (lpDarkData);
return FALSE;
return SANE_FALSE;
}
status =
Asic_ReadCalibrationData (&g_chip, lpWhiteData, dwWhiteTotalSize, 8);
if (status != STATUS_GOOD)
if (status != SANE_STATUS_GOOD)
{
free (lpWhiteData);
free (lpDarkData);
return FALSE;
return SANE_FALSE;
}
Asic_ScanStop (&g_chip);
@ -1133,63 +1133,63 @@ Reflective_LineCalibration16Bits (void)
/*Read dark level data */
status = Asic_SetWindow (&g_chip, SCAN_TYPE_CALIBRATE_DARK, 48, g_XDpi, 600,
g_X, 0, wCalWidth, wCalHeight);
if (status != STATUS_GOOD)
if (status != SANE_STATUS_GOOD)
{
DBG (DBG_FUNC,
"Reflective_LineCalibration16Bits: Asic_SetWindow return error\n");
free (lpWhiteData);
free (lpDarkData);
return FALSE;
return SANE_FALSE;
}
status = Asic_TurnLamp (&g_chip, FALSE);
if (status != STATUS_GOOD)
status = Asic_TurnLamp (&g_chip, SANE_FALSE);
if (status != SANE_STATUS_GOOD)
{
DBG (DBG_FUNC,
"Reflective_LineCalibration16Bits: Asic_TurnLamp return error\n");
free (lpWhiteData);
free (lpDarkData);
return FALSE;
return SANE_FALSE;
}
usleep (500000);
status = Asic_ScanStart (&g_chip);
if (status != STATUS_GOOD)
if (status != SANE_STATUS_GOOD)
{
DBG (DBG_FUNC,
"Reflective_LineCalibration16Bits: Asic_ScanStart return error\n");
free (lpWhiteData);
free (lpDarkData);
return FALSE;
return SANE_FALSE;
}
status = Asic_ReadCalibrationData (&g_chip, lpDarkData, dwDarkTotalSize, 8);
if (status != STATUS_GOOD)
if (status != SANE_STATUS_GOOD)
{
DBG (DBG_FUNC,
"Reflective_LineCalibration16Bits: Asic_ReadCalibrationData return error\n");
free (lpWhiteData);
free (lpDarkData);
return FALSE;
return SANE_FALSE;
}
Asic_ScanStop (&g_chip);
/* Turn on lamp */
status = Asic_TurnLamp (&g_chip, TRUE);
if (status != STATUS_GOOD)
status = Asic_TurnLamp (&g_chip, SANE_TRUE);
if (status != SANE_STATUS_GOOD)
{
DBG (DBG_FUNC,
"Reflective_LineCalibration16Bits: Asic_TurnLamp return error\n");
free (lpWhiteData);
free (lpDarkData);
return FALSE;
return SANE_FALSE;
}
#ifdef DEBUG_SAVE_IMAGE
@ -1197,7 +1197,7 @@ Reflective_LineCalibration16Bits (void)
SANE_Byte * lpBuf = malloc (50);
if (NULL == lpBuf)
{
return FALSE;
return SANE_FALSE;
}
memset (lpBuf, 0, 50);
@ -1236,7 +1236,7 @@ Reflective_LineCalibration16Bits (void)
free (lpWhiteData);
free (lpDarkData);
return FALSE;
return SANE_FALSE;
}
/* create dark level shading */
@ -1424,5 +1424,5 @@ Reflective_LineCalibration16Bits (void)
DBG (DBG_FUNC,
"Reflective_LineCalibration16Bits: leave Reflective_LineCalibration16Bits\n");
return TRUE;
return SANE_TRUE;
}

Wyświetl plik

@ -58,7 +58,7 @@ static SANE_Bool Transparent_LineCalibration16Bits (unsigned short wTAShadingMin
/**********************************************************************
reset the scanner
Return value:
TRUE if operation is success, FALSE otherwise
SANE_TRUE if operation is success, SANE_FALSE otherwise
***********************************************************************/
static SANE_Bool
Transparent_Reset (void)
@ -68,44 +68,44 @@ Transparent_Reset (void)
if (g_bOpened)
{
DBG (DBG_FUNC, "Transparent_Reset: scanner has been opened\n");
return FALSE;
return SANE_FALSE;
}
if (STATUS_GOOD != Asic_Open (&g_chip))
if (SANE_STATUS_GOOD != Asic_Open (&g_chip))
{
DBG (DBG_FUNC, "Transparent_Reset: can not open scanner\n");
return FALSE;
return SANE_FALSE;
}
Asic_ResetADParameters (&g_chip, LS_POSITIVE);
if (STATUS_GOOD != Asic_TurnLamp (&g_chip, FALSE))
if (SANE_STATUS_GOOD != Asic_TurnLamp (&g_chip, SANE_FALSE))
{
DBG (DBG_FUNC, "Reflective_Reset: Asic_TurnLamp return error\n");
return FALSE;
return SANE_FALSE;
}
if (STATUS_GOOD != Asic_TurnTA (&g_chip, TRUE))
if (SANE_STATUS_GOOD != Asic_TurnTA (&g_chip, SANE_TRUE))
{
DBG (DBG_FUNC, "Reflective_Reset: Asic_TurnTA return error\n");
return FALSE;
return SANE_FALSE;
}
if (STATUS_GOOD != Asic_Close (&g_chip))
if (SANE_STATUS_GOOD != Asic_Close (&g_chip))
{
DBG (DBG_FUNC, "Reflective_Reset: Asic_Close return error\n");
return FALSE;
return SANE_FALSE;
}
g_Y = 0;
g_wLineartThreshold = 128;
g_dwTotalTotalXferLines = 0;
g_bFirstReadImage = TRUE;
g_bFirstReadImage = SANE_TRUE;
g_pGammaTable = NULL;
DBG (DBG_FUNC, "Transparent_Reset: leave Transparent_Reset\n");
return TRUE;
return SANE_TRUE;
}
/**********************************************************************
@ -120,7 +120,7 @@ Parameters:
Width: Width of Scan Image
Height: Height of Scan Image
Return value:
TRUE if the operation is success, FALSE otherwise
SANE_TRUE if the operation is success, SANE_FALSE otherwise
***********************************************************************/
static SANE_Bool
Transparent_SetupScan (COLORMODE ColorMode,
@ -136,13 +136,13 @@ Transparent_SetupScan (COLORMODE ColorMode,
if (g_bOpened)
{
DBG (DBG_FUNC, "Transparent_SetupScan: scanner has been opened\n");
return FALSE;
return SANE_FALSE;
}
if (!g_bPrepared)
{
DBG (DBG_FUNC, "Transparent_SetupScan: scanner not prepared\n");
return FALSE;
return SANE_FALSE;
}
g_ScanMode = ColorMode;
@ -214,40 +214,40 @@ Transparent_SetupScan (COLORMODE ColorMode,
break;
}
if (Asic_Open (&g_chip) != STATUS_GOOD)
if (Asic_Open (&g_chip) != SANE_STATUS_GOOD)
{
DBG (DBG_FUNC, "Transparent_SetupScan: Asic_Open return error\n");
return FALSE;
return SANE_FALSE;
}
g_bOpened = TRUE;
g_bOpened = SANE_TRUE;
if (STATUS_GOOD != Asic_TurnLamp (&g_chip, FALSE))
if (SANE_STATUS_GOOD != Asic_TurnLamp (&g_chip, SANE_FALSE))
{
DBG (DBG_FUNC, "Transparent_SetupScan: Asic_TurnLamp return error\n");
return FALSE;
return SANE_FALSE;
}
if (Asic_IsTAConnected (&g_chip, &hasTA) != STATUS_GOOD)
if (Asic_IsTAConnected (&g_chip, &hasTA) != SANE_STATUS_GOOD)
{
DBG (DBG_FUNC,
"Transparent_SetupScan: Asic_IsTAConnected return error\n");
return FALSE;
return SANE_FALSE;
}
if (!hasTA)
{
DBG (DBG_FUNC, "Transparent_SetupScan: no TA device\n");
return FALSE;
return SANE_FALSE;
}
if (Asic_TurnTA (&g_chip, TRUE) != STATUS_GOOD)
if (Asic_TurnTA (&g_chip, SANE_TRUE) != SANE_STATUS_GOOD)
{
DBG (DBG_FUNC, "Transparent_SetupScan: Asic_TurnTA return error\n");
return FALSE;
return SANE_FALSE;
}
/* Begin Find Left&Top Side */
Asic_MotorMove (&g_chip, TRUE, TRAN_START_POS);
Asic_MotorMove (&g_chip, SANE_TRUE, TRAN_START_POS);
if (1200 == g_XDpi)
{
@ -302,7 +302,7 @@ Transparent_SetupScan (COLORMODE ColorMode,
g_bScanBits, g_XDpi, g_YDpi, g_X, g_Y, g_Width, g_Height);
g_Y = Y * 1200 / g_YDpi + (300 - 40) + 189;
Asic_MotorMove (&g_chip, TRUE, g_Y - 360);
Asic_MotorMove (&g_chip, SANE_TRUE, g_Y - 360);
g_Y = 360;
Asic_SetWindow (&g_chip, SCAN_TYPE_NORMAL, g_bScanBits, g_XDpi, g_YDpi,
@ -315,7 +315,7 @@ Transparent_SetupScan (COLORMODE ColorMode,
/**********************************************************************
To adjust the value of offset gain of R/G/B
Return value:
TRUE if operation is success, FALSE otherwise
SANE_TRUE if operation is success, SANE_FALSE otherwise
***********************************************************************/
static SANE_Bool
Transparent_AdjustAD (void)
@ -342,11 +342,11 @@ Transparent_AdjustAD (void)
DBG (DBG_FUNC, "Transparent_AdjustAD: call in\n");
if (!g_bOpened)
{
return FALSE;
return SANE_FALSE;
}
if (!g_bPrepared)
{
return FALSE;
return SANE_FALSE;
}
@ -374,7 +374,7 @@ Transparent_AdjustAD (void)
lpCalData = malloc (wCalWidth * 3);
if (lpCalData == NULL)
{
return FALSE;
return SANE_FALSE;
}
Asic_SetWindow (&g_chip, SCAN_TYPE_CALIBRATE_DARK, 24,
@ -394,7 +394,7 @@ Transparent_AdjustAD (void)
{
DBG (DBG_FUNC,
"Transparent_AdjustAD: Leave Transparent_AdjustAD for malloc fail!\n");
return FALSE;
return SANE_FALSE;
}
memset (lpBuf, 0, 50);
stream = fopen ("/root/AD(Tra).pnm", "wb+\n");
@ -807,7 +807,7 @@ Transparent_AdjustAD (void)
DBG (DBG_FUNC, "Transparent_AdjustAD: leave Transparent_AdjustAD\n");
free (lpCalData);
return TRUE;
return SANE_TRUE;
}
/**********************************************************************
@ -816,7 +816,7 @@ Parameters:
lpwStartX: the left side
lpwStartY: the top side
Return value:
TRUE if operation is success, FALSE otherwise
SANE_TRUE if operation is success, SANE_FALSE otherwise
***********************************************************************/
static SANE_Bool
Transparent_FindTopLeft (unsigned short * lpwStartX, unsigned short * lpwStartY)
@ -837,12 +837,12 @@ Transparent_FindTopLeft (unsigned short * lpwStartX, unsigned short * lpwStartY)
{
DBG (DBG_FUNC, "Transparent_FindTopLeft: scanner not opened\n");
return FALSE;
return SANE_FALSE;
}
if (!g_bPrepared)
{
DBG (DBG_FUNC, "Transparent_FindTopLeft: scanner not prepared\n");
return FALSE;
return SANE_FALSE;
}
wXResolution = wYResolution = FIND_LEFT_TOP_CALIBRATE_RESOLUTION;
@ -852,7 +852,7 @@ Transparent_FindTopLeft (unsigned short * lpwStartX, unsigned short * lpwStartY)
if (lpCalData == NULL)
{
DBG (DBG_FUNC, "Transparent_FindTopLeft: lpCalData malloc fail\n");
return FALSE;
return SANE_FALSE;
}
dwTotalSize = wCalWidth * wCalHeight;
@ -879,7 +879,7 @@ Transparent_FindTopLeft (unsigned short * lpwStartX, unsigned short * lpwStartY)
SANE_Byte * lpBuf = malloc (50);
if (NULL == lpBuf)
{
return FALSE;
return SANE_FALSE;
}
memset (lpBuf, 0, 50);
stream = fopen ("/root/bound(Tra).pnm", "wb+\n");
@ -944,7 +944,7 @@ Transparent_FindTopLeft (unsigned short * lpwStartX, unsigned short * lpwStartY)
}
Asic_MotorMove (&g_chip, FALSE,
Asic_MotorMove (&g_chip, SANE_FALSE,
(wCalHeight - *lpwStartY) * 1200 / wYResolution + 300);
free (lpCalData);
@ -953,13 +953,13 @@ Transparent_FindTopLeft (unsigned short * lpwStartX, unsigned short * lpwStartY)
"Transparent_FindTopLeft: *lpwStartY = %d, *lpwStartX = %d\n",
*lpwStartY, *lpwStartX);
DBG (DBG_FUNC, "Transparent_FindTopLeft: leave Transparent_FindTopLeft\n");
return TRUE;
return SANE_TRUE;
}
/**********************************************************************
Get the calibration data
Return value:
TRUE if the operation is success, FALSE otherwise
SANE_TRUE if the operation is success, SANE_FALSE otherwise
***********************************************************************/
static SANE_Bool
Transparent_LineCalibration16Bits (unsigned short wTAShadingMinus)
@ -996,13 +996,13 @@ Transparent_LineCalibration16Bits (unsigned short wTAShadingMinus)
{
DBG (DBG_FUNC,
"Transparent_LineCalibration16Bits: scanner not opened\n");
return FALSE;
return SANE_FALSE;
}
if (!g_bPrepared)
{
DBG (DBG_FUNC,
"Transparent_LineCalibration16Bits: scanner not prepared\n");
return FALSE;
return SANE_FALSE;
}
if (g_XDpi < 600)
@ -1018,7 +1018,7 @@ Transparent_LineCalibration16Bits (unsigned short wTAShadingMinus)
{
DBG (DBG_FUNC,
"Transparent_LineCalibration16Bits: lpWhiteData or lpDarkData malloc fail\n");
return FALSE;
return SANE_FALSE;
}
/*Read white level data */
@ -1037,8 +1037,8 @@ Transparent_LineCalibration16Bits (unsigned short wTAShadingMinus)
Asic_SetWindow (&g_chip, SCAN_TYPE_CALIBRATE_DARK, 48, g_XDpi, 600, g_X, 0,
wCalWidth, wCalHeight);
Asic_TurnLamp (&g_chip, FALSE);
Asic_TurnTA (&g_chip, FALSE);
Asic_TurnLamp (&g_chip, SANE_FALSE);
Asic_TurnTA (&g_chip, SANE_FALSE);
usleep (500000);
@ -1047,14 +1047,14 @@ Transparent_LineCalibration16Bits (unsigned short wTAShadingMinus)
Asic_ScanStop (&g_chip);
Asic_TurnTA (&g_chip, TRUE);
Asic_TurnTA (&g_chip, SANE_TRUE);
#ifdef DEBUG_SAVE_IMAGE
FILE *stream = NULL;
SANE_Byte * lpBuf = malloc (50);
if (NULL == lpBuf)
{
return FALSE;
return SANE_FALSE;
}
memset (lpBuf, 0, 50);
stream = fopen ("/root/whiteshading(Tra).pnm", "wb+\n");
@ -1090,7 +1090,7 @@ Transparent_LineCalibration16Bits (unsigned short wTAShadingMinus)
free (lpWhiteData);
free (lpDarkData);
return FALSE;
return SANE_FALSE;
}
DBG (DBG_FUNC,
@ -1328,5 +1328,5 @@ Transparent_LineCalibration16Bits (unsigned short wTAShadingMinus)
DBG (DBG_FUNC,
"Transparent_LineCalibration16Bits: leave Transparent_LineCalibration16Bits\n");
return TRUE;
return SANE_TRUE;
}