]> sigrok.org Git - libsigrok.git/commitdiff
sysclk-lwla: Read full 64 bit of capture duration field
authorDaniel Elstner <redacted>
Sat, 31 Oct 2015 09:19:51 +0000 (10:19 +0100)
committerDaniel Elstner <redacted>
Sat, 31 Oct 2015 09:19:51 +0000 (10:19 +0100)
Evaluate all 64 bit of the duration field in the capture status
record. Although unlikely in practical use, due to compression
it is possible for the duration in ms to exceed 32 bit.

src/hardware/sysclk-lwla/protocol.c

index 0753f4579714a70b6b528c6f97ad41902f68afbb..ba676f69a72c7804bfc6aed3b2bdcca359ce1fa8 100644 (file)
@@ -372,13 +372,10 @@ static void process_capture_status(const struct sr_dev_inst *sdi)
                return;
        }
 
-       /* TODO: Find out the actual bit width of these fields as stored
-        * in the FPGA.  These fields are definitely less than 64 bit wide
-        * internally, and the unused bits occasionally even contain garbage.
-        */
        mem_fill = LWLA_TO_UINT32(acq->xfer_buf_in[0]);
-       duration = LWLA_TO_UINT32(acq->xfer_buf_in[4]);
-       flags    = LWLA_TO_UINT32(acq->xfer_buf_in[8]) & STATUS_FLAG_MASK;
+       duration = LWLA_TO_UINT32(acq->xfer_buf_in[4])
+               | ((uint64_t)LWLA_TO_UINT32(acq->xfer_buf_in[5]) << 32);
+       flags = LWLA_TO_UINT32(acq->xfer_buf_in[8]) & STATUS_FLAG_MASK;
 
        /* The LWLA1034 runs at 125 MHz if the clock divider is bypassed.
         * However, the time base used for the duration is apparently not