]> sigrok.org Git - libsigrok.git/commitdiff
asix-sigma: Properly fetch timestamp in decode_chunk_ts()
authorMarek Vasut <redacted>
Sun, 20 Apr 2014 20:45:25 +0000 (22:45 +0200)
committerBert Vermeulen <redacted>
Wed, 30 Apr 2014 16:45:52 +0000 (09:45 -0700)
Instead of this ad-hoc readout voodoo, use proper function to read
the timestemp. One which will not break even on big-endian machines.

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

index 8be458e0e8a4a12722b1251bd459c0376cd48bcf..64ebcbb8505778c8dd1904ba5c6c90aa3a6e4c38 100644 (file)
@@ -952,6 +952,7 @@ static int decode_chunk_ts(struct sigma_dram_line *dram_line, uint16_t *lastts,
                           uint16_t limit_chunk, void *cb_data)
 {
        uint8_t *buf = (uint8_t *)dram_line;
+       struct sigma_dram_cluster *dram_cluster;
        struct sr_dev_inst *sdi = cb_data;
        struct dev_context *devc = sdi->priv;
        uint16_t tsdiff, ts;
@@ -978,8 +979,9 @@ static int decode_chunk_ts(struct sigma_dram_line *dram_line, uint16_t *lastts,
        }
 
        /* For each ts. */
-       for (i = 0; i < 64; ++i) {
-               ts = *(uint16_t *) &buf[i * 16];
+       for (i = 0; i < 64; i++) {
+               dram_cluster = &dram_line->cluster[i];
+               ts = sigma_dram_cluster_ts(dram_cluster);
                tsdiff = ts - *lastts;
                *lastts = ts;