1 /* sane - Scanner Access Now Easy. 2 3 Copyright (C) 2019 Povilas Kanapickas <povilas@radix.lt> 4 5 This file is part of the SANE package. 6 7 This program is free software; you can redistribute it and/or 8 modify it under the terms of the GNU General Public License as 9 published by the Free Software Foundation; either version 2 of the 10 License, or (at your option) any later version. 11 12 This program is distributed in the hope that it will be useful, but 13 WITHOUT ANY WARRANTY; without even the implied warranty of 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 General Public License for more details. 16 17 You should have received a copy of the GNU General Public License 18 along with this program. If not, see <https://www.gnu.org/licenses/>. 19 */ 20 21 #ifndef BACKEND_GENESYS_SCANNER_INTERFACE_USB_H 22 #define BACKEND_GENESYS_SCANNER_INTERFACE_USB_H 23 24 #include "scanner_interface.h" 25 #include "usb_device.h" 26 27 namespace genesys { 28 29 class ScannerInterfaceUsb : public ScannerInterface 30 { 31 public: 32 ScannerInterfaceUsb(Genesys_Device* dev); 33 34 ~ScannerInterfaceUsb() override; 35 36 bool is_mock() const override; 37 38 std::uint8_t read_register(std::uint16_t address) override; 39 void write_register(std::uint16_t address, std::uint8_t value) override; 40 void write_registers(const Genesys_Register_Set& regs) override; 41 42 void write_0x8c(std::uint8_t index, std::uint8_t value) override; 43 void bulk_read_data(std::uint8_t addr, std::uint8_t* data, std::size_t size) override; 44 void bulk_write_data(std::uint8_t addr, std::uint8_t* data, std::size_t size) override; 45 46 void write_buffer(std::uint8_t type, std::uint32_t addr, std::uint8_t* data, 47 std::size_t size) override; 48 void write_gamma(std::uint8_t type, std::uint32_t addr, std::uint8_t* data, 49 std::size_t size) override; 50 51 void write_ahb(std::uint32_t addr, std::uint32_t size, std::uint8_t* data) override; 52 53 std::uint16_t read_fe_register(std::uint8_t address) override; 54 void write_fe_register(std::uint8_t address, std::uint16_t value) override; 55 56 IUsbDevice& get_usb_device() override; 57 58 void sleep_us(unsigned microseconds) override; 59 60 void record_progress_message(const char* msg) override; 61 62 void record_slope_table(unsigned table_nr, const std::vector<std::uint16_t>& steps) override; 63 64 void record_key_value(const std::string& key, const std::string& value) override; 65 66 void test_checkpoint(const std::string& name) override; 67 68 private: 69 Genesys_Device* dev_; 70 UsbDevice usb_dev_; 71 }; 72 73 } // namespace genesys 74 75 #endif 76