]> sigrok.org Git - libsigrok.git/commitdiff
asix-sigma: Fixup the download of the last data acquisition chunk
authorGerhard Sittig <redacted>
Fri, 26 May 2017 00:18:33 +0000 (02:18 +0200)
committerUwe Hermann <redacted>
Fri, 26 May 2017 20:48:36 +0000 (22:48 +0200)
Correctly determine the size of a download chunk for the last DRAM row
that's involved in the recent data acquisition.

This commit is based on work done by jry@.

This addresses bug #838 (trailing garbage).

It's assumed that the previously downloaded excess data was "swallowed"
by the sample count enforcement logic that was applied earlier, so the
(remainder of the) issue could have gone unnoticed, unless some other
termination condition than sample count was used.

src/hardware/asix-sigma/protocol.c

index 6fda3908c1e8da4c62861890fc0fd0a249a9d72f..a80e4d10c45be1f9e3af90745672206909b92666 100644 (file)
@@ -1076,7 +1076,7 @@ static int download_capture(struct sr_dev_inst *sdi)
 
        while (dl_lines_total > dl_lines_done) {
                /* We can download only up-to 32 DRAM lines in one go! */
-               dl_lines_curr = MIN(chunks_per_read, dl_lines_total);
+               dl_lines_curr = MIN(chunks_per_read, dl_lines_total - dl_lines_done);
 
                bufsz = sigma_read_dram(dl_lines_done, dl_lines_curr,
                                        (uint8_t *)dram_line, devc);