genesys: Record motor slope tables in the config test

merge-requests/228/merge
Povilas Kanapickas 2019-11-23 12:38:40 +02:00
rodzic d8e8899a76
commit ce59a69224
12 zmienionych plików z 62 dodań i 0 usunięć

Wyświetl plik

@ -397,6 +397,9 @@ static void gl124_send_slope_table(Genesys_Device* dev, int table_nr,
DBG (DBG_io, "%s: %s\n", __func__, msg);
}
if (dev->interface->is_mock()) {
dev->interface->record_slope_table(table_nr, slope_table);
}
// slope table addresses are fixed
dev->interface->write_ahb(0x10000000 + 0x4000 * table_nr, steps * 2, table.data());
}

Wyświetl plik

@ -841,6 +841,9 @@ static void gl646_send_slope_table(Genesys_Device* dev, int table_nr,
table[i * 2 + 1] = slope_table[i] >> 8;
}
if (dev->interface->is_mock()) {
dev->interface->record_slope_table(table_nr, slope_table);
}
dev->interface->write_buffer(0x3c, start_address + table_nr * 0x100, table.data(), steps * 2);
}

Wyświetl plik

@ -573,6 +573,9 @@ static void gl841_send_slope_table(Genesys_Device* dev, int table_nr,
DBG(DBG_io, "%s: %s\n", __func__, msg);
}
if (dev->interface->is_mock()) {
dev->interface->record_slope_table(table_nr, slope_table);
}
dev->interface->write_buffer(0x3c, start_address + table_nr * 0x200, table.data(), steps * 2);
}

Wyświetl plik

@ -717,6 +717,10 @@ static void gl843_send_slope_table(Genesys_Device* dev, int table_nr,
DBG(DBG_io, "%s: %s\n", __func__, msg);
}
if (dev->interface->is_mock()) {
dev->interface->record_slope_table(table_nr, slope_table);
}
// slope table addresses are fixed : 0x40000, 0x48000, 0x50000, 0x58000, 0x60000
// XXX STEF XXX USB 1.1 ? sanei_genesys_write_0x8c (dev, 0x0f, 0x14);
dev->interface->write_gamma(0x28, 0x40000 + 0x8000 * table_nr, table.data(), steps * 2,

Wyświetl plik

@ -296,6 +296,9 @@ static void gl846_send_slope_table(Genesys_Device* dev, int table_nr,
DBG (DBG_io, "%s: %s\n", __func__, msg);
}
if (dev->interface->is_mock()) {
dev->interface->record_slope_table(table_nr, slope_table);
}
// slope table addresses are fixed
dev->interface->write_ahb(0x10000000 + 0x4000 * table_nr, steps * 2, table.data());
}

Wyświetl plik

@ -317,6 +317,9 @@ static void gl847_send_slope_table(Genesys_Device* dev, int table_nr,
DBG (DBG_io, "%s: %s\n", __func__, msg);
}
if (dev->interface->is_mock()) {
dev->interface->record_slope_table(table_nr, slope_table);
}
// slope table addresses are fixed
dev->interface->write_ahb(0x10000000 + 0x4000 * table_nr, steps * 2, table.data());
}

Wyświetl plik

@ -48,6 +48,7 @@
#include <cstddef>
#include <cstdint>
#include <string>
#include <vector>
namespace genesys {
@ -99,6 +100,8 @@ public:
virtual void record_progress_message(const char* msg) = 0;
virtual void record_slope_table(unsigned table_nr, const std::vector<std::uint16_t>& steps) = 0;
virtual void record_key_value(const std::string& key, const std::string& value) = 0;
virtual void test_checkpoint(const std::string& name) = 0;

Wyświetl plik

@ -494,6 +494,13 @@ void ScannerInterfaceUsb::record_progress_message(const char* msg)
sanei_usb_testing_record_message(msg);
}
void ScannerInterfaceUsb::record_slope_table(unsigned table_nr,
const std::vector<std::uint16_t>& steps)
{
(void) table_nr;
(void) steps;
}
void ScannerInterfaceUsb::record_key_value(const std::string& key, const std::string& value)
{
(void) key;

Wyświetl plik

@ -82,6 +82,8 @@ public:
void record_progress_message(const char* msg) override;
void record_slope_table(unsigned table_nr, const std::vector<std::uint16_t>& steps) override;
void record_key_value(const std::string& key, const std::string& value) override;
void test_checkpoint(const std::string& name) override;

Wyświetl plik

@ -183,6 +183,17 @@ void TestScannerInterface::sleep_us(unsigned microseconds)
(void) microseconds;
}
void TestScannerInterface::record_slope_table(unsigned table_nr,
const std::vector<std::uint16_t>& steps)
{
slope_tables_[table_nr] = steps;
}
std::map<unsigned, std::vector<std::uint16_t>>& TestScannerInterface::recorded_slope_tables()
{
return slope_tables_;
}
void TestScannerInterface::record_progress_message(const char* msg)
{
last_progress_message_ = msg;

Wyświetl plik

@ -90,6 +90,10 @@ public:
const std::string& last_progress_message() const;
void record_slope_table(unsigned table_nr, const std::vector<std::uint16_t>& steps) override;
std::map<unsigned, std::vector<std::uint16_t>>& recorded_slope_tables();
void record_key_value(const std::string& key, const std::string& value) override;
std::map<std::string, std::string>& recorded_key_values();
@ -106,6 +110,9 @@ private:
TestUsbDevice usb_dev_;
TestCheckpointCallback checkpoint_callback_;
std::map<unsigned, std::vector<std::uint16_t>> slope_tables_;
std::string last_progress_message_;
std::map<std::string, std::string> key_values_;
};

Wyświetl plik

@ -212,6 +212,18 @@ void build_checkpoint(const genesys::Genesys_Device& dev,
<< "iface.cached_fe_regs: "
<< genesys::format_indent_braced_list(4, iface.cached_fe_regs()) << "\n\n"
<< "iface.last_progress_message: " << iface.last_progress_message() << "\n\n";
out << "iface.slope_tables: {\n";
for (const auto& kv : iface.recorded_slope_tables()) {
out << " " << kv.first << ": {";
for (unsigned i = 0; i < kv.second.size(); ++i) {
if (i % 10 == 0) {
out << "\n ";
}
out << ' ' << kv.second[i];
}
out << "\n }\n";
}
out << "}\n";
if (iface.recorded_key_values().empty()) {
out << "iface.recorded_key_values: []\n";
} else {
@ -221,6 +233,7 @@ void build_checkpoint(const genesys::Genesys_Device& dev,
}
out << "}\n";
}
iface.recorded_key_values().clear();
out << "\n";
}