WIP setup optical regs ~OK

merge-requests/1/head
Stphane Voltz 2010-04-25 21:32:44 +02:00
rodzic b445223349
commit 3dba8c1d66
8 zmienionych plików z 522 dodań i 633 usunięć

Wyświetl plik

@ -166,7 +166,7 @@ static const SANE_Range threshold_curve_range = {
/* ------------------------------------------------------------------------ */
/*
* returns true if filter bit is on (monochrome scan)
* setup the hardware dependent functions
*/
static SANE_Status
genesys_init_cmd_set (Genesys_Device * dev)
@ -177,6 +177,8 @@ genesys_init_cmd_set (Genesys_Device * dev)
return sanei_gl646_init_cmd_set (dev);
case GENESYS_GL841:
return sanei_gl841_init_cmd_set (dev);
case GENESYS_GL847:
return sanei_gl847_init_cmd_set (dev);
default:
return SANE_STATUS_INVAL;
}
@ -284,13 +286,45 @@ sanei_genesys_set_reg_from_set (Genesys_Register_Set * reg, SANE_Byte address,
/* Read and write RAM, registers and AFE */
/* ------------------------------------------------------------------------ */
/**
* Write to one GL847 ASIC register
URB 10 control 0x40 0x04 0x83 0x00 len 2 wrote 0xa6 0x04
*/
static SANE_Status
sanei_genesys_write_gl847_register (Genesys_Device * dev, uint8_t reg, uint8_t val)
{
SANE_Status status;
uint8_t buffer[2];
/* Write to one register */
buffer[0]=reg;
buffer[1]=val;
status =
sanei_usb_control_msg (dev->dn, REQUEST_TYPE_OUT, REQUEST_BUFFER,
VALUE_SET_REGISTER, INDEX, 2, buffer);
if (status != SANE_STATUS_GOOD)
{
DBG (DBG_error, "sanei_genesys_write_gl847_register (0x%02x, 0x%02x): failed : %s\n", reg, val, sane_strstatus (status));
return status;
}
DBG (DBG_io, "sanei_genesys_write_gl847_register (0x%02x, 0x%02x) completed\n",
reg, val);
return status;
}
/**
* Write to one ASIC register
*/
SANE_Status
sanei_genesys_write_register (Genesys_Device * dev, uint8_t reg, uint8_t val)
{
SANE_Status status;
/* route to gl847 function if needed */
if(dev->model->asic_type==GENESYS_GL847)
return sanei_genesys_write_gl847_register(dev, reg, val);
status =
sanei_usb_control_msg (dev->dn, REQUEST_TYPE_OUT, REQUEST_REGISTER,
VALUE_SET_REGISTER, INDEX, 1, &reg);
@ -319,6 +353,29 @@ sanei_genesys_write_register (Genesys_Device * dev, uint8_t reg, uint8_t val)
return status;
}
/* read reg 0x41:
* URB 164 control 0xc0 0x04 0x8e 0x4122 len 2 read 0xfc 0x55
*/
static SANE_Status
sanei_genesys_read_gl847_register (Genesys_Device * dev, uint8_t reg, uint8_t * val)
{
SANE_Status status;
uint16_t value;
status =
sanei_usb_control_msg (dev->dn, REQUEST_TYPE_IN, REQUEST_BUFFER,
VALUE_GET_REGISTER, 0x22+(reg<<8), 2, (SANE_Byte *)&value);
if (status != SANE_STATUS_GOOD)
{
DBG (DBG_error,
"sanei_genesys_read_gl847_register (0x%02x): failed while setting register: %s\n",
reg, sane_strstatus (status));
return status;
}
*val=value & 0xff;
DBG( DBG_io2, "sanei_genesys_read_gl847_register(0x%02x)=0x%02x\n",reg,value & 0xff);
return status;
}
/* Read from one register */
SANE_Status
@ -326,6 +383,10 @@ sanei_genesys_read_register (Genesys_Device * dev, uint8_t reg, uint8_t * val)
{
SANE_Status status;
/* route to gl847 function if needed */
if(dev->model->asic_type==GENESYS_GL847)
return sanei_genesys_read_gl847_register(dev, reg, val);
status =
sanei_usb_control_msg (dev->dn, REQUEST_TYPE_OUT, REQUEST_REGISTER,
VALUE_SET_REGISTER, INDEX, 1, &reg);
@ -361,6 +422,13 @@ SANE_Status
sanei_genesys_set_buffer_address (Genesys_Device * dev, uint32_t addr)
{
SANE_Status status;
if(dev->model->asic_type==GENESYS_GL847)
{
DBG (DBG_warn,
"sanei_genesys_set_buffer_address: shouldn't be used for GL847 \n");
return SANE_STATUS_GOOD;
}
DBG (DBG_io,
"sanei_genesys_set_buffer_address: setting address to 0x%05x\n",
@ -1377,8 +1445,20 @@ genesys_send_offset_and_shading (Genesys_Device * dev, uint8_t * data,
DBG (DBG_proc, "genesys_send_offset_and_shading (size = %d)\n", size);
/* ASIC higher than gl843 doesn't have register 2A/2B, so we route to
* a per ASIC shading data loading function if available */
if(dev->model->cmd_set->send_shading_data!=NULL)
{
status=dev->model->cmd_set->send_shading_data(dev, data, size);
DBG (DBG_proc, "genesys_send_offset_and_shading: completed\n");
return status;
}
/* gl646, gl84[123] case */
dpihw = sanei_genesys_read_reg_from_set (dev->reg, 0x05) >> 6;
/* TODO invert the test so only the 2 models behaving like that are
* tested instead of adding all the others */
/* many scanners send coefficient for lineart/gray like in color mode */
if (dev->settings.scan_mode < 2
&& dev->model->ccd_type != CCD_DSMOBILE600
@ -6055,7 +6135,10 @@ config_attach_genesys (SANEI_Config * config, const char *devname)
}
/* probes for scanner to attach to the backend */
static SANE_Status
#ifndef UNIT_TESTING
static
#endif
SANE_Status
probe_genesys_devices (void)
{
SANEI_Config config;

Wyświetl plik

@ -36,6 +36,9 @@ usb 0x04a9 0x2213
# Canon LiDE 60
usb 0x04a9 0x221c
# Canon LiDE 200
usb 0x04a9 0x1905
# Visioneer Strobe XP200
usb 0x04a7 0x0426

Wyświetl plik

@ -138,6 +138,14 @@ static Genesys_Frontend Wolfson[] = {
, {0x07, 0x00, 0x00}
}
,
{DAC_CANONLIDE200,
{0x9d, 0x9a, 0x00, 0x00}
, {0x00, 0x00, 0x00}
, {0x32, 0x04, 0x00} /* offset */
, {0x00, 0x3f, 0x00} /* gain */
, {0x00, 0x00, 0x00}
}
, /* 6: CANONLIDE200 */
};
@ -393,6 +401,31 @@ static Genesys_Sensor Sensor[] = {
1.0, 1.0, 1.0,
NULL, NULL, NULL}
,
/* CANONLIDE200 */
{CIS_CANONLIDE200,
1200, /* optical resolution */
87, /* black pixels */
16, /* dummy pixels */
0,
10400,
210,
200,
{0x00, 0x00, 0x00, 0x00},
/* reg 0x10 - 0x1d */
{0x02, 0x7d, 0x02, 0x7d, 0x02, 0x7d, /* EXPR/EXPG/EXPB */
0x10, 0x0c, 0x00, 0xff, 0x34, 0x00, 0x02, 0x04 },
/* reg 0x52 - 0x5e */
{0x03, 0x07,
0x00, 0x00, 0x00, 0x00,
0x2a, 0xe1,
0x55,
0x00, 0x00, 0x00,
0x41
}
,
1.0, 1.0, 1.0,
NULL, NULL, NULL}
,
};
@ -492,6 +525,14 @@ static Genesys_Gpo Gpo[] = {
{0xfb, 0x00}, /* 6e, 6f */
}
,
/* CANONLIDE200 */
{GPO_CANONLIDE200,
{0xfb, 0x20}
,
{0xff, 0x00}
,
}
,
};
static Genesys_Motor Motor[] = {
@ -712,6 +753,24 @@ static Genesys_Motor Motor[] = {
0.8,
},},},
},
{MOTOR_CANONLIDE200, /* Canon LiDE 200 */
1200,
2400,
1,
1,
{{{
3500,
1300,
60,
0.8,
},
{
3500,
1400,
60,
0.8,
},},},
},
};
/* here we have the various device settings...
@ -821,6 +880,60 @@ static Genesys_Model canon_lide_50_model = {
400
};
static Genesys_Model canon_lide_200_model = {
"canon-lide-200", /* Name */
"Canon", /* Device vendor string */
"LiDE 200", /* Device model name */
GENESYS_GL847,
NULL,
{1200, 600, 300, 150, 75, 50, 0}, /* possible x-resolutions */
{2400, 1200, 600, 300, 150, 75, 50, 0}, /* possible y-resolutions */
{16, 8, 0}, /* possible depths in gray mode */
{16, 8, 0}, /* possible depths in color mode */
SANE_FIX (0.42), /* Start of scan area in mm (x) */
SANE_FIX (7.9), /* Start of scan area in mm (y) */
SANE_FIX (218.0), /* Size of scan area in mm (x) */
SANE_FIX (299.0), /* Size of scan area in mm (y) */
SANE_FIX (3.0), /* Start of white strip in mm (y) */
SANE_FIX (0.0), /* Start of black mark in mm (x) */
SANE_FIX (0.0), /* Start of scan area in TA mode in mm (x) */
SANE_FIX (0.0), /* Start of scan area in TA mode in mm (y) */
SANE_FIX (100.0), /* Size of scan area in TA mode in mm (x) */
SANE_FIX (100.0), /* Size of scan area in TA mode in mm (y) */
SANE_FIX (0.0), /* Start of white strip in TA mode in mm (y) */
SANE_FIX (0.0), /* Size of scan area after paper sensor stops
sensing document in mm */
SANE_FIX (0.0), /* Amount of feeding needed to eject document
after finishing scanning in mm */
0, 0, 0, /* RGB CCD Line-distance correction in pixel */
COLOR_ORDER_RGB, /* Order of the CCD/CIS colors */
SANE_TRUE, /* Is this a CIS scanner? */
SANE_FALSE, /* Is this a sheetfed scanner? */
CIS_CANONLIDE200,
DAC_CANONLIDE200,
GPO_CANONLIDE200,
MOTOR_CANONLIDE200,
GENESYS_FLAG_LAZY_INIT /* Which flags are needed for this scanner? */
| GENESYS_FLAG_SKIP_WARMUP
| GENESYS_FLAG_OFFSET_CALIBRATION
| GENESYS_FLAG_DARK_WHITE_CALIBRATION
| GENESYS_FLAG_CUSTOM_GAMMA
| GENESYS_FLAG_HALF_CCD_MODE,
GENESYS_HAS_SCAN_SW | GENESYS_HAS_COPY_SW | GENESYS_HAS_EMAIL_SW | GENESYS_HAS_FILE_SW,
300,
400
}; /* this is completely untested -- hmg */
static Genesys_Model canon_lide_60_model = {
"canon-lide-60", /* Name */
"Canon", /* Device vendor string */
@ -1896,6 +2009,7 @@ static Genesys_USB_Device_Entry genesys_usb_device_list[] = {
{0x04a7, 0x04ac, &xerox_travelscanner_model},
{0x04a9, 0x2213, &canon_lide_50_model},
{0x04a9, 0x221c, &canon_lide_60_model},
{0x04a9, 0x1905, &canon_lide_200_model},
{0x0638, 0x0a10, &umax_astra_4500_model},
{0x07b3, 0x0600, &plustek_st12_model},
{0x07b3, 0x0601, &plustek_st24_model},

Wyświetl plik

@ -5752,7 +5752,8 @@ static Genesys_Command_Set gl646_cmd_set = {
gl646_search_strip,
gl646_is_compatible_calibration,
gl646_move_to_ta
gl646_move_to_ta,
NULL
};
SANE_Status

Wyświetl plik

@ -6296,6 +6296,7 @@ static Genesys_Command_Set gl841_cmd_set = {
gl841_search_strip,
gl841_is_compatible_calibration,
NULL,
NULL
};

Plik diff jest za duży Load Diff

Wyświetl plik

@ -112,13 +112,12 @@
#define REG07_DMASEL 0x02
#define REG07_DMARDWR 0x01
#define REG08_DECFLAG 0x40
#define REG08_GMMFFR 0x20
#define REG08_GMMFFG 0x10
#define REG08_GMMFFB 0x08
#define REG08_GMMZR 0x04
#define REG08_GMMZG 0x02
#define REG08_GMMZB 0x01
#define REG08_DRAM2X 0x80
#define REG08_MPENB 0x20
#define REG08_CIS_LINE 0x10
#define REG08_IR1ENB 0x08
#define REG08_IR2ENB 0x04
#define REG08_ENB24M 0x01
#define REG09_MCNTSET 0xc0
#define REG09_CLKSET 0x30

Wyświetl plik

@ -123,6 +123,8 @@
#define GPIO_OUTPUT_ENABLE 0x89
#define GPIO_READ 0x8a
#define GPIO_WRITE 0x8b
#define VALUE_BUF_ENDACCESS 0x8c
#define VALUE_GET_REGISTER 0x8e
#define INDEX 0x00
/* todo: used?
@ -146,8 +148,8 @@
#define AFE_SET 2
#define AFE_POWER_SAVE 4
#define LOWORD(x) ((uint16_t)(x & 0xffff))
#define HIWORD(x) ((uint16_t)(x >> 16))
#define LOWORD(x) ((uint16_t)((x) & 0xffff))
#define HIWORD(x) ((uint16_t)((x) >> 16))
#define LOBYTE(x) ((uint8_t)((x) & 0xFF))
#define HIBYTE(x) ((uint8_t)((x) >> 8))
@ -240,6 +242,9 @@ Genesys_Color_Order;
#define GENESYS_GL646 646
#define GENESYS_GL841 841
#define GENESYS_GL846 846
#define GENESYS_GL847 847
#define GENESYS_GL848 848
/*135 registers for gl841 + 1 null-reg*/
#define GENESYS_MAX_REGS 136
@ -255,6 +260,7 @@ Genesys_Color_Order;
#define DAC_WOLFSON_XP300 8
#define DAC_WOLFSON_HP3670 9
#define DAC_WOLFSON_DSM600 10
#define DAC_CANONLIDE200 11
#define CCD_UMAX 0
#define CCD_ST12 1 /* SONY ILX548: 5340 Pixel ??? */
@ -271,6 +277,7 @@ Genesys_Color_Order;
#define CCD_DSMOBILE600 12
#define CCD_XP300 13
#define CCD_DP685 14
#define CIS_CANONLIDE200 15
#define GPO_UMAX 0
#define GPO_ST12 1
@ -284,6 +291,7 @@ Genesys_Color_Order;
#define GPO_HP3670 9
#define GPO_DP665 10
#define GPO_DP685 11
#define GPO_CANONLIDE200 12
#define MOTOR_UMAX 0
#define MOTOR_5345 1
@ -297,6 +305,7 @@ Genesys_Color_Order;
#define MOTOR_DP665 10
#define MOTOR_ROADWARRIOR 11
#define MOTOR_DSMOBILE_600 12
#define MOTOR_CANONLIDE200 13
/* Forward typedefs */
@ -416,6 +425,12 @@ typedef struct Genesys_Command_Set
* move scanning head to transparency adapter
*/
SANE_Status (*move_to_ta) (Genesys_Device * dev);
/**
* write shading data calibration to ASIC
*/
SANE_Status (*send_shading_data) (Genesys_Device * dev, uint8_t * data, int size);
} Genesys_Command_Set;
typedef struct Genesys_Model
@ -769,5 +784,6 @@ sanei_genesys_buffer_consume(Genesys_Buffer * buf, size_t size);
/*---------------------------------------------------------------------------*/
extern SANE_Status sanei_gl646_init_cmd_set (Genesys_Device * dev);
extern SANE_Status sanei_gl841_init_cmd_set (Genesys_Device * dev);
extern SANE_Status sanei_gl847_init_cmd_set (Genesys_Device * dev);
#endif /* not GENESYS_LOW_H */