Commit Graph

1476 Commits

Author SHA1 Message Date
Uwe Hermann 89ab9fc39c sr_config_commit(): Factor out SR_ERR_DEV_CLOSED check.
This ensures consistent checks and log messages across all drivers
and reduces the per-driver boilerplate.
2017-07-07 21:51:22 +02:00
Uwe Hermann c3cd66a00c sr_config_set(): Factor out SR_ERR_DEV_CLOSED check.
This ensures consistent checks and log messages across all drivers
and reduces the per-driver boilerplate.
2017-07-07 21:51:19 +02:00
Uwe Hermann f670835f1f Add sr_dev_acquisition_start(), factor out SR_ERR_DEV_CLOSED check.
This ensures consistent checks and log messages across all drivers
and reduces the per-driver boilerplate.
2017-07-07 21:51:16 +02:00
Uwe Hermann d2f7c417fd Add sr_dev_acquisition_stop(), factor out SR_ERR_DEV_CLOSED check.
This ensures consistent checks and log messages across all drivers
and reduces the per-driver boilerplate.
2017-07-07 21:51:10 +02:00
Soeren Apel 6ad2fbaad2 Introduce A2L methods
The memory allocation for sr_datafeed_logic is broken, the memory
will never be freed. #994 is used to handle this issue.
2017-07-06 00:16:24 +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 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
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
Joel Holdsworth cd189a44f8 fx2lafw/dslogic: Use const buffer instead of memset 2017-06-20 00:18:16 +02:00
Joel Holdsworth c2f35321b3 fx2lafw/dslogic: Fixed dslogic_set_vth package structure 2017-06-20 00:18:16 +02:00
Joel Holdsworth ac0facf4e0 fx2lafw/dslogic: Added register address #defines 2017-06-20 00:18:16 +02:00
Joel Holdsworth 9d71f81532 fx2lafw/dslogic: Updated bRequest #defines to reflect libsigrok4DSL 2017-06-20 00:18:16 +02:00
Joel Holdsworth 9082b5ccf7 fx2lafw: Call dslogic_get_number_of_transfers into fx2lafw_get_number_of_transfers 2017-06-20 00:18:16 +02:00
Joel Holdsworth c33f32a922 fx2lafw/dslogic: Added DSLogic Plus and Basic variants 2017-06-20 00:18:16 +02:00
Uwe Hermann f200d59ee2 Various Doxygen fixes. 2017-06-12 02:44:28 +02:00
Gerhard Sittig 2355d22919 input/csv: Eliminate remaining memory leaks in error paths
When the processing of columns of text lines detected errors, the loop
was aborted and the routine was left, but allocated resources were not
freed. Fix the remaining memory leaks in the error code paths.
2017-06-09 23:21:03 +02:00
Gerhard Sittig f027208ea7 input/csv: Fixup datafeed chunk size calculation
The constant at the top of the source file is the number of samples in a
datafeed submission chunk. The previous implementation erroneously made
it the size in bytes. There is no need to round down the buffer size
according to the unit size.
2017-06-09 23:21:03 +02:00
Gerhard Sittig d05b1a8606 output/csv: Nit, remove an unused loop iteration variable
The i variable is not used in the bottom loop in gen_header(). Remove it
to not obfuscate the purpose of the iteration.
2017-06-09 23:20:36 +02:00
Gerhard Sittig cd59e6eca1 input/csv: Send larger datafeed chunks, to speedup import
The previous implementation sent one sigrok session datafeed packet per
processed CSV line. This is rather inefficient for the CSV input module,
and triggers a dramatic performance loss in the srzip output format.

Communicate up to 128K samples within one datafeed packet. This fixes
bug #695.

Factor out repeated calculation of the unit size which is derived from
the channel count. Fix a minor memory leak in an error path while we are
here. (Other memory leaks in rare error paths remain with this commit.)

Suggested-By: Elias Oenal <sigrok@eliasoenal.com>
2017-06-08 23:26:47 +02:00
Gerhard Sittig de788af410 input/csv: Update developer comment (fix for last EOL marker) 2017-06-06 23:28:15 +02:00
Gerhard Sittig 7f4c3a6224 input/csv: Accept absence of last end-of-line termination sequence
On the Windows platform it appears to be popular to _not_ terminate the
very last line in a text file. Which results in an unmet constraint in
the CSV input module and an internal exception in PulseView which aborts
program execution.

Cope with the absence of the text line termination sequence at the very
end of the input stream. Keep all other checks in place, such that only
completely received text lines get processed.

This fixes bug #635.
2017-06-06 23:28:09 +02:00
Gerhard Sittig 4439363aa0 input/csv: Skip leading UTF-8 BOM in the input stream
This fixes bug #756.
2017-06-06 23:28:05 +02:00
Gerhard Sittig ccff468b5e input/csv: Add developer comment with TODO items
"Document" the current state of the implementation in the CSV input
module's source code. Discuss how text handling is non-trivial, which
approaches are available and how they have drawbacks.

Mention the lack of support for the import of analog data as well.
2017-06-06 23:28:05 +02:00
Gerhard Sittig 241c386a4f input/csv: Correctly skip over last processed end-of-line sequence
The CSV input module supports variable length end-of-line encodings
(either CRLF, or CR, or LF). When a bunch of accumulated text lines got
processed, do skip the corresponding number of characters after the end
of the last processed line.

This fixes one of the issues discussed in bug #635.
2017-06-06 23:28:00 +02:00
Gerhard Sittig 4555d3bda0 input/csv: Fix a false negative after successful import
The input module runs receive() and end() invocations which end up
calling process_buffer(). It's perfectly legal to call the process
routine with an empty accumulation buffer, especially when the process
routine was called from end().

This fixes a condition where PulseView raised a fatal error at the end
of a completed successful import.

Reported-By: Sergey Alirzaev <zl29ah@gmail.com>
2017-06-06 23:27:52 +02:00
Gerhard Sittig f9b7486154 input/csv: Re-order processing steps (column mode vs text line split)
Move an independent test for single/multi column operation out of a code
path that checked for and then processed text lines. This commit does
not change behaviour, but prepares a subsequent commit.
2017-06-06 19:00:14 +02:00
Gerhard Sittig 492dfa9025 input/csv: Concentrate text line encoding in a single spot
Factor out a magic string literal which held a delimiter set yet could
be mistaken for an (assumed) fixed termination string. Concentrate the
determination of the end-of-line text encoding as well as the resulting
set of possible deliminters in one nearby location. The symbolic name
for the delimiter set eliminates the doubt on its purpose.
2017-06-06 19:00:14 +02:00
Gerhard Sittig df0db9fdda input/csv: Improve readability (bool expr vs assign, nested arrays)
Move variable assignments out of boolean condition checks. Factor out
repeated access to nested arrays. This shall improve readability.
2017-06-06 19:00:14 +02:00
Uwe Hermann 176d785d33 Drop trailing whitespace in various files. 2017-06-06 14:10:02 +02:00
Uwe Hermann faf6dc4633 Minor cosmetics. 2017-06-06 12:17:44 +02:00
Soeren Apel 77463bd397 Demo: Convert white spaces to dashes for walking one/zero pattern 2017-05-28 14:19:22 +02:00
Soeren Apel 845060fa9d Demo: Add walking one/walking zero pattern 2017-05-27 19:39:54 +02:00
Gerhard Sittig eac48b3491 asix-sigma: Silence a compiler warning (declared but not used)
The call site which referenced the variable was conditional (disabled
trigger support) but the variable declaration was not. Fix that.
2017-05-26 22:48:40 +02:00
Gerhard Sittig 2f425a56ed asix-sigma: Use monotonic time not wallclock time
Switch from gettimeofday() to g_get_monotonic_time() calls.

This commit is based on work done by jry@ (but with reduced diff size).
2017-05-26 22:48:39 +02:00
Gerhard Sittig 74d453abfd asix-sigma: Handle sample memory wrap around (circular buffer)
Handle the case when the sample data memory was filled and has wrapped
around during acquisition. Download the respective part of the data
which is reliably available, only skipping a single 1KB row which might
contain either old or new data while it's not certain which it would be.

This will be essential when triggers later become available. Right now
it copes with user requests for sample counts that exceed the total DRAM
capacity. Instead the maximum available amount of data is provided.

Of course acquisition no longer gets stopped when the end of DRAM is
reached.
2017-05-26 22:48:39 +02:00
Gerhard Sittig 547c4cdc60 asix-sigma: Fixup the download of the last data acquisition chunk
Correctly determine the size of a download chunk for the last DRAM row
that's involved in the recent data acquisition.

This commit is based on work done by jry@.

This addresses bug #838 (trailing garbage).

It's assumed that the previously downloaded excess data was "swallowed"
by the sample count enforcement logic that was applied earlier, so the
(remainder of the) issue could have gone unnoticed, unless some other
termination condition than sample count was used.
2017-05-26 22:48:36 +02:00
Gerhard Sittig 468f17f2d6 asix-sigma: Comment on RLE decompression upon data retrieval
Rephrase and shorten a comment on how RLE decompression works. Drop the
part of the comment which is not related to (de-)compression.
2017-05-26 22:48:35 +02:00
Gerhard Sittig 13262b48c1 asix-sigma: Remove an unused variable 2017-05-26 22:48:33 +02:00
Gerhard Sittig 8256ed15c6 asix-sigma: Adjust clock configuration upon acquisition start
Configure the samplerate clock and channel count during acquisition
start in identical ways for 50MHz, 100MHz, and 200MHz modes.

This part was inspired by work done by jry@ yet was addressed in
different ways (no exception, do everything in every mode the same way).

Eliminate a portability issue in the previous implementation. Make sure
to send the configuration bytes in the correct order to the hardware.
Don't typecase a struct reference to a bytepointer and hope that the
internal memory representation might fit the external hardware's idea.
2017-05-26 22:48:32 +02:00
Gerhard Sittig 5b1d15efb9 asix-sigma: Document the sample memory layout
Add a comment about sample memory organization in a central spot. This
concentrates knowledge which otherwise would be spread across several
locations all over the driver's codebase, yet is essential to have at
hand during maintenance.

All of the information was determined/updated by jry@ with the help of
Ondrej at Asix when he did lots of fixes and improvements to asix-sigma.
2017-05-26 22:48:30 +02:00
Gerhard Sittig 735ed8a18e asix-sigma: Enforce optionally specified sample count
The Asix Sigma hardware does not support a sample count limit. Instead
this optional input parameter gets mapped to a sample time, and some
slack for hardware pipelines and compression gets added. When data
acquisition completes and sample data gets downloaded, chances are that
there is more data than requested by the user.

Do enforce the optional sample count limit. Stop sending data to the
sigrok session when the configured number of samples was sent.

This commit is based on work done by jry@.

This fixes bug #838.
2017-05-26 22:48:27 +02:00
Gerhard Sittig 22f64ed88c asix-sigma: Acquisition stop, symbolic identifiers for mode register fields
Enhance how the data acquisition is stopped. Wait for the hardware to
flag the successful completion of data retrieval as well as flushing
through hardware pipelines.

Use symbolic identifiers for the mode register's fields (for read as
well as write access).

This commit uses part of a code update to better match the documentation
done by jry@, but not all of it to reduce the size of the commit.
2017-05-26 22:48:24 +02:00
Gerhard Sittig f06fb3e9f1 asix-sigma: Nit, separate declaration from assignment statements
Minor adjustment for improved readability. Don't hide assignments in
variable declarations. Move initialization of some variables closer to
related evaluation or subsequent processing. Break a complicated looking
roundup expression into several short steps.
2017-05-26 22:48:22 +02:00
Gerhard Sittig 84a6ed1a12 asix-sigma: Fix a register addressing bug (non-issue)
Fix how the READ_ID register index was passed to the hardware access.
Addresses are sent in nibbles, so shift by eight is wrong here. No harm
was done, as the register's index is zero.
2017-05-26 22:48:21 +02:00
Gerhard Sittig a9016883f8 asix-sigma: Only download firmware when necessary
The Asix Sigma driver is aware of three firmware images, which are
required for acquisition with up to 50MHz, 100MHz, and 200MHz. The
previous implementation always downloaded the corresponding firmware
image whenever the sample rate has changed, which was redundant.

Skip the download when the new samplerate uses the same firmware as the
previously selected samplerate did. This results in faster responses in
the GUI when the samplerate selection changes.

Move assignments out of the variable declaration block for improved
readability while we are here.
2017-05-26 22:48:18 +02:00
Gerhard Sittig 85c032e485 asix-sigma: Properly decode data gathered at 100 and 200 MHz
The hardware provides captured data at a maximum rate of 16bits per 20ns
(50 MHz). For samplerates of 100 and 200 MHz one individual 16bit entity
contains multiple samples for a reduced number of channels. The bits of
several sample points are interleaved within the 16bit entity.

This commit is based on work done by jry@ who fixed a lot of issues with
the help from Ondrej at Asix.

This fixes bug #840.
2017-05-26 22:48:13 +02:00
Gerhard Sittig 3281cf59aa asix-sigma: Stabilize channel assignment for different samplerates
Adjust the interpretation of acquired sample data such that regardless
of 50/100/200MHz samplerate the assignment of LA pins to sigrok channels
remains stable.
2017-05-26 22:48:11 +02:00
Gerhard Sittig 0498f7439f asix-sigma: Factor out access to sample data and session data
Introduce helper routines to access the sample data that is provided by
the ASIX hardware, as well as the buffer which accumulates logic data
before it gets sent to the session's datafeed.

This hides endianess issues from call sites, and prepares access to
memory layout which varies with sample frequencies.

This commit is based on work done by jry@.
2017-05-26 22:48:08 +02:00
Gerhard Sittig de3f7acb4d asix-sigma: Disable support for triggers, they don't work right now
This works around bug #359. Triggers currently are not operational for
Asix Sigma. Don't claim support in the driver so that UIs won't use the
feature. Yet allow research in this issue, by concentrating the switch
for the feature's support in a central location.

Add/update a comment and unobfuscate an error code path while we are here.
2017-05-26 22:48:02 +02:00
Gerhard Sittig e686119cc2 asix-sigma: Nit, remove redundant USB VID/PID declaration
Both the .c and the .h file declared the same identifiers for USB
properties of ASIX hardware with identical values. Remove the .c
incarnation and keep the .h content, as the names are used in api.c
as well as protocol.c sources.
2017-05-26 22:48:01 +02:00
Gerhard Sittig 9a0a606a82 asix-sigma: Improve sample time estimation, consider hardware pipeline
Introduce a separate routine which maps sample counts and sample period
to an elapsed sample time after which acquisition shall get stopped.
Add some more time to make sure the most recent captured data has passed
the hardware pipeline and is available for download.

This commit is based on work done by jry@.
2017-05-26 22:47:59 +02:00
Gerhard Sittig a44b3b3f16 asix-sigma: Fixed RLE decoder
When "tsdiff < EVENTS_PER_CLUSTER" we don't want "tsdiff - EVENTS_PER_CLUSTER"
(a negative number) to be treated as (int).

Submitted-By: jry <jrysig@gmail.com>
[ gsi: massaged for mainline submission ]
2017-05-26 22:47:45 +02:00
Uwe Hermann 42be2adb5a Add APIs to query libsigrok build information. 2017-05-26 18:00:58 +02:00
Uwe Hermann 9d12555fba serial-dmm: Use a custom dummy struct for m2110.
This DMM/parser is not related to metex14, don't use that struct.
2017-05-24 19:04:17 +02:00
Uwe Hermann decc199654 uni-t-dmm: Fix incorrect Tenma 72-7745 list entry.
This is a regression from f05406117d.
2017-05-24 01:34:06 +02:00
Uwe Hermann 06f0872ea9 uni-t-dmm: Add missing special cases for some ES519xx protocols. 2017-05-24 01:29:28 +02:00
Angus Gratton 8a68f96eae fx2lafw: Always enable wide sampling for dslogic firmware
Fixes regression in 8399f68a3.

Ref: https://sourceforge.net/p/sigrok/mailman/message/35780588/

Signed-off-by: Angus Gratton <gus@projectgus.com>
2017-05-23 20:00:57 +02:00
Uwe Hermann 45fcaf2cca ut71x: Fix incorrect resistance values on some DMMs.
The resistance values of some DMMs were incorrectly reported due to a
missing factor of 10 in the calculations.

Tested on Voltcraft VC-920/VC-940 and Tenma 72-9380A/72-7730/72-7732.
2017-05-23 19:38:19 +02:00