]> sigrok.org Git - libsigrok.git/commitdiff
asix-sigma: Use proper structure for DRAM lines
authorMarek Vasut <redacted>
Sun, 20 Apr 2014 20:40:38 +0000 (22:40 +0200)
committerBert Vermeulen <redacted>
Wed, 30 Apr 2014 16:45:52 +0000 (09:45 -0700)
Use proper structure instead of plain buffer of uint8_t for the contents
of DRAM in download_capture(). This is beneficial as we can interpret the
contents easily.

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

index d2543a4db91c6240280f188efd44249d91617bcd..8be458e0e8a4a12722b1251bd459c0376cd48bcf 100644 (file)
@@ -947,10 +947,11 @@ static uint16_t sigma_dram_cluster_ts(struct sigma_dram_cluster *cluster)
  * For 50 MHz and below, events contain one sample for each channel,
  * spread 20 ns apart.
  */
-static int decode_chunk_ts(uint8_t *buf, uint16_t *lastts,
+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)
 {
+       uint8_t *buf = (uint8_t *)dram_line;
        struct sr_dev_inst *sdi = cb_data;
        struct dev_context *devc = sdi->priv;
        uint16_t tsdiff, ts;
@@ -1083,7 +1084,6 @@ static int download_capture(struct sr_dev_inst *sdi)
        struct dev_context *devc = sdi->priv;
        const int chunks_per_read = 32;
        struct sigma_dram_line *dram_line;
-       unsigned char *buf;
        int bufsz;
        uint32_t stoppos, triggerpos;
        struct sr_datafeed_packet packet;
@@ -1098,8 +1098,6 @@ static int download_capture(struct sr_dev_inst *sdi)
        if (!dram_line)
                return FALSE;
 
-       buf = (unsigned char *)dram_line;
-
        sr_info("Downloading sample data.");
 
        /* Stop acquisition. */
@@ -1130,7 +1128,8 @@ static int download_capture(struct sr_dev_inst *sdi)
                /* We can download only up-to 32 DRAM lines in one go! */
                dl_lines_curr = MIN(chunks_per_read, dl_lines_total);
 
-               bufsz = sigma_read_dram(dl_lines_done, dl_lines_curr, buf, devc);
+               bufsz = sigma_read_dram(dl_lines_done, dl_lines_curr,
+                                       (uint8_t *)dram_line, devc);
                /* TODO: Check bufsz. For now, just avoid compiler warnings. */
                (void)bufsz;
 
@@ -1152,7 +1151,7 @@ static int download_capture(struct sr_dev_inst *sdi)
                        if (dl_lines_done + i == trg_line)
                                trigger_line = trg_line;
 
-                       decode_chunk_ts(buf + (i * CHUNK_SIZE),
+                       decode_chunk_ts(dram_line + i,
                                        &devc->state.lastts,
                                        &devc->state.lastsample,
                                        trigger_line, dl_limit, sdi);