Commit Graph

4761 Commits

Author SHA1 Message Date
Uwe Hermann c7b5c3588e hantek-4032l: Rename 'devc->buffer' to 'devc->buf'.
This is shorter and also avoids confusion with transfer->buffer.
2018-06-05 23:59:24 +02:00
Uwe Hermann 7b9387b8f0 hantek-4032l: Rename number_samples to num_samples. 2018-06-05 23:56:30 +02:00
Uwe Hermann 264a4cb2b8 hantek-4032l: Use MIN() where possible. 2018-06-05 23:55:23 +02:00
Uwe Hermann cbc656e45f hantek-4032l: Simplify some config_get/_set parts.
Also, drop some unneeded checks.
2018-06-05 23:43:23 +02:00
Uwe Hermann 583fc126d0 hantek-4032l: config_set(): Simplify SR_CONF_CAPTURE_RATIO case.
The sr_config_set() wrapper already checks the value.
2018-06-05 23:16:02 +02:00
Uwe Hermann 2dcd904c18 hantek-4032l: Drop some unneeded malloc checks.
As per guidelines in HACKING.
2018-06-05 23:02:58 +02:00
Uwe Hermann 61803a29aa hantek-4032l: Reduce indentation level a bit. 2018-06-05 22:59:29 +02:00
Uwe Hermann b8a954c586 zketech-ebd-usb: Fix a compiler warning. 2018-06-05 22:01:12 +02:00
Andrej Valek f49065c668 hantek-4032l: Add support for external clocks.
These options are NOT available for FPGA version 0.

- add option to select edge type

Signed-off-by: Andrej Valek <andy@skyrain.eu>
2018-06-05 22:01:12 +02:00
Andrej Valek bc294eaca8 Add SR_CONF_EXTERNAL_CLOCK_SOURCE key.
Signed-off-by: Andrej Valek <andy@skyrain.eu>
2018-06-05 22:01:12 +02:00
Andrej Valek 2a80186103 hantek-4032l: Separate threshold channels.
Split global threshold into channels A and B.

Signed-off-by: Andrej Valek <andy@skyrain.eu>
2018-06-05 22:01:12 +02:00
Andrej Valek caad0024fb hantek-4032l: Set new pwm threshold handling.
Calculate threshold values from <-6.0;6.0> range.

Signed-off-by: Andrej Valek <andy@skyrain.eu>
2018-06-05 17:16:39 +02:00
Andrej Valek 3dc976fe9f hantek-4032l: Implement trigger handling.
Send trigger position to upper layer.

Signed-off-by: Andrej Valek <andy@skyrain.eu>
2018-06-05 17:16:39 +02:00
Andrej Valek 4b75f84c01 hantek-4032l: Set maximum samples size to 64MB.
Signed-off-by: Andrej Valek <andy@skyrain.eu>
2018-06-05 17:11:43 +02:00
Andrej Valek 2958315ded hantek-4032l: Increase speed of data getting.
- 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>
2018-06-05 17:10:14 +02:00
Andrej Valek 43d8603571 hantek-4032l: Separate USB receive callbacks.
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>
2018-06-05 16:57:48 +02:00
Andrej Valek 7a7afc0086 hantek-4032l: Get FGPA version.
- 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>
2018-06-05 16:57:48 +02:00
Andrej Valek 28f2d07fe5 hantek-4032l: Unify style.
Signed-off-by: Andrej Valek <andy@skyrain.eu>
2018-06-05 16:55:45 +02:00
Soeren Apel 9e850040db Fix #1167 by not creating sigrok channels twice
Also fixes a similar bug in the analog_raw input module that prevented
it from resetting properly - it freed its resources by calling cleanup().
2018-06-03 19:37:49 +02:00
Gerhard Sittig 3c9117094c input/logicport: remove obsolete reset/cleanup assignments
The in->buf truncation is done by common backend logic. The module's
cleanup() does zero out inc, which obsoletes the flag assignments.
2018-06-03 19:28:46 +02:00
Gerhard Sittig 4c40d096d4 input/logicport: don't re-create channels after input module reset
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.
2018-06-03 19:28:46 +02:00
Gerhard Sittig 49d9a095e8 input/logicport: silence a non-fatal glib runtime assertion
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
2018-06-03 19:28:46 +02:00
Gerhard Sittig a38c2bfbbb input: clear sdi_ready flag and receive() buffer in common code
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.
2018-06-03 19:28:46 +02:00
Uwe Hermann 1e99158c1b hantek-6xxx: Drop some unused variables. 2018-06-02 23:23:55 +02:00
Sergey Alirzaev 4299fcc0b8 hantek-6xxx: FIFO sampling
It doesn't buffer all the samples before sending them out anymore.

This fixes bug #1214.
2018-06-02 23:12:29 +02:00
Uwe Hermann d828b05e65 scpi-pps: Rigol DP71x: Make OVP/OCP threshold listable. 2018-06-01 15:47:48 +02:00
Frank Stettner 1c8901f744 scpi: Use locale independent sr_vsnprintf_ascii() and sr_vsprintf_ascii() functions. 2018-06-01 15:46:17 +02:00
Frank Stettner 7ca40d2d1c tests: Tests for the locale independent sr_vsprintf_ascii() function. 2018-06-01 15:46:17 +02:00
Frank Stettner 21ef355e50 strutil: Locale independent sprintf() and vsprintf() functions 2018-06-01 15:46:17 +02:00
Frank Stettner 49a468ed8b scpi-pps: Add listable OVP/OCP threshold for HP 66xxx and prepared all other 2018-06-01 15:46:17 +02:00
Frank Stettner a61c8cce01 scpi-pps: Add HP 6631B, HP 66332A, HP 6633B and HP 6634B power supplies 2018-06-01 15:46:17 +02:00
Frank Stettner 7e381bfc3c scpi-pps: Add missing functionality for the HP 6632B power supply. 2018-06-01 15:46:17 +02:00
Frank Stettner 17a82e83ff scpi-pps: Reimplemention of switching channel groups (PSU channels)
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.
2018-06-01 15:46:17 +02:00
Frank Stettner fa2ce8c762 scpi-pps: Use thread safe SCPI functions, return float not double.
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.
2018-06-01 15:46:17 +02:00
Frank Stettner fd20e59caa scpi: Synchronize read, write and write+read operations.
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.
2018-06-01 15:46:17 +02:00
Uwe Hermann 1c5adc5ff7 scpi.c: Drop an unneeded log message.
The IDN string is already logged by sr_scpi_get_string().
2018-06-01 14:43:10 +02:00
Uwe Hermann 0c8aedb543 scpi_serial.c: Improve an error message. 2018-06-01 14:43:10 +02:00
Uwe Hermann 0261956fab scpi_serial.c: Drop an unneeded log message.
The number of bytes read is already logged by the serial backend:

  sr: [00:00.072857] scpi_serial: Read 1 bytes into buffer.
  sr: [00:00.073884] serial: Read 1/2008 bytes.
  sr: [00:00.073900] scpi_serial: Read 1 bytes into buffer.
  sr: [00:00.074896] serial: Read 1/2007 bytes.
  sr: [00:00.074905] scpi_serial: Read 1 bytes into buffer.
  sr: [00:00.075949] serial: Read 1/2006 bytes.
2018-06-01 14:43:10 +02:00
Uwe Hermann 319fe9cea6 scpi-pps: Add support for the Rigol DP711/DP712. 2018-06-01 14:43:10 +02:00
Gerhard Sittig 13ac09279a input/chronovu_la8: claim responsibility for LA16 files, devel comments
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.
2018-05-25 23:21:43 +02:00
Gerhard Sittig e8eb24222c input/chronovu_la8: only send data to the session, don't send the header
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.
2018-05-25 23:07:28 +02:00
Gerhard Sittig 20358f90b4 input/logicport: unobfuscate 64-bit-clean bit mask literals
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.
2018-05-21 20:15:48 +02:00
Gerhard Sittig 67765e465a input/trace32_ad: fix potential buffer overflow for unexpected input data
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.
2018-05-21 20:13:27 +02:00
Uwe Hermann 090f1e1e54 hwdriver.c: Fix two scan-build warnings.
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";
               ^~
2018-05-19 22:23:16 +02:00
Uwe Hermann b4580cb9d0 siglent-sds: Fix multiple scan-build warnings.
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);
                  ^~~~~~~~~~~
2018-05-19 22:01:28 +02:00
Uwe Hermann d5db6ea7e1 lecroy-xstream: Fix a potential memory leak.
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;
                                         ^~~~~~
2018-05-19 22:01:26 +02:00
Uwe Hermann 4fc4b8e7aa hameg-hmo: Fix two potential memory leaks.
Reported by scan-build:

  src/hardware/hameg-hmo/api.c:533:12: warning: Potential leak of memory pointed to by 'pod_enabled'
                                  return SR_ERR;
                                         ^~~~~~
2018-05-19 22:01:21 +02:00
Uwe Hermann 24801f4e80 input/logicport: Fix outdated format_match().
Reported by scan-build:

  src/input/logicport.c:1186:18: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
    .format_match = format_match,
                    ^~~~~~~~~~~~
2018-05-19 22:01:18 +02:00
Gerhard Sittig 092843eb42 bindings: wrap sr_input_scan_file() in the C++ language binding
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.
2018-05-17 22:31:27 +02:00
Gerhard Sittig c83bdde9da input: provide accessor routine for (struct sr_input *)->module
Add a public API routine which allows applications to query the
sr_input_module from an sr_input.
2018-05-17 22:31:27 +02:00