demo: Cast to double while calculating the pattern frequency.
Without the cast non integer frequencies weren't possible (e.g. with a sampling
frequency of 50Hz we would end up with a signal frequency of 2Hz instead of
2.5Hz). The result were signals which had an incorrect number of samples per
period.
Daniel Elstner [Sun, 26 Jan 2014 23:22:01 +0000 (00:22 +0100)]
hwdriver: Change TRIGGER_SLOPE setting to string type.
Drivers interpreted the uint64 values to the SR_CONF_TRIGGER_SLOPE
configuration setting in different ways. In order to orthogonalize
the API, change the type of the setting to a string with the same
format as uses for logic probes.
Daniel Elstner [Sat, 25 Jan 2014 01:21:19 +0000 (02:21 +0100)]
sysclk-lwla: Load bitstream files in RBF format.
Modify the bitstream loading routine to work directly with the
Raw Binary Files (.rbf) generated by Altera tools. Previously,
a custom format was used which was basically an RBF preceded by
a 4-byte header specifying the transfer length.
Uwe Hermann [Thu, 23 Jan 2014 21:45:08 +0000 (22:45 +0100)]
sr file format: Bump version to 2.
The *.sr (libsigrok session) file format has changed since the last
libsigrok release. Frontends using older libsigrok versions will not
be able to read *.sr files created by frontends using the new file format.
Thus, bump the version number of the file format to 2.
Current libsigrok will read both version 1 and version 2 files
correctly, and always write version 2 files.
Daniel Elstner [Thu, 23 Jan 2014 01:35:51 +0000 (02:35 +0100)]
sysclk-lwla: Implement config_commit() callback.
Move pre-acquisition hardware setup to the new config_commit()
callback. At the moment, the only setting applied at commit
time is switching the clock source, which involves uploading
a new bitstream to the FPGA.
Move setup of channels and trigger masks to the new probe
configuration callback. Although the actual hardware setup
still happens just before acquisition, the new approach
already has the advantage that invalid settings are caught
early.
Also, it turns out that the LWLA1034 allows triggering on
channels which are not enabled for data acquisition. This
feature is now supported as well.
Daniel Elstner [Thu, 23 Jan 2014 00:24:29 +0000 (01:24 +0100)]
sysclk-lwla: Do not reset drv_context.instances on scan.
Apparently, frontends may call scan() more than once to accumulate
multiple devices, so do not reset the instance list pointer at the
start of each scan. Also, number devices continuously across scans.
Martin Ling [Wed, 22 Jan 2014 00:25:32 +0000 (00:25 +0000)]
rigol-ds: Overhaul VS5000 and DS1000 support.
This change moves the handling of series differences out to the points in the
code where they actually matter, unifying the overall structure of the code.
It also adds new VS5000/DS1000 series equivalents for commands that were
previously only implemented on the later models.
After this change, trigger waiting and the 'Memory' data source are supported
on the VS5000/DS1000 series.
Daniel Elstner [Mon, 20 Jan 2014 22:04:49 +0000 (23:04 +0100)]
session: Auto-commit settings before acquisition.
(sr_session_start): Just before starting acquisition on
a device, call sr_config_commit() to apply pending config
changes to the hardware device.
(sr_session_dev_add): Ditto. Also, return an error code
if starting acquisition failed.
Daniel Elstner [Sun, 19 Jan 2014 19:39:11 +0000 (20:39 +0100)]
hwdriver: Introduce sr_config_commit() API call.
(sr_dev_driver.config_probe_set): New optional callback enabling
drivers to be notified upon changes to probe settings.
(sr_dev_probe_enable, sr_dev_trigger_set): Invoke new driver
callback on changes.
(sr_dev_driver.config_commit): New optional callback allowing
drivers to defer application of configuration settings until
an explicit call to config_commit().
(sr_config_commit): New public wrapper function.
Bert Vermeulen [Sun, 19 Jan 2014 16:18:59 +0000 (17:18 +0100)]
Remove SR_CONF_MAX_UNCOMPRESSED_SAMPLES again.
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.
Daniel Elstner [Sat, 18 Jan 2014 17:13:40 +0000 (18:13 +0100)]
sysclk-lwla: Improve message log output.
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.
Daniel Elstner [Sat, 18 Jan 2014 16:36:23 +0000 (17:36 +0100)]
sysclk-lwla: Streamline packet output logic.
(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.
Daniel Elstner [Sat, 18 Jan 2014 15:08:39 +0000 (16:08 +0100)]
sysclk-lwla: Implement SR_CONF_LIMIT_MSEC.
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.
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.