Commit Graph

4379 Commits

Author SHA1 Message Date
Uwe Hermann 9e411f4be8 rigol-ds: config_set: Move error printing to wrapper. 2017-07-21 17:06:40 +02:00
Uwe Hermann 0f8bee7162 rigol-ds: Update a code comment. 2017-07-21 17:06:40 +02:00
Uwe Hermann 396cdca0c3 rigol-ds: Drop two unneeded #defines. 2017-07-21 17:06:40 +02:00
Uwe Hermann 53012da658 drivers: Use ARRAY_AND_SIZE where possible. 2017-07-21 17:06:40 +02:00
Uwe Hermann 105df67463 drivers: Factor out std_gvar_array_*(). 2017-07-21 16:54:05 +02:00
Uwe Hermann 7bc3cfe6ff drivers: Factor out std_gvar_min_max_step_thresholds(). 2017-07-21 16:54:05 +02:00
Uwe Hermann bcee129962 scpi-pps: Change some floats to doubles.
This makes the code more consistent with the rest of the code-base
and also allows std_gvar_min_max_step_array() to work here.

Without this change:

  src/hardware/scpi-pps/api.c: In function ‘config_list’:
  src/hardware/scpi-pps/api.c:570:40: warning: passing argument 1 of ‘std_gvar_min_max_step_array’ from incompatible pointer type [-Wincompatible-pointer-types]
      *data = std_gvar_min_max_step_array(ch_spec->voltage);
                                          ^~~~~~~
  In file included from src/scpi.h:30:0,
                   from src/hardware/scpi-pps/api.c:23:
  src/libsigrok-internal.h:964:19: note: expected ‘const double *’ but argument is of type ‘const float *’
   SR_PRIV GVariant *std_gvar_min_max_step_array(const double a[3]);
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
  src/hardware/scpi-pps/api.c:573:40: warning: passing argument 1 of ‘std_gvar_min_max_step_array’ from incompatible pointer type [-Wincompatible-pointer-types]
      *data = std_gvar_min_max_step_array(ch_spec->frequency);
                                          ^~~~~~~
  In file included from src/scpi.h:30:0,
                   from src/hardware/scpi-pps/api.c:23:
  src/libsigrok-internal.h:964:19: note: expected ‘const double *’ but argument is of type ‘const float *’
   SR_PRIV GVariant *std_gvar_min_max_step_array(const double a[3]);
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
  src/hardware/scpi-pps/api.c:576:40: warning: passing argument 1 of ‘std_gvar_min_max_step_array’ from incompatible pointer type [-Wincompatible-pointer-types]
      *data = std_gvar_min_max_step_array(ch_spec->current);
                                          ^~~~~~~
  In file included from src/scpi.h:30:0,
                   from src/hardware/scpi-pps/api.c:23:
  src/libsigrok-internal.h:964:19: note: expected ‘const double *’ but argument is of type ‘const float *’
   SR_PRIV GVariant *std_gvar_min_max_step_array(const double a[3]);
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
2017-07-21 16:49:01 +02:00
Uwe Hermann 54d471f498 drivers: Factor out std_gvar_min_max_step{,_array}(). 2017-07-21 16:49:01 +02:00
Uwe Hermann 463160cbca drivers: Factor out std_gvar_samplerates{,_steps}(). 2017-07-21 16:49:01 +02:00
Uwe Hermann db944f1622 drivers: Factor out std_gvar_tuple_{array,rational}(). 2017-07-21 16:40:15 +02:00
Uwe Hermann 6b82c3e57a drivers: Consistently name per-cg options 'devopts_cg_*'. 2017-07-21 15:45:03 +02:00
Uwe Hermann 4b25cbffa1 drivers: Drop some unnecessary prefixes. 2017-07-21 15:45:03 +02:00
Uwe Hermann ca314e060f drivers: Drop unneeded or duplicate comments.
Drop various comments which are not really needed, too verbose, document
obvious things, are duplicated across all drivers, or simply incorrect.
2017-07-21 15:23:56 +02:00
Uwe Hermann c8e789fa0c baylibre-acme: Add SR_CONF_POWERMETER key. 2017-07-19 15:40:41 +02:00
Uwe Hermann 31bdc10ec2 Add SR_CONF_POWERMETER. 2017-07-19 15:40:41 +02:00
Uwe Hermann b258c09f26 testo: Drop unneeded sdi->driver assignment.
This is already done by std_scan_complete().
2017-07-19 15:39:23 +02:00
Uwe Hermann 05199c0ac9 drivers: Provide proper drvopts.
The device class config keys should be in drvopts (not devopts).
2017-07-19 15:39:23 +02:00
Uwe Hermann 55fb76b348 drivers: Always use same scanopts/drvopts/devopts/devopts_cg* order. 2017-07-19 15:11:01 +02:00
Uwe Hermann e66d1892d0 drivers: Add and use STD_CONFIG_LIST().
This ensures consistent handling of the SR_CONF_SCAN_OPTIONS and
SR_CONF_DEVICE_OPTIONS (with sdi NULL or non-NULL) config keys
and also reduces copy-pasted boilerplate in the drivers a bit.

This function does not handle channel-group specific items, that's
very driver-specific and thus left to the individual drivers.

Also move some generic checks and error messages from the drivers into
the sr_config_list() wrapper.
2017-07-19 15:11:01 +02:00
Uwe Hermann 13d2ac54f4 saleae-logic-pro: Use sr_dev_acquisition_stop() wrapper. 2017-07-17 11:26:12 +02:00
Jan Luebbe f2b8a31be5 saleae-logic-pro: Detect and abort on capture errors
The HW simply stops sending data on overflows, so if we receive no data
in one second, we abort the acquisition. We also need to allocate more
buffers to support higher sample rates.
2017-07-16 19:28:58 +02:00
Jan Luebbe da39089014 saleae-logic-pro: Implement bitstream upload and initialization
The control packets can be longer than 256 bytes, so change the
low-level functions accordingly.
2017-07-16 19:25:46 +02:00
Jan Luebbe f1aca068c7 saleae-logic-pro: Implement FX3 firmware upload 2017-07-16 19:24:27 +02:00
Uwe Hermann a9010323dd drivers: Remove some uneeded 'ret' variables. 2017-07-13 11:59:11 +02:00
Uwe Hermann b4fde527b6 session_driver: Use std_cleanup(). 2017-07-13 11:59:11 +02:00
Uwe Hermann 029b20425b session_driver: Don't open-code std_dev_clear(). 2017-07-13 11:59:11 +02:00
Uwe Hermann 3553451f1e clear_helper(): Use a cast to shorten all implementations. 2017-07-13 11:59:11 +02:00
Uwe Hermann 8bf18daabb sr_dev_clear(): Always free sdi->priv (devc).
Until now, clear_helper() callbacks for std_dev_clear_with_callback()
were expected to g_free(devc), but not all of them did that.

Have std_dev_clear_with_callback() unconditionally g_free(sdi->priv)
(i.e., devc), regardless of whether a clear_helper() callback was
provided or not. It was doing g_free(sdi->priv) when no callback
was provided already anyway.

This makes the individual drivers' clear_helper() implementations
shorter and prevents errors such as missing g_free(devc) calls.

This works, because all drivers either call std_dev_clear_with_callback()
directly, or indirectly via std_dev_clear().

This also allows us to remove some no-longer needed dev_clear()
and clear_helper() implementations that only did g_free(devc)
in favor of std_dev_clear().
2017-07-13 11:59:11 +02:00
Uwe Hermann 53279f13e4 dev_clear(): Consistently name callback 'clear_helper()'. 2017-07-13 11:59:11 +02:00
Uwe Hermann f778bf02ea std: Add and use std_dev_clear() where possible.
Be explicit and consistent in the drivers about which dev_clear function
will be called to avoid confusion and inconsistencies.

Drop some open-coded implementations of std_dev_clear().
2017-07-13 11:59:11 +02:00
Uwe Hermann 6e43c3d531 std: Rename std_dev_clear() to std_dev_clear_with_callback(). 2017-07-13 11:59:11 +02:00
Uwe Hermann 4d67b9d9dc std: Factor out some API call dummy implementations. 2017-07-13 11:59:11 +02:00
Uwe Hermann 91057d2fc2 Various log message cleanups.
Drop unneeded log messages, add some others that might be useful,
document which ones we're intentionally not emitting.

Don't log "$operation successful" type of messages in most cases,
that's too verbose; logging failures only is sufficient there.

baylibre-acme: Don't log "No such file or directory" messages during scan,
this triggers on all kinds of unrelated devices (e.g. "AMDGPU i2c bit
bus 0x91" in this case):

  sr: [...] baylibre-acme: Name for probe 1 can't be read: Failed to open file “/sys/class/i2c-adapter/i2c-1/1-0040/name”: No such file or directory
  sr: [...] baylibre-acme: Name for probe 2 can't be read: Failed to open file “/sys/class/i2c-adapter/i2c-1/1-0041/name”: No such file or directory
  sr: [...] baylibre-acme: Name for probe 3 can't be read: Failed to open file “/sys/class/i2c-adapter/i2c-1/1-0044/name”: No such file or directory
  sr: [...] baylibre-acme: Name for probe 4 can't be read: Failed to open file “/sys/class/i2c-adapter/i2c-1/1-0045/name”: No such file or directory
  sr: [...] baylibre-acme: Name for probe 5 can't be read: Failed to open file “/sys/class/i2c-adapter/i2c-1/1-0042/name”: No such file or directory
  sr: [...] baylibre-acme: Name for probe 5 can't be read: Failed to open file “/sys/class/i2c-adapter/i2c-1/1-004c/name”: No such file or directory
  sr: [...] baylibre-acme: Name for probe 6 can't be read: Failed to open file “/sys/class/i2c-adapter/i2c-1/1-0043/name”: No such file or directory
  sr: [...] baylibre-acme: Name for probe 6 can't be read: Failed to open file “/sys/class/i2c-adapter/i2c-1/1-0049/name”: No such file or directory
  sr: [...] baylibre-acme: Name for probe 7 can't be read: Failed to open file “/sys/class/i2c-adapter/i2c-1/1-0046/name”: No such file or directory
  sr: [...] baylibre-acme: Name for probe 7 can't be read: Failed to open file “/sys/class/i2c-adapter/i2c-1/1-004f/name”: No such file or directory
  sr: [...] baylibre-acme: Name for probe 8 can't be read: Failed to open file “/sys/class/i2c-adapter/i2c-1/1-0047/name”: No such file or directory
  sr: [...] baylibre-acme: Name for probe 8 can't be read: Failed to open file “/sys/class/i2c-adapter/i2c-1/1-004b/name”: No such file or directory
2017-07-13 11:59:11 +02:00
Uwe Hermann 12852b0337 std: Simplifications, random fixes, Doxygen cosmetics.
- sr_dev_clear(): Don't try to clear uninitialized drivers (the same
   check was previously done in std_dev_clear()).

 - Document some places where we intentionally don't emit log messages.

 - std: Various Doxygen fixes and updates.

 - std: Add some more sanity-checks on input parameters.
2017-07-13 11:59:11 +02:00
Uwe Hermann e374786753 session_file: Start out with SR_ST_INACTIVE like all drivers. 2017-07-08 14:25:23 +02:00
Uwe Hermann f1ba6b4b2c sr_dev_close(): Set status to SR_ST_INACTIVE.
This ensures consistent checks and log messages across all drivers
and reduces the per-driver boilerplate.
2017-07-08 14:25:23 +02:00
Uwe Hermann 7e46362338 sr_dev_open(): Set status to SR_ST_ACTIVE upon success.
This ensures consistent checks and log messages across all drivers
and reduces the per-driver boilerplate.
2017-07-08 14:25:23 +02:00
Uwe Hermann 6402c37916 sr_dev_open(): Factor out SR_ST_ACTIVE check.
This ensures consistent checks and log messages across all drivers
and reduces the per-driver boilerplate.
2017-07-08 14:25:23 +02:00
Uwe Hermann 093e1cba6b sr_dev_close(): Factor out SR_ERR_DEV_CLOSED check.
This ensures consistent checks and log messages across all drivers
and reduces the per-driver boilerplate.
2017-07-07 21:51:25 +02:00
Uwe Hermann 89ab9fc39c sr_config_commit(): Factor out SR_ERR_DEV_CLOSED check.
This ensures consistent checks and log messages across all drivers
and reduces the per-driver boilerplate.
2017-07-07 21:51:22 +02:00
Uwe Hermann c3cd66a00c sr_config_set(): Factor out SR_ERR_DEV_CLOSED check.
This ensures consistent checks and log messages across all drivers
and reduces the per-driver boilerplate.
2017-07-07 21:51:19 +02:00
Uwe Hermann f670835f1f Add sr_dev_acquisition_start(), factor out SR_ERR_DEV_CLOSED check.
This ensures consistent checks and log messages across all drivers
and reduces the per-driver boilerplate.
2017-07-07 21:51:16 +02:00
Uwe Hermann d2f7c417fd Add sr_dev_acquisition_stop(), factor out SR_ERR_DEV_CLOSED check.
This ensures consistent checks and log messages across all drivers
and reduces the per-driver boilerplate.
2017-07-07 21:51:10 +02:00
Soeren Apel 6ad2fbaad2 Introduce A2L methods
The memory allocation for sr_datafeed_logic is broken, the memory
will never be freed. #994 is used to handle this issue.
2017-07-06 00:16:24 +02:00
Soeren Apel 895cbcdd3c Bindings: constify data pointer 2017-07-06 00:07:30 +02:00
Roland Hieber 8b9fa09859 gitignore nano and vim swap files
When .*.swp already exists, vim will try .*.swo, then .*.swn, and so
forth. Ignore those files too.

Signed-off-by: Roland Hieber <rohieb@rohieb.name>
2017-07-04 12:18:03 +02:00
Richard f97c159536 serial-dmm: Add support for the SparkFun 70C multimeter. 2017-07-04 12:10:29 +02:00
Richard b0e1a1ecc4 Mark some arrays as const 2017-07-04 12:10:29 +02:00
Uwe Hermann fbbafc6909 saleae-logic-pro: Fix two compiler warnings.
src/hardware/saleae-logic-pro/protocol.c:389:12: warning: 'set_led' defined but not used [-Wunused-function]
   static int set_led(const struct sr_dev_inst *sdi, uint8_t r, uint8_t g, uint8_t b)
              ^
    CC       src/hardware/saleae-logic-pro/api.lo
  src/hardware/saleae-logic-pro/api.c: In function 'dev_acquisition_handle':
  src/hardware/saleae-logic-pro/api.c:332:9: warning: missing initializer for field 'tv_sec' of 'struct timeval' [-Wmissing-field-initializers]
    struct timeval tv = {};
           ^
  In file included from /usr/include/x86_64-linux-gnu/sys/time.h:27:0,
                   from include/libsigrok/libsigrok.h:24,
                   from src/hardware/saleae-logic-pro/protocol.h:25,
                   from src/hardware/saleae-logic-pro/api.c:23:
  /usr/include/x86_64-linux-gnu/bits/time.h:32:14: note: 'tv_sec' declared here
       __time_t tv_sec;  /* Seconds.  */
                ^
2017-07-03 11:57:02 +02:00
Uwe Hermann b605edf38f Revert "C++: Avoid std::map::emplace() for GCC 4.7 compatibility"
This reverts commit 8c52989811.

We now require g++ >= 4.8.1 which supports std::map::emplace(), as does
clang >= 3.3.
2017-07-03 11:20:26 +02:00