genesys: Use {uint,int}{8,16,32,64} from std namespace

This is not strictly necessary as all known C++ compilers also inject
these types to the global namespace. However this is not guaranteed by
the C++ standard and accordingly some code completion tools don't
support this without additional configuration.
merge-requests/670/head
Povilas Kanapickas 2021-12-26 16:09:17 +02:00
rodzic 7c76892b98
commit b668e92047
20 zmienionych plików z 253 dodań i 265 usunięć

Wyświetl plik

@ -331,9 +331,8 @@ void sanei_genesys_init_structs (Genesys_Device * dev)
* @param gamma gamma to compute values
* @return a gamma table filled with the computed values
* */
void
sanei_genesys_create_gamma_table (std::vector<uint16_t>& gamma_table, int size,
float maximum, float gamma_max, float gamma)
void sanei_genesys_create_gamma_table(std::vector<std::uint16_t>& gamma_table, int size,
float maximum, float gamma_max, float gamma)
{
gamma_table.clear();
gamma_table.resize(size, 0);
@ -355,7 +354,7 @@ sanei_genesys_create_gamma_table (std::vector<uint16_t>& gamma_table, int size,
}
void sanei_genesys_create_default_gamma_table(Genesys_Device* dev,
std::vector<uint16_t>& gamma_table, float gamma)
std::vector<std::uint16_t>& gamma_table, float gamma)
{
int size = 0;
int max = 0;
@ -417,7 +416,7 @@ SANE_Int sanei_genesys_exposure_time2(Genesys_Device * dev, const MotorProfile&
The data needs to be of size "size", and in little endian byte order.
*/
static void genesys_send_offset_and_shading(Genesys_Device* dev, const Genesys_Sensor& sensor,
uint8_t* data, int size)
std::uint8_t* data, int size)
{
DBG_HELPER_ARGS(dbg, "(size = %d)", size);
int start_address;
@ -448,10 +447,10 @@ void sanei_genesys_init_shading_data(Genesys_Device* dev, const Genesys_Sensor&
unsigned channels = dev->settings.get_channels();
// 16 bit black, 16 bit white
std::vector<uint8_t> shading_data(pixels_per_line * 4 * channels, 0);
// 16 bit black, 16 bit white
std::vector<std::uint8_t> shading_data(pixels_per_line * 4 * channels, 0);
uint8_t* shading_data_ptr = shading_data.data();
std::uint8_t* shading_data_ptr = shading_data.data();
for (unsigned i = 0; i < pixels_per_line * channels; i++) {
*shading_data_ptr++ = 0x00; /* dark lo */
@ -508,7 +507,7 @@ void scanner_clear_scan_and_feed_counts(Genesys_Device& dev)
}
void scanner_send_slope_table(Genesys_Device* dev, const Genesys_Sensor& sensor, unsigned table_nr,
const std::vector<uint16_t>& slope_table)
const std::vector<std::uint16_t>& slope_table)
{
DBG_HELPER_ARGS(dbg, "table_nr = %d, steps = %zu", table_nr, slope_table.size());
@ -536,7 +535,7 @@ void scanner_send_slope_table(Genesys_Device* dev, const Genesys_Sensor& sensor,
throw SaneException("invalid table number %d", table_nr);
}
std::vector<uint8_t> table;
std::vector<std::uint8_t> table;
table.reserve(slope_table.size() * 2);
for (std::size_t i = 0; i < slope_table.size(); i++) {
table.push_back(slope_table[i] & 0xff);
@ -1888,7 +1887,7 @@ void scanner_coarse_gain_calibration(Genesys_Device& dev, const Genesys_Sensor&
if (dev.model->asic_type == AsicType::GL842 ||
dev.model->asic_type == AsicType::GL843)
{
std::vector<uint16_t> values;
std::vector<std::uint16_t> values;
// FIXME: start from the second line because the first line often has artifacts. Probably
// caused by unclean cleanup of previous scan
for (std::size_t x = pixels / 4; x < (pixels * 3 / 4); x++) {
@ -2286,12 +2285,12 @@ SensorExposure scanner_led_calibration(Genesys_Device& dev, const Genesys_Sensor
}
void sanei_genesys_calculate_zmod(bool two_table,
uint32_t exposure_time,
const std::vector<uint16_t>& slope_table,
std::uint32_t exposure_time,
const std::vector<std::uint16_t>& slope_table,
unsigned acceleration_steps,
unsigned move_steps,
unsigned buffer_acceleration_steps,
uint32_t* out_z1, uint32_t* out_z2)
std::uint32_t* out_z1, std::uint32_t* out_z2)
{
// acceleration total time
unsigned sum = std::accumulate(slope_table.begin(), slope_table.begin() + acceleration_steps,
@ -2341,7 +2340,7 @@ static void genesys_shading_calibration_impl(Genesys_Device* dev, const Genesys_
debug_dump(DBG_info, dev->calib_session);
size_t size;
uint32_t pixels_per_line;
std::uint32_t pixels_per_line;
if (dev->model->asic_type == AsicType::GL842 ||
dev->model->asic_type == AsicType::GL843 ||
@ -2382,7 +2381,7 @@ static void genesys_shading_calibration_impl(Genesys_Device* dev, const Genesys_
size = channels * 2 * pixels_per_line * (dev->calib_session.params.lines + 1);
}
std::vector<uint16_t> calibration_data(size / 2);
std::vector<std::uint16_t> calibration_data(size / 2);
// turn off motor and lamp power for flatbed scanners, but not for sheetfed scanners
// because they have a calibration sheet with a sufficient black strip
@ -2461,8 +2460,8 @@ static void genesys_shading_calibration_impl(Genesys_Device* dev, const Genesys_
static void genesys_dark_shading_by_dummy_pixel(Genesys_Device* dev, const Genesys_Sensor& sensor)
{
DBG_HELPER(dbg);
uint32_t pixels_per_line;
uint32_t skip, xend;
std::uint32_t pixels_per_line;
std::uint32_t skip, xend;
int dummy1, dummy2, dummy3; /* dummy black average per channel */
if (dev->model->asic_type == AsicType::GL842 ||
@ -2686,11 +2685,9 @@ static void genesys_dark_white_shading_calibration(Genesys_Device* dev,
dev->interface->write_registers(local_reg);
}
size_t size;
uint32_t pixels_per_line;
std::size_t size;
std::uint32_t pixels_per_line;
unsigned int x;
uint32_t dark, white, dark_sum, white_sum, dark_count, white_count, col,
dif;
if (dev->model->asic_type == AsicType::GL842 ||
dev->model->asic_type == AsicType::GL843)
@ -2726,7 +2723,7 @@ static void genesys_dark_white_shading_calibration(Genesys_Device* dev,
size = channels * 2 * pixels_per_line * dev->calib_session.params.lines;
}
std::vector<uint8_t> calibration_data(size);
std::vector<std::uint8_t> calibration_data(size);
// turn on motor and lamp power
sanei_genesys_set_lamp_power(dev, sensor, local_reg, true);
@ -2764,19 +2761,17 @@ static void genesys_dark_white_shading_calibration(Genesys_Device* dev,
std::fill(dev->white_average_data.begin(),
dev->white_average_data.begin() + start_offset * channels, 0);
uint16_t* average_white = dev->white_average_data.data() +
start_offset * channels;
uint16_t* average_dark = dev->dark_average_data.data() +
start_offset * channels;
std::uint16_t* average_white = dev->white_average_data.data() + start_offset * channels;
std::uint16_t* average_dark = dev->dark_average_data.data() + start_offset * channels;
for (x = 0; x < pixels_per_line * channels; x++)
{
dark = 0xffff;
white = 0;
std::uint32_t dark = 0xffff;
std::uint32_t white = 0;
for (std::size_t y = 0; y < dev->calib_session.params.lines; y++)
{
col = calibration_data[(x + y * pixels_per_line * channels) * 2];
std::uint32_t col = calibration_data[(x + y * pixels_per_line * channels) * 2];
col |=
calibration_data[(x + y * pixels_per_line * channels) * 2 +
1] << 8;
@ -2787,20 +2782,20 @@ static void genesys_dark_white_shading_calibration(Genesys_Device* dev,
dark = col;
}
dif = white - dark;
std::uint32_t dif = white - dark;
dark = dark + dif / 8;
white = white - dif / 8;
dark_count = 0;
dark_sum = 0;
std::uint32_t dark_count = 0;
std::uint32_t dark_sum = 0;
white_count = 0;
white_sum = 0;
std::uint32_t white_count = 0;
std::uint32_t white_sum = 0;
for (std::size_t y = 0; y < dev->calib_session.params.lines; y++)
{
col = calibration_data[(x + y * pixels_per_line * channels) * 2];
std::uint32_t col = calibration_data[(x + y * pixels_per_line * channels) * 2];
col |=
calibration_data[(x + y * pixels_per_line * channels) * 2 +
1] << 8;
@ -2888,9 +2883,8 @@ compute_coefficient (unsigned int coeff, unsigned int target, unsigned int value
* @param target_bright value of the white target code
* @param target_dark value of the black target code
*/
static void
compute_averaged_planar (Genesys_Device * dev, const Genesys_Sensor& sensor,
uint8_t * shading_data,
static void compute_averaged_planar(Genesys_Device * dev, const Genesys_Sensor& sensor,
std::uint8_t* shading_data,
unsigned int pixels_per_line,
unsigned int words_per_color,
unsigned int channels,
@ -3069,7 +3063,7 @@ static std::array<unsigned, 3> color_order_to_cmat(ColorOrder color_order)
* @param target value of the target code
*/
static void compute_coefficients(Genesys_Device * dev,
uint8_t * shading_data,
std::uint8_t* shading_data,
unsigned int pixels_per_line,
unsigned int channels,
ColorOrder color_order,
@ -3077,7 +3071,6 @@ static void compute_coefficients(Genesys_Device * dev,
unsigned int coeff,
unsigned int target)
{
uint8_t *ptr; /* contain 16bit words in little endian */
unsigned int x, c;
unsigned int val, br, dk;
unsigned int start, end;
@ -3103,7 +3096,8 @@ static void compute_coefficients(Genesys_Device * dev,
for (x = start; x < end; x++)
{
/* TODO if channels=1 , use filter to know the base addr */
ptr = shading_data + 4 * ((x + offset) * channels + cmat[c]);
// contain 16bit words in little endian
std::uint8_t* ptr = shading_data + 4 * ((x + offset) * channels + cmat[c]);
// dark data
dk = dev->dark_average_data[x * channels + c];
@ -3141,7 +3135,7 @@ static void compute_coefficients(Genesys_Device * dev,
* @param target white target value
*/
static void compute_planar_coefficients(Genesys_Device * dev,
uint8_t * shading_data,
std::uint8_t* shading_data,
unsigned int factor,
unsigned int pixels_per_line,
unsigned int words_per_color,
@ -3151,22 +3145,20 @@ static void compute_planar_coefficients(Genesys_Device * dev,
unsigned int coeff,
unsigned int target)
{
uint8_t *ptr; /* contains 16bit words in little endian */
uint32_t x, c, i;
uint32_t val, dk, br;
std::uint32_t i;
std::uint32_t val, dk, br;
auto cmat = color_order_to_cmat(color_order);
DBG(DBG_io, "%s: factor=%d, pixels_per_line=%d, words=0x%X, coeff=0x%04x\n", __func__, factor,
pixels_per_line, words_per_color, coeff);
for (c = 0; c < channels; c++)
{
for (unsigned c = 0; c < channels; c++) {
/* shading data is larger than pixels_per_line so offset can be neglected */
for (x = 0; x < pixels_per_line; x+=factor)
{
for (unsigned x = 0; x < pixels_per_line; x += factor) {
/* x2 because of 16 bit values, and x2 since one coeff for dark
* and another for white */
ptr = shading_data + words_per_color * cmat[c] * 2 + (x + offset) * 4;
// contains 16bit words in little endian
std::uint8_t* ptr = shading_data + words_per_color * cmat[c] * 2 + (x + offset) * 4;
dk = 0;
br = 0;
@ -3182,9 +3174,8 @@ static void compute_planar_coefficients(Genesys_Device * dev,
val = compute_coefficient (coeff, target, br - dk);
/* we duplicate the information to have calibration data at optical resolution */
for (i = 0; i < factor; i++)
{
// we duplicate the information to have calibration data at optical resolution
for (unsigned i = 0; i < factor; i++) {
ptr[0 + 4 * i] = dk & 255;
ptr[1 + 4 * i] = dk / 256;
ptr[2 + 4 * i] = val & 0xff;
@ -3205,10 +3196,9 @@ static void compute_planar_coefficients(Genesys_Device * dev,
}
}
static void
compute_shifted_coefficients (Genesys_Device * dev,
const Genesys_Sensor& sensor,
uint8_t * shading_data,
static void compute_shifted_coefficients(Genesys_Device * dev,
const Genesys_Sensor& sensor,
std::uint8_t* shading_data,
unsigned int pixels_per_line,
unsigned int channels,
ColorOrder color_order,
@ -3220,7 +3210,7 @@ compute_shifted_coefficients (Genesys_Device * dev,
{
unsigned int x, avgpixels, basepixels, i, j, val1, val2;
unsigned int br_tmp [3], dk_tmp [3];
uint8_t *ptr = shading_data + offset * 3 * 4; /* contain 16bit words in little endian */
std::uint8_t* ptr = shading_data + offset * 3 * 4; // contain 16bit words in little endian
unsigned int patch_cnt = offset * 3; /* at start, offset of first patch */
auto cmat = color_order_to_cmat(color_order);
@ -3306,7 +3296,7 @@ static void genesys_send_shading_coefficient(Genesys_Device* dev, const Genesys_
return;
}
uint32_t pixels_per_line;
std::uint32_t pixels_per_line;
int o;
unsigned int length; /**> number of shading calibration data words */
unsigned int factor;
@ -3363,8 +3353,8 @@ static void genesys_send_shading_coefficient(Genesys_Device* dev, const Genesys_
length = words_per_color * 3 * 2;
/* allocate computed size */
// contains 16bit words in little endian
std::vector<uint8_t> shading_data(length, 0);
// contains 16bit words in little endian
std::vector<std::uint8_t> shading_data(length, 0);
if (!dev->calib_session.computed) {
genesys_send_offset_and_shading(dev, sensor, shading_data.data(), length);
@ -3692,7 +3682,7 @@ static void genesys_save_calibration(Genesys_Device* dev, const Genesys_Sensor&
static void genesys_flatbed_calibration(Genesys_Device* dev, Genesys_Sensor& sensor)
{
DBG_HELPER(dbg);
uint32_t pixels_per_line;
std::uint32_t pixels_per_line;
unsigned coarse_res = sensor.full_resolution;
if (dev->settings.yres <= sensor.full_resolution / 2) {
@ -3965,8 +3955,8 @@ static void genesys_warmup_lamp(Genesys_Device* dev)
auto channels = dev->session.params.channels;
auto lines = dev->session.output_line_count;
std::vector<uint8_t> first_line(total_size);
std::vector<uint8_t> second_line(total_size);
std::vector<std::uint8_t> first_line(total_size);
std::vector<std::uint8_t> second_line(total_size);
do {
first_line = second_line;
@ -5702,7 +5692,7 @@ static void get_option_value(Genesys_Scanner* s, int option, void* val)
auto* dev = s->dev;
unsigned int i;
SANE_Word* table = nullptr;
std::vector<uint16_t> gamma_table;
std::vector<std::uint16_t> gamma_table;
unsigned option_size = 0;
const Genesys_Sensor* sensor = nullptr;

Wyświetl plik

@ -376,7 +376,7 @@ gl124_init_registers (Genesys_Device * dev)
* @param dev device owning the AFE
* @param set flag AFE_INIT to specify the AFE must be reset before writing data
* */
static void gl124_set_ti_fe(Genesys_Device* dev, uint8_t set)
static void gl124_set_ti_fe(Genesys_Device* dev, std::uint8_t set)
{
DBG_HELPER(dbg);
int i;
@ -388,9 +388,8 @@ static void gl124_set_ti_fe(Genesys_Device* dev, uint8_t set)
// start writing to DAC
dev->interface->write_fe_register(0x00, 0x80);
/* write values to analog frontend */
for (uint16_t addr = 0x01; addr < 0x04; addr++)
{
// write values to analog frontend
for (std::uint16_t addr = 0x01; addr < 0x04; addr++) {
dev->interface->write_fe_register(addr, dev->frontend.regs.get_value(addr));
}
@ -413,13 +412,14 @@ static void gl124_set_ti_fe(Genesys_Device* dev, uint8_t set)
// Set values of analog frontend
void CommandSetGl124::set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t set) const
void CommandSetGl124::set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor,
std::uint8_t set) const
{
DBG_HELPER_ARGS(dbg, "%s", set == AFE_INIT ? "init" :
set == AFE_SET ? "set" :
set == AFE_POWER_SAVE ? "powersave" : "huh?");
(void) sensor;
uint8_t val;
std::uint8_t val;
if (set == AFE_INIT) {
dev->frontend = dev->frontend_initial;
@ -456,7 +456,7 @@ static void gl124_init_motor_regs_scan(Genesys_Device* dev,
int use_fast_fed;
unsigned int lincnt, fast_dpi;
unsigned int feedl,dist;
uint32_t z1, z2;
std::uint32_t z1, z2;
unsigned yres;
unsigned min_speed;
unsigned int linesel;
@ -514,7 +514,7 @@ static void gl124_init_motor_regs_scan(Genesys_Device* dev,
reg->set24(REG_LINCNT, lincnt);
/* compute register 02 value */
uint8_t r02 = REG_0x02_NOTHOME;
std::uint8_t r02 = REG_0x02_NOTHOME;
if (use_fast_fed) {
r02 |= REG_0x02_FASTFED;
@ -612,7 +612,6 @@ static void gl124_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens
const ScanSession& session)
{
DBG_HELPER_ARGS(dbg, "exposure_time=%d", exposure_time);
uint32_t expmax;
scanner_setup_sensor(*dev, sensor, *reg);
@ -693,7 +692,7 @@ static void gl124_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens
reg->find_reg(REG_0x60).value &= ~REG_0x60_LEDADD;
if (session.enable_ledadd) {
reg->find_reg(REG_0x60).value |= REG_0x60_LEDADD;
expmax = reg->get24(REG_EXPR);
std::uint32_t expmax = reg->get24(REG_EXPR);
expmax = std::max(expmax, reg->get24(REG_EXPG));
expmax = std::max(expmax, reg->get24(REG_EXPB));
@ -860,7 +859,7 @@ void gl124_setup_scan_gpio(Genesys_Device* dev, int resolution)
{
DBG_HELPER(dbg);
uint8_t val = dev->interface->read_register(REG_0x32);
std::uint8_t val = dev->interface->read_register(REG_0x32);
/* LiDE 110, 210 and 220 cases */
if(dev->model->gpio_id != GpioId::CANON_LIDE_120) {
@ -917,7 +916,7 @@ void CommandSetGl124::begin_scan(Genesys_Device* dev, const Genesys_Sensor& sens
scanner_clear_scan_and_feed_counts(*dev);
// enable scan and motor
uint8_t val = dev->interface->read_register(REG_0x01);
std::uint8_t val = dev->interface->read_register(REG_0x01);
val |= REG_0x01_SCAN;
dev->interface->write_register(REG_0x01, val);
@ -1008,7 +1007,7 @@ void CommandSetGl124::wait_for_motor_stop(Genesys_Device* dev) const
DBG_HELPER(dbg);
auto status = scanner_read_status(*dev);
uint8_t val40 = dev->interface->read_register(REG_0x100);
std::uint8_t val40 = dev->interface->read_register(REG_0x100);
if (!status.is_motor_enabled && (val40 & REG_0x100_MOTMFLG) == 0) {
return;
@ -1031,7 +1030,7 @@ void CommandSetGl124::send_shading_data(Genesys_Device* dev, const Genesys_Senso
{
DBG_HELPER_ARGS(dbg, "writing %d bytes of shading data", size);
std::uint32_t addr, length, segcnt, pixels, i;
uint8_t *ptr, *src;
std::uint8_t *ptr, *src;
/* logical size of a color as seen by generic code of the frontend */
length = size / 3;
@ -1054,7 +1053,7 @@ void CommandSetGl124::send_shading_data(Genesys_Device* dev, const Genesys_Senso
std::to_string(dev->session.segment_count));
DBG( DBG_io2, "%s: using chunks of %d bytes (%d shading data pixels)\n",__func__,length, length/4);
std::vector<uint8_t> buffer(pixels * dev->session.segment_count, 0);
std::vector<std::uint8_t> buffer(pixels * dev->session.segment_count, 0);
/* write actual red data */
for(i=0;i<3;i++)
@ -1081,7 +1080,7 @@ void CommandSetGl124::send_shading_data(Genesys_Device* dev, const Genesys_Senso
/* next shading coefficient */
ptr+=4;
}
uint8_t val = dev->interface->read_register(0xd0+i);
std::uint8_t val = dev->interface->read_register(0xd0+i);
addr = val * 8192 + 0x10000000;
dev->interface->write_ahb(addr, pixels * dev->session.segment_count, buffer.data());
}
@ -1288,7 +1287,7 @@ void CommandSetGl124::asic_boot(Genesys_Device* dev, bool cold) const
dev->interface->write_register(0x36, 0x01);
// set GPIO 17
uint8_t val = dev->interface->read_register(0x33);
std::uint8_t val = dev->interface->read_register(0x33);
val |= 0x01;
dev->interface->write_register(0x33, val);
@ -1331,7 +1330,7 @@ void CommandSetGl124::update_hardware_sensors(Genesys_Scanner* s) const
any of them.
*/
DBG_HELPER(dbg);
uint8_t val = s->dev->interface->read_register(REG_0x31);
std::uint8_t val = s->dev->interface->read_register(REG_0x31);
/* TODO : for the next scanner special case,
* add another per scanner button profile struct to avoid growing

Wyświetl plik

@ -67,7 +67,7 @@ public:
Genesys_Register_Set* reg,
const ScanSession& session) const override;
void set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t set) const override;
void set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor, std::uint8_t set) const override;
void set_powersaving(Genesys_Device* dev, int delay) const override;
void save_power(Genesys_Device* dev, bool enable) const override;
@ -101,7 +101,7 @@ public:
void eject_document(Genesys_Device* dev) const override;
void send_shading_data(Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t* data,
void send_shading_data(Genesys_Device* dev, const Genesys_Sensor& sensor, std::uint8_t* data,
int size) const override;
ScanSession calculate_scan_session(const Genesys_Device* dev,

Wyświetl plik

@ -64,11 +64,12 @@ constexpr unsigned CALIBRATION_LINES = 10;
static void write_control(Genesys_Device* dev, const Genesys_Sensor& sensor, int resolution);
static void gl646_set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t set, int dpi);
static void gl646_set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor, std::uint8_t set,
int dpi);
static void simple_scan(Genesys_Device* dev, const Genesys_Sensor& sensor,
const ScanSession& session, bool move,
std::vector<uint8_t>& data, const char* test_identifier);
std::vector<std::uint8_t>& data, const char* test_identifier);
/**
* Send the stop scan command
* */
@ -395,7 +396,7 @@ static Motor_Master motor_master[] = {
/**
* reads value from gpio endpoint
*/
static void gl646_gpio_read(IUsbDevice& usb_dev, uint8_t* value)
static void gl646_gpio_read(IUsbDevice& usb_dev, std::uint8_t* value)
{
DBG_HELPER(dbg);
usb_dev.control_msg(REQUEST_TYPE_IN, REQUEST_REGISTER, GPIO_READ, INDEX, 1, value);
@ -404,7 +405,7 @@ static void gl646_gpio_read(IUsbDevice& usb_dev, uint8_t* value)
/**
* writes the given value to gpio endpoint
*/
static void gl646_gpio_write(IUsbDevice& usb_dev, uint8_t value)
static void gl646_gpio_write(IUsbDevice& usb_dev, std::uint8_t value)
{
DBG_HELPER_ARGS(dbg, "(0x%02x)", value);
usb_dev.control_msg(REQUEST_TYPE_OUT, REQUEST_REGISTER, GPIO_WRITE, INDEX, 1, &value);
@ -413,7 +414,7 @@ static void gl646_gpio_write(IUsbDevice& usb_dev, uint8_t value)
/**
* writes the given value to gpio output enable endpoint
*/
static void gl646_gpio_output_enable(IUsbDevice& usb_dev, uint8_t value)
static void gl646_gpio_output_enable(IUsbDevice& usb_dev, std::uint8_t value)
{
DBG_HELPER_ARGS(dbg, "(0x%02x)", value);
usb_dev.control_msg(REQUEST_TYPE_OUT, REQUEST_REGISTER, GPIO_OUTPUT_ENABLE, INDEX, 1, &value);
@ -461,10 +462,10 @@ void CommandSetGl646::init_regs_for_scan_session(Genesys_Device* dev, const Gene
debug_dump(DBG_info, sensor);
uint32_t move = session.params.starty;
std::uint32_t move = session.params.starty;
Motor_Master *motor = nullptr;
uint32_t z1, z2;
std::uint32_t z1, z2;
int feedl;
@ -1042,7 +1043,7 @@ gl646_init_regs (Genesys_Device * dev)
}
// Set values of Analog Device type frontend
static void gl646_set_ad_fe(Genesys_Device* dev, uint8_t set)
static void gl646_set_ad_fe(Genesys_Device* dev, std::uint8_t set)
{
DBG_HELPER(dbg);
int i;
@ -1077,7 +1078,7 @@ static void gl646_set_ad_fe(Genesys_Device* dev, uint8_t set)
* @param set action from AFE_SET, AFE_INIT and AFE_POWERSAVE
* @param dpi resolution of the scan since it affects settings
*/
static void gl646_wm_hp3670(Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t set,
static void gl646_wm_hp3670(Genesys_Device* dev, const Genesys_Sensor& sensor, std::uint8_t set,
unsigned dpi)
{
DBG_HELPER(dbg);
@ -1127,16 +1128,17 @@ static void gl646_wm_hp3670(Genesys_Device* dev, const Genesys_Sensor& sensor, u
* @param set action to execute
* @param dpi dpi to setup the AFE
*/
static void gl646_set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t set, int dpi)
static void gl646_set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor, std::uint8_t set,
int dpi)
{
DBG_HELPER_ARGS(dbg, "%s,%d", set == AFE_INIT ? "init" :
set == AFE_SET ? "set" :
set == AFE_POWER_SAVE ? "powersave" : "huh?", dpi);
int i;
uint8_t val;
std::uint8_t val;
/* Analog Device type frontend */
uint8_t frontend_type = dev->reg.find_reg(0x04).value & REG_0x04_FESET;
std::uint8_t frontend_type = dev->reg.find_reg(0x04).value & REG_0x04_FESET;
if (frontend_type == 0x02) {
gl646_set_ad_fe(dev, set);
return;
@ -1222,7 +1224,8 @@ static void gl646_set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor, uint
* @param dev device to set
* @param set action to execute
*/
void CommandSetGl646::set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t set) const
void CommandSetGl646::set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor,
std::uint8_t set) const
{
gl646_set_fe(dev, sensor, set, dev->settings.yres);
}
@ -1873,8 +1876,8 @@ void CommandSetGl646::send_gamma_table(Genesys_Device* dev, const Genesys_Sensor
bits = 12;
}
/* allocate temporary gamma tables: 16 bits words, 3 channels */
std::vector<uint8_t> gamma(size * 2 * 3);
// allocate temporary gamma tables: 16 bits words, 3 channels */
std::vector<std::uint8_t> gamma(size * 2 * 3);
sanei_genesys_generate_gamma_buffer(dev, sensor, bits, size-1, size, gamma.data());
@ -1911,7 +1914,7 @@ SensorExposure CommandSetGl646::led_calibration(Genesys_Device* dev, const Genes
int val;
int avg[3], avga, avge;
int turn;
uint16_t expr, expg, expb;
std::uint16_t expr, expg, expb;
unsigned channels = dev->settings.get_channels();
@ -1946,7 +1949,7 @@ SensorExposure CommandSetGl646::led_calibration(Genesys_Device* dev, const Genes
// colors * bytes_per_color * scan lines
unsigned total_size = pixels * channels * 2 * 1;
std::vector<uint8_t> line(total_size);
std::vector<std::uint8_t> line(total_size);
/*
we try to get equal bright leds here:
@ -2041,13 +2044,12 @@ SensorExposure CommandSetGl646::led_calibration(Genesys_Device* dev, const Genes
/**
* average dark pixels of a scan
*/
static int
dark_average (uint8_t * data, unsigned int pixels, unsigned int lines,
unsigned int channels, unsigned int black)
static int dark_average(std::uint8_t * data, unsigned int pixels, unsigned int lines,
unsigned int channels, unsigned int black)
{
unsigned int i, j, k, average, count;
unsigned int avg[3];
uint8_t val;
std::uint8_t val;
/* computes average value on black margin */
for (k = 0; k < channels; k++)
@ -2129,7 +2131,7 @@ static void ad_fe_offset_calibration(Genesys_Device* dev, const Genesys_Sensor&
dev->frontend.set_gain(1, 0);
dev->frontend.set_gain(2, 0);
std::vector<uint8_t> line;
std::vector<std::uint8_t> line;
/* scan with no move */
bottom = 1;
@ -2250,7 +2252,7 @@ void CommandSetGl646::offset_calibration(Genesys_Device* dev, const Genesys_Sens
dev->frontend.set_offset(1, bottom);
dev->frontend.set_offset(2, bottom);
std::vector<uint8_t> first_line, second_line;
std::vector<std::uint8_t> first_line, second_line;
dev->cmd_set->init_regs_for_scan_session(dev, sensor, &dev->reg, session);
simple_scan(dev, calib_sensor, session, false, first_line, "offset_first_line");
@ -2402,7 +2404,7 @@ void CommandSetGl646::coarse_gain_calibration(Genesys_Device* dev, const Genesys
unsigned pass = 0;
std::vector<uint8_t> line;
std::vector<std::uint8_t> line;
/* loop until each channel raises to acceptable level */
while (((average[0] < calib_sensor.gain_white_ref) ||
@ -2531,8 +2533,8 @@ void CommandSetGl646::init(Genesys_Device* dev) const
DBG_INIT();
DBG_HELPER(dbg);
uint8_t val = 0;
uint32_t addr = 0xdead;
std::uint8_t val = 0;
std::uint32_t addr = 0xdead;
size_t len;
// to detect real power up condition, we write to REG_0x41 with pwrbit set, then read it back.
@ -2662,7 +2664,7 @@ void CommandSetGl646::init(Genesys_Device* dev) const
static void simple_scan(Genesys_Device* dev, const Genesys_Sensor& sensor,
const ScanSession& session, bool move,
std::vector<uint8_t>& data, const char* scan_identifier)
std::vector<std::uint8_t>& data, const char* scan_identifier)
{
unsigned lines = session.output_line_count;
if (!dev->model->is_cis) {
@ -2714,7 +2716,7 @@ static void simple_scan(Genesys_Device* dev, const Genesys_Sensor& sensor,
if (dev->model->is_cis && session.params.scan_mode == ScanColorMode::COLOR_SINGLE_PASS) {
auto pixels_count = session.params.pixels;
std::vector<uint8_t> buffer(pixels_count * 3 * bpp);
std::vector<std::uint8_t> buffer(pixels_count * 3 * bpp);
if (bpp == 1) {
for (unsigned y = 0; y < lines; y++) {
@ -2757,7 +2759,7 @@ void CommandSetGl646::update_hardware_sensors(Genesys_Scanner* session) const
{
DBG_HELPER(dbg);
Genesys_Device *dev = session->dev;
uint8_t value;
std::uint8_t value;
// do what is needed to get a new set of events, but try to not loose any of them.
gl646_gpio_read(dev->interface->get_usb_device(), &value);
@ -2877,8 +2879,8 @@ void CommandSetGl646::update_home_sensor_gpio(Genesys_Device& dev) const
static void write_control(Genesys_Device* dev, const Genesys_Sensor& sensor, int resolution)
{
DBG_HELPER(dbg);
uint8_t control[4];
uint32_t addr = 0xdead;
std::uint8_t control[4];
std::uint32_t addr = 0xdead;
/* 2300 does not write to 'control' */
if (dev->model->motor_id == MotorId::HP2300) {

Wyświetl plik

@ -71,7 +71,7 @@ public:
Genesys_Register_Set* reg,
const ScanSession& session) const override;
void set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t set) const override;
void set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor, std::uint8_t set) const override;
void set_powersaving(Genesys_Device* dev, int delay) const override;
void save_power(Genesys_Device* dev, bool enable) const override;
@ -105,7 +105,7 @@ public:
void eject_document(Genesys_Device* dev) const override;
void send_shading_data(Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t* data,
void send_shading_data(Genesys_Device* dev, const Genesys_Sensor& sensor, std::uint8_t* data,
int size) const override;
bool has_send_shading_data() const override

Wyświetl plik

@ -338,7 +338,7 @@ gl841_init_registers (Genesys_Device * dev)
}
}
static void gl841_set_lide80_fe(Genesys_Device* dev, uint8_t set)
static void gl841_set_lide80_fe(Genesys_Device* dev, std::uint8_t set)
{
DBG_HELPER(dbg);
@ -361,7 +361,7 @@ static void gl841_set_lide80_fe(Genesys_Device* dev, uint8_t set)
}
// Set values of Analog Device type frontend
static void gl841_set_ad_fe(Genesys_Device* dev, uint8_t set)
static void gl841_set_ad_fe(Genesys_Device* dev, std::uint8_t set)
{
DBG_HELPER(dbg);
int i;
@ -411,7 +411,8 @@ static void gl841_set_ad_fe(Genesys_Device* dev, uint8_t set)
}
// Set values of analog frontend
void CommandSetGl841::set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t set) const
void CommandSetGl841::set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor,
std::uint8_t set) const
{
DBG_HELPER_ARGS(dbg, "%s", set == AFE_INIT ? "init" :
set == AFE_SET ? "set" :
@ -419,7 +420,7 @@ void CommandSetGl841::set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor,
(void) sensor;
/* Analog Device type frontend */
uint8_t frontend_type = dev->reg.find_reg(0x04).value & REG_0x04_FESET;
std::uint8_t frontend_type = dev->reg.find_reg(0x04).value & REG_0x04_FESET;
if (frontend_type == 0x02) {
gl841_set_ad_fe(dev, set);
@ -503,7 +504,7 @@ static void gl841_write_freq(Genesys_Device* dev, unsigned int ydpi)
{
DBG_HELPER(dbg);
/**< fast table */
uint8_t tdefault[] = {
std::uint8_t tdefault[] = {
0x18, 0x36, 0x18, 0x36, 0x18, 0x36, 0x18, 0x36, 0x18, 0x36,
0x18, 0x36, 0x18, 0x36, 0x18, 0x36, 0x18, 0x36, 0x18, 0x36,
0x18, 0x36, 0x18, 0x36, 0x18, 0x36, 0x18, 0x36, 0x18, 0x36,
@ -518,7 +519,7 @@ static void gl841_write_freq(Genesys_Device* dev, unsigned int ydpi)
0x18, 0x76, 0x18, 0x76, 0x18, 0x76, 0x18, 0x76, 0x18, 0x76,
0x18, 0x76, 0x18, 0x76, 0x18, 0x76, 0x18, 0x76
};
uint8_t t1200[] = {
std::uint8_t t1200[] = {
0xc7, 0x31, 0xc7, 0x31, 0xc7, 0x31, 0xc7, 0x31, 0xc7, 0x31,
0xc7, 0x31, 0xc7, 0x31, 0xc7, 0x31, 0xc0, 0x11, 0xc0, 0x11,
0xc0, 0x11, 0xc0, 0x11, 0xc0, 0x11, 0xc0, 0x11, 0xc0, 0x11,
@ -533,7 +534,7 @@ static void gl841_write_freq(Genesys_Device* dev, unsigned int ydpi)
0xc7, 0x71, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20,
0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20
};
uint8_t t300[] = {
std::uint8_t t300[] = {
0x08, 0x32, 0x08, 0x32, 0x08, 0x32, 0x08, 0x32, 0x08, 0x32,
0x08, 0x32, 0x08, 0x32, 0x08, 0x32, 0x00, 0x13, 0x00, 0x13,
0x00, 0x13, 0x00, 0x13, 0x00, 0x13, 0x00, 0x13, 0x00, 0x13,
@ -548,7 +549,7 @@ static void gl841_write_freq(Genesys_Device* dev, unsigned int ydpi)
0x08, 0x72, 0x0c, 0x60, 0x0c, 0x60, 0x0c, 0x60, 0x0c, 0x60,
0x0c, 0x60, 0x0c, 0x60, 0x0c, 0x60, 0x0c, 0x60
};
uint8_t t150[] = {
std::uint8_t t150[] = {
0x0c, 0x33, 0xcf, 0x33, 0xcf, 0x33, 0xcf, 0x33, 0xcf, 0x33,
0xcf, 0x33, 0xcf, 0x33, 0xcf, 0x33, 0x40, 0x14, 0x80, 0x15,
0x80, 0x15, 0x80, 0x15, 0x80, 0x15, 0x80, 0x15, 0x80, 0x15,
@ -564,7 +565,7 @@ static void gl841_write_freq(Genesys_Device* dev, unsigned int ydpi)
0x16, 0x60, 0x16, 0x60, 0x16, 0x60, 0x16, 0x60
};
uint8_t *table;
std::uint8_t *table;
if(dev->model->motor_id == MotorId::CANON_LIDE_80) {
switch(ydpi)
@ -602,7 +603,7 @@ static void gl841_init_motor_regs_feed(Genesys_Device* dev, const Genesys_Sensor
/*number of scan lines to add in a scan_lines line*/
{
std::vector<uint16_t> table;
std::vector<std::uint16_t> table;
table.resize(256, 0xffff);
scanner_send_slope_table(dev, sensor, 0, table);
@ -875,7 +876,7 @@ static void gl841_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens
const ScanSession& session)
{
DBG_HELPER_ARGS(dbg, "exposure_time=%d", exposure_time);
uint16_t expavg, expr, expb, expg;
std::uint16_t expavg, expr, expb, expg;
dev->cmd_set->set_fe(dev, sensor, AFE_SET);
@ -1212,7 +1213,7 @@ void CommandSetGl841::save_power(Genesys_Device* dev, bool enable) const
/* final state: GPIO8 disabled, GPIO9 enabled, GPIO17 disabled,
GPIO18 disabled*/
uint8_t val = dev->interface->read_register(REG_0x6D);
std::uint8_t val = dev->interface->read_register(REG_0x6D);
dev->interface->write_register(REG_0x6D, val | 0x80);
dev->interface->sleep_ms(1);
@ -1237,7 +1238,7 @@ void CommandSetGl841::save_power(Genesys_Device* dev, bool enable) const
}
if (dev->model->gpio_id == GpioId::DP685)
{
uint8_t val = dev->interface->read_register(REG_0x6B);
std::uint8_t val = dev->interface->read_register(REG_0x6B);
dev->interface->write_register(REG_0x6B, val & ~REG_0x6B_GPO17);
dev->reg.find_reg(0x6b).value &= ~REG_0x6B_GPO17;
dev->initial_regs.find_reg(0x6b).value &= ~REG_0x6B_GPO17;
@ -1255,7 +1256,7 @@ void CommandSetGl841::save_power(Genesys_Device* dev, bool enable) const
/* final state: GPIO8 enabled, GPIO9 disabled, GPIO17 enabled,
GPIO18 enabled*/
uint8_t val = dev->interface->read_register(REG_0x6D);
std::uint8_t val = dev->interface->read_register(REG_0x6D);
dev->interface->write_register(REG_0x6D, val | 0x80);
dev->interface->sleep_ms(10);
@ -1284,7 +1285,7 @@ void CommandSetGl841::save_power(Genesys_Device* dev, bool enable) const
if (dev->model->gpio_id == GpioId::DP665
|| dev->model->gpio_id == GpioId::DP685)
{
uint8_t val = dev->interface->read_register(REG_0x6B);
std::uint8_t val = dev->interface->read_register(REG_0x6B);
dev->interface->write_register(REG_0x6B, val | REG_0x6B_GPO17);
dev->reg.find_reg(0x6b).value |= REG_0x6B_GPO17;
dev->initial_regs.find_reg(0x6b).value |= REG_0x6B_GPO17;
@ -1361,7 +1362,7 @@ static bool gl841_get_paper_sensor(Genesys_Device* dev)
{
DBG_HELPER(dbg);
uint8_t val = dev->interface->read_register(REG_0x6D);
std::uint8_t val = dev->interface->read_register(REG_0x6D);
return (val & 0x1) == 0;
}
@ -1579,7 +1580,7 @@ void CommandSetGl841::begin_scan(Genesys_Device* dev, const Genesys_Sensor& sens
(void) sensor;
// FIXME: SEQUENTIAL not really needed in this case
Genesys_Register_Set local_reg(Genesys_Register_Set::SEQUENTIAL);
uint8_t val;
std::uint8_t val;
if (dev->model->gpio_id == GpioId::CANON_LIDE_80) {
val = dev->interface->read_register(REG_0x6B);
@ -1690,8 +1691,8 @@ void CommandSetGl841::send_gamma_table(Genesys_Device* dev, const Genesys_Sensor
size = 256;
/* allocate temporary gamma tables: 16 bits words, 3 channels */
std::vector<uint8_t> gamma(size * 2 * 3);
// allocate temporary gamma tables: 16 bits words, 3 channels
std::vector<std::uint8_t> gamma(size * 2 * 3);
sanei_genesys_generate_gamma_buffer(dev, sensor, 16, 65535, size, gamma.data());
@ -1763,7 +1764,7 @@ static void ad_fe_offset_calibration(Genesys_Device* dev, const Genesys_Sensor&
// FIXME: we're reading twice as much data for no reason
std::size_t total_size = session.output_line_bytes * 2;
std::vector<uint8_t> line(total_size);
std::vector<std::uint8_t> line(total_size);
dev->frontend.set_gain(0, 0);
dev->frontend.set_gain(1, 0);
@ -2247,10 +2248,9 @@ void CommandSetGl841::init(Genesys_Device* dev) const
void CommandSetGl841::update_hardware_sensors(Genesys_Scanner* s) const
{
DBG_HELPER(dbg);
/* do what is needed to get a new set of events, but try to not lose
any of them.
*/
uint8_t val;
// do what is needed to get a new set of events, but try to not lose any of them.
std::uint8_t val;
if (s->dev->model->gpio_id == GpioId::CANON_LIDE_35
|| s->dev->model->gpio_id == GpioId::CANON_LIDE_80)
@ -2278,11 +2278,10 @@ void CommandSetGl841::update_hardware_sensors(Genesys_Scanner* s) const
* for all the channels.
*/
void CommandSetGl841::send_shading_data(Genesys_Device* dev, const Genesys_Sensor& sensor,
uint8_t* data, int size) const
std::uint8_t* data, int size) const
{
DBG_HELPER_ARGS(dbg, "writing %d bytes of shading data", size);
uint32_t length, x, pixels, i;
uint8_t *ptr,*src;
std::uint32_t length, x, pixels, i;
/* old method if no SHDAREA */
if ((dev->reg.find_reg(0x01).value & REG_0x01_SHDAREA) == 0) {
@ -2312,7 +2311,7 @@ void CommandSetGl841::send_shading_data(Genesys_Device* dev, const Genesys_Senso
DBG(DBG_io2, "%s: using chunks of %d bytes (%d shading data pixels)\n", __func__, length,
length/4);
std::vector<uint8_t> buffer(pixels, 0);
std::vector<std::uint8_t> buffer(pixels, 0);
/* write actual shading data contigously
* channel by channel, starting at addr 0x0000
@ -2321,14 +2320,14 @@ void CommandSetGl841::send_shading_data(Genesys_Device* dev, const Genesys_Senso
{
/* copy data to work buffer and process it */
/* coefficient destination */
ptr=buffer.data();
std::uint8_t* ptr = buffer.data();
/* iterate on both sensor segment, data has been averaged,
* so is in the right order and we only have to copy it */
for(x=0;x<pixels;x+=4)
{
/* coefficient source */
src = data + x + beginpixel + i * length;
std::uint8_t* src = data + x + beginpixel + i * length;
ptr[0]=src[0];
ptr[1]=src[1];
ptr[2]=src[2];

Wyświetl plik

@ -67,7 +67,7 @@ public:
Genesys_Register_Set* reg,
const ScanSession& session) const override;
void set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t set) const override;
void set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor, std::uint8_t set) const override;
void set_powersaving(Genesys_Device* dev, int delay) const override;
void save_power(Genesys_Device* dev, bool enable) const override;
@ -101,7 +101,7 @@ public:
void eject_document(Genesys_Device* dev) const override;
void send_shading_data(Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t* data,
void send_shading_data(Genesys_Device* dev, const Genesys_Sensor& sensor, std::uint8_t* data,
int size) const override;
ScanSession calculate_scan_session(const Genesys_Device* dev,

Wyświetl plik

@ -226,7 +226,8 @@ static void gl842_init_registers(Genesys_Device& dev)
}
// Set values of analog frontend
void CommandSetGl842::set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t set) const
void CommandSetGl842::set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor,
std::uint8_t set) const
{
DBG_HELPER_ARGS(dbg, "%s", set == AFE_INIT ? "init" :
set == AFE_SET ? "set" :
@ -239,7 +240,7 @@ void CommandSetGl842::set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor,
// check analog frontend type
// FIXME: looks like we write to that register with initial data
uint8_t fe_type = dev->interface->read_register(REG_0x04) & REG_0x04_FESET;
std::uint8_t fe_type = dev->interface->read_register(REG_0x04) & REG_0x04_FESET;
if (fe_type == 2 || dev->model->model_id == ModelId::CANON_LIDE_90) {
for (const auto& reg : dev->frontend.regs) {
dev->interface->write_fe_register(reg.address, reg.value);
@ -844,11 +845,11 @@ void CommandSetGl842::send_gamma_table(Genesys_Device* dev, const Genesys_Sensor
unsigned size = 256;
std::vector<uint8_t> gamma(size * 2 * 3);
std::vector<std::uint8_t> gamma(size * 2 * 3);
std::vector<uint16_t> rgamma = get_gamma_table(dev, sensor, GENESYS_RED);
std::vector<uint16_t> ggamma = get_gamma_table(dev, sensor, GENESYS_GREEN);
std::vector<uint16_t> bgamma = get_gamma_table(dev, sensor, GENESYS_BLUE);
std::vector<std::uint16_t> rgamma = get_gamma_table(dev, sensor, GENESYS_RED);
std::vector<std::uint16_t> ggamma = get_gamma_table(dev, sensor, GENESYS_GREEN);
std::vector<std::uint16_t> bgamma = get_gamma_table(dev, sensor, GENESYS_BLUE);
// copy sensor specific's gamma tables
for (unsigned i = 0; i < size; i++) {
@ -954,7 +955,7 @@ void CommandSetGl842::asic_boot(Genesys_Device* dev, bool cold) const
dev->interface->write_registers(dev->reg);
if (dev->model->model_id == ModelId::PLUSTEK_OPTICFILM_7200) {
uint8_t data[32] = {
std::uint8_t data[32] = {
0xd0, 0x38, 0x07, 0x00, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -1009,7 +1010,7 @@ void CommandSetGl842::update_home_sensor_gpio(Genesys_Device& dev) const
* for all the channels.
*/
void CommandSetGl842::send_shading_data(Genesys_Device* dev, const Genesys_Sensor& sensor,
uint8_t* data, int size) const
std::uint8_t* data, int size) const
{
DBG_HELPER(dbg);
@ -1035,7 +1036,7 @@ void CommandSetGl842::send_shading_data(Genesys_Device* dev, const Genesys_Senso
dev->interface->record_key_value("shading_offset", std::to_string(offset));
dev->interface->record_key_value("shading_length", std::to_string(length));
std::vector<uint8_t> final_data(length, 0);
std::vector<std::uint8_t> final_data(length, 0);
unsigned count = 0;
if (offset < 0) {

Wyświetl plik

@ -67,7 +67,7 @@ public:
Genesys_Register_Set* reg,
const ScanSession& session) const override;
void set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t set) const override;
void set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor, std::uint8_t set) const override;
void set_powersaving(Genesys_Device* dev, int delay) const override;
void save_power(Genesys_Device* dev, bool enable) const override;
@ -101,7 +101,7 @@ public:
void eject_document(Genesys_Device* dev) const override;
void send_shading_data(Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t* data,
void send_shading_data(Genesys_Device* dev, const Genesys_Sensor& sensor, std::uint8_t* data,
int size) const override;
ScanSession calculate_scan_session(const Genesys_Device* dev,

Wyświetl plik

@ -618,7 +618,7 @@ gl843_init_registers (Genesys_Device * dev)
}
if (dev->model->model_id == ModelId::PLUSTEK_OPTICFILM_7200I) {
uint8_t data[32] = {
std::uint8_t data[32] = {
0x8c, 0x8f, 0xc9, 0x00, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -637,7 +637,8 @@ static void gl843_set_ad_fe(Genesys_Device* dev)
}
// Set values of analog frontend
void CommandSetGl843::set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t set) const
void CommandSetGl843::set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor,
std::uint8_t set) const
{
DBG_HELPER_ARGS(dbg, "%s", set == AFE_INIT ? "init" :
set == AFE_SET ? "set" :
@ -650,7 +651,7 @@ void CommandSetGl843::set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor,
// check analog frontend type
// FIXME: looks like we write to that register with initial data
uint8_t fe_type = dev->interface->read_register(REG_0x04) & REG_0x04_FESET;
std::uint8_t fe_type = dev->interface->read_register(REG_0x04) & REG_0x04_FESET;
if (fe_type == 2) {
gl843_set_ad_fe(dev);
return;
@ -1141,7 +1142,7 @@ void CommandSetGl843::save_power(Genesys_Device* dev, bool enable) const
// switch KV-SS080 lamp off
if (dev->model->gpio_id == GpioId::KVSS080) {
uint8_t val = dev->interface->read_register(REG_0x6C);
std::uint8_t val = dev->interface->read_register(REG_0x6C);
if (enable) {
val &= 0xef;
} else {
@ -1161,7 +1162,7 @@ static bool gl843_get_paper_sensor(Genesys_Device* dev)
{
DBG_HELPER(dbg);
uint8_t val = dev->interface->read_register(REG_0x6D);
std::uint8_t val = dev->interface->read_register(REG_0x6D);
return (val & 0x1) == 0;
}
@ -1304,7 +1305,7 @@ void CommandSetGl843::begin_scan(Genesys_Device* dev, const Genesys_Sensor& sens
scanner_clear_scan_and_feed_counts(*dev);
// enable scan and motor
uint8_t val = dev->interface->read_register(REG_0x01);
std::uint8_t val = dev->interface->read_register(REG_0x01);
val |= REG_0x01_SCAN;
dev->interface->write_register(REG_0x01, val);
@ -1457,11 +1458,11 @@ void CommandSetGl843::send_gamma_table(Genesys_Device* dev, const Genesys_Sensor
size = 256;
/* allocate temporary gamma tables: 16 bits words, 3 channels */
std::vector<uint8_t> gamma(size * 2 * 3);
std::vector<std::uint8_t> gamma(size * 2 * 3);
std::vector<uint16_t> rgamma = get_gamma_table(dev, sensor, GENESYS_RED);
std::vector<uint16_t> ggamma = get_gamma_table(dev, sensor, GENESYS_GREEN);
std::vector<uint16_t> bgamma = get_gamma_table(dev, sensor, GENESYS_BLUE);
std::vector<std::uint16_t> rgamma = get_gamma_table(dev, sensor, GENESYS_RED);
std::vector<std::uint16_t> ggamma = get_gamma_table(dev, sensor, GENESYS_GREEN);
std::vector<std::uint16_t> bgamma = get_gamma_table(dev, sensor, GENESYS_BLUE);
// copy sensor specific's gamma tables
for (i = 0; i < size; i++) {
@ -1574,7 +1575,7 @@ static void gl843_init_gpio(Genesys_Device* dev)
void CommandSetGl843::asic_boot(Genesys_Device* dev, bool cold) const
{
DBG_HELPER(dbg);
uint8_t val;
std::uint8_t val;
if (cold) {
dev->interface->write_register(0x0e, 0x01);
@ -1686,7 +1687,7 @@ void CommandSetGl843::update_hardware_sensors(Genesys_Scanner* s) const
any of them.
*/
uint8_t val = s->dev->interface->read_register(REG_0x6D);
std::uint8_t val = s->dev->interface->read_register(REG_0x6D);
DBG(DBG_io, "%s: read buttons_gpio value=0x%x\n", __func__, (int)val);
switch (s->dev->model->gpio_id)
@ -1724,11 +1725,10 @@ void CommandSetGl843::update_home_sensor_gpio(Genesys_Device& dev) const
* for all the channels.
*/
void CommandSetGl843::send_shading_data(Genesys_Device* dev, const Genesys_Sensor& sensor,
uint8_t* data, int size) const
std::uint8_t* data, int size) const
{
DBG_HELPER(dbg);
uint32_t final_size, i;
uint8_t *buffer;
std::uint32_t final_size, i;
int count;
int offset = 0;
@ -1756,10 +1756,10 @@ void CommandSetGl843::send_shading_data(Genesys_Device* dev, const Genesys_Senso
/* compute and allocate size for final data */
final_size = ((length+251) / 252) * 256;
DBG(DBG_io, "%s: final shading size=%04x (length=%d)\n", __func__, final_size, length);
std::vector<uint8_t> final_data(final_size, 0);
std::vector<std::uint8_t> final_data(final_size, 0);
/* copy regular shading data to the expected layout */
buffer = final_data.data();
std::uint8_t* buffer = final_data.data();
count = 0;
if (offset < 0) {
count += (-offset);

Wyświetl plik

@ -67,7 +67,7 @@ public:
Genesys_Register_Set* reg,
const ScanSession& session) const override;
void set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t set) const override;
void set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor, std::uint8_t set) const override;
void set_powersaving(Genesys_Device* dev, int delay) const override;
void save_power(Genesys_Device* dev, bool enable) const override;
@ -101,7 +101,7 @@ public:
void eject_document(Genesys_Device* dev) const override;
void send_shading_data(Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t* data,
void send_shading_data(Genesys_Device* dev, const Genesys_Sensor& sensor, std::uint8_t* data,
int size) const override;
ScanSession calculate_scan_session(const Genesys_Device* dev,

Wyświetl plik

@ -305,7 +305,7 @@ gl846_init_registers (Genesys_Device * dev)
/**
* Set register values of Analog Device type frontend
* */
static void gl846_set_adi_fe(Genesys_Device* dev, uint8_t set)
static void gl846_set_adi_fe(Genesys_Device* dev, std::uint8_t set)
{
DBG_HELPER(dbg);
int i;
@ -335,15 +335,16 @@ static void gl846_set_adi_fe(Genesys_Device* dev, uint8_t set)
}
// Set values of analog frontend
void CommandSetGl846::set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t set) const
void CommandSetGl846::set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor,
std::uint8_t set) const
{
DBG_HELPER_ARGS(dbg, "%s", set == AFE_INIT ? "init" :
set == AFE_SET ? "set" :
set == AFE_POWER_SAVE ? "powersave" : "huh?");
(void) sensor;
/* route to specific analog frontend setup */
uint8_t frontend_type = dev->reg.find_reg(0x04).value & REG_0x04_FESET;
// route to specific analog frontend setup
std::uint8_t frontend_type = dev->reg.find_reg(0x04).value & REG_0x04_FESET;
switch (frontend_type) {
case 0x02: /* ADI FE */
gl846_set_adi_fe(dev, set);
@ -788,7 +789,6 @@ void CommandSetGl846::begin_scan(Genesys_Device* dev, const Genesys_Sensor& sens
{
DBG_HELPER(dbg);
(void) sensor;
uint8_t val;
if (reg->state.is_xpa_on && reg->state.is_lamp_on) {
dev->cmd_set->set_xpa_lamp_power(*dev, true);
@ -796,7 +796,7 @@ void CommandSetGl846::begin_scan(Genesys_Device* dev, const Genesys_Sensor& sens
scanner_clear_scan_and_feed_counts(*dev);
val = dev->interface->read_register(REG_0x01);
std::uint8_t val = dev->interface->read_register(REG_0x01);
val |= REG_0x01_SCAN;
dev->interface->write_register(REG_0x01, val);
reg->set8(REG_0x01, val);
@ -902,11 +902,10 @@ void CommandSetGl846::init_regs_for_shading(Genesys_Device* dev, const Genesys_S
* for all the channels.
*/
void CommandSetGl846::send_shading_data(Genesys_Device* dev, const Genesys_Sensor& sensor,
uint8_t* data, int size) const
std::uint8_t* data, int size) const
{
DBG_HELPER_ARGS(dbg, "writing %d bytes of shading data", size);
std::uint32_t addr, i;
uint8_t val,*ptr,*src;
unsigned length = static_cast<unsigned>(size / 3);
@ -924,7 +923,7 @@ void CommandSetGl846::send_shading_data(Genesys_Device* dev, const Genesys_Senso
dev->interface->record_key_value("shading_length", std::to_string(length));
dev->interface->record_key_value("shading_factor", std::to_string(sensor.shading_factor));
std::vector<uint8_t> buffer(pixels, 0);
std::vector<std::uint8_t> buffer(pixels, 0);
DBG(DBG_io2, "%s: using chunks of %d (0x%04x) bytes\n", __func__, pixels, pixels);
@ -936,12 +935,12 @@ void CommandSetGl846::send_shading_data(Genesys_Device* dev, const Genesys_Senso
{
/* build up actual shading data by copying the part from the full width one
* to the one corresponding to SHDAREA */
ptr = buffer.data();
std::uint8_t* ptr = buffer.data();
/* iterate on both sensor segment */
for (unsigned x = 0; x < pixels; x += 4 * sensor.shading_factor) {
// coefficient source
src = (data + offset + i * length) + x;
std::uint8_t* src = (data + offset + i * length) + x;
/* coefficient copy */
ptr[0]=src[0];
@ -953,7 +952,7 @@ void CommandSetGl846::send_shading_data(Genesys_Device* dev, const Genesys_Senso
ptr+=4;
}
val = dev->interface->read_register(0xd0+i);
std::uint8_t val = dev->interface->read_register(0xd0+i);
addr = val * 8192 + 0x10000000;
dev->interface->write_ahb(addr, pixels, buffer.data());
}
@ -1001,7 +1000,7 @@ static void gl846_init_memory_layout(Genesys_Device* dev)
void CommandSetGl846::asic_boot(Genesys_Device* dev, bool cold) const
{
DBG_HELPER(dbg);
uint8_t val;
std::uint8_t val;
// reset ASIC if cold boot
if (cold) {
@ -1076,8 +1075,7 @@ void CommandSetGl846::update_hardware_sensors(Genesys_Scanner* s) const
/* do what is needed to get a new set of events, but try to not lose
any of them.
*/
uint8_t val;
uint8_t scan, file, email, copy;
std::uint8_t scan, file, email, copy;
switch(s->dev->model->gpio_id)
{
default:
@ -1086,7 +1084,7 @@ void CommandSetGl846::update_hardware_sensors(Genesys_Scanner* s) const
email=0x04;
copy=0x08;
}
val = s->dev->interface->read_register(REG_0x6D);
std::uint8_t val = s->dev->interface->read_register(REG_0x6D);
s->buttons[BUTTON_SCAN_SW].write((val & scan) == 0);
s->buttons[BUTTON_FILE_SW].write((val & file) == 0);

Wyświetl plik

@ -67,7 +67,7 @@ public:
Genesys_Register_Set* reg,
const ScanSession& session) const override;
void set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t set) const override;
void set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor, std::uint8_t set) const override;
void set_powersaving(Genesys_Device* dev, int delay) const override;
void save_power(Genesys_Device* dev, bool enable) const override;
@ -101,7 +101,7 @@ public:
void eject_document(Genesys_Device* dev) const override;
void send_shading_data(Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t* data,
void send_shading_data(Genesys_Device* dev, const Genesys_Sensor& sensor, std::uint8_t* data,
int size) const override;
ScanSession calculate_scan_session(const Genesys_Device* dev,

Wyświetl plik

@ -72,7 +72,7 @@ gl847_init_registers (Genesys_Device * dev)
{
DBG_HELPER(dbg);
int lide700=0;
uint8_t val;
std::uint8_t val;
/* 700F class needs some different initial settings */
if (dev->model->model_id == ModelId::CANON_LIDE_700F) {
@ -254,7 +254,8 @@ gl847_init_registers (Genesys_Device * dev)
}
// Set values of analog frontend
void CommandSetGl847::set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t set) const
void CommandSetGl847::set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor,
std::uint8_t set) const
{
DBG_HELPER_ARGS(dbg, "%s", set == AFE_INIT ? "init" :
set == AFE_SET ? "set" :
@ -430,7 +431,7 @@ static void gl847_init_motor_regs_scan(Genesys_Device* dev,
unsigned tgtime = 1 << (reg->get8(REG_0x1C) & REG_0x1C_TGTIME);
// hi res motor speed GPIO
uint8_t effective = dev->interface->read_register(REG_0x6C);
std::uint8_t effective = dev->interface->read_register(REG_0x6C);
// if quarter step, bipolar Vref2
@ -763,7 +764,7 @@ void CommandSetGl847::begin_scan(Genesys_Device* dev, const Genesys_Sensor& sens
{
DBG_HELPER(dbg);
(void) sensor;
uint8_t val;
std::uint8_t val;
if (reg->state.is_xpa_on && reg->state.is_lamp_on) {
dev->cmd_set->set_xpa_lamp_power(*dev, true);
@ -920,11 +921,10 @@ void CommandSetGl847::init_regs_for_shading(Genesys_Device* dev, const Genesys_S
* for all the channels.
*/
void CommandSetGl847::send_shading_data(Genesys_Device* dev, const Genesys_Sensor& sensor,
uint8_t* data, int size) const
std::uint8_t* data, int size) const
{
DBG_HELPER_ARGS(dbg, "writing %d bytes of shading data", size);
std::uint32_t addr, i;
uint8_t val,*ptr,*src;
unsigned length = static_cast<unsigned>(size / 3);
@ -942,7 +942,7 @@ void CommandSetGl847::send_shading_data(Genesys_Device* dev, const Genesys_Senso
dev->interface->record_key_value("shading_length", std::to_string(length));
dev->interface->record_key_value("shading_factor", std::to_string(sensor.shading_factor));
std::vector<uint8_t> buffer(pixels, 0);
std::vector<std::uint8_t> buffer(pixels, 0);
DBG(DBG_io2, "%s: using chunks of %d (0x%04x) bytes\n", __func__, pixels, pixels);
@ -958,12 +958,12 @@ void CommandSetGl847::send_shading_data(Genesys_Device* dev, const Genesys_Senso
{
/* build up actual shading data by copying the part from the full width one
* to the one corresponding to SHDAREA */
ptr = buffer.data();
std::uint8_t* ptr = buffer.data();
// iterate on both sensor segment
for (unsigned x = 0; x < pixels; x += 4 * sensor.shading_factor) {
/* coefficient source */
src = (data + offset + i * length) + x;
// coefficient source
std::uint8_t* src = (data + offset + i * length) + x;
/* coefficient copy */
ptr[0]=src[0];
@ -975,7 +975,7 @@ void CommandSetGl847::send_shading_data(Genesys_Device* dev, const Genesys_Senso
ptr+=4;
}
val = dev->interface->read_register(0xd0+i);
std::uint8_t val = dev->interface->read_register(0xd0+i);
addr = val * 8192 + 0x10000000;
dev->interface->write_ahb(addr, pixels, buffer.data());
}
@ -1071,7 +1071,7 @@ void CommandSetGl847::asic_boot(Genesys_Device* dev, bool cold) const
}
// test CHKVER
uint8_t val = dev->interface->read_register(REG_0x40);
std::uint8_t val = dev->interface->read_register(REG_0x40);
if (val & REG_0x40_CHKVER) {
val = dev->interface->read_register(0x00);
DBG(DBG_info, "%s: reported version for genesys chip is 0x%02x\n", __func__, val);
@ -1130,8 +1130,7 @@ void CommandSetGl847::update_hardware_sensors(Genesys_Scanner* s) const
/* do what is needed to get a new set of events, but try to not lose
any of them.
*/
uint8_t val;
uint8_t scan, file, email, copy;
std::uint8_t scan, file, email, copy;
switch(s->dev->model->gpio_id) {
case GpioId::CANON_LIDE_700F:
scan=0x04;
@ -1145,7 +1144,7 @@ void CommandSetGl847::update_hardware_sensors(Genesys_Scanner* s) const
email=0x04;
copy=0x08;
}
val = s->dev->interface->read_register(REG_0x6D);
std::uint8_t val = s->dev->interface->read_register(REG_0x6D);
s->buttons[BUTTON_SCAN_SW].write((val & scan) == 0);
s->buttons[BUTTON_FILE_SW].write((val & file) == 0);

Wyświetl plik

@ -67,7 +67,7 @@ public:
Genesys_Register_Set* reg,
const ScanSession& session) const override;
void set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t set) const override;
void set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor, std::uint8_t set) const override;
void set_powersaving(Genesys_Device* dev, int delay) const override;
void save_power(Genesys_Device* dev, bool enable) const override;
@ -101,7 +101,7 @@ public:
void eject_document(Genesys_Device* dev) const override;
void send_shading_data(Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t* data,
void send_shading_data(Genesys_Device* dev, const Genesys_Sensor& sensor, std::uint8_t* data,
int size) const override;
ScanSession calculate_scan_session(const Genesys_Device* dev,

Wyświetl plik

@ -194,7 +194,7 @@ ImagePipelineNodeDesegment::ImagePipelineNodeDesegment(ImagePipelineNode& source
std::iota(segment_order_.begin(), segment_order_.end(), 0);
}
bool ImagePipelineNodeDesegment::get_next_row_data(uint8_t* out_data)
bool ImagePipelineNodeDesegment::get_next_row_data(std::uint8_t* out_data)
{
bool got_data = true;

Wyświetl plik

@ -127,7 +127,7 @@ unsigned sanei_genesys_get_bulk_max_size(AsicType asic_type)
}
// Set address for writing data
void sanei_genesys_set_buffer_address(Genesys_Device* dev, uint32_t addr)
void sanei_genesys_set_buffer_address(Genesys_Device* dev, std::uint32_t addr)
{
DBG_HELPER(dbg);
@ -377,7 +377,7 @@ void wait_until_has_valid_words(Genesys_Device* dev)
}
// Read data (e.g scanned image) from scan buffer
void sanei_genesys_read_data_from_scanner(Genesys_Device* dev, uint8_t* data, size_t size)
void sanei_genesys_read_data_from_scanner(Genesys_Device* dev, std::uint8_t* data, size_t size)
{
DBG_HELPER_ARGS(dbg, "size = %zu bytes", size);
@ -582,7 +582,7 @@ void sanei_genesys_read_feed_steps(Genesys_Device* dev, unsigned int* steps)
void sanei_genesys_set_lamp_power(Genesys_Device* dev, const Genesys_Sensor& sensor,
Genesys_Register_Set& regs, bool set)
{
static const uint8_t REG_0x03_LAMPPWR = 0x10;
static const std::uint8_t REG_0x03_LAMPPWR = 0x10;
if (set) {
regs.find_reg(0x03).value |= REG_0x03_LAMPPWR;
@ -623,7 +623,7 @@ void sanei_genesys_set_lamp_power(Genesys_Device* dev, const Genesys_Sensor& sen
void sanei_genesys_set_motor_power(Genesys_Register_Set& regs, bool set)
{
static const uint8_t REG_0x02_MTRPWR = 0x10;
static const std::uint8_t REG_0x02_MTRPWR = 0x10;
if (set) {
regs.find_reg(0x02).value |= REG_0x02_MTRPWR;
@ -652,13 +652,13 @@ bool should_enable_gamma(const ScanSession& session, const Genesys_Sensor& senso
return true;
}
std::vector<uint16_t> get_gamma_table(Genesys_Device* dev, const Genesys_Sensor& sensor,
int color)
std::vector<std::uint16_t> get_gamma_table(Genesys_Device* dev, const Genesys_Sensor& sensor,
int color)
{
if (!dev->gamma_override_tables[color].empty()) {
return dev->gamma_override_tables[color];
} else {
std::vector<uint16_t> ret;
std::vector<std::uint16_t> ret;
sanei_genesys_create_default_gamma_table(dev, ret, sensor.gamma[color]);
return ret;
}
@ -678,16 +678,16 @@ void sanei_genesys_generate_gamma_buffer(Genesys_Device* dev,
int bits,
int max,
int size,
uint8_t* gamma)
std::uint8_t* gamma)
{
DBG_HELPER(dbg);
std::vector<uint16_t> rgamma = get_gamma_table(dev, sensor, GENESYS_RED);
std::vector<uint16_t> ggamma = get_gamma_table(dev, sensor, GENESYS_GREEN);
std::vector<uint16_t> bgamma = get_gamma_table(dev, sensor, GENESYS_BLUE);
std::vector<std::uint16_t> rgamma = get_gamma_table(dev, sensor, GENESYS_RED);
std::vector<std::uint16_t> ggamma = get_gamma_table(dev, sensor, GENESYS_GREEN);
std::vector<std::uint16_t> bgamma = get_gamma_table(dev, sensor, GENESYS_BLUE);
if(dev->settings.contrast!=0 || dev->settings.brightness!=0)
{
std::vector<uint16_t> lut(65536);
std::vector<std::uint16_t> lut(65536);
sanei_genesys_load_lut(reinterpret_cast<unsigned char *>(lut.data()),
bits,
bits,
@ -697,7 +697,7 @@ void sanei_genesys_generate_gamma_buffer(Genesys_Device* dev,
dev->settings.brightness);
for (int i = 0; i < size; i++)
{
uint16_t value=rgamma[i];
std::uint16_t value = rgamma[i];
value=lut[value];
gamma[i * 2 + size * 0 + 0] = value & 0xff;
gamma[i * 2 + size * 0 + 1] = (value >> 8) & 0xff;
@ -717,7 +717,7 @@ void sanei_genesys_generate_gamma_buffer(Genesys_Device* dev,
{
for (int i = 0; i < size; i++)
{
uint16_t value=rgamma[i];
std::uint16_t value=rgamma[i];
gamma[i * 2 + size * 0 + 0] = value & 0xff;
gamma[i * 2 + size * 0 + 1] = (value >> 8) & 0xff;
@ -747,15 +747,15 @@ void sanei_genesys_send_gamma_table(Genesys_Device* dev, const Genesys_Sensor& s
size = 256 + 1;
/* allocate temporary gamma tables: 16 bits words, 3 channels */
std::vector<uint8_t> gamma(size * 2 * 3, 255);
// allocate temporary gamma tables: 16 bits words, 3 channels
std::vector<std::uint8_t> gamma(size * 2 * 3, 255);
sanei_genesys_generate_gamma_buffer(dev, sensor, 16, 65535, size, gamma.data());
// loop sending gamma tables NOTE: 0x01000000 not 0x10000000
for (i = 0; i < 3; i++) {
// clear corresponding GMM_N bit
uint8_t val = dev->interface->read_register(0xbd);
std::uint8_t val = dev->interface->read_register(0xbd);
val &= ~(0x01 << i);
dev->interface->write_register(0xbd, val);
@ -1410,7 +1410,7 @@ void sanei_genesys_asic_init(Genesys_Device* dev)
{
DBG_HELPER(dbg);
uint8_t val;
std::uint8_t val;
bool cold = true;
// URB 16 control 0xc0 0x0c 0x8e 0x0b len 1 read 0x00 */
@ -1507,13 +1507,13 @@ void scanner_start_action(Genesys_Device& dev, bool start_motor)
void sanei_genesys_set_dpihw(Genesys_Register_Set& regs, unsigned dpihw)
{
// same across GL646, GL841, GL843, GL846, GL847, GL124
const uint8_t REG_0x05_DPIHW_MASK = 0xc0;
const uint8_t REG_0x05_DPIHW_600 = 0x00;
const uint8_t REG_0x05_DPIHW_1200 = 0x40;
const uint8_t REG_0x05_DPIHW_2400 = 0x80;
const uint8_t REG_0x05_DPIHW_4800 = 0xc0;
const std::uint8_t REG_0x05_DPIHW_MASK = 0xc0;
const std::uint8_t REG_0x05_DPIHW_600 = 0x00;
const std::uint8_t REG_0x05_DPIHW_1200 = 0x40;
const std::uint8_t REG_0x05_DPIHW_2400 = 0x80;
const std::uint8_t REG_0x05_DPIHW_4800 = 0xc0;
uint8_t dpihw_setting;
std::uint8_t dpihw_setting;
switch (dpihw) {
case 600:
dpihw_setting = REG_0x05_DPIHW_600;
@ -1925,8 +1925,8 @@ void sanei_genesys_load_lut(unsigned char* lut,
double shift, rise;
int max_in_val = (1 << in_bits) - 1;
int max_out_val = (1 << out_bits) - 1;
uint8_t *lut_p8 = lut;
uint16_t* lut_p16 = reinterpret_cast<std::uint16_t*>(lut);
std::uint8_t* lut_p8 = lut;
std::uint16_t* lut_p16 = reinterpret_cast<std::uint16_t*>(lut);
/* slope is converted to rise per unit run:
* first [-127,127] to [-.999,.999]

Wyświetl plik

@ -224,8 +224,8 @@ void scanner_register_rw_set_bits(Genesys_Device& dev, std::uint16_t address, st
void scanner_register_rw_bits(Genesys_Device& dev, std::uint16_t address,
std::uint8_t value, std::uint8_t mask);
extern void sanei_genesys_write_ahb(Genesys_Device* dev, uint32_t addr, uint32_t size,
uint8_t* data);
void sanei_genesys_write_ahb(Genesys_Device* dev, std::uint32_t addr, std::uint32_t size,
std::uint8_t* data);
extern void sanei_genesys_init_structs (Genesys_Device * dev);
@ -272,14 +272,14 @@ bool should_enable_gamma(const ScanSession& session, const Genesys_Sensor& senso
i.e. the number written to REG_FWDSTEP.
*/
void sanei_genesys_calculate_zmod(bool two_table,
uint32_t exposure_time,
const std::vector<uint16_t>& slope_table,
std::uint32_t exposure_time,
const std::vector<std::uint16_t>& slope_table,
unsigned acceleration_steps,
unsigned move_steps,
unsigned buffer_acceleration_steps,
uint32_t* out_z1, uint32_t* out_z2);
std::uint32_t* out_z1, std::uint32_t* out_z2);
extern void sanei_genesys_set_buffer_address(Genesys_Device* dev, uint32_t addr);
extern void sanei_genesys_set_buffer_address(Genesys_Device* dev, std::uint32_t addr);
unsigned sanei_genesys_get_bulk_max_size(AsicType asic_type);
@ -287,10 +287,10 @@ SANE_Int sanei_genesys_exposure_time2(Genesys_Device* dev, const MotorProfile& p
int endpixel, int led_exposure);
void sanei_genesys_create_default_gamma_table(Genesys_Device* dev,
std::vector<uint16_t>& gamma_table, float gamma);
std::vector<std::uint16_t>& gamma_table, float gamma);
std::vector<uint16_t> get_gamma_table(Genesys_Device* dev, const Genesys_Sensor& sensor,
int color);
std::vector<std::uint16_t> get_gamma_table(Genesys_Device* dev, const Genesys_Sensor& sensor,
int color);
void sanei_genesys_send_gamma_table(Genesys_Device* dev, const Genesys_Sensor& sensor);
@ -328,14 +328,14 @@ SensorExposure scanner_led_calibration(Genesys_Device& dev, const Genesys_Sensor
void scanner_clear_scan_and_feed_counts(Genesys_Device& dev);
void scanner_send_slope_table(Genesys_Device* dev, const Genesys_Sensor& sensor, unsigned table_nr,
const std::vector<uint16_t>& slope_table);
const std::vector<std::uint16_t>& slope_table);
extern void sanei_genesys_write_file(const char* filename, const std::uint8_t* data,
std::size_t length);
void wait_until_buffer_non_empty(Genesys_Device* dev, bool check_status_twice = false);
extern void sanei_genesys_read_data_from_scanner(Genesys_Device* dev, uint8_t* data, size_t size);
void sanei_genesys_read_data_from_scanner(Genesys_Device* dev, std::uint8_t* data, size_t size);
Image read_unshuffled_image_from_scanner(Genesys_Device* dev, const ScanSession& session,
std::size_t total_bytes);
@ -413,12 +413,12 @@ extern void sanei_genesys_load_lut(unsigned char* lut,
int out_min, int out_max,
int slope, int offset);
extern void sanei_genesys_generate_gamma_buffer(Genesys_Device* dev,
const Genesys_Sensor& sensor,
int bits,
int max,
int size,
uint8_t* gamma);
void sanei_genesys_generate_gamma_buffer(Genesys_Device* dev,
const Genesys_Sensor& sensor,
int bits,
int max,
int size,
std::uint8_t* gamma);
unsigned session_adjust_output_pixels(unsigned output_pixels,
const Genesys_Device& dev, const Genesys_Sensor& sensor,

Wyświetl plik

@ -147,8 +147,8 @@ void ScannerInterfaceUsb::write_registers(const Genesys_Register_Set& regs)
if (dev_->model->asic_type == AsicType::GL646 ||
dev_->model->asic_type == AsicType::GL841)
{
uint8_t outdata[8];
std::vector<uint8_t> buffer;
std::uint8_t outdata[8];
std::vector<std::uint8_t> buffer;
buffer.reserve(regs.size() * 2);
/* copy registers and values in data buffer */
@ -206,7 +206,7 @@ static void bulk_read_data_send_header(UsbDevice& usb_dev, AsicType asic_type, s
{
DBG_HELPER(dbg);
uint8_t outdata[8];
std::uint8_t outdata[8];
if (asic_type == AsicType::GL124 ||
asic_type == AsicType::GL845 ||
asic_type == AsicType::GL846 ||

Wyświetl plik

@ -47,8 +47,8 @@
namespace genesys {
TestScannerInterface::TestScannerInterface(Genesys_Device* dev, uint16_t vendor_id,
uint16_t product_id, uint16_t bcd_device) :
TestScannerInterface::TestScannerInterface(Genesys_Device* dev, std::uint16_t vendor_id,
std::uint16_t product_id, std::uint16_t bcd_device) :
dev_{dev},
usb_dev_{vendor_id, product_id, bcd_device}
{