]> sigrok.org Git - libsigrok.git/commitdiff
zeroplus: Modify analyzer_read_start to just prep for bulk reads.
authorRuss Dill <redacted>
Wed, 1 Jan 2014 00:25:51 +0000 (16:25 -0800)
committerBert Vermeulen <redacted>
Fri, 3 Jan 2014 14:09:10 +0000 (15:09 +0100)
Let the capture loop manage which samples are thrown out rather
than throwing out two here.

Signed-off-by: Russ Dill <redacted>
hardware/zeroplus-logic-cube/analyzer.c
hardware/zeroplus-logic-cube/gl_usb.c
hardware/zeroplus-logic-cube/gl_usb.h

index e9780d2dd0bb5f90e56dfb5f3995c6bf25ad0526..1bf1f65b2abdb29593642b8147784a7fb713b2ef 100644 (file)
@@ -411,12 +411,10 @@ SR_PRIV void analyzer_wait(libusb_device_handle *devh, int set, int unset)
 
 SR_PRIV void analyzer_read_start(libusb_device_handle *devh)
 {
-       int i;
-
        analyzer_write_status(devh, 3, STATUS_FLAG_20 | STATUS_FLAG_READ);
 
-       for (i = 0; i < 8; i++)
-               (void)gl_reg_read(devh, READ_RAM_STATUS);
+       /* Prep for bulk reads */
+       gl_reg_read_buf(devh, READ_RAM_STATUS, NULL, 0);
 }
 
 SR_PRIV int analyzer_read_data(libusb_device_handle *devh, void *buffer,
index 0bffd43a08e9f6af542894a8a78221e3228bac98..20993286d275ffde471cebbe9809b4ef850c76f7 100644 (file)
@@ -132,3 +132,21 @@ SR_PRIV int gl_reg_read(libusb_device_handle *devh, unsigned int reg)
        ret = gl_read_data(devh);
        return ret;
 }
+
+SR_PRIV int gl_reg_read_buf(libusb_device_handle *devh, unsigned int reg,
+               unsigned char *buf, unsigned int len)
+{
+       int ret;
+       unsigned int i;
+
+       ret = gl_write_address(devh, reg);
+       if (ret < 0)
+               return ret;
+       for (i = 0; i < len; i++) {
+               ret = gl_read_data(devh);
+               if (ret < 0)
+                       return ret;
+               buf[i] = ret;
+       }
+       return 0;
+}
index ac588fb5d4a3f0948e7d69930d64e68c690b57bb..c3a33fb34fb35d867fc14bdddb180472fe826d17 100644 (file)
@@ -40,5 +40,6 @@ SR_PRIV int gl_read_bulk(libusb_device_handle *devh, void *buffer,
 SR_PRIV int gl_reg_write(libusb_device_handle *devh, unsigned int reg,
                         unsigned int val);
 SR_PRIV int gl_reg_read(libusb_device_handle *devh, unsigned int reg);
-
+SR_PRIV int gl_reg_read_buf(libusb_device_handle *devh, unsigned int reg,
+                       unsigned char *buf, unsigned int len);
 #endif