Fix indentation of debug macros.

merge-requests/1/head
Jan Hauffa 2011-04-21 23:25:34 +02:00 zatwierdzone przez m. allan noah
rodzic c0e44738a4
commit babee51689
3 zmienionych plików z 160 dodań i 160 usunięć

Wyświetl plik

@ -126,7 +126,7 @@ get_target_image (Mustek_Scanner * s, TARGETIMAGE * pTarget)
{ {
SANE_String val, val_source; SANE_String val, val_source;
float x1, y1, x2, y2; float x1, y1, x2, y2;
DBG_ENTER(); DBG_ENTER ();
if (s->val[OPT_PREVIEW].w) if (s->val[OPT_PREVIEW].w)
pTarget->wXDpi = 75; pTarget->wXDpi = 75;
@ -189,13 +189,13 @@ get_target_image (Mustek_Scanner * s, TARGETIMAGE * pTarget)
pTarget->cmColorMode = CM_TEXT; pTarget->cmColorMode = CM_TEXT;
} }
DBG_LEAVE(); DBG_LEAVE ();
} }
static void static void
calc_parameters (TARGETIMAGE * pTarget, SANE_Parameters * params) calc_parameters (TARGETIMAGE * pTarget, SANE_Parameters * params)
{ {
DBG_ENTER(); DBG_ENTER ();
params->pixels_per_line = pTarget->wWidth; params->pixels_per_line = pTarget->wWidth;
params->lines = pTarget->wHeight; params->lines = pTarget->wHeight;
@ -230,7 +230,7 @@ calc_parameters (TARGETIMAGE * pTarget, SANE_Parameters * params)
break; break;
} }
DBG_LEAVE(); DBG_LEAVE ();
} }
static size_t static size_t
@ -254,7 +254,7 @@ init_options (Mustek_Scanner * s)
SANE_Int option, count = 0; SANE_Int option, count = 0;
SANE_Word *dpi_list; SANE_Word *dpi_list;
TARGETIMAGE target; TARGETIMAGE target;
DBG_ENTER(); DBG_ENTER ();
memset (s->opt, 0, sizeof (s->opt)); memset (s->opt, 0, sizeof (s->opt));
memset (s->val, 0, sizeof (s->val)); memset (s->val, 0, sizeof (s->val));
@ -407,7 +407,7 @@ init_options (Mustek_Scanner * s)
get_target_image (s, &target); get_target_image (s, &target);
calc_parameters (&target, &s->params); calc_parameters (&target, &s->params);
DBG_LEAVE(); DBG_LEAVE ();
return SANE_STATUS_GOOD; return SANE_STATUS_GOOD;
} }
@ -419,21 +419,21 @@ sane_init (SANE_Int * version_code,
SANE_Auth_Callback __sane_unused__ authorize) SANE_Auth_Callback __sane_unused__ authorize)
{ {
DBG_INIT (); DBG_INIT ();
DBG_ENTER(); DBG_ENTER ();
DBG (DBG_ERR, "SANE Mustek USB2 backend version %d.%d build %d from %s\n", DBG (DBG_ERR, "SANE Mustek USB2 backend version %d.%d build %d from %s\n",
SANE_CURRENT_MAJOR, V_MINOR, BUILD, PACKAGE_STRING); SANE_CURRENT_MAJOR, V_MINOR, BUILD, PACKAGE_STRING);
if (version_code) if (version_code)
*version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, BUILD); *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, BUILD);
DBG_LEAVE(); DBG_LEAVE ();
return SANE_STATUS_GOOD; return SANE_STATUS_GOOD;
} }
void void
sane_exit (void) sane_exit (void)
{ {
DBG_ENTER(); DBG_ENTER ();
if (devlist != NULL) if (devlist != NULL)
{ {
@ -441,14 +441,14 @@ sane_exit (void)
devlist = NULL; devlist = NULL;
} }
DBG_LEAVE(); DBG_LEAVE ();
} }
SANE_Status SANE_Status
sane_get_devices (const SANE_Device *** device_list, sane_get_devices (const SANE_Device *** device_list,
SANE_Bool __sane_unused__ local_only) SANE_Bool __sane_unused__ local_only)
{ {
DBG_ENTER(); DBG_ENTER ();
if (devlist != NULL) if (devlist != NULL)
free (devlist); free (devlist);
@ -470,7 +470,7 @@ sane_get_devices (const SANE_Device *** device_list,
} }
*device_list = devlist; *device_list = devlist;
DBG_LEAVE(); DBG_LEAVE ();
return SANE_STATUS_GOOD; return SANE_STATUS_GOOD;
} }
@ -478,7 +478,7 @@ SANE_Status
sane_open (SANE_String_Const devicename, SANE_Handle * handle) sane_open (SANE_String_Const devicename, SANE_Handle * handle)
{ {
Mustek_Scanner *s; Mustek_Scanner *s;
DBG_ENTER(); DBG_ENTER ();
DBG (DBG_FUNC, "devicename=%s\n", devicename); DBG (DBG_FUNC, "devicename=%s\n", devicename);
Scanner_Init (); Scanner_Init ();
@ -496,7 +496,7 @@ sane_open (SANE_String_Const devicename, SANE_Handle * handle)
init_options (s); init_options (s);
*handle = s; *handle = s;
DBG_LEAVE(); DBG_LEAVE ();
return SANE_STATUS_GOOD; return SANE_STATUS_GOOD;
} }
@ -504,7 +504,7 @@ void
sane_close (SANE_Handle handle) sane_close (SANE_Handle handle)
{ {
Mustek_Scanner *s = handle; Mustek_Scanner *s = handle;
DBG_ENTER(); DBG_ENTER ();
Scanner_PowerControl (SANE_FALSE, SANE_FALSE); Scanner_PowerControl (SANE_FALSE, SANE_FALSE);
Scanner_BackHome (); Scanner_BackHome ();
@ -515,7 +515,7 @@ sane_close (SANE_Handle handle)
free (handle); free (handle);
DBG_LEAVE(); DBG_LEAVE ();
} }
const SANE_Option_Descriptor * const SANE_Option_Descriptor *
@ -540,7 +540,7 @@ sane_control_option (SANE_Handle handle, SANE_Int option,
SANE_Word cap; SANE_Word cap;
SANE_Int myinfo = 0; SANE_Int myinfo = 0;
TARGETIMAGE target; TARGETIMAGE target;
DBG_ENTER(); DBG_ENTER ();
DBG (DBG_FUNC, "action = %s, option = %s (%d)\n", DBG (DBG_FUNC, "action = %s, option = %s (%d)\n",
(action == SANE_ACTION_GET_VALUE) ? "get" : (action == SANE_ACTION_GET_VALUE) ? "get" :
(action == SANE_ACTION_SET_VALUE) ? "set" : (action == SANE_ACTION_SET_VALUE) ? "set" :
@ -686,7 +686,7 @@ sane_control_option (SANE_Handle handle, SANE_Int option,
if (info) if (info)
*info = myinfo; *info = myinfo;
DBG_LEAVE(); DBG_LEAVE ();
return SANE_STATUS_GOOD; return SANE_STATUS_GOOD;
} }
@ -694,7 +694,7 @@ SANE_Status
sane_get_parameters (SANE_Handle handle, SANE_Parameters * params) sane_get_parameters (SANE_Handle handle, SANE_Parameters * params)
{ {
Mustek_Scanner *s = handle; Mustek_Scanner *s = handle;
DBG_ENTER(); DBG_ENTER ();
DBG (DBG_INFO, "params.format = %d\n", s->params.format); DBG (DBG_INFO, "params.format = %d\n", s->params.format);
DBG (DBG_INFO, "params.depth = %d\n", s->params.depth); DBG (DBG_INFO, "params.depth = %d\n", s->params.depth);
@ -705,7 +705,7 @@ sane_get_parameters (SANE_Handle handle, SANE_Parameters * params)
if (params) if (params)
*params = s->params; *params = s->params;
DBG_LEAVE(); DBG_LEAVE ();
return SANE_STATUS_GOOD; return SANE_STATUS_GOOD;
} }
@ -714,7 +714,7 @@ sane_start (SANE_Handle handle)
{ {
Mustek_Scanner *s = handle; Mustek_Scanner *s = handle;
TARGETIMAGE target; TARGETIMAGE target;
DBG_ENTER(); DBG_ENTER ();
if ((s->val[OPT_TL_X].w >= s->val[OPT_BR_X].w) || if ((s->val[OPT_TL_X].w >= s->val[OPT_BR_X].w) ||
(s->val[OPT_TL_Y].w >= s->val[OPT_BR_Y].w)) (s->val[OPT_TL_Y].w >= s->val[OPT_BR_Y].w))
@ -759,7 +759,7 @@ sane_start (SANE_Handle handle)
if (!Scanner_SetupScan (&target)) if (!Scanner_SetupScan (&target))
return SANE_STATUS_INVAL; return SANE_STATUS_INVAL;
DBG_LEAVE(); DBG_LEAVE ();
return SANE_STATUS_GOOD; return SANE_STATUS_GOOD;
} }
@ -773,7 +773,7 @@ sane_read (SANE_Handle handle, SANE_Byte * buf, SANE_Int max_len,
SANE_Int lines, lines_read; SANE_Int lines, lines_read;
unsigned short lines_received; unsigned short lines_received;
int i; int i;
DBG_ENTER(); DBG_ENTER ();
DBG (DBG_FUNC, "max_len=%d\n", max_len); DBG (DBG_FUNC, "max_len=%d\n", max_len);
if (!buf || !len) if (!buf || !len)
@ -857,7 +857,7 @@ sane_read (SANE_Handle handle, SANE_Byte * buf, SANE_Int max_len,
s->scan_buf_len -= lines_read; s->scan_buf_len -= lines_read;
s->scan_buf_start += lines_read; s->scan_buf_start += lines_read;
DBG_LEAVE(); DBG_LEAVE ();
return SANE_STATUS_GOOD; return SANE_STATUS_GOOD;
} }
@ -866,7 +866,7 @@ sane_cancel (SANE_Handle handle)
{ {
Mustek_Scanner *s = handle; Mustek_Scanner *s = handle;
int i; int i;
DBG_ENTER(); DBG_ENTER ();
if (s->bIsScanning) if (s->bIsScanning)
{ {
@ -901,7 +901,7 @@ sane_cancel (SANE_Handle handle)
DBG (DBG_INFO, "not scanning\n"); DBG (DBG_INFO, "not scanning\n");
} }
DBG_LEAVE(); DBG_LEAVE ();
} }
SANE_Status SANE_Status

Wyświetl plik

@ -100,7 +100,7 @@ ClearFIFO (ASIC * chip)
{ {
SANE_Status status; SANE_Status status;
SANE_Byte buf[4]; SANE_Byte buf[4];
DBG_ASIC_ENTER(); DBG_ASIC_ENTER ();
buf[0] = 0; buf[0] = 0;
buf[1] = 0; buf[1] = 0;
@ -113,7 +113,7 @@ ClearFIFO (ASIC * chip)
status = WriteIOControl (chip, 0xc0, 0, 4, buf); status = WriteIOControl (chip, 0xc0, 0, 4, buf);
DBG_ASIC_LEAVE(); DBG_ASIC_LEAVE ();
return status; return status;
} }
@ -123,7 +123,7 @@ SwitchBank (ASIC * chip, unsigned short reg)
SANE_Status status; SANE_Status status;
SANE_Byte buf[4]; SANE_Byte buf[4];
SANE_Byte bank; SANE_Byte bank;
DBG_ASIC_ENTER(); DBG_ASIC_ENTER ();
bank = HIBYTE(reg); bank = HIBYTE(reg);
if (bank > SELECT_REGISTER_BANK2) if (bank > SELECT_REGISTER_BANK2)
@ -146,7 +146,7 @@ SwitchBank (ASIC * chip, unsigned short reg)
DBG (DBG_ASIC, "RegisterBankStatus=%d\n", chip->RegisterBankStatus); DBG (DBG_ASIC, "RegisterBankStatus=%d\n", chip->RegisterBankStatus);
} }
DBG_ASIC_LEAVE(); DBG_ASIC_LEAVE ();
return SANE_STATUS_GOOD; return SANE_STATUS_GOOD;
} }
@ -155,7 +155,7 @@ SendData (ASIC * chip, unsigned short reg, SANE_Byte data)
{ {
SANE_Status status; SANE_Status status;
SANE_Byte buf[4]; SANE_Byte buf[4];
DBG_ASIC_ENTER(); DBG_ASIC_ENTER ();
DBG (DBG_ASIC, "reg=%x,data=%x\n", reg, data); DBG (DBG_ASIC, "reg=%x,data=%x\n", reg, data);
status = SwitchBank (chip, reg); status = SwitchBank (chip, reg);
@ -168,7 +168,7 @@ SendData (ASIC * chip, unsigned short reg, SANE_Byte data)
buf[3] = data; buf[3] = data;
status = WriteIOControl (chip, 0xb0, 0, 4, buf); status = WriteIOControl (chip, 0xb0, 0, 4, buf);
DBG_ASIC_LEAVE(); DBG_ASIC_LEAVE ();
return status; return status;
} }
@ -177,12 +177,12 @@ ReceiveData (ASIC * chip, SANE_Byte * reg)
{ {
SANE_Status status; SANE_Status status;
SANE_Byte buf[4]; SANE_Byte buf[4];
DBG_ASIC_ENTER(); DBG_ASIC_ENTER ();
status = ReadIOControl (chip, 0x07, 0, 4, buf); status = ReadIOControl (chip, 0x07, 0, 4, buf);
*reg = buf[0]; *reg = buf[0];
DBG_ASIC_LEAVE(); DBG_ASIC_LEAVE ();
return status; return status;
} }
@ -191,7 +191,7 @@ WriteAddressLineForRegister (ASIC * chip, SANE_Byte x)
{ {
SANE_Status status; SANE_Status status;
SANE_Byte buf[4]; SANE_Byte buf[4];
DBG_ASIC_ENTER(); DBG_ASIC_ENTER ();
buf[0] = x; buf[0] = x;
buf[1] = x; buf[1] = x;
@ -199,7 +199,7 @@ WriteAddressLineForRegister (ASIC * chip, SANE_Byte x)
buf[3] = x; buf[3] = x;
status = WriteIOControl (chip, 0x04, x, 4, buf); status = WriteIOControl (chip, 0x04, x, 4, buf);
DBG_ASIC_LEAVE(); DBG_ASIC_LEAVE ();
return status; return status;
} }
@ -207,7 +207,7 @@ static SANE_Status
SetRWSize (ASIC * chip, SANE_Bool isWriteAccess, unsigned int size) SetRWSize (ASIC * chip, SANE_Bool isWriteAccess, unsigned int size)
{ {
SANE_Status status; SANE_Status status;
DBG_ASIC_ENTER(); DBG_ASIC_ENTER ();
if (!isWriteAccess) if (!isWriteAccess)
size >>= 1; size >>= 1;
@ -223,7 +223,7 @@ SetRWSize (ASIC * chip, SANE_Bool isWriteAccess, unsigned int size)
return status; return status;
status = SendData (chip, ES01_7F_DMA_SIZE_BYTE3, BYTE3 (size)); status = SendData (chip, ES01_7F_DMA_SIZE_BYTE3, BYTE3 (size));
DBG_ASIC_LEAVE(); DBG_ASIC_LEAVE ();
return status; return status;
} }
@ -232,7 +232,7 @@ DMARead (ASIC * chip, unsigned int size, SANE_Byte * pData)
{ {
SANE_Status status; SANE_Status status;
size_t cur_read_size; size_t cur_read_size;
DBG_ASIC_ENTER(); DBG_ASIC_ENTER ();
DBG (DBG_ASIC, "size=%d\n", size); DBG (DBG_ASIC, "size=%d\n", size);
status = ClearFIFO (chip); status = ClearFIFO (chip);
@ -265,7 +265,7 @@ DMARead (ASIC * chip, unsigned int size, SANE_Byte * pData)
if (cur_read_size < DMA_BLOCK_SIZE) if (cur_read_size < DMA_BLOCK_SIZE)
usleep (20000); usleep (20000);
DBG_ASIC_LEAVE(); DBG_ASIC_LEAVE ();
return SANE_STATUS_GOOD; return SANE_STATUS_GOOD;
} }
@ -274,7 +274,7 @@ DMAWrite (ASIC * chip, unsigned int size, SANE_Byte * pData)
{ {
SANE_Status status; SANE_Status status;
size_t cur_write_size; size_t cur_write_size;
DBG_ASIC_ENTER(); DBG_ASIC_ENTER ();
DBG (DBG_ASIC, "size=%d\n", size); DBG (DBG_ASIC, "size=%d\n", size);
status = ClearFIFO (chip); status = ClearFIFO (chip);
@ -306,7 +306,7 @@ DMAWrite (ASIC * chip, unsigned int size, SANE_Byte * pData)
status = ClearFIFO (chip); status = ClearFIFO (chip);
DBG_ASIC_LEAVE(); DBG_ASIC_LEAVE ();
return status; return status;
} }
@ -314,7 +314,7 @@ static SANE_Status
SendData2Byte (ASIC * chip, unsigned short reg, SANE_Byte data) SendData2Byte (ASIC * chip, unsigned short reg, SANE_Byte data)
{ {
SANE_Status status = SANE_STATUS_GOOD; SANE_Status status = SANE_STATUS_GOOD;
DBG_ASIC_ENTER(); DBG_ASIC_ENTER ();
if (!chip->is2ByteTransfer) if (!chip->is2ByteTransfer)
{ {
@ -335,7 +335,7 @@ SendData2Byte (ASIC * chip, unsigned short reg, SANE_Byte data)
status = WriteIOControl (chip, 0xb0, 0, 4, chip->dataBuf); status = WriteIOControl (chip, 0xb0, 0, 4, chip->dataBuf);
} }
DBG_ASIC_LEAVE(); DBG_ASIC_LEAVE ();
return status; return status;
} }
@ -347,7 +347,7 @@ SetRamAddress (ASIC * chip, unsigned int dwStartAddr, unsigned int dwEndAddr,
RAM_TYPE AccessTarget) RAM_TYPE AccessTarget)
{ {
SANE_Status status; SANE_Status status;
DBG_ASIC_ENTER(); DBG_ASIC_ENTER ();
/* Set start address. Unit is a word. */ /* Set start address. Unit is a word. */
SendData (chip, ES01_A0_HostStartAddr0_7, BYTE0 (dwStartAddr)); SendData (chip, ES01_A0_HostStartAddr0_7, BYTE0 (dwStartAddr));
@ -380,7 +380,7 @@ SetRamAddress (ASIC * chip, unsigned int dwStartAddr, unsigned int dwEndAddr,
status = ClearFIFO (chip); status = ClearFIFO (chip);
DBG_ASIC_LEAVE(); DBG_ASIC_LEAVE ();
return status; return status;
} }
@ -389,7 +389,7 @@ RamAccess (ASIC * chip, RAMACCESS * access)
{ {
SANE_Status status; SANE_Status status;
SANE_Byte a[2]; SANE_Byte a[2];
DBG_ASIC_ENTER(); DBG_ASIC_ENTER ();
status = SetRamAddress (chip, access->StartAddress, 0xffffff, status = SetRamAddress (chip, access->StartAddress, 0xffffff,
access->RamType); access->RamType);
@ -417,7 +417,7 @@ RamAccess (ASIC * chip, RAMACCESS * access)
status = DMARead (chip, access->RwSize, access->BufferPtr); status = DMARead (chip, access->RwSize, access->BufferPtr);
} }
DBG_ASIC_LEAVE(); DBG_ASIC_LEAVE ();
return status; return status;
} }
@ -432,7 +432,7 @@ SetMotorCurrentAndPhase (ASIC * chip,
SANE_Byte MotorPhaseMask; SANE_Byte MotorPhaseMask;
int i; int i;
DBG_ASIC_ENTER(); DBG_ASIC_ENTER ();
if (MotorCurrentAndPhase->MotorDriverIs3967 == 1) if (MotorCurrentAndPhase->MotorDriverIs3967 == 1)
MotorPhaseMask = 0xFE; MotorPhaseMask = 0xFE;
@ -508,7 +508,7 @@ SetMotorCurrentAndPhase (ASIC * chip,
SendData (chip, ES02_50_MOTOR_CURRENT_CONTORL, SendData (chip, ES02_50_MOTOR_CURRENT_CONTORL,
MotorCurrentAndPhase->MoveType); MotorCurrentAndPhase->MoveType);
DBG_ASIC_LEAVE(); DBG_ASIC_LEAVE ();
} }
static SANE_Status static SANE_Status
@ -517,7 +517,7 @@ SetMotorTable (ASIC * chip, unsigned int dwTableBaseAddr,
{ {
SANE_Status status; SANE_Status status;
RAMACCESS access; RAMACCESS access;
DBG_ASIC_ENTER(); DBG_ASIC_ENTER ();
access.IsWriteAccess = SANE_TRUE; access.IsWriteAccess = SANE_TRUE;
access.RamType = EXTERNAL_RAM; access.RamType = EXTERNAL_RAM;
@ -531,7 +531,7 @@ SetMotorTable (ASIC * chip, unsigned int dwTableBaseAddr,
SendData (chip, ES01_9D_MotorTableAddrA14_A21, SendData (chip, ES01_9D_MotorTableAddrA14_A21,
(SANE_Byte) (dwTableBaseAddr >> TABLE_OFFSET_BASE)); (SANE_Byte) (dwTableBaseAddr >> TABLE_OFFSET_BASE));
DBG_ASIC_LEAVE(); DBG_ASIC_LEAVE ();
return status; return status;
} }
@ -541,7 +541,7 @@ SetShadingTable (ASIC * chip, unsigned int dwTableBaseAddr,
{ {
SANE_Status status; SANE_Status status;
RAMACCESS access; RAMACCESS access;
DBG_ASIC_ENTER(); DBG_ASIC_ENTER ();
access.IsWriteAccess = SANE_TRUE; access.IsWriteAccess = SANE_TRUE;
access.RamType = EXTERNAL_RAM; access.RamType = EXTERNAL_RAM;
@ -555,7 +555,7 @@ SetShadingTable (ASIC * chip, unsigned int dwTableBaseAddr,
SendData (chip, ES01_9B_ShadingTableAddrA14_A21, SendData (chip, ES01_9B_ShadingTableAddrA14_A21,
(SANE_Byte) (dwTableBaseAddr >> TABLE_OFFSET_BASE)); (SANE_Byte) (dwTableBaseAddr >> TABLE_OFFSET_BASE));
DBG_ASIC_LEAVE(); DBG_ASIC_LEAVE ();
return status; return status;
} }
@ -565,7 +565,7 @@ MotorMove (ASIC * chip, MOTORMOVE * Move)
SANE_Status status; SANE_Status status;
unsigned int motor_steps; unsigned int motor_steps;
SANE_Byte temp_motor_action; SANE_Byte temp_motor_action;
DBG_ASIC_ENTER(); DBG_ASIC_ENTER ();
status = PrepareScanChip (chip); status = PrepareScanChip (chip);
if (status != SANE_STATUS_GOOD) if (status != SANE_STATUS_GOOD)
@ -657,7 +657,7 @@ MotorMove (ASIC * chip, MOTORMOVE * Move)
status = WaitUnitReady (chip); status = WaitUnitReady (chip);
DBG_ASIC_LEAVE(); DBG_ASIC_LEAVE ();
return status; return status;
} }
@ -674,7 +674,7 @@ SetMotorStepTable (ASIC * chip, MOTORMOVE * MotorStepsTable,
SANE_Byte bScanDecSteps = 255; SANE_Byte bScanDecSteps = 255;
unsigned short wScanBackTrackingSteps = 40; unsigned short wScanBackTrackingSteps = 40;
unsigned short wScanRestartSteps = 40; unsigned short wScanRestartSteps = 40;
DBG_ASIC_ENTER(); DBG_ASIC_ENTER ();
switch (wYResolution) switch (wYResolution)
{ {
@ -771,7 +771,7 @@ SetMotorStepTable (ASIC * chip, MOTORMOVE * MotorStepsTable,
SendData (chip, ES01_F1_ScanImageStep8_15, BYTE1 (dwScanImageSteps)); SendData (chip, ES01_F1_ScanImageStep8_15, BYTE1 (dwScanImageSteps));
SendData (chip, ES01_F2_ScanImageStep16_19, BYTE2 (dwScanImageSteps)); SendData (chip, ES01_F2_ScanImageStep16_19, BYTE2 (dwScanImageSteps));
DBG_ASIC_LEAVE(); DBG_ASIC_LEAVE ();
} }
static void static void
@ -782,7 +782,7 @@ SetMotorStepTableForCalibration (ASIC * chip, MOTORMOVE * MotorStepsTable,
SANE_Byte bScanDecSteps = 1; SANE_Byte bScanDecSteps = 1;
unsigned short wFixScanSteps = 0; unsigned short wFixScanSteps = 0;
unsigned short wScanBackTrackingSteps = 20; unsigned short wScanBackTrackingSteps = 20;
DBG_ASIC_ENTER(); DBG_ASIC_ENTER ();
chip->isMotorMoveToFirstLine = 0; chip->isMotorMoveToFirstLine = 0;
@ -819,7 +819,7 @@ SetMotorStepTableForCalibration (ASIC * chip, MOTORMOVE * MotorStepsTable,
SendData (chip, ES01_F1_ScanImageStep8_15, BYTE1 (dwScanImageSteps)); SendData (chip, ES01_F1_ScanImageStep8_15, BYTE1 (dwScanImageSteps));
SendData (chip, ES01_F2_ScanImageStep16_19, BYTE2 (dwScanImageSteps)); SendData (chip, ES01_F2_ScanImageStep16_19, BYTE2 (dwScanImageSteps));
DBG_ASIC_LEAVE(); DBG_ASIC_LEAVE ();
} }
static void static void
@ -961,7 +961,7 @@ SimpleMotorMove (ASIC * chip,
CALCULATEMOTORTABLE CalMotorTable; CALCULATEMOTORTABLE CalMotorTable;
MOTOR_CURRENT_AND_PHASE CurrentPhase; MOTOR_CURRENT_AND_PHASE CurrentPhase;
MOTORMOVE Move; MOTORMOVE Move;
DBG_ASIC_ENTER(); DBG_ASIC_ENTER ();
MotorTable = malloc (MOTOR_TABLE_SIZE * sizeof (unsigned short)); MotorTable = malloc (MOTOR_TABLE_SIZE * sizeof (unsigned short));
if (!MotorTable) if (!MotorTable)
@ -1003,7 +1003,7 @@ SimpleMotorMove (ASIC * chip,
Move.FixMoveSpeed = dwFixMoveSpeed; Move.FixMoveSpeed = dwFixMoveSpeed;
status = MotorMove (chip, &Move); status = MotorMove (chip, &Move);
DBG_ASIC_LEAVE(); DBG_ASIC_LEAVE ();
return status; return status;
} }
@ -1048,7 +1048,7 @@ OpenScanChip (ASIC * chip)
{ {
SANE_Status status; SANE_Status status;
SANE_Byte x[4]; SANE_Byte x[4];
DBG_ASIC_ENTER(); DBG_ASIC_ENTER ();
x[0] = 0x64; x[0] = 0x64;
x[1] = 0x64; x[1] = 0x64;
@ -1080,7 +1080,7 @@ OpenScanChip (ASIC * chip)
x[3] = 0x45; x[3] = 0x45;
status = WriteIOControl (chip, 0x90, 0, 4, x); status = WriteIOControl (chip, 0x90, 0, 4, x);
DBG_ASIC_LEAVE(); DBG_ASIC_LEAVE ();
return status; return status;
} }
@ -1089,7 +1089,7 @@ CloseScanChip (ASIC * chip)
{ {
SANE_Status status; SANE_Status status;
SANE_Byte x[4]; SANE_Byte x[4];
DBG_ASIC_ENTER(); DBG_ASIC_ENTER ();
x[0] = 0x64; x[0] = 0x64;
x[1] = 0x64; x[1] = 0x64;
@ -1121,7 +1121,7 @@ CloseScanChip (ASIC * chip)
x[3] = 0x17; x[3] = 0x17;
status = WriteIOControl (chip, 0x90, 0, 4, x); status = WriteIOControl (chip, 0x90, 0, 4, x);
DBG_ASIC_LEAVE(); DBG_ASIC_LEAVE ();
return status; return status;
} }
@ -1129,7 +1129,7 @@ static SANE_Status
PrepareScanChip (ASIC * chip) PrepareScanChip (ASIC * chip)
{ {
SANE_Status status; SANE_Status status;
DBG_ASIC_ENTER(); DBG_ASIC_ENTER ();
SendData (chip, ES01_F3_ActionOption, 0); SendData (chip, ES01_F3_ActionOption, 0);
SendData (chip, ES01_86_DisableAllClockWhenIdle, 0); SendData (chip, ES01_86_DisableAllClockWhenIdle, 0);
@ -1137,7 +1137,7 @@ PrepareScanChip (ASIC * chip)
status = WaitUnitReady (chip); status = WaitUnitReady (chip);
DBG_ASIC_LEAVE(); DBG_ASIC_LEAVE ();
return status; return status;
} }
@ -1148,7 +1148,7 @@ TestDRAM (ASIC * chip)
RAMACCESS access; RAMACCESS access;
SANE_Byte buf[DRAM_TEST_SIZE]; SANE_Byte buf[DRAM_TEST_SIZE];
unsigned int i; unsigned int i;
DBG_ASIC_ENTER(); DBG_ASIC_ENTER ();
for (i = 0; i < sizeof (buf); i++) for (i = 0; i < sizeof (buf); i++)
buf[i] = i; buf[i] = i;
@ -1180,7 +1180,7 @@ TestDRAM (ASIC * chip)
} }
} }
DBG_ASIC_LEAVE(); DBG_ASIC_LEAVE ();
return SANE_STATUS_GOOD; return SANE_STATUS_GOOD;
} }
@ -1188,7 +1188,7 @@ static SANE_Status
SafeInitialChip (ASIC * chip) SafeInitialChip (ASIC * chip)
{ {
SANE_Status status; SANE_Status status;
DBG_ASIC_ENTER(); DBG_ASIC_ENTER ();
status = PrepareScanChip (chip); status = PrepareScanChip (chip);
if (status != SANE_STATUS_GOOD) if (status != SANE_STATUS_GOOD)
@ -1203,7 +1203,7 @@ SafeInitialChip (ASIC * chip)
chip->isFirstOpenChip = SANE_FALSE; chip->isFirstOpenChip = SANE_FALSE;
} }
DBG_ASIC_LEAVE(); DBG_ASIC_LEAVE ();
return status; return status;
} }
@ -1211,7 +1211,7 @@ static SANE_Status
GetChipStatus (ASIC * chip, SANE_Byte Selector, SANE_Byte * ChipStatus) GetChipStatus (ASIC * chip, SANE_Byte Selector, SANE_Byte * ChipStatus)
{ {
SANE_Status status; SANE_Status status;
DBG_ASIC_ENTER(); DBG_ASIC_ENTER ();
status = SendData (chip, ES01_8B_Status, Selector); status = SendData (chip, ES01_8B_Status, Selector);
if (status != SANE_STATUS_GOOD) if (status != SANE_STATUS_GOOD)
@ -1224,7 +1224,7 @@ GetChipStatus (ASIC * chip, SANE_Byte Selector, SANE_Byte * ChipStatus)
if (ChipStatus) if (ChipStatus)
status = ReceiveData (chip, ChipStatus); status = ReceiveData (chip, ChipStatus);
DBG_ASIC_LEAVE(); DBG_ASIC_LEAVE ();
return status; return status;
} }
@ -1233,7 +1233,7 @@ IsCarriageHome (ASIC * chip, SANE_Bool * LampHome)
{ {
SANE_Status status; SANE_Status status;
SANE_Byte temp; SANE_Byte temp;
DBG_ASIC_ENTER(); DBG_ASIC_ENTER ();
status = GetChipStatus (chip, H1H0L1L0_PS_MJ, &temp); status = GetChipStatus (chip, H1H0L1L0_PS_MJ, &temp);
if (status != SANE_STATUS_GOOD) if (status != SANE_STATUS_GOOD)
@ -1242,7 +1242,7 @@ IsCarriageHome (ASIC * chip, SANE_Bool * LampHome)
*LampHome = (temp & SENSOR0_DETECTED) ? SANE_TRUE : SANE_FALSE; *LampHome = (temp & SENSOR0_DETECTED) ? SANE_TRUE : SANE_FALSE;
DBG (DBG_ASIC, "LampHome=%d\n", *LampHome); DBG (DBG_ASIC, "LampHome=%d\n", *LampHome);
DBG_ASIC_LEAVE(); DBG_ASIC_LEAVE ();
return SANE_STATUS_GOOD; return SANE_STATUS_GOOD;
} }
@ -1252,7 +1252,7 @@ WaitCarriageHome (ASIC * chip)
SANE_Status status; SANE_Status status;
SANE_Bool LampHome; SANE_Bool LampHome;
int i; int i;
DBG_ASIC_ENTER(); DBG_ASIC_ENTER ();
for (i = 0; i < 100; i++) for (i = 0; i < 100; i++)
{ {
@ -1269,7 +1269,7 @@ WaitCarriageHome (ASIC * chip)
if ((status == SANE_STATUS_GOOD) && (i == 100)) if ((status == SANE_STATUS_GOOD) && (i == 100))
status = SANE_STATUS_DEVICE_BUSY; status = SANE_STATUS_DEVICE_BUSY;
DBG_ASIC_LEAVE(); DBG_ASIC_LEAVE ();
return status; return status;
} }
@ -1279,7 +1279,7 @@ WaitUnitReady (ASIC * chip)
SANE_Status status; SANE_Status status;
SANE_Byte temp; SANE_Byte temp;
int i; int i;
DBG_ASIC_ENTER(); DBG_ASIC_ENTER ();
for (i = 0; i < 300; i++) for (i = 0; i < 300; i++)
{ {
@ -1294,7 +1294,7 @@ WaitUnitReady (ASIC * chip)
status = SendData (chip, ES01_F4_ActiveTrigger, 0); status = SendData (chip, ES01_F4_ActiveTrigger, 0);
DBG_ASIC_LEAVE(); DBG_ASIC_LEAVE ();
return status; return status;
} }
@ -1302,7 +1302,7 @@ WaitUnitReady (ASIC * chip)
static void static void
SetCCDTiming (ASIC * chip) SetCCDTiming (ASIC * chip)
{ {
DBG_ASIC_ENTER(); DBG_ASIC_ENTER ();
SendData (chip, ES01_82_AFE_ADCCLK_TIMING_ADJ_BYTE0, SendData (chip, ES01_82_AFE_ADCCLK_TIMING_ADJ_BYTE0,
BYTE0 (chip->Timing.AFE_ADCCLK_Timing)); BYTE0 (chip->Timing.AFE_ADCCLK_Timing));
@ -1404,13 +1404,13 @@ SetCCDTiming (ASIC * chip)
SendData (chip, ES01_1EB_PHCP_TIMING_ADJ_B3, SendData (chip, ES01_1EB_PHCP_TIMING_ADJ_B3,
BYTE3 (chip->Timing.CCD_PHCP_Timing)); BYTE3 (chip->Timing.CCD_PHCP_Timing));
DBG_ASIC_LEAVE(); DBG_ASIC_LEAVE ();
} }
static void static void
SetLineTimeAndExposure (ASIC * chip) SetLineTimeAndExposure (ASIC * chip)
{ {
DBG_ASIC_ENTER(); DBG_ASIC_ENTER ();
SendData (chip, ES01_C4_MultiTGTimesRed, 0); SendData (chip, ES01_C4_MultiTGTimesRed, 0);
SendData (chip, ES01_C5_MultiTGTimesGreen, 0); SendData (chip, ES01_C5_MultiTGTimesGreen, 0);
@ -1424,13 +1424,13 @@ SetLineTimeAndExposure (ASIC * chip)
SendData (chip, ES01_CB_CCDDummyCycleNumber, 0); SendData (chip, ES01_CB_CCDDummyCycleNumber, 0);
DBG_ASIC_LEAVE(); DBG_ASIC_LEAVE ();
} }
static void static void
SetLEDTime (ASIC * chip) SetLEDTime (ASIC * chip)
{ {
DBG_ASIC_ENTER(); DBG_ASIC_ENTER ();
SendData (chip, ES01_B8_ChannelRedExpStartPixelLSB, SendData (chip, ES01_B8_ChannelRedExpStartPixelLSB,
LOBYTE (chip->Timing.ChannelR_StartPixel)); LOBYTE (chip->Timing.ChannelR_StartPixel));
@ -1459,14 +1459,14 @@ SetLEDTime (ASIC * chip)
SendData (chip, ES01_C3_ChannelBlueExpEndPixelMSB, SendData (chip, ES01_C3_ChannelBlueExpEndPixelMSB,
HIBYTE (chip->Timing.ChannelB_EndPixel)); HIBYTE (chip->Timing.ChannelB_EndPixel));
DBG_ASIC_LEAVE(); DBG_ASIC_LEAVE ();
} }
void void
SetAFEGainOffset (ASIC * chip) SetAFEGainOffset (ASIC * chip)
{ {
int i, j; int i, j;
DBG_ASIC_ENTER(); DBG_ASIC_ENTER ();
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
{ {
@ -1508,14 +1508,14 @@ SetAFEGainOffset (ASIC * chip)
SendData (chip, ES01_0A_AD9826OffsetRedP + (i * 2), chip->AD.Offset[i]); SendData (chip, ES01_0A_AD9826OffsetRedP + (i * 2), chip->AD.Offset[i]);
} }
DBG_ASIC_LEAVE(); DBG_ASIC_LEAVE ();
} }
static void static void
SetScanMode (ASIC * chip, SANE_Byte bScanBits) SetScanMode (ASIC * chip, SANE_Byte bScanBits)
{ {
SANE_Byte temp_f5_register; SANE_Byte temp_f5_register;
DBG_ASIC_ENTER(); DBG_ASIC_ENTER ();
if (bScanBits >= 24) if (bScanBits >= 24)
temp_f5_register = COLOR_ES02 | GRAY_GREEN_BLUE_ES02; temp_f5_register = COLOR_ES02 | GRAY_GREEN_BLUE_ES02;
@ -1532,7 +1532,7 @@ SetScanMode (ASIC * chip, SANE_Byte bScanBits)
SendData (chip, ES01_F5_ScanDataFormat, temp_f5_register); SendData (chip, ES01_F5_ScanDataFormat, temp_f5_register);
DBG (DBG_ASIC, "F5_ScanDataFormat=0x%x\n", temp_f5_register); DBG (DBG_ASIC, "F5_ScanDataFormat=0x%x\n", temp_f5_register);
DBG_ASIC_LEAVE(); DBG_ASIC_LEAVE ();
} }
static void static void
@ -1542,7 +1542,7 @@ SetPackAddress (ASIC * chip, unsigned short wWidth, unsigned short wX,
{ {
unsigned short ValidPixelNumber; unsigned short ValidPixelNumber;
int i; int i;
DBG_ASIC_ENTER(); DBG_ASIC_ENTER ();
ValidPixelNumber = (unsigned short) ((wWidth + 10 + 15) * XRatioAdderDouble); ValidPixelNumber = (unsigned short) ((wWidth + 10 + 15) * XRatioAdderDouble);
ValidPixelNumber &= ~15; ValidPixelNumber &= ~15;
@ -1702,7 +1702,7 @@ SetPackAddress (ASIC * chip, unsigned short wWidth, unsigned short wX,
if (pValidPixelNumber) if (pValidPixelNumber)
*pValidPixelNumber = ValidPixelNumber; *pValidPixelNumber = ValidPixelNumber;
DBG_ASIC_LEAVE(); DBG_ASIC_LEAVE ();
} }
static void static void
@ -1710,7 +1710,7 @@ SetExtraSettings (ASIC * chip, unsigned short wXResolution,
unsigned short wCCD_PixelNumber, SANE_Bool bypassShading) unsigned short wCCD_PixelNumber, SANE_Bool bypassShading)
{ {
SANE_Byte temp_ff_register = 0; SANE_Byte temp_ff_register = 0;
DBG_ASIC_ENTER(); DBG_ASIC_ENTER ();
SendData (chip, ES01_B8_ChannelRedExpStartPixelLSB, SendData (chip, ES01_B8_ChannelRedExpStartPixelLSB,
LOBYTE (chip->Timing.ChannelR_StartPixel)); LOBYTE (chip->Timing.ChannelR_StartPixel));
@ -1778,7 +1778,7 @@ SetExtraSettings (ASIC * chip, unsigned short wXResolution,
SendData (chip, ES01_89_LINE_ART_THRESHOLD_LOW_VALUE, 127); SendData (chip, ES01_89_LINE_ART_THRESHOLD_LOW_VALUE, 127);
usleep (50000); usleep (50000);
DBG_ASIC_LEAVE(); DBG_ASIC_LEAVE ();
} }
@ -1802,7 +1802,7 @@ SANE_Status
Asic_Open (ASIC * chip) Asic_Open (ASIC * chip)
{ {
SANE_Status status; SANE_Status status;
DBG_ASIC_ENTER(); DBG_ASIC_ENTER ();
if (chip->firmwarestate > FS_OPENED) if (chip->firmwarestate > FS_OPENED)
{ {
@ -1871,7 +1871,7 @@ Asic_Open (ASIC * chip)
} }
DBG (DBG_INFO, "device %s successfully opened\n", device_name); DBG (DBG_INFO, "device %s successfully opened\n", device_name);
DBG_ASIC_LEAVE(); DBG_ASIC_LEAVE ();
return SANE_STATUS_GOOD; return SANE_STATUS_GOOD;
} }
@ -1879,7 +1879,7 @@ SANE_Status
Asic_Close (ASIC * chip) Asic_Close (ASIC * chip)
{ {
SANE_Status status; SANE_Status status;
DBG_ASIC_ENTER(); DBG_ASIC_ENTER ();
if (chip->firmwarestate < FS_OPENED) if (chip->firmwarestate < FS_OPENED)
{ {
@ -1899,14 +1899,14 @@ Asic_Close (ASIC * chip)
chip->firmwarestate = FS_ATTACHED; chip->firmwarestate = FS_ATTACHED;
DBG_ASIC_LEAVE(); DBG_ASIC_LEAVE ();
return status; return status;
} }
void void
Asic_Initialize (ASIC * chip) Asic_Initialize (ASIC * chip)
{ {
DBG_ASIC_ENTER(); DBG_ASIC_ENTER ();
chip->isFirstOpenChip = SANE_TRUE; chip->isFirstOpenChip = SANE_TRUE;
chip->isUsb20 = SANE_FALSE; chip->isUsb20 = SANE_FALSE;
@ -1920,13 +1920,13 @@ Asic_Initialize (ASIC * chip)
chip->firmwarestate = FS_ATTACHED; chip->firmwarestate = FS_ATTACHED;
DBG_ASIC_LEAVE(); DBG_ASIC_LEAVE ();
} }
SANE_Status SANE_Status
Asic_TurnLamp (ASIC * chip, SANE_Bool isLampOn) Asic_TurnLamp (ASIC * chip, SANE_Bool isLampOn)
{ {
DBG_ASIC_ENTER(); DBG_ASIC_ENTER ();
if (chip->firmwarestate != FS_OPENED) if (chip->firmwarestate != FS_OPENED)
{ {
@ -1940,7 +1940,7 @@ Asic_TurnLamp (ASIC * chip, SANE_Bool isLampOn)
else else
SendData (chip, ES01_90_Lamp0PWM, 0); SendData (chip, ES01_90_Lamp0PWM, 0);
DBG_ASIC_LEAVE(); DBG_ASIC_LEAVE ();
return SANE_STATUS_GOOD; return SANE_STATUS_GOOD;
} }
@ -1948,7 +1948,7 @@ Asic_TurnLamp (ASIC * chip, SANE_Bool isLampOn)
SANE_Status SANE_Status
Asic_TurnTA (ASIC * chip, SANE_Bool isTAOn) Asic_TurnTA (ASIC * chip, SANE_Bool isTAOn)
{ {
DBG_ASIC_ENTER(); DBG_ASIC_ENTER ();
if (chip->firmwarestate != FS_OPENED) if (chip->firmwarestate != FS_OPENED)
{ {
@ -1962,7 +1962,7 @@ Asic_TurnTA (ASIC * chip, SANE_Bool isTAOn)
else else
SendData (chip, ES01_91_Lamp1PWM, 0); SendData (chip, ES01_91_Lamp1PWM, 0);
DBG_ASIC_LEAVE(); DBG_ASIC_LEAVE ();
return SANE_STATUS_GOOD; return SANE_STATUS_GOOD;
} }
@ -2077,7 +2077,7 @@ Asic_SetWindow (ASIC * chip, SCANSOURCE lsLightSource,
unsigned short * pMotorTable; unsigned short * pMotorTable;
unsigned int RealTableSize; unsigned int RealTableSize;
unsigned short wFullBank; unsigned short wFullBank;
DBG_ASIC_ENTER(); DBG_ASIC_ENTER ();
DBG (DBG_ASIC, "lsLightSource=%d,ScanType=%d,bScanBits=%d," \ DBG (DBG_ASIC, "lsLightSource=%d,ScanType=%d,bScanBits=%d," \
"wXResolution=%d,wYResolution=%d,wX=%d,wY=%d," \ "wXResolution=%d,wYResolution=%d,wX=%d,wY=%d," \
"wWidth=%d,wLength=%d\n", "wWidth=%d,wLength=%d\n",
@ -2348,7 +2348,7 @@ Asic_SetWindow (ASIC * chip, SCANSOURCE lsLightSource,
status = SetRamAddress (chip, 0, dwEndAddr, EXTERNAL_RAM); status = SetRamAddress (chip, 0, dwEndAddr, EXTERNAL_RAM);
DBG_ASIC_LEAVE(); DBG_ASIC_LEAVE ();
return status; return status;
} }
@ -2356,7 +2356,7 @@ SANE_Status
Asic_ScanStart (ASIC * chip) Asic_ScanStart (ASIC * chip)
{ {
SANE_Status status; SANE_Status status;
DBG_ASIC_ENTER(); DBG_ASIC_ENTER ();
if (chip->firmwarestate != FS_OPENED) if (chip->firmwarestate != FS_OPENED)
{ {
@ -2376,7 +2376,7 @@ Asic_ScanStart (ASIC * chip)
chip->firmwarestate = FS_SCANNING; chip->firmwarestate = FS_SCANNING;
DBG_ASIC_LEAVE(); DBG_ASIC_LEAVE ();
return SANE_STATUS_GOOD; return SANE_STATUS_GOOD;
} }
@ -2385,7 +2385,7 @@ Asic_ScanStop (ASIC * chip)
{ {
SANE_Status status; SANE_Status status;
SANE_Byte buf[4]; SANE_Byte buf[4];
DBG_ASIC_ENTER(); DBG_ASIC_ENTER ();
if (chip->firmwarestate < FS_OPENED) if (chip->firmwarestate < FS_OPENED)
{ {
@ -2427,7 +2427,7 @@ Asic_ScanStop (ASIC * chip)
chip->firmwarestate = FS_OPENED; chip->firmwarestate = FS_OPENED;
DBG_ASIC_LEAVE(); DBG_ASIC_LEAVE ();
return SANE_STATUS_GOOD; return SANE_STATUS_GOOD;
} }
@ -2436,7 +2436,7 @@ Asic_ReadImage (ASIC * chip, SANE_Byte * pBuffer, unsigned short LinesCount)
{ {
SANE_Status status; SANE_Status status;
unsigned int dwXferBytes; unsigned int dwXferBytes;
DBG_ASIC_ENTER(); DBG_ASIC_ENTER ();
DBG (DBG_ASIC, "LinesCount=%d\n", LinesCount); DBG (DBG_ASIC, "LinesCount=%d\n", LinesCount);
if (chip->firmwarestate != FS_SCANNING) if (chip->firmwarestate != FS_SCANNING)
@ -2454,7 +2454,7 @@ Asic_ReadImage (ASIC * chip, SANE_Byte * pBuffer, unsigned short LinesCount)
status = DMARead (chip, dwXferBytes, pBuffer); status = DMARead (chip, dwXferBytes, pBuffer);
DBG_ASIC_LEAVE(); DBG_ASIC_LEAVE ();
return status; return status;
} }
@ -2464,7 +2464,7 @@ Asic_CheckFunctionKey (ASIC * chip, SANE_Byte * key)
{ {
SANE_Status status; SANE_Status status;
SANE_Byte bBuffer_1, bBuffer_2; SANE_Byte bBuffer_1, bBuffer_2;
DBG_ASIC_ENTER(); DBG_ASIC_ENTER ();
if (chip->firmwarestate != FS_OPENED) if (chip->firmwarestate != FS_OPENED)
{ {
@ -2501,7 +2501,7 @@ Asic_CheckFunctionKey (ASIC * chip, SANE_Byte * key)
*key = 0; *key = 0;
DBG (DBG_ASIC, "key=%d\n", *key); DBG (DBG_ASIC, "key=%d\n", *key);
DBG_ASIC_LEAVE(); DBG_ASIC_LEAVE ();
return SANE_STATUS_GOOD; return SANE_STATUS_GOOD;
} }
#endif #endif
@ -2511,7 +2511,7 @@ Asic_IsTAConnected (ASIC * chip, SANE_Bool * hasTA)
{ {
SANE_Status status; SANE_Status status;
SANE_Byte bBuffer_1 = 0xff; SANE_Byte bBuffer_1 = 0xff;
DBG_ASIC_ENTER(); DBG_ASIC_ENTER ();
if (chip->firmwarestate != FS_OPENED) if (chip->firmwarestate != FS_OPENED)
{ {
@ -2531,7 +2531,7 @@ Asic_IsTAConnected (ASIC * chip, SANE_Bool * hasTA)
*hasTA = (~bBuffer_1 & 0x08) ? SANE_TRUE : SANE_FALSE; *hasTA = (~bBuffer_1 & 0x08) ? SANE_TRUE : SANE_FALSE;
DBG (DBG_ASIC, "hasTA=%d\n", *hasTA); DBG (DBG_ASIC, "hasTA=%d\n", *hasTA);
DBG_ASIC_LEAVE(); DBG_ASIC_LEAVE ();
return SANE_STATUS_GOOD; return SANE_STATUS_GOOD;
} }
@ -2543,7 +2543,7 @@ Asic_ReadCalibrationData (ASIC * chip, SANE_Byte * pBuffer,
SANE_Byte * pCalBuffer; SANE_Byte * pCalBuffer;
unsigned int dwTotalReadData = 0; unsigned int dwTotalReadData = 0;
unsigned int dwReadImageData; unsigned int dwReadImageData;
DBG_ASIC_ENTER(); DBG_ASIC_ENTER ();
if (chip->firmwarestate != FS_SCANNING) if (chip->firmwarestate != FS_SCANNING)
{ {
@ -2599,7 +2599,7 @@ Asic_ReadCalibrationData (ASIC * chip, SANE_Byte * pBuffer,
} }
} }
DBG_ASIC_LEAVE(); DBG_ASIC_LEAVE ();
return status; return status;
} }
@ -2608,7 +2608,7 @@ Asic_MotorMove (ASIC * chip, SANE_Bool isForward, unsigned int dwTotalSteps)
{ {
SANE_Status status; SANE_Status status;
SANE_Byte bActionType; SANE_Byte bActionType;
DBG_ASIC_ENTER(); DBG_ASIC_ENTER ();
if (chip->firmwarestate != FS_OPENED) if (chip->firmwarestate != FS_OPENED)
{ {
@ -2620,7 +2620,7 @@ Asic_MotorMove (ASIC * chip, SANE_Bool isForward, unsigned int dwTotalSteps)
status = SimpleMotorMove (chip, 5000, 1800, 7000, 200, dwTotalSteps, status = SimpleMotorMove (chip, 5000, 1800, 7000, 200, dwTotalSteps,
bActionType); bActionType);
DBG_ASIC_LEAVE(); DBG_ASIC_LEAVE ();
return status; return status;
} }
@ -2629,7 +2629,7 @@ Asic_CarriageHome (ASIC * chip)
{ {
SANE_Status status; SANE_Status status;
SANE_Bool LampHome; SANE_Bool LampHome;
DBG_ASIC_ENTER(); DBG_ASIC_ENTER ();
if (chip->firmwarestate != FS_OPENED) if (chip->firmwarestate != FS_OPENED)
{ {
@ -2645,7 +2645,7 @@ Asic_CarriageHome (ASIC * chip)
status = SimpleMotorMove (chip, 5000, 1200, 3000, 220, 766, status = SimpleMotorMove (chip, 5000, 1200, 3000, 220, 766,
ACTION_TYPE_BACKTOHOME); ACTION_TYPE_BACKTOHOME);
DBG_ASIC_LEAVE(); DBG_ASIC_LEAVE ();
return status; return status;
} }
@ -2658,7 +2658,7 @@ Asic_SetShadingTable (ASIC * chip, unsigned short * pWhiteShading,
unsigned short wValidPixelNumber; unsigned short wValidPixelNumber;
double dbXRatioAdderDouble; double dbXRatioAdderDouble;
unsigned int wShadingTableSize; unsigned int wShadingTableSize;
DBG_ASIC_ENTER(); DBG_ASIC_ENTER ();
if (chip->firmwarestate != FS_OPENED) if (chip->firmwarestate != FS_OPENED)
{ {
@ -2716,6 +2716,6 @@ Asic_SetShadingTable (ASIC * chip, unsigned short * pWhiteShading,
} }
} }
DBG_ASIC_LEAVE(); DBG_ASIC_LEAVE ();
return SANE_STATUS_GOOD; return SANE_STATUS_GOOD;
} }

Wyświetl plik

@ -100,7 +100,7 @@ static unsigned int g_dwAlreadyGetLines;
void void
Scanner_Init (void) Scanner_Init (void)
{ {
DBG_ENTER(); DBG_ENTER ();
Asic_Initialize (&g_chip); Asic_Initialize (&g_chip);
@ -111,20 +111,20 @@ Scanner_Init (void)
g_pReadImageHead = NULL; g_pReadImageHead = NULL;
g_pGammaTable = NULL; g_pGammaTable = NULL;
DBG_LEAVE(); DBG_LEAVE ();
} }
SANE_Bool SANE_Bool
Scanner_IsPresent (void) Scanner_IsPresent (void)
{ {
DBG_ENTER(); DBG_ENTER ();
if (Asic_Open (&g_chip) != SANE_STATUS_GOOD) if (Asic_Open (&g_chip) != SANE_STATUS_GOOD)
return SANE_FALSE; return SANE_FALSE;
if (Asic_Close (&g_chip) != SANE_STATUS_GOOD) if (Asic_Close (&g_chip) != SANE_STATUS_GOOD)
return SANE_FALSE; return SANE_FALSE;
DBG_LEAVE(); DBG_LEAVE ();
return SANE_TRUE; return SANE_TRUE;
} }
@ -132,7 +132,7 @@ SANE_Bool
Scanner_PowerControl (SANE_Bool isLampOn, SANE_Bool isTALampOn) Scanner_PowerControl (SANE_Bool isLampOn, SANE_Bool isTALampOn)
{ {
SANE_Bool hasTA; SANE_Bool hasTA;
DBG_ENTER(); DBG_ENTER ();
if (Asic_Open (&g_chip) != SANE_STATUS_GOOD) if (Asic_Open (&g_chip) != SANE_STATUS_GOOD)
return SANE_FALSE; return SANE_FALSE;
@ -149,7 +149,7 @@ Scanner_PowerControl (SANE_Bool isLampOn, SANE_Bool isTALampOn)
if (Asic_Close (&g_chip) != SANE_STATUS_GOOD) if (Asic_Close (&g_chip) != SANE_STATUS_GOOD)
return SANE_FALSE; return SANE_FALSE;
DBG_LEAVE(); DBG_LEAVE ();
return SANE_TRUE; return SANE_TRUE;
error: error:
@ -160,7 +160,7 @@ error:
SANE_Bool SANE_Bool
Scanner_BackHome (void) Scanner_BackHome (void)
{ {
DBG_ENTER(); DBG_ENTER ();
if (Asic_Open (&g_chip) != SANE_STATUS_GOOD) if (Asic_Open (&g_chip) != SANE_STATUS_GOOD)
return SANE_FALSE; return SANE_FALSE;
@ -174,7 +174,7 @@ Scanner_BackHome (void)
if (Asic_Close (&g_chip) != SANE_STATUS_GOOD) if (Asic_Close (&g_chip) != SANE_STATUS_GOOD)
return SANE_FALSE; return SANE_FALSE;
DBG_LEAVE(); DBG_LEAVE ();
return SANE_TRUE; return SANE_TRUE;
} }
@ -182,7 +182,7 @@ SANE_Bool
Scanner_IsTAConnected (void) Scanner_IsTAConnected (void)
{ {
SANE_Bool hasTA; SANE_Bool hasTA;
DBG_ENTER(); DBG_ENTER ();
if (Asic_Open (&g_chip) != SANE_STATUS_GOOD) if (Asic_Open (&g_chip) != SANE_STATUS_GOOD)
return SANE_FALSE; return SANE_FALSE;
@ -193,7 +193,7 @@ Scanner_IsTAConnected (void)
if (Asic_Close (&g_chip) != SANE_STATUS_GOOD) if (Asic_Close (&g_chip) != SANE_STATUS_GOOD)
return SANE_FALSE; return SANE_FALSE;
DBG_LEAVE(); DBG_LEAVE ();
return hasTA; return hasTA;
} }
@ -201,7 +201,7 @@ Scanner_IsTAConnected (void)
SANE_Bool SANE_Bool
Scanner_GetKeyStatus (SANE_Byte * pKey) Scanner_GetKeyStatus (SANE_Byte * pKey)
{ {
DBG_ENTER(); DBG_ENTER ();
if (Asic_Open (&g_chip) != SANE_STATUS_GOOD) if (Asic_Open (&g_chip) != SANE_STATUS_GOOD)
return SANE_FALSE; return SANE_FALSE;
@ -215,7 +215,7 @@ Scanner_GetKeyStatus (SANE_Byte * pKey)
if (Asic_Close (&g_chip) != SANE_STATUS_GOOD) if (Asic_Close (&g_chip) != SANE_STATUS_GOOD)
return SANE_FALSE; return SANE_FALSE;
DBG_LEAVE(); DBG_LEAVE ();
return SANE_TRUE; return SANE_TRUE;
} }
#endif #endif
@ -785,7 +785,7 @@ ReadDataFromScanner (void __sane_unused__ * dummy)
unsigned short wReadImageLines = 0; unsigned short wReadImageLines = 0;
unsigned short wScanLinesThisBlock; unsigned short wScanLinesThisBlock;
unsigned short wBufferLines = g_wLineDistance * 2 + g_wPixelDistance; unsigned short wBufferLines = g_wLineDistance * 2 + g_wPixelDistance;
DBG_ENTER(); DBG_ENTER ();
DBG (DBG_FUNC, "ReadDataFromScanner: new thread\n"); DBG (DBG_FUNC, "ReadDataFromScanner: new thread\n");
while (wTotalReadImageLines < wWantedLines) while (wTotalReadImageLines < wWantedLines)
@ -838,7 +838,7 @@ ReadDataFromScanner (void __sane_unused__ * dummy)
} }
DBG (DBG_FUNC, "ReadDataFromScanner: read OK, exit thread\n"); DBG (DBG_FUNC, "ReadDataFromScanner: read OK, exit thread\n");
DBG_LEAVE(); DBG_LEAVE ();
return NULL; return NULL;
} }
@ -850,7 +850,7 @@ GetLine (SANE_Byte * pLine, unsigned short * wLinesCount,
unsigned short wWantedTotalLines; unsigned short wWantedTotalLines;
unsigned short TotalXferLines = 0; unsigned short TotalXferLines = 0;
SANE_Byte * pFirstLine = pLine; SANE_Byte * pFirstLine = pLine;
DBG_ENTER(); DBG_ENTER ();
wWantedTotalLines = *wLinesCount; wWantedTotalLines = *wLinesCount;
@ -922,7 +922,7 @@ GetLine (SANE_Byte * pLine, unsigned short * wLinesCount,
} }
} }
DBG_LEAVE(); DBG_LEAVE ();
return SANE_TRUE; return SANE_TRUE;
} }
@ -933,7 +933,7 @@ Scanner_GetRows (SANE_Byte * pBlock, unsigned short * Rows,
unsigned int dwLineIncrement = g_SWBytesPerRow; unsigned int dwLineIncrement = g_SWBytesPerRow;
SANE_Bool fixEvenOdd = SANE_FALSE; SANE_Bool fixEvenOdd = SANE_FALSE;
void (* pFunc)(SANE_Byte *, SANE_Bool) = NULL; void (* pFunc)(SANE_Byte *, SANE_Bool) = NULL;
DBG_ENTER(); DBG_ENTER ();
if (!g_bOpened || !g_bPrepared) if (!g_bOpened || !g_bPrepared)
{ {
@ -991,7 +991,7 @@ Scanner_GetRows (SANE_Byte * pBlock, unsigned short * Rows,
break; break;
} }
DBG_LEAVE(); DBG_LEAVE ();
return GetLine (pBlock, Rows, dwLineIncrement, pFunc, isOrderInvert, return GetLine (pBlock, Rows, dwLineIncrement, pFunc, isOrderInvert,
fixEvenOdd); fixEvenOdd);
} }
@ -1000,7 +1000,7 @@ void
Scanner_ScanSuggest (TARGETIMAGE * pTarget) Scanner_ScanSuggest (TARGETIMAGE * pTarget)
{ {
unsigned short wMaxWidth, wMaxHeight; unsigned short wMaxWidth, wMaxHeight;
DBG_ENTER(); DBG_ENTER ();
/* check width and height */ /* check width and height */
wMaxWidth = (MAX_SCANNING_WIDTH * pTarget->wXDpi) / 300; wMaxWidth = (MAX_SCANNING_WIDTH * pTarget->wXDpi) / 300;
@ -1010,14 +1010,14 @@ Scanner_ScanSuggest (TARGETIMAGE * pTarget)
pTarget->wWidth = _MIN (pTarget->wWidth, wMaxWidth); pTarget->wWidth = _MIN (pTarget->wWidth, wMaxWidth);
pTarget->wHeight = _MIN (pTarget->wHeight, wMaxHeight); pTarget->wHeight = _MIN (pTarget->wHeight, wMaxHeight);
DBG_LEAVE(); DBG_LEAVE ();
} }
SANE_Bool SANE_Bool
Scanner_StopScan (void) Scanner_StopScan (void)
{ {
SANE_Bool result = SANE_TRUE; SANE_Bool result = SANE_TRUE;
DBG_ENTER(); DBG_ENTER ();
if (!g_bOpened || !g_bPrepared) if (!g_bOpened || !g_bPrepared)
{ {
@ -1050,14 +1050,14 @@ Scanner_StopScan (void)
g_pReadImageHead = NULL; g_pReadImageHead = NULL;
} }
DBG_LEAVE(); DBG_LEAVE ();
return result; return result;
} }
static SANE_Bool static SANE_Bool
PrepareScan (void) PrepareScan (void)
{ {
DBG_ENTER(); DBG_ENTER ();
g_isCanceled = SANE_FALSE; g_isCanceled = SANE_FALSE;
@ -1094,14 +1094,14 @@ PrepareScan (void)
return SANE_FALSE; return SANE_FALSE;
} }
DBG_LEAVE(); DBG_LEAVE ();
return SANE_TRUE; return SANE_TRUE;
} }
SANE_Bool SANE_Bool
Scanner_Reset (void) Scanner_Reset (void)
{ {
DBG_ENTER(); DBG_ENTER ();
if (g_bOpened) if (g_bOpened)
{ {
@ -1113,7 +1113,7 @@ Scanner_Reset (void)
g_bFirstReadImage = SANE_TRUE; g_bFirstReadImage = SANE_TRUE;
g_bPrepared = SANE_TRUE; g_bPrepared = SANE_TRUE;
DBG_LEAVE(); DBG_LEAVE ();
return SANE_TRUE; return SANE_TRUE;
} }
@ -1230,7 +1230,7 @@ AdjustAD (void)
FILE * stream; FILE * stream;
char buf[16]; char buf[16];
#endif #endif
DBG_ENTER(); DBG_ENTER ();
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
{ {
@ -1463,7 +1463,7 @@ AdjustAD (void)
free (pCalData); free (pCalData);
DBG_LEAVE(); DBG_LEAVE ();
return SANE_TRUE; return SANE_TRUE;
error: error:
@ -1484,7 +1484,7 @@ FindTopLeft (unsigned short * pwStartX, unsigned short * pwStartY)
FILE * stream; FILE * stream;
char buf[20]; char buf[20];
#endif #endif
DBG_ENTER(); DBG_ENTER ();
if (g_Target.ssScanSource == SS_REFLECTIVE) if (g_Target.ssScanSource == SS_REFLECTIVE)
{ {
@ -1625,7 +1625,7 @@ FindTopLeft (unsigned short * pwStartX, unsigned short * pwStartY)
free (pCalData); free (pCalData);
DBG (DBG_FUNC, "pwStartY=%d,pwStartX=%d\n", *pwStartY, *pwStartX); DBG (DBG_FUNC, "pwStartY=%d,pwStartX=%d\n", *pwStartY, *pwStartX);
DBG_LEAVE(); DBG_LEAVE ();
return SANE_TRUE; return SANE_TRUE;
error: error:
@ -1678,7 +1678,7 @@ LineCalibration16Bits (void)
FILE * stream; FILE * stream;
char buf[22]; char buf[22];
#endif #endif
DBG_ENTER(); DBG_ENTER ();
wCalWidth = g_Target.wWidth; wCalWidth = g_Target.wWidth;
wCalHeight = LINE_CALIBRATION_HEIGHT; wCalHeight = LINE_CALIBRATION_HEIGHT;
@ -1961,7 +1961,7 @@ LineCalibration16Bits (void)
free (pWhiteData); free (pWhiteData);
free (pDarkData); free (pDarkData);
DBG_LEAVE(); DBG_LEAVE ();
return SANE_TRUE; return SANE_TRUE;
error: error:
@ -1974,7 +1974,7 @@ static SANE_Bool
CreateGammaTable (COLORMODE cmColorMode, unsigned short ** pGammaTable) CreateGammaTable (COLORMODE cmColorMode, unsigned short ** pGammaTable)
{ {
unsigned short * pTable = NULL; unsigned short * pTable = NULL;
DBG_ENTER(); DBG_ENTER ();
if ((cmColorMode == CM_GRAY8) || (cmColorMode == CM_RGB24)) if ((cmColorMode == CM_GRAY8) || (cmColorMode == CM_RGB24))
{ {
@ -2024,7 +2024,7 @@ CreateGammaTable (COLORMODE cmColorMode, unsigned short ** pGammaTable)
*pGammaTable = pTable; *pGammaTable = pTable;
DBG_LEAVE(); DBG_LEAVE ();
return SANE_TRUE; return SANE_TRUE;
} }
@ -2033,7 +2033,7 @@ Scanner_SetupScan (TARGETIMAGE * pTarget)
{ {
unsigned short finalY; unsigned short finalY;
SANE_Byte bScanBits; SANE_Byte bScanBits;
DBG_ENTER(); DBG_ENTER ();
if (g_bOpened || !g_bPrepared) if (g_bOpened || !g_bPrepared)
{ {
@ -2227,6 +2227,6 @@ Scanner_SetupScan (TARGETIMAGE * pTarget)
SANE_STATUS_GOOD) SANE_STATUS_GOOD)
return SANE_FALSE; return SANE_FALSE;
DBG_LEAVE(); DBG_LEAVE ();
return PrepareScan (); return PrepareScan ();
} }