summaryrefslogtreecommitdiff
path: root/backend/hp3900_rts8822.c
diff options
context:
space:
mode:
Diffstat (limited to 'backend/hp3900_rts8822.c')
-rw-r--r--backend/hp3900_rts8822.c116
1 files changed, 58 insertions, 58 deletions
diff --git a/backend/hp3900_rts8822.c b/backend/hp3900_rts8822.c
index 9c8deaa..d76763d 100644
--- a/backend/hp3900_rts8822.c
+++ b/backend/hp3900_rts8822.c
@@ -63,7 +63,7 @@
#include <stdio.h>
#include <stdlib.h>
-#include <string.h> /* bzero() */
+#include <string.h> /* memset() */
#include <time.h> /* clock() */
#include <math.h> /* truncf() */
#include <ctype.h> /* tolower() */
@@ -630,12 +630,12 @@ RTS_Alloc ()
{
SANE_Int rst = OK;
- bzero (dev, sizeof (struct st_device));
+ memset (dev, 0, sizeof (struct st_device));
/* initial registers */
dev->init_regs = malloc (sizeof (SANE_Byte) * RT_BUFFER_LEN);
if (dev->init_regs != NULL)
- bzero (dev->init_regs, sizeof (SANE_Byte) * RT_BUFFER_LEN);
+ memset (dev->init_regs, 0, sizeof (SANE_Byte) * RT_BUFFER_LEN);
else
rst = ERROR;
@@ -643,7 +643,7 @@ RTS_Alloc ()
{
dev->scanning = malloc (sizeof (struct st_scanning));
if (dev->scanning != NULL)
- bzero (dev->scanning, sizeof (struct st_scanning));
+ memset (dev->scanning, 0, sizeof (struct st_scanning));
else
rst = ERROR;
}
@@ -652,7 +652,7 @@ RTS_Alloc ()
{
dev->Reading = malloc (sizeof (struct st_readimage));
if (dev->Reading != NULL)
- bzero (dev->Reading, sizeof (struct st_readimage));
+ memset (dev->Reading, 0, sizeof (struct st_readimage));
else
rst = ERROR;
}
@@ -661,7 +661,7 @@ RTS_Alloc ()
{
dev->Resize = malloc (sizeof (struct st_resize));
if (dev->Resize != NULL)
- bzero (dev->Resize, sizeof (struct st_resize));
+ memset (dev->Resize, 0, sizeof (struct st_resize));
else
rst = ERROR;
}
@@ -670,7 +670,7 @@ RTS_Alloc ()
{
dev->status = malloc (sizeof (struct st_status));
if (dev->status != NULL)
- bzero (dev->status, sizeof (struct st_status));
+ memset (dev->status, 0, sizeof (struct st_status));
else
rst = ERROR;
}
@@ -1255,7 +1255,7 @@ Load_Chipset (struct st_device *dev)
{
SANE_Int model;
- bzero (dev->chipset, sizeof (struct st_chip));
+ memset (dev->chipset, 0, sizeof (struct st_chip));
/* get chipset model of selected scanner */
model = cfg_chipset_model_get (RTS_Debug->dev_model);
@@ -1611,7 +1611,7 @@ RTS_Scanner_SetParams (struct st_device *dev, struct params *param)
compression = FALSE;
/* resetting low level config */
- bzero (&hwdcfg, sizeof (struct st_hwdconfig));
+ memset (&hwdcfg, 0, sizeof (struct st_hwdconfig));
/* setting low level config */
hwdcfg.scantype = scan.scantype;
@@ -1650,7 +1650,7 @@ SetScanParams (struct st_device *dev, SANE_Byte * Regs,
dbg_ScanParams (scancfg);
dbg_hwdcfg (hwdcfg);
- bzero (&mycoords, sizeof (struct st_coords));
+ memset (&mycoords, 0, sizeof (struct st_coords));
/* Copy scancfg to scan2 */
memcpy (&scan2, scancfg, sizeof (struct st_scanparams));
@@ -1774,7 +1774,7 @@ SetScanParams (struct st_device *dev, SANE_Byte * Regs,
8)) ? hwdcfg->compression : FALSE;
if ((arrangeline2 == FIX_BY_HARD) || (mycolormode == CM_LINEART))
- arrangeline2 = mycolormode; /*¿? */
+ arrangeline2 = mycolormode; /*¿? */
else if ((mycolormode == CM_GRAY) && (hwdcfg->highresolution == FALSE))
arrangeline2 = 0;
@@ -2372,7 +2372,7 @@ IsScannerLinked (struct st_device *dev)
lamp = FLB_LAMP;
- /* Comprobar si es la primera conexión con el escaner */
+ /* Comprobar si es la primera conexión con el escaner */
if (Read_Word (dev->usb_handle, 0xe829, &var2) == OK)
{
SANE_Int firstconnection;
@@ -2385,7 +2385,7 @@ IsScannerLinked (struct st_device *dev)
if (firstconnection == TRUE)
{
- /* primera conexión */
+ /* primera conexión */
SANE_Byte flb_lamp, tma_lamp;
flb_lamp = 0;
@@ -3675,7 +3675,7 @@ Init_Registers (struct st_device *dev)
DBG (DBG_FNC, "+ Init_Registers:\n");
/* Lee dev->init_regs */
- bzero (dev->init_regs, RT_BUFFER_LEN);
+ memset (dev->init_regs, 0, RT_BUFFER_LEN);
RTS_ReadRegs (dev->usb_handle, dev->init_regs);
Read_FE3E (dev, &v1619);
@@ -4116,7 +4116,7 @@ Lamp_Status_Get (struct st_device *dev, SANE_Byte * flb_lamp,
case RTS8822BL_03A:
*flb_lamp = ((data2 & 0x40) != 0) ? 1 : 0;
*tma_lamp = (((data2 & 0x20) != 0)
- && ((data1 & 0x10) == 1)) ? 1 : 0;
+ && ((data1 & 0x10) != 0)) ? 1 : 0;
break;
default:
if ((_B1 (data1) & 0x10) == 0)
@@ -4825,8 +4825,8 @@ Refs_Analyze_Pattern (struct st_scanparams *scancfg,
if ((scancfg->coord.width - dist) > 1)
{
/* clear buffers */
- bzero (color_sum, sizeof (double) * buffersize);
- bzero (color_dif, sizeof (double) * buffersize);
+ memset (color_sum, 0, sizeof (double) * buffersize);
+ memset (color_dif, 0, sizeof (double) * buffersize);
for (xpos = 0; xpos < scancfg->coord.width; xpos++)
{
@@ -4875,8 +4875,8 @@ Refs_Analyze_Pattern (struct st_scanparams *scancfg,
if ((scancfg->coord.height - dist) > 1)
{
/* clear buffers */
- bzero (color_sum, sizeof (double) * buffersize);
- bzero (color_dif, sizeof (double) * buffersize);
+ memset (color_sum, 0, sizeof (double) * buffersize);
+ memset (color_dif, 0, sizeof (double) * buffersize);
for (ypos = 0; ypos < scancfg->coord.height; ypos++)
{
@@ -4924,8 +4924,8 @@ Refs_Analyze_Pattern (struct st_scanparams *scancfg,
if ((scancfg->coord.width - dist) > 1)
{
/* clear buffers */
- bzero (color_sum, sizeof (double) * buffersize);
- bzero (color_dif, sizeof (double) * buffersize);
+ memset (color_sum, 0, sizeof (double) * buffersize);
+ memset (color_dif, 0, sizeof (double) * buffersize);
for (xpos = 0; xpos < scancfg->coord.width; xpos++)
{
@@ -6188,7 +6188,7 @@ Reading_DestroyBuffers (struct st_device *dev)
dev->scanning->imagebuffer = NULL;
}
- bzero (dev->Reading, sizeof (struct st_readimage));
+ memset (dev->Reading, 0, sizeof (struct st_readimage));
return OK;
}
@@ -6462,7 +6462,7 @@ RTS_ScanCounter_Inc (struct st_device *dev)
break;
default:
/* value is 4 bytes size starting from address 0x21 in lsb format */
- bzero (&somebuffer, sizeof (somebuffer));
+ memset (&somebuffer, 0, sizeof (somebuffer));
somebuffer[4] = 0x0c;
RTS_EEPROM_ReadInteger (dev->usb_handle, 0x21, &idata);
@@ -7049,7 +7049,7 @@ Triplet_Colour_LRes (SANE_Int Width, SANE_Byte * Buffer,
*/
/* Esta funcion une los tres canales de color en un triplete
- Inicialmente cada color está separado en 3 buffers apuntados
+ Inicialmente cada color está separado en 3 buffers apuntados
por pChannel1 ,2 y 3
*/
SANE_Int Value;
@@ -7591,11 +7591,11 @@ Read_Block (struct st_device *dev, SANE_Int buffer_size, SANE_Byte * buffer,
/*
scan2:
04F0155C 01 08 00 02 03 00 58 02 ..X
-04F01564 58 02 58 02 C5 00 00 00 XXÅ...
-04F0156C B4 07 00 00 8B 01 00 00 ´..‹..
-04F01574 10 06 00 00 EC 13 00 00 ..ì..
-04F0157C B2 07 00 00 B4 07 00 00 ²..´..
-04F01584 CF 08 00 00 Ï..
+04F01564 58 02 58 02 C5 00 00 00 XXÃ…...
+04F0156C B4 07 00 00 8B 01 00 00 ´..‹..
+04F01574 10 06 00 00 EC 13 00 00 ..ì..
+04F0157C B2 07 00 00 B4 07 00 00 ²..´..
+04F01584 CF 08 00 00 Ã..
arrangeline2 = 1
*/
@@ -7786,7 +7786,7 @@ Scan_Read_BufferA (struct st_device *dev, SANE_Int buffer_size, SANE_Int arg2,
opStatus = Reading_Wait (dev, rd->Channels_per_dot,
rd->Channel_size,
iAmount,
- &rd->Bytes_Available, 10, sc);
+ &rd->Bytes_Available, 60, sc);
/* If something fails, perhaps we can read some bytes... */
if (opStatus != OK)
@@ -8072,7 +8072,7 @@ Scan_Start (struct st_device *dev)
dbg_ScanParams (&scancfg);
/* reserva buffer 6 dwords en fa84-fa9f */
- bzero (&hwdcfg, sizeof (struct st_hwdconfig));
+ memset (&hwdcfg, 0, sizeof (struct st_hwdconfig));
/* wait till lamp is at home (should use timeout
windows driver doesn't use it)
@@ -8329,7 +8329,7 @@ if (Calib_test(dev, Regs, &myCalib, &scancfg) == OK )
}
else
{
- /*5e7c *//* entra aquí */
+ /*5e7c *//* entra aquí */
if ((scancfg.resolution_y / 10) > scancfg.coord.top)
runb1 = 0;
}
@@ -9209,7 +9209,7 @@ RTS_Setup (struct st_device *dev, SANE_Byte * Regs,
if (scancfg->colormode == CM_LINEART)
data_bitset (&Regs[0x60b], 0x0c, 0);
- /* disable gamma correction ¿? */
+ /* disable gamma correction ¿? */
data_bitset (&Regs[0x1d0], 0x40, 0);
}
@@ -10009,7 +10009,7 @@ Shading_apply (struct st_device *dev, SANE_Byte * Regs,
}
/*3d4c */
- bzero (&calbuffers, sizeof (struct st_cal2));
+ memset (&calbuffers, 0, sizeof (struct st_cal2));
/* If black shading correction is enabled ... */
if ((Regs[0x1cf] & 8) != 0)
@@ -10340,7 +10340,7 @@ RTS_GetImage (struct st_device *dev, SANE_Byte * Regs,
(struct st_hwdconfig *) malloc (sizeof (struct st_hwdconfig));
if (hwdcfg != NULL)
{
- bzero (hwdcfg, sizeof (struct st_hwdconfig));
+ memset (hwdcfg, 0, sizeof (struct st_hwdconfig));
if (((options & 2) != 0) || ((_B1 (options) & 1) != 0))
{
@@ -10404,7 +10404,7 @@ RTS_GetImage (struct st_device *dev, SANE_Byte * Regs,
sizeof (SANE_Byte));
if (myRegs != NULL)
{
- bzero (myRegs,
+ memset (myRegs, 0,
RT_BUFFER_LEN * sizeof (SANE_Byte));
RTS_Setup (dev, myRegs, &scan, hwdcfg,
gain_offset);
@@ -10547,7 +10547,7 @@ Refs_Detect (struct st_device *dev, SANE_Byte * Regs, SANE_Int resolution_x,
*x = *y = 0; /* default */
/* set configuration to scan a little area at the top-left corner */
- bzero (&scancfg, sizeof (struct st_scanparams));
+ memset (&scancfg, 0, sizeof (struct st_scanparams));
scancfg.depth = 8;
scancfg.colormode = CM_GRAY;
scancfg.channel = CL_RED;
@@ -10588,7 +10588,7 @@ Refs_Detect (struct st_device *dev, SANE_Byte * Regs, SANE_Int resolution_x,
pwmlamplevel = 0;
Lamp_PWM_use (dev, 1);
- bzero (&gain_offset, sizeof (struct st_gain_offset));
+ memset (&gain_offset, 0, sizeof (struct st_gain_offset));
for (C = CL_RED; C <= CL_BLUE; C++)
{
gain_offset.pag[C] = 3;
@@ -11290,7 +11290,7 @@ Head_Relocate (struct st_device *dev, SANE_Int speed, SANE_Int direction,
struct st_motormove mymotor;
struct st_motorpos mtrpos;
- bzero (&mymotor, sizeof (struct st_motormove));
+ memset (&mymotor, 0, sizeof (struct st_motormove));
memcpy (Regs, dev->init_regs, RT_BUFFER_LEN * sizeof (SANE_Byte));
if (speed < dev->motormove_count)
@@ -11338,7 +11338,7 @@ Calib_CreateFixedBuffers ()
(USHORT *) malloc (0x7f8 * sizeof (USHORT));
if (fixed_black_shading[channel] != NULL)
- bzero (fixed_black_shading[channel], 0x7f8 * sizeof (USHORT));
+ memset (fixed_black_shading[channel], 0, 0x7f8 * sizeof (USHORT));
else
ret = ERROR;
@@ -11348,7 +11348,7 @@ Calib_CreateFixedBuffers ()
(USHORT *) malloc (0x7f8 * sizeof (USHORT));
if (fixed_white_shading[channel] != NULL)
- bzero (fixed_white_shading[channel], 0x7f8 * sizeof (USHORT));
+ memset (fixed_white_shading[channel], 0, 0x7f8 * sizeof (USHORT));
else
ret = ERROR;
@@ -12779,7 +12779,7 @@ Calib_WhiteShading_3 (struct st_device *dev,
/*a743 */
if (lf130 > 0)
- bzero (buffer1, lf130 * sizeof (double));
+ memset (buffer1, 0, lf130 * sizeof (double));
/*a761 */
if (lf12c > 0)
@@ -12959,7 +12959,7 @@ Calib_WhiteShading_3 (struct st_device *dev,
/*a743 */
if (lf130 > 0)
- bzero (buffer1, lf130 * sizeof (double));
+ memset (buffer1, 0, lf130 * sizeof (double));
/*a761 */
if (lf12c > 0)
@@ -13325,14 +13325,14 @@ Calib_BlackShading (struct st_device *dev,
if (scancfg.depth > 8)
{
/*8bb2 */
- bzero (&dbvalue, 6 * sizeof (double));
+ memset (&dbvalue, 0, 6 * sizeof (double));
position = 0;
if (bytes_per_line > 0)
{
do
{
- bzero (&buff3, 0x8000 * sizeof (SANE_Int));
+ memset (&buff3, 0, 0x8000 * sizeof (SANE_Int));
sumatorio = 0;
ptr = buffer + position;
current_line = 0;
@@ -13435,14 +13435,14 @@ Calib_BlackShading (struct st_device *dev,
else
{
/*8eb6 */
- bzero (&dbvalue, 6 * sizeof (double));
+ memset (&dbvalue, 0, 6 * sizeof (double));
position = 0;
if (bytes_per_line > 0)
{
do
{
- bzero (&buff2, 256 * sizeof (SANE_Byte));
+ memset (&buff2, 0, 256 * sizeof (SANE_Byte));
sumatorio = 0;
/* ptr points to the next position of the first line */
ptr = buffer + position;
@@ -13634,7 +13634,7 @@ Calibration (struct st_device *dev, SANE_Byte * Regs,
Calib_LoadConfig (dev, &calibcfg, scan.scantype, scancfg->resolution_x,
scancfg->depth);
- bzero (&calibdata->gain_offset, sizeof (struct st_gain_offset)); /*[42b3654] */
+ memset (&calibdata->gain_offset, 0, sizeof (struct st_gain_offset)); /*[42b3654] */
for (a = CL_RED; a <= CL_BLUE; a++)
{
myCalib->WRef[a] = calibcfg.WRef[a];
@@ -13902,7 +13902,7 @@ Constrains_Check (struct st_device *dev, SANE_Int Resolution,
SANE_Int scantype, struct st_coords *mycoords)
{
/*
- Constrains:
+ Constrains:
100 dpi 850 x 1170 | 164 x 327
300 dpi 2550 x 3510
600 dpi 5100 x 7020
@@ -14110,7 +14110,7 @@ Init_Vars (void)
hp_gamma = malloc (sizeof (struct st_gammatables));
if (hp_gamma != NULL)
- bzero (hp_gamma, sizeof (struct st_gammatables));
+ memset (hp_gamma, 0, sizeof (struct st_gammatables));
else
rst = ERROR;
@@ -14118,7 +14118,7 @@ Init_Vars (void)
{
RTS_Debug = malloc (sizeof (struct st_debug_opts));
if (RTS_Debug != NULL)
- bzero (RTS_Debug, sizeof (struct st_debug_opts));
+ memset (RTS_Debug, 0, sizeof (struct st_debug_opts));
else
rst = ERROR;
}
@@ -14127,7 +14127,7 @@ Init_Vars (void)
{
default_gain_offset = malloc (sizeof (struct st_gain_offset));
if (default_gain_offset != NULL)
- bzero (default_gain_offset, sizeof (struct st_gain_offset));
+ memset (default_gain_offset, 0, sizeof (struct st_gain_offset));
else
rst = ERROR;
}
@@ -14136,7 +14136,7 @@ Init_Vars (void)
{
calibdata = malloc (sizeof (struct st_calibration_data));
if (calibdata != NULL)
- bzero (calibdata, sizeof (struct st_calibration_data));
+ memset (calibdata, 0, sizeof (struct st_calibration_data));
else
rst = ERROR;
}
@@ -14145,7 +14145,7 @@ Init_Vars (void)
{
wshading = malloc (sizeof (struct st_shading));
if (wshading != NULL)
- bzero (wshading, sizeof (struct st_shading));
+ memset (wshading, 0, sizeof (struct st_shading));
else
rst = ERROR;
}
@@ -14467,7 +14467,7 @@ WShading_Calibrate (struct st_device *dev, SANE_Byte * Regs,
DBG (DBG_FNC, "> WShading_Calibrate(*myCalib)\n");
- bzero (&myCalibTable, sizeof (struct st_gain_offset));
+ memset (&myCalibTable, 0, sizeof (struct st_gain_offset));
for (C = CL_RED; C <= CL_BLUE; C++)
{
myCalibTable.pag[C] = 3;
@@ -14687,7 +14687,7 @@ motor_pos (struct st_device *dev, SANE_Byte * Regs,
DBG (DBG_FNC, "> Calib_test(*myCalib)\n");
- bzero (&myCalibTable, sizeof (struct st_gain_offset));
+ memset (&myCalibTable, 0, sizeof (struct st_gain_offset));
calibcfg =
(struct st_calibration_config *)
@@ -14821,7 +14821,7 @@ Calib_BlackShading_jkd (struct st_device *dev, SANE_Byte * Regs,
DBG (DBG_FNC, "> Calib_BlackShading_jkd(*myCalib)\n");
- bzero (&myCalibTable, sizeof (struct st_gain_offset));
+ memset (&myCalibTable, 0, sizeof (struct st_gain_offset));
for (C = CL_RED; C <= CL_BLUE; C++)
{
myCalibTable.pag[C] = 3;
@@ -14955,7 +14955,7 @@ Calib_test (struct st_device *dev, SANE_Byte * Regs,
DBG (DBG_FNC, "> Calib_test(*myCalib)\n");
- bzero (&myCalibTable, sizeof (struct st_gain_offset));
+ memset (&myCalibTable, 0, sizeof (struct st_gain_offset));
calibcfg =
(struct st_calibration_config *)