Commit Graph

1613 Commits

Author SHA1 Message Date
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
Uwe Hermann 7db9027985 demo: Retain the default of 8 digital channels for now. 2017-05-21 18:35:21 +02:00
Gerhard Sittig b1e6eec6f5 demo: support up to 128 logic channels, enable the lower 8 by default
Bump the number of supported logic channels from 8 to 128. This is
mostly motivated to test the 64 channels limit which some of the
components/subprojects of the sigrok project might have (input/output
modules, user interfaces).

Only automatically enable the first 8 of the 128 total logic channels,
i.e. default to the previous behaviour. Prepare to only enable part of
the set of analog channels, but stick with their being active by default
as well.

Factor out the choice for the default logic pattern, too. This allows
for easier adjustment of the default configuration, when settings are
concentrated in a single spot.
2017-05-21 18:35:01 +02:00
Gerhard Sittig 81d53a29d6 demo: add "cable squid" logic waveform (works-with logo, many channels)
Extend the demo driver, add another waveform choice for logic channels.
Create a "cable squid" logo representation which occupies a large number
of channels.

This pattern occupies 128x128 pixels. Unlike the 'sigrok' pattern it
gets repeated when more channels are involved, but is not shifted in the
repetition.
2017-05-21 18:35:01 +02:00
Uwe Hermann 2b17aeb874 ut71x: Fix float printing issue in a debug message.
Old:
ut71x: Applying exponent -12, new value is 0.000000.
P1: 1.500 nF AUTO
P1: 1.500 nF AUTO

New:
ut71x: Applying exponent -12, new value is 1.5e-09.
P1: 1.500 nF AUTO
P1: 1.500 nF AUTO

This fixes bug #700.
2017-05-21 18:17:58 +02:00
Soeren Apel 16a1d50a63 Virtual session: Workaround for SR_CONF_CAPTUREFILE (#944)
This is a (hopefully temporary) workaround for the
SR_CONF_CAPTUREFILE mechanism. The value for
vdev->capturefile is set by this, however only once
via stream_session_data().
During stream processing in stream_session_data(),
capturefile may receive new values - e.g. when there
are multiple logic files or if there is analog data.
With that, the initially set capturefile is overwritten.

When re-loading the file, we are then running into
issues because we don't know what the initial value was.
As all .sr files use "logic-1" by default and, we
simulate the behavior of stream_session_data() and
assign this name to capturefile if there are logic
channels present.

With this change, all three kinds of files reload
as expected: logic only, analog only and mixed signal.
For this reason, it's a short-term fix for #944.
2017-05-21 17:10:38 +02:00
Soeren Apel 6fb5570b15 Virtual session: rename num_channels to num_logic_channels 2017-05-21 17:10:16 +02:00
Uwe Hermann 64f628bf8a hantek-6xxx: Only list DC coupling once.
Avoid incorrect indexing and the follow-up segfault.

This fixes bug #822.
2017-05-17 01:46:50 +02:00
Martin Ling 01dd7a4cc7 rigol-ds: Handle digital channels correctly for MSO2000A series.
The handling of the digital channels for this series is somewhere
between that of the DS1000D series (PROTOCOL_V2) and the MSO1000Z
(PROTOCOL_V4).

The :LA command set is similar to that of V4, but the LA data has to be
requested with :WAV:SOUR:LA and arrives in interleaved form like V2.

None of these changes should affect other models. They only affect the
case of PROTOCOL_V3 with digital channels, which occurs only for the
MSO2000A series.
2017-05-17 00:20:29 +01:00
Uwe Hermann 364b09c2a9 hantek-6xxx: Fix coupling selection.
Due to an uninitialized variable, switching to/from AC/DC coupling
(on models that support this) was not working.

This fixes bug #836.
2017-05-16 22:23:24 +02:00
Martin Ling 09f24ef2a9 rigol-ds: Add model entries for MSO2000A series.
This should be sufficient to fully support these models, unless there
are protocol differences for the digital channels.

This fixes bug #778.
2017-05-15 17:42:03 +02:00
Wolfram Sang 10892c5b8a output/csv: get proper index for input channels
'j' is the loop variable for channels, not 'ch'.

This fixes parts of bug #844.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2017-05-13 22:34:17 +02:00
Wolfram Sang 7e7d7bc074 output/csv: fix a minor leak
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2017-05-13 22:34:16 +02:00
Wolfram Sang d3cc09a612 output/csv: fix segfault with logic channels
'i' was iterating in steps of unitsize. However, the destination array
was also indexed with it, but it is of u8 type. Let 'i' run bytewise and
only multiply with unitsize when we need it.

This fixes parts of bug #844.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2017-05-13 22:34:13 +02:00
Wolfram Sang 6a235225b3 output/csv: fix segfault when naming logic channels
'j' is the loop variable for channels, not 'i'.

This fixes parts of bug #844.

Reported-by: Maxim Sloyko <m.sloyko@gmail.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2017-05-13 22:33:54 +02:00
Uwe Hermann 8005151b87 output/csv: Fix a compiler warning.
src/output/csv.c: In function 'dump_saved_values':
src/output/csv.c:461:6: warning: format '%lu' expects argument of
type 'long unsigned int', but argument 3 has type 'uint64_t' [-Wformat=]
      ctx->sample_time, ctx->value);
      ^
2017-05-10 15:36:33 +02:00
Martin Ling ef7fb1abff rigol-ds: Send *OPC? after commands that don't return a value.
Fixes #933.

We'd already had this problem elsewhere and thus have this wrapper function
that does this where necessary. It just wasn't in use on these two call sites,
which was causing timing problems when used over tcp-raw or VXI transports.
2017-05-10 00:33:58 +01:00
Johannes Römer bf8a02b633 hameg-hmo: Add support for Hameg HMO3524 2017-05-09 12:29:15 +02:00
Gerhard Sittig adee480c02 output/vcd: minor nit, remove unused variable 2017-05-05 18:25:15 +02:00
Soeren Apel b7939d7cac De-init vdev->capturefile when done
Without doing this, re-reading the input file
results in a segfault as the internal state
machine becomes confused.
2017-05-04 18:40:39 +02:00
Gwenhael Goavec-Merou b853eb76fb openbench-logic-sniffer: fix acquisition restart with trigger enabled
With trigger enabled, and with PulseView, a second (or more) acquisition
starts immediately instead of blocking. It's mandatory to try several times
to have a correct behavior.

According to http://mygizmos.org/ols/Logic-Sniffer-FPGA-Spec.pdf section 2.3.1
p.8, the Openbench Logic Sniffer must be reset before each arm command.

This fixes bug #809.

Signed-off-by: Gwenhael Goavec-Merou <gwenhael.goavec-merou@trabucayre.com>
2017-05-02 22:06:58 +02:00
Gwenhael Goavec-Merou 244995a2e3 openbench-logic-sniffer: add a function to handle reset command
Openbench Logic Sniffer reset is a little more complex than a simple send.
To avoid code duplication, this patch adds a new function dedicated to
this task.

Signed-off-by: Gwenhael Goavec-Merou <gwenhael.goavec-merou@trabucayre.com>
2017-05-02 22:06:51 +02:00
Marc Schink 81eb36d640 scpi-pps: Add initial support for R&S HMC8043 2017-03-31 11:55:22 +02:00
Bert Vermeulen 40bbf635fa uni-t-ut32x: Accept SR_CONF_CONN, fixing scan. 2017-03-21 20:45:46 +01:00
Uwe Hermann df3e608a20 session_driver.c: Increase chunk size for slightly better performance.
Increasing the chunk size from 512ksamples to 4Msamples leads to
slightly faster session file loading from sigrok session (*.sr) files
in frontends, while not looking too "chunky".

The performance increase is not really massive, but still noticeable.
A further increase to, say, 10 or 100Msamples shows no further
noticeable improvements.
2017-03-16 23:59:58 +01:00
Uwe Hermann f9592d65e9 fx2lafw: Only sample/send analog data if analog channels are enabled. 2017-03-15 03:30:11 +01:00
Uwe Hermann 5db45cc55d fx2lafw: Drop unused devc->ch_enabled. 2017-03-15 01:45:27 +01:00
Jan Losinski 8399f68a3f fx2lafw: Use wide_sampling only if necessary.
This changes the fx2lafw code to only enable the wide_sampling (16bit)
method, if at least one of the higher eight channels is enabled. This
has the benefit, that we can use higher samplerates on 16bit LA
devices if we use only the first eight channels.

The wide sampling is also enabled if we have one or more analog
channels.

Signed-off-by: Jan Losinski <losinski@wh2.tu-dresden.de>
2017-03-15 00:26:49 +01:00
Sven Schnelle b6be55ce95 SCPI: add sr_scpi_write_data()
Can be used to send raw data on a SCPI connection.

Signed-off-by: Sven Schnelle <svens@stackframe.org>
2017-03-11 13:47:39 +01:00
Uwe Hermann 9a512113ca Fix obsolete code comments.
"Probe groups" are called "channel groups" now.
2017-03-10 11:41:34 +01:00
Uwe Hermann 815685462f sr_scpi_free(): Allow NULL as argument. 2017-03-10 11:41:34 +01:00
Uwe Hermann 7b365c4719 sr_scpi_hw_info_free(): Allow NULL as argument. 2017-03-10 11:41:34 +01:00
Uwe Hermann ce375f2a39 sr_usbtmc_dev_inst_free(): Allow NULL as argument. 2017-03-10 11:41:34 +01:00
Uwe Hermann 5801ce7840 sr_usb_dev_inst_new(): Allow NULL as argument.
(documentation fix, the function always handled NULL fine)
2017-03-10 11:41:34 +01:00
Uwe Hermann 04891a997c sr_serial_dev_inst_free(): Allow NULL as argument. 2017-03-10 11:41:34 +01:00
Uwe Hermann 4bf9398802 sr_dev_inst_free(): Allow NULL as argument. 2017-03-10 11:38:12 +01:00
Uwe Hermann 8662130615 scope drivers: More consistent config key ordering. 2017-03-08 01:10:40 +01:00
Soeren Apel d73aacf12a rigol-ds: Fix capabilities listing in config_list() 2017-03-08 01:10:40 +01:00
Soeren Apel 90230cfa7f lecroy-xstream: Fix capabilities listing in config_list()
This fixes bug #913.
2017-03-08 01:10:39 +01:00
Uwe Hermann 9a17c23bc9 Fix sr_period_string() Doxygen comments. 2017-03-08 01:10:39 +01:00
Soeren Apel 6984cfb245 Rework sr_period_string 2017-03-07 17:13:46 +01:00
Matthieu Guillaumin ae87e02fad pce-322a: Adding support for reading memory from PCE-322A SPL 2017-03-07 14:09:46 +01:00
Uwe Hermann 6d13a46ce0 lecroy-xstream: Drop some unneeded "lecroy_" prefixes.
For the time being this driver only handles LeCroy devices, so those
prefixes are not needed.
2017-03-02 21:22:10 +01:00
Uwe Hermann b295fa5190 lecroy-xstream: Drop prototypes for non-existing functions. 2017-03-02 21:22:10 +01:00
Uwe Hermann ea257cdc23 lecroy-xstream: Minor whitespace and consistency fixes. 2017-03-02 21:22:10 +01:00
Soeren Apel 9de47e9e71 lecroy-xstream: Use sr_period_string() 2017-03-02 21:22:10 +01:00
Soeren Apel 7002e64a54 lecroy-xstream: Fix compiler warnings 2017-03-02 21:22:10 +01:00
Soeren Apel d0b913eac4 lecroy-xstream: Don't send custom SCPI command to the probed device 2017-03-02 21:22:00 +01:00
Soeren Apel bb08570f1a lecroy-xstream: Change human-readable name 2017-03-02 15:49:49 +01:00
Sven Schnelle 3f2c7c94a1 lecroy-xstream: Add the actual driver implementation
Signed-off-by: Sven Schnelle <svens@stackframe.org>
2017-03-02 15:39:44 +01:00
Sven Schnelle e3b83c5ec3 lecroy-xstream: Initial driver skeleton.
Signed-off-by: Sven Schnelle <svens@stackframe.org>
2017-03-02 15:39:44 +01:00
Uwe Hermann 0d9841ddd6 rohde-schwarz-sme-0x: Add support for SR_CONF_SIGNAL_GENERATOR. 2017-03-02 15:18:02 +01:00
Uwe Hermann 6928c4a928 Add SR_CONF_SIGNAL_GENERATOR. 2017-03-02 15:17:53 +01:00
Uwe Hermann d7056eead2 rohde-schwarz-sme-0x: Drop prototypes for non-existing functions. 2017-03-02 14:56:46 +01:00
Uwe Hermann ed1fae0bb3 rohde-schwarz-sme-0x: Minor whitespace and consistency fixes. 2017-03-02 14:56:46 +01:00
Soeren Apel 9e50659470 rohde-schwarz-sme-0x: Coding style fixes 2017-02-26 21:02:03 +01:00
Vlad Ivanov a28b3df111 rohde-schwarz-sme-0x: Initial device support
Signed-off-by: Vlad Ivanov <vlad.ivanov@lab-systems.ru>
2017-02-26 21:02:03 +01:00
Uwe Hermann 97c2710b2c hwdriver: Drop unneeded debug message.
The logs already show scan attempts per-driver, no need to also log the
init per-driver, since that's always happening and cannot (normally) fail.
2017-02-26 15:43:35 +01:00
Sven Schnelle 6ca578feb8 Fix analog output display
I've seen the following output from sigrok-cli:

CH1: 478.720 mV
CH1: -514 mV
CH1: -0 V

I added some debug, and it seems like the digits value isn't reset
to the actual value after calling sr_analog_si_prefix_friendly():

using 6 digits
value2 0.478720 digits 6
value2 -0.513536 digits 3
value2 -0.487424 digits 0

This commit fixes this by resetting the value to the actual value before.

Signed-off-by: Sven Schnelle <svens@stackframe.org>
2017-02-15 08:57:04 +01:00
Sven Schnelle 471ac344a5 Fix initial sample value for demo driver
devc->step is not reset on acquistion start, so acquisition
starts with a different value every time. Thats annoying when
using the demo driver to debug sigrok, so lets make sure that
it's reset to 0.

Signed-off-by: Sven Schnelle <svens@stackframe.org>
2017-02-14 23:32:45 +01:00
Sebastian Tabares Amaya 759f2ef762 Add support for Hantek 6022BL 2017-01-27 01:12:14 +01:00
Aurelien Jacobs 0ceb70381b agilent-dmm: Add support for U124xC. 2017-01-22 19:03:29 +01:00
Aurelien Jacobs 1af3f40eec agilent_dmm: Split generic part of recv_log_u128x() to recv_log(). 2017-01-22 19:03:29 +01:00
Aurelien Jacobs 29bdeeb549 agilent-dmm: Add support for Vsense (Non-Contact Voltage). 2017-01-22 19:03:29 +01:00
Aurelien Jacobs c2e3c322e6 agilent-dmm: Fix handling of the 2nd channel of 2 channels models.
The 2nd channel of those models is not limited to temperature,
so it is necessary to query CONF? @2.
2017-01-22 19:03:29 +01:00
Aurelien Jacobs 4fdedbbb3a agilent-dmm: Set correct length in strncmp(). 2017-01-22 19:03:29 +01:00
Aurelien Jacobs 841aadc95b libsigrok.h: Add SR_MQ_HARMONIC_RATIO. 2017-01-22 19:03:29 +01:00
Uwe Hermann 35bb2fcef9 scpi_serial: Convert 'got_newline' variable to gboolean. 2017-01-21 15:17:35 +01:00
Stefan Brüns d64be25be4 scpi: Do not block when reading header of definite length blocks
When using SCPI over serial (over USB), we want the header without waiting
for the terminating newline, as otherwise the transfer may time out.
sr_scpi_get_data() will block until the message is complete.
2017-01-21 15:08:21 +01:00
Stefan Brüns 9ea4018f2f scpi_serial: Get rid of intermediate buffer, do not strip newline
Lowlevel access functions should not alter the data. sr_scpi_get_string(),
which is called by most highlevel access functions, strips newlines
in a central place, and is only fed with data which contains newlines
as a final terminator.
IEEE 488.2 definite length blocks may contain arbitrary data, thus the
payload up to the provided length should be passed unaltered.

Track if the last received character is a newline, which can be used
by sr_scpi_get_string() and its callers to determine if the response
is complete.
2017-01-21 15:08:21 +01:00
Stefan Brüns 37ef582d08 scpi: Query current time just once, use microseconds for timeout
g_get_monotonic_time() returns current time in microseconds, use the same
granularity for storing the read timeout.
There is also no need to check the timeout if data has just been read.
2017-01-21 15:08:21 +01:00
Stefan Brüns 59b9c3290a yokogawa-dlm: Mostly fix dumping of current timebase
sr_period_string takes the frequency as its argument, i.e. the reciprocal
of the timebase. Obviously this will not work for frequencies less than
1Hz / timebases greater than 1 second, but at least is correct for all
other available timebases.
2017-01-21 15:08:21 +01:00
Stefan Brüns d8b65ef661 hameg_hmo: Mostly fix dumping of current timebase
sr_period_string takes the frequency as its argument, i.e. the reciprocal
of the timebase. Obviously this will not work for frequencies less than
1Hz / timebases greater than 1 second, but at least is correct for all
other available timebases.
2017-01-21 15:08:21 +01:00
Stefan Brüns a547531bf1 strutil: Fix sr_period_string output
The output was wrong for all frequencies but 1 Hz, 1 kHz, 1 MHz and 1 GHz.
With this changes, the output may still be off due to rounding, but will
be correct as to the shown accuracy.
2017-01-20 19:48:39 +01:00
Gerhard Sittig 900846816f scpi: Don't process received data of zero length
When nothing was received in a read attempt, we need not adjust the
buffered data's read position nor the glib string object's size. Skip
any processing for empty input, just keep checking for timeouts.
2017-01-20 18:53:43 +01:00
Gerhard Sittig ad21865fa7 scpi: Rephrase buffer resize for free space during SCPI read, add comments
Routine sr_scpi_get_data() checks for free space in the receive buffer,
and resizes the buffer when free space drops below a threshold. The
previous logic assumed that the resize and the read logic would interact
in some specific way to achieve the desired operation.

Adjust the buffer resize such that more free space is pre-allocated, yet
the payload size of the buffer is not affected. This eliminates the
dependency of the optional resize logic from subsequent activity for
reception of data that is non-optional.

Add comments while we are here, outline the steps taken in the
sr_scpi_get_data() routine.
2017-01-20 18:53:43 +01:00
Gerhard Sittig 4889acefb2 hameg-hmo: Rephrase the channel constraints check (analog vs digital)
Phrase the logic which checks the use of analog channels and digital
pods in more generic terms. Place a comment about the contraints' being
potentially dependent on the specific HMO model. This implementation
should lend itself better to future adjustment (HMO1002?).
2017-01-20 18:53:43 +01:00
Gerhard Sittig e06875b2ce hameg-hmo: Map logic data from second digital pod to channels D8-D15
An internal libsigrok implementation detail prevents partial submission
of logic data for different channel groups in multiple calls. Instead
one logic packet needs to be sent in a single call, which combines data
for all channels.

Introduce a logic data storage which folds samples from several channel
groups that were received at different points in time into a combined
memory layout of larger unitsize. Stick with the former shortcut of
passing on the input bytes directly when only the first digital pod is
used during acquisition.

This change correctly maps data from the second pod to channels D8-D15.
2017-01-20 18:53:43 +01:00
Gerhard Sittig 1b0f62df22 hameg-hmo: Do read from second digital pod during acquisition
The previous implementation only added one of the digital channels to
the list of enabled channels that are involved in the acquisition (the
first one that was found). This means that when the set of used digital
channels spans more than one pod/group, the second pod will never be
read from.

Make sure to enable one digital channel per pod/group, such that
acquisition will retrieve data from all involved input sources.

Add comments while we are here. Mention how the different setup, check,
start, and receive routines which are spread across several files do
interact to achieve acquisition.
2017-01-07 21:36:53 +01:00
Gerhard Sittig b23eb1d4d1 hameg-hmo: Send exactly one sigrok frame per scope frame
The previous implementation used to put FRAME_BEGIN and FRAME_END
markers around each received chunk of samples, while those chunks
correspond to a single channel (analog) or a group of eight channels
(digital) each. In other words, the hameg-hmo driver had provided a
multiple of the requested frames, and those frames were incomplete.

Make sure to only send FRAME_BEGIN before the first channel's data,
and FRAME_END after the last channel's data of a frame. Thus make
sigrok frames exactly match the scope's frames.

Add some comments on the frame marker and the acquisition stop logic
while we are here.
2017-01-07 21:36:53 +01:00
Gerhard Sittig 65a6794ea1 hameg-hmo: Use the host's endianess to read analog channel data via SCPI
Configure the scope to the host's native endianess before downloading
acquisition data from analog channels. This unbreaks operation on those
models which default to a representation which differs from the host.
2017-01-07 21:36:53 +01:00
Gerhard Sittig d1ad8b10bc Revert "hameg-hmo: Support BE format for SCPI sample downloads"
Undo the change which queries the scope's endianess and has the floats
converted after reception. An alternative implementation will perform
better.
2017-01-07 21:36:52 +01:00
Gerhard Sittig d5a61aaf2d Revert "scpi: Don't process received data of zero length"
Undo the change which skips management activities when no data was
received. This change breaks the current implementation, and needs to
get deferred until a delicate interaction between the resize and the
read logic has been eliminated.
2017-01-07 21:36:52 +01:00
Gerhard Sittig 2ea1fdf121 license: remove FSF postal address from boiler plate license text
Remove the FSF postal address as it might change (it did in the past).
Reference the gnu.org website instead which is more stable.
2017-01-07 16:05:39 +01:00
Gerhard Sittig 661aa24aa6 asyc-ii: Rephrase "exponent" logic when parsing packets
Replace a C library strcspn(3) call with the more portable glib
g_strstr_len(3) routine. This is possible since a single separator
is searched for, no actual "set of characters" is involved.

As a byproduct, this eliminates a "late" reference to 'cnt' at the
bottom of the routine, after the value was assigned in a rather distant
location at the top of the routine. The cost of strlen() should be
acceptable for a buffer with a single digit total length.
2017-01-07 15:51:47 +01:00
Gerhard Sittig 43528280d9 asyc-ii: Prefer more portable and common string routines
Replace C language string operations with their glib incarnations for
improved portability. Prefer a common sigrok float conversion routine
over a DIY implementation.
2017-01-07 15:51:47 +01:00
Gerhard Sittig c2debda60d asyc-ii: Unobfuscate a comment on packet parse constraints
The specific packet layout puts constraints on the parse logic (case
sensitive comparison, order of comparison). Fix a comment that made no
sense before, and better reflect that there are two constraints.
2017-01-07 15:51:47 +01:00
Gerhard Sittig 26e8c6a2b2 scpi: Rephrase length logic in data block reception, comment/group code
Slightly rephrase the SCPI code which parses the responses that carry
(binary) data blocks. Be explicit about NUL termination when parsing the
leading length spec in the response, obsoleting the array initializer.
Add lots of comments and group source code lines to better reflect
what's happening from the protocol's perspective.

Fix the returned error code in the path which reads responses of
excessive length in chunks. The previous implementation detected errors
but always returned code 0 (success).
2017-01-07 15:51:47 +01:00
Gerhard Sittig 904401e8fe scpi: Don't process received data of zero length
When nothing was received in a read attempt, we need not adjust the
buffered data's read position nor the glib string object's size. Skip
any processing for empty input, just keep checking for timeouts.
2017-01-07 15:51:47 +01:00
Gerhard Sittig d3de86f3ca scpi: Minor style nits
Drop an initial assignment to a variable which never takes effect.
Add braces around the body of a more complex if block. Separate routines
from each other by exactly one empty line.
2017-01-07 15:51:47 +01:00
Gerhard Sittig d431e4ec28 hameg-hmo: Support BE format for SCPI sample downloads
When the channel state is retrieved, query the pre-set byteorder for
SCPI data blocks as well. When samples get retrieved during capture,
support float representations in either big or little endian format.

This commit unbreaks devices which operate in BE format by default
(tested with HMO2524). It keeps working with LE format as before. For
devices which don't support the byteorder query or return unknown
responses, LE format is assumed for backwards compatibility. The
device's byteorder is only queried and never set. This makes the
commit least intrusive.
2017-01-07 15:51:46 +01:00
Gerhard Sittig 74413fafb4 hameg-hmo: Declare support for 2 pods / 16 channels on HMO2524 and above
A comment mentioned that the models HMO2524 and above support 16 digital
channels (and thus have two pods for the probes). Move those models to a
section that declares the respective features, including trigger support
on the upper digital channels.

Model detection and reflection of supported channels was tested on HMO2524.
2017-01-07 15:51:46 +01:00
Gerhard Sittig 40a75c8e97 hameg-hmo: Release enabled channels when acquisition start fails
Commit db81fbb582 made sure to release a potentially previously
allocated list of enabled channels before (re-)building the list in the
current invocation of acquisition start.

This commit frees the memory in the error path near the failed creation
already, which reduces the period of time where unused resources are
held, and eliminates a memory leak when acquisition is not stopped after
failed start.

Both approaches can coexist. Freeing an empty list is perfectly fine.
2017-01-07 15:51:32 +01:00
Gerhard Sittig 2d224dbae7 hameg-hmo: Fix index access for models with 2 pods / 16 digital channels
Fix the code which registers the name of the second pod for digital
probes. The previous implementation registered the first pod twice, and
lost the reference to the second pod. No harm was done, none of the
supported models declared support for two pods so far.

Factor out a channel to group mapping in the registration of digital
channels, while we are here.
2017-01-07 15:46:52 +01:00
Gerhard Sittig 503220ec8d deree-de5000: rename to serial-lcr, update configure logic
The former DER EE DE-5000 driver was a very thin wrapper around the
ES51919 LCR meter chipset. None of its source was specific to the
deree-de5000 device. In fact it contained code for all currently
supported LCR meters, and it's expected that all LCR meters which
will get added in the future will fit in as well.

Follow the serial-dmm model. Rename the src/hardware/deree-de5000/
directory to serial-lcr/. Update the configure logic. Although the
source directory and the configure option are named serial-lcr, the
LCR meter still is used by specifying the "deree-de5000" device driver
(which just happens to reside in the serial-lcr driver sources, among
others).
2016-12-26 13:12:35 +01:00
Gerhard Sittig dc5895cbdd serial-dmm: add DMM entry for Metrix MX56C (ASYC-II based) 2016-12-20 17:51:36 +01:00
Gerhard Sittig 4ba4d52a8f dmm: introduce support for ASYC-II 16-byte protocol in PRINT mode
Introduce an asycii.c source file (modelled after metex14.c) which
implements support for the 16-byte protocol of the ASYC-II multimeter
chipset (RX only, when the PRINT button was pressed).
2016-12-20 17:51:36 +01:00
Uwe Hermann 6c62c605f9 Consistently use the "PeakTech" vendor name spelling.
(as per vendor website, and also to be consistent with our wiki)
2016-12-06 21:50:05 +01:00
Vlad Ivanov fef90b4101 fx2lafw: fix device product string check
Signed-off-by: Vlad Ivanov <vlad@ivanov.email>
2016-12-05 02:16:56 +01:00
Karl Palsson 7087a8b0fa fx2lafw: warn on fail to open plausible devices
Instead of silently ignoring all devices that fail to open.

This fixes bug #867.

Signed-off-by: Karl Palsson <karlp@tweak.net.au>
2016-12-05 02:16:33 +01:00
Gerhard Sittig ced210d53a deree-de5000: add driver item for the Peaktech 2170 model
Register another driver for the Peaktech 2170 LCR meter, which is
based on the ES51919/ES51920 chipset, too.
2016-12-05 01:07:08 +01:00
Gerhard Sittig beedfa06b6 deree-de5000: prepare to add more ES51919 based LCR meters
The "deree-de5000" driver is a very thin wrapper around the ES51919
chipset. We expect more models from other vendors to use that same
support code.

Model the registration of vendor/model combinations after the serial-dmm
approach. Register the DER EE DE-5000 device as the currently only
member in a list of drivers which all use the ES51919 chipset (no model
specific routines are registered in the absence of support for other LCR
meter chips).

This commit does not change the driver's behaviour nor the set of
supported hardware. It prepares the addition of more drivers in the
future.
2016-12-05 01:06:58 +01:00
Uwe Hermann 82458e50b1 serial-dmm: Expand a code comment. 2016-11-06 14:45:08 +01:00
Gerhard Sittig d5b1b76d65 serial-dmm: comment nit on the UART bitrate for ES519xx chips
Factor out identical comments on the UART bitrate of ES519xx based
multimeters. These probably got copied from the first item as of 2012
when new items were added in 2014 (the added devices were from the
same vendor and rebadged).

Expand on the fact that the bitrate still is within spec, and does not
harm at all. Strictly speaking the comment could get dropped.
2016-11-06 14:43:50 +01:00
Gerhard Sittig 89a3d8af3a serial-dmm: sort the list of device drivers (part 12, vc870)
This commit puts 'vc870' meters into one group. Which completes the
series of commits which sort the list of supported serial DMMs.
2016-11-06 14:43:48 +01:00
Gerhard Sittig 53e875ab16 serial-dmm: sort the list of device drivers (part 11, sort ut71x)
This commit sorts items in the 'ut71x' group. This is separated from
collecting the group to reduce the diff size and simplify verification.
2016-11-06 14:43:46 +01:00
Gerhard Sittig 6c6e5e47f0 serial-dmm: sort the list of device drivers (part 10, group ut71x)
This commit puts 'ut71x' meters into one group. Item order is kept to
reduce the diff size and simplify verification.
2016-11-06 14:43:44 +01:00
Gerhard Sittig 9249648863 serial-dmm: sort the list of device drivers (part 9, rs9lcd)
This commit puts 'rs9lcd' meters into one group.
2016-11-06 14:43:43 +01:00
Gerhard Sittig b35d0023a8 serial-dmm: sort the list of device drivers (part 8, sort metex14)
This commit sorts items in the 'metex14' group. This is separated from
collecting the group to reduce the diff size and simplify verification.
2016-11-06 14:43:40 +01:00
Gerhard Sittig ab34156b90 serial-dmm: sort the list of device drivers (part 7, group metex14)
This commit puts 'metex14' meters into one group. Item order is kept to
reduce the diff size and simplify verification.
2016-11-06 14:43:38 +01:00
Gerhard Sittig 0e27643ff8 serial-dmm: sort the list of device drivers (part 6, fs9922)
This commit puts 'fs9922' meters into one group.
2016-11-06 14:43:37 +01:00
Gerhard Sittig 1cd40b57d6 serial-dmm: sort the list of device drivers (part 5, sort fs9721)
This commit sorts items in the 'fs9721' group. This is separated from
collecting the group to reduce the diff size and simplify verification.
2016-11-06 14:43:35 +01:00
Gerhard Sittig 289e1f4e7b serial-dmm: sort the list of device drivers (part 4, group fs9721)
This commit puts 'fs9721' meters into one group. Item order is kept to
reduce the diff size and simplify verification.
2016-11-06 14:43:32 +01:00
Gerhard Sittig 7532f61d1b serial-dmm: sort the list of device drivers (part 3, es519xx)
This commit puts 'es519xx' meters into one group.
2016-11-06 14:43:31 +01:00
Gerhard Sittig 440a374fe3 serial-dmm: sort the list of device drivers (part 2, dtm0660)
This commit puts 'dtm0660' meters into one group.
2016-11-06 14:43:30 +01:00
Gerhard Sittig c06785841c serial-dmm: sort the list of device drivers (part 1, bm25x)
The previous implementation seems to have added drivers in their "order
of appearance". Start sorting the rather long list, to simplify several
tasks: Add new entries as more drivers get written, find existing items
during research, identify and compare similar models during maintenance.
As a byproduct, there will be no doubt about where to put things during
future work :) and duplicates will be spotted immediately.

This commit puts 'bm25x' meters into one group. And comments on the sort
order and motivation for sorting the table.
2016-11-06 14:43:25 +01:00
Gerhard Sittig 6b7e644e5c es51919 lcr: unbreak channel setup after successful detection
Commit 6bcb3ee876 introduced initial support for the Cyrustek ES51919
chipset. Its setup_channels() routine used to init a variable to assume
failure, then a loop added channels and changed the value to success.

Commit 5e23fcab88 changed channel setup to never fail, but kept the
initialization with an error code. Which prevented the operation of
successfully detected LCR meters.

Remove the no longer needed variable, instead always return success from
an operation which cannot fail.

Fixes: 5e23fcab88 "Simplify channel creation."
Signed-off-by: Gerhard Sittig <gerhard.sittig@gmx.net>
2016-11-02 23:27:56 +01:00
Gerhard Sittig e68c0eb409 serial-dmm: add support for Peaktech-3330 (based on FS9721)
Add another DMM entry for Peaktech-3330, which is based on the FS9721
chipset. Support was tested with the CP210x based USB cable.

Signed-off-by: Gerhard Sittig <gerhard.sittig@gmx.net>
2016-11-02 23:23:56 +01:00
Gerhard Sittig 0150fdca54 output/ascii: add support for user configurable character set
Since tastes and requirements might differ, introduce support for a
user specified character set in the construction of ASCII art graphs
of signal levels. The syntax is "charset=<low><high>[<fall><rise>]",
the default remains backwards compatible with existing consumers.

In comparison to assuming a fixed character set, this change addresses
several distinct aspects:

Users can adjust the output for "higher visual contrast", or "straight
lines" instead of dotted patterns, or "increased difference in height"
for low and high signal levels, or "filled" (block like, "wall of text")
appearance of periods with high levels. User adjustable characters are
needed, as no single fixed set can satisfy the differing expectations.
Perception of the output heavily depends on specific terminals and fonts
in use.

Then there is the issue of levels versus edges, and how their timing
relates. By default edges are drawn at a point in time where the signal
was sampled and was deteremined to already _have_ changed and have
settled to the new level, which means that the position of edges in the
resulting graph might be off by up to one sample period. Strictly
speaking, the available set of samples only contains levels, and does
not hint where exactly an edge might have occured. Though this might be
considered rather nitpicky, representing the graph without edges does
better reflect the input data, and might simplify postprocessing.

Compare the previously only supported format (still the default, -O ascii):

  1:...................................................../""""""""""""""""""""
  1:""""""""""""""""""""""""""""""""\.........................................
  1:..........................................................................

to those example alternatives:

  $ sigrok-cli -i file.sr -O ascii:charset=_\"\\/
  1:_____________________________________________________/""""""""""""""""""""
  1:""""""""""""""""""""""""""""""""\_________________________________________
  1:__________________________________________________________________________

  $ sigrok-cli -i file.sr -O ascii:charset=_\"
  1:_____________________________________________________"""""""""""""""""""""
  1:""""""""""""""""""""""""""""""""__________________________________________
  1:__________________________________________________________________________

  $ sigrok-cli -i file.sr -O ascii:charset=_^
  1:_____________________________________________________^^^^^^^^^^^^^^^^^^^^^
  1:^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^__________________________________________
  1:__________________________________________________________________________

  $ sigrok-cli -i file.sr -O ascii:charset=_M
  1:_____________________________________________________MMMMMMMMMMMMMMMMMMMMM
  1:MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM__________________________________________
  1:__________________________________________________________________________

  $ sigrok-cli -i file.sr -O ascii:charset=_X
  1:_____________________________________________________XXXXXXXXXXXXXXXXXXXXX
  1:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX__________________________________________
  1:__________________________________________________________________________

Signed-off-by: Gerhard Sittig <gerhard.sittig@gmx.net>
2016-11-02 19:09:55 +01:00
Uwe Hermann 7dc72c37e2 hantek-6xxx: Add "fx2lafw-" prefix to the firmware files. 2016-10-31 14:42:29 +01:00
Uwe Hermann 459324acb8 hantek-6xxx: Update driver to use the USB product version field.
We now require the use of the latest fx2lafw firmware which uses the
same USB VID/PID (1D50:608E) for the Hantek 6022BE and the variants
and rebadges of that device (e.g. the SainSmart DDS120).

The variants can be distinguished via the USB product version field.
2016-10-30 14:36:40 +01:00
Aurelien Jacobs f6e7b6124a agilent-dmm: style improvement 2016-10-17 23:21:18 +02:00
Aurelien Jacobs 63bb11baba agilent-dmm: add support for Log-* data_source for U128x 2016-10-17 02:29:13 +02:00
Aurelien Jacobs b907d62fb8 agilent-dmm: rework job management
This allows much faster and configurable sampling rate, and faster
reaction to function switch.
This also gives a more repeatable job ordering and more reliable
query/reply association.
2016-10-17 02:29:13 +02:00
Aurelien Jacobs 6ace179e6d agilent-dmm: prepare config handling to easily receive more options 2016-10-17 02:24:53 +02:00
Aurelien Jacobs 5728718b66 analog: use SI prefix only with units that accept SI prefixes 2016-10-17 02:24:53 +02:00
Aurelien Jacobs d2f6abf6de agilent-dmm: fix handling of continuity mode for U128x 2016-10-17 02:24:53 +02:00
Aurelien Jacobs 7ab126cacb agilent-dmm: add support for pulse width and duty cycle on U128x 2016-10-17 02:24:53 +02:00
Aurelien Jacobs cdc311957b analog: use correct unit for dBm/dBV 2016-10-17 02:09:18 +02:00
Aurelien Jacobs 8f68f36bc5 agilent-dmm: add support for dBm/dBV modes 2016-10-17 02:09:18 +02:00
Aurelien Jacobs d822726dbf agilent-dmm: add support for reading secondary display and temperature 2016-10-17 02:09:18 +02:00
Gerhard Sittig 7c86d85372 asix-sigma: fix buffer length check in register write helper
Fix the array size check in the sigma_write_register() routine. The
'len' parameter specifies the number of bytes to write, while the 'buf'
array holds one nibble per array item.

The previous implementation (commit e8686e3ae3) switched to a
constant size and made the buffer large enough so that no existing
request would exceed the buffer, fixing an overflow that was present
before that commit. But the most recent size check was incomplete and
might erroneously succeed for larger amounts of write data.

It's assumed that the issue which gets addressed here never occured in
practice. The constant-size buffer could hold up to 39 bytes of input
data in their transport representation, while the largest data that was
passed to the write routine is six bytes (trigger LUT params).

Fixes: e8686e3ae3 "asix-sigma: Avoid use of variable length arrays"

Signed-off-by: Gerhard Sittig <gerhard.sittig@gmx.net>
2016-10-17 02:05:22 +02:00
Gerhard Sittig 2f7e529ce6 asix-sigma: store "limit samples" value, re-determine "limit msecs" period
The driver internally implements the "limit samples" feature by means of
the "limit sample period" approach. Determination of the corresponding
period of time for captures depends on the sample rate as well as the
maximum sample count, and thus needs to be re-done when either setting
changes.

Introduce a "limit_samples" variable so that the value is available when
needed later. As a byproduct the parameter can be retrieved now (get).

Add comments to the sigma_set_samplerate() routine's sections, since
quite a bit is happening there, and interacts with other locations.

Signed-off-by: Gerhard Sittig <gerhard.sittig@gmx.net>
2016-10-17 02:05:21 +02:00
Gerhard Sittig 4154a516de asix-sigma: fix out-of-range access to the samplerates[] array
Commit 2c9c0df86e removed the sentinel from the samplerates[] array,
but did not adjust the test which checked whether a rate is listed in
the set of supported rates. This could result in an out-of-range access
beyond the array's last item.

Fix the "listed?" check after iterating the table of supported rates.
Cope with either presence or absence of a sentinel in the array.

Address some more style nits while we are here. Rename an identifier
for a local variable which unintentionally might suggest that it would
be a preprocessor macro (all-caps). Reduce redundancy in data type
references as well as in the determination of the array size.

Signed-off-by: Gerhard Sittig <gerhard.sittig@gmx.net>
2016-10-17 02:05:21 +02:00
Gerhard Sittig 387825dcb1 asix-sigma: update comments in firmware download code paths
The current implementation of the ASIX Sigma firmware download contains
comments which express uncertainty. Rephrase them, no magic is involved.

Discuss the polarity of the CCLK hardware signal. Which shall eliminate
potential concerns in future reviews or maintenance.

This commit only updates comments, and does not change behaviour.

Signed-off-by: Gerhard Sittig <gerhard.sittig@gmx.net>
2016-10-17 02:05:21 +02:00
Uwe Hermann ba508e22d4 demo: File naming consistency changes. 2016-09-24 14:27:03 +02:00
Uwe Hermann caeb8d7a9d hantek-dso: File naming consistency changes. 2016-09-24 13:17:08 +02:00
Uwe Hermann 2cb232a9e4 fluke-dmm: File naming consistency changes. 2016-09-24 13:16:58 +02:00
Uwe Hermann 6cf1a87bfb agilent-dmm: File naming consistency changes. 2016-09-24 13:16:01 +02:00
Uwe Hermann 7ade12b470 resource: Improve logging output.
Don't show duplicate lines (per default) such as

  sr: resource: Failed to locate 'saleae-logic16-fx2.fw'.
  sr: resource: Failed to open resource 'saleae-logic16-fx2.fw'.

The first one is now an sr_dbg() instead of sr_err().

Also, mention that a higher loglevel will give more information as to
where the backend is looking for resources / firmware files.

This fixes bug #806.
2016-09-24 11:41:47 +02:00
Mike Meyer cad447d21a output/csv: Add an option to output units for column labels.
This change tweaks the CSV output module to change the label
setting from on/off to units/channels/off, where channels is the old
on behavior, and units uses the meaning field to generate the column
label - except for the generated Time column, which uses the label from
the X axis when it's generating gnuplot output.
2016-09-24 11:21:00 +02:00
Karsten König d53295e69e rigol-ds: Add DS1074Z Plus and DS1104Z Plus.
This was successfully tested on a DS1074Z Plus.
2016-09-24 11:04:32 +02:00
Mike Meyer f9c6b5cfd3 output/gnuplot: Remove, obsoleted by improved CSV module.
We no longer need a gnuplot output module, the CSV module can output
gnuplot-compatible data now (and it can also generate .gpi files).
2016-09-04 18:15:00 +02:00
Uwe Hermann e34dbc9d08 csv: Fix a segfault due to a g_malloc() allocating too few bytes. 2016-09-04 18:03:50 +02:00
Uwe Hermann cf1d5f1749 csv: Fix a segfault when using non-hardware input. 2016-09-04 18:03:50 +02:00
Mike Meyer 9e24c8bc65 New all-singing, almost all dancing, csv output module.
- It now handles more than one analog value correctly - at least from the
   demo driver.
 - Add column headers from channel names.
 - Add a row dedup capability.
 - Add a sample time column.
 - Add a frame end formatting (for gnuplot).
 - Made almost all formatting controllable or at least optional.
 - Fix it so we can mix analog and digital values.
 - Add outputting a gnuplot script for the data.
 - Count actual channels, not just mine, to find end of sample.
 - Add trigger option (untested).
2016-09-04 18:03:50 +02:00
Uwe Hermann 55ec0b673a fluke-dmm: Fix two compiler warnings.
src/hardware/fluke-dmm/fluke.c:312:24: warning: implicit conversion from \
  enumeration type 'enum sr_unit' to different enumeration type 'enum sr_mq' \
   [-Wenum-conversion]
          devc->mq = devc->unit = devc->mqflags = 0;
                   ~ ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~

  src/hardware/fluke-dmm/fluke.c:312:40: warning: implicit conversion from \
  enumeration type 'enum sr_mqflag' to different enumeration type 'enum \
  sr_unit' [-Wenum-conversion]
          devc->mq = devc->unit = devc->mqflags = 0;
                                ~ ~~~~~~~~~~~~~~^~~
2016-08-29 21:51:28 +02:00
Uwe Hermann 693c52482a es51919: Fix a compiler warning.
src/lcr/es51919.c:538:73: warning: comparison of unsigned enum expression \
		< 0 is always false [-Wtautological-compare]
    if ((analog->meaning->mq = parse_mq(pkt, is_secondary, pkt[2] & 0x80)) < 0)
2016-08-29 21:51:28 +02:00
Uwe Hermann 5c436a3bad strutil.c: Fix a Doxygen warning. 2016-08-29 21:51:28 +02:00
Uwe Hermann cd04f641a5 Fix various sample/time limit regressions.
These were accidentally introduced when the sw_limits helpers were added.
2016-08-29 21:51:28 +02:00
Uwe Hermann cb4b368f17 gmc-mh-1x-2x: Shorten some code by using the ternary operator. 2016-08-29 21:51:28 +02:00
Uwe Hermann d9251a2c9f Remove some unneeded double-spaces.
(also perform some other minor whitespace fixes while at it)
2016-08-29 21:51:27 +02:00
Uwe Hermann 2ecc745ccb device.c: Whitespace/cosmetics and typo fixes. 2016-08-29 21:51:27 +02:00
Uwe Hermann 8dc423b033 analog.c: Whitespace/cosmetics and typo fixes. 2016-08-29 21:51:27 +02:00
Uwe Hermann 7dcaddd3f0 Have remaining drivers default to digits=2 for analog values.
The default so far was 0, which meant there would be no significant
digits at all, yielding results that looked strange/wrong to the user.

Long-term all remaining drivers should be fixed to use the actual,
correct digits and spec_digits values according to the device's
capabilities and/or datasheet/manual. Until that is done, a default
of digits=2 is used as a temporary workaround.

This fixes the remaining parts of bug #815.
2016-08-29 00:25:19 +02:00
Uwe Hermann 869c837511 Document if or why sometimes digits/spec_digits is 0. 2016-08-29 00:25:19 +02:00
Aurelien Jacobs a005472fa2 appa-55ii: properly set encoding digits also for log memory reception 2016-08-29 00:25:19 +02:00
Aurelien Jacobs 962172e495 analog: improve output readability by using SI prefix 2016-08-29 00:25:19 +02:00
Aurelien Jacobs 6c1c13cdcd gwinstek-gds-800: properly set encoding digits 2016-08-29 00:25:18 +02:00
Aurelien Jacobs 417412c8f8 hantek-dso: properly set encoding digits 2016-08-29 00:25:18 +02:00
Aurelien Jacobs 1e1fdbc994 hantek-6xxx: properly set encoding digits 2016-08-29 00:25:18 +02:00
Aurelien Jacobs 545101338a hung-chang-dso-2100: properly set encoding digits 2016-08-29 00:25:18 +02:00
Aurelien Jacobs ad4c0275c2 baylibre-acme: properly set encoding digits 2016-08-24 02:39:40 +02:00
Aurelien Jacobs d043b29d5c tondaj-sl-814: properly set encoding digits 2016-08-24 01:01:23 +02:00