]> sigrok.org Git - libsigrok.git/commitdiff
asix-sigma: Suspend support for trailing DRAM lines
authorMarek Vasut <redacted>
Sun, 20 Apr 2014 20:58:34 +0000 (22:58 +0200)
committerBert Vermeulen <redacted>
Wed, 30 Apr 2014 16:45:52 +0000 (09:45 -0700)
The support for trailing DRAM lines was broken. This patch starts
rework of support for this, but in order to do that, we need to
rework decode_chunk_ts() a little first.

This patch adjusts the decode_chunk_ts() a little to receive the
total amount of events in DRAM line instead of some nonsense value.
This patch temporarily removes the support for the trailing DRAM
lines until the decode_chunk_ts() is fixed to cope with this, so
yes, this patch introduces breakage!

Signed-off-by: Marek Vasut <redacted>
hardware/asix-sigma/asix-sigma.c

index 64ebcbb8505778c8dd1904ba5c6c90aa3a6e4c38..59acdcb1dcaa657d8822c0db5e91eb4a1e649777 100644 (file)
@@ -949,7 +949,7 @@ static uint16_t sigma_dram_cluster_ts(struct sigma_dram_cluster *cluster)
  */
 static int decode_chunk_ts(struct sigma_dram_line *dram_line, uint16_t *lastts,
                           uint16_t *lastsample, int triggerpos,
-                          uint16_t limit_chunk, void *cb_data)
+                          uint16_t events_in_line, void *cb_data)
 {
        uint8_t *buf = (uint8_t *)dram_line;
        struct sigma_dram_cluster *dram_cluster;
@@ -979,16 +979,12 @@ static int decode_chunk_ts(struct sigma_dram_line *dram_line, uint16_t *lastts,
        }
 
        /* For each ts. */
-       for (i = 0; i < 64; i++) {
+       for (i = 0; i < (events_in_line / 7); i++) {
                dram_cluster = &dram_line->cluster[i];
                ts = sigma_dram_cluster_ts(dram_cluster);
                tsdiff = ts - *lastts;
                *lastts = ts;
 
-               /* Decode partial chunk. */
-               if (limit_chunk && ts > limit_chunk)
-                       return SR_OK;
-
                /* Pad last sample up to current point. */
                numpad = tsdiff * devc->samples_per_event - clustersize;
                if (numpad > 0) {
@@ -1093,7 +1089,7 @@ static int download_capture(struct sr_dev_inst *sdi)
 
        uint32_t i;
        uint32_t dl_lines_total, dl_lines_curr, dl_lines_done;
-       uint32_t dl_trailing_events;
+       uint32_t dl_events_in_line = 64 * 7;
        uint32_t trg_line = ~0;
 
        dram_line = g_try_malloc0(chunks_per_read * sizeof(*dram_line));
@@ -1122,7 +1118,6 @@ static int download_capture(struct sr_dev_inst *sdi)
         * line can be only partial, containing less than 64 clusters.
         */
        dl_lines_total = (stoppos >> 9) + 1;
-       dl_trailing_events = stoppos & 0x1ff;
 
        dl_lines_done = 0;
 
@@ -1143,11 +1138,10 @@ static int download_capture(struct sr_dev_inst *sdi)
                }
 
                for (i = 0; i < dl_lines_curr; i++) {
-                       uint32_t dl_limit = 0;
                        int trigger_line = -1;
                        /* The last "DRAM line" can be only partially full. */
                        if (dl_lines_done + i == dl_lines_total - 1)
-                               dl_limit = dl_trailing_events;
+                               dl_events_in_line = stoppos & 0x1ff;
 
                        /* Test if the trigger happened on this line. */
                        if (dl_lines_done + i == trg_line)
@@ -1156,7 +1150,8 @@ static int download_capture(struct sr_dev_inst *sdi)
                        decode_chunk_ts(dram_line + i,
                                        &devc->state.lastts,
                                        &devc->state.lastsample,
-                                       trigger_line, dl_limit, sdi);
+                                       trigger_line,
+                                       dl_events_in_line, sdi);
                }
 
                dl_lines_done += dl_lines_curr;