]> sigrok.org Git - libsigrok.git/commit - src/hardware/zeroplus-logic-cube/api.c
zeroplus: Major rework of sample buffer processing
authorRuss Dill <redacted>
Mon, 30 Dec 2013 15:12:49 +0000 (07:12 -0800)
committerBert Vermeulen <redacted>
Fri, 3 Jan 2014 14:09:11 +0000 (15:09 +0100)
commit42ceb77726b6314fc999cf3664114820eaeddba9
tree9901ce5a1d4b52121166938a79055e1f59b028fc
parenta864a05b25d150214978f51e21b724d912648129
zeroplus: Major rework of sample buffer processing

The sample buffer is a still a bit of a mystery, but this should help.
The variables in play:

triggerbar/ramsize_trigger - These two variables added together indicate
how many samples we want captured. ramsize_trigger - triggerbar
indicades how many samples must be captured. The ratio between the two
is determined by capture ratio.

memory_size - This indicates the number of samples in the circular
capture buffer. stop_address, now_address, and trigger_address are
pointers within the zeroplus that wrap based on this size.

now_address - The address that the zeroplus was about to write to when
it finished capturing, and now the address that will be read from when
reads are done from the capture buffer

stop_address - The address that the zeroplus last wrote to when it
completed capture.

trigger_address - The sample address for which the trigger occured.

status - This one is a bit tricky. Some testing has shown that if the
zeroplus has captured memory_size or less samples, the STATUS_READY bit
is set. For all captures generated with more samples than this,
STATUS_READY was cleared. However, boundary conditions are difficult to
test and values such as, memory_size + 1 have not been tested. We use
this to determine if the capture has wrapped through the sample buffer.

More testing is required, but this improves behavior in a number of
cases, specifically capturing sample amounts that are not a power of 2
of the sample buffer size. Before, random data was passed to libsigrok.

Signed-off-by: Russ Dill <redacted>
hardware/zeroplus-logic-cube/api.c