Skip to content

Commit 05e39c5

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 3a39f13 commit 05e39c5

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

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

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,7 @@ ols_set_basic_trigger_stage(const struct ols_basic_trigger_desc *trigger_desc,
628628
SR_PRIV int ols_prepare_acquisition(const struct sr_dev_inst *sdi)
629629
{
630630
int ret;
631+
uint32_t readcount, delaycount;
631632

632633
struct dev_context *devc = sdi->priv;
633634
struct sr_serial_dev_inst *serial = sdi->conn;
@@ -643,13 +644,13 @@ SR_PRIV int ols_prepare_acquisition(const struct sr_dev_inst *sdi)
643644
}
644645

645646
/*
646-
* Limit readcount to prevent reading past the end of the hardware
647-
* buffer. Rather read too many samples than too few.
647+
* Limit the number of samples to what the hardware can do.
648+
* The sample count is always a multiple of four.
648649
*/
649-
uint32_t samplecount =
650-
MIN(devc->max_samples / num_changroups, devc->limit_samples);
651-
uint32_t readcount = (samplecount + 3) / 4;
652-
uint32_t delaycount;
650+
devc->limit_samples =
651+
(MIN(devc->max_samples / num_changroups, devc->limit_samples) + 3)
652+
/ 4 * 4;
653+
readcount = devc->limit_samples / 4;
653654

654655
/* Basic triggers. */
655656
struct ols_basic_trigger_desc basic_trigger_desc;

0 commit comments

Comments
 (0)