1141cc406Sopenharmony_ci/* sane - Scanner Access Now Easy.
2141cc406Sopenharmony_ci
3141cc406Sopenharmony_ci   Copyright (C) 2010-2013 Stéphane Voltz <stef.dev@free.fr>
4141cc406Sopenharmony_ci
5141cc406Sopenharmony_ci   This file is part of the SANE package.
6141cc406Sopenharmony_ci
7141cc406Sopenharmony_ci   This program is free software; you can redistribute it and/or
8141cc406Sopenharmony_ci   modify it under the terms of the GNU General Public License as
9141cc406Sopenharmony_ci   published by the Free Software Foundation; either version 2 of the
10141cc406Sopenharmony_ci   License, or (at your option) any later version.
11141cc406Sopenharmony_ci
12141cc406Sopenharmony_ci   This program is distributed in the hope that it will be useful, but
13141cc406Sopenharmony_ci   WITHOUT ANY WARRANTY; without even the implied warranty of
14141cc406Sopenharmony_ci   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15141cc406Sopenharmony_ci   General Public License for more details.
16141cc406Sopenharmony_ci
17141cc406Sopenharmony_ci   You should have received a copy of the GNU General Public License
18141cc406Sopenharmony_ci   along with this program.  If not, see <https://www.gnu.org/licenses/>.
19141cc406Sopenharmony_ci*/
20141cc406Sopenharmony_ci
21141cc406Sopenharmony_ci#ifndef BACKEND_GENESYS_GL847_H
22141cc406Sopenharmony_ci#define BACKEND_GENESYS_GL847_H
23141cc406Sopenharmony_ci
24141cc406Sopenharmony_ci#include "genesys.h"
25141cc406Sopenharmony_ci#include "command_set_common.h"
26141cc406Sopenharmony_ci
27141cc406Sopenharmony_cinamespace genesys {
28141cc406Sopenharmony_cinamespace gl847 {
29141cc406Sopenharmony_ci
30141cc406Sopenharmony_ciclass CommandSetGl847 : public CommandSetCommon
31141cc406Sopenharmony_ci{
32141cc406Sopenharmony_cipublic:
33141cc406Sopenharmony_ci    ~CommandSetGl847() override = default;
34141cc406Sopenharmony_ci
35141cc406Sopenharmony_ci    bool needs_home_before_init_regs_for_scan(Genesys_Device* dev) const override;
36141cc406Sopenharmony_ci
37141cc406Sopenharmony_ci    void init(Genesys_Device* dev) const override;
38141cc406Sopenharmony_ci
39141cc406Sopenharmony_ci    void init_regs_for_warmup(Genesys_Device* dev, const Genesys_Sensor& sensor,
40141cc406Sopenharmony_ci                              Genesys_Register_Set* regs) const override;
41141cc406Sopenharmony_ci
42141cc406Sopenharmony_ci    void init_regs_for_shading(Genesys_Device* dev, const Genesys_Sensor& sensor,
43141cc406Sopenharmony_ci                               Genesys_Register_Set& regs) const override;
44141cc406Sopenharmony_ci
45141cc406Sopenharmony_ci    void init_regs_for_scan_session(Genesys_Device* dev, const Genesys_Sensor& sensor,
46141cc406Sopenharmony_ci                                    Genesys_Register_Set* reg,
47141cc406Sopenharmony_ci                                    const ScanSession& session) const override;
48141cc406Sopenharmony_ci
49141cc406Sopenharmony_ci    void set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor, std::uint8_t set) const override;
50141cc406Sopenharmony_ci    void set_powersaving(Genesys_Device* dev, int delay) const override;
51141cc406Sopenharmony_ci    void save_power(Genesys_Device* dev, bool enable) const override;
52141cc406Sopenharmony_ci
53141cc406Sopenharmony_ci    void begin_scan(Genesys_Device* dev, const Genesys_Sensor& sensor,
54141cc406Sopenharmony_ci                    Genesys_Register_Set* regs, bool start_motor) const override;
55141cc406Sopenharmony_ci
56141cc406Sopenharmony_ci    void end_scan(Genesys_Device* dev, Genesys_Register_Set* regs, bool check_stop) const override;
57141cc406Sopenharmony_ci
58141cc406Sopenharmony_ci    void send_gamma_table(Genesys_Device* dev, const Genesys_Sensor& sensor) const override;
59141cc406Sopenharmony_ci
60141cc406Sopenharmony_ci    void offset_calibration(Genesys_Device* dev, const Genesys_Sensor& sensor,
61141cc406Sopenharmony_ci                            Genesys_Register_Set& regs) const override;
62141cc406Sopenharmony_ci
63141cc406Sopenharmony_ci    void coarse_gain_calibration(Genesys_Device* dev, const Genesys_Sensor& sensor,
64141cc406Sopenharmony_ci                                 Genesys_Register_Set& regs, int dpi) const override;
65141cc406Sopenharmony_ci
66141cc406Sopenharmony_ci    SensorExposure led_calibration(Genesys_Device* dev, const Genesys_Sensor& sensor,
67141cc406Sopenharmony_ci                                   Genesys_Register_Set& regs) const override;
68141cc406Sopenharmony_ci
69141cc406Sopenharmony_ci    void wait_for_motor_stop(Genesys_Device* dev) const override;
70141cc406Sopenharmony_ci
71141cc406Sopenharmony_ci    void move_back_home(Genesys_Device* dev, bool wait_until_home) const override;
72141cc406Sopenharmony_ci
73141cc406Sopenharmony_ci    void update_hardware_sensors(struct Genesys_Scanner* s) const override;
74141cc406Sopenharmony_ci
75141cc406Sopenharmony_ci    void update_home_sensor_gpio(Genesys_Device& dev) const override;
76141cc406Sopenharmony_ci
77141cc406Sopenharmony_ci    void load_document(Genesys_Device* dev) const override;
78141cc406Sopenharmony_ci
79141cc406Sopenharmony_ci    void detect_document_end(Genesys_Device* dev) const override;
80141cc406Sopenharmony_ci
81141cc406Sopenharmony_ci    void eject_document(Genesys_Device* dev) const override;
82141cc406Sopenharmony_ci
83141cc406Sopenharmony_ci    void send_shading_data(Genesys_Device* dev, const Genesys_Sensor& sensor, std::uint8_t* data,
84141cc406Sopenharmony_ci                           int size) const override;
85141cc406Sopenharmony_ci
86141cc406Sopenharmony_ci    ScanSession calculate_scan_session(const Genesys_Device* dev,
87141cc406Sopenharmony_ci                                       const Genesys_Sensor& sensor,
88141cc406Sopenharmony_ci                                       const Genesys_Settings& settings) const override;
89141cc406Sopenharmony_ci
90141cc406Sopenharmony_ci    void asic_boot(Genesys_Device* dev, bool cold) const override;
91141cc406Sopenharmony_ci};
92141cc406Sopenharmony_ci
93141cc406Sopenharmony_cienum SlopeTable
94141cc406Sopenharmony_ci{
95141cc406Sopenharmony_ci    SCAN_TABLE = 0, // table 1 at 0x4000
96141cc406Sopenharmony_ci    BACKTRACK_TABLE = 1, // table 2 at 0x4800
97141cc406Sopenharmony_ci    STOP_TABLE = 2, // table 3 at 0x5000
98141cc406Sopenharmony_ci    FAST_TABLE = 3, // table 4 at 0x5800
99141cc406Sopenharmony_ci    HOME_TABLE = 4, // table 5 at 0x6000
100141cc406Sopenharmony_ci};
101141cc406Sopenharmony_ci
102141cc406Sopenharmony_ci} // namespace gl847
103141cc406Sopenharmony_ci} // namespace genesys
104141cc406Sopenharmony_ci
105141cc406Sopenharmony_ci#endif // BACKEND_GENESYS_GL847_H
106