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.
Uwe Hermann [Thu, 16 Jan 2014 23:26:30 +0000 (00:26 +0100)]
usb: Fix two compiler warnings on Windows.
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)
^
hameg-hmo: Change the way vdiv and timebase are saved.
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.
hameg-hmo: Send the DF_END packet in acquisition_stop()
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.
strutil: Add function to parse floating point numbers while ignoring the locale.
Most of the supported gear uses the ANSI C locale for communication, and if the
client sets up an incompatible locale parsing would fail.
This function ignores the client's locale and parses floating point numbers
using the ANSI C locale. This function should be always used when parsing
floating point numbers coming from the instrument.
device: Pass sdi as an function argument to config_list in dev_has_option()
With drivers that support multiple devices we need to know the device model
while listing options. That information is most of the time saved in the private
part of the dev_inst structure.
Pass the pointer to the dev_inst structure as an function argument so we have
access to this information.
strutil: Correctly parse floating point frequencies in parse_size_string().
parse_size_string() incorrectly parses a real number, e.g. 1.5 kHz ends up
being 1Hz.
This patch fixes parse_size_string() to take the fractional part as well into
account. The fractional part is parsed as an double precision floating point
number while ignoring the locale.
Daniel Elstner [Wed, 15 Jan 2014 01:51:08 +0000 (02:51 +0100)]
sysclk-lwla: Bypass divider in external clock mode.
(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.
Daniel Elstner [Wed, 15 Jan 2014 00:12:39 +0000 (01:12 +0100)]
sysclk-lwla: Utility functions clean-up and semantic fixes.
(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.
Daniel Elstner [Tue, 14 Jan 2014 23:52:26 +0000 (00:52 +0100)]
sysclk-lwla: Avoid warning due to bogus range check.
(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.
Uwe Hermann [Tue, 14 Jan 2014 18:52:26 +0000 (19:52 +0100)]
sysclk-lwla: Fix probe name issue.
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).
Aurelien Jacobs [Sat, 11 Jan 2014 23:38:08 +0000 (00:38 +0100)]
scpi_tcp: split into scpi_tcp_raw and scpi_tcp_rigol
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.
Bert Vermeulen [Tue, 7 Jan 2014 11:52:23 +0000 (12:52 +0100)]
Add sr_session_save_init().
This allows a frontend to initialize a session file, providing the
required samplerate and probe names, without having a proper
struct sr_dev_inst handy.
sr_session_append() is then used to add captured data to the session
file, as usual.
The existing sr_session_save() function works the same way as always.
Uwe Hermann [Mon, 6 Jan 2014 19:44:44 +0000 (20:44 +0100)]
hardware/common/dmm: Fix debug output level.
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)
Russ Dill [Mon, 30 Dec 2013 15:12:49 +0000 (07:12 -0800)]
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.
Russ Dill [Mon, 30 Dec 2013 14:59:55 +0000 (06:59 -0800)]
zeroplus: Always set DONT_CARE_TRIGGERBAR to 1
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.