Log the ringbuffer pointers

Logging the ringbuffer pointers is very useful while investigating
problems and adding support for new models.
This commit is contained in:
Jef Driesen 2024-03-19 19:46:13 +01:00
parent 4cc0bc25ae
commit 9070b7d035

View File

@ -461,6 +461,7 @@ oceanic_common_device_profile (dc_device_t *abstract, dc_event_progress_t *progr
// Go through the logbook entries a first time, to get the end of // Go through the logbook entries a first time, to get the end of
// profile pointer and calculate the total amount of bytes in the // profile pointer and calculate the total amount of bytes in the
// profile ringbuffer. // profile ringbuffer.
unsigned int rb_profile_begin = INVALID;
unsigned int rb_profile_end = INVALID; unsigned int rb_profile_end = INVALID;
unsigned int rb_profile_size = 0; unsigned int rb_profile_size = 0;
@ -495,6 +496,8 @@ oceanic_common_device_profile (dc_device_t *abstract, dc_event_progress_t *progr
continue; continue;
} }
DEBUG (abstract->context, "Entry: %08x %08x", rb_entry_begin, rb_entry_end);
// Take the end pointer of the most recent logbook entry as the // Take the end pointer of the most recent logbook entry as the
// end of profile pointer. // end of profile pointer.
if (rb_profile_end == INVALID) { if (rb_profile_end == INVALID) {
@ -516,6 +519,9 @@ oceanic_common_device_profile (dc_device_t *abstract, dc_event_progress_t *progr
break; break;
} }
// Update the profile begin pointer.
rb_profile_begin = rb_entry_begin;
// Update the total profile size. // Update the total profile size.
rb_profile_size += rb_entry_size + gap; rb_profile_size += rb_entry_size + gap;
@ -523,6 +529,8 @@ oceanic_common_device_profile (dc_device_t *abstract, dc_event_progress_t *progr
previous = rb_entry_begin; previous = rb_entry_begin;
} }
DEBUG (abstract->context, "Profile: %08x %08x", rb_profile_begin, rb_profile_end);
// At this point, we know the exact amount of data // At this point, we know the exact amount of data
// that needs to be transfered for the profiles. // that needs to be transfered for the profiles.
progress->maximum -= (layout->rb_profile_end - layout->rb_profile_begin) - rb_profile_size; progress->maximum -= (layout->rb_profile_end - layout->rb_profile_begin) - rb_profile_size;
@ -583,6 +591,8 @@ oceanic_common_device_profile (dc_device_t *abstract, dc_event_progress_t *progr
continue; continue;
} }
DEBUG (abstract->context, "Entry: %08x %08x", rb_entry_begin, rb_entry_end);
// Calculate the number of bytes. // Calculate the number of bytes.
unsigned int rb_entry_size = RB_PROFILE_DISTANCE (rb_entry_begin, rb_entry_end, layout, DC_RINGBUFFER_FULL); unsigned int rb_entry_size = RB_PROFILE_DISTANCE (rb_entry_begin, rb_entry_end, layout, DC_RINGBUFFER_FULL);
@ -685,6 +695,9 @@ oceanic_common_device_foreach (dc_device_t *abstract, dc_dive_callback_t callbac
return rc; return rc;
} }
DEBUG (abstract->context, "Logbook: %08x %08x", rb_logbook_begin, rb_logbook_end);
DEBUG (abstract->context, "Profile: %08x %08x", rb_profile_begin, rb_profile_end);
// Memory buffer for the logbook data. // Memory buffer for the logbook data.
dc_buffer_t *logbook = dc_buffer_new (0); dc_buffer_t *logbook = dc_buffer_new (0);
if (logbook == NULL) { if (logbook == NULL) {