kopia lustrzana https://gitlab.com/sane-project/backends
				
				
				
			Merge branch 'genesys-cleanup' into 'master'
genesys: Miscellaneous cleanup See merge request sane-project/backends!412merge-requests/213/head^2
						commit
						1938bcfbeb
					
				| 
						 | 
				
			
			@ -552,6 +552,9 @@ enum class ScanFlag : unsigned
 | 
			
		|||
    USE_XPA = 1 << 9,
 | 
			
		||||
    ENABLE_LEDADD = 1 << 10,
 | 
			
		||||
    REVERSE = 1 << 12,
 | 
			
		||||
 | 
			
		||||
    // (unused): the scanner should return head to home position automatically after scan.
 | 
			
		||||
    AUTO_GO_HOME = 1 << 13,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
inline ScanFlag operator|(ScanFlag left, ScanFlag right)
 | 
			
		||||
| 
						 | 
				
			
			@ -591,39 +594,6 @@ inline void serialize(std::ostream& str, ScanFlag& x)
 | 
			
		|||
std::ostream& operator<<(std::ostream& out, ScanFlag flags);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
enum class MotorFlag : unsigned
 | 
			
		||||
{
 | 
			
		||||
    NONE = 0,
 | 
			
		||||
    AUTO_GO_HOME = 1 << 0,
 | 
			
		||||
    DISABLE_BUFFER_FULL_MOVE = 1 << 2,
 | 
			
		||||
    FEED = 1 << 3,
 | 
			
		||||
    USE_XPA = 1 << 4,
 | 
			
		||||
    REVERSE = 1 << 5,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
inline MotorFlag operator|(MotorFlag left, MotorFlag right)
 | 
			
		||||
{
 | 
			
		||||
    return static_cast<MotorFlag>(static_cast<unsigned>(left) | static_cast<unsigned>(right));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
inline MotorFlag& operator|=(MotorFlag& left, MotorFlag right)
 | 
			
		||||
{
 | 
			
		||||
    left = left | right;
 | 
			
		||||
    return left;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
inline MotorFlag operator&(MotorFlag left, MotorFlag right)
 | 
			
		||||
{
 | 
			
		||||
    return static_cast<MotorFlag>(static_cast<unsigned>(left) & static_cast<unsigned>(right));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
inline bool has_flag(MotorFlag flags, MotorFlag which)
 | 
			
		||||
{
 | 
			
		||||
    return (flags & which) == which;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
enum class Direction : unsigned
 | 
			
		||||
{
 | 
			
		||||
    FORWARD = 0,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -632,6 +632,30 @@ bool scanner_is_motor_stopped(Genesys_Device& dev)
 | 
			
		|||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void scanner_setup_sensor(Genesys_Device& dev, const Genesys_Sensor& sensor,
 | 
			
		||||
                          Genesys_Register_Set& regs)
 | 
			
		||||
{
 | 
			
		||||
    DBG_HELPER(dbg);
 | 
			
		||||
 | 
			
		||||
    if (dev.model->asic_type == AsicType::GL646) {
 | 
			
		||||
        for (const auto& custom_reg : sensor.custom_base_regs) {
 | 
			
		||||
            regs.set8(custom_reg.address, custom_reg.value);
 | 
			
		||||
        }
 | 
			
		||||
    } else {
 | 
			
		||||
        for (const auto& custom_reg : sensor.custom_regs) {
 | 
			
		||||
            regs.set8(custom_reg.address, custom_reg.value);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (dev.model->asic_type != AsicType::GL841 &&
 | 
			
		||||
        dev.model->asic_type != AsicType::GL843)
 | 
			
		||||
    {
 | 
			
		||||
        regs_set_exposure(dev.model->asic_type, regs, sensor.exposure);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    dev.segment_order = sensor.segment_order;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void scanner_stop_action(Genesys_Device& dev)
 | 
			
		||||
{
 | 
			
		||||
    DBG_HELPER(dbg);
 | 
			
		||||
| 
						 | 
				
			
			@ -5619,7 +5643,9 @@ static void sane_open_impl(SANE_String_Const devicename, SANE_Handle * handle)
 | 
			
		|||
 | 
			
		||||
    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
 | 
			
		||||
    // we will select
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -53,6 +53,37 @@
 | 
			
		|||
namespace genesys {
 | 
			
		||||
namespace gl124 {
 | 
			
		||||
 | 
			
		||||
struct Gpio_layout
 | 
			
		||||
{
 | 
			
		||||
    std::uint8_t r31;
 | 
			
		||||
    std::uint8_t r32;
 | 
			
		||||
    std::uint8_t r33;
 | 
			
		||||
    std::uint8_t r34;
 | 
			
		||||
    std::uint8_t r35;
 | 
			
		||||
    std::uint8_t r36;
 | 
			
		||||
    std::uint8_t r38;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/** @brief gpio layout
 | 
			
		||||
 * describes initial gpio settings for a given model
 | 
			
		||||
 * registers 0x31 to 0x38
 | 
			
		||||
 */
 | 
			
		||||
static Gpio_layout gpios[] = {
 | 
			
		||||
    /* LiDE 110 */
 | 
			
		||||
    { /*    0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x38 */
 | 
			
		||||
        0x9f, 0x59, 0x01, 0x80, 0x5f, 0x01, 0x00
 | 
			
		||||
    },
 | 
			
		||||
    /* LiDE 210 */
 | 
			
		||||
    {
 | 
			
		||||
        0x9f, 0x59, 0x01, 0x80, 0x5f, 0x01, 0x00
 | 
			
		||||
    },
 | 
			
		||||
    /* LiDE 120 */
 | 
			
		||||
    {
 | 
			
		||||
        0x9f, 0x53, 0x01, 0x80, 0x5f, 0x01, 0x00
 | 
			
		||||
    },
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/** @brief set all registers to default values .
 | 
			
		||||
 * This function is called only once at the beginning and
 | 
			
		||||
 * fills register startup values for registers reused across scans.
 | 
			
		||||
| 
						 | 
				
			
			@ -473,7 +504,7 @@ static void gl124_init_motor_regs_scan(Genesys_Device* dev,
 | 
			
		|||
                                       unsigned int scan_dummy,
 | 
			
		||||
                                       unsigned int feed_steps,
 | 
			
		||||
                                       ScanColorMode scan_mode,
 | 
			
		||||
                                       MotorFlag flags)
 | 
			
		||||
                                       ScanFlag flags)
 | 
			
		||||
{
 | 
			
		||||
    DBG_HELPER(dbg);
 | 
			
		||||
  int use_fast_fed;
 | 
			
		||||
| 
						 | 
				
			
			@ -548,15 +579,15 @@ static void gl124_init_motor_regs_scan(Genesys_Device* dev,
 | 
			
		|||
        r02 &= ~REG_0x02_FASTFED;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (has_flag(flags, MotorFlag::AUTO_GO_HOME)) {
 | 
			
		||||
    if (has_flag(flags, ScanFlag::AUTO_GO_HOME)) {
 | 
			
		||||
        r02 |= REG_0x02_AGOHOME;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (has_flag(flags, MotorFlag::DISABLE_BUFFER_FULL_MOVE) || (yres >= sensor.optical_res))
 | 
			
		||||
    if (has_flag(flags, ScanFlag::DISABLE_BUFFER_FULL_MOVE) || (yres >= sensor.optical_res))
 | 
			
		||||
    {
 | 
			
		||||
        r02 |= REG_0x02_ACDCDIS;
 | 
			
		||||
    }
 | 
			
		||||
    if (has_flag(flags, MotorFlag::REVERSE)) {
 | 
			
		||||
    if (has_flag(flags, ScanFlag::REVERSE)) {
 | 
			
		||||
        r02 |= REG_0x02_MTRREV;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -598,7 +629,7 @@ static void gl124_init_motor_regs_scan(Genesys_Device* dev,
 | 
			
		|||
    feedl <<= static_cast<unsigned>(motor_profile.step_type);
 | 
			
		||||
 | 
			
		||||
    dist = scan_table.steps_count;
 | 
			
		||||
    if (has_flag(flags, MotorFlag::FEED)) {
 | 
			
		||||
    if (has_flag(flags, ScanFlag::FEEDING)) {
 | 
			
		||||
        dist *= 2;
 | 
			
		||||
    }
 | 
			
		||||
    if (use_fast_fed) {
 | 
			
		||||
| 
						 | 
				
			
			@ -640,35 +671,6 @@ static void gl124_init_motor_regs_scan(Genesys_Device* dev,
 | 
			
		|||
    reg->set16(REG_FMOVDEC, fast_table.steps_count);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/** @brief copy sensor specific settings
 | 
			
		||||
 * Set up register set for the given sensor resolution. Values are from the device table
 | 
			
		||||
 * in genesys_devices.c for registers:
 | 
			
		||||
 *       [0x16 ... 0x1d]
 | 
			
		||||
 *       [0x52 ... 0x5e]
 | 
			
		||||
 * Other come from the specific device sensor table in genesys_gl124.h:
 | 
			
		||||
 *      0x18, 0x20, 0x61, 0x98 and
 | 
			
		||||
 * @param dev device to set up
 | 
			
		||||
 * @param regs register set to modify
 | 
			
		||||
 * @param dpi resolution of the sensor during scan
 | 
			
		||||
 * @param ccd_size_divisor flag for half ccd mode
 | 
			
		||||
 * */
 | 
			
		||||
static void gl124_setup_sensor(Genesys_Device* dev, const Genesys_Sensor& sensor,
 | 
			
		||||
                               Genesys_Register_Set* regs)
 | 
			
		||||
{
 | 
			
		||||
    DBG_HELPER(dbg);
 | 
			
		||||
 | 
			
		||||
    for (const auto& reg : sensor.custom_regs) {
 | 
			
		||||
        regs->set8(reg.address, reg.value);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    regs->set24(REG_EXPR, sensor.exposure.red);
 | 
			
		||||
    regs->set24(REG_EXPG, sensor.exposure.green);
 | 
			
		||||
    regs->set24(REG_EXPB, sensor.exposure.blue);
 | 
			
		||||
 | 
			
		||||
    dev->segment_order = sensor.segment_order;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** @brief setup optical related registers
 | 
			
		||||
 * start and pixels are expressed in optical sensor resolution coordinate
 | 
			
		||||
 * space.
 | 
			
		||||
| 
						 | 
				
			
			@ -692,7 +694,7 @@ static void gl124_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens
 | 
			
		|||
    DBG_HELPER_ARGS(dbg, "exposure_time=%d", exposure_time);
 | 
			
		||||
  uint32_t expmax;
 | 
			
		||||
 | 
			
		||||
    gl124_setup_sensor(dev, sensor, reg);
 | 
			
		||||
    scanner_setup_sensor(*dev, sensor, *reg);
 | 
			
		||||
 | 
			
		||||
    dev->cmd_set->set_fe(dev, sensor, AFE_SET);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -855,19 +857,9 @@ void CommandSetGl124::init_regs_for_scan_session(Genesys_Device* dev, const Gene
 | 
			
		|||
    move = session.params.starty;
 | 
			
		||||
  DBG(DBG_info, "%s: move=%d steps\n", __func__, move);
 | 
			
		||||
 | 
			
		||||
    MotorFlag mflags = MotorFlag::NONE;
 | 
			
		||||
    if (has_flag(session.params.flags, ScanFlag::DISABLE_BUFFER_FULL_MOVE)) {
 | 
			
		||||
        mflags |= MotorFlag::DISABLE_BUFFER_FULL_MOVE;
 | 
			
		||||
    }
 | 
			
		||||
    if (has_flag(session.params.flags, ScanFlag::FEEDING)) {
 | 
			
		||||
        mflags |= MotorFlag::FEED;
 | 
			
		||||
    }
 | 
			
		||||
    if (has_flag(session.params.flags, ScanFlag::REVERSE)) {
 | 
			
		||||
        mflags |= MotorFlag::REVERSE;
 | 
			
		||||
    }
 | 
			
		||||
    gl124_init_motor_regs_scan(dev, sensor, reg, motor_profile, exposure_time, slope_dpi,
 | 
			
		||||
                               session.optical_line_count,
 | 
			
		||||
                               dummy, move, session.params.scan_mode, mflags);
 | 
			
		||||
                               dummy, move, session.params.scan_mode, session.params.flags);
 | 
			
		||||
 | 
			
		||||
  /*** prepares data reordering ***/
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1511,10 +1503,5 @@ void CommandSetGl124::move_to_ta(Genesys_Device* dev) const
 | 
			
		|||
    throw SaneException("not implemented");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
std::unique_ptr<CommandSet> create_gl124_cmd_set()
 | 
			
		||||
{
 | 
			
		||||
    return std::unique_ptr<CommandSet>(new CommandSetGl124{});
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
} // namespace gl124
 | 
			
		||||
} // namespace genesys
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -50,39 +50,6 @@
 | 
			
		|||
namespace genesys {
 | 
			
		||||
namespace gl124 {
 | 
			
		||||
 | 
			
		||||
typedef struct
 | 
			
		||||
{
 | 
			
		||||
  uint8_t r31;
 | 
			
		||||
  uint8_t r32;
 | 
			
		||||
  uint8_t r33;
 | 
			
		||||
  uint8_t r34;
 | 
			
		||||
  uint8_t r35;
 | 
			
		||||
  uint8_t r36;
 | 
			
		||||
  uint8_t r38;
 | 
			
		||||
} Gpio_layout;
 | 
			
		||||
 | 
			
		||||
/** @brief gpio layout
 | 
			
		||||
 * describes initial gpio settings for a given model
 | 
			
		||||
 * registers 0x31 to 0x38
 | 
			
		||||
 */
 | 
			
		||||
static Gpio_layout gpios[]={
 | 
			
		||||
	/* LiDE 110 */
 | 
			
		||||
	{ /*    0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x38 */
 | 
			
		||||
		0x9f, 0x59, 0x01, 0x80, 0x5f, 0x01, 0x00
 | 
			
		||||
	},
 | 
			
		||||
	/* LiDE 210 */
 | 
			
		||||
	{
 | 
			
		||||
		0x9f, 0x59, 0x01, 0x80, 0x5f, 0x01, 0x00
 | 
			
		||||
	},
 | 
			
		||||
	/* LiDE 120 */
 | 
			
		||||
	{
 | 
			
		||||
		0x9f, 0x53, 0x01, 0x80, 0x5f, 0x01, 0x00
 | 
			
		||||
	},
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static void gl124_send_slope_table(Genesys_Device* dev, int table_nr,
 | 
			
		||||
                                   const std::vector<uint16_t>& slope_table, int steps);
 | 
			
		||||
 | 
			
		||||
class CommandSetGl124 : public CommandSetCommon
 | 
			
		||||
{
 | 
			
		||||
public:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -66,6 +66,379 @@ constexpr unsigned CALIBRATION_LINES = 10;
 | 
			
		|||
static void gl646_send_slope_table(Genesys_Device* dev, int table_nr,
 | 
			
		||||
                                   const std::vector<uint16_t>& slope_table,
 | 
			
		||||
                                   int steps);
 | 
			
		||||
static void write_control(Genesys_Device* dev, const Genesys_Sensor& sensor, int resolution);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static void gl646_set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t set, int dpi);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * sets up the scanner for a scan, registers, gamma tables, shading tables
 | 
			
		||||
 * and slope tables, based on the parameter struct.
 | 
			
		||||
 * @param dev         device to set up
 | 
			
		||||
 * @param regs        registers to set up
 | 
			
		||||
 * @param settings    settings of the scan
 | 
			
		||||
 * @param split       true if move before scan has to be done
 | 
			
		||||
 * @param xcorrection true if scanner's X geometry must be taken into account to
 | 
			
		||||
 * 		     compute X, ie add left margins
 | 
			
		||||
 * @param ycorrection true if scanner's Y geometry must be taken into account to
 | 
			
		||||
 * 		     compute Y, ie add top margins
 | 
			
		||||
 */
 | 
			
		||||
static ScanSession setup_for_scan(Genesys_Device* device,
 | 
			
		||||
                                  const Genesys_Sensor& sensor,
 | 
			
		||||
                                  Genesys_Register_Set*regs,
 | 
			
		||||
                                  Genesys_Settings settings,
 | 
			
		||||
                                  bool split,
 | 
			
		||||
                                  bool xcorrection,
 | 
			
		||||
                                  bool ycorrection,
 | 
			
		||||
                                  bool reverse);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Does a simple move of the given distance by doing a scan at lowest resolution
 | 
			
		||||
 * shading correction. Memory for data is allocated in this function
 | 
			
		||||
 * and must be freed by caller.
 | 
			
		||||
 * @param dev device of the scanner
 | 
			
		||||
 * @param distance distance to move in MM
 | 
			
		||||
 */
 | 
			
		||||
static void simple_move(Genesys_Device* dev, SANE_Int distance);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Does a simple scan of the area given by the settings. Scanned data
 | 
			
		||||
 * it put in an allocated area which must be freed by the caller.
 | 
			
		||||
 * and slope tables, based on the parameter struct. There is no shading
 | 
			
		||||
 * correction while gamma correction is active.
 | 
			
		||||
 * @param dev      device to set up
 | 
			
		||||
 * @param settings settings of the scan
 | 
			
		||||
 * @param move     flag to enable scanhead to move
 | 
			
		||||
 * @param forward  flag to tell movement direction
 | 
			
		||||
 * @param shading  flag to tell if shading correction should be done
 | 
			
		||||
 * @param data     pointer that will point to the scanned data
 | 
			
		||||
 */
 | 
			
		||||
static void simple_scan(Genesys_Device* dev, const Genesys_Sensor& sensor,
 | 
			
		||||
                        Genesys_Settings settings, bool move, bool forward,
 | 
			
		||||
                        bool shading, std::vector<uint8_t>& data, const char* test_identifier);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Send the stop scan command
 | 
			
		||||
 * */
 | 
			
		||||
static void end_scan_impl(Genesys_Device* dev, Genesys_Register_Set* reg, bool check_stop,
 | 
			
		||||
                          bool eject);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * master motor settings table entry
 | 
			
		||||
 */
 | 
			
		||||
struct Motor_Master
 | 
			
		||||
{
 | 
			
		||||
    MotorId motor_id;
 | 
			
		||||
    unsigned dpi;
 | 
			
		||||
    unsigned channels;
 | 
			
		||||
 | 
			
		||||
    // settings
 | 
			
		||||
    StepType steptype;
 | 
			
		||||
    bool fastmod; // fast scanning
 | 
			
		||||
    bool fastfed; // fast fed slope tables
 | 
			
		||||
    SANE_Int mtrpwm;
 | 
			
		||||
    MotorSlope slope1;
 | 
			
		||||
    MotorSlope slope2;
 | 
			
		||||
    SANE_Int fwdbwd; // forward/backward steps
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * master motor settings, for a given motor and dpi,
 | 
			
		||||
 * it gives steps and speed informations
 | 
			
		||||
 */
 | 
			
		||||
static Motor_Master motor_master[] = {
 | 
			
		||||
    /* HP3670 motor settings */
 | 
			
		||||
    {MotorId::HP3670, 50, 3, StepType::HALF, false, true, 1,
 | 
			
		||||
     MotorSlope::create_from_steps(2329, 120, 229),
 | 
			
		||||
     MotorSlope::create_from_steps(3399, 337, 192), 192},
 | 
			
		||||
 | 
			
		||||
    {MotorId::HP3670, 75, 3, StepType::FULL, false, true, 1,
 | 
			
		||||
     MotorSlope::create_from_steps(3429, 305, 200),
 | 
			
		||||
     MotorSlope::create_from_steps(3399, 337, 192), 192},
 | 
			
		||||
 | 
			
		||||
    {MotorId::HP3670, 100, 3, StepType::HALF, false, true, 1,
 | 
			
		||||
     MotorSlope::create_from_steps(2905, 187, 143),
 | 
			
		||||
     MotorSlope::create_from_steps(3399, 337, 192), 192},
 | 
			
		||||
 | 
			
		||||
    {MotorId::HP3670, 150, 3, StepType::HALF, false, true, 1,
 | 
			
		||||
     MotorSlope::create_from_steps(3429, 305, 73),
 | 
			
		||||
     MotorSlope::create_from_steps(3399, 337, 192), 192},
 | 
			
		||||
 | 
			
		||||
    {MotorId::HP3670, 300, 3, StepType::HALF, false, true, 1,
 | 
			
		||||
     MotorSlope::create_from_steps(1055, 563, 11),
 | 
			
		||||
     MotorSlope::create_from_steps(3399, 337, 192), 192},
 | 
			
		||||
 | 
			
		||||
    {MotorId::HP3670, 600, 3, StepType::FULL, false, true, 0,
 | 
			
		||||
     MotorSlope::create_from_steps(10687, 5126, 3),
 | 
			
		||||
     MotorSlope::create_from_steps(3399, 337, 192), 192},
 | 
			
		||||
 | 
			
		||||
    {MotorId::HP3670,1200, 3, StepType::HALF, false, true, 0,
 | 
			
		||||
     MotorSlope::create_from_steps(15937, 6375, 3),
 | 
			
		||||
     MotorSlope::create_from_steps(3399, 337, 192), 192},
 | 
			
		||||
 | 
			
		||||
    {MotorId::HP3670, 50, 1, StepType::HALF, false, true, 1,
 | 
			
		||||
     MotorSlope::create_from_steps(2329, 120, 229),
 | 
			
		||||
     MotorSlope::create_from_steps(3399, 337, 192), 192},
 | 
			
		||||
 | 
			
		||||
    {MotorId::HP3670, 75, 1, StepType::FULL, false, true, 1,
 | 
			
		||||
     MotorSlope::create_from_steps(3429, 305, 200),
 | 
			
		||||
     MotorSlope::create_from_steps(3399, 337, 192), 192},
 | 
			
		||||
 | 
			
		||||
    {MotorId::HP3670, 100, 1, StepType::HALF, false, true, 1,
 | 
			
		||||
     MotorSlope::create_from_steps(2905, 187, 143),
 | 
			
		||||
     MotorSlope::create_from_steps(3399, 337, 192), 192},
 | 
			
		||||
 | 
			
		||||
    {MotorId::HP3670, 150, 1, StepType::HALF, false, true, 1,
 | 
			
		||||
     MotorSlope::create_from_steps(3429, 305, 73),
 | 
			
		||||
     MotorSlope::create_from_steps(3399, 337, 192), 192},
 | 
			
		||||
 | 
			
		||||
    {MotorId::HP3670, 300, 1, StepType::HALF, false, true, 1,
 | 
			
		||||
     MotorSlope::create_from_steps(1055, 563, 11),
 | 
			
		||||
     MotorSlope::create_from_steps(3399, 337, 192), 192},
 | 
			
		||||
 | 
			
		||||
    {MotorId::HP3670, 600, 1, StepType::FULL, false, true, 0,
 | 
			
		||||
     MotorSlope::create_from_steps(10687, 5126, 3),
 | 
			
		||||
     MotorSlope::create_from_steps(3399, 337, 192), 192},
 | 
			
		||||
 | 
			
		||||
    {MotorId::HP3670,1200, 1, StepType::HALF, false, true, 0,
 | 
			
		||||
     MotorSlope::create_from_steps(15937, 6375, 3),
 | 
			
		||||
     MotorSlope::create_from_steps(3399, 337, 192), 192},
 | 
			
		||||
 | 
			
		||||
    /* HP2400/G2410 motor settings base motor dpi = 600 */
 | 
			
		||||
    {MotorId::HP2400, 50, 3, StepType::FULL, false, true, 63,
 | 
			
		||||
     MotorSlope::create_from_steps(8736, 601, 120),
 | 
			
		||||
     MotorSlope::create_from_steps(4905, 337, 192), 192},
 | 
			
		||||
 | 
			
		||||
    {MotorId::HP2400, 100, 3, StepType::HALF, false, true, 63,
 | 
			
		||||
     MotorSlope::create_from_steps(8736, 601, 120),
 | 
			
		||||
     MotorSlope::create_from_steps(4905, 337, 192), 192},
 | 
			
		||||
 | 
			
		||||
    {MotorId::HP2400, 150, 3, StepType::HALF, false, true, 63,
 | 
			
		||||
     MotorSlope::create_from_steps(15902, 902, 67),
 | 
			
		||||
     MotorSlope::create_from_steps(4905, 337, 192), 192},
 | 
			
		||||
 | 
			
		||||
    {MotorId::HP2400, 300, 3, StepType::HALF, false, true, 63,
 | 
			
		||||
     MotorSlope::create_from_steps(16703, 2188, 32),
 | 
			
		||||
     MotorSlope::create_from_steps(4905, 337, 192), 192},
 | 
			
		||||
 | 
			
		||||
    {MotorId::HP2400, 600, 3, StepType::FULL, false, true, 63,
 | 
			
		||||
     MotorSlope::create_from_steps(18761, 18761, 3),
 | 
			
		||||
     MotorSlope::create_from_steps(4905, 627, 192), 192},
 | 
			
		||||
 | 
			
		||||
    {MotorId::HP2400,1200, 3, StepType::HALF, false, true, 63,
 | 
			
		||||
     MotorSlope::create_from_steps(43501, 43501, 3),
 | 
			
		||||
     MotorSlope::create_from_steps(4905, 627, 192), 192},
 | 
			
		||||
 | 
			
		||||
    {MotorId::HP2400, 50, 1, StepType::FULL, false, true, 63,
 | 
			
		||||
     MotorSlope::create_from_steps(8736, 601, 120),
 | 
			
		||||
     MotorSlope::create_from_steps(4905, 337, 192), 192},
 | 
			
		||||
 | 
			
		||||
    {MotorId::HP2400, 100, 1, StepType::HALF, false, true, 63,
 | 
			
		||||
     MotorSlope::create_from_steps(8736, 601, 120),
 | 
			
		||||
     MotorSlope::create_from_steps(4905, 337, 192), 192},
 | 
			
		||||
 | 
			
		||||
    {MotorId::HP2400, 150, 1, StepType::HALF, false, true, 63,
 | 
			
		||||
     MotorSlope::create_from_steps(15902, 902, 67),
 | 
			
		||||
     MotorSlope::create_from_steps(4905, 337, 192), 192},
 | 
			
		||||
 | 
			
		||||
    {MotorId::HP2400, 300, 1, StepType::HALF, false, true, 63,
 | 
			
		||||
     MotorSlope::create_from_steps(16703, 2188, 32),
 | 
			
		||||
     MotorSlope::create_from_steps(4905, 337, 192), 192},
 | 
			
		||||
 | 
			
		||||
    {MotorId::HP2400, 600, 1, StepType::FULL, false, true, 63,
 | 
			
		||||
     MotorSlope::create_from_steps(18761, 18761, 3),
 | 
			
		||||
     MotorSlope::create_from_steps(4905, 337, 192), 192},
 | 
			
		||||
 | 
			
		||||
    {MotorId::HP2400,1200, 1, StepType::HALF, false, true, 63,
 | 
			
		||||
     MotorSlope::create_from_steps(43501, 43501, 3),
 | 
			
		||||
     MotorSlope::create_from_steps(4905, 337, 192), 192},
 | 
			
		||||
 | 
			
		||||
    /* XP 200 motor settings */
 | 
			
		||||
    {MotorId::XP200, 75, 3, StepType::HALF, true, false, 0,
 | 
			
		||||
     MotorSlope::create_from_steps(6000, 2136, 4),
 | 
			
		||||
     MotorSlope::create_from_steps(12000, 1200, 8), 1},
 | 
			
		||||
 | 
			
		||||
    {MotorId::XP200, 100, 3, StepType::HALF, true, false, 0,
 | 
			
		||||
     MotorSlope::create_from_steps(6000, 2850, 4),
 | 
			
		||||
     MotorSlope::create_from_steps(12000, 1200, 8), 1},
 | 
			
		||||
 | 
			
		||||
    {MotorId::XP200, 200, 3, StepType::HALF, true, false, 0,
 | 
			
		||||
     MotorSlope::create_from_steps(6999, 5700, 4),
 | 
			
		||||
     MotorSlope::create_from_steps(12000, 1200, 8), 1},
 | 
			
		||||
 | 
			
		||||
    {MotorId::XP200, 250, 3, StepType::HALF, true, false, 0,
 | 
			
		||||
     MotorSlope::create_from_steps(6999, 6999, 4),
 | 
			
		||||
     MotorSlope::create_from_steps(12000, 1200, 8), 1},
 | 
			
		||||
 | 
			
		||||
    {MotorId::XP200, 300, 3, StepType::HALF, true, false, 0,
 | 
			
		||||
     MotorSlope::create_from_steps(13500, 13500, 4),
 | 
			
		||||
     MotorSlope::create_from_steps(12000, 1200, 8), 1},
 | 
			
		||||
 | 
			
		||||
    {MotorId::XP200, 600, 3, StepType::HALF, true, true, 0,
 | 
			
		||||
     MotorSlope::create_from_steps(31998, 31998, 4),
 | 
			
		||||
     MotorSlope::create_from_steps(12000, 1200, 2), 1},
 | 
			
		||||
 | 
			
		||||
    {MotorId::XP200, 75, 1, StepType::HALF, true, false, 0,
 | 
			
		||||
     MotorSlope::create_from_steps(6000, 2000, 4),
 | 
			
		||||
     MotorSlope::create_from_steps(12000, 1200, 8), 1},
 | 
			
		||||
 | 
			
		||||
    {MotorId::XP200, 100, 1, StepType::HALF, true, false, 0,
 | 
			
		||||
     MotorSlope::create_from_steps(6000, 1300, 4),
 | 
			
		||||
     MotorSlope::create_from_steps(12000, 1200, 8), 1},
 | 
			
		||||
 | 
			
		||||
    {MotorId::XP200, 200, 1, StepType::HALF, true, true, 0,
 | 
			
		||||
     MotorSlope::create_from_steps(6000, 3666, 4),
 | 
			
		||||
     MotorSlope::create_from_steps(12000, 1200, 8), 1},
 | 
			
		||||
 | 
			
		||||
    {MotorId::XP200, 300, 1, StepType::HALF, true, false, 0,
 | 
			
		||||
     MotorSlope::create_from_steps(6500, 6500, 4),
 | 
			
		||||
     MotorSlope::create_from_steps(12000, 1200, 8), 1},
 | 
			
		||||
 | 
			
		||||
    {MotorId::XP200, 600, 1, StepType::HALF, true, true, 0,
 | 
			
		||||
     MotorSlope::create_from_steps(24000, 24000, 4),
 | 
			
		||||
     MotorSlope::create_from_steps(12000, 1200, 2), 1},
 | 
			
		||||
 | 
			
		||||
    /* HP scanjet 2300c */
 | 
			
		||||
    {MotorId::HP2300, 75, 3, StepType::FULL, false, true, 63,
 | 
			
		||||
     MotorSlope::create_from_steps(8139, 560, 120),
 | 
			
		||||
     MotorSlope::create_from_steps(4905, 337, 120), 16},
 | 
			
		||||
 | 
			
		||||
    {MotorId::HP2300, 150, 3, StepType::HALF, false, true, 63,
 | 
			
		||||
     MotorSlope::create_from_steps(7903, 543, 67),
 | 
			
		||||
     MotorSlope::create_from_steps(4905, 337, 120), 16},
 | 
			
		||||
 | 
			
		||||
    {MotorId::HP2300, 300, 3, StepType::HALF, false, true, 63,
 | 
			
		||||
     MotorSlope::create_from_steps(2175, 1087, 3),
 | 
			
		||||
     MotorSlope::create_from_steps(4905, 337, 120), 16},
 | 
			
		||||
 | 
			
		||||
    {MotorId::HP2300, 600, 3, StepType::HALF, false, true, 63,
 | 
			
		||||
     MotorSlope::create_from_steps(8700, 4350, 3),
 | 
			
		||||
     MotorSlope::create_from_steps(4905, 337, 120), 16},
 | 
			
		||||
 | 
			
		||||
    {MotorId::HP2300,1200, 3, StepType::HALF, false, true, 63,
 | 
			
		||||
     MotorSlope::create_from_steps(17400, 8700, 3),
 | 
			
		||||
     MotorSlope::create_from_steps(4905, 337, 120), 16},
 | 
			
		||||
 | 
			
		||||
    {MotorId::HP2300, 75, 1, StepType::FULL, false, true, 63,
 | 
			
		||||
     MotorSlope::create_from_steps(8139, 560, 120),
 | 
			
		||||
     MotorSlope::create_from_steps(4905, 337, 120), 16},
 | 
			
		||||
 | 
			
		||||
    {MotorId::HP2300, 150, 1, StepType::HALF, false, true, 63,
 | 
			
		||||
     MotorSlope::create_from_steps(7903, 543, 67),
 | 
			
		||||
     MotorSlope::create_from_steps(4905, 337, 120), 16},
 | 
			
		||||
 | 
			
		||||
    {MotorId::HP2300, 300, 1, StepType::HALF, false, true, 63,
 | 
			
		||||
     MotorSlope::create_from_steps(2175, 1087, 3),
 | 
			
		||||
     MotorSlope::create_from_steps(4905, 337, 120), 16},
 | 
			
		||||
 | 
			
		||||
    {MotorId::HP2300, 600, 1, StepType::HALF, false, true, 63,
 | 
			
		||||
     MotorSlope::create_from_steps(8700, 4350, 3),
 | 
			
		||||
     MotorSlope::create_from_steps(4905, 337, 120), 16},
 | 
			
		||||
 | 
			
		||||
    {MotorId::HP2300,1200, 1, StepType::HALF, false, true, 63,
 | 
			
		||||
     MotorSlope::create_from_steps(17400, 8700, 3),
 | 
			
		||||
     MotorSlope::create_from_steps(4905, 337, 120), 16},
 | 
			
		||||
 | 
			
		||||
    /* non half ccd settings for 300 dpi
 | 
			
		||||
    {MotorId::HP2300, 300, 3, StepType::HALF, false, true, 63,
 | 
			
		||||
     MotorSlope::create_from_steps(5386, 2175, 44),
 | 
			
		||||
     MotorSlope::create_from_steps(4905, 337, 120), 16},
 | 
			
		||||
 | 
			
		||||
    {MotorId::HP2300, 300, 1, StepType::HALF, false, true, 63,
 | 
			
		||||
     MotorSlope::create_from_steps(5386, 2175, 44),
 | 
			
		||||
     MotorSlope::create_from_steps(4905, 337, 120), 16},
 | 
			
		||||
    */
 | 
			
		||||
 | 
			
		||||
    /* MD5345/6471 motor settings */
 | 
			
		||||
    /* vfinal=(exposure/(1200/dpi))/step_type */
 | 
			
		||||
    {MotorId::MD_5345, 50, 3, StepType::HALF, false, true, 2,
 | 
			
		||||
     MotorSlope::create_from_steps(2500, 250, 255),
 | 
			
		||||
     MotorSlope::create_from_steps(2000, 300, 255), 64},
 | 
			
		||||
 | 
			
		||||
    {MotorId::MD_5345, 75, 3, StepType::HALF, false, true, 2,
 | 
			
		||||
     MotorSlope::create_from_steps(2500, 343, 255),
 | 
			
		||||
     MotorSlope::create_from_steps(2000, 300, 255), 64},
 | 
			
		||||
 | 
			
		||||
    {MotorId::MD_5345, 100, 3, StepType::HALF, false, true, 2,
 | 
			
		||||
     MotorSlope::create_from_steps(2500, 458, 255),
 | 
			
		||||
     MotorSlope::create_from_steps(2000, 300, 255), 64},
 | 
			
		||||
 | 
			
		||||
    {MotorId::MD_5345, 150, 3, StepType::HALF, false, true, 2,
 | 
			
		||||
     MotorSlope::create_from_steps(2500, 687, 255),
 | 
			
		||||
     MotorSlope::create_from_steps(2000, 300, 255), 64},
 | 
			
		||||
 | 
			
		||||
    {MotorId::MD_5345, 200, 3, StepType::HALF, false, true, 2,
 | 
			
		||||
     MotorSlope::create_from_steps(2500, 916, 255),
 | 
			
		||||
     MotorSlope::create_from_steps(2000, 300, 255), 64},
 | 
			
		||||
 | 
			
		||||
    {MotorId::MD_5345, 300, 3, StepType::HALF, false, true, 2,
 | 
			
		||||
     MotorSlope::create_from_steps(2500, 1375, 255),
 | 
			
		||||
     MotorSlope::create_from_steps(2000, 300, 255), 64},
 | 
			
		||||
 | 
			
		||||
    {MotorId::MD_5345, 400, 3, StepType::HALF, false, true, 0,
 | 
			
		||||
     MotorSlope::create_from_steps(2000, 1833, 32),
 | 
			
		||||
     MotorSlope::create_from_steps(2000, 300, 255), 32},
 | 
			
		||||
 | 
			
		||||
    {MotorId::MD_5345, 500, 3, StepType::HALF, false, true, 0,
 | 
			
		||||
     MotorSlope::create_from_steps(2291, 2291, 32),
 | 
			
		||||
     MotorSlope::create_from_steps(2000, 300, 255), 32},
 | 
			
		||||
 | 
			
		||||
    {MotorId::MD_5345, 600, 3, StepType::HALF, false, true, 0,
 | 
			
		||||
     MotorSlope::create_from_steps(2750, 2750, 32),
 | 
			
		||||
     MotorSlope::create_from_steps(2000, 300, 255), 32},
 | 
			
		||||
 | 
			
		||||
    {MotorId::MD_5345, 1200, 3, StepType::QUARTER, false, true, 0,
 | 
			
		||||
     MotorSlope::create_from_steps(2750, 2750, 16),
 | 
			
		||||
     MotorSlope::create_from_steps(2000, 300, 255), 146},
 | 
			
		||||
 | 
			
		||||
    {MotorId::MD_5345, 2400, 3, StepType::QUARTER, false, true, 0,
 | 
			
		||||
     MotorSlope::create_from_steps(5500, 5500, 16),
 | 
			
		||||
     MotorSlope::create_from_steps(2000, 300, 255), 146},
 | 
			
		||||
 | 
			
		||||
    {MotorId::MD_5345, 50, 1, StepType::HALF, false, true, 2,
 | 
			
		||||
     MotorSlope::create_from_steps(2500, 250, 255),
 | 
			
		||||
     MotorSlope::create_from_steps(2000, 300, 255), 64},
 | 
			
		||||
 | 
			
		||||
    {MotorId::MD_5345, 75, 1, StepType::HALF, false, true, 2,
 | 
			
		||||
     MotorSlope::create_from_steps(2500, 343, 255),
 | 
			
		||||
     MotorSlope::create_from_steps(2000, 300, 255), 64},
 | 
			
		||||
 | 
			
		||||
    {MotorId::MD_5345, 100, 1, StepType::HALF, false, true, 2,
 | 
			
		||||
     MotorSlope::create_from_steps(2500, 458, 255),
 | 
			
		||||
     MotorSlope::create_from_steps(2000, 300, 255), 64},
 | 
			
		||||
 | 
			
		||||
    {MotorId::MD_5345, 150, 1, StepType::HALF, false, true, 2,
 | 
			
		||||
     MotorSlope::create_from_steps(2500, 687, 255),
 | 
			
		||||
     MotorSlope::create_from_steps(2000, 300, 255), 64},
 | 
			
		||||
 | 
			
		||||
    {MotorId::MD_5345, 200, 1, StepType::HALF, false, true, 2,
 | 
			
		||||
     MotorSlope::create_from_steps(2500, 916, 255),
 | 
			
		||||
     MotorSlope::create_from_steps(2000, 300, 255), 64},
 | 
			
		||||
 | 
			
		||||
    {MotorId::MD_5345, 300, 1, StepType::HALF, false, true, 2,
 | 
			
		||||
     MotorSlope::create_from_steps(2500, 1375, 255),
 | 
			
		||||
     MotorSlope::create_from_steps(2000, 300, 255), 64},
 | 
			
		||||
 | 
			
		||||
    {MotorId::MD_5345, 400, 1, StepType::HALF, false, true, 0,
 | 
			
		||||
     MotorSlope::create_from_steps(2000, 1833, 32),
 | 
			
		||||
     MotorSlope::create_from_steps(2000, 300, 255), 32},
 | 
			
		||||
 | 
			
		||||
    {MotorId::MD_5345, 500, 1, StepType::HALF, false, true, 0,
 | 
			
		||||
     MotorSlope::create_from_steps(2291, 2291, 32),
 | 
			
		||||
     MotorSlope::create_from_steps(2000, 300, 255), 32},
 | 
			
		||||
 | 
			
		||||
    {MotorId::MD_5345, 600, 1, StepType::HALF, false, true, 0,
 | 
			
		||||
     MotorSlope::create_from_steps(2750, 2750, 32),
 | 
			
		||||
     MotorSlope::create_from_steps(2000, 300, 255), 32},
 | 
			
		||||
 | 
			
		||||
    {MotorId::MD_5345, 1200, 1, StepType::QUARTER, false, true, 0,
 | 
			
		||||
     MotorSlope::create_from_steps(2750, 2750, 16),
 | 
			
		||||
     MotorSlope::create_from_steps(2000, 300, 255), 146},
 | 
			
		||||
 | 
			
		||||
    {MotorId::MD_5345, 2400, 1, StepType::QUARTER, false, true, 0,
 | 
			
		||||
     MotorSlope::create_from_steps(5500, 5500, 16),
 | 
			
		||||
     MotorSlope::create_from_steps(2000, 300, 255), 146}, /* 5500 guessed */
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * reads value from gpio endpoint
 | 
			
		||||
| 
						 | 
				
			
			@ -546,30 +919,6 @@ void CommandSetGl646::init_regs_for_scan_session(Genesys_Device* dev, const Gene
 | 
			
		|||
    gl646_send_slope_table(dev, 1, slope_table2.table, regs->get8(0x6b));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/** copy sensor specific settings */
 | 
			
		||||
/* *dev  : device infos
 | 
			
		||||
   *regs : regiters to be set
 | 
			
		||||
   extended : do extended set up
 | 
			
		||||
   ccd_size_divisor: set up for half ccd resolution
 | 
			
		||||
   all registers 08-0B, 10-1D, 52-5E are set up. They shouldn't
 | 
			
		||||
   appear anywhere else but in register init
 | 
			
		||||
*/
 | 
			
		||||
static void
 | 
			
		||||
gl646_setup_sensor (Genesys_Device * dev, const Genesys_Sensor& sensor, Genesys_Register_Set * regs)
 | 
			
		||||
{
 | 
			
		||||
    (void) dev;
 | 
			
		||||
    DBG(DBG_proc, "%s: start\n", __func__);
 | 
			
		||||
 | 
			
		||||
    for (const auto& reg_setting : sensor.custom_base_regs) {
 | 
			
		||||
        regs->set8(reg_setting.address, reg_setting.value);
 | 
			
		||||
    }
 | 
			
		||||
    // FIXME: all other drivers don't set exposure here
 | 
			
		||||
    regs_set_exposure(AsicType::GL646, *regs, sensor.exposure);
 | 
			
		||||
 | 
			
		||||
    DBG(DBG_proc, "%s: end\n", __func__);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Set all registers to default values after init
 | 
			
		||||
 * @param dev scannerr's device to set
 | 
			
		||||
| 
						 | 
				
			
			@ -643,8 +992,7 @@ gl646_init_regs (Genesys_Device * dev)
 | 
			
		|||
        dev->reg.find_reg(0x06).value = 0x18; // PWRBIT on, shading gain=8, normal AFE image capture
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  gl646_setup_sensor(dev, sensor, &dev->reg);
 | 
			
		||||
    scanner_setup_sensor(*dev, sensor, dev->reg);
 | 
			
		||||
 | 
			
		||||
  dev->reg.find_reg(0x1e).value = 0xf0;	/* watch-dog time */
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -3137,10 +3485,5 @@ void CommandSetGl646::asic_boot(Genesys_Device *dev, bool cold) const
 | 
			
		|||
    throw SaneException("not implemented");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
std::unique_ptr<CommandSet> create_gl646_cmd_set()
 | 
			
		||||
{
 | 
			
		||||
    return std::unique_ptr<CommandSet>(new CommandSetGl646{});
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
} // namespace gl646
 | 
			
		||||
} // namespace genesys
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -54,388 +54,6 @@
 | 
			
		|||
namespace genesys {
 | 
			
		||||
namespace gl646 {
 | 
			
		||||
 | 
			
		||||
static void gl646_set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t set, int dpi);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * sets up the scanner for a scan, registers, gamma tables, shading tables
 | 
			
		||||
 * and slope tables, based on the parameter struct.
 | 
			
		||||
 * @param dev         device to set up
 | 
			
		||||
 * @param regs        registers to set up
 | 
			
		||||
 * @param settings    settings of the scan
 | 
			
		||||
 * @param split       true if move before scan has to be done
 | 
			
		||||
 * @param xcorrection true if scanner's X geometry must be taken into account to
 | 
			
		||||
 * 		     compute X, ie add left margins
 | 
			
		||||
 * @param ycorrection true if scanner's Y geometry must be taken into account to
 | 
			
		||||
 * 		     compute Y, ie add top margins
 | 
			
		||||
 */
 | 
			
		||||
static ScanSession setup_for_scan(Genesys_Device* device,
 | 
			
		||||
                                  const Genesys_Sensor& sensor,
 | 
			
		||||
                                  Genesys_Register_Set*regs,
 | 
			
		||||
                                  Genesys_Settings settings,
 | 
			
		||||
                                  bool split,
 | 
			
		||||
                                  bool xcorrection,
 | 
			
		||||
                                  bool ycorrection,
 | 
			
		||||
                                  bool reverse);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Does a simple move of the given distance by doing a scan at lowest resolution
 | 
			
		||||
 * shading correction. Memory for data is allocated in this function
 | 
			
		||||
 * and must be freed by caller.
 | 
			
		||||
 * @param dev device of the scanner
 | 
			
		||||
 * @param distance distance to move in MM
 | 
			
		||||
 */
 | 
			
		||||
static void simple_move(Genesys_Device* dev, SANE_Int distance);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Does a simple scan of the area given by the settings. Scanned data
 | 
			
		||||
 * it put in an allocated area which must be freed by the caller.
 | 
			
		||||
 * and slope tables, based on the parameter struct. There is no shading
 | 
			
		||||
 * correction while gamma correction is active.
 | 
			
		||||
 * @param dev      device to set up
 | 
			
		||||
 * @param settings settings of the scan
 | 
			
		||||
 * @param move     flag to enable scanhead to move
 | 
			
		||||
 * @param forward  flag to tell movement direction
 | 
			
		||||
 * @param shading  flag to tell if shading correction should be done
 | 
			
		||||
 * @param data     pointer that will point to the scanned data
 | 
			
		||||
 */
 | 
			
		||||
static void simple_scan(Genesys_Device* dev, const Genesys_Sensor& sensor,
 | 
			
		||||
                        Genesys_Settings settings, bool move, bool forward,
 | 
			
		||||
                        bool shading, std::vector<uint8_t>& data, const char* test_identifier);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Send the stop scan command
 | 
			
		||||
 * */
 | 
			
		||||
static void end_scan_impl(Genesys_Device* dev, Genesys_Register_Set* reg, bool check_stop,
 | 
			
		||||
                          bool eject);
 | 
			
		||||
/**
 | 
			
		||||
 * writes control data to an area behind the last motor table.
 | 
			
		||||
 */
 | 
			
		||||
static void write_control(Genesys_Device* dev, const Genesys_Sensor& sensor, int resolution);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * initialize scanner's registers at SANE init time
 | 
			
		||||
 */
 | 
			
		||||
static void gl646_init_regs (Genesys_Device * dev);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * master motor settings table entry
 | 
			
		||||
 */
 | 
			
		||||
typedef struct
 | 
			
		||||
{
 | 
			
		||||
  /* key */
 | 
			
		||||
    MotorId motor_id;
 | 
			
		||||
    unsigned dpi;
 | 
			
		||||
  unsigned channels;
 | 
			
		||||
 | 
			
		||||
  /* settings */
 | 
			
		||||
    StepType steptype;
 | 
			
		||||
    bool fastmod; // fast scanning
 | 
			
		||||
    bool fastfed; // fast fed slope tables
 | 
			
		||||
  SANE_Int mtrpwm;
 | 
			
		||||
    MotorSlope slope1;
 | 
			
		||||
    MotorSlope slope2;
 | 
			
		||||
  SANE_Int fwdbwd;		/* forward/backward steps */
 | 
			
		||||
} Motor_Master;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * master motor settings, for a given motor and dpi,
 | 
			
		||||
 * it gives steps and speed informations
 | 
			
		||||
 */
 | 
			
		||||
static Motor_Master motor_master[] = {
 | 
			
		||||
    /* HP3670 motor settings */
 | 
			
		||||
    {MotorId::HP3670, 50, 3, StepType::HALF, false, true, 1,
 | 
			
		||||
     MotorSlope::create_from_steps(2329, 120, 229),
 | 
			
		||||
     MotorSlope::create_from_steps(3399, 337, 192), 192},
 | 
			
		||||
 | 
			
		||||
    {MotorId::HP3670, 75, 3, StepType::FULL, false, true, 1,
 | 
			
		||||
     MotorSlope::create_from_steps(3429, 305, 200),
 | 
			
		||||
     MotorSlope::create_from_steps(3399, 337, 192), 192},
 | 
			
		||||
 | 
			
		||||
    {MotorId::HP3670, 100, 3, StepType::HALF, false, true, 1,
 | 
			
		||||
     MotorSlope::create_from_steps(2905, 187, 143),
 | 
			
		||||
     MotorSlope::create_from_steps(3399, 337, 192), 192},
 | 
			
		||||
 | 
			
		||||
    {MotorId::HP3670, 150, 3, StepType::HALF, false, true, 1,
 | 
			
		||||
     MotorSlope::create_from_steps(3429, 305, 73),
 | 
			
		||||
     MotorSlope::create_from_steps(3399, 337, 192), 192},
 | 
			
		||||
 | 
			
		||||
    {MotorId::HP3670, 300, 3, StepType::HALF, false, true, 1,
 | 
			
		||||
     MotorSlope::create_from_steps(1055, 563, 11),
 | 
			
		||||
     MotorSlope::create_from_steps(3399, 337, 192), 192},
 | 
			
		||||
 | 
			
		||||
    {MotorId::HP3670, 600, 3, StepType::FULL, false, true, 0,
 | 
			
		||||
     MotorSlope::create_from_steps(10687, 5126, 3),
 | 
			
		||||
     MotorSlope::create_from_steps(3399, 337, 192), 192},
 | 
			
		||||
 | 
			
		||||
    {MotorId::HP3670,1200, 3, StepType::HALF, false, true, 0,
 | 
			
		||||
     MotorSlope::create_from_steps(15937, 6375, 3),
 | 
			
		||||
     MotorSlope::create_from_steps(3399, 337, 192), 192},
 | 
			
		||||
 | 
			
		||||
    {MotorId::HP3670, 50, 1, StepType::HALF, false, true, 1,
 | 
			
		||||
     MotorSlope::create_from_steps(2329, 120, 229),
 | 
			
		||||
     MotorSlope::create_from_steps(3399, 337, 192), 192},
 | 
			
		||||
 | 
			
		||||
    {MotorId::HP3670, 75, 1, StepType::FULL, false, true, 1,
 | 
			
		||||
     MotorSlope::create_from_steps(3429, 305, 200),
 | 
			
		||||
     MotorSlope::create_from_steps(3399, 337, 192), 192},
 | 
			
		||||
 | 
			
		||||
    {MotorId::HP3670, 100, 1, StepType::HALF, false, true, 1,
 | 
			
		||||
     MotorSlope::create_from_steps(2905, 187, 143),
 | 
			
		||||
     MotorSlope::create_from_steps(3399, 337, 192), 192},
 | 
			
		||||
 | 
			
		||||
    {MotorId::HP3670, 150, 1, StepType::HALF, false, true, 1,
 | 
			
		||||
     MotorSlope::create_from_steps(3429, 305, 73),
 | 
			
		||||
     MotorSlope::create_from_steps(3399, 337, 192), 192},
 | 
			
		||||
 | 
			
		||||
    {MotorId::HP3670, 300, 1, StepType::HALF, false, true, 1,
 | 
			
		||||
     MotorSlope::create_from_steps(1055, 563, 11),
 | 
			
		||||
     MotorSlope::create_from_steps(3399, 337, 192), 192},
 | 
			
		||||
 | 
			
		||||
    {MotorId::HP3670, 600, 1, StepType::FULL, false, true, 0,
 | 
			
		||||
     MotorSlope::create_from_steps(10687, 5126, 3),
 | 
			
		||||
     MotorSlope::create_from_steps(3399, 337, 192), 192},
 | 
			
		||||
 | 
			
		||||
    {MotorId::HP3670,1200, 1, StepType::HALF, false, true, 0,
 | 
			
		||||
     MotorSlope::create_from_steps(15937, 6375, 3),
 | 
			
		||||
     MotorSlope::create_from_steps(3399, 337, 192), 192},
 | 
			
		||||
 | 
			
		||||
    /* HP2400/G2410 motor settings base motor dpi = 600 */
 | 
			
		||||
    {MotorId::HP2400, 50, 3, StepType::FULL, false, true, 63,
 | 
			
		||||
     MotorSlope::create_from_steps(8736, 601, 120),
 | 
			
		||||
     MotorSlope::create_from_steps(4905, 337, 192), 192},
 | 
			
		||||
 | 
			
		||||
    {MotorId::HP2400, 100, 3, StepType::HALF, false, true, 63,
 | 
			
		||||
     MotorSlope::create_from_steps(8736, 601, 120),
 | 
			
		||||
     MotorSlope::create_from_steps(4905, 337, 192), 192},
 | 
			
		||||
 | 
			
		||||
    {MotorId::HP2400, 150, 3, StepType::HALF, false, true, 63,
 | 
			
		||||
     MotorSlope::create_from_steps(15902, 902, 67),
 | 
			
		||||
     MotorSlope::create_from_steps(4905, 337, 192), 192},
 | 
			
		||||
 | 
			
		||||
    {MotorId::HP2400, 300, 3, StepType::HALF, false, true, 63,
 | 
			
		||||
     MotorSlope::create_from_steps(16703, 2188, 32),
 | 
			
		||||
     MotorSlope::create_from_steps(4905, 337, 192), 192},
 | 
			
		||||
 | 
			
		||||
    {MotorId::HP2400, 600, 3, StepType::FULL, false, true, 63,
 | 
			
		||||
     MotorSlope::create_from_steps(18761, 18761, 3),
 | 
			
		||||
     MotorSlope::create_from_steps(4905, 627, 192), 192},
 | 
			
		||||
 | 
			
		||||
    {MotorId::HP2400,1200, 3, StepType::HALF, false, true, 63,
 | 
			
		||||
     MotorSlope::create_from_steps(43501, 43501, 3),
 | 
			
		||||
     MotorSlope::create_from_steps(4905, 627, 192), 192},
 | 
			
		||||
 | 
			
		||||
    {MotorId::HP2400, 50, 1, StepType::FULL, false, true, 63,
 | 
			
		||||
     MotorSlope::create_from_steps(8736, 601, 120),
 | 
			
		||||
     MotorSlope::create_from_steps(4905, 337, 192), 192},
 | 
			
		||||
 | 
			
		||||
    {MotorId::HP2400, 100, 1, StepType::HALF, false, true, 63,
 | 
			
		||||
     MotorSlope::create_from_steps(8736, 601, 120),
 | 
			
		||||
     MotorSlope::create_from_steps(4905, 337, 192), 192},
 | 
			
		||||
 | 
			
		||||
    {MotorId::HP2400, 150, 1, StepType::HALF, false, true, 63,
 | 
			
		||||
     MotorSlope::create_from_steps(15902, 902, 67),
 | 
			
		||||
     MotorSlope::create_from_steps(4905, 337, 192), 192},
 | 
			
		||||
 | 
			
		||||
    {MotorId::HP2400, 300, 1, StepType::HALF, false, true, 63,
 | 
			
		||||
     MotorSlope::create_from_steps(16703, 2188, 32),
 | 
			
		||||
     MotorSlope::create_from_steps(4905, 337, 192), 192},
 | 
			
		||||
 | 
			
		||||
    {MotorId::HP2400, 600, 1, StepType::FULL, false, true, 63,
 | 
			
		||||
     MotorSlope::create_from_steps(18761, 18761, 3),
 | 
			
		||||
     MotorSlope::create_from_steps(4905, 337, 192), 192},
 | 
			
		||||
 | 
			
		||||
    {MotorId::HP2400,1200, 1, StepType::HALF, false, true, 63,
 | 
			
		||||
     MotorSlope::create_from_steps(43501, 43501, 3),
 | 
			
		||||
     MotorSlope::create_from_steps(4905, 337, 192), 192},
 | 
			
		||||
 | 
			
		||||
    /* XP 200 motor settings */
 | 
			
		||||
    {MotorId::XP200, 75, 3, StepType::HALF, true, false, 0,
 | 
			
		||||
     MotorSlope::create_from_steps(6000, 2136, 4),
 | 
			
		||||
     MotorSlope::create_from_steps(12000, 1200, 8), 1},
 | 
			
		||||
 | 
			
		||||
    {MotorId::XP200, 100, 3, StepType::HALF, true, false, 0,
 | 
			
		||||
     MotorSlope::create_from_steps(6000, 2850, 4),
 | 
			
		||||
     MotorSlope::create_from_steps(12000, 1200, 8), 1},
 | 
			
		||||
 | 
			
		||||
    {MotorId::XP200, 200, 3, StepType::HALF, true, false, 0,
 | 
			
		||||
     MotorSlope::create_from_steps(6999, 5700, 4),
 | 
			
		||||
     MotorSlope::create_from_steps(12000, 1200, 8), 1},
 | 
			
		||||
 | 
			
		||||
    {MotorId::XP200, 250, 3, StepType::HALF, true, false, 0,
 | 
			
		||||
     MotorSlope::create_from_steps(6999, 6999, 4),
 | 
			
		||||
     MotorSlope::create_from_steps(12000, 1200, 8), 1},
 | 
			
		||||
 | 
			
		||||
    {MotorId::XP200, 300, 3, StepType::HALF, true, false, 0,
 | 
			
		||||
     MotorSlope::create_from_steps(13500, 13500, 4),
 | 
			
		||||
     MotorSlope::create_from_steps(12000, 1200, 8), 1},
 | 
			
		||||
 | 
			
		||||
    {MotorId::XP200, 600, 3, StepType::HALF, true, true, 0,
 | 
			
		||||
     MotorSlope::create_from_steps(31998, 31998, 4),
 | 
			
		||||
     MotorSlope::create_from_steps(12000, 1200, 2), 1},
 | 
			
		||||
 | 
			
		||||
    {MotorId::XP200, 75, 1, StepType::HALF, true, false, 0,
 | 
			
		||||
     MotorSlope::create_from_steps(6000, 2000, 4),
 | 
			
		||||
     MotorSlope::create_from_steps(12000, 1200, 8), 1},
 | 
			
		||||
 | 
			
		||||
    {MotorId::XP200, 100, 1, StepType::HALF, true, false, 0,
 | 
			
		||||
     MotorSlope::create_from_steps(6000, 1300, 4),
 | 
			
		||||
     MotorSlope::create_from_steps(12000, 1200, 8), 1},
 | 
			
		||||
 | 
			
		||||
    {MotorId::XP200, 200, 1, StepType::HALF, true, true, 0,
 | 
			
		||||
     MotorSlope::create_from_steps(6000, 3666, 4),
 | 
			
		||||
     MotorSlope::create_from_steps(12000, 1200, 8), 1},
 | 
			
		||||
 | 
			
		||||
    {MotorId::XP200, 300, 1, StepType::HALF, true, false, 0,
 | 
			
		||||
     MotorSlope::create_from_steps(6500, 6500, 4),
 | 
			
		||||
     MotorSlope::create_from_steps(12000, 1200, 8), 1},
 | 
			
		||||
 | 
			
		||||
    {MotorId::XP200, 600, 1, StepType::HALF, true, true, 0,
 | 
			
		||||
     MotorSlope::create_from_steps(24000, 24000, 4),
 | 
			
		||||
     MotorSlope::create_from_steps(12000, 1200, 2), 1},
 | 
			
		||||
 | 
			
		||||
    /* HP scanjet 2300c */
 | 
			
		||||
    {MotorId::HP2300, 75, 3, StepType::FULL, false, true, 63,
 | 
			
		||||
     MotorSlope::create_from_steps(8139, 560, 120),
 | 
			
		||||
     MotorSlope::create_from_steps(4905, 337, 120), 16},
 | 
			
		||||
 | 
			
		||||
    {MotorId::HP2300, 150, 3, StepType::HALF, false, true, 63,
 | 
			
		||||
     MotorSlope::create_from_steps(7903, 543, 67),
 | 
			
		||||
     MotorSlope::create_from_steps(4905, 337, 120), 16},
 | 
			
		||||
 | 
			
		||||
    {MotorId::HP2300, 300, 3, StepType::HALF, false, true, 63,
 | 
			
		||||
     MotorSlope::create_from_steps(2175, 1087, 3),
 | 
			
		||||
     MotorSlope::create_from_steps(4905, 337, 120), 16},
 | 
			
		||||
 | 
			
		||||
    {MotorId::HP2300, 600, 3, StepType::HALF, false, true, 63,
 | 
			
		||||
     MotorSlope::create_from_steps(8700, 4350, 3),
 | 
			
		||||
     MotorSlope::create_from_steps(4905, 337, 120), 16},
 | 
			
		||||
 | 
			
		||||
    {MotorId::HP2300,1200, 3, StepType::HALF, false, true, 63,
 | 
			
		||||
     MotorSlope::create_from_steps(17400, 8700, 3),
 | 
			
		||||
     MotorSlope::create_from_steps(4905, 337, 120), 16},
 | 
			
		||||
 | 
			
		||||
    {MotorId::HP2300, 75, 1, StepType::FULL, false, true, 63,
 | 
			
		||||
     MotorSlope::create_from_steps(8139, 560, 120),
 | 
			
		||||
     MotorSlope::create_from_steps(4905, 337, 120), 16},
 | 
			
		||||
 | 
			
		||||
    {MotorId::HP2300, 150, 1, StepType::HALF, false, true, 63,
 | 
			
		||||
     MotorSlope::create_from_steps(7903, 543, 67),
 | 
			
		||||
     MotorSlope::create_from_steps(4905, 337, 120), 16},
 | 
			
		||||
 | 
			
		||||
    {MotorId::HP2300, 300, 1, StepType::HALF, false, true, 63,
 | 
			
		||||
     MotorSlope::create_from_steps(2175, 1087, 3),
 | 
			
		||||
     MotorSlope::create_from_steps(4905, 337, 120), 16},
 | 
			
		||||
 | 
			
		||||
    {MotorId::HP2300, 600, 1, StepType::HALF, false, true, 63,
 | 
			
		||||
     MotorSlope::create_from_steps(8700, 4350, 3),
 | 
			
		||||
     MotorSlope::create_from_steps(4905, 337, 120), 16},
 | 
			
		||||
 | 
			
		||||
    {MotorId::HP2300,1200, 1, StepType::HALF, false, true, 63,
 | 
			
		||||
     MotorSlope::create_from_steps(17400, 8700, 3),
 | 
			
		||||
     MotorSlope::create_from_steps(4905, 337, 120), 16},
 | 
			
		||||
 | 
			
		||||
    /* non half ccd settings for 300 dpi
 | 
			
		||||
    {MotorId::HP2300, 300, 3, StepType::HALF, false, true, 63,
 | 
			
		||||
     MotorSlope::create_from_steps(5386, 2175, 44),
 | 
			
		||||
     MotorSlope::create_from_steps(4905, 337, 120), 16},
 | 
			
		||||
 | 
			
		||||
    {MotorId::HP2300, 300, 1, StepType::HALF, false, true, 63,
 | 
			
		||||
     MotorSlope::create_from_steps(5386, 2175, 44),
 | 
			
		||||
     MotorSlope::create_from_steps(4905, 337, 120), 16},
 | 
			
		||||
    */
 | 
			
		||||
 | 
			
		||||
    /* MD5345/6471 motor settings */
 | 
			
		||||
    /* vfinal=(exposure/(1200/dpi))/step_type */
 | 
			
		||||
    {MotorId::MD_5345, 50, 3, StepType::HALF, false, true, 2,
 | 
			
		||||
     MotorSlope::create_from_steps(2500, 250, 255),
 | 
			
		||||
     MotorSlope::create_from_steps(2000, 300, 255), 64},
 | 
			
		||||
 | 
			
		||||
    {MotorId::MD_5345, 75, 3, StepType::HALF, false, true, 2,
 | 
			
		||||
     MotorSlope::create_from_steps(2500, 343, 255),
 | 
			
		||||
     MotorSlope::create_from_steps(2000, 300, 255), 64},
 | 
			
		||||
 | 
			
		||||
    {MotorId::MD_5345, 100, 3, StepType::HALF, false, true, 2,
 | 
			
		||||
     MotorSlope::create_from_steps(2500, 458, 255),
 | 
			
		||||
     MotorSlope::create_from_steps(2000, 300, 255), 64},
 | 
			
		||||
 | 
			
		||||
    {MotorId::MD_5345, 150, 3, StepType::HALF, false, true, 2,
 | 
			
		||||
     MotorSlope::create_from_steps(2500, 687, 255),
 | 
			
		||||
     MotorSlope::create_from_steps(2000, 300, 255), 64},
 | 
			
		||||
 | 
			
		||||
    {MotorId::MD_5345, 200, 3, StepType::HALF, false, true, 2,
 | 
			
		||||
     MotorSlope::create_from_steps(2500, 916, 255),
 | 
			
		||||
     MotorSlope::create_from_steps(2000, 300, 255), 64},
 | 
			
		||||
 | 
			
		||||
    {MotorId::MD_5345, 300, 3, StepType::HALF, false, true, 2,
 | 
			
		||||
     MotorSlope::create_from_steps(2500, 1375, 255),
 | 
			
		||||
     MotorSlope::create_from_steps(2000, 300, 255), 64},
 | 
			
		||||
 | 
			
		||||
    {MotorId::MD_5345, 400, 3, StepType::HALF, false, true, 0,
 | 
			
		||||
     MotorSlope::create_from_steps(2000, 1833, 32),
 | 
			
		||||
     MotorSlope::create_from_steps(2000, 300, 255), 32},
 | 
			
		||||
 | 
			
		||||
    {MotorId::MD_5345, 500, 3, StepType::HALF, false, true, 0,
 | 
			
		||||
     MotorSlope::create_from_steps(2291, 2291, 32),
 | 
			
		||||
     MotorSlope::create_from_steps(2000, 300, 255), 32},
 | 
			
		||||
 | 
			
		||||
    {MotorId::MD_5345, 600, 3, StepType::HALF, false, true, 0,
 | 
			
		||||
     MotorSlope::create_from_steps(2750, 2750, 32),
 | 
			
		||||
     MotorSlope::create_from_steps(2000, 300, 255), 32},
 | 
			
		||||
 | 
			
		||||
    {MotorId::MD_5345, 1200, 3, StepType::QUARTER, false, true, 0,
 | 
			
		||||
     MotorSlope::create_from_steps(2750, 2750, 16),
 | 
			
		||||
     MotorSlope::create_from_steps(2000, 300, 255), 146},
 | 
			
		||||
 | 
			
		||||
    {MotorId::MD_5345, 2400, 3, StepType::QUARTER, false, true, 0,
 | 
			
		||||
     MotorSlope::create_from_steps(5500, 5500, 16),
 | 
			
		||||
     MotorSlope::create_from_steps(2000, 300, 255), 146},
 | 
			
		||||
 | 
			
		||||
    {MotorId::MD_5345, 50, 1, StepType::HALF, false, true, 2,
 | 
			
		||||
     MotorSlope::create_from_steps(2500, 250, 255),
 | 
			
		||||
     MotorSlope::create_from_steps(2000, 300, 255), 64},
 | 
			
		||||
 | 
			
		||||
    {MotorId::MD_5345, 75, 1, StepType::HALF, false, true, 2,
 | 
			
		||||
     MotorSlope::create_from_steps(2500, 343, 255),
 | 
			
		||||
     MotorSlope::create_from_steps(2000, 300, 255), 64},
 | 
			
		||||
 | 
			
		||||
    {MotorId::MD_5345, 100, 1, StepType::HALF, false, true, 2,
 | 
			
		||||
     MotorSlope::create_from_steps(2500, 458, 255),
 | 
			
		||||
     MotorSlope::create_from_steps(2000, 300, 255), 64},
 | 
			
		||||
 | 
			
		||||
    {MotorId::MD_5345, 150, 1, StepType::HALF, false, true, 2,
 | 
			
		||||
     MotorSlope::create_from_steps(2500, 687, 255),
 | 
			
		||||
     MotorSlope::create_from_steps(2000, 300, 255), 64},
 | 
			
		||||
 | 
			
		||||
    {MotorId::MD_5345, 200, 1, StepType::HALF, false, true, 2,
 | 
			
		||||
     MotorSlope::create_from_steps(2500, 916, 255),
 | 
			
		||||
     MotorSlope::create_from_steps(2000, 300, 255), 64},
 | 
			
		||||
 | 
			
		||||
    {MotorId::MD_5345, 300, 1, StepType::HALF, false, true, 2,
 | 
			
		||||
     MotorSlope::create_from_steps(2500, 1375, 255),
 | 
			
		||||
     MotorSlope::create_from_steps(2000, 300, 255), 64},
 | 
			
		||||
 | 
			
		||||
    {MotorId::MD_5345, 400, 1, StepType::HALF, false, true, 0,
 | 
			
		||||
     MotorSlope::create_from_steps(2000, 1833, 32),
 | 
			
		||||
     MotorSlope::create_from_steps(2000, 300, 255), 32},
 | 
			
		||||
 | 
			
		||||
    {MotorId::MD_5345, 500, 1, StepType::HALF, false, true, 0,
 | 
			
		||||
     MotorSlope::create_from_steps(2291, 2291, 32),
 | 
			
		||||
     MotorSlope::create_from_steps(2000, 300, 255), 32},
 | 
			
		||||
 | 
			
		||||
    {MotorId::MD_5345, 600, 1, StepType::HALF, false, true, 0,
 | 
			
		||||
     MotorSlope::create_from_steps(2750, 2750, 32),
 | 
			
		||||
     MotorSlope::create_from_steps(2000, 300, 255), 32},
 | 
			
		||||
 | 
			
		||||
    {MotorId::MD_5345, 1200, 1, StepType::QUARTER, false, true, 0,
 | 
			
		||||
     MotorSlope::create_from_steps(2750, 2750, 16),
 | 
			
		||||
     MotorSlope::create_from_steps(2000, 300, 255), 146},
 | 
			
		||||
 | 
			
		||||
    {MotorId::MD_5345, 2400, 1, StepType::QUARTER, false, true, 0,
 | 
			
		||||
     MotorSlope::create_from_steps(5500, 5500, 16),
 | 
			
		||||
     MotorSlope::create_from_steps(2000, 300, 255), 146}, /* 5500 guessed */
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
class CommandSetGl646 : public CommandSetCommon
 | 
			
		||||
{
 | 
			
		||||
public:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -68,15 +68,6 @@ static int gl841_exposure_time(Genesys_Device *dev, const Genesys_Sensor& sensor
 | 
			
		|||
                               int start,
 | 
			
		||||
                               int used_pixels);
 | 
			
		||||
 | 
			
		||||
static void sanei_gl841_setup_sensor(const Genesys_Sensor& sensor, Genesys_Register_Set* regs)
 | 
			
		||||
{
 | 
			
		||||
    DBG_HELPER(dbg);
 | 
			
		||||
 | 
			
		||||
    for (const auto& custom_reg : sensor.custom_regs) {
 | 
			
		||||
        regs->set8(custom_reg.address, custom_reg.value);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Set all registers to default values
 | 
			
		||||
 * (function called only once at the beginning)
 | 
			
		||||
| 
						 | 
				
			
			@ -169,14 +160,14 @@ gl841_init_registers (Genesys_Device * dev)
 | 
			
		|||
        dev->reg.init_reg(0x15, 0x00);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    dev->reg.init_reg(0x16, 0x00); // SENSOR_DEF, overwritten in sanei_gl841_setup_sensor() below
 | 
			
		||||
    dev->reg.init_reg(0x17, 0x00); // SENSOR_DEF, overwritten in sanei_gl841_setup_sensor() below
 | 
			
		||||
    dev->reg.init_reg(0x18, 0x00); // SENSOR_DEF, overwritten in sanei_gl841_setup_sensor() below
 | 
			
		||||
    dev->reg.init_reg(0x19, 0x00); // SENSOR_DEF, overwritten in sanei_gl841_setup_sensor() below
 | 
			
		||||
    dev->reg.init_reg(0x1a, 0x00); // SENSOR_DEF, overwritten in sanei_gl841_setup_sensor() below
 | 
			
		||||
    dev->reg.init_reg(0x1b, 0x00); // SENSOR_DEF, overwritten in sanei_gl841_setup_sensor() below
 | 
			
		||||
    dev->reg.init_reg(0x1c, 0x00); // SENSOR_DEF, overwritten in sanei_gl841_setup_sensor() below
 | 
			
		||||
    dev->reg.init_reg(0x1d, 0x01); // SENSOR_DEF, overwritten in sanei_gl841_setup_sensor() below
 | 
			
		||||
    dev->reg.init_reg(0x16, 0x00); // SENSOR_DEF, overwritten in scanner_setup_sensor() below
 | 
			
		||||
    dev->reg.init_reg(0x17, 0x00); // SENSOR_DEF, overwritten in scanner_setup_sensor() below
 | 
			
		||||
    dev->reg.init_reg(0x18, 0x00); // SENSOR_DEF, overwritten in scanner_setup_sensor() below
 | 
			
		||||
    dev->reg.init_reg(0x19, 0x00); // SENSOR_DEF, overwritten in scanner_setup_sensor() below
 | 
			
		||||
    dev->reg.init_reg(0x1a, 0x00); // SENSOR_DEF, overwritten in scanner_setup_sensor() below
 | 
			
		||||
    dev->reg.init_reg(0x1b, 0x00); // SENSOR_DEF, overwritten in scanner_setup_sensor() below
 | 
			
		||||
    dev->reg.init_reg(0x1c, 0x00); // SENSOR_DEF, overwritten in scanner_setup_sensor() below
 | 
			
		||||
    dev->reg.init_reg(0x1d, 0x01); // SENSOR_DEF, overwritten in scanner_setup_sensor() below
 | 
			
		||||
    dev->reg.init_reg(0x1e, 0xf0);
 | 
			
		||||
    if (dev->model->model_id == ModelId::CANON_LIDE_80) {
 | 
			
		||||
        dev->reg.init_reg(0x1e, 0x10);
 | 
			
		||||
| 
						 | 
				
			
			@ -237,15 +228,15 @@ gl841_init_registers (Genesys_Device * dev)
 | 
			
		|||
    dev->reg.init_reg(0x3e, 0x00);
 | 
			
		||||
    dev->reg.init_reg(0x3f, 0x00);
 | 
			
		||||
 | 
			
		||||
    dev->reg.init_reg(0x52, 0x00);  // SENSOR_DEF, overwritten in sanei_gl841_setup_sensor() below
 | 
			
		||||
    dev->reg.init_reg(0x53, 0x00);  // SENSOR_DEF, overwritten in sanei_gl841_setup_sensor() below
 | 
			
		||||
    dev->reg.init_reg(0x54, 0x00);  // SENSOR_DEF, overwritten in sanei_gl841_setup_sensor() below
 | 
			
		||||
    dev->reg.init_reg(0x55, 0x00);  // SENSOR_DEF, overwritten in sanei_gl841_setup_sensor() below
 | 
			
		||||
    dev->reg.init_reg(0x56, 0x00);  // SENSOR_DEF, overwritten in sanei_gl841_setup_sensor() below
 | 
			
		||||
    dev->reg.init_reg(0x57, 0x00);  // SENSOR_DEF, overwritten in sanei_gl841_setup_sensor() below
 | 
			
		||||
    dev->reg.init_reg(0x58, 0x00);  // SENSOR_DEF, overwritten in sanei_gl841_setup_sensor() below
 | 
			
		||||
    dev->reg.init_reg(0x59, 0x00);  // SENSOR_DEF, overwritten in sanei_gl841_setup_sensor() below
 | 
			
		||||
    dev->reg.init_reg(0x5a, 0x00);  // SENSOR_DEF, overwritten in sanei_gl841_setup_sensor() below
 | 
			
		||||
    dev->reg.init_reg(0x52, 0x00);  // SENSOR_DEF, overwritten in scanner_setup_sensor() below
 | 
			
		||||
    dev->reg.init_reg(0x53, 0x00);  // SENSOR_DEF, overwritten in scanner_setup_sensor() below
 | 
			
		||||
    dev->reg.init_reg(0x54, 0x00);  // SENSOR_DEF, overwritten in scanner_setup_sensor() below
 | 
			
		||||
    dev->reg.init_reg(0x55, 0x00);  // SENSOR_DEF, overwritten in scanner_setup_sensor() below
 | 
			
		||||
    dev->reg.init_reg(0x56, 0x00);  // SENSOR_DEF, overwritten in scanner_setup_sensor() below
 | 
			
		||||
    dev->reg.init_reg(0x57, 0x00);  // SENSOR_DEF, overwritten in scanner_setup_sensor() below
 | 
			
		||||
    dev->reg.init_reg(0x58, 0x00);  // SENSOR_DEF, overwritten in scanner_setup_sensor() below
 | 
			
		||||
    dev->reg.init_reg(0x59, 0x00);  // SENSOR_DEF, overwritten in scanner_setup_sensor() below
 | 
			
		||||
    dev->reg.init_reg(0x5a, 0x00);  // SENSOR_DEF, overwritten in scanner_setup_sensor() below
 | 
			
		||||
 | 
			
		||||
    if (dev->model->model_id == ModelId::CANON_LIDE_80) {
 | 
			
		||||
        dev->reg.init_reg(0x5d, 0x20);
 | 
			
		||||
| 
						 | 
				
			
			@ -273,10 +264,10 @@ gl841_init_registers (Genesys_Device * dev)
 | 
			
		|||
        dev->reg.init_reg(0x5e, 0x02);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    dev->reg.init_reg(0x70, 0x00); // SENSOR_DEF, overwritten in sanei_gl841_setup_sensor() below
 | 
			
		||||
    dev->reg.init_reg(0x71, 0x00); // SENSOR_DEF, overwritten in sanei_gl841_setup_sensor() below
 | 
			
		||||
    dev->reg.init_reg(0x72, 0x00); // SENSOR_DEF, overwritten in sanei_gl841_setup_sensor() below
 | 
			
		||||
    dev->reg.init_reg(0x73, 0x00); // SENSOR_DEF, overwritten in sanei_gl841_setup_sensor() below
 | 
			
		||||
    dev->reg.init_reg(0x70, 0x00); // SENSOR_DEF, overwritten in scanner_setup_sensor() below
 | 
			
		||||
    dev->reg.init_reg(0x71, 0x00); // SENSOR_DEF, overwritten in scanner_setup_sensor() below
 | 
			
		||||
    dev->reg.init_reg(0x72, 0x00); // SENSOR_DEF, overwritten in scanner_setup_sensor() below
 | 
			
		||||
    dev->reg.init_reg(0x73, 0x00); // SENSOR_DEF, overwritten in scanner_setup_sensor() below
 | 
			
		||||
 | 
			
		||||
    if (dev->model->model_id == ModelId::CANON_LIDE_80) {
 | 
			
		||||
        dev->reg.init_reg(0x74, 0x00);
 | 
			
		||||
| 
						 | 
				
			
			@ -307,7 +298,7 @@ gl841_init_registers (Genesys_Device * dev)
 | 
			
		|||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    sanei_gl841_setup_sensor(sensor, &dev->reg);
 | 
			
		||||
    scanner_setup_sensor(*dev, sensor, dev->reg);
 | 
			
		||||
 | 
			
		||||
    // set up GPIO
 | 
			
		||||
    for (const auto& reg : dev->gpo.regs) {
 | 
			
		||||
| 
						 | 
				
			
			@ -601,7 +592,7 @@ uint8_t *table;
 | 
			
		|||
static void gl841_init_motor_regs(Genesys_Device* dev, const Genesys_Sensor& sensor,
 | 
			
		||||
                                  Genesys_Register_Set* reg, unsigned int feed_steps,/*1/base_ydpi*/
 | 
			
		||||
                                  /*maybe float for half/quarter step resolution?*/
 | 
			
		||||
                                  unsigned int action, MotorFlag flags)
 | 
			
		||||
                                  unsigned int action, ScanFlag flags)
 | 
			
		||||
{
 | 
			
		||||
    DBG_HELPER_ARGS(dbg, "feed_steps=%d, action=%d, flags=%x", feed_steps, action,
 | 
			
		||||
                    static_cast<unsigned>(flags));
 | 
			
		||||
| 
						 | 
				
			
			@ -669,7 +660,7 @@ static void gl841_init_motor_regs(Genesys_Device* dev, const Genesys_Sensor& sen
 | 
			
		|||
    else
 | 
			
		||||
    reg->find_reg(0x02).value &= ~0x08;
 | 
			
		||||
 | 
			
		||||
    if (has_flag(flags, MotorFlag::AUTO_GO_HOME)) {
 | 
			
		||||
    if (has_flag(flags, ScanFlag::AUTO_GO_HOME)) {
 | 
			
		||||
        reg->find_reg(0x02).value |= 0x20;
 | 
			
		||||
    } else {
 | 
			
		||||
        reg->find_reg(0x02).value &= ~0x20;
 | 
			
		||||
| 
						 | 
				
			
			@ -677,7 +668,7 @@ static void gl841_init_motor_regs(Genesys_Device* dev, const Genesys_Sensor& sen
 | 
			
		|||
 | 
			
		||||
    reg->find_reg(0x02).value &= ~0x40;
 | 
			
		||||
 | 
			
		||||
    if (has_flag(flags, MotorFlag::REVERSE)) {
 | 
			
		||||
    if (has_flag(flags, ScanFlag::REVERSE)) {
 | 
			
		||||
        reg->find_reg(0x02).value |= REG_0x02_MTRREV;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -702,7 +693,7 @@ static void gl841_init_motor_regs_scan(Genesys_Device* dev, const Genesys_Sensor
 | 
			
		|||
                                       // number of scan lines to add in a scan_lines line
 | 
			
		||||
                                       unsigned int feed_steps,/*1/base_ydpi*/
 | 
			
		||||
                                       // maybe float for half/quarter step resolution?
 | 
			
		||||
                                       MotorFlag flags)
 | 
			
		||||
                                       ScanFlag flags)
 | 
			
		||||
{
 | 
			
		||||
    DBG_HELPER_ARGS(dbg, "scan_exposure_time=%d, scan_yres=%d, scan_step_type=%d, scan_lines=%d,"
 | 
			
		||||
                         " scan_dummy=%d, feed_steps=%d, flags=%x",
 | 
			
		||||
| 
						 | 
				
			
			@ -819,36 +810,6 @@ static void gl841_init_motor_regs_scan(Genesys_Device* dev, const Genesys_Sensor
 | 
			
		|||
    }
 | 
			
		||||
    DBG(DBG_info, "%s: Decided to use %s mode\n", __func__, use_fast_fed?"fast feed":"slow feed");
 | 
			
		||||
 | 
			
		||||
/* all needed slopes available. we did even decide which mode to use.
 | 
			
		||||
   what next?
 | 
			
		||||
   - transfer slopes
 | 
			
		||||
SCAN:
 | 
			
		||||
flags \ use_fast_fed    ! 0         1
 | 
			
		||||
------------------------\--------------------
 | 
			
		||||
                      0 ! 0,1,2     0,1,2,3
 | 
			
		||||
MotorFlag::AUTO_GO_HOME ! 0,1,2,4   0,1,2,3,4
 | 
			
		||||
OFF:       none
 | 
			
		||||
FEED:      3
 | 
			
		||||
GO_HOME:   3
 | 
			
		||||
HOME_FREE: 3
 | 
			
		||||
   - setup registers
 | 
			
		||||
     * slope specific registers (already done)
 | 
			
		||||
     * DECSEL for HOME_FREE/GO_HOME/SCAN
 | 
			
		||||
     * FEEDL
 | 
			
		||||
     * MTRREV
 | 
			
		||||
     * MTRPWR
 | 
			
		||||
     * FASTFED
 | 
			
		||||
     * STEPSEL
 | 
			
		||||
     * MTRPWM
 | 
			
		||||
     * FSTPSEL
 | 
			
		||||
     * FASTPWM
 | 
			
		||||
     * HOMENEG
 | 
			
		||||
     * BWDSTEP
 | 
			
		||||
     * FWDSTEP
 | 
			
		||||
     * Z1
 | 
			
		||||
     * Z2
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
    reg->set8(0x3d, (feedl >> 16) & 0xf);
 | 
			
		||||
    reg->set8(0x3e, (feedl >> 8) & 0xff);
 | 
			
		||||
    reg->set8(0x3f, feedl & 0xff);
 | 
			
		||||
| 
						 | 
				
			
			@ -866,12 +827,12 @@ HOME_FREE: 3
 | 
			
		|||
    else
 | 
			
		||||
    reg->find_reg(0x02).value &= ~0x08;
 | 
			
		||||
 | 
			
		||||
    if (has_flag(flags, MotorFlag::AUTO_GO_HOME))
 | 
			
		||||
    if (has_flag(flags, ScanFlag::AUTO_GO_HOME))
 | 
			
		||||
    reg->find_reg(0x02).value |= 0x20;
 | 
			
		||||
    else
 | 
			
		||||
    reg->find_reg(0x02).value &= ~0x20;
 | 
			
		||||
 | 
			
		||||
    if (has_flag(flags, MotorFlag::DISABLE_BUFFER_FULL_MOVE)) {
 | 
			
		||||
    if (has_flag(flags, ScanFlag::DISABLE_BUFFER_FULL_MOVE)) {
 | 
			
		||||
        reg->find_reg(0x02).value |= 0x40;
 | 
			
		||||
    } else {
 | 
			
		||||
        reg->find_reg(0x02).value &= ~0x40;
 | 
			
		||||
| 
						 | 
				
			
			@ -885,7 +846,7 @@ HOME_FREE: 3
 | 
			
		|||
        gl841_send_slope_table(dev, sensor, 3, fast_table.table, 256);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (has_flag(flags, MotorFlag::AUTO_GO_HOME)) {
 | 
			
		||||
    if (has_flag(flags, ScanFlag::AUTO_GO_HOME)) {
 | 
			
		||||
        gl841_send_slope_table(dev, sensor, 4, fast_table.table, 256);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1066,7 +1027,7 @@ static void gl841_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens
 | 
			
		|||
    }
 | 
			
		||||
 | 
			
		||||
    /* sensor parameters */
 | 
			
		||||
    sanei_gl841_setup_sensor(sensor, &dev->reg);
 | 
			
		||||
    scanner_setup_sensor(*dev, sensor, dev->reg);
 | 
			
		||||
    reg->set8(0x29, 255); /*<<<"magic" number, only suitable for cis*/
 | 
			
		||||
    reg->set16(REG_DPISET, sensor.register_dpiset);
 | 
			
		||||
    reg->set16(REG_STRPIXEL, session.pixel_startx);
 | 
			
		||||
| 
						 | 
				
			
			@ -1259,11 +1220,8 @@ dummy \ scanned lines
 | 
			
		|||
    if (has_flag(session.params.flags, ScanFlag::SINGLE_LINE)) {
 | 
			
		||||
        gl841_init_motor_regs_off(reg, session.optical_line_count);
 | 
			
		||||
    } else {
 | 
			
		||||
        auto motor_flag = has_flag(session.params.flags, ScanFlag::DISABLE_BUFFER_FULL_MOVE) ?
 | 
			
		||||
                              MotorFlag::DISABLE_BUFFER_FULL_MOVE : MotorFlag::NONE;
 | 
			
		||||
 | 
			
		||||
        gl841_init_motor_regs_scan(dev, sensor, reg, exposure_time, slope_dpi, scan_step_type,
 | 
			
		||||
                                   session.optical_line_count, dummy, move, motor_flag);
 | 
			
		||||
                                   session.optical_line_count, dummy, move, session.params.flags);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
    dev->read_buffer.clear();
 | 
			
		||||
| 
						 | 
				
			
			@ -1587,7 +1545,7 @@ void CommandSetGl841::eject_document(Genesys_Device* dev) const
 | 
			
		|||
    regs_set_optical_off(dev->model->asic_type, local_reg);
 | 
			
		||||
 | 
			
		||||
  const auto& sensor = sanei_genesys_find_sensor_any(dev);
 | 
			
		||||
    gl841_init_motor_regs(dev, sensor, &local_reg, 65536, MOTOR_ACTION_FEED, MotorFlag::NONE);
 | 
			
		||||
    gl841_init_motor_regs(dev, sensor, &local_reg, 65536, MOTOR_ACTION_FEED, ScanFlag::NONE);
 | 
			
		||||
 | 
			
		||||
    dev->interface->write_registers(local_reg);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1858,7 +1816,7 @@ void CommandSetGl841::move_back_home(Genesys_Device* dev, bool wait_until_home)
 | 
			
		|||
 | 
			
		||||
  const auto& sensor = sanei_genesys_find_sensor_any(dev);
 | 
			
		||||
 | 
			
		||||
    gl841_init_motor_regs(dev, sensor, &local_reg, 65536, MOTOR_ACTION_GO_HOME, MotorFlag::REVERSE);
 | 
			
		||||
    gl841_init_motor_regs(dev, sensor, &local_reg, 65536, MOTOR_ACTION_GO_HOME, ScanFlag::REVERSE);
 | 
			
		||||
 | 
			
		||||
    // set up for no scan
 | 
			
		||||
    regs_set_optical_off(dev->model->asic_type, local_reg);
 | 
			
		||||
| 
						 | 
				
			
			@ -2652,10 +2610,5 @@ void CommandSetGl841::asic_boot(Genesys_Device *dev, bool cold) const
 | 
			
		|||
    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 genesys
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -66,26 +66,6 @@ static int gl843_get_step_multiplier(Genesys_Register_Set* regs)
 | 
			
		|||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** copy sensor specific settings */
 | 
			
		||||
static void gl843_setup_sensor(Genesys_Device* dev, const Genesys_Sensor& sensor,
 | 
			
		||||
                               Genesys_Register_Set* regs)
 | 
			
		||||
{
 | 
			
		||||
    DBG_HELPER(dbg);
 | 
			
		||||
    for (const auto& custom_reg : sensor.custom_regs) {
 | 
			
		||||
        regs->set8(custom_reg.address, custom_reg.value);
 | 
			
		||||
    }
 | 
			
		||||
    if (dev->model->model_id == ModelId::PANASONIC_KV_SS080 ||
 | 
			
		||||
        dev->model->model_id == ModelId::HP_SCANJET_4850C ||
 | 
			
		||||
        dev->model->model_id == ModelId::HP_SCANJET_G4010 ||
 | 
			
		||||
        dev->model->model_id == ModelId::HP_SCANJET_G4050)
 | 
			
		||||
    {
 | 
			
		||||
        regs->set8(0x7d, 0x90);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    dev->segment_order = sensor.segment_order;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/** @brief set all registers to default values .
 | 
			
		||||
 * This function is called only once at the beginning and
 | 
			
		||||
 * fills register startup values for registers reused across scans.
 | 
			
		||||
| 
						 | 
				
			
			@ -96,9 +76,9 @@ static void gl843_setup_sensor(Genesys_Device* dev, const Genesys_Sensor& sensor
 | 
			
		|||
static void
 | 
			
		||||
gl843_init_registers (Genesys_Device * dev)
 | 
			
		||||
{
 | 
			
		||||
  // Within this function SENSOR_DEF marker documents that a register is part
 | 
			
		||||
  // of the sensors definition and the actual value is set in
 | 
			
		||||
  // gl843_setup_sensor().
 | 
			
		||||
    // Within this function SENSOR_DEF marker documents that a register is part
 | 
			
		||||
    // of the sensors definition and the actual value is set in
 | 
			
		||||
    // scanner_setup_sensor().
 | 
			
		||||
 | 
			
		||||
    // 0x6c, 0x6d, 0x6e, 0x6f, 0xa6, 0xa7, 0xa8, 0xa9 are defined in the Gpo sensor struct
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -743,7 +723,7 @@ static void gl843_init_motor_regs_scan(Genesys_Device* dev,
 | 
			
		|||
                                       unsigned int scan_lines,
 | 
			
		||||
                                       unsigned int scan_dummy,
 | 
			
		||||
                                       unsigned int feed_steps,
 | 
			
		||||
                                       MotorFlag flags)
 | 
			
		||||
                                       ScanFlag flags)
 | 
			
		||||
{
 | 
			
		||||
    DBG_HELPER_ARGS(dbg, "exposure=%d, scan_yres=%d, step_type=%d, scan_lines=%d, scan_dummy=%d, "
 | 
			
		||||
                         "feed_steps=%d, flags=%x",
 | 
			
		||||
| 
						 | 
				
			
			@ -757,7 +737,7 @@ static void gl843_init_motor_regs_scan(Genesys_Device* dev,
 | 
			
		|||
 | 
			
		||||
    bool use_fast_fed = false;
 | 
			
		||||
 | 
			
		||||
    if ((scan_yres >= 300 && feed_steps > 900) || (has_flag(flags, MotorFlag::FEED))) {
 | 
			
		||||
    if ((scan_yres >= 300 && feed_steps > 900) || (has_flag(flags, ScanFlag::FEEDING))) {
 | 
			
		||||
        use_fast_fed = true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -775,19 +755,19 @@ static void gl843_init_motor_regs_scan(Genesys_Device* dev,
 | 
			
		|||
    }
 | 
			
		||||
 | 
			
		||||
    // in case of automatic go home, move until home sensor
 | 
			
		||||
    if (has_flag(flags, MotorFlag::AUTO_GO_HOME)) {
 | 
			
		||||
    if (has_flag(flags, ScanFlag::AUTO_GO_HOME)) {
 | 
			
		||||
        reg02 |= REG_0x02_AGOHOME | REG_0x02_NOTHOME;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  /* disable backtracking */
 | 
			
		||||
    if (has_flag(flags, MotorFlag::DISABLE_BUFFER_FULL_MOVE)
 | 
			
		||||
    if (has_flag(flags, ScanFlag::DISABLE_BUFFER_FULL_MOVE)
 | 
			
		||||
      ||(scan_yres>=2400 && dev->model->model_id != ModelId::CANON_4400F)
 | 
			
		||||
      ||(scan_yres>=sensor.optical_res))
 | 
			
		||||
    {
 | 
			
		||||
        reg02 |= REG_0x02_ACDCDIS;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (has_flag(flags, MotorFlag::REVERSE)) {
 | 
			
		||||
    if (has_flag(flags, ScanFlag::REVERSE)) {
 | 
			
		||||
        reg02 |= REG_0x02_MTRREV;
 | 
			
		||||
    } else {
 | 
			
		||||
        reg02 &= ~REG_0x02_MTRREV;
 | 
			
		||||
| 
						 | 
				
			
			@ -943,8 +923,8 @@ static void gl843_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens
 | 
			
		|||
  tgtime = exposure / 65536 + 1;
 | 
			
		||||
  DBG(DBG_io2, "%s: tgtime=%d\n", __func__, tgtime);
 | 
			
		||||
 | 
			
		||||
  /* sensor parameters */
 | 
			
		||||
    gl843_setup_sensor(dev, sensor, reg);
 | 
			
		||||
    // sensor parameters
 | 
			
		||||
    scanner_setup_sensor(*dev, sensor, *reg);
 | 
			
		||||
 | 
			
		||||
    dev->cmd_set->set_fe(dev, sensor, AFE_SET);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1114,24 +1094,9 @@ void CommandSetGl843::init_regs_for_scan_session(Genesys_Device* dev, const Gene
 | 
			
		|||
 | 
			
		||||
    // now _LOGICAL_ optical values used are known, setup registers
 | 
			
		||||
    gl843_init_optical_regs_scan(dev, sensor, reg, exposure, session);
 | 
			
		||||
 | 
			
		||||
  /*** motor parameters ***/
 | 
			
		||||
    MotorFlag mflags = MotorFlag::NONE;
 | 
			
		||||
    if (has_flag(session.params.flags, ScanFlag::DISABLE_BUFFER_FULL_MOVE)) {
 | 
			
		||||
        mflags |= MotorFlag::DISABLE_BUFFER_FULL_MOVE;
 | 
			
		||||
    }
 | 
			
		||||
    if (has_flag(session.params.flags, ScanFlag::FEEDING)) {
 | 
			
		||||
        mflags |= MotorFlag::FEED;
 | 
			
		||||
    }
 | 
			
		||||
    if (has_flag(session.params.flags, ScanFlag::USE_XPA)) {
 | 
			
		||||
        mflags |= MotorFlag::USE_XPA;
 | 
			
		||||
    }
 | 
			
		||||
    if (has_flag(session.params.flags, ScanFlag::REVERSE)) {
 | 
			
		||||
        mflags |= MotorFlag::REVERSE;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    gl843_init_motor_regs_scan(dev, sensor, session, reg, motor_profile, exposure, slope_dpi,
 | 
			
		||||
                               session.optical_line_count, dummy, session.params.starty, mflags);
 | 
			
		||||
                               session.optical_line_count, dummy, session.params.starty,
 | 
			
		||||
                               session.params.flags);
 | 
			
		||||
 | 
			
		||||
    dev->read_buffer.clear();
 | 
			
		||||
    dev->read_buffer.alloc(session.buffer_size_read);
 | 
			
		||||
| 
						 | 
				
			
			@ -1890,10 +1855,5 @@ void CommandSetGl843::wait_for_motor_stop(Genesys_Device* dev) const
 | 
			
		|||
    (void) dev;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
std::unique_ptr<CommandSet> create_gl843_cmd_set()
 | 
			
		||||
{
 | 
			
		||||
    return std::unique_ptr<CommandSet>(new CommandSetGl843{});
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
} // namespace gl843
 | 
			
		||||
} // namespace genesys
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -67,25 +67,6 @@ static int gl846_get_step_multiplier (Genesys_Register_Set * regs)
 | 
			
		|||
    return 1 << value;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** @brief sensor specific settings
 | 
			
		||||
*/
 | 
			
		||||
static void gl846_setup_sensor(Genesys_Device * dev, const Genesys_Sensor& sensor,
 | 
			
		||||
                               Genesys_Register_Set* regs)
 | 
			
		||||
{
 | 
			
		||||
    DBG_HELPER(dbg);
 | 
			
		||||
 | 
			
		||||
    for (const auto& reg : sensor.custom_regs) {
 | 
			
		||||
        regs->set8(reg.address, reg.value);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    regs->set16(REG_EXPR, sensor.exposure.red);
 | 
			
		||||
    regs->set16(REG_EXPG, sensor.exposure.green);
 | 
			
		||||
    regs->set16(REG_EXPB, sensor.exposure.blue);
 | 
			
		||||
 | 
			
		||||
    dev->segment_order = sensor.segment_order;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/** @brief set all registers to default values .
 | 
			
		||||
 * This function is called only once at the beginning and
 | 
			
		||||
 * fills register startup values for registers reused across scans.
 | 
			
		||||
| 
						 | 
				
			
			@ -424,7 +405,7 @@ static void gl846_init_motor_regs_scan(Genesys_Device* dev,
 | 
			
		|||
                                       unsigned int scan_lines,
 | 
			
		||||
                                       unsigned int scan_dummy,
 | 
			
		||||
                                       unsigned int feed_steps,
 | 
			
		||||
                                       MotorFlag flags)
 | 
			
		||||
                                       ScanFlag flags)
 | 
			
		||||
{
 | 
			
		||||
    DBG_HELPER_ARGS(dbg, "scan_exposure_time=%d, scan_yres=%d, step_type=%d, scan_lines=%d, "
 | 
			
		||||
                         "scan_dummy=%d, feed_steps=%d, flags=%x",
 | 
			
		||||
| 
						 | 
				
			
			@ -434,7 +415,7 @@ static void gl846_init_motor_regs_scan(Genesys_Device* dev,
 | 
			
		|||
    unsigned step_multiplier = gl846_get_step_multiplier(reg);
 | 
			
		||||
 | 
			
		||||
    bool use_fast_fed = false;
 | 
			
		||||
    if (dev->settings.yres == 4444 && feed_steps > 100 && !has_flag(flags, MotorFlag::FEED)) {
 | 
			
		||||
    if (dev->settings.yres == 4444 && feed_steps > 100 && !has_flag(flags, ScanFlag::FEEDING)) {
 | 
			
		||||
        use_fast_fed = true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -451,14 +432,14 @@ static void gl846_init_motor_regs_scan(Genesys_Device* dev,
 | 
			
		|||
        reg02 &= ~REG_0x02_FASTFED;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (has_flag(flags, MotorFlag::AUTO_GO_HOME)) {
 | 
			
		||||
    if (has_flag(flags, ScanFlag::AUTO_GO_HOME)) {
 | 
			
		||||
        reg02 |= REG_0x02_AGOHOME | REG_0x02_NOTHOME;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (has_flag(flags, MotorFlag::DISABLE_BUFFER_FULL_MOVE) ||(scan_yres>=sensor.optical_res)) {
 | 
			
		||||
    if (has_flag(flags, ScanFlag::DISABLE_BUFFER_FULL_MOVE) || (scan_yres>=sensor.optical_res)) {
 | 
			
		||||
        reg02 |= REG_0x02_ACDCDIS;
 | 
			
		||||
    }
 | 
			
		||||
    if (has_flag(flags, MotorFlag::REVERSE)) {
 | 
			
		||||
    if (has_flag(flags, ScanFlag::REVERSE)) {
 | 
			
		||||
        reg02 |= REG_0x02_MTRREV;
 | 
			
		||||
    } else {
 | 
			
		||||
        reg02 &= ~REG_0x02_MTRREV;
 | 
			
		||||
| 
						 | 
				
			
			@ -513,7 +494,7 @@ static void gl846_init_motor_regs_scan(Genesys_Device* dev,
 | 
			
		|||
    } else {
 | 
			
		||||
        feedl <<= static_cast<unsigned>(motor_profile.step_type);
 | 
			
		||||
        dist = scan_table.steps_count;
 | 
			
		||||
        if (has_flag(flags, MotorFlag::FEED)) {
 | 
			
		||||
        if (has_flag(flags, ScanFlag::FEEDING)) {
 | 
			
		||||
            dist *= 2;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -619,7 +600,7 @@ static void gl846_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens
 | 
			
		|||
{
 | 
			
		||||
    DBG_HELPER_ARGS(dbg, "exposure_time=%d", exposure_time);
 | 
			
		||||
 | 
			
		||||
    gl846_setup_sensor(dev, sensor, reg);
 | 
			
		||||
    scanner_setup_sensor(*dev, sensor, *reg);
 | 
			
		||||
 | 
			
		||||
    dev->cmd_set->set_fe(dev, sensor, AFE_SET);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -757,20 +738,9 @@ void CommandSetGl846::init_regs_for_scan_session(Genesys_Device* dev, const Gene
 | 
			
		|||
   * scan since color calibration is OK for this mode
 | 
			
		||||
   */
 | 
			
		||||
    gl846_init_optical_regs_scan(dev, sensor, reg, exposure_time, session);
 | 
			
		||||
 | 
			
		||||
    MotorFlag mflags = MotorFlag::NONE;
 | 
			
		||||
    if (has_flag(session.params.flags, ScanFlag::DISABLE_BUFFER_FULL_MOVE)) {
 | 
			
		||||
        mflags |= MotorFlag::DISABLE_BUFFER_FULL_MOVE;
 | 
			
		||||
    }
 | 
			
		||||
    if (has_flag(session.params.flags, ScanFlag::FEEDING)) {
 | 
			
		||||
        mflags |= MotorFlag::FEED;
 | 
			
		||||
    }
 | 
			
		||||
    if (has_flag(session.params.flags, ScanFlag::REVERSE)) {
 | 
			
		||||
        mflags |= MotorFlag::REVERSE;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    gl846_init_motor_regs_scan(dev, sensor, session, reg, motor_profile, exposure_time, slope_dpi,
 | 
			
		||||
                               session.optical_line_count, dummy, session.params.starty, mflags);
 | 
			
		||||
                               session.optical_line_count, dummy, session.params.starty,
 | 
			
		||||
                               session.params.flags);
 | 
			
		||||
 | 
			
		||||
  /*** prepares data reordering ***/
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1275,10 +1245,5 @@ void CommandSetGl846::move_to_ta(Genesys_Device* dev) const
 | 
			
		|||
    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 genesys
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -53,6 +53,27 @@
 | 
			
		|||
namespace genesys {
 | 
			
		||||
namespace gl847 {
 | 
			
		||||
 | 
			
		||||
struct Gpio_Profile
 | 
			
		||||
{
 | 
			
		||||
    GpioId gpio_id;
 | 
			
		||||
    std::uint8_t r6b;
 | 
			
		||||
    std::uint8_t r6c;
 | 
			
		||||
    std::uint8_t r6d;
 | 
			
		||||
    std::uint8_t r6e;
 | 
			
		||||
    std::uint8_t r6f;
 | 
			
		||||
    std::uint8_t ra6;
 | 
			
		||||
    std::uint8_t ra7;
 | 
			
		||||
    std::uint8_t ra8;
 | 
			
		||||
    std::uint8_t ra9;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static Gpio_Profile gpios[] =
 | 
			
		||||
{
 | 
			
		||||
    { GpioId::CANON_LIDE_200, 0x02, 0xf9, 0x20, 0xff, 0x00, 0x04, 0x04, 0x00, 0x00},
 | 
			
		||||
    { GpioId::CANON_LIDE_700F, 0x06, 0xdb, 0xff, 0xff, 0x80, 0x15, 0x07, 0x20, 0x10},
 | 
			
		||||
    { GpioId::UNKNOWN, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * compute the step multiplier used
 | 
			
		||||
 */
 | 
			
		||||
| 
						 | 
				
			
			@ -62,25 +83,6 @@ static unsigned gl847_get_step_multiplier (Genesys_Register_Set * regs)
 | 
			
		|||
    return 1 << value;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** @brief sensor specific settings
 | 
			
		||||
*/
 | 
			
		||||
static void gl847_setup_sensor(Genesys_Device * dev, const Genesys_Sensor& sensor,
 | 
			
		||||
                               Genesys_Register_Set* regs)
 | 
			
		||||
{
 | 
			
		||||
    DBG_HELPER(dbg);
 | 
			
		||||
 | 
			
		||||
    for (const auto& reg : sensor.custom_regs) {
 | 
			
		||||
        regs->set8(reg.address, reg.value);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    regs->set16(REG_EXPR, sensor.exposure.red);
 | 
			
		||||
    regs->set16(REG_EXPG, sensor.exposure.green);
 | 
			
		||||
    regs->set16(REG_EXPB, sensor.exposure.blue);
 | 
			
		||||
 | 
			
		||||
    dev->segment_order = sensor.segment_order;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/** @brief set all registers to default values .
 | 
			
		||||
 * This function is called only once at the beginning and
 | 
			
		||||
 * fills register startup values for registers reused across scans.
 | 
			
		||||
| 
						 | 
				
			
			@ -340,7 +342,7 @@ static void gl847_init_motor_regs_scan(Genesys_Device* dev,
 | 
			
		|||
                                       unsigned int scan_lines,
 | 
			
		||||
                                       unsigned int scan_dummy,
 | 
			
		||||
                                       unsigned int feed_steps,
 | 
			
		||||
                                       MotorFlag flags)
 | 
			
		||||
                                       ScanFlag flags)
 | 
			
		||||
{
 | 
			
		||||
    DBG_HELPER_ARGS(dbg, "scan_exposure_time=%d, can_yres=%d, step_type=%d, scan_lines=%d, "
 | 
			
		||||
                         "scan_dummy=%d, feed_steps=%d, flags=%x",
 | 
			
		||||
| 
						 | 
				
			
			@ -350,7 +352,7 @@ static void gl847_init_motor_regs_scan(Genesys_Device* dev,
 | 
			
		|||
    unsigned step_multiplier = gl847_get_step_multiplier (reg);
 | 
			
		||||
 | 
			
		||||
    bool use_fast_fed = false;
 | 
			
		||||
    if (dev->settings.yres == 4444 && feed_steps > 100 && !has_flag(flags, MotorFlag::FEED)) {
 | 
			
		||||
    if (dev->settings.yres == 4444 && feed_steps > 100 && !has_flag(flags, ScanFlag::FEEDING)) {
 | 
			
		||||
        use_fast_fed = true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -367,14 +369,14 @@ static void gl847_init_motor_regs_scan(Genesys_Device* dev,
 | 
			
		|||
        reg02 &= ~REG_0x02_FASTFED;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (has_flag(flags, MotorFlag::AUTO_GO_HOME)) {
 | 
			
		||||
    if (has_flag(flags, ScanFlag::AUTO_GO_HOME)) {
 | 
			
		||||
        reg02 |= REG_0x02_AGOHOME | REG_0x02_NOTHOME;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (has_flag(flags, MotorFlag::DISABLE_BUFFER_FULL_MOVE) ||(scan_yres>=sensor.optical_res)) {
 | 
			
		||||
    if (has_flag(flags, ScanFlag::DISABLE_BUFFER_FULL_MOVE) || (scan_yres >= sensor.optical_res)) {
 | 
			
		||||
        reg02 |= REG_0x02_ACDCDIS;
 | 
			
		||||
    }
 | 
			
		||||
    if (has_flag(flags, MotorFlag::REVERSE)) {
 | 
			
		||||
    if (has_flag(flags, ScanFlag::REVERSE)) {
 | 
			
		||||
        reg02 |= REG_0x02_MTRREV;
 | 
			
		||||
    } else {
 | 
			
		||||
        reg02 &= ~REG_0x02_MTRREV;
 | 
			
		||||
| 
						 | 
				
			
			@ -421,7 +423,7 @@ static void gl847_init_motor_regs_scan(Genesys_Device* dev,
 | 
			
		|||
    } else {
 | 
			
		||||
        feedl <<= static_cast<unsigned>(motor_profile.step_type);
 | 
			
		||||
        dist = scan_table.steps_count;
 | 
			
		||||
        if (has_flag(flags, MotorFlag::FEED)) {
 | 
			
		||||
        if (has_flag(flags, ScanFlag::FEEDING)) {
 | 
			
		||||
            dist *= 2;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -519,7 +521,7 @@ static void gl847_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens
 | 
			
		|||
{
 | 
			
		||||
    DBG_HELPER_ARGS(dbg, "exposure_time=%d", exposure_time);
 | 
			
		||||
 | 
			
		||||
    gl847_setup_sensor(dev, sensor, reg);
 | 
			
		||||
    scanner_setup_sensor(*dev, sensor, *reg);
 | 
			
		||||
 | 
			
		||||
    dev->cmd_set->set_fe(dev, sensor, AFE_SET);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -629,7 +631,6 @@ void CommandSetGl847::init_regs_for_scan_session(Genesys_Device* dev, const Gene
 | 
			
		|||
    DBG_HELPER(dbg);
 | 
			
		||||
    session.assert_computed();
 | 
			
		||||
 | 
			
		||||
  int move;
 | 
			
		||||
  int exposure_time;
 | 
			
		||||
 | 
			
		||||
  int slope_dpi = 0;
 | 
			
		||||
| 
						 | 
				
			
			@ -659,23 +660,9 @@ void CommandSetGl847::init_regs_for_scan_session(Genesys_Device* dev, const Gene
 | 
			
		|||
   * scan since color calibration is OK for this mode
 | 
			
		||||
   */
 | 
			
		||||
    gl847_init_optical_regs_scan(dev, sensor, reg, exposure_time, session);
 | 
			
		||||
 | 
			
		||||
    move = session.params.starty;
 | 
			
		||||
    DBG(DBG_info, "%s: move=%d steps\n", __func__, move);
 | 
			
		||||
 | 
			
		||||
    MotorFlag mflags = MotorFlag::NONE;
 | 
			
		||||
    if (has_flag(session.params.flags, ScanFlag::DISABLE_BUFFER_FULL_MOVE)) {
 | 
			
		||||
        mflags |= MotorFlag::DISABLE_BUFFER_FULL_MOVE;
 | 
			
		||||
    }
 | 
			
		||||
    if (has_flag(session.params.flags, ScanFlag::FEEDING)) {
 | 
			
		||||
        mflags |= MotorFlag::FEED;
 | 
			
		||||
  }
 | 
			
		||||
    if (has_flag(session.params.flags, ScanFlag::REVERSE)) {
 | 
			
		||||
        mflags |= MotorFlag::REVERSE;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    gl847_init_motor_regs_scan(dev, sensor, reg, motor_profile, exposure_time, slope_dpi,
 | 
			
		||||
                               session.optical_line_count, dummy, move, mflags);
 | 
			
		||||
                               session.optical_line_count, dummy, session.params.starty,
 | 
			
		||||
                               session.params.flags);
 | 
			
		||||
 | 
			
		||||
    dev->read_buffer.clear();
 | 
			
		||||
    dev->read_buffer.alloc(session.buffer_size_read);
 | 
			
		||||
| 
						 | 
				
			
			@ -1172,10 +1159,5 @@ void CommandSetGl847::move_to_ta(Genesys_Device* dev) const
 | 
			
		|||
    throw SaneException("not implemented");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
std::unique_ptr<CommandSet> create_gl847_cmd_set()
 | 
			
		||||
{
 | 
			
		||||
    return std::unique_ptr<CommandSet>(new CommandSetGl847{});
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
} // namespace gl847
 | 
			
		||||
} // namespace genesys
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -50,26 +50,6 @@
 | 
			
		|||
namespace genesys {
 | 
			
		||||
namespace gl847 {
 | 
			
		||||
 | 
			
		||||
typedef struct
 | 
			
		||||
{
 | 
			
		||||
    GpioId gpio_id;
 | 
			
		||||
  uint8_t r6b;
 | 
			
		||||
  uint8_t r6c;
 | 
			
		||||
  uint8_t r6d;
 | 
			
		||||
  uint8_t r6e;
 | 
			
		||||
  uint8_t r6f;
 | 
			
		||||
  uint8_t ra6;
 | 
			
		||||
  uint8_t ra7;
 | 
			
		||||
  uint8_t ra8;
 | 
			
		||||
  uint8_t ra9;
 | 
			
		||||
} Gpio_Profile;
 | 
			
		||||
 | 
			
		||||
static Gpio_Profile gpios[]={
 | 
			
		||||
    { GpioId::CANON_LIDE_200, 0x02, 0xf9, 0x20, 0xff, 0x00, 0x04, 0x04, 0x00, 0x00},
 | 
			
		||||
    { GpioId::CANON_LIDE_700F, 0x06, 0xdb, 0xff, 0xff, 0x80, 0x15, 0x07, 0x20, 0x10},
 | 
			
		||||
    { GpioId::UNKNOWN, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
class CommandSetGl847 : public CommandSetCommon
 | 
			
		||||
{
 | 
			
		||||
public:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -56,6 +56,14 @@
 | 
			
		|||
#include "gl847_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 <cmath>
 | 
			
		||||
#include <vector>
 | 
			
		||||
| 
						 | 
				
			
			@ -66,29 +74,16 @@
 | 
			
		|||
 | 
			
		||||
namespace genesys {
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 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)
 | 
			
		||||
std::unique_ptr<CommandSet> create_cmd_set(AsicType asic_type)
 | 
			
		||||
{
 | 
			
		||||
  DBG_INIT ();
 | 
			
		||||
    DBG_HELPER(dbg);
 | 
			
		||||
    switch (dev->model->asic_type) {
 | 
			
		||||
        case AsicType::GL646: dev->cmd_set = gl646::create_gl646_cmd_set(); break;
 | 
			
		||||
        case AsicType::GL841: dev->cmd_set = gl841::create_gl841_cmd_set(); break;
 | 
			
		||||
        case AsicType::GL843: dev->cmd_set = gl843::create_gl843_cmd_set(); break;
 | 
			
		||||
    switch (asic_type) {
 | 
			
		||||
        case AsicType::GL646: return std::unique_ptr<CommandSet>(new gl646::CommandSetGl646{});
 | 
			
		||||
        case AsicType::GL841: return std::unique_ptr<CommandSet>(new gl841::CommandSetGl841{});
 | 
			
		||||
        case AsicType::GL843: return std::unique_ptr<CommandSet>(new gl843::CommandSetGl843{});
 | 
			
		||||
        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::GL847: dev->cmd_set = gl847::create_gl847_cmd_set(); break;
 | 
			
		||||
        case AsicType::GL124: dev->cmd_set = gl124::create_gl124_cmd_set(); break;
 | 
			
		||||
        case AsicType::GL846: return std::unique_ptr<CommandSet>(new gl846::CommandSetGl846{});
 | 
			
		||||
        case AsicType::GL847: return std::unique_ptr<CommandSet>(new gl847::CommandSetGl847{});
 | 
			
		||||
        case AsicType::GL124: return std::unique_ptr<CommandSet>(new gl124::CommandSetGl124{});
 | 
			
		||||
        default: throw SaneException(SANE_STATUS_INVAL, "unknown ASIC type");
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -153,19 +153,6 @@
 | 
			
		|||
#define AFE_SET        2
 | 
			
		||||
#define AFE_POWER_SAVE 4
 | 
			
		||||
 | 
			
		||||
#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))
 | 
			
		||||
 | 
			
		||||
/* Global constants */
 | 
			
		||||
/* TODO: emove this leftover of early backend days */
 | 
			
		||||
#define MOTOR_SPEED_MAX		350
 | 
			
		||||
#define DARK_VALUE		0
 | 
			
		||||
 | 
			
		||||
#define MAX_RESOLUTIONS 13
 | 
			
		||||
#define MAX_DPI 4
 | 
			
		||||
 | 
			
		||||
namespace genesys {
 | 
			
		||||
 | 
			
		||||
class UsbDeviceEntry {
 | 
			
		||||
| 
						 | 
				
			
			@ -219,7 +206,7 @@ private:
 | 
			
		|||
/*       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
 | 
			
		||||
Status scanner_read_status(Genesys_Device& dev);
 | 
			
		||||
| 
						 | 
				
			
			@ -385,6 +372,9 @@ void scanner_stop_action_no_move(Genesys_Device& dev, Genesys_Register_Set& regs
 | 
			
		|||
 | 
			
		||||
bool scanner_is_motor_stopped(Genesys_Device& dev);
 | 
			
		||||
 | 
			
		||||
void scanner_setup_sensor(Genesys_Device& dev, const Genesys_Sensor& sensor,
 | 
			
		||||
                          Genesys_Register_Set& regs);
 | 
			
		||||
 | 
			
		||||
const MotorProfile* get_motor_profile_ptr(const std::vector<MotorProfile>& profiles,
 | 
			
		||||
                                          unsigned exposure,
 | 
			
		||||
                                          const ScanSession& session);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -886,9 +886,9 @@ void genesys_init_usb_device_tables()
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
    model = Genesys_Model();
 | 
			
		||||
    model.name = "canon-5600f";
 | 
			
		||||
    model.name = "canon-canoscan-5600f";
 | 
			
		||||
    model.vendor = "Canon";
 | 
			
		||||
    model.model = "5600F";
 | 
			
		||||
    model.model = "CanoScan 5600F";
 | 
			
		||||
    model.model_id = ModelId::CANON_5600F;
 | 
			
		||||
    model.asic_type = AsicType::GL847;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1489,6 +1489,7 @@ void genesys_init_sensor_tables()
 | 
			
		|||
        { 0x58, 0x6b },
 | 
			
		||||
        { 0x59, 0x00 },
 | 
			
		||||
        { 0x5a, 0xc0 },
 | 
			
		||||
        { 0x7d, 0x90 },
 | 
			
		||||
    };
 | 
			
		||||
    sensor.gamma = { 1.0f, 1.0f, 1.0f };
 | 
			
		||||
    sensor.get_ccd_size_divisor_fun = default_get_ccd_size_divisor_for_dpi;
 | 
			
		||||
| 
						 | 
				
			
			@ -1554,7 +1555,7 @@ void genesys_init_sensor_tables()
 | 
			
		|||
            { 0x70, 0x00 }, { 0x71, 0x02 },
 | 
			
		||||
            { 0x74, 0x00 }, { 0x75, 0x01 }, { 0x76, 0xff },
 | 
			
		||||
            { 0x77, 0x03 }, { 0x78, 0xff }, { 0x79, 0xff },
 | 
			
		||||
            { 0x7a, 0x03 }, { 0x7b, 0xff }, { 0x7c, 0xff },
 | 
			
		||||
            { 0x7a, 0x03 }, { 0x7b, 0xff }, { 0x7c, 0xff }, { 0x7d, 0x90 },
 | 
			
		||||
            { 0x9e, 0x00 },
 | 
			
		||||
            { 0xaa, 0x00 },
 | 
			
		||||
        };
 | 
			
		||||
| 
						 | 
				
			
			@ -1568,7 +1569,7 @@ void genesys_init_sensor_tables()
 | 
			
		|||
            { 0x70, 0x08 }, { 0x71, 0x0c },
 | 
			
		||||
            { 0x74, 0x0f }, { 0x75, 0xff }, { 0x76, 0xff },
 | 
			
		||||
            { 0x77, 0x00 }, { 0x78, 0x01 }, { 0x79, 0xff },
 | 
			
		||||
            { 0x7a, 0x00 }, { 0x7b, 0x01 }, { 0x7c, 0xff },
 | 
			
		||||
            { 0x7a, 0x00 }, { 0x7b, 0x01 }, { 0x7c, 0xff }, { 0x7d, 0x90 },
 | 
			
		||||
            { 0x9e, 0xc0 },
 | 
			
		||||
            { 0xaa, 0x05 },
 | 
			
		||||
        };
 | 
			
		||||
| 
						 | 
				
			
			@ -1582,7 +1583,7 @@ void genesys_init_sensor_tables()
 | 
			
		|||
            { 0x70, 0x08 }, { 0x71, 0x0a },
 | 
			
		||||
            { 0x74, 0x0f }, { 0x75, 0xff }, { 0x76, 0xff },
 | 
			
		||||
            { 0x77, 0x00 }, { 0x78, 0x00 }, { 0x79, 0x00 },
 | 
			
		||||
            { 0x7a, 0x00 }, { 0x7b, 0x00 }, { 0x7c, 0x00 },
 | 
			
		||||
            { 0x7a, 0x00 }, { 0x7b, 0x00 }, { 0x7c, 0x00 }, { 0x7d, 0x90 },
 | 
			
		||||
            { 0x9e, 0xc0 },
 | 
			
		||||
            { 0xaa, 0x05 },
 | 
			
		||||
        };
 | 
			
		||||
| 
						 | 
				
			
			@ -1593,10 +1594,10 @@ void genesys_init_sensor_tables()
 | 
			
		|||
            { 0x1a, 0x38 }, { 0x1b, 0x10 }, { 0x1c, 0xc1 }, { 0x1d, 0x08 },
 | 
			
		||||
            { 0x52, 0x02 }, { 0x53, 0x05 }, { 0x54, 0x08 }, { 0x55, 0x0b }, { 0x56, 0x0e },
 | 
			
		||||
            { 0x57, 0x11 }, { 0x58, 0x1b }, { 0x59, 0x00 }, { 0x5a, 0x40 },
 | 
			
		||||
            { 0x70, 0x08 }, { 0x71, 0x0a },
 | 
			
		||||
            { 0x74, 0x0f }, { 0x75, 0xff }, { 0x76, 0xff },
 | 
			
		||||
            { 0x77, 0x00 }, { 0x78, 0x00 }, { 0x79, 0x00 },
 | 
			
		||||
            { 0x7a, 0x00 }, { 0x7b, 0x00 }, { 0x7c, 0x00 },
 | 
			
		||||
            { 0x70, 0x08 }, { 0x71, 0x0a },
 | 
			
		||||
            { 0x7a, 0x00 }, { 0x7b, 0x00 }, { 0x7c, 0x00 }, { 0x7d, 0x90 },
 | 
			
		||||
            { 0x9e, 0xc0 },
 | 
			
		||||
            { 0xaa, 0x07 },
 | 
			
		||||
        };
 | 
			
		||||
| 
						 | 
				
			
			@ -1610,7 +1611,7 @@ void genesys_init_sensor_tables()
 | 
			
		|||
            { 0x70, 0x00 }, { 0x71, 0x02 },
 | 
			
		||||
            { 0x74, 0x00 }, { 0x75, 0x1c }, { 0x76, 0x7f },
 | 
			
		||||
            { 0x77, 0x03 }, { 0x78, 0xff }, { 0x79, 0xff },
 | 
			
		||||
            { 0x7a, 0x03 }, { 0x7b, 0xff }, { 0x7c, 0xff },
 | 
			
		||||
            { 0x7a, 0x03 }, { 0x7b, 0xff }, { 0x7c, 0xff }, { 0x7d, 0x90 },
 | 
			
		||||
            { 0x9e, 0x00 },
 | 
			
		||||
            { 0xaa, 0x00 },
 | 
			
		||||
        };
 | 
			
		||||
| 
						 | 
				
			
			@ -1682,7 +1683,7 @@ void genesys_init_sensor_tables()
 | 
			
		|||
            { 0x70, 0x00 }, { 0x71, 0x02 },
 | 
			
		||||
            { 0x74, 0x00 }, { 0x75, 0x01 }, { 0x76, 0xff },
 | 
			
		||||
            { 0x77, 0x03 }, { 0x78, 0xff }, { 0x79, 0xff },
 | 
			
		||||
            { 0x7a, 0x03 }, { 0x7b, 0xff }, { 0x7c, 0xff },
 | 
			
		||||
            { 0x7a, 0x03 }, { 0x7b, 0xff }, { 0x7c, 0xff }, { 0x7d, 0x90 },
 | 
			
		||||
            { 0x9e, 0x00 },
 | 
			
		||||
            { 0xaa, 0x00 },
 | 
			
		||||
        };
 | 
			
		||||
| 
						 | 
				
			
			@ -1695,7 +1696,7 @@ void genesys_init_sensor_tables()
 | 
			
		|||
            { 0x70, 0x08 }, { 0x71, 0x0c },
 | 
			
		||||
            { 0x74, 0x0f }, { 0x75, 0xff }, { 0x76, 0xff },
 | 
			
		||||
            { 0x77, 0x00 }, { 0x78, 0x01 }, { 0x79, 0xff },
 | 
			
		||||
            { 0x7a, 0x00 }, { 0x7b, 0x01 }, { 0x7c, 0xff },
 | 
			
		||||
            { 0x7a, 0x00 }, { 0x7b, 0x01 }, { 0x7c, 0xff }, { 0x7d, 0x90 },
 | 
			
		||||
            { 0x9e, 0xc0 },
 | 
			
		||||
            { 0xaa, 0x05 },
 | 
			
		||||
        };
 | 
			
		||||
| 
						 | 
				
			
			@ -1708,7 +1709,7 @@ void genesys_init_sensor_tables()
 | 
			
		|||
            { 0x70, 0x08 }, { 0x71, 0x0a },
 | 
			
		||||
            { 0x74, 0x0f }, { 0x75, 0xff }, { 0x76, 0xff },
 | 
			
		||||
            { 0x77, 0x00 }, { 0x78, 0x00 }, { 0x79, 0x00 },
 | 
			
		||||
            { 0x7a, 0x00 }, { 0x7b, 0x00 }, { 0x7c, 0x00 },
 | 
			
		||||
            { 0x7a, 0x00 }, { 0x7b, 0x00 }, { 0x7c, 0x00 }, { 0x7d, 0x90 },
 | 
			
		||||
            { 0x9e, 0xc0 },
 | 
			
		||||
            { 0xaa, 0x05 },
 | 
			
		||||
        };
 | 
			
		||||
| 
						 | 
				
			
			@ -1721,7 +1722,7 @@ void genesys_init_sensor_tables()
 | 
			
		|||
            { 0x70, 0x08 }, { 0x71, 0x0a },
 | 
			
		||||
            { 0x74, 0x0f }, { 0x75, 0xff }, { 0x76, 0xff },
 | 
			
		||||
            { 0x77, 0x00 }, { 0x78, 0x00 }, { 0x79, 0x00 },
 | 
			
		||||
            { 0x7a, 0x00 }, { 0x7b, 0x00 }, { 0x7c, 0x00 },
 | 
			
		||||
            { 0x7a, 0x00 }, { 0x7b, 0x00 }, { 0x7c, 0x00 }, { 0x7d, 0x90 },
 | 
			
		||||
            { 0x9e, 0xc0 },
 | 
			
		||||
            { 0xaa, 0x07 },
 | 
			
		||||
        };
 | 
			
		||||
| 
						 | 
				
			
			@ -1734,7 +1735,7 @@ void genesys_init_sensor_tables()
 | 
			
		|||
            { 0x70, 0x00 }, { 0x71, 0x02 },
 | 
			
		||||
            { 0x74, 0x00 }, { 0x75, 0x1c }, { 0x76, 0x7f },
 | 
			
		||||
            { 0x77, 0x03 }, { 0x78, 0xff }, { 0x79, 0xff },
 | 
			
		||||
            { 0x7a, 0x03 }, { 0x7b, 0xff }, { 0x7c, 0xff },
 | 
			
		||||
            { 0x7a, 0x03 }, { 0x7b, 0xff }, { 0x7c, 0xff }, { 0x7d, 0x90 },
 | 
			
		||||
            { 0x9e, 0x00 },
 | 
			
		||||
            { 0xaa, 0x00 },
 | 
			
		||||
        };
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Ładowanie…
	
		Reference in New Issue