kopia lustrzana https://gitlab.com/sane-project/backends
genesys: Use same buffer and gamma write method on all chipsets
rodzic
aca291906c
commit
498b52fe98
|
@ -779,8 +779,7 @@ uint8_t *table;
|
||||||
table=tdefault;
|
table=tdefault;
|
||||||
}
|
}
|
||||||
dev->interface->write_register(0x66, 0x00);
|
dev->interface->write_register(0x66, 0x00);
|
||||||
dev->interface->write_gamma(0x28, 0xc000, table, 128,
|
dev->interface->write_gamma(0x28, 0xc000, table, 128);
|
||||||
ScannerInterface::FLAG_SWAP_REGISTERS);
|
|
||||||
dev->interface->write_register(0x5b, 0x00);
|
dev->interface->write_register(0x5b, 0x00);
|
||||||
dev->interface->write_register(0x5c, 0x00);
|
dev->interface->write_register(0x5c, 0x00);
|
||||||
}
|
}
|
||||||
|
|
|
@ -652,8 +652,7 @@ gl843_init_registers (Genesys_Device * dev)
|
||||||
0x6a, 0x73, 0x63, 0x68, 0x69, 0x65, 0x6e, 0x00,
|
0x6a, 0x73, 0x63, 0x68, 0x69, 0x65, 0x6e, 0x00,
|
||||||
};
|
};
|
||||||
|
|
||||||
dev->interface->write_buffer(0x3c, 0x3ff000, data, 32,
|
dev->interface->write_buffer(0x3c, 0x3ff000, data, 32);
|
||||||
ScannerInterface::FLAG_SWAP_REGISTERS);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -679,8 +678,7 @@ static void gl843_send_slope_table(Genesys_Device* dev, int table_nr,
|
||||||
|
|
||||||
// slope table addresses are fixed : 0x40000, 0x48000, 0x50000, 0x58000, 0x60000
|
// slope table addresses are fixed : 0x40000, 0x48000, 0x50000, 0x58000, 0x60000
|
||||||
// XXX STEF XXX USB 1.1 ? sanei_genesys_write_0x8c (dev, 0x0f, 0x14);
|
// 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,
|
dev->interface->write_gamma(0x28, 0x40000 + 0x8000 * table_nr, table.data(), steps * 2);
|
||||||
ScannerInterface::FLAG_SWAP_REGISTERS);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gl843_set_ad_fe(Genesys_Device* dev)
|
static void gl843_set_ad_fe(Genesys_Device* dev)
|
||||||
|
@ -1794,8 +1792,7 @@ void CommandSetGl843::send_gamma_table(Genesys_Device* dev, const Genesys_Sensor
|
||||||
gamma[i * 2 + size * 4 + 1] = (bgamma[i] >> 8) & 0xff;
|
gamma[i * 2 + size * 4 + 1] = (bgamma[i] >> 8) & 0xff;
|
||||||
}
|
}
|
||||||
|
|
||||||
dev->interface->write_gamma(0x28, 0x0000, gamma.data(), size * 2 * 3,
|
dev->interface->write_gamma(0x28, 0x0000, gamma.data(), size * 2 * 3);
|
||||||
ScannerInterface::FLAG_SWAP_REGISTERS);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* this function does the led calibration by scanning one line of the calibration
|
/* this function does the led calibration by scanning one line of the calibration
|
||||||
|
@ -2851,8 +2848,7 @@ void CommandSetGl843::send_shading_data(Genesys_Device* dev, const Genesys_Senso
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dev->interface->write_buffer(0x3c, 0, final_data.data(), count,
|
dev->interface->write_buffer(0x3c, 0, final_data.data(), count);
|
||||||
ScannerInterface::FLAG_SMALL_ADDRESS);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CommandSetGl843::needs_home_before_init_regs_for_scan(Genesys_Device* dev) const
|
bool CommandSetGl843::needs_home_before_init_regs_for_scan(Genesys_Device* dev) const
|
||||||
|
|
|
@ -56,11 +56,6 @@ namespace genesys {
|
||||||
class ScannerInterface
|
class ScannerInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum Flags {
|
|
||||||
FLAG_NONE = 0,
|
|
||||||
FLAG_SWAP_REGISTERS = 1 << 0,
|
|
||||||
FLAG_SMALL_ADDRESS = 1 << 1
|
|
||||||
};
|
|
||||||
|
|
||||||
virtual ~ScannerInterface();
|
virtual ~ScannerInterface();
|
||||||
|
|
||||||
|
@ -77,10 +72,10 @@ public:
|
||||||
// GL646, GL841, GL843 have different ways to write to RAM and to gamma tables
|
// GL646, GL841, GL843 have different ways to write to RAM and to gamma tables
|
||||||
// FIXME: remove flags when updating tests
|
// FIXME: remove flags when updating tests
|
||||||
virtual void write_buffer(std::uint8_t type, std::uint32_t addr, std::uint8_t* data,
|
virtual void write_buffer(std::uint8_t type, std::uint32_t addr, std::uint8_t* data,
|
||||||
std::size_t size, Flags flags = FLAG_NONE) = 0;
|
std::size_t size) = 0;
|
||||||
|
|
||||||
virtual void write_gamma(std::uint8_t type, std::uint32_t addr, std::uint8_t* data,
|
virtual void write_gamma(std::uint8_t type, std::uint32_t addr, std::uint8_t* data,
|
||||||
std::size_t size, Flags flags = FLAG_NONE) = 0;
|
std::size_t size) = 0;
|
||||||
|
|
||||||
// GL845, GL846, GL847 and GL124 have a uniform way to write to RAM tables
|
// GL845, GL846, GL847 and GL124 have a uniform way to write to RAM tables
|
||||||
virtual void write_ahb(std::uint32_t addr, std::uint32_t size, std::uint8_t* data) = 0;
|
virtual void write_ahb(std::uint32_t addr, std::uint32_t size, std::uint8_t* data) = 0;
|
||||||
|
|
|
@ -351,7 +351,7 @@ void ScannerInterfaceUsb::bulk_write_data(std::uint8_t addr, std::uint8_t* data,
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScannerInterfaceUsb::write_buffer(std::uint8_t type, std::uint32_t addr, std::uint8_t* data,
|
void ScannerInterfaceUsb::write_buffer(std::uint8_t type, std::uint32_t addr, std::uint8_t* data,
|
||||||
std::size_t size, Flags flags)
|
std::size_t size)
|
||||||
{
|
{
|
||||||
DBG_HELPER_ARGS(dbg, "type: 0x%02x, addr: 0x%08x, size: 0x%08zx", type, addr, size);
|
DBG_HELPER_ARGS(dbg, "type: 0x%02x, addr: 0x%08x, size: 0x%08zx", type, addr, size);
|
||||||
if (dev_->model->asic_type != AsicType::GL646 &&
|
if (dev_->model->asic_type != AsicType::GL646 &&
|
||||||
|
@ -362,19 +362,9 @@ void ScannerInterfaceUsb::write_buffer(std::uint8_t type, std::uint32_t addr, st
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dev_->model->asic_type == AsicType::GL843) {
|
if (dev_->model->asic_type == AsicType::GL843) {
|
||||||
if (flags & FLAG_SWAP_REGISTERS) {
|
write_register(0x2b, ((addr >> 4) & 0xff));
|
||||||
if (!(flags & FLAG_SMALL_ADDRESS)) {
|
write_register(0x2a, ((addr >> 12) & 0xff));
|
||||||
write_register(0x29, ((addr >> 20) & 0xff));
|
write_register(0x29, ((addr >> 20) & 0xff));
|
||||||
}
|
|
||||||
write_register(0x2a, ((addr >> 12) & 0xff));
|
|
||||||
write_register(0x2b, ((addr >> 4) & 0xff));
|
|
||||||
} else {
|
|
||||||
write_register(0x2b, ((addr >> 4) & 0xff));
|
|
||||||
write_register(0x2a, ((addr >> 12) & 0xff));
|
|
||||||
if (!(flags & FLAG_SMALL_ADDRESS)) {
|
|
||||||
write_register(0x29, ((addr >> 20) & 0xff));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
write_register(0x2b, ((addr >> 4) & 0xff));
|
write_register(0x2b, ((addr >> 4) & 0xff));
|
||||||
write_register(0x2a, ((addr >> 12) & 0xff));
|
write_register(0x2a, ((addr >> 12) & 0xff));
|
||||||
|
@ -383,7 +373,7 @@ void ScannerInterfaceUsb::write_buffer(std::uint8_t type, std::uint32_t addr, st
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScannerInterfaceUsb::write_gamma(std::uint8_t type, std::uint32_t addr, std::uint8_t* data,
|
void ScannerInterfaceUsb::write_gamma(std::uint8_t type, std::uint32_t addr, std::uint8_t* data,
|
||||||
std::size_t size, Flags flags)
|
std::size_t size)
|
||||||
{
|
{
|
||||||
DBG_HELPER_ARGS(dbg, "type: 0x%02x, addr: 0x%08x, size: 0x%08zx", type, addr, size);
|
DBG_HELPER_ARGS(dbg, "type: 0x%02x, addr: 0x%08x, size: 0x%08zx", type, addr, size);
|
||||||
if (dev_->model->asic_type != AsicType::GL841 &&
|
if (dev_->model->asic_type != AsicType::GL841 &&
|
||||||
|
@ -392,13 +382,8 @@ void ScannerInterfaceUsb::write_gamma(std::uint8_t type, std::uint32_t addr, std
|
||||||
throw SaneException("Unsupported transfer mode");
|
throw SaneException("Unsupported transfer mode");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags & FLAG_SWAP_REGISTERS) {
|
write_register(0x5b, ((addr >> 12) & 0xff));
|
||||||
write_register(0x5b, ((addr >> 12) & 0xff));
|
write_register(0x5c, ((addr >> 4) & 0xff));
|
||||||
write_register(0x5c, ((addr >> 4) & 0xff));
|
|
||||||
} else {
|
|
||||||
write_register(0x5c, ((addr >> 4) & 0xff));
|
|
||||||
write_register(0x5b, ((addr >> 12) & 0xff));
|
|
||||||
}
|
|
||||||
bulk_write_data(type, data, size);
|
bulk_write_data(type, data, size);
|
||||||
|
|
||||||
if (dev_->model->asic_type == AsicType::GL843) {
|
if (dev_->model->asic_type == AsicType::GL843) {
|
||||||
|
|
|
@ -67,9 +67,9 @@ public:
|
||||||
void bulk_write_data(std::uint8_t addr, std::uint8_t* data, std::size_t size) override;
|
void bulk_write_data(std::uint8_t addr, std::uint8_t* data, std::size_t size) override;
|
||||||
|
|
||||||
void write_buffer(std::uint8_t type, std::uint32_t addr, std::uint8_t* data,
|
void write_buffer(std::uint8_t type, std::uint32_t addr, std::uint8_t* data,
|
||||||
std::size_t size, Flags flags) override;
|
std::size_t size) override;
|
||||||
void write_gamma(std::uint8_t type, std::uint32_t addr, std::uint8_t* data,
|
void write_gamma(std::uint8_t type, std::uint32_t addr, std::uint8_t* data,
|
||||||
std::size_t size, Flags flags) override;
|
std::size_t size) override;
|
||||||
|
|
||||||
void write_ahb(std::uint32_t addr, std::uint32_t size, std::uint8_t* data) override;
|
void write_ahb(std::uint32_t addr, std::uint32_t size, std::uint8_t* data) override;
|
||||||
|
|
||||||
|
|
|
@ -137,23 +137,21 @@ void TestScannerInterface::bulk_write_data(std::uint8_t addr, std::uint8_t* data
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestScannerInterface::write_buffer(std::uint8_t type, std::uint32_t addr, std::uint8_t* data,
|
void TestScannerInterface::write_buffer(std::uint8_t type, std::uint32_t addr, std::uint8_t* data,
|
||||||
std::size_t size, Flags flags)
|
std::size_t size)
|
||||||
{
|
{
|
||||||
(void) type;
|
(void) type;
|
||||||
(void) addr;
|
(void) addr;
|
||||||
(void) data;
|
(void) data;
|
||||||
(void) size;
|
(void) size;
|
||||||
(void) flags;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestScannerInterface::write_gamma(std::uint8_t type, std::uint32_t addr, std::uint8_t* data,
|
void TestScannerInterface::write_gamma(std::uint8_t type, std::uint32_t addr, std::uint8_t* data,
|
||||||
std::size_t size, Flags flags)
|
std::size_t size)
|
||||||
{
|
{
|
||||||
(void) type;
|
(void) type;
|
||||||
(void) addr;
|
(void) addr;
|
||||||
(void) data;
|
(void) data;
|
||||||
(void) size;
|
(void) size;
|
||||||
(void) flags;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestScannerInterface::write_ahb(std::uint32_t addr, std::uint32_t size, std::uint8_t* data)
|
void TestScannerInterface::write_ahb(std::uint32_t addr, std::uint32_t size, std::uint8_t* data)
|
||||||
|
|
|
@ -74,9 +74,9 @@ public:
|
||||||
void bulk_write_data(std::uint8_t addr, std::uint8_t* data, std::size_t size) override;
|
void bulk_write_data(std::uint8_t addr, std::uint8_t* data, std::size_t size) override;
|
||||||
|
|
||||||
void write_buffer(std::uint8_t type, std::uint32_t addr, std::uint8_t* data,
|
void write_buffer(std::uint8_t type, std::uint32_t addr, std::uint8_t* data,
|
||||||
std::size_t size, Flags flags) override;
|
std::size_t size) override;
|
||||||
void write_gamma(std::uint8_t type, std::uint32_t addr, std::uint8_t* data,
|
void write_gamma(std::uint8_t type, std::uint32_t addr, std::uint8_t* data,
|
||||||
std::size_t size, Flags flags) override;
|
std::size_t size) override;
|
||||||
void write_ahb(std::uint32_t addr, std::uint32_t size, std::uint8_t* data) override;
|
void write_ahb(std::uint32_t addr, std::uint32_t size, std::uint8_t* data) override;
|
||||||
|
|
||||||
std::uint16_t read_fe_register(std::uint8_t address) override;
|
std::uint16_t read_fe_register(std::uint8_t address) override;
|
||||||
|
|
Ładowanie…
Reference in New Issue