summaryrefslogtreecommitdiff
path: root/backend/genesys_low.h
diff options
context:
space:
mode:
Diffstat (limited to 'backend/genesys_low.h')
-rw-r--r--backend/genesys_low.h98
1 files changed, 67 insertions, 31 deletions
diff --git a/backend/genesys_low.h b/backend/genesys_low.h
index 1d5ef22..b5a0a8f 100644
--- a/backend/genesys_low.h
+++ b/backend/genesys_low.h
@@ -8,44 +8,44 @@
Copyright (C) 2006 Laurent Charpentier <laurent_pubs@yahoo.com>
Parts of the structs have been taken from the gt68xx backend by
Sergey Vlasov <vsu@altlinux.ru> et al.
-
+
This file is part of the SANE package.
-
+
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
-
+
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
-
+
As a special exception, the authors of SANE give permission for
additional uses of the libraries contained in this release of SANE.
-
+
The exception is that, if you link a SANE library with other files
to produce an executable, this does not by itself cause the
resulting executable to be covered by the GNU General Public
License. Your use of that executable is in no way restricted on
account of linking the SANE library code into it.
-
+
This exception does not, however, invalidate any other reasons why
the executable file might be covered by the GNU General Public
License.
-
+
If you submit changes to SANE to the maintainers to be included in
a subsequent release, you agree by submitting the changes that
those changes may be distributed with this exception intact.
-
+
If you write modifications of your own for SANE, it is your choice
whether to permit this exception to apply to your modifications.
- If you do not wish that, delete this exception notice.
+ If you do not wish that, delete this exception notice.
*/
#ifndef GENESYS_LOW_H
@@ -67,7 +67,7 @@
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
-#ifdef HAVE_MKDIR
+#ifdef HAVE_MKDIR
#include <sys/stat.h>
#include <sys/types.h>
#endif
@@ -81,6 +81,12 @@
#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 */
#define DBG_init 2 /* initialization and scanning time messages */
@@ -140,11 +146,11 @@
#define GENESYS_FLAG_SKIP_WARMUP (1 << 4) /**< skip genesys_warmup() */
/** @brief offset calibration flag
* signals that the scanner does offset calibration. In this case off_calibration() and
- * coarse_gain_calibration() functions must be implemented
+ * coarse_gain_calibration() functions must be implemented
*/
#define GENESYS_FLAG_OFFSET_CALIBRATION (1 << 5)
#define GENESYS_FLAG_SEARCH_START (1 << 6) /**< do start search before scanning */
-#define GENESYS_FLAG_REPARK (1 << 7) /**< repark head (and check for lock) by
+#define GENESYS_FLAG_REPARK (1 << 7) /**< repark head (and check for lock) by
moving without scanning */
#define GENESYS_FLAG_DARK_CALIBRATION (1 << 8) /**< do dark calibration */
#define GENESYS_FLAG_STAGGERED_LINE (1 << 9) /**< pixel columns are shifted vertically for hi-res modes */
@@ -286,8 +292,8 @@ typedef struct
SANE_Int maximum_speed; /* maximum speed allowed. Unit: pixeltime/step */
SANE_Int minimum_steps; /* number of steps used for default curve */
float g; /* power for non-linear acceleration curves. */
-/* vs*(1-i^g)+ve*(i^g) where
- vs = start speed, ve = end speed,
+/* vs*(1-i^g)+ve*(i^g) where
+ vs = start speed, ve = end speed,
i = 0.0 for first entry and i = 1.0 for last entry in default table*/
} Genesys_Motor_Slope;
@@ -310,7 +316,6 @@ typedef enum Genesys_Color_Order
Genesys_Color_Order;
-#define MAX_SCANNERS 50
#define MAX_RESOLUTIONS 13
#define MAX_DPI 4
@@ -346,6 +351,7 @@ Genesys_Color_Order;
#define DAC_CS8400F 17
#define DAC_IMG101 18
#define DAC_PLUSTEK3800 19
+#define DAC_CANONLIDE80 20
#define CCD_UMAX 0
#define CCD_ST12 1 /* SONY ILX548: 5340 Pixel ??? */
@@ -375,6 +381,9 @@ Genesys_Color_Order;
#define CCD_IMG101 25
#define CCD_PLUSTEK3800 26
#define CIS_CANONLIDE210 27
+#define CIS_CANONLIDE80 28
+#define CIS_CANONLIDE220 29
+#define CIS_CANONLIDE120 30
#define GPO_UMAX 0
#define GPO_ST12 1
@@ -400,6 +409,7 @@ Genesys_Color_Order;
#define GPO_CS8400F 21
#define GPO_IMG101 22
#define GPO_PLUSTEK3800 23
+#define GPO_CANONLIDE80 24
#define MOTOR_UMAX 0
#define MOTOR_5345 1
@@ -424,6 +434,7 @@ Genesys_Color_Order;
#define MOTOR_IMG101 21
#define MOTOR_PLUSTEK3800 22
#define MOTOR_CANONLIDE210 23
+#define MOTOR_CANONLIDE80 24
/* Forward typedefs */
@@ -474,8 +485,8 @@ typedef struct Genesys_Command_Set
SANE_Status (*save_power) (Genesys_Device * dev, SANE_Bool enable);
void (*set_motor_power) (Genesys_Register_Set * regs, SANE_Bool set);
- void (*set_lamp_power) (Genesys_Device * dev,
- Genesys_Register_Set * regs,
+ void (*set_lamp_power) (Genesys_Device * dev,
+ Genesys_Register_Set * regs,
SANE_Bool set);
SANE_Status (*begin_scan) (Genesys_Device * dev,
@@ -499,9 +510,9 @@ typedef struct Genesys_Command_Set
SANE_Bool wait_until_home);
SANE_Status (*bulk_write_register) (Genesys_Device * dev,
- Genesys_Register_Set * reg,
+ Genesys_Register_Set * reg,
size_t elems);
- SANE_Status (*bulk_write_data) (Genesys_Device * dev, uint8_t addr,
+ SANE_Status (*bulk_write_data) (Genesys_Device * dev, uint8_t addr,
uint8_t * data, size_t len);
SANE_Status (*bulk_read_data) (Genesys_Device * dev, uint8_t addr,
@@ -511,7 +522,7 @@ typedef struct Genesys_Command_Set
If possible, just get information for given option.
The sensor state in Genesys_Scanner.val[] should be merged with the
new sensor state, using the information that was last read by the frontend
- in Genesys_Scanner.last_val[], in such a way that a button up/down
+ in Genesys_Scanner.last_val[], in such a way that a button up/down
relative to Genesys_Scanner.last_val[] is not lost.
*/
SANE_Status (*update_hardware_sensors) (struct Genesys_Scanner * s);
@@ -532,7 +543,7 @@ typedef struct Genesys_Command_Set
*/
SANE_Status (*eject_document) (Genesys_Device * dev);
/**
- * search for an black or white area in forward or reverse
+ * search for an black or white area in forward or reverse
* direction */
SANE_Status (*search_strip) (Genesys_Device * dev, SANE_Bool forward, SANE_Bool black);
@@ -562,6 +573,24 @@ typedef struct Genesys_Command_Set
*/
SANE_Status (*asic_boot) (Genesys_Device * dev, SANE_Bool cold);
+ /**
+ * Scan register setting interface
+ */
+ SANE_Status (*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 scan_method,
+ int scan_mode,
+ int color_filter,
+ unsigned int flags);
+
} Genesys_Command_Set;
/** @brief structure to describe a scanner model
@@ -583,7 +612,7 @@ typedef struct Genesys_Model
SANE_Int bpp_color_values[MAX_DPI]; /* possible depths in color mode */
SANE_Fixed x_offset; /* Start of scan area in mm */
- SANE_Fixed y_offset; /* Start of scan area in mm (Amount of
+ SANE_Fixed y_offset; /* Start of scan area in mm (Amount of
feeding needed to get to the medium) */
SANE_Fixed x_size; /* Size of scan area in mm */
SANE_Fixed y_size; /* Size of scan area in mm */
@@ -600,7 +629,7 @@ typedef struct Genesys_Model
SANE_Fixed post_scan; /* Size of scan area after paper sensor stops
sensing document in mm */
- SANE_Fixed eject_feed; /* Amount of feeding needed to eject document
+ SANE_Fixed eject_feed; /* Amount of feeding needed to eject document
after finishing scanning in mm */
/* Line-distance correction (in pixel at optical_ydpi) for CCD scanners */
@@ -654,7 +683,7 @@ typedef struct
unsigned int color_filter;
/**< true if scan is true gray, false if monochrome scan */
- int true_gray;
+ int true_gray;
/**< lineart threshold */
int threshold;
@@ -678,6 +707,9 @@ typedef struct
/**< value for brightness enhancement in the [-100..100] range */
int brightness;
+
+ /**< cahe entries expiration time */
+ int expiration_time;
} Genesys_Settings;
typedef struct Genesys_Current_Setup
@@ -691,7 +723,7 @@ typedef struct Genesys_Current_Setup
float xres; /* used xres */
float yres; /* used yres*/
SANE_Bool half_ccd; /* half ccd mode */
- SANE_Int stagger;
+ SANE_Int stagger;
SANE_Int max_shift; /* max shift of any ccd component, including staggered pixels*/
} Genesys_Current_Setup;
@@ -780,7 +812,7 @@ struct Genesys_Device
size_t wpl; /**< asic's word per line */
Genesys_Current_Setup current_setup; /* contains the real used values */
-
+
/**< look up table used in dynamic rasterization */
unsigned char lineart_lut[256];
@@ -850,7 +882,7 @@ typedef struct {
#define SCAN_FLAG_CALIBRATION 0x100
#define SCAN_FLAG_FEEDING 0x200
#define SCAN_FLAG_USE_XPA 0x400
-
+#define SCAN_FLAG_ENABLE_LEDADD 0x800
#define MOTOR_FLAG_AUTO_GO_HOME 0x01
#define MOTOR_FLAG_DISABLE_BUFFER_FULL_MOVE 0x02
#define MOTOR_FLAG_FEED 0x04
@@ -995,7 +1027,7 @@ extern void
sanei_genesys_create_gamma_table (uint16_t * gamma_table, int size,
float maximum, float gamma_max,
float gamma);
-
+
extern SANE_Status sanei_genesys_send_gamma_table (Genesys_Device * dev);
extern SANE_Status sanei_genesys_start_motor (Genesys_Device * dev);
@@ -1054,7 +1086,7 @@ sanei_genesys_wait_for_home(Genesys_Device *dev);
extern SANE_Status
sanei_genesys_asic_init(Genesys_Device *dev, SANE_Bool cold);
-extern
+extern
int sanei_genesys_compute_dpihw(Genesys_Device *dev, int xres);
extern
@@ -1173,7 +1205,7 @@ compute_planar_coefficients (Genesys_Device * dev,
unsigned int channels,
unsigned int cmat[3],
unsigned int offset,
- unsigned int coeff,
+ unsigned int coeff,
unsigned int target);
void
@@ -1190,6 +1222,10 @@ compute_shifted_coefficients (Genesys_Device * dev,
SANE_Status
probe_genesys_devices (void);
+
+SANE_Status genesys_flatbed_calibration (Genesys_Device *dev);
+
+SANE_Status genesys_send_shading_coefficient (Genesys_Device *dev);
#endif