Oceanic: fix up dive truncation issues, update memory layout

This fixes the dive truncation that happened with long dives due to the
removal of extra padding (commit a2100843b9cf: "Remove extra padding
from the end of the profile").  It turns out the rest of the profile was
in bits 13-15 (with bit 12 being something else).

Also update the memory layout and the baudrate for the i770R.

Signed-off-by: Janice McLaughlin <janice@moremobilesoftware.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Janice McLaughlin 2018-10-02 16:03:36 -07:00 committed by Linus Torvalds
parent 2518231577
commit 17ff3e0667
2 changed files with 10 additions and 8 deletions

View File

@ -507,7 +507,7 @@ static const oceanic_common_layout_t aqualung_i770r_layout = {
0x40000, /* highmem */
0x0000, /* cf_devinfo */
0x0040, /* cf_pointers */
0x1000, /* rb_logbook_begin */
0x2000, /* rb_logbook_begin */
0x10000, /* rb_logbook_end */
16, /* rb_logbook_entry_size */
0x40000, /* rb_profile_begin */
@ -871,10 +871,8 @@ oceanic_atom2_device_open (dc_device_t **out, dc_context_t *context, dc_iostream
case VTX:
case I750TC:
case PROPLUSX:
baudrate = 115200;
break;
case I770R:
baudrate = 1000000;
baudrate = 115200;
break;
default:
baudrate = 38400;

View File

@ -496,10 +496,14 @@ oceanic_common_device_profile (dc_device_t *abstract, dc_event_progress_t *progr
// Remove padding from the profile.
if (layout->highmem) {
// The logbook entry contains the total number of pages containing
// profile data, excluding the footer page. Limit the profile size
// to this size.
unsigned int npages = (array_uint16_le (profiles + offset + 12) & 0x0FFF) + 1;
unsigned char *profile = profiles + offset;
// profile+12 and the bottom 4 bits of profile+13 and the top 3 bits of profile+13
// is the number of pages of profile data until the start of the footer
// (not including the prepended logbook entry).
unsigned int high_part = array_uint16_le (profile + 12) & 0xE000;
unsigned int low_part = array_uint16_le (profile + 12) & 0x0FFF;
unsigned int npages = ((high_part >> 1) | low_part) + 1;
// INFO (abstract->context, "profile npages: 0x%X (%d)", npages, npages);
unsigned int length = npages * PAGESIZE;
if (rb_entry_size > length) {
rb_entry_size = length;