genesys: Init cmd_set directly instead of going through a function

merge-requests/113/head
Povilas Kanapickas 2019-08-02 22:39:05 +03:00
rodzic a58b20d2c8
commit 16c55bf330
8 zmienionych plików z 19 dodań i 48 usunięć

Wyświetl plik

@ -3063,7 +3063,7 @@ static void gl124_update_hardware_sensors(Genesys_Scanner* s)
/** the gl124 command set */
static Genesys_Command_Set gl124_cmd_set = {
Genesys_Command_Set gl124_cmd_set = {
"gl124-generic", /* the name of this set */
[](Genesys_Device* dev) -> bool { (void) dev; return true; },
@ -3118,8 +3118,3 @@ static Genesys_Command_Set gl124_cmd_set = {
gl124_calculate_current_setup,
gl124_boot
};
void sanei_gl124_init_cmd_set(Genesys_Device* dev)
{
dev->cmd_set = &gl124_cmd_set;
}

Wyświetl plik

@ -4093,7 +4093,7 @@ static void gl646_search_strip(Genesys_Device* dev, const Genesys_Sensor& sensor
}
/** the gl646 command set */
static Genesys_Command_Set gl646_cmd_set = {
Genesys_Command_Set gl646_cmd_set = {
"gl646-generic", /* the name of this set */
gl646_needs_home_before_init_regs_for_scan,
@ -4148,8 +4148,3 @@ static Genesys_Command_Set gl646_cmd_set = {
NULL,
NULL
};
void sanei_gl646_init_cmd_set(Genesys_Device* dev)
{
dev->cmd_set = &gl646_cmd_set;
}

Wyświetl plik

@ -4658,7 +4658,7 @@ static void gl841_send_shading_data(Genesys_Device* dev, const Genesys_Sensor& s
/** the gl841 command set */
static Genesys_Command_Set gl841_cmd_set = {
Genesys_Command_Set gl841_cmd_set = {
"gl841-generic", /* the name of this set */
[](Genesys_Device* dev) -> bool { (void) dev; return true; },
@ -4712,8 +4712,3 @@ static Genesys_Command_Set gl841_cmd_set = {
gl841_calculate_current_setup,
NULL
};
void sanei_gl841_init_cmd_set(Genesys_Device* dev)
{
dev->cmd_set = &gl841_cmd_set;
}

Wyświetl plik

@ -3917,7 +3917,7 @@ static void gl843_send_shading_data(Genesys_Device* dev, const Genesys_Sensor& s
/** the gl843 command set */
static Genesys_Command_Set gl843_cmd_set = {
Genesys_Command_Set gl843_cmd_set = {
"gl843-generic", /* the name of this set */
[](Genesys_Device* dev) -> bool { (void) dev; return true; },
@ -3971,8 +3971,3 @@ static Genesys_Command_Set gl843_cmd_set = {
gl843_calculate_current_setup,
gl843_boot
};
void sanei_gl843_init_cmd_set(Genesys_Device* dev)
{
dev->cmd_set = &gl843_cmd_set;
}

Wyświetl plik

@ -2848,7 +2848,7 @@ static void gl846_coarse_gain_calibration(Genesys_Device* dev, const Genesys_Sen
/** the gl846 command set */
static Genesys_Command_Set gl846_cmd_set = {
Genesys_Command_Set gl846_cmd_set = {
"gl846-generic", /* the name of this set */
nullptr,
@ -2902,8 +2902,3 @@ static Genesys_Command_Set gl846_cmd_set = {
gl846_calculate_current_setup,
gl846_boot
};
void sanei_gl846_init_cmd_set(Genesys_Device* dev)
{
dev->cmd_set = &gl846_cmd_set;
}

Wyświetl plik

@ -2958,7 +2958,7 @@ static void gl847_coarse_gain_calibration(Genesys_Device* dev, const Genesys_Sen
/** the gl847 command set */
static Genesys_Command_Set gl847_cmd_set = {
Genesys_Command_Set gl847_cmd_set = {
"gl847-generic", /* the name of this set */
nullptr,
@ -3012,8 +3012,3 @@ static Genesys_Command_Set gl847_cmd_set = {
gl847_calculate_current_setup,
gl847_boot
};
void sanei_gl847_init_cmd_set(Genesys_Device* dev)
{
dev->cmd_set = &gl847_cmd_set;
}

Wyświetl plik

@ -56,18 +56,25 @@
/**
* setup the hardware dependent functions
*/
extern Genesys_Command_Set gl124_cmd_set;
extern Genesys_Command_Set gl646_cmd_set;
extern Genesys_Command_Set gl841_cmd_set;
extern Genesys_Command_Set gl843_cmd_set;
extern Genesys_Command_Set gl846_cmd_set;
extern Genesys_Command_Set gl847_cmd_set;
void sanei_genesys_init_cmd_set(Genesys_Device* dev)
{
DBG_INIT ();
DBG_HELPER(dbg);
switch (dev->model->asic_type) {
case GENESYS_GL646: sanei_gl646_init_cmd_set(dev); break;
case GENESYS_GL841: sanei_gl841_init_cmd_set(dev); break;
case GENESYS_GL843: sanei_gl843_init_cmd_set(dev); break;
case GENESYS_GL646: dev->cmd_set = &gl646_cmd_set; break;
case GENESYS_GL841: dev->cmd_set = &gl841_cmd_set; break;
case GENESYS_GL843: dev->cmd_set = &gl843_cmd_set; break;
case GENESYS_GL845: // since only a few reg bits differs we handle both together
case GENESYS_GL846: sanei_gl846_init_cmd_set(dev); break;
case GENESYS_GL847: sanei_gl847_init_cmd_set(dev); break;
case GENESYS_GL124: sanei_gl124_init_cmd_set(dev); break;
case GENESYS_GL846: dev->cmd_set = &gl846_cmd_set; break;
case GENESYS_GL847: dev->cmd_set = &gl847_cmd_set; break;
case GENESYS_GL124: dev->cmd_set = &gl124_cmd_set; break;
default: throw SaneException(SANE_STATUS_INVAL, "unknown ASIC type");
}
}

Wyświetl plik

@ -681,12 +681,6 @@ extern void sanei_genesys_generate_gamma_buffer(Genesys_Device* dev,
/*---------------------------------------------------------------------------*/
/* ASIC specific functions declarations */
/*---------------------------------------------------------------------------*/
extern void sanei_gl646_init_cmd_set(Genesys_Device* dev);
extern void sanei_gl841_init_cmd_set(Genesys_Device* dev);
extern void sanei_gl843_init_cmd_set(Genesys_Device* dev);
extern void sanei_gl846_init_cmd_set(Genesys_Device* dev);
extern void sanei_gl847_init_cmd_set(Genesys_Device* dev);
extern void sanei_gl124_init_cmd_set(Genesys_Device* dev);
// same as usleep, except that it does nothing if testing mode is enabled
extern void sanei_genesys_usleep(unsigned int useconds);