Introduce helper function which returns the timestamp of DRAM cluster
and use it in download_capture().

Signed-off-by: Marek Vasut <[email protected]>
---
 hardware/asix-sigma/asix-sigma.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/hardware/asix-sigma/asix-sigma.c b/hardware/asix-sigma/asix-sigma.c
index e573732..d2543a4 100644
--- a/hardware/asix-sigma/asix-sigma.c
+++ b/hardware/asix-sigma/asix-sigma.c
@@ -929,6 +929,15 @@ static int get_trigger_offset(uint16_t *samples, uint16_t 
last_sample,
        return i & 0x7;
 }
 
+
+/*
+ * Return the timestamp of "DRAM cluster".
+ */
+static uint16_t sigma_dram_cluster_ts(struct sigma_dram_cluster *cluster)
+{
+       return (cluster->timestamp_hi << 8) | cluster->timestamp_lo;
+}
+
 /*
  * Decode chunk of 1024 bytes, 64 clusters, 7 events per cluster.
  * Each event is 20ns apart, and can contain multiple samples.
@@ -1127,7 +1136,8 @@ static int download_capture(struct sr_dev_inst *sdi)
 
                /* This is the first DRAM line, so find the initial timestamp. 
*/
                if (dl_lines_done == 0) {
-                       devc->state.lastts = RL16(buf) - 1;
+                       devc->state.lastts =
+                               sigma_dram_cluster_ts(&dram_line[0].cluster[0]);
                        devc->state.lastsample = 0;
                }
 
-- 
1.8.5.3


------------------------------------------------------------------------------
Start Your Social Network Today - Download eXo Platform
Build your Enterprise Intranet with eXo Platform Software
Java Based Open Source Intranet - Social, Extensible, Cloud Ready
Get Started Now And Turn Your Intranet Into A Collaboration Platform
http://p.sf.net/sfu/ExoPlatform
_______________________________________________
sigrok-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sigrok-devel

Reply via email to