From b7b5ca79c8f7a92d488d96d0b1d0963d01d86423 Mon Sep 17 00:00:00 2001 From: Povilas Kanapickas Date: Wed, 20 Mar 2019 23:09:04 +0200 Subject: [PATCH 1/2] rts8891: Remove uses of unused UNIT_TESTING ifdef --- backend/rts8891.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/backend/rts8891.c b/backend/rts8891.c index 46ef8a0e1..93018abb7 100644 --- a/backend/rts8891.c +++ b/backend/rts8891.c @@ -3694,10 +3694,7 @@ initialize_device (struct Rts8891_Device *dev) } #else /* FAST_INIT */ -#ifndef UNIT_TESTING -static -#endif -SANE_Status +static SANE_Status init_registers (struct Rts8891_Device *dev) { int i; @@ -5449,10 +5446,7 @@ offset_calibration (struct Rts8891_Device *dev, int mode, int light) * We scan a 637 pixels by 66 linesxoffset=24 , xend=661, pixels=637 y offset=1 , yend=67, lines =66 */ -#ifndef UNIT_TESTING -static -#endif -SANE_Status +static SANE_Status setup_shading_calibration (struct Rts8891_Device *dev, int mode, int *light, int *status1, SANE_Byte * regs) { SANE_Status status = SANE_STATUS_GOOD; @@ -6554,10 +6548,7 @@ move_to_scan_area (struct Rts8891_Session *session) /* The windows driver is allways scanning in color, so we do the same. */ /* For now, the only mode that could be done would be 300 dpi gray scan, */ /* based on the register settings of find_origin() */ -#ifndef UNIT_TESTING -static -#endif -SANE_Status +static SANE_Status setup_scan_registers (struct Rts8891_Session *session, SANE_Byte *status1, SANE_Byte *status2, SANE_Byte *regs) { SANE_Status status = SANE_STATUS_GOOD; From d866998f102f242ed421ff4b4480aa2a4073c166 Mon Sep 17 00:00:00 2001 From: Povilas Kanapickas Date: Wed, 20 Mar 2019 23:09:05 +0200 Subject: [PATCH 2/2] genesys: Remove uses of unused UNIT_TESTING ifdef --- backend/genesys.c | 40 +++++----------------- backend/genesys.h | 5 --- backend/genesys_gl124.c | 35 ++++--------------- backend/genesys_gl124.h | 35 ++++--------------- backend/genesys_gl646.c | 20 +++-------- backend/genesys_gl646.h | 25 +++----------- backend/genesys_gl841.c | 45 +++++-------------------- backend/genesys_gl841.h | 74 ----------------------------------------- backend/genesys_gl843.c | 72 +++++++++------------------------------ backend/genesys_gl843.h | 30 ----------------- backend/genesys_gl846.c | 40 +++++----------------- backend/genesys_gl846.h | 40 +++++----------------- backend/genesys_gl847.c | 30 ++++------------- backend/genesys_gl847.h | 31 +++-------------- backend/genesys_low.c | 37 --------------------- backend/genesys_low.h | 71 --------------------------------------- 16 files changed, 83 insertions(+), 547 deletions(-) diff --git a/backend/genesys.c b/backend/genesys.c index 7779fce96..76b08f051 100644 --- a/backend/genesys.c +++ b/backend/genesys.c @@ -917,10 +917,7 @@ sanei_genesys_exposure_time (Genesys_Device * dev, Genesys_Register_Set * reg, The data needs to be of size "size", and in little endian byte order. */ -#ifndef UNIT_TESTING -static -#endif - SANE_Status +static SANE_Status genesys_send_offset_and_shading (Genesys_Device * dev, uint8_t * data, int size) { @@ -1762,10 +1759,7 @@ genesys_coarse_calibration (Genesys_Device * dev) /* Averages image data. average_data and calibration_data are little endian 16 bit words. */ -#ifndef UNIT_TESTING -static -#endif -void +static void genesys_average_data (uint8_t * average_data, uint8_t * calibration_data, uint32_t lines, @@ -2169,10 +2163,7 @@ genesys_white_shading_calibration (Genesys_Device * dev) /* This calibration uses a scan over the calibration target, comprising a * black and a white strip. (So the motor must be on.) */ -#ifndef UNIT_TESTING -static -#endif -SANE_Status +static SANE_Status genesys_dark_white_shading_calibration (Genesys_Device * dev) { SANE_Status status; @@ -2424,10 +2415,7 @@ compute_coefficient (unsigned int coeff, unsigned int target, unsigned int value * @param target_bright value of the white target code * @param target_dark value of the black target code */ -#ifndef UNIT_TESTING -static -#endif -void +static void compute_averaged_planar (Genesys_Device * dev, uint8_t * shading_data, unsigned int pixels_per_line, @@ -2610,10 +2598,7 @@ compute_averaged_planar (Genesys_Device * dev, * @param coeff 4000h or 2000h depending on fast scan mode or not * @param target value of the target code */ -#ifndef UNIT_TESTING -static -#endif -void +static void compute_coefficients (Genesys_Device * dev, uint8_t * shading_data, unsigned int pixels_per_line, @@ -2687,10 +2672,7 @@ compute_coefficients (Genesys_Device * dev, * @param coeff 4000h or 2000h depending on fast scan mode or not * @param target white target value */ -#ifndef UNIT_TESTING -static -#endif -void +static void compute_planar_coefficients (Genesys_Device * dev, uint8_t * shading_data, unsigned int factor, @@ -2759,10 +2741,7 @@ compute_planar_coefficients (Genesys_Device * dev, } } -#ifndef UNIT_TESTING -static -#endif -void +static void compute_shifted_coefficients (Genesys_Device * dev, uint8_t * shading_data, unsigned int pixels_per_line, @@ -6314,10 +6293,7 @@ config_attach_genesys (SANEI_Config __sane_unused__ *config, const char *devname } /* probes for scanner to attach to the backend */ -#ifndef UNIT_TESTING -static -#endif -SANE_Status +static SANE_Status probe_genesys_devices (void) { SANEI_Config config; diff --git a/backend/genesys.h b/backend/genesys.h index eab92bb61..b6d092357 100644 --- a/backend/genesys.h +++ b/backend/genesys.h @@ -157,9 +157,4 @@ typedef struct Genesys_Scanner SANE_Int bpp_list[5]; /**< */ } Genesys_Scanner; -#ifdef UNIT_TESTING -SANE_Status genesys_dark_white_shading_calibration (Genesys_Device * dev); -char *calibration_filename(Genesys_Device *currdev); -void add_device(Genesys_Device *dev); -#endif #endif /* not GENESYS_H */ diff --git a/backend/genesys_gl124.c b/backend/genesys_gl124.c index d5a2e8d8b..effb70944 100644 --- a/backend/genesys_gl124.c +++ b/backend/genesys_gl124.c @@ -1943,19 +1943,13 @@ gl124_set_powersaving (Genesys_Device * dev, int delay /* in minutes */ ) return SANE_STATUS_GOOD; } -#ifndef UNIT_TESTING -static -#endif - SANE_Status +static SANE_Status gl124_start_action (Genesys_Device * dev) { return sanei_genesys_write_register (dev, 0x0f, 0x01); } -#ifndef UNIT_TESTING -static -#endif -SANE_Status +static SANE_Status gl124_stop_action (Genesys_Device * dev) { SANE_Status status; @@ -2101,10 +2095,7 @@ uint8_t val; /* Send the low-level scan command */ /* todo : is this that useful ? */ -#ifndef UNIT_TESTING -static -#endif - SANE_Status +static SANE_Status gl124_begin_scan (Genesys_Device * dev, Genesys_Register_Set * reg, SANE_Bool start_motor) { @@ -2141,10 +2132,7 @@ gl124_begin_scan (Genesys_Device * dev, Genesys_Register_Set * reg, /* Send the stop scan command */ -#ifndef UNIT_TESTING -static -#endif - SANE_Status +static SANE_Status gl124_end_scan (Genesys_Device * dev, Genesys_Register_Set * reg, SANE_Bool check_stop) { @@ -2386,10 +2374,7 @@ gl124_slow_back_home (Genesys_Device * dev, SANE_Bool wait_until_home) * @param steps number of steps to move * @param reverse true is moving backward * */ -#ifndef UNIT_TESTING -static -#endif -SANE_Status +static SANE_Status gl124_feed (Genesys_Device * dev, unsigned int steps, int reverse) { Genesys_Register_Set local_reg[GENESYS_GL124_MAX_REGS]; @@ -2895,10 +2880,7 @@ gl124_init_regs_for_scan (Genesys_Device * dev) * Send shading calibration data. The buffer is considered to always hold values * for all the channels. */ -#ifndef UNIT_TESTING -static -#endif -SANE_Status +static SANE_Status gl124_send_shading_data (Genesys_Device * dev, uint8_t * data, int size) { SANE_Status status = SANE_STATUS_GOOD; @@ -3798,10 +3780,7 @@ gl124_init_memory_layout (Genesys_Device * dev) * initialize backend and ASIC : registers, motor tables, and gamma tables * then ensure scanner's head is at home */ -#ifndef UNIT_TESTING -static -#endif -SANE_Status +static SANE_Status gl124_init (Genesys_Device * dev) { SANE_Status status; diff --git a/backend/genesys_gl124.h b/backend/genesys_gl124.h index 9ca6afd11..1e6f31cc6 100644 --- a/backend/genesys_gl124.h +++ b/backend/genesys_gl124.h @@ -701,40 +701,19 @@ SANE_Status gl124_init_scan_regs (Genesys_Device * dev, int color_filter, unsigned int flags); -#ifndef UNIT_TESTING -static -#endif - SANE_Status gl124_start_action (Genesys_Device * dev); -#ifndef UNIT_TESTING -static -#endif - SANE_Status +static SANE_Status gl124_start_action (Genesys_Device * dev); +static SANE_Status gl124_begin_scan (Genesys_Device * dev, Genesys_Register_Set * reg, SANE_Bool start_motor); -#ifndef UNIT_TESTING -static -#endif - SANE_Status +static SANE_Status gl124_end_scan (Genesys_Device * dev, Genesys_Register_Set * reg, SANE_Bool check_stop); -#ifndef UNIT_TESTING -static -#endif - SANE_Status +static SANE_Status gl124_slow_back_home (Genesys_Device * dev, SANE_Bool wait_until_home); -#ifndef UNIT_TESTING -static -#endif -SANE_Status gl124_init (Genesys_Device * dev); -#ifndef UNIT_TESTING -static -#endif -SANE_Status gl124_send_shading_data (Genesys_Device * dev, uint8_t * data, int size); +static SANE_Status gl124_init (Genesys_Device * dev); +static SANE_Status gl124_send_shading_data (Genesys_Device * dev, uint8_t * data, int size); -#ifndef UNIT_TESTING -static -#endif -SANE_Status gl124_feed (Genesys_Device * dev, unsigned int steps, int reverse); +static SANE_Status gl124_feed (Genesys_Device * dev, unsigned int steps, int reverse); GENESYS_STATIC SANE_Status gl124_stop_action (Genesys_Device * dev); diff --git a/backend/genesys_gl646.c b/backend/genesys_gl646.c index 93d9905bc..11f5b3361 100644 --- a/backend/genesys_gl646.c +++ b/backend/genesys_gl646.c @@ -1978,10 +1978,7 @@ gl646_wm_hp3670 (Genesys_Device * dev, uint8_t set, int dpi) * @param set action to execute * @param dpi dpi to setup the AFE * @return error or SANE_STATUS_GOOD */ -#ifndef UNIT_TESTING -static -#endif - SANE_Status +static SANE_Status gl646_set_fe (Genesys_Device * dev, uint8_t set, int dpi) { SANE_Status status; @@ -2173,10 +2170,7 @@ gl646_set_fe (Genesys_Device * dev, uint8_t set, int dpi) * @param dev device to set * @param set action to execute * @return error or SANE_STATUS_GOOD */ -#ifndef UNIT_TESTING -static -#endif - SANE_Status +static SANE_Status gl646_public_set_fe (Genesys_Device * dev, uint8_t set) { return gl646_set_fe (dev, set, dev->settings.yres); @@ -2344,10 +2338,7 @@ gl646_set_powersaving (Genesys_Device * dev, int delay /* in minutes */ ) * HOMESNR becomes 1 ->document left sensor * paper event -> document is out */ -#ifndef UNIT_TESTING -static -#endif - SANE_Status +static SANE_Status gl646_load_document (Genesys_Device * dev) { SANE_Status status = SANE_STATUS_GOOD; @@ -5197,10 +5188,7 @@ simple_scan (Genesys_Device * dev, Genesys_Settings settings, SANE_Bool move, * @param dev device of the scanner * @param distance distance to move in MM */ -#ifndef UNIT_TESTING -static -#endif - SANE_Status +static SANE_Status simple_move (Genesys_Device * dev, SANE_Int distance) { SANE_Status status; diff --git a/backend/genesys_gl646.h b/backend/genesys_gl646.h index 4c47d0316..2c6070f75 100644 --- a/backend/genesys_gl646.h +++ b/backend/genesys_gl646.h @@ -251,15 +251,9 @@ enum GENESYS_GL646_MAX_REGS }; -#ifndef UNIT_TESTING -static -#endif -SANE_Status gl646_set_fe (Genesys_Device * dev, uint8_t set, int dpi); +static SANE_Status gl646_set_fe (Genesys_Device * dev, uint8_t set, int dpi); -#ifndef UNIT_TESTING -static -#endif -SANE_Status gl646_public_set_fe (Genesys_Device * dev, uint8_t set); +static SANE_Status gl646_public_set_fe (Genesys_Device * dev, uint8_t set); GENESYS_STATIC SANE_Status @@ -317,10 +311,7 @@ gl646_setup_registers (Genesys_Device * dev, * @param dev device of the scanner * @param distance distance to move in MM */ -#ifndef UNIT_TESTING -static -#endif - SANE_Status +static SANE_Status simple_move (Genesys_Device * dev, SANE_Int distance); /** @@ -335,10 +326,7 @@ simple_move (Genesys_Device * dev, SANE_Int distance); * @param shading flag to tell if shading correction should be done * @param data pointer that will point to the scanned data */ -#ifndef UNIT_TESTING -static -#endif -SANE_Status +static SANE_Status simple_scan (Genesys_Device * dev, Genesys_Settings settings, SANE_Bool move, SANE_Bool forward, SANE_Bool shading, unsigned char **data); @@ -359,10 +347,7 @@ static SANE_Status write_control (Genesys_Device * dev, int resolution); */ static void gl646_init_regs (Genesys_Device * dev); -#ifndef UNIT_TESTING -static -#endif -SANE_Status gl646_load_document (Genesys_Device * dev); +static SANE_Status gl646_load_document (Genesys_Device * dev); static SANE_Status gl646_detect_document_end (Genesys_Device * dev); diff --git a/backend/genesys_gl841.c b/backend/genesys_gl841.c index e067555ea..45f7d7f3d 100644 --- a/backend/genesys_gl841.c +++ b/backend/genesys_gl841.c @@ -1688,10 +1688,7 @@ uint8_t *table; } -#ifndef UNIT_TESTING -static -#endif -SANE_Status +static SANE_Status gl841_init_motor_regs(Genesys_Device * dev, Genesys_Register_Set * reg, unsigned int feed_steps,/*1/base_ydpi*/ @@ -1856,10 +1853,7 @@ HOME_FREE: 3 return SANE_STATUS_GOOD; } -#ifndef UNIT_TESTING -static -#endif -SANE_Status +static SANE_Status gl841_init_motor_regs_scan(Genesys_Device * dev, Genesys_Register_Set * reg, unsigned int scan_exposure_time,/*pixel*/ @@ -3431,19 +3425,13 @@ gl841_set_powersaving (Genesys_Device * dev, return status; } -#ifndef UNIT_TESTING -static -#endif -SANE_Status +static SANE_Status gl841_start_action (Genesys_Device * dev) { return sanei_genesys_write_register (dev, 0x0f, 0x01); } -#ifndef UNIT_TESTING -static -#endif -SANE_Status +static SANE_Status gl841_stop_action (Genesys_Device * dev) { Genesys_Register_Set local_reg[GENESYS_GL841_MAX_REGS+1]; @@ -3821,10 +3809,7 @@ gl841_detect_document_end (Genesys_Device * dev) /* Send the low-level scan command */ /* todo : is this that useful ? */ -#ifndef UNIT_TESTING -static -#endif -SANE_Status +static SANE_Status gl841_begin_scan (Genesys_Device * dev, Genesys_Register_Set * reg, SANE_Bool start_motor) { @@ -3881,10 +3866,7 @@ gl841_begin_scan (Genesys_Device * dev, Genesys_Register_Set * reg, /* Send the stop scan command */ -#ifndef UNIT_TESTING -static -#endif -SANE_Status +static SANE_Status gl841_end_scan (Genesys_Device * dev, Genesys_Register_Set __sane_unused__ * reg, SANE_Bool check_stop) { @@ -3914,10 +3896,7 @@ gl841_end_scan (Genesys_Device * dev, Genesys_Register_Set __sane_unused__ * reg } /* Moves the slider to steps */ -#ifndef UNIT_TESTING -static -#endif -SANE_Status +static SANE_Status gl841_feed (Genesys_Device * dev, int steps) { Genesys_Register_Set local_reg[GENESYS_GL841_MAX_REGS+1]; @@ -3993,10 +3972,7 @@ gl841_feed (Genesys_Device * dev, int steps) } /* Moves the slider to the home (top) position slowly */ -#ifndef UNIT_TESTING -static -#endif -SANE_Status +static SANE_Status gl841_slow_back_home (Genesys_Device * dev, SANE_Bool wait_until_home) { Genesys_Register_Set local_reg[GENESYS_GL841_MAX_REGS+1]; @@ -5606,10 +5582,7 @@ gl841_init_regs_for_warmup (Genesys_Device * dev, * so that the head goes to park position. * as a by-product, also check for lock */ -#ifndef UNIT_TESTING -static -#endif -SANE_Status +static SANE_Status sanei_gl841_repark_head (Genesys_Device * dev) { SANE_Status status; diff --git a/backend/genesys_gl841.h b/backend/genesys_gl841.h index d1bd07e67..483c9ae6b 100644 --- a/backend/genesys_gl841.h +++ b/backend/genesys_gl841.h @@ -372,80 +372,6 @@ enum /** * prototypes declaration in case of unit testing */ -#ifdef UNIT_TESTING -SANE_Status -gl841_init_scan_regs (Genesys_Device * dev, - Genesys_Register_Set * reg, - float xres, - float yres, - float startx, - float starty, - float pixels, - float lines, - unsigned int depth, - unsigned int channels, - int color_filter, - unsigned int flags); - -SANE_Status -gl841_begin_scan (Genesys_Device * dev, - Genesys_Register_Set * reg, - SANE_Bool start_motor); - -SANE_Status -gl841_end_scan (Genesys_Device * dev, - Genesys_Register_Set __sane_unused__ * reg, - SANE_Bool check_stop); - -SANE_Status -gl841_slow_back_home (Genesys_Device * dev, SANE_Bool wait_until_home); - -SANE_Status -sanei_gl841_repark_head (Genesys_Device * dev); - -SANE_Status -gl841_feed (Genesys_Device * dev, int steps); - -SANE_Status -gl841_init_motor_regs_scan(Genesys_Device * dev, - Genesys_Register_Set * reg, - unsigned int scan_exposure_time, - float scan_yres, - int scan_step_type, - unsigned int scan_lines, - unsigned int scan_dummy, - unsigned int feed_steps, - int scan_power_mode, - unsigned int flags) ; - -SANE_Status -gl841_stop_action (Genesys_Device * dev); - -SANE_Status -gl841_start_action (Genesys_Device * dev); - -SANE_Status -gl841_init_motor_regs(Genesys_Device * dev, - Genesys_Register_Set * reg, - unsigned int feed_steps, - unsigned int action, - unsigned int flags); - -SANE_Status gl841_send_slope_table (Genesys_Device * dev, int table_nr, uint16_t * slope_table, int steps); - -SANE_Status gl841_bulk_write_data_gamma (Genesys_Device * dev, uint8_t addr, uint8_t * data, size_t len); - -SANE_Status gl841_offset_calibration (Genesys_Device * dev); - -SANE_Status gl841_coarse_gain_calibration (Genesys_Device * dev, int dpi); - -SANE_Status gl841_led_calibration (Genesys_Device * dev); - -SANE_Status gl841_send_shading_data (Genesys_Device * dev, uint8_t * data, int size); - -int gl841_scan_step_type(Genesys_Device *dev, int yres); -SANE_Status gl841_write_freq(Genesys_Device *dev, unsigned int ydpi); -#endif GENESYS_STATIC int gl841_exposure_time(Genesys_Device *dev, diff --git a/backend/genesys_gl843.c b/backend/genesys_gl843.c index b47fb7eeb..489e7c0e0 100644 --- a/backend/genesys_gl843.c +++ b/backend/genesys_gl843.c @@ -778,10 +778,7 @@ gl843_init_registers (Genesys_Device * dev) /* Send slope table for motor movement slope_table in machine byte order */ -#ifndef UNIT_TESTING -static -#endif - SANE_Status +static SANE_Status gl843_send_slope_table (Genesys_Device * dev, int table_nr, uint16_t * slope_table, int steps) { @@ -1383,10 +1380,7 @@ gl843_init_optical_regs_scan (Genesys_Device * dev, * * this function sets up the scanner to scan in normal or single line mode */ -#ifndef UNIT_TESTING -static -#endif - SANE_Status +static SANE_Status gl843_init_scan_regs (Genesys_Device * dev, Genesys_Register_Set * reg, float xres, /*dpi */ @@ -1928,10 +1922,7 @@ gl843_set_powersaving (Genesys_Device * dev, int delay /* in minutes */ ) return status; } -#ifndef UNIT_TESTING -static -#endif - SANE_Status +static SANE_Status gl843_start_action (Genesys_Device * dev) { return sanei_genesys_write_register (dev, 0x0f, 0x01); @@ -2201,10 +2192,7 @@ gl843_detect_document_end (Genesys_Device * dev) * toggle gpios to switch disble XPA slider motor * @param dev device to set up */ -#ifndef UNIT_TESTING -static -#endif -SANE_Status gl843_xpa_motor_off(Genesys_Device *dev) +static SANE_Status gl843_xpa_motor_off(Genesys_Device *dev) { uint8_t val; SANE_Status status=SANE_STATUS_GOOD; @@ -2233,10 +2221,7 @@ SANE_Status gl843_xpa_motor_off(Genesys_Device *dev) * toggle gpios to switch enable XPA slider motor * @param dev device to set up */ -#ifndef UNIT_TESTING -static -#endif -SANE_Status gl843_xpa_motor_on(Genesys_Device *dev) +static SANE_Status gl843_xpa_motor_on(Genesys_Device *dev) { uint8_t val; SANE_Status status=SANE_STATUS_GOOD; @@ -2275,10 +2260,7 @@ SANE_Status gl843_xpa_motor_on(Genesys_Device *dev) * XPA light * @param dev device to set up */ -#ifndef UNIT_TESTING -static -#endif -SANE_Status gl843_xpa_lamp_on(Genesys_Device *dev) +static SANE_Status gl843_xpa_lamp_on(Genesys_Device *dev) { uint8_t val; SANE_Status status=SANE_STATUS_GOOD; @@ -2307,10 +2289,7 @@ SANE_Status gl843_xpa_lamp_on(Genesys_Device *dev) } /* Send the low-level scan command */ -#ifndef UNIT_TESTING -static -#endif -SANE_Status +static SANE_Status gl843_begin_scan (Genesys_Device * dev, Genesys_Register_Set * reg, SANE_Bool start_motor) { @@ -2397,10 +2376,7 @@ gl843_begin_scan (Genesys_Device * dev, Genesys_Register_Set * reg, /* Send the stop scan command */ -#ifndef UNIT_TESTING -static -#endif - SANE_Status +static SANE_Status gl843_end_scan (Genesys_Device * dev, Genesys_Register_Set * reg, SANE_Bool check_stop) { @@ -2531,10 +2507,7 @@ static SANE_Status gl843_park_xpa_lamp (Genesys_Device * dev) /** @brief Moves the slider to the home (top) position slowly * */ -#ifndef UNIT_TESTING -static -#endif - SANE_Status +static SANE_Status gl843_slow_back_home (Genesys_Device * dev, SANE_Bool wait_until_home) { Genesys_Register_Set local_reg[GENESYS_GL843_MAX_REGS]; @@ -2869,10 +2842,7 @@ gl843_init_regs_for_coarse_calibration (Genesys_Device * dev) * @param dev device to work on * @param steps number of steps to move * */ -#ifndef UNIT_TESTING -static -#endif -SANE_Status +static SANE_Status gl843_feed (Genesys_Device * dev, unsigned int steps) { Genesys_Register_Set local_reg[GENESYS_GL843_MAX_REGS]; @@ -3842,10 +3812,7 @@ gl843_init_gpio (Genesys_Device * dev) /* * * initialize ASIC from power on condition */ -#ifndef UNIT_TESTING -static -#endif -SANE_Status +static SANE_Status gl843_boot (Genesys_Device * dev, SANE_Bool cold) { SANE_Status status; @@ -3926,10 +3893,7 @@ gl843_boot (Genesys_Device * dev, SANE_Bool cold) * initialize backend and ASIC : registers, motor tables, and gamma tables * then ensure scanner's head is at home */ -#ifndef UNIT_TESTING -static -#endif -SANE_Status +static SANE_Status gl843_init (Genesys_Device * dev) { SANE_Status status; @@ -3978,14 +3942,13 @@ gl843_update_hardware_sensors (Genesys_Scanner * s) return status; } -#ifndef UNIT_TESTING -static -#endif + /** @brief move sensor to transparency adaptor * Move sensor to the calibration of the transparency adapator (XPA). * @param dev device to use */ -SANE_Status gl843_move_to_ta (Genesys_Device * dev) +static SANE_Status +gl843_move_to_ta (Genesys_Device * dev) { SANE_Status status = SANE_STATUS_GOOD; float resolution; @@ -4309,10 +4272,7 @@ gl843_search_strip (Genesys_Device * dev, SANE_Bool forward, SANE_Bool black) * Send shading calibration data. The buffer is considered to always hold values * for all the channels. */ -#ifndef UNIT_TESTING -static -#endif -SANE_Status +static SANE_Status gl843_send_shading_data (Genesys_Device * dev, uint8_t * data, int size) { SANE_Status status; diff --git a/backend/genesys_gl843.h b/backend/genesys_gl843.h index 4be46cc44..cbd760ab1 100644 --- a/backend/genesys_gl843.h +++ b/backend/genesys_gl843.h @@ -43,36 +43,6 @@ #include "genesys.h" -#ifdef UNIT_TESTING -SANE_Status gl843_send_slope_table (Genesys_Device * dev, int table_nr, uint16_t * slope_table, int steps); -SANE_Status gl843_init_scan_regs (Genesys_Device * dev, - Genesys_Register_Set * reg, - float xres, /*dpi */ - float yres, /*dpi */ - float startx, /*optical_res, from dummy_pixel+1 */ - float starty, /*base_ydpi, from home! */ - float pixels, - float lines, - unsigned int depth, - unsigned int channels, - int scan_mode, - int color_filter, - unsigned int flags); -SANE_Status gl843_start_action (Genesys_Device * dev); -SANE_Status gl843_begin_scan (Genesys_Device * dev, Genesys_Register_Set * reg, SANE_Bool start_motor); -SANE_Status gl843_end_scan (Genesys_Device * dev, Genesys_Register_Set * reg, SANE_Bool check_stop); -SANE_Status gl843_slow_back_home (Genesys_Device * dev, SANE_Bool wait_until_home); -SANE_Status gl843_feed (Genesys_Device * dev, unsigned int steps); -SANE_Status gl843_init (Genesys_Device * dev); -SANE_Status gl843_boot (Genesys_Device * dev, SANE_Bool cold); -SANE_Status gl843_send_shading_data (Genesys_Device * dev, uint8_t * data, int size); -SANE_Status gl843_bulk_write_register (Genesys_Device * dev, Genesys_Register_Set * reg, size_t elems); -SANE_Status gl843_xpa_lamp_on (Genesys_Device * dev); -SANE_Status gl843_xpa_motor_on (Genesys_Device * dev); -SANE_Status gl843_xpa_motor_off (Genesys_Device * dev); -SANE_Status gl843_move_to_ta (Genesys_Device * dev); -#endif - #define DBGSTART DBG (DBG_proc, "%s start\n", __func__); #define DBGCOMPLETED DBG (DBG_proc, "%s completed\n", __func__); diff --git a/backend/genesys_gl846.c b/backend/genesys_gl846.c index 8d1c34d49..213f27f96 100644 --- a/backend/genesys_gl846.c +++ b/backend/genesys_gl846.c @@ -1257,10 +1257,7 @@ gl846_init_optical_regs_scan (Genesys_Device * dev, * * this function sets up the scanner to scan in normal or single line mode */ -#ifndef UNIT_TESTING -static -#endif - SANE_Status +static SANE_Status gl846_init_scan_regs (Genesys_Device * dev, Genesys_Register_Set * reg, float xres, /*dpi */ @@ -1737,10 +1734,7 @@ gl846_start_action (Genesys_Device * dev) return sanei_genesys_write_register (dev, 0x0f, 0x01); } -#ifndef UNIT_TESTING -static -#endif -SANE_Status +static SANE_Status gl846_stop_action (Genesys_Device * dev) { SANE_Status status; @@ -1824,10 +1818,7 @@ gl846_stop_action (Genesys_Device * dev) } /* Send the low-level scan command */ -#ifndef UNIT_TESTING -static -#endif - SANE_Status +static SANE_Status gl846_begin_scan (Genesys_Device * dev, Genesys_Register_Set * reg, SANE_Bool start_motor) { @@ -1870,10 +1861,7 @@ gl846_begin_scan (Genesys_Device * dev, Genesys_Register_Set * reg, /* Send the stop scan command */ -#ifndef UNIT_TESTING -static -#endif - SANE_Status +static SANE_Status gl846_end_scan (Genesys_Device * dev, Genesys_Register_Set * reg, SANE_Bool check_stop) { @@ -1904,10 +1892,7 @@ gl846_end_scan (Genesys_Device * dev, Genesys_Register_Set * reg, } /* Moves the slider to the home (top) postion slowly */ -#ifndef UNIT_TESTING -static -#endif -SANE_Status +static SANE_Status gl846_slow_back_home (Genesys_Device * dev, SANE_Bool wait_until_home) { Genesys_Register_Set local_reg[GENESYS_GL846_MAX_REGS]; @@ -2244,10 +2229,7 @@ gl846_init_regs_for_coarse_calibration (Genesys_Device * dev) * @param dev device to work on * @param steps number of steps to move in base_dpi line count * */ -#ifndef UNIT_TESTING -static -#endif -SANE_Status +static SANE_Status gl846_feed (Genesys_Device * dev, unsigned int steps) { Genesys_Register_Set local_reg[GENESYS_GL846_MAX_REGS]; @@ -2882,10 +2864,7 @@ gl846_init_memory_layout (Genesys_Device * dev) /* * * initialize ASIC from power on condition */ -#ifndef UNIT_TESTING -static -#endif -SANE_Status +static SANE_Status gl846_boot (Genesys_Device * dev, SANE_Bool cold) { SANE_Status status; @@ -2958,10 +2937,7 @@ gl846_boot (Genesys_Device * dev, SANE_Bool cold) * initialize backend and ASIC : registers, motor tables, and gamma tables * then ensure scanner's head is at home */ -#ifndef UNIT_TESTING -static -#endif -SANE_Status gl846_init (Genesys_Device * dev) +static SANE_Status gl846_init (Genesys_Device * dev) { SANE_Status status; diff --git a/backend/genesys_gl846.h b/backend/genesys_gl846.h index e1dc711cc..ea076df5d 100644 --- a/backend/genesys_gl846.h +++ b/backend/genesys_gl846.h @@ -509,10 +509,7 @@ enum * * this function sets up the scanner to scan in normal or single line mode */ -#ifndef UNIT_TESTING -static -#endif -SANE_Status gl846_init_scan_regs (Genesys_Device * dev, +static SANE_Status gl846_init_scan_regs (Genesys_Device * dev, Genesys_Register_Set * reg, float xres, /*dpi */ float yres, /*dpi */ @@ -526,48 +523,27 @@ SANE_Status gl846_init_scan_regs (Genesys_Device * dev, unsigned int flags); /* Send the low-level scan command */ -#ifndef UNIT_TESTING -static -#endif -SANE_Status gl846_begin_scan (Genesys_Device * dev, Genesys_Register_Set * reg, SANE_Bool start_motor); +static SANE_Status gl846_begin_scan (Genesys_Device * dev, Genesys_Register_Set * reg, SANE_Bool start_motor); /* Send the stop scan command */ -#ifndef UNIT_TESTING -static -#endif -SANE_Status gl846_end_scan (Genesys_Device * dev, Genesys_Register_Set * reg, SANE_Bool check_stop); +static SANE_Status gl846_end_scan (Genesys_Device * dev, Genesys_Register_Set * reg, SANE_Bool check_stop); -#ifndef UNIT_TESTING -static -#endif -SANE_Status gl846_init (Genesys_Device * dev); +static SANE_Status gl846_init (Genesys_Device * dev); /** @brief moves the slider to steps at motor base dpi * @param dev device to work on * @param steps number of steps to move * */ -#ifndef UNIT_TESTING -static -#endif -SANE_Status +static SANE_Status gl846_feed (Genesys_Device * dev, unsigned int steps); -#ifndef UNIT_TESTING -static -#endif -SANE_Status +static SANE_Status gl846_stop_action (Genesys_Device * dev); -#ifndef UNIT_TESTING -static -#endif -SANE_Status +static SANE_Status gl846_slow_back_home (Genesys_Device * dev, SANE_Bool wait_until_home); -#ifndef UNIT_TESTING -static -#endif -SANE_Status +static SANE_Status gl846_boot (Genesys_Device * dev, SANE_Bool cold); diff --git a/backend/genesys_gl847.c b/backend/genesys_gl847.c index 378c12955..82ff6b498 100644 --- a/backend/genesys_gl847.c +++ b/backend/genesys_gl847.c @@ -1281,10 +1281,7 @@ gl847_init_optical_regs_scan (Genesys_Device * dev, * * this function sets up the scanner to scan in normal or single line mode */ -#ifndef UNIT_TESTING -static -#endif - SANE_Status +static SANE_Status gl847_init_scan_regs (Genesys_Device * dev, Genesys_Register_Set * reg, float xres, /*dpi */ @@ -1761,10 +1758,7 @@ gl847_start_action (Genesys_Device * dev) return sanei_genesys_write_register (dev, 0x0f, 0x01); } -#ifndef UNIT_TESTING -static -#endif -SANE_Status +static SANE_Status gl847_stop_action (Genesys_Device * dev) { SANE_Status status; @@ -1848,10 +1842,7 @@ gl847_stop_action (Genesys_Device * dev) } /* Send the low-level scan command */ -#ifndef UNIT_TESTING -static -#endif - SANE_Status +static SANE_Status gl847_begin_scan (Genesys_Device * dev, Genesys_Register_Set * reg, SANE_Bool start_motor) { @@ -1896,10 +1887,7 @@ gl847_begin_scan (Genesys_Device * dev, Genesys_Register_Set * reg, /* Send the stop scan command */ -#ifndef UNIT_TESTING -static -#endif - SANE_Status +static SANE_Status gl847_end_scan (Genesys_Device * dev, Genesys_Register_Set * reg, SANE_Bool check_stop) { @@ -2308,10 +2296,7 @@ gl847_init_regs_for_coarse_calibration (Genesys_Device * dev) * @param dev device to work on * @param steps number of steps to move in base_dpi line count * */ -#ifndef UNIT_TESTING -static -#endif -SANE_Status +static SANE_Status gl847_feed (Genesys_Device * dev, unsigned int steps) { Genesys_Register_Set local_reg[GENESYS_GL847_MAX_REGS]; @@ -3054,10 +3039,7 @@ gl847_boot (Genesys_Device * dev, SANE_Bool cold) * initialize backend and ASIC : registers, motor tables, and gamma tables * then ensure scanner's head is at home */ -#ifndef UNIT_TESTING -static -#endif -SANE_Status gl847_init (Genesys_Device * dev) +static SANE_Status gl847_init (Genesys_Device * dev) { SANE_Status status; diff --git a/backend/genesys_gl847.h b/backend/genesys_gl847.h index 1da2065f7..7282eea3e 100644 --- a/backend/genesys_gl847.h +++ b/backend/genesys_gl847.h @@ -43,12 +43,6 @@ #include "genesys.h" - -#ifdef UNIT_TESTING -SANE_Status gl847_stop_action (Genesys_Device * dev); -SANE_Status gl847_slow_back_home (Genesys_Device * dev, SANE_Bool wait_until_home); -#endif - #define REG01 0x01 #define REG01_CISSET 0x80 #define REG01_DOGENB 0x40 @@ -480,10 +474,7 @@ enum * * this function sets up the scanner to scan in normal or single line mode */ -#ifndef UNIT_TESTING -static -#endif -SANE_Status gl847_init_scan_regs (Genesys_Device * dev, +static SANE_Status gl847_init_scan_regs (Genesys_Device * dev, Genesys_Register_Set * reg, float xres, /*dpi */ float yres, /*dpi */ @@ -497,30 +488,18 @@ SANE_Status gl847_init_scan_regs (Genesys_Device * dev, unsigned int flags); /* Send the low-level scan command */ -#ifndef UNIT_TESTING -static -#endif -SANE_Status gl847_begin_scan (Genesys_Device * dev, Genesys_Register_Set * reg, SANE_Bool start_motor); +static SANE_Status gl847_begin_scan (Genesys_Device * dev, Genesys_Register_Set * reg, SANE_Bool start_motor); /* Send the stop scan command */ -#ifndef UNIT_TESTING -static -#endif -SANE_Status gl847_end_scan (Genesys_Device * dev, Genesys_Register_Set * reg, SANE_Bool check_stop); +static SANE_Status gl847_end_scan (Genesys_Device * dev, Genesys_Register_Set * reg, SANE_Bool check_stop); -#ifndef UNIT_TESTING -static -#endif -SANE_Status gl847_init (Genesys_Device * dev); +static SANE_Status gl847_init (Genesys_Device * dev); /** @brief moves the slider to steps at motor base dpi * @param dev device to work on * @param steps number of steps to move * */ -#ifndef UNIT_TESTING -static -#endif -SANE_Status +static SANE_Status gl847_feed (Genesys_Device * dev, unsigned int steps); typedef struct diff --git a/backend/genesys_low.c b/backend/genesys_low.c index a97bf893f..c94fcf40c 100644 --- a/backend/genesys_low.c +++ b/backend/genesys_low.c @@ -295,13 +295,6 @@ sanei_genesys_write_register (Genesys_Device * dev, uint16_t reg, uint8_t val) SANE_Status status; SANE_Byte reg8; -#ifdef UNIT_TESTING - if(dev->usb_mode<0) - { - return SANE_STATUS_GOOD; - } -#endif - /* 16 bit register address space */ if(reg>255) { @@ -359,13 +352,6 @@ sanei_genesys_write_0x8c (Genesys_Device * dev, uint8_t index, uint8_t val) { SANE_Status status; -#ifdef UNIT_TESTING - if(dev->usb_mode<0) - { - return SANE_STATUS_GOOD; - } -#endif - DBG (DBG_io, "sanei_genesys_write_0x8c: 0x%02x,0x%02x\n", index, val); status = @@ -417,14 +403,6 @@ sanei_genesys_read_register (Genesys_Device * dev, uint16_t reg, uint8_t * val) SANE_Status status; SANE_Byte reg8; -#ifdef UNIT_TESTING - if(dev->usb_mode<0) - { - *val=0; - return SANE_STATUS_GOOD; - } -#endif - /* 16 bit register address space */ if(reg>255) { @@ -572,13 +550,6 @@ sanei_genesys_fe_write_data (Genesys_Device * dev, uint8_t addr, SANE_Status status; Genesys_Register_Set reg[3]; -#ifdef UNIT_TESTING - if(dev->usb_mode<0) - { - return SANE_STATUS_GOOD; - } -#endif - DBG (DBG_io, "sanei_genesys_fe_write_data (0x%02x, 0x%04x)\n", addr, data); reg[0].address = 0x51; @@ -616,14 +587,6 @@ sanei_genesys_fe_write_data (Genesys_Device * dev, uint8_t addr, SANE_Status sanei_genesys_get_status (Genesys_Device * dev, uint8_t * status) { -#ifdef UNIT_TESTING - if(dev->usb_mode<0) - { - *status=0; - return SANE_STATUS_GOOD; - } -#endif - if(dev->model->asic_type==GENESYS_GL124) return sanei_genesys_read_hregister(dev, 0x101, status); return sanei_genesys_read_register (dev, 0x41, status); diff --git a/backend/genesys_low.h b/backend/genesys_low.h index 603849c10..135653177 100644 --- a/backend/genesys_low.h +++ b/backend/genesys_low.h @@ -81,11 +81,7 @@ #include "../include/_stdint.h" -#ifndef UNIT_TESTING #define GENESYS_STATIC static -#else -#define GENESYS_STATIC -#endif #define DBG_error0 0 /* errors/warnings printed even with devuglevel 0 */ #define DBG_error 1 /* fatal errors */ @@ -1165,73 +1161,6 @@ sanei_genesys_generate_gamma_buffer(Genesys_Device * dev, int size, uint8_t *gamma); -#ifdef UNIT_TESTING -SANE_Status -genesys_send_offset_and_shading (Genesys_Device * dev, - uint8_t * data, - int size); - -void -genesys_average_data (uint8_t * average_data, - uint8_t * calibration_data, - uint32_t lines, - uint32_t pixel_components_per_line); - -void -compute_averaged_planar (Genesys_Device * dev, - uint8_t * shading_data, - unsigned int pixels_per_line, - unsigned int words_per_color, - unsigned int channels, - unsigned int o, - unsigned int coeff, - unsigned int target_bright, - unsigned int target_dark); - - -void -compute_coefficients (Genesys_Device * dev, - uint8_t * shading_data, - unsigned int pixels_per_line, - unsigned int channels, - unsigned int cmat[3], - int offset, - unsigned int coeff, - unsigned int target); - -void -compute_planar_coefficients (Genesys_Device * dev, - uint8_t * shading_data, - unsigned int factor, - unsigned int pixels_per_line, - unsigned int words_per_color, - unsigned int channels, - unsigned int cmat[3], - unsigned int offset, - unsigned int coeff, - unsigned int target); - -void -compute_shifted_coefficients (Genesys_Device * dev, - uint8_t * shading_data, - unsigned int pixels_per_line, - unsigned int channels, - unsigned int cmat[3], - int offset, - unsigned int coeff, - unsigned int target_dark, - unsigned int target_bright, - unsigned int patch_size); /* contigous extent */ - -SANE_Status -probe_genesys_devices (void); - -SANE_Status genesys_flatbed_calibration (Genesys_Device *dev); - -SANE_Status genesys_send_shading_coefficient (Genesys_Device *dev); -#endif - - /*---------------------------------------------------------------------------*/ /* ASIC specific functions declarations */ /*---------------------------------------------------------------------------*/