Commit Graph

4335 Commits

Author SHA1 Message Date
Soeren Apel 895cbcdd3c Bindings: constify data pointer 2017-07-06 00:07:30 +02:00
Roland Hieber 8b9fa09859 gitignore nano and vim swap files
When .*.swp already exists, vim will try .*.swo, then .*.swn, and so
forth. Ignore those files too.

Signed-off-by: Roland Hieber <rohieb@rohieb.name>
2017-07-04 12:18:03 +02:00
Richard f97c159536 serial-dmm: Add support for the SparkFun 70C multimeter. 2017-07-04 12:10:29 +02:00
Richard b0e1a1ecc4 Mark some arrays as const 2017-07-04 12:10:29 +02:00
Uwe Hermann fbbafc6909 saleae-logic-pro: Fix two compiler warnings.
src/hardware/saleae-logic-pro/protocol.c:389:12: warning: 'set_led' defined but not used [-Wunused-function]
   static int set_led(const struct sr_dev_inst *sdi, uint8_t r, uint8_t g, uint8_t b)
              ^
    CC       src/hardware/saleae-logic-pro/api.lo
  src/hardware/saleae-logic-pro/api.c: In function 'dev_acquisition_handle':
  src/hardware/saleae-logic-pro/api.c:332:9: warning: missing initializer for field 'tv_sec' of 'struct timeval' [-Wmissing-field-initializers]
    struct timeval tv = {};
           ^
  In file included from /usr/include/x86_64-linux-gnu/sys/time.h:27:0,
                   from include/libsigrok/libsigrok.h:24,
                   from src/hardware/saleae-logic-pro/protocol.h:25,
                   from src/hardware/saleae-logic-pro/api.c:23:
  /usr/include/x86_64-linux-gnu/bits/time.h:32:14: note: 'tv_sec' declared here
       __time_t tv_sec;  /* Seconds.  */
                ^
2017-07-03 11:57:02 +02:00
Uwe Hermann b605edf38f Revert "C++: Avoid std::map::emplace() for GCC 4.7 compatibility"
This reverts commit 8c52989811.

We now require g++ >= 4.8.1 which supports std::map::emplace(), as does
clang >= 3.3.
2017-07-03 11:20:26 +02:00
Uwe Hermann bb0c52719e saleae-logic-pro: Random minor cosmetics/consistency fixes. 2017-06-28 12:35:05 +02:00
Uwe Hermann b6189f7c8a saleae-logic-pro: Driver name consistency fixes. 2017-06-28 12:35:05 +02:00
Jan Luebbe ca7d19b5c8 saleae-logicpro: Initial implementation.
The driver currently support only digital channels and a limited set of
sample rates.
2017-06-28 12:09:32 +02:00
Jan Luebbe a8e913c452 saleae-logicpro: Initial driver skeleton. 2017-06-28 12:09:32 +02:00
Gerhard Sittig 1f4f98e05c asix-sigma: Only open the USB device once (fails with newer libftdi)
The asix-sigma driver was reported to fail in combination with newer
libftdi versions, because the firmware upload routine opened again an
already opened device, and then failed to claim the interface. Which was
not fatal before with previous libftdi versions.

Remove the redundant open call. Remove the local FTDI context variable,
which brings the firmware upload routine in line with all other calls
that communicate to the USB device.

This fixes bug #471.

Suggested-By: Marian Cingel <cingel.marian@gmail.com>
2017-06-27 13:28:25 +02:00
Gerhard Sittig ac9534f48a asix-sigma: Only change number of channels after successful firmware upload
The asix-sigma driver supports different samplerates, which will involve
different firmware images and will affect the number of available logic
channels as well as their memory layout in downloaded sample data.

Make sure to only store the configuration's parameters after the setup
of that configuration has successfully completed, and make sure to store
a consistent set of parameters. Specifically don't change the number of
channels when the firmware upload failed.

This fixes part of bug #471.

Suggested-By: Marian Cingel <cingel.marian@gmail.com>
2017-06-27 13:28:25 +02:00
Gerhard Sittig 7bcf21683e asix-sigma: Propagate errors from firmware upload
The firmware upload code paths in the asix-sigma driver used to return
either the SR_OK code, or the magic number 0 for error conditions. Which
happens to be identical and cannot be told apart by callers.

Provide proper SR_ERR return codes for error conditions, such that
callers can tell whether the firmware upload succeeded.

This fixes part of bug #471.

Suggested-By: Marian Cingel <cingel.marian@gmail.com>
2017-06-27 13:28:25 +02:00
Gerhard Sittig ad466f86cc strutil: Assume bool is true when no value is specified
Adjust the string to boolean conversion for an edge case. Accept empty
text (either NULL or empty strings) to mean true instead of false.

This behaviour is more useful from the user's point of view, when the
option's name alone will enable a feature, and an explicit "option=yes"
specification is not strictly necessary. All calling applications in
mainline already implemented this semantics.
2017-06-25 20:42:21 +02:00
Gerhard Sittig e7eb29685c C++ binding: Nits, style cleanup (braces, whitespace) 2017-06-25 20:42:21 +02:00
Gerhard Sittig 61a6d983bd C++ binding: Allow to re-use ConfigKey::parse_string() for Option class
Split the data type detection from the actual data type conversion in
the ConfigKey::parse_string() method. Allow the Option class to re-use
the public ConfigKey method, to share the maximum amount of data type
conversion code for both Driver and InputFormat option specs.

This is the least intrusive yet most reliable and consistent approach in
the libsigrok C++ binding that allows applications to support driver scan
and input file format options from command line arguments.
2017-06-25 20:42:21 +02:00
Uwe Hermann 276d7b18bb hung-chang-dso-2100: Fix a gcc 7 compiler warning.
../src/hardware/hung-chang-dso-2100/api.c: In function ‘config_commit’:
  ../src/hardware/hung-chang-dso-2100/api.c:562:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
     state = 0x01;
     ~~~~~~^~~~~~
  ../src/hardware/hung-chang-dso-2100/api.c:563:2: note: here
    default:
    ^~~~~~~
  ../src/hardware/hung-chang-dso-2100/api.c:565:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
     if (ret != SR_OK)
        ^
  ../src/hardware/hung-chang-dso-2100/api.c:567:2: note: here
    case 0x01:
    ^~~~
2017-06-24 18:56:53 +02:00
Uwe Hermann 317c97bebb output/csv: Fix a gcc 7 compiler warning.
../src/output/csv.c: In function ‘receive’:
  ../src/output/csv.c:580:8: warning: this statement may fall through [-Wimplicit-fallthrough=]
     *out = g_string_new(ctx->frame);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
  ../src/output/csv.c:582:2: note: here
    case SR_DF_END:
    ^~~~
2017-06-24 18:29:26 +02:00
Uwe Hermann 1a14a62349 input/wav: Fix incorrect memset() call.
../src/input/wav.c: In function ‘send_chunk’:
  ../src/input/wav.c:200:2: warning: ‘memset’ used with length equal to number of elements without multiplication by element size [-Wmemset-elt-size]
    memset(fdata, 0, CHUNK_SIZE);
    ^~~~~~
2017-06-24 17:26:02 +02:00
Uwe Hermann 41b8fca1a1 input/raw_analog: Fix gcc 7 compiler warnings.
../src/input/raw_analog.c: In function ‘init’:
  ../src/input/raw_analog.c:133:31: warning: ‘%d’ directive output may be truncated writing between 1 and 10 bytes into a region of size 6 [-Wformat-truncation=]
     snprintf(channelname, 8, "CH%d", i + 1);
                                 ^~
  ../src/input/raw_analog.c:133:28: note: directive argument in the range [1, 2147483647]
     snprintf(channelname, 8, "CH%d", i + 1);
                              ^~~~~~
  ../src/input/raw_analog.c:133:3: note: ‘snprintf’ output between 4 and 13 bytes into a destination of size 8
     snprintf(channelname, 8, "CH%d", i + 1);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2017-06-24 17:23:56 +02:00
Gerhard Sittig 4a465510fb demo: Mask out logic data for disabled channels in datafeed packets
The previous implementation used to provide datafeed packets which
contain logic data in positions that correspond to disabled channels.

Do mask out logic data of disabled channels in the memory image before
it is sent to the session's datafeed. This implementation works fine for
those situations where either all logic channels are enabled (default
configuration) or when only the upper channels get disabled (which can
be considered a typical use case).

For those configurations where enabled channels follow disabled channels
(i.e. setups with gaps in the sequence of enabled channels) behaviour
will be unexpected: Neither is the mask adjusted to contain gaps, nor
will enabled channels get mapped to result in a dense representation.
The respective code paths are marked with TODO comments.

Add a comment to discuss a non-obvious generator call for analog data in
the acquisition start routine, while we are here.
2017-06-24 16:33:50 +02:00
Gerhard Sittig 1b7b72d49e demo: Skip generating data when all channels in a group are disabled
The generator logic determines how many samples per group (analog and
logic) need to get produced, then keeps iterating until each group has
reached the specified count. Different groups can generate different
numbers of samples per iteration, they have their own stride.

It's essential to check whether all channels in a group are disabled, to
then completely skip the respective half of the generation loop. Without
this check, the group would be expected to generate data but it won't,
which results in an endless loop. This was observed with analog channels.

There was another issue with logic channels. Unexpected logic data was
seen in the output although neither logic channel was selected.

This commit fixes bug #923.
2017-06-23 19:33:24 +02:00
Gerhard Sittig 01f2adb07a demo: Don't generate analog output data for disabled channels
Skip the emission of session datafeed packets for disabled analog
channels.

Implementation detail: Allow for quick lookup of the channel that is
associated with an analog generator, as the data generation routines
only pass generator references in later calls.

This fixes part of bug #923 (which initially is about unexpected
logic data while analog channels were affected in similar ways).
2017-06-23 19:33:24 +02:00
Gerhard Sittig d114464551 demo: Only send average result data when averaging is active
After the requested number of samples was sent, another session df
packet was emitted with one sample for the analog channels, which
contained the most recent result of averaging. Make this emission
depend on the "averaging requested?" flag.

This fixes bug #930.
2017-06-23 19:33:24 +02:00
Gerhard Sittig d91d0b1250 demo: Unbreak execution with all analog channels disabled
The 'demo' driver supports scan options to adjust the number of
supported channels, and runtime control for the enabled state of
channels.

Starting with zero analog channels created (scan option) resulted in a
runtime assertion. Creating but disabling analog channels (GUI checkbox,
CLI option) resulted in unexpected output for disabled channels.

Move the creation of a hash table out of the conditional loop that
iterates over created analog channels. Which results in the table's
always being valid, and iteration during data acquisition yields no
analog output as is expected.

This fixes bug #625.
2017-06-23 19:33:24 +02:00
Gerhard Sittig f1c79a6a35 demo: Drop previous "default enabled" logic (experiment remainder)
A previous implementation of the demo driver supported the creation of
larger channel counts yet only enabling part of them by default. This
was kind of pointless, I just was not aware of the available scan
options.

Drop the "enabled channels" limitation, enable all channels that get
created (like the implementation before the experiment did), and create
as many channels as was compiled in by default or later got specified
by scan options.
2017-06-23 19:33:24 +02:00
Uwe Hermann ecadb11845 dreamsourcelab-dslogic: Drop an assert(). 2017-06-21 18:02:50 +02:00
Uwe Hermann 4984ca28f7 dreamsourcelab-dslogic: Don't check for USB manufacturer/product.
Before firmware upload some models (e.g. the original DSLogic or the
DSLogic Pro) don't have any USB manufacturer or product strings set, so
they wouldn't be detected.
2017-06-21 18:02:50 +02:00
Uwe Hermann 7962b129c3 dreamsourcelab-dslogic: Drop an unneeded dslogic_ prefix. 2017-06-20 23:33:29 +02:00
Uwe Hermann 44b46d7036 dreamsourcelab-dslogic: Naming and other consistency fixes. 2017-06-20 23:33:29 +02:00
Joel Holdsworth f74485b608 dslogic: Recast samples into sigrok-compatible sample words 2017-06-20 00:18:16 +02:00
Joel Holdsworth 03a0002ed4 dslogic: Fixed buffer size calculation 2017-06-20 00:18:16 +02:00
Joel Holdsworth 6dfa2c39bf dslogic: Factored out enabled_channel_count, enabled_channel_mask 2017-06-20 00:18:16 +02:00
Joel Holdsworth 5e23d42f07 dslogic: Don't leak the trigger transfers array 2017-06-20 00:18:16 +02:00
Joel Holdsworth 5e7e327ac8 dslogic: Removed trigger_fired option 2017-06-20 00:18:16 +02:00
Joel Holdsworth 658caaf0d1 dslogic: Merged trigger_request into dslogic_acquisition_start 2017-06-20 00:18:16 +02:00
Joel Holdsworth 4bd770f56b dslogic: Moved all protocol handling to protocol.c
Previously the USB communication code was split between api.ci,
dslogic.c and protocol.c, with protocol internals split between
both. This patch puts all the protocol handling code into one
source file reducing the number of internal interfaces and making
the code more readable.
2017-06-20 00:18:16 +02:00
Joel Holdsworth b0acb693f9 fx2lafw: Moved all protocol handling to protocol.c
Previously the USB communication code was split between api.c
and protocol.c, with protocol internals split between both. This
patch puts all the protocol handling code into one source file
reducing the number of internal interfaces and making the code
more readable.
2017-06-20 00:18:16 +02:00
Joel Holdsworth 2f3cf5c21d dslogic: Fixed FPGA setting code 2017-06-20 00:18:16 +02:00
Joel Holdsworth 731fcfb456 dslogic: Declare memory depths 2017-06-20 00:18:16 +02:00
Joel Holdsworth 1ee7074616 dslogic: Fixed voltage selection 2017-06-20 00:18:16 +02:00
Joel Holdsworth 3c749da174 dslogic: Updated matching of device with loaded firmware 2017-06-20 00:18:16 +02:00
Joel Holdsworth 84f6d40a11 dslogic: Renamed D0-16 channels to 0-16 2017-06-20 00:18:16 +02:00
Joel Holdsworth 780c5e2466 dslogic: Added half and quater-mode flags 2017-06-20 00:18:16 +02:00
Joel Holdsworth 6c317a8d75 dslogic: Simplified supported_device table 2017-06-20 00:18:16 +02:00
Joel Holdsworth 3566348b92 dslogic: Refactored firmware selection into dslogic_fpga_firmware_upload 2017-06-20 00:18:16 +02:00
Joel Holdsworth adcb9951f8 fx2lafw/dslogic: Split DSLogic into a separate driver 2017-06-20 00:18:16 +02:00
Joel Holdsworth 69f7d9b4a9 usb.c: Moved in usb_match_manuf_product 2017-06-20 00:18:16 +02:00
Joel Holdsworth e40ee26b45 fx2lafw/dslogic: Updated dslogic_fpga_config structure to reflect v0.97 firmware 2017-06-20 00:18:16 +02:00
Joel Holdsworth cf398cc058 fx2lafw/dslogic: Imported FPGA config mode flags 2017-06-20 00:18:16 +02:00