]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/asix-sigma/protocol.c
asix-sigma: Fixup the download of the last data acquisition chunk
[libsigrok.git] / src / hardware / asix-sigma / protocol.c
index 1f2b2a63d49fc678b9d062c20fa92f5fb950ed23..a80e4d10c45be1f9e3af90745672206909b92666 100644 (file)
@@ -857,15 +857,9 @@ static void sigma_decode_dram_cluster(struct sigma_dram_cluster *dram_cluster,
        logic.data = samples;
 
        /*
-        * First of all, send Sigrok a copy of the last sample from
-        * previous cluster as many times as needed to make up for
-        * the differential characteristics of data we get from the
-        * Sigma. Sigrok needs one sample of data per period.
-        *
-        * One DRAM cluster contains a timestamp and seven samples,
-        * the units of timestamp are "devc->period_ps" , the first
-        * sample in the cluster happens at the time of the timestamp
-        * and the remaining samples happen at timestamp +1...+6 .
+        * If this cluster is not adjacent to the previously received
+        * cluster, then send the appropriate number of samples with the
+        * previous values to the sigrok session. This "decodes RLE".
         */
        for (ts = 0; ts < tsdiff; ts++) {
                i = ts % 1024;
@@ -1082,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);