kopia lustrzana https://gitlab.com/sane-project/backends
genesys: Simplify creation of command set
rodzic
c0deb9b2c4
commit
edda9bff25
|
@ -5619,7 +5619,9 @@ static void sane_open_impl(SANE_String_Const devicename, SANE_Handle * handle)
|
||||||
|
|
||||||
init_options(s);
|
init_options(s);
|
||||||
|
|
||||||
sanei_genesys_init_cmd_set(s->dev);
|
DBG_INIT();
|
||||||
|
|
||||||
|
s->dev->cmd_set = create_cmd_set(s->dev->model->asic_type);
|
||||||
|
|
||||||
// FIXME: we create sensor tables for the sensor, this should happen when we know which sensor
|
// FIXME: we create sensor tables for the sensor, this should happen when we know which sensor
|
||||||
// we will select
|
// we will select
|
||||||
|
|
|
@ -1511,10 +1511,5 @@ void CommandSetGl124::move_to_ta(Genesys_Device* dev) const
|
||||||
throw SaneException("not implemented");
|
throw SaneException("not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<CommandSet> create_gl124_cmd_set()
|
|
||||||
{
|
|
||||||
return std::unique_ptr<CommandSet>(new CommandSetGl124{});
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace gl124
|
} // namespace gl124
|
||||||
} // namespace genesys
|
} // namespace genesys
|
||||||
|
|
|
@ -3137,10 +3137,5 @@ void CommandSetGl646::asic_boot(Genesys_Device *dev, bool cold) const
|
||||||
throw SaneException("not implemented");
|
throw SaneException("not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<CommandSet> create_gl646_cmd_set()
|
|
||||||
{
|
|
||||||
return std::unique_ptr<CommandSet>(new CommandSetGl646{});
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace gl646
|
} // namespace gl646
|
||||||
} // namespace genesys
|
} // namespace genesys
|
||||||
|
|
|
@ -2652,10 +2652,5 @@ void CommandSetGl841::asic_boot(Genesys_Device *dev, bool cold) const
|
||||||
dev->cmd_set->set_fe(dev, sensor, AFE_INIT);
|
dev->cmd_set->set_fe(dev, sensor, AFE_INIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<CommandSet> create_gl841_cmd_set()
|
|
||||||
{
|
|
||||||
return std::unique_ptr<CommandSet>(new CommandSetGl841{});
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace gl841
|
} // namespace gl841
|
||||||
} // namespace genesys
|
} // namespace genesys
|
||||||
|
|
|
@ -1890,10 +1890,5 @@ void CommandSetGl843::wait_for_motor_stop(Genesys_Device* dev) const
|
||||||
(void) dev;
|
(void) dev;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<CommandSet> create_gl843_cmd_set()
|
|
||||||
{
|
|
||||||
return std::unique_ptr<CommandSet>(new CommandSetGl843{});
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace gl843
|
} // namespace gl843
|
||||||
} // namespace genesys
|
} // namespace genesys
|
||||||
|
|
|
@ -1275,10 +1275,5 @@ void CommandSetGl846::move_to_ta(Genesys_Device* dev) const
|
||||||
scanner_move(*dev, dev->model->default_method, feed, Direction::FORWARD);
|
scanner_move(*dev, dev->model->default_method, feed, Direction::FORWARD);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<CommandSet> create_gl846_cmd_set()
|
|
||||||
{
|
|
||||||
return std::unique_ptr<CommandSet>(new CommandSetGl846{});
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace gl846
|
} // namespace gl846
|
||||||
} // namespace genesys
|
} // namespace genesys
|
||||||
|
|
|
@ -1172,10 +1172,5 @@ void CommandSetGl847::move_to_ta(Genesys_Device* dev) const
|
||||||
throw SaneException("not implemented");
|
throw SaneException("not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<CommandSet> create_gl847_cmd_set()
|
|
||||||
{
|
|
||||||
return std::unique_ptr<CommandSet>(new CommandSetGl847{});
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace gl847
|
} // namespace gl847
|
||||||
} // namespace genesys
|
} // namespace genesys
|
||||||
|
|
|
@ -56,6 +56,14 @@
|
||||||
#include "gl847_registers.h"
|
#include "gl847_registers.h"
|
||||||
#include "gl646_registers.h"
|
#include "gl646_registers.h"
|
||||||
|
|
||||||
|
#include "gl124.h"
|
||||||
|
#include "gl646.h"
|
||||||
|
#include "gl841.h"
|
||||||
|
#include "gl843.h"
|
||||||
|
#include "gl846.h"
|
||||||
|
#include "gl847.h"
|
||||||
|
#include "gl646.h"
|
||||||
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
@ -66,29 +74,16 @@
|
||||||
|
|
||||||
namespace genesys {
|
namespace genesys {
|
||||||
|
|
||||||
/**
|
std::unique_ptr<CommandSet> create_cmd_set(AsicType asic_type)
|
||||||
* setup the hardware dependent functions
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace gl124 { std::unique_ptr<CommandSet> create_gl124_cmd_set(); }
|
|
||||||
namespace gl646 { std::unique_ptr<CommandSet> create_gl646_cmd_set(); }
|
|
||||||
namespace gl841 { std::unique_ptr<CommandSet> create_gl841_cmd_set(); }
|
|
||||||
namespace gl843 { std::unique_ptr<CommandSet> create_gl843_cmd_set(); }
|
|
||||||
namespace gl846 { std::unique_ptr<CommandSet> create_gl846_cmd_set(); }
|
|
||||||
namespace gl847 { std::unique_ptr<CommandSet> create_gl847_cmd_set(); }
|
|
||||||
|
|
||||||
void sanei_genesys_init_cmd_set(Genesys_Device* dev)
|
|
||||||
{
|
{
|
||||||
DBG_INIT ();
|
switch (asic_type) {
|
||||||
DBG_HELPER(dbg);
|
case AsicType::GL646: return std::unique_ptr<CommandSet>(new gl646::CommandSetGl646{});
|
||||||
switch (dev->model->asic_type) {
|
case AsicType::GL841: return std::unique_ptr<CommandSet>(new gl841::CommandSetGl841{});
|
||||||
case AsicType::GL646: dev->cmd_set = gl646::create_gl646_cmd_set(); break;
|
case AsicType::GL843: return std::unique_ptr<CommandSet>(new gl843::CommandSetGl843{});
|
||||||
case AsicType::GL841: dev->cmd_set = gl841::create_gl841_cmd_set(); break;
|
|
||||||
case AsicType::GL843: dev->cmd_set = gl843::create_gl843_cmd_set(); break;
|
|
||||||
case AsicType::GL845: // since only a few reg bits differs we handle both together
|
case AsicType::GL845: // since only a few reg bits differs we handle both together
|
||||||
case AsicType::GL846: dev->cmd_set = gl846::create_gl846_cmd_set(); break;
|
case AsicType::GL846: return std::unique_ptr<CommandSet>(new gl846::CommandSetGl846{});
|
||||||
case AsicType::GL847: dev->cmd_set = gl847::create_gl847_cmd_set(); break;
|
case AsicType::GL847: return std::unique_ptr<CommandSet>(new gl847::CommandSetGl847{});
|
||||||
case AsicType::GL124: dev->cmd_set = gl124::create_gl124_cmd_set(); break;
|
case AsicType::GL124: return std::unique_ptr<CommandSet>(new gl124::CommandSetGl124{});
|
||||||
default: throw SaneException(SANE_STATUS_INVAL, "unknown ASIC type");
|
default: throw SaneException(SANE_STATUS_INVAL, "unknown ASIC type");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -219,7 +219,7 @@ private:
|
||||||
/* common functions needed by low level specific functions */
|
/* common functions needed by low level specific functions */
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
extern void sanei_genesys_init_cmd_set(Genesys_Device* dev);
|
std::unique_ptr<CommandSet> create_cmd_set(AsicType asic_type);
|
||||||
|
|
||||||
// reads the status of the scanner
|
// reads the status of the scanner
|
||||||
Status scanner_read_status(Genesys_Device& dev);
|
Status scanner_read_status(Genesys_Device& dev);
|
||||||
|
|
Ładowanie…
Reference in New Issue