Add support for the Pepino-style of accessing >256K of memory. For that,
we introduce 'feature_flag' which can be set according to the device.

Signed-off-by: Wolfram Sang <w...@the-dreams.de>
---
 src/hardware/openbench-logic-sniffer/api.c    | 28 +++++++++++++++----
 .../openbench-logic-sniffer/protocol.c        |  6 ++++
 .../openbench-logic-sniffer/protocol.h        |  5 ++++
 3 files changed, 33 insertions(+), 6 deletions(-)

diff --git a/src/hardware/openbench-logic-sniffer/api.c 
b/src/hardware/openbench-logic-sniffer/api.c
index 351f7954..0bfc5641 100644
--- a/src/hardware/openbench-logic-sniffer/api.c
+++ b/src/hardware/openbench-logic-sniffer/api.c
@@ -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);
-       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->feature_flags & FEATURE_HUGE_MEM) {
+               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_DELAY, 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_COUNT, 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",
diff --git a/src/hardware/openbench-logic-sniffer/protocol.c 
b/src/hardware/openbench-logic-sniffer/protocol.c
index b9383ddd..0e0458b9 100644
--- a/src/hardware/openbench-logic-sniffer/protocol.c
+++ b/src/hardware/openbench-logic-sniffer/protocol.c
@@ -287,6 +287,12 @@ SR_PRIV struct sr_dev_inst *get_metadata(struct 
sr_serial_dev_inst *serial)
 
        sdi->model = devname->str;
        sdi->version = version->str;
+
+       if (strncmp(devname->str, "Pepino OLS", 10) == 0)
+               devc->feature_flags |= FEATURE_HUGE_MEM;
+
+       sr_dbg("Derived feature flags: 0x%.8x", devc->feature_flags);
+
        g_string_free(devname, FALSE);
        g_string_free(version, FALSE);
 
diff --git a/src/hardware/openbench-logic-sniffer/protocol.h 
b/src/hardware/openbench-logic-sniffer/protocol.h
index 15ed7139..da8f739d 100644
--- a/src/hardware/openbench-logic-sniffer/protocol.h
+++ b/src/hardware/openbench-logic-sniffer/protocol.h
@@ -42,6 +42,8 @@
 #define CMD_SET_DIVIDER            0x80
 #define CMD_CAPTURE_SIZE           0x81
 #define CMD_SET_FLAGS              0x82
+#define CMD_CAPTURE_COUNT          0x83                /* extension for Pepino 
*/
+#define CMD_CAPTURE_DELAY          0x84                /* extension for Pepino 
*/
 #define CMD_SET_TRIGGER_MASK       0xc0
 #define CMD_SET_TRIGGER_VALUE      0xc1
 #define CMD_SET_TRIGGER_CONFIG     0xc2
@@ -64,11 +66,14 @@
 #define FLAG_FILTER                (1 << 1)
 #define FLAG_DEMUX                 (1 << 0)
 
+#define FEATURE_HUGE_MEM           (1 << 0)
+
 struct dev_context {
        int max_channels;
        uint32_t max_samples;
        uint32_t max_samplerate;
        uint32_t protocol_version;
+       uint32_t feature_flags;
 
        uint64_t cur_samplerate;
        uint32_t cur_samplerate_divider;
-- 
2.19.1



_______________________________________________
sigrok-devel mailing list
sigrok-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sigrok-devel

Reply via email to