From: Marek Vasut Date: Sun, 20 Apr 2014 20:45:25 +0000 (+0200) Subject: asix-sigma: Properly fetch timestamp in decode_chunk_ts() X-Git-Tag: libsigrok-0.3.0~33 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=3628074d09723f20fa1b0a2026d6300ff69242c3;p=libsigrok.git asix-sigma: Properly fetch timestamp in decode_chunk_ts() 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 --- diff --git a/hardware/asix-sigma/asix-sigma.c b/hardware/asix-sigma/asix-sigma.c index 8be458e0..64ebcbb8 100644 --- a/hardware/asix-sigma/asix-sigma.c +++ b/hardware/asix-sigma/asix-sigma.c @@ -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;