]> sigrok.org Git - libsigrok.git/commitdiff
ols: Don't reduce sample count just because it's not a multiple of 4.
authorBert Vermeulen <redacted>
Thu, 23 Jan 2014 00:09:16 +0000 (01:09 +0100)
committerBert Vermeulen <redacted>
Thu, 23 Jan 2014 00:09:16 +0000 (01:09 +0100)
hardware/openbench-logic-sniffer/api.c

index 2d201bb2d3a6c52f2d1938e9f188e044f485bc8c..7852b6ce3ee473b43bcbb1e9f6b39ca0f2404ad8 100644 (file)
@@ -422,7 +422,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi,
        struct sr_serial_dev_inst *serial;
        uint32_t trigger_config[4];
        uint32_t data;
-       uint16_t readcount, delaycount;
+       uint16_t samplecount, readcount, delaycount;
        uint8_t changrp_mask;
        int num_channels;
        int i;
@@ -456,7 +456,10 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi,
         * Limit readcount to prevent reading past the end of the hardware
         * buffer.
         */
-       readcount = MIN(devc->max_samples / num_channels, devc->limit_samples) / 4;
+       samplecount = MIN(devc->max_samples / num_channels, devc->limit_samples);
+       readcount = samplecount / 4;
+       if (samplecount % 4)
+               readcount++;
 
        memset(trigger_config, 0, 16);
        trigger_config[devc->num_stages] |= 0x08;