1141cc406Sopenharmony_ci/* sane - Scanner Access Now Easy.
2141cc406Sopenharmony_ci
3141cc406Sopenharmony_ci   Copyright (C) 2019 Povilas Kanapickas <povilas@radix.lt>
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_SCANNER_INTERFACE_USB_H
22141cc406Sopenharmony_ci#define BACKEND_GENESYS_SCANNER_INTERFACE_USB_H
23141cc406Sopenharmony_ci
24141cc406Sopenharmony_ci#include "scanner_interface.h"
25141cc406Sopenharmony_ci#include "usb_device.h"
26141cc406Sopenharmony_ci
27141cc406Sopenharmony_cinamespace genesys {
28141cc406Sopenharmony_ci
29141cc406Sopenharmony_ciclass ScannerInterfaceUsb : public ScannerInterface
30141cc406Sopenharmony_ci{
31141cc406Sopenharmony_cipublic:
32141cc406Sopenharmony_ci    ScannerInterfaceUsb(Genesys_Device* dev);
33141cc406Sopenharmony_ci
34141cc406Sopenharmony_ci    ~ScannerInterfaceUsb() override;
35141cc406Sopenharmony_ci
36141cc406Sopenharmony_ci    bool is_mock() const override;
37141cc406Sopenharmony_ci
38141cc406Sopenharmony_ci    std::uint8_t read_register(std::uint16_t address) override;
39141cc406Sopenharmony_ci    void write_register(std::uint16_t address, std::uint8_t value) override;
40141cc406Sopenharmony_ci    void write_registers(const Genesys_Register_Set& regs) override;
41141cc406Sopenharmony_ci
42141cc406Sopenharmony_ci    void write_0x8c(std::uint8_t index, std::uint8_t value) override;
43141cc406Sopenharmony_ci    void bulk_read_data(std::uint8_t addr, std::uint8_t* data, std::size_t size) override;
44141cc406Sopenharmony_ci    void bulk_write_data(std::uint8_t addr, std::uint8_t* data, std::size_t size) override;
45141cc406Sopenharmony_ci
46141cc406Sopenharmony_ci    void write_buffer(std::uint8_t type, std::uint32_t addr, std::uint8_t* data,
47141cc406Sopenharmony_ci                      std::size_t size) override;
48141cc406Sopenharmony_ci    void write_gamma(std::uint8_t type, std::uint32_t addr, std::uint8_t* data,
49141cc406Sopenharmony_ci                     std::size_t size) override;
50141cc406Sopenharmony_ci
51141cc406Sopenharmony_ci    void write_ahb(std::uint32_t addr, std::uint32_t size, std::uint8_t* data) override;
52141cc406Sopenharmony_ci
53141cc406Sopenharmony_ci    std::uint16_t read_fe_register(std::uint8_t address) override;
54141cc406Sopenharmony_ci    void write_fe_register(std::uint8_t address, std::uint16_t value) override;
55141cc406Sopenharmony_ci
56141cc406Sopenharmony_ci    IUsbDevice& get_usb_device() override;
57141cc406Sopenharmony_ci
58141cc406Sopenharmony_ci    void sleep_us(unsigned microseconds) override;
59141cc406Sopenharmony_ci
60141cc406Sopenharmony_ci    void record_progress_message(const char* msg) override;
61141cc406Sopenharmony_ci
62141cc406Sopenharmony_ci    void record_slope_table(unsigned table_nr, const std::vector<std::uint16_t>& steps) override;
63141cc406Sopenharmony_ci
64141cc406Sopenharmony_ci    void record_key_value(const std::string& key, const std::string& value) override;
65141cc406Sopenharmony_ci
66141cc406Sopenharmony_ci    void test_checkpoint(const std::string& name) override;
67141cc406Sopenharmony_ci
68141cc406Sopenharmony_ciprivate:
69141cc406Sopenharmony_ci    Genesys_Device* dev_;
70141cc406Sopenharmony_ci    UsbDevice usb_dev_;
71141cc406Sopenharmony_ci};
72141cc406Sopenharmony_ci
73141cc406Sopenharmony_ci} // namespace genesys
74141cc406Sopenharmony_ci
75141cc406Sopenharmony_ci#endif
76