From: Marcus Comstedt Date: Sun, 17 Aug 2014 12:20:01 +0000 (+0200) Subject: saleae-logic16: Recognize FPGA FIFO overflow status X-Git-Tag: libsigrok-0.4.0~1140 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=7754fb4d931013f520f85aa8cbef3bcd491e2599;p=libsigrok.git saleae-logic16: Recognize FPGA FIFO overflow status --- diff --git a/src/hardware/saleae-logic16/protocol.c b/src/hardware/saleae-logic16/protocol.c index 78583343..26db6515 100644 --- a/src/hardware/saleae-logic16/protocol.c +++ b/src/hardware/saleae-logic16/protocol.c @@ -464,6 +464,9 @@ SR_PRIV int logic16_setup_acquisition(const struct sr_dev_inst *sdi, if ((ret = read_fpga_register(sdi, 1, ®1)) != SR_OK) return ret; + /* Ignore FIFO overflow on previous capture */ + reg1 &= ~0x20; + if (reg1 != 0x08) { sr_dbg("Invalid state at acquisition setup: 0x%02x != 0x08.", reg1); return SR_ERR; @@ -540,8 +543,8 @@ SR_PRIV int logic16_abort_acquisition(const struct sr_dev_inst *sdi) if ((ret = read_fpga_register(sdi, 1, ®1)) != SR_OK) return ret; - if (reg1 != 0x08) { - sr_dbg("Invalid state at acquisition stop: 0x%02x != 0x08.", reg1); + if ((reg1 & ~0x20) != 0x08) { + sr_dbg("Invalid state at acquisition stop: 0x%02x != 0x08.", reg1 & ~0x20); return SR_ERR; } @@ -551,6 +554,11 @@ SR_PRIV int logic16_abort_acquisition(const struct sr_dev_inst *sdi) if ((ret = read_fpga_register(sdi, 9, ®9)) != SR_OK) return ret; + if (reg1 & 0x20) { + sr_warn("FIFO overflow, capture data may be truncated."); + return SR_ERR; + } + return SR_OK; }