The maximum sample size that can be set on a device is now published
by sr_config_list(SR_CONF_LIMIT_SAMPLES). This returns a tuple of
uint64_t representing minimum and maximum number of samples.
Report settings at acquisition start as informational messages.
Print a message when the the trigger condition has been met.
Demote some other messages from information to debug, and use
the %zu format for printing size_t values.
(process_sample_data): When expanding run-length samples into
session packets, calculate the number of samples to write in
advance while honoring all constraints. This is cleaner than
checking constraints within the expansion loop. Also, the new
logic always fills up packets exactly to whatever limit applies
first, thereby removing the need for truncation after the fact.
Allow the acquisition to be constrained by time in addition to
a sample count limit. Since the LWLA protocol actually provides
only a duration natively, implement the sample count limit on top
of the new duration limit.
With this change, limiting an acquisition in external clock mode
should finally work properly.
This adds sine wave generation capabilities for the analog channels in the demo
driver. The frequency of the sine wave depends on the configured sample rate of
the demo device. The frequency of the sine wave is always 20 times smaller than
the sample rate, in other words we always have 20 samples per period.
CC libsigrok_hw_common_la-usb.lo
usb.c:241:18: warning: no previous prototype for 'usb_thread'
[-Wmissing-prototypes]
SR_PRIV gpointer usb_thread(gpointer data)
^
usb.c:256:13: warning: no previous prototype for 'usb_callback'
[-Wmissing-prototypes]
SR_PRIV int usb_callback(int fd, int revents, void *cb_data)
^
The sample rate on the Hameg scopes changes depending on the number of channels
turned on and on the current timebase.
Update the sample rate if any of the above change.
The current vertical division setting (per channel) and the timebase are stored
as a floating point number. This is suboptimal since clients expect us to send
this information to them in form of a rational number.
Store only the index of the current setting since all the supported settings are
already stored inside of an array.
The DF_END packet was send out after all configured frames were fetched, but
devices may stop the acquisition at any point in time and an DF_END will not be
send out in this case.
Send the DF_END packet inside of acquisition_stop() so this can't happen.
The device is after a scan left open and clients that don't call unconditionally
dev_open() will never fetch the initial device state.
Close the device after the scan so clients know they need to open it.
(lwla_setup_acquisition): Set the clock divider bypass
flag to 1 for the external clock modes as well.
(capture_setup): Set the clock divide count to 0 if an
external clock source is selected.
(lwla_send_bitstream): Unref the mapped file earlier in order
to simplify the error handling.
(lwla_receive_reply): Do not treat a reply buffer length of
zero as silent no-op. That logic was left over from an earlier
iteration, before the distinction between reply buffer size and
expected read length was introduced.
(lwla_set_clock_source): Checking whether an enum value is greater
than or equal to zero apparently results in a warning with some
compilers. Assign the enum to an unsigned variable to avoid this,
and return SR_ERR_BUG if the range is exceeded, as this indicates
a bug in the driver code itself.
The g_ascii_formatd() function expects the "format" argument to start
with a '%' character, e.g. it should be "%f" or such (this is not
clearly documented in the glib API docs, but visible from the source code).
The usage of "CH%f" for example will trigger an assertion and thus make the
LWLA device unusable in practice (e.g. in PulseView on Windows no probenames
would be shown, and sampling wouldn't work).
Example:
GLib-CRITICAL **: g_ascii_formatd: assertion 'format[0] == '%'' failed
(not exposed in all glib versions or builds of glib on all distros
apparently, some may need G_MESSAGES_DEBUG=all or other measures)
From the glib g_ascii_formatd() code:
g_return_val_if_fail (format[0] == '%', NULL);
We now use g_snprintf() instead for simplicity. This has been tested to
fix this specific issue (i.e. the probenames now do show up in PulseView).
This closes bug #270.
The current implementation is renamed to tcp-rigol as it seems to be
a Rigol proprietary protocol used only on Rigol VS5000 series.
A new tcp-raw implementation is introduced which simply carries raw SCPI
commands over TCP. It is probably a much more common protocol and it is
at least available on Rigol DS2000 series on port 5555.
Most messages from the DMM parsers are not hard errors, lower to
sr_dbg() so that the sigrok-cli output doesn't get cluttered (by default)
with debug output such as:
P1: 0.001100 V DC AUTO
sr: fs9721: Sync nibble in byte 0 (0x00) is invalid.
P1: 0.001100 V DC AUTO
(using -l 4 or -l 5 will still allow the user to see such messages)
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 <Russ.Dill@gmail.com>
Experimentation with the windows driver has found no situation where
this is set to anything other than 1. The zerominus software also never
sets this to anything other than one. Revert the code change made in
0ab0cb942f.
Signed-off-by: Russ Dill <Russ.Dill@gmail.com>
If there is no trigger, don't try to capture anything before it. There
won't be any because we trigger immediately.
Signed-off-by: Russ Dill <Russ.Dill@gmail.com>
This will need some additional work when support is added for compression
modes since group D is disabled for RLE compression and C and D are
disabled for "double" compression.
Signed-off-by: Russ Dill <Russ.Dill@gmail.com>
We have to wait a bit longer than 1s for a valid DMM packet to arrive,
since for various DMMs some modes (Hz/% for example) the packets will
arrive a lot less often than in other modes. If the waiting period is
too short detection of the DMM will fail.
CC libsigrok_hw_gmc_mh_1x_2x_la-protocol.lo
protocol.c:133:32: warning: equality comparison with extraneous
parentheses
[-Wparentheses-equality]
} else if ((devc->scale1000 == 2)) {
~~~~~~~~~~~~~~~~^~~~
protocol.c:133:32: note: remove extraneous parentheses around the
comparison to
silence this warning
} else if ((devc->scale1000 == 2)) {
~ ^ ~