Skip to content

Commit 6cc8c2e

Browse files
committed
ols: Communicate internally that the number of samples is a multiple of 4
The exact number must be known when reading data so that we can read the right number of samples without incuring a timeout penalty.
1 parent b274f6c commit 6cc8c2e

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/hardware/openbench-logic-sniffer/protocol.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -593,11 +593,12 @@ SR_PRIV int ols_prepare_acquisition(const struct sr_dev_inst *sdi) {
593593
}
594594

595595
/*
596-
* Limit readcount to prevent reading past the end of the hardware
597-
* buffer. Rather read too many samples than too few.
596+
* Limit the number of samples to what the hardware can do.
597+
* The sample count is always a multiple of four.
598598
*/
599-
uint32_t samplecount = MIN(devc->max_samples / num_changroups, devc->limit_samples);
600-
uint32_t readcount = (samplecount + 3) / 4;
599+
devc->limit_samples =
600+
(MIN(devc->max_samples / num_changroups, devc->limit_samples) + 3) / 4 * 4;
601+
uint32_t readcount = devc->limit_samples / 4;
601602
uint32_t delaycount;
602603

603604
/* Basic triggers. */

0 commit comments

Comments
 (0)