Skip to content

OLS Improvements #51

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 20 commits into
base: master
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions src/hardware/openbench-logic-sniffer/protocol.c
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,7 @@ ols_set_basic_trigger_stage(const struct ols_basic_trigger_desc *trigger_desc,
SR_PRIV int ols_prepare_acquisition(const struct sr_dev_inst *sdi)
{
int ret;
uint32_t readcount, delaycount;

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

/*
* Limit readcount to prevent reading past the end of the hardware
* buffer. Rather read too many samples than too few.
* Limit the number of samples to what the hardware can do.
* The sample count is always a multiple of four.
*/
uint32_t samplecount =
MIN(devc->max_samples / num_changroups, devc->limit_samples);
uint32_t readcount = (samplecount + 3) / 4;
uint32_t delaycount;
devc->limit_samples =
(MIN(devc->max_samples / num_changroups, devc->limit_samples) + 3)
Comment on lines +735 to +736

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TBH, I liked the intermediate step with 'samplecount'. It made the calculation easier to follow. The multiplication with 4 itself makes sense, of course.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problem, I brought back the intermediate step, and kept the arithmetic.

/ 4 * 4;
readcount = devc->limit_samples / 4;

/* Basic triggers. */
struct ols_basic_trigger_desc basic_trigger_desc;
Expand Down