genesys: Simplify sensor register desc by matching ccd_size_divisor

merge-requests/139/head
Povilas Kanapickas 2019-08-17 11:49:04 +03:00
rodzic e36d6b8fb5
commit b19720cfa1
2 zmienionych plików z 94 dodań i 78 usunięć

Wyświetl plik

@ -483,8 +483,9 @@ static void gl646_setup_registers(Genesys_Device* dev,
nb = sizeof (sensor_settings) / sizeof (Sensor_Settings); nb = sizeof (sensor_settings) / sizeof (Sensor_Settings);
while (i < nb) while (i < nb)
{ {
if (sensor_mst->sensor == sensor_settings[i].sensor if (sensor_mst->sensor == sensor_settings[i].sensor &&
&& sensor_mst->cksel == sensor_settings[i].cksel) sensor_mst->cksel == sensor_settings[i].cksel &&
sensor_mst->ccd_size_divisor == sensor_settings[i].ccd_size_divisor)
{ {
settings = &sensor_settings[i]; settings = &sensor_settings[i];
} }
@ -506,12 +507,8 @@ static void gl646_setup_registers(Genesys_Device* dev,
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
{ {
r = sanei_genesys_get_address (regs, 0x08 + i); r = sanei_genesys_get_address (regs, 0x08 + i);
if (ccd_size_divisor > 1) {
r->value = settings->manual_0x08_0x0b[i];
} else {
r->value = settings->regs_0x08_0x0b[i]; r->value = settings->regs_0x08_0x0b[i];
} }
}
for (i = 0; i < 8; i++) for (i = 0; i < 8; i++)
{ {
@ -524,13 +521,6 @@ static void gl646_setup_registers(Genesys_Device* dev,
r = sanei_genesys_get_address (regs, 0x52 + i); r = sanei_genesys_get_address (regs, 0x52 + i);
r->value = settings->regs_0x52_0x5e[i]; r->value = settings->regs_0x52_0x5e[i];
} }
if (ccd_size_divisor > 1) {
for (i = 0; i < 7; i++)
{
r = sanei_genesys_get_address (regs, 0x52 + i);
r->value = settings->manual_0x52_0x58[i];
}
}
/* now generate slope tables : we are not using generate_slope_table3 yet */ /* now generate slope tables : we are not using generate_slope_table3 yet */
sanei_genesys_generate_slope_table (slope_table1, motor->steps1, sanei_genesys_generate_slope_table (slope_table1, motor->steps1,

Wyświetl plik

@ -311,13 +311,12 @@ typedef struct
/* key */ /* key */
SANE_Int sensor; SANE_Int sensor;
SANE_Int cksel; SANE_Int cksel;
unsigned ccd_size_divisor = 1;
/* values */ /* values */
uint8_t regs_0x08_0x0b[4]; /**< settings for normal CCD clock */ uint8_t regs_0x08_0x0b[4]; /**< settings for normal CCD clock */
uint8_t manual_0x08_0x0b[4]; /**< settings for CCD/2 clock */
uint8_t regs_0x16_0x1d[8]; uint8_t regs_0x16_0x1d[8];
uint8_t regs_0x52_0x5e[13]; uint8_t regs_0x52_0x5e[13];
uint8_t manual_0x52_0x58[7];
} Sensor_Settings; } Sensor_Settings;
/** /**
@ -499,67 +498,94 @@ static Motor_Master motor_master[] = {
*/ */
static Sensor_Settings sensor_settings[] = { static Sensor_Settings sensor_settings[] = {
/* HP 3670 */ /* HP 3670 */
{CCD_HP3670, 1, { CCD_HP3670, 1, 1,
{0x0d, 0x0f, 0x11, 0x13}, {0x0d, 0x0f, 0x11, 0x13},
{0x2b, 0x07, 0x30, 0x2a, 0x00, 0x00, 0xc0, 0x43},
{0x03, 0x07, 0x0b, 0x0f, 0x13, 0x17, 0x23, 0x00, 0xc1, 0x00, 0x00, 0x00, 0x00 },
},
{ CCD_HP3670, 1, 2,
{0x00, 0x00, 0x00, 0x00}, {0x00, 0x00, 0x00, 0x00},
{0x2b, 0x07, 0x30, 0x2a, 0x00, 0x00, 0xc0, 0x43}, {0x2b, 0x07, 0x30, 0x2a, 0x00, 0x00, 0xc0, 0x43},
{0x03, 0x07, 0x0b, 0x0f, 0x13, 0x17, 0x23, 0x00, 0xc1, 0x00, 0x00, 0x00, 0x00, }, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc1, 0x00, 0x00, 0x00, 0x00 },
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
}, },
{CCD_HP3670, 2, { CCD_HP3670, 2, 1,
{0x00, 0x05, 0x06, 0x08}, {0x00, 0x05, 0x06, 0x08},
{0x33, 0x07, 0x31, 0x2a, 0x02, 0x0e, 0xc0, 0x43},
{0x0b, 0x0f, 0x13, 0x17, 0x03, 0x07, 0x63, 0x00, 0xc1, 0x02, 0x0e, 0x00, 0x00 },
},
{ CCD_HP3670, 2, 2,
{0x00, 0x00, 0x00, 0x00}, {0x00, 0x00, 0x00, 0x00},
{0x33, 0x07, 0x31, 0x2a, 0x02, 0x0e, 0xc0, 0x43}, {0x33, 0x07, 0x31, 0x2a, 0x02, 0x0e, 0xc0, 0x43},
{0x0b, 0x0f, 0x13, 0x17, 0x03, 0x07, 0x63, 0x00, 0xc1, 0x02, 0x0e, 0x00, 0x00, }, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc1, 0x02, 0x0e, 0x00, 0x00 },
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
}, },
{CCD_HP3670, 4, { CCD_HP3670, 4, 1,
{0x00, 0x0a, 0x0b, 0x0d}, {0x00, 0x0a, 0x0b, 0x0d},
{0x33, 0x07, 0x33, 0x2a, 0x02, 0x13, 0xc0, 0x43},
{0x0f, 0x13, 0x17, 0x03, 0x07, 0x0b, 0x83, 0x15, 0xc1, 0x05, 0x0a, 0x0f, 0x00 },
},
{ CCD_HP3670, 4, 2,
{0x00, 0x00, 0x00, 0x00}, {0x00, 0x00, 0x00, 0x00},
{0x33, 0x07, 0x33, 0x2a, 0x02, 0x13, 0xc0, 0x43}, {0x33, 0x07, 0x33, 0x2a, 0x02, 0x13, 0xc0, 0x43},
{0x0f, 0x13, 0x17, 0x03, 0x07, 0x0b, 0x83, 0x15, 0xc1, 0x05, 0x0a, 0x0f, 0x00, }, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0xc1, 0x05, 0x0a, 0x0f, 0x00 },
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
}, },
{CCD_HP2400, 4, { CCD_HP2400, 4, 1,
{0x14, 0x15, 0x00, 0x00}, {0x14, 0x15, 0x00, 0x00},
{0xbf, 0x08, 0x3f, 0x2a, 0x00, 0x00, 0x00, 0x02},
{11, 15, 19, 23, 3, 7, 0x63, 0x00, 0xc1, 0x00, 0x00, 0x00, 0x00},
},
{ CCD_HP2400, 4, 2,
{0x00, 0x00, 0x00, 0x00}, {0x00, 0x00, 0x00, 0x00},
{0xbf, 0x08, 0x3f, 0x2a, 0x00, 0x00, 0x00, 0x02}, {0xbf, 0x08, 0x3f, 0x2a, 0x00, 0x00, 0x00, 0x02},
{11, 15, 19, 23, 3, 7, 0x63, 0x00, 0xc1, 0x00, 0x00, 0x00, 0x00}, {11, 15, 19, 23, 3, 7, 0x63, 0x00, 0xc1, 0x00, 0x00, 0x00, 0x00},
{11, 15, 19, 23, 3, 7, 0x63}
}, },
{CCD_HP2400, 2, { CCD_HP2400, 2, 1,
{14, 15, 0, 0},
{14, 15, 0, 0}, {14, 15, 0, 0},
{0xbf, 0x08, 0x31, 0x2a, 0, 0, 0, 0x02}, {0xbf, 0x08, 0x31, 0x2a, 0, 0, 0, 0x02},
{3, 7, 11, 15, 19, 23, 0x23, 0, 0xc1, 0, 0, 0, 0}, {3, 7, 11, 15, 19, 23, 0x23, 0, 0xc1, 0, 0, 0, 0},
{3, 7, 11, 15, 19, 23, 0x23}
}, },
{CCD_HP2400, 1, { CCD_HP2400, 2, 2,
{0x02, 0x04, 0x00, 0x00}, {14, 15, 0, 0},
{0xbf, 0x08, 0x31, 0x2a, 0, 0, 0, 0x02},
{3, 7, 11, 15, 19, 23, 0x23, 0, 0xc1, 0, 0, 0, 0},
},
{ CCD_HP2400, 1, 1,
{0x02, 0x04, 0x00, 0x00}, {0x02, 0x04, 0x00, 0x00},
{0xbf, 0x08, 0x30, 0x2a, 0x00, 0x00, 0xc0, 0x42}, {0xbf, 0x08, 0x30, 0x2a, 0x00, 0x00, 0xc0, 0x42},
{0x0b, 0x0f, 0x13, 0x17, 0x03, 0x07, 0x63, 0x00, 0xc1, 0x00, 0x0e, 0x00, 0x00}, {0x0b, 0x0f, 0x13, 0x17, 0x03, 0x07, 0x63, 0x00, 0xc1, 0x00, 0x0e, 0x00, 0x00},
{0x0b, 0x0f, 0x13, 0x17, 0x03, 0x07, 0x63}
}, },
{CIS_XP200, 1, { CCD_HP2400, 1, 2,
{6, 7, 10, 4}, {0x02, 0x04, 0x00, 0x00},
{0xbf, 0x08, 0x30, 0x2a, 0x00, 0x00, 0xc0, 0x42},
{0x0b, 0x0f, 0x13, 0x17, 0x03, 0x07, 0x63, 0x00, 0xc1, 0x00, 0x0e, 0x00, 0x00},
},
{ CIS_XP200, 1, 1,
{6, 7, 10, 4}, {6, 7, 10, 4},
{0x24, 0x04, 0x00, 0x2a, 0x0a, 0x0a, 0, 0x11}, {0x24, 0x04, 0x00, 0x2a, 0x0a, 0x0a, 0, 0x11},
{8, 2, 0, 0, 0, 0, 0x1a, 0x51, 0, 0, 0, 0, 0}, {8, 2, 0, 0, 0, 0, 0x1a, 0x51, 0, 0, 0, 0, 0},
{8, 2, 0, 0, 0, 0, 0x1a}
}, },
{CCD_HP2300, 1, { CIS_XP200, 1, 2,
{6, 7, 10, 4},
{0x24, 0x04, 0x00, 0x2a, 0x0a, 0x0a, 0, 0x11},
{8, 2, 0, 0, 0, 0, 0x1a, 0x51, 0, 0, 0, 0, 0},
},
{ CCD_HP2300, 1, 1,
{0x01, 0x03, 0x04, 0x06}, {0x01, 0x03, 0x04, 0x06},
{0xb7, 0x0a, 0x20, 0x2a, 0x6a, 0x8a, 0x00, 0x05},
{0x0f, 0x13, 0x17, 0x03, 0x07, 0x0b, 0x83, 0x00, 0xc1, 0x06, 0x0b, 0x10, 0x16},
},
{ CCD_HP2300, 1, 2,
{0x16, 0x00, 0x01, 0x03}, {0x16, 0x00, 0x01, 0x03},
{0xb7, 0x0a, 0x20, 0x2a, 0x6a, 0x8a, 0x00, 0x05}, {0xb7, 0x0a, 0x20, 0x2a, 0x6a, 0x8a, 0x00, 0x05},
{0x0f, 0x13, 0x17, 0x03, 0x07, 0x0b, 0x83, 0x00, 0xc1, 0x06, 0x0b, 0x10, 0x16}, {0x0f, 0x13, 0x17, 0x03, 0x07, 0x0b, 0x83, 0x00, 0xc1, 0x06, 0x0b, 0x10, 0x16},
{0x0f, 0x13, 0x17, 0x03, 0x07, 0x0b, 0x83}
}, },
{CCD_5345, 1, { CCD_5345, 1, 1,
{0x0d, 0x0f, 0x11, 0x13}, {0x0d, 0x0f, 0x11, 0x13},
{0x00, 0x05, 0x06, 0x08},
{0x0b, 0x0a, 0x30, 0x2a, 0x00, 0x00, 0x00, 0x03, }, {0x0b, 0x0a, 0x30, 0x2a, 0x00, 0x00, 0x00, 0x03, },
{0x03, 0x07, 0x0b, 0x0f, 0x13, 0x17, 0x23, 0x00, 0xc1, 0x00, 0x00, 0x00, 0x00}, {0x03, 0x07, 0x0b, 0x0f, 0x13, 0x17, 0x23, 0x00, 0xc1, 0x00, 0x00, 0x00, 0x00},
{0x0f, 0x13, 0x17, 0x03, 0x07, 0x0b, 0x83} },
{ CCD_5345, 1, 2,
{0x00, 0x05, 0x06, 0x08},
{0x0b, 0x0a, 0x30, 0x2a, 0x00, 0x00, 0x00, 0x03, },
{0x0f, 0x13, 0x17, 0x03, 0x07, 0x0b, 0x83, 0x00, 0xc1, 0x00, 0x00, 0x00, 0x00},
}, },
}; };