Add an address parameter to the memory dump helper function

To support devices where not all memory is readable, the memory dump
helper function needs an extra parameter to specify the start address.
This commit is contained in:
Jef Driesen 2022-05-12 16:24:55 +02:00
parent d0c7562c41
commit 2443d3ea47
12 changed files with 13 additions and 13 deletions

View File

@ -386,7 +386,7 @@ cressi_edy_device_dump (dc_device_t *abstract, dc_buffer_t *buffer)
devinfo.serial = 0;
device_event_emit (abstract, DC_EVENT_DEVINFO, &devinfo);
return device_dump_read (abstract, dc_buffer_get_data (buffer),
return device_dump_read (abstract, 0, dc_buffer_get_data (buffer),
dc_buffer_get_size (buffer), SZ_PACKET);
}

View File

@ -92,7 +92,7 @@ int
device_is_cancelled (dc_device_t *device);
dc_status_t
device_dump_read (dc_device_t *device, unsigned char data[], unsigned int size, unsigned int blocksize);
device_dump_read (dc_device_t *device, unsigned int address, unsigned char data[], unsigned int size, unsigned int blocksize);
#ifdef __cplusplus
}

View File

@ -342,7 +342,7 @@ dc_device_dump (dc_device_t *device, dc_buffer_t *buffer)
dc_status_t
device_dump_read (dc_device_t *device, unsigned char data[], unsigned int size, unsigned int blocksize)
device_dump_read (dc_device_t *device, unsigned int address, unsigned char data[], unsigned int size, unsigned int blocksize)
{
if (device == NULL)
return DC_STATUS_UNSUPPORTED;
@ -363,7 +363,7 @@ device_dump_read (dc_device_t *device, unsigned char data[], unsigned int size,
len = blocksize;
// Read the packet.
dc_status_t rc = device->vtable->read (device, nbytes, data + nbytes, len);
dc_status_t rc = device->vtable->read (device, address + nbytes, data + nbytes, len);
if (rc != DC_STATUS_SUCCESS)
return rc;

View File

@ -382,7 +382,7 @@ liquivision_lynx_device_dump (dc_device_t *abstract, dc_buffer_t *buffer)
}
// Download the memory dump.
return device_dump_read (abstract, dc_buffer_get_data (buffer),
return device_dump_read (abstract, 0, dc_buffer_get_data (buffer),
dc_buffer_get_size (buffer), SEGMENTSIZE);
}

View File

@ -201,7 +201,7 @@ mares_darwin_device_dump (dc_device_t *abstract, dc_buffer_t *buffer)
}
// Download the memory dump.
status = device_dump_read (abstract, dc_buffer_get_data (buffer),
status = device_dump_read (abstract, 0, dc_buffer_get_data (buffer),
dc_buffer_get_size (buffer), PACKETSIZE);
if (status != DC_STATUS_SUCCESS) {
return status;

View File

@ -664,7 +664,7 @@ mares_iconhd_device_dump (dc_device_t *abstract, dc_buffer_t *buffer)
device_event_emit (abstract, DC_EVENT_VENDOR, &vendor);
// Download the memory dump.
status = device_dump_read (abstract, dc_buffer_get_data (buffer),
status = device_dump_read (abstract, 0, dc_buffer_get_data (buffer),
dc_buffer_get_size (buffer), device->packetsize);
if (status != DC_STATUS_SUCCESS) {
return status;

View File

@ -204,7 +204,7 @@ mares_puck_device_dump (dc_device_t *abstract, dc_buffer_t *buffer)
}
// Download the memory dump.
status = device_dump_read (abstract, dc_buffer_get_data (buffer),
status = device_dump_read (abstract, 0, dc_buffer_get_data (buffer),
dc_buffer_get_size (buffer), PACKETSIZE);
if (status != DC_STATUS_SUCCESS) {
return status;

View File

@ -209,7 +209,7 @@ oceanic_common_device_dump (dc_device_t *abstract, dc_buffer_t *buffer)
device_event_emit (abstract, DC_EVENT_VENDOR, &vendor);
// Download the memory dump.
status = device_dump_read (abstract, dc_buffer_get_data (buffer),
status = device_dump_read (abstract, 0, dc_buffer_get_data (buffer),
dc_buffer_get_size (buffer), PAGESIZE * device->multipage);
if (status != DC_STATUS_SUCCESS) {
return status;

View File

@ -363,7 +363,7 @@ sporasub_sp2_device_dump (dc_device_t *abstract, dc_buffer_t *buffer)
vendor.size = sizeof (device->version);
device_event_emit (abstract, DC_EVENT_VENDOR, &vendor);
return device_dump_read (abstract, dc_buffer_get_data (buffer),
return device_dump_read (abstract, 0, dc_buffer_get_data (buffer),
dc_buffer_get_size (buffer), SZ_READ);
}

View File

@ -218,7 +218,7 @@ suunto_common2_device_dump (dc_device_t *abstract, dc_buffer_t *buffer)
vendor.size = sizeof (device->version);
device_event_emit (abstract, DC_EVENT_VENDOR, &vendor);
return device_dump_read (abstract, dc_buffer_get_data (buffer),
return device_dump_read (abstract, 0, dc_buffer_get_data (buffer),
dc_buffer_get_size (buffer), SZ_PACKET);
}

View File

@ -435,7 +435,7 @@ suunto_vyper_device_dump (dc_device_t *abstract, dc_buffer_t *buffer)
}
// Download the memory dump.
status = device_dump_read (abstract, dc_buffer_get_data (buffer),
status = device_dump_read (abstract, 0, dc_buffer_get_data (buffer),
dc_buffer_get_size (buffer), SZ_PACKET);
if (status != DC_STATUS_SUCCESS) {
return status;

View File

@ -241,7 +241,7 @@ zeagle_n2ition3_device_dump (dc_device_t *abstract, dc_buffer_t *buffer)
return DC_STATUS_NOMEMORY;
}
return device_dump_read (abstract, dc_buffer_get_data (buffer),
return device_dump_read (abstract, 0, dc_buffer_get_data (buffer),
dc_buffer_get_size (buffer), SZ_PACKET);
}