From: Wolfram Sang Date: Wed, 2 Jan 2019 12:15:25 +0000 (+0100) Subject: ols: add feature to support >256K memory X-Git-Url: https://sigrok.org/gitweb/?p=libsigrok.git;a=commitdiff_plain;h=f6ce25ec05e8707ee3783b111ea13779f237c3b3 ols: add feature to support >256K memory 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 --- diff --git a/src/hardware/openbench-logic-sniffer/api.c b/src/hardware/openbench-logic-sniffer/api.c index 5e959507..b0cc3978 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->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", diff --git a/src/hardware/openbench-logic-sniffer/protocol.h b/src/hardware/openbench-logic-sniffer/protocol.h index 15ed7139..7bcaed1f 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_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