]> sigrok.org Git - libsigrok.git/commitdiff
ols: add feature to support >256K memory
authorWolfram Sang <redacted>
Wed, 2 Jan 2019 12:15:25 +0000 (13:15 +0100)
committerUwe Hermann <redacted>
Sun, 13 Jan 2019 19:07:27 +0000 (20:07 +0100)
Add support for the Pepino-style of accessing >256K of memory. Because
this the only known extension of accessing >256K currently, we apply it
as soon as the sample size is bigger than 256K.  Let's hope other
devices (if any) will follow this style. If not, we need to add support
depending on the device name later.

Signed-off-by: Wolfram Sang <redacted>
src/hardware/openbench-logic-sniffer/api.c
src/hardware/openbench-logic-sniffer/protocol.h

index 5e959507efa54515052dab98c46bf46d3be3492a..b0cc3978bf25e8e529f2ca4ea529e4d09679d232 100644 (file)
@@ -464,12 +464,28 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
        /* Send sample limit and pre/post-trigger capture ratio. */
        sr_dbg("Setting sample limit %d, trigger point at %d",
                        (readcount - 1) * 4, (delaycount - 1) * 4);
        /* Send sample limit and pre/post-trigger capture ratio. */
        sr_dbg("Setting sample limit %d, trigger point at %d",
                        (readcount - 1) * 4, (delaycount - 1) * 4);
-       arg[0] = ((readcount - 1) & 0xff);
-       arg[1] = ((readcount - 1) & 0xff00) >> 8;
-       arg[2] = ((delaycount - 1) & 0xff);
-       arg[3] = ((delaycount - 1) & 0xff00) >> 8;
-       if (send_longcommand(serial, CMD_CAPTURE_SIZE, arg) != SR_OK)
-               return SR_ERR;
+
+       if (devc->max_samples > 256 * 1024) {
+               arg[0] = ((readcount - 1) & 0xff);
+               arg[1] = ((readcount - 1) & 0xff00) >> 8;
+               arg[2] = ((readcount - 1) & 0xff0000) >> 16;
+               arg[3] = ((readcount - 1) & 0xff000000) >> 24;
+               if (send_longcommand(serial, CMD_CAPTURE_READCOUNT, arg) != SR_OK)
+                       return SR_ERR;
+               arg[0] = ((delaycount - 1) & 0xff);
+               arg[1] = ((delaycount - 1) & 0xff00) >> 8;
+               arg[2] = ((delaycount - 1) & 0xff0000) >> 16;
+               arg[3] = ((delaycount - 1) & 0xff000000) >> 24;
+               if (send_longcommand(serial, CMD_CAPTURE_DELAYCOUNT, arg) != SR_OK)
+                       return SR_ERR;
+       } else {
+               arg[0] = ((readcount - 1) & 0xff);
+               arg[1] = ((readcount - 1) & 0xff00) >> 8;
+               arg[2] = ((delaycount - 1) & 0xff);
+               arg[3] = ((delaycount - 1) & 0xff00) >> 8;
+               if (send_longcommand(serial, CMD_CAPTURE_SIZE, arg) != SR_OK)
+                       return SR_ERR;
+       }
 
        /* Flag register. */
        sr_dbg("Setting intpat %s, extpat %s, RLE %s, noise_filter %s, demux %s",
 
        /* Flag register. */
        sr_dbg("Setting intpat %s, extpat %s, RLE %s, noise_filter %s, demux %s",
index 15ed713991e408a1eaf2f69c099bd399a73ab9df..7bcaed1f6699ecbcdb1463ae37cb8da3d21b68a2 100644 (file)
@@ -42,6 +42,8 @@
 #define CMD_SET_DIVIDER            0x80
 #define CMD_CAPTURE_SIZE           0x81
 #define CMD_SET_FLAGS              0x82
 #define CMD_SET_DIVIDER            0x80
 #define CMD_CAPTURE_SIZE           0x81
 #define CMD_SET_FLAGS              0x82
+#define CMD_CAPTURE_DELAYCOUNT     0x83                /* extension for Pepino */
+#define CMD_CAPTURE_READCOUNT      0x84                /* extension for Pepino */
 #define CMD_SET_TRIGGER_MASK       0xc0
 #define CMD_SET_TRIGGER_VALUE      0xc1
 #define CMD_SET_TRIGGER_CONFIG     0xc2
 #define CMD_SET_TRIGGER_MASK       0xc0
 #define CMD_SET_TRIGGER_VALUE      0xc1
 #define CMD_SET_TRIGGER_CONFIG     0xc2