- add support for multiple transfers.
- set nummber of samples to 1 for FPGA FW version 0
- increase size of data transfer buffer to 2kB.
Signed-off-by: Andrej Valek <andy@skyrain.eu>
Callback for data transfer is separated from status. This change will be
used for better data transfer sending/receiving. Cast signal, that trigger
has been captured was moved into state: H4032L_STATUS_FIRST_TRANSFER.
Signed-off-by: Andrej Valek <andy@skyrain.eu>
- get FPGA version in dev_open
- enable some features only for newer FPGA
- decrease printing number of message of FPGA version
Signed-off-by: Andrej Valek <andy@skyrain.eu>
Split the creation of channels and groups as well as the creation of the
session feed buffer into separate routines. Re-allocate the buffer after
reset but do not re-create the channels and groups.
This implementation assumes that after reset() of the input module, the
very same set of channels (including their order, names and enabled
state, as well as group membership) results from processing the
subsequently fed file content. Reading rather different configurations
from the same input file by means of repeated reset and re-read may not
work as expected.
Explicitly check GString pointers for validity before calling glib
routines that would access string content. This silences an assertion
error for a non-fatal runtime condition:
(process:17044): GLib-CRITICAL **: g_string_free: assertion 'string != NULL' failed
Rephrase common input reset logic such that additional common code can
execute after the individual module's reset callback. No behaviour has
changed, the module's reset callback still is optional, and identical
log output gets emitted.
Do clear the sdi_ready flag in the common sr_input_reset() routine, so
that all input modules will parse header information again before
processing sample data when subsequent calls receive new file content.
Void the input module's receive() buffer from common reset code. This
unbreaks the feature of re-reading previously consumed input files.
Extend comments in the common reset and free code paths, which involve
the modules' reset and cleanup routines, which interact in non-trivial
ways. Discuss the responsibilities of common and individual routines, to
remain aware during maintenance.
Acquisition won't work correctly in a multi-threaded environment, when
config_set() and config_get() are called with a channel group.
The channel switching itself has moved to scpi/scpi.c, to be able to
handle switching in a thread safe way.
Use of the thread safe SCPI functions, so no write+read operation is
interruped.
Also return float values instead of double value in acquisition mode.
This is related to bug #779.
This ensures that SCPI read/write/write+read operations are thread safe.
F.e.: If a write operation expects a return value (in other words: a
read operation), it is not allowed to be interrupted by another write
operation.
To simplify things, the SCPI helper functions are moved from
scpi/helpers.c to scpi/scpi.c and also are renamed to fit the naming
scheme.
libgpib in particular will abort the program execution in case of
concurrent operations.
The chronovu_la8 input module is capable of handling either file type,
generated by LA8 or LA16 vendor software. Automatic detection is not
available, but user provided channel counts work fine.
Adjust the input module's name and description, and claim support for
.kdt as well as .kd1 files.
Add developer notes on implementation details, the file content's
constraints, and potential future adjustment.
The file format is funny, a data part is leading (fixed size) and a
"header" part follows. The previous implementation sent the header part
to the session, too, pretending it was part of the data. This change
limits the number of samples that get sent to the session.
Comment on the file layout and header fields while we are here. This
information got lost in commit 02e24c0ce0 when the input module got
converted from do-it-yourself file operations to having intrinsic
handler routines invoked from common logic which handles the file.
Prefer the more portable UINT64_C() macro over the UL suffix when a
literal needs to span "more than 31 bit positions". Adjust other
locations for consistency across the source file.
Commit 8c4bff1d25 introduced a routine which prints what mostly should
be text, and avoids non-printable characters. This implementation used an
incorrect format string, which could result in data getting written past
the end of a buffer. Fix the format string.
src/hwdriver.c: In function ‘log_key’:
src/hwdriver.c:648:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
opstr = op == SR_CONF_GET ? "get" : op == SR_CONF_SET ? "set" : "list";
^~
src/hwdriver.c: In function ‘check_key’:
src/hwdriver.c:681:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
opstr = op == SR_CONF_GET ? "get" : op == SR_CONF_SET ? "set" : "list";
^~
src/hardware/siglent-sds/api.c:596:3: warning: Argument to g_free() is the address of a global variable, which is not memory allocated by malloc()
g_free(cmd);
^~~~~~~~~~~
src/hardware/siglent-sds/api.c:641:3: warning: Argument to g_free() is the address of a global variable, which is not memory allocated by malloc()
g_free(cmd);
^~~~~~~~~~~
Reported by scan-build:
src/hardware/lecroy-xstream/protocol.c:680:12: warning: Potential leak of memory pointed to by 'analog.data'
return SR_ERR;
^~~~~~
Reported by scan-build:
src/input/logicport.c:1186:18: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
.format_match = format_match,
^~~~~~~~~~~~
Allow C++ applications to have the input format automatically detected,
and get a corresponding InputFormat instance. This makes the format match
logic available to PulseView.
Log determined header format when parsing trace32 file headers. Keep
another log message during regular processing, but silence it during
format match.
Use more appropriate data types for local and instance variables. Adjust
format strings accordingly.
There were several issues with the previous implementation of the logic
which parses trace32 input files: A string comparison was inverted, and
compared a seven character literal to a five character copy of the input.
One more character was trimmed before CTRL-Z (the CP/M EOF), which often
is SPACE in input files, but might be excessive on other input files.
Replace a DIY character search while we are here. Use symbolic names for
special characters. Factor out a test and memory release, to simplify
error code paths in the remaining logic. Extend comments.
There is not much point in log messages about format mismatch in the
auto detect phase, where each module gets queried in turn and most are
supposed to not match.
Do not print non-printable characters in log messages. Those could occur
in the format detection phase, or in the regular processing of input
files that either are unexpected or invalid (or is there a binary header
format variant even?).
Although the file format handled by this input module appears to be of
fixed size (8MiB plus 5 more bytes), it's more reliable to use a data
type for the file size that is larger than "an int". Although off_t
would be most portable, use uint64_t to match the code which passes the
parameter to the input module.
The previous implementation already was inconsistent (used to allocate
255 bytes and claimed that 128 bytes were sufficient). While existing
formats already required more than a few bytes of input (regular VCD
files' header sections exceed 255 bytes length).
Increase the buffer size that gets passed to input modules' match
method. Use 4MiB for consistency with other locations. Do not enforce a
minimum size, as there are valid input files which are shorter than 128
bytes. Auto-detection failed on those.
This addresses part of bug #1200.
When users don't specify the input format, applications can try to have
the format auto-detected. Some of the tests were weak and could result
in false positives.
Add a 'confidence' parameter to the input modules' format_match()
method. Claim high confidence (1) for those formats which can check
magic strings or the presence of essential keywords (vcd, wav). Claim
medium confidence (10) for those formats which happened to mis-detect
inputs in the past (trace32_ad). Claim weak confidence (100) for those
formats which totally lack reliable conditions and rather guess than
detect (chronovu_la8).
Prefer the best match in public scan routines. Return at most one module
to callers even if multiple modules matched, to keep the current API.
This addresses part of bug #1200.
Implement an input module for .lpf files, the "LogicPort File" format of
the Intronix LA1034 vendor software. This version supports wires with
enabled and inverted state, compressed samples, signal names, signal
groups (but not multiple assignment), and automatic format detection.
The logic which determines whether "the file header" was completely
received, and sample data can get sent to the session, implements an
assumption in the absence of a better and more reliable condition.
Invalid input gets rejected, but diagnostics is rather limited. Since
all channels get to be the member of a channel group, either specified
by the user in the input file, or arranged for in the input module, the
"missing separator" part of bug 1186 has become obsolete.
../include/libsigrok/libsigrok.h:653:19: warning: result of ‘1 << 31’ requires 33 bits to represent, but ‘int’ only has 32 bits [-Wshift-overflow=]
SR_CONF_GET = (1 << 31),
^~
[...]
src/analog.c:205:23: warning: declaration of ‘i’ shadows a previous local [-Wshadow]
for (unsigned int i = 0; i < count; i++) {
^
src/analog.c:178:18: note: shadowed declaration is here
unsigned int b, i, count;
^
[...]
src/analog.c: In function ‘sr_analog_to_float’:
src/analog.c:194:9: warning: declaration of ‘offset’ shadows a previous local [-Wshadow]
float offset = analog->encoding->offset.p / (float)analog->encoding->offset.q;
^~~~~~
src/analog.c:177:8: note: shadowed declaration is here
float offset;
^~~~~~
Allow developers to specify the (default) number of frames at compile
time (default to "off" as before). Accept the frame limit spec at scan()
time as well. This is useful when applications don't run config_set() at
runtime.
Tested with:
$ pulseview -d demo:logic_channels=0:analog_channels=1:limit_frames=4
The previous implementation supported the generation of frames as a
compile time option. This change lets users adjust the feature at
runtime.
In the absence of a frame count limit no frame begin/end markers get
sent (the default behaviour of the previous implementation). When a
frame count limit is specified, the respective number of frames gets
sent and acquisition stops.
The fixed amount of 1000 samples per frame is an arbitrary choice. This
compile time option is easily adjusted in the source code.