Uwe Hermann [Sat, 24 Jun 2017 16:25:40 +0000 (18:25 +0200)]
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:
^~~~
Uwe Hermann [Sat, 24 Jun 2017 16:04:27 +0000 (18:04 +0200)]
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:
^~~~
Uwe Hermann [Sat, 24 Jun 2017 15:26:02 +0000 (17:26 +0200)]
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);
^~~~~~
Uwe Hermann [Sat, 24 Jun 2017 15:23:56 +0000 (17:23 +0200)]
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);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Gerhard Sittig [Tue, 20 Jun 2017 19:04:37 +0000 (21:04 +0200)]
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.
Gerhard Sittig [Sat, 17 Jun 2017 18:59:18 +0000 (20:59 +0200)]
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.
Gerhard Sittig [Sat, 17 Jun 2017 18:33:12 +0000 (20:33 +0200)]
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).
Gerhard Sittig [Sat, 17 Jun 2017 17:23:35 +0000 (19:23 +0200)]
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.
Gerhard Sittig [Sat, 17 Jun 2017 15:58:45 +0000 (17:58 +0200)]
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.
Gerhard Sittig [Sun, 11 Jun 2017 19:02:57 +0000 (21:02 +0200)]
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.
Uwe Hermann [Wed, 21 Jun 2017 05:53:20 +0000 (07:53 +0200)]
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.
Joel Holdsworth [Thu, 15 Jun 2017 19:32:01 +0000 (13:32 -0600)]
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.
Joel Holdsworth [Thu, 15 Jun 2017 17:34:52 +0000 (11:34 -0600)]
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.
Uwe Hermann [Mon, 12 Jun 2017 01:03:21 +0000 (03:03 +0200)]
Bump libtool version (not package version) to 4:0:0.
The last release (0.4.0) had the libtool version (current:revision:age)
set to 3:0:0. Since this release adds, removes, and changes interfaces,
the new version is 4:0:0.
Uwe Hermann [Sun, 11 Jun 2017 21:03:09 +0000 (23:03 +0200)]
Rename sigrok-logo-notext.png to libsigrok_112x112.png.
This is more specific and prevents any potential issues e.g. when
multiple distro packages might ship with a generic file like
sigrok-logo-notext.png that's supposed to be installed in the same place.
Gerhard Sittig [Fri, 9 Jun 2017 21:13:35 +0000 (23:13 +0200)]
C++ binding: Fixup memory leak in input module receive() calls
The Input::send() method allocated glib strings and copied input data,
but only released the glib string container and leaked the actual string
content. This led to leaks in the size of the verbatim input file, which
is especially wasteful for uncompressed textual representations.
Gerhard Sittig [Fri, 9 Jun 2017 21:10:40 +0000 (23:10 +0200)]
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.
Gerhard Sittig [Fri, 9 Jun 2017 21:07:25 +0000 (23:07 +0200)]
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.
Gerhard Sittig [Thu, 8 Jun 2017 18:13:31 +0000 (20:13 +0200)]
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.)
Gerhard Sittig [Mon, 5 Jun 2017 17:00:23 +0000 (19:00 +0200)]
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.
Gerhard Sittig [Mon, 5 Jun 2017 16:24:52 +0000 (18:24 +0200)]
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.
Gerhard Sittig [Mon, 5 Jun 2017 14:41:42 +0000 (16:41 +0200)]
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.
Gerhard Sittig [Mon, 5 Jun 2017 11:37:33 +0000 (13:37 +0200)]
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.
Gerhard Sittig [Mon, 5 Jun 2017 11:34:05 +0000 (13:34 +0200)]
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.
Gerhard Sittig [Mon, 5 Jun 2017 11:09:16 +0000 (13:09 +0200)]
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.
Gerhard Sittig [Fri, 26 May 2017 01:06:39 +0000 (03:06 +0200)]
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.
Gerhard Sittig [Fri, 26 May 2017 00:18:33 +0000 (02:18 +0200)]
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.
Gerhard Sittig [Thu, 25 May 2017 23:30:42 +0000 (01:30 +0200)]
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.
Gerhard Sittig [Thu, 25 May 2017 22:31:21 +0000 (00:31 +0200)]
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.
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.
Gerhard Sittig [Thu, 25 May 2017 20:55:00 +0000 (22:55 +0200)]
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.
Gerhard Sittig [Thu, 25 May 2017 20:09:54 +0000 (22:09 +0200)]
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.
Gerhard Sittig [Thu, 25 May 2017 19:57:30 +0000 (21:57 +0200)]
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.
Gerhard Sittig [Thu, 25 May 2017 17:47:31 +0000 (19:47 +0200)]
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.
Gerhard Sittig [Sun, 23 Apr 2017 14:51:31 +0000 (16:51 +0200)]
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.
Gerhard Sittig [Thu, 25 May 2017 23:34:55 +0000 (01:34 +0200)]
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.
Gerhard Sittig [Sun, 23 Apr 2017 12:15:57 +0000 (14:15 +0200)]
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.
Gerhard Sittig [Thu, 25 May 2017 17:06:36 +0000 (19:06 +0200)]
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.
Gerhard Sittig [Thu, 25 May 2017 11:31:46 +0000 (13:31 +0200)]
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.
Gerhard Sittig [Sun, 23 Apr 2017 16:20:44 +0000 (18:20 +0200)]
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.
Gerhard Sittig [Fri, 5 May 2017 21:20:43 +0000 (23:20 +0200)]
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.
Gerhard Sittig [Fri, 5 May 2017 20:35:38 +0000 (22:35 +0200)]
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.