Commit Graph

1564 Commits

Author SHA1 Message Date
Marek Vasut 64fe661b87 asix-sigma: Pull out the logic-mode switching
Pull out the code which switches Sigma from the FPGA programming mode
into Logic-Analyzer mode into separate function. Also, given the reply
is only ever 3-byte long, do not allocate 32 byte big buffer, but only
a 3-byte long one.

Signed-off-by: Marek Vasut <marex@denx.de>
2014-04-30 09:45:51 -07:00
Marek Vasut 29b66a2eb0 asix-sigma: Squash yoda-condition in upload_firmware()
Signed-off-by: Marek Vasut <marex@denx.de>
2014-04-30 09:45:51 -07:00
Marek Vasut a80226bbb9 asix-sigma: Move the sigma_fw_2_bitbang()
Move the sigma_fw_2_bitbang() function closer to the upload_firmware()
function so there's not such a horrible mess in the file.

Signed-off-by: Marek Vasut <marex@denx.de>
2014-04-30 09:45:50 -07:00
Marek Vasut d485d44361 asix-sigma: Cleanup the bit2bitbang
Rework the bit2bitbang function. Remarkable changes are:
- The function was renamed to sigma_fw_2_bitbang()
- We use glib function calls to work with the file
- We mmap the file containing firmware instead of opening the file
  and then reading it into a buffer.
- The magic firmware transformation is now type-safe.
- Documentation and comments were added where applicable.

Signed-off-by: Marek Vasut <marex@denx.de>
2014-04-30 09:45:50 -07:00
Marek Vasut 8bbf7627df asix-sigma: Weed out in-condition assignments
Remove all those if ((ret = foo(bar)) < 0) constructs from upload_firmware()
function. This is just a confusing programming practice, kill it. While at it,
replace all the uses of &devc->ftdic with plain ftdic , which is defined at
the begining.

Signed-off-by: Marek Vasut <marex@denx.de>
2014-04-30 09:45:50 -07:00
Marek Vasut 499b17e9c0 asix-sigma: Fix firmware path construction
The code silently assumed the firmware path can be no longer than 128 bytes.
This doesn't scale. This patch fixes it in such a way that it completely
rips out the run-time computation of firmware path and instead replaces it
with compile-time computation. It's true this makes the library grow by a
couple bytes, but makes the code cleaner.

Signed-off-by: Marek Vasut <marex@denx.de>
2014-04-30 09:45:50 -07:00
Marek Vasut d5fa188ac9 asix-sigma: Cleanup FPGA initialization
Rework the pre-firmware-upload FPGA initialization sequence so it matches
the documentation. Also, since this sequence is documented in a separate
section, wrap it into separate function.

Signed-off-by: Marek Vasut <marex@denx.de>
2014-04-30 09:45:50 -07:00
Marek Vasut 790c7ccc88 asix-sigma: Remove NUM_CHANNELS macro
The NUM_CHANNELS macro is inflexible, since in 100MHz and 200MHz modes
we don't support 16 channels. Moreover, it's only used to limit the size
of array of channel labels, which can be done in much cleaner way.

Signed-off-by: Marek Vasut <marex@denx.de>
2014-04-30 09:45:50 -07:00
Marek Vasut b1648dea88 asix-sigma: Document sampling rate table
Add comments to the sampling rate table explaining how the frequencies
are selected and where do those numbers come from.

Signed-off-by: Marek Vasut <marex@denx.de>
2014-04-30 09:45:50 -07:00
Bert Vermeulen 6868626bd3 asix-sigma: Acquisition fixes. 2014-04-30 09:45:50 -07:00
Bert Vermeulen 06b5d7f70d fx2lafw: Don't send more samples than requested.
It's the new law.
2014-04-24 21:04:23 +02:00
Bert Vermeulen b0ccd64d02 WIP 2014-04-23 19:27:31 +02:00
Bert Vermeulen 1e1dac0c07 ols: Allow disabling all channels.
This fixed bug 316.
2014-04-21 14:46:49 +02:00
Bert Vermeulen 7e7b7fb7d3 Removed ALSA driver.
This driver has been unmaintained for years, and was never good code
to begin with. It's also questionable whether it was ever useful,
particularly with the demo driver now supporting various analog
signalling.
2014-04-19 13:37:53 +02:00
Uwe Hermann 55f98c6533 sr_dev_inst_new(): Use NULL (not "") if version unknown/nonexisting.
Unify the whole code-base to use NULL there, not a mix of "" and NULL.
2014-04-13 18:57:54 +02:00
Uwe Hermann cfe01d0607 chronovu-la: Show errors other than "device not found".
This can be useful for the user to see, e.g. for permission related
issues (device is there, but cannot be accessed).
2014-04-13 18:57:53 +02:00
Aurelien Jacobs 99af83b738 rigol-ds: fix long memory depth setting on DS1000 2014-04-06 22:47:44 +02:00
Aurelien Jacobs f589a6d499 scpi_usbtmc_libusb: disable all clear_halt for Rigol DS1000 2014-04-06 22:47:44 +02:00
Aurelien Jacobs 50e6311a1b scpi_usbtmc_libusb: disable bulk_out clear_halt for Rigol DS1000
fix hangup issue with Rigol firmware version 00.02.02.02.00
2014-04-06 17:32:59 +02:00
Aurelien Jacobs eb28f1b7b2 fx2lafw: fix possible use of uninitialized variable (gcc-4.9 warning fix)
hardware/fx2lafw/protocol.c: In function 'fx2lafw_command_start_acquisition':
hardware/fx2lafw/protocol.c:113:7: warning: 'cmd.flags' may be used uninitialized in this function [-Wmaybe-uninitialized]
   (cmd.flags & CMD_START_FLAGS_CLK_48MHZ) ? "48" : "30");
       ^
2014-04-06 17:32:46 +02:00
Uwe Hermann 38d3246497 Various drivers: Expose SR_CONF_TRIGGER_TYPE.
Without this, sigrok-cli --show (for example) will not show the
supported trigger types.
2014-04-02 17:20:10 +02:00
Uwe Hermann 69bdcd8bb4 chronovu-la: LA16 has fewer max. samples than LA8.
Each LA16 sample is 16bits wide (LA8 samples are 8 bits wide). Adapt the
number returned for SR_CONF_LIMIT_SAMPLES in config_list() accordingly.
2014-04-02 17:20:10 +02:00
Uwe Hermann 05266f36a5 chronovu-la: Fix byte order for LA16 samples sent to the bus. 2014-04-02 17:20:10 +02:00
Uwe Hermann b0efc84e12 chronovu-la: Document that streaming is not possible.
This closes bug #261.
2014-04-02 17:20:10 +02:00
Uwe Hermann 7b3567126c Rename 'chronovu-la8' driver to 'chronovu-la'.
The driver now also supports the LA16 device (and possibly others in the
future).
2014-04-02 17:20:09 +02:00
Uwe Hermann 00910580bb la8: Add support for the ChronoVu LA16.
The ChronoVu LA16 is a new logic analyzer from ChronoVu with some
differences in features compared to the LA8, e.g.

 - Supports 16 channels (instead of 8).
 - Max. 200MHz samplerate (instead of 100MHz).
 - Supports state triggering (low and high channel value) and edge triggering
   (rising or falling edge), the LA8 only supports state triggering.

This driver now supports both the LA8 and LA16, but it needed a few
changes:

 - Add support for detecting multiple device instances at all.
 - Add support for both LA8 and/or LA16 devices being detected.
 - Add a device profile struct for LA8-/LA16-specific device properties.
 - Move the samplerates list to devc (it's different for LA8 and LA16).
 - Split scan() into two functions, one for scanning, one for adding a device.
 - Expand some variables and fields from uint8_t to uint16_t in order to
   support 16 channels.
 - Update the samplerate related functions to support the LA16's 200MHz.
 - Various other minor updates in order to better handle both device types.
 - Various error handling improvements and simplifications.
 - Also, replace time() with g_get_monotonic_time() everywhere.

This also fixes bug #247 (which was related to incorrect handling of
resources during scan and open of the device, which was exposed by
PulseView allowing multiple consecutive scan/close/open calls).
2014-04-02 17:20:09 +02:00
Uwe Hermann b172c1301e la8: Cleanups, cosmetics, simplifications.
Also, make some LA8 references more generic in preparation of
LA16 support.
2014-04-02 17:20:09 +02:00
Uwe Hermann 9503583268 demo: Fix typos. 2014-03-30 18:06:54 +02:00
Uwe Hermann 8bd3daa48a Various drivers: Drop some unneeded lines. 2014-03-30 18:06:45 +02:00
Bert Vermeulen 0bcfc9dcd8 rigol-ds: Don't close SCPI handle we didn't open. 2014-03-27 15:13:24 +01:00
Aurelien Jacobs 5d336f1130 rigol-ds: Add the TRIGGER_SLOPE entry to config_get() and config_list() 2014-03-25 23:11:31 +01:00
Uwe Hermann 61e77667de hameg-hmo: Change some PG_/pg_ names to CG_/cg_.
This fixes parts of bug #259.
2014-03-25 21:02:05 +01:00
Uwe Hermann fca75cbb74 A few more random 'probe' to 'channel' changes.
This fixes parts of bug #259.
2014-03-25 20:58:54 +01:00
Uwe Hermann f3ca73edd2 Rename a few more API calls with 'probe' in their name.
This fixes parts of bug #259.
2014-03-25 20:58:54 +01:00
Uwe Hermann 3f239f0803 Rename various *PROBE* macros to *CHANNEL*.
This fixes parts of bug #259.
2014-03-25 20:58:54 +01:00
Uwe Hermann 56d0d24535 Rename sr_probe_new() to sr_channel_new().
This fixes parts of bug #259.
2014-03-25 20:58:54 +01:00
Uwe Hermann ba7dd8bbb8 Replace 'probe' with 'channel' in most places.
Also, consistently use 'ch' for channel variables. This matches how we
consistently use sdi, devc, and so on all over the code-base.

This fixes parts of bug #259.
2014-03-25 20:58:54 +01:00
Uwe Hermann 91aea754aa Rename 'struct sr_probe' to 'struct sr_channel' everywhere.
This fixes parts of bug #259.
2014-03-25 20:58:54 +01:00
Uwe Hermann 53b4680fce Consistently use 'cg' for channel group variables.
This matches how we consistently use sdi, devc, and so on all over
the code-base.

This fixes parts of bug #259.
2014-03-25 20:58:54 +01:00
Uwe Hermann a68bf88e3a Replace channel_group.probes with channel_group.channels.
This fixes parts of bug #259.
2014-03-25 20:58:54 +01:00
Uwe Hermann 40fd0264f9 Replace some 'pg' with 'cg'.
(since 'probe groups' are now called 'channel groups')

This fixes parts of bug #259.
2014-03-25 20:58:54 +01:00
Uwe Hermann 660e398fe9 Replace 'probe group' with 'channel group' everywhere.
The name 'probe' (and thus 'probe group') is a relic from the times when
sigrok was mostly about logic analyzers. Nowadays we support a lot more
device types where 'probe' is not really a good term and 'channel' is
much better suited.

This fixes parts of bug #259.
2014-03-25 20:58:54 +01:00
poljar (Damir Jelić) 3fd2dca207 hameg-hmo: Add missing cases in config_get(). 2014-03-25 20:48:58 +01:00
poljar (Damir Jelić) bbabdaf1e2 hameg-hmo: Add the TRIGGER_SLOPE entry to config_list(). 2014-03-25 20:48:58 +01:00
poljar (Damir Jelić) 422a1c0d58 hameg-hmo: Fix the logic for the horizontal trigger position in config_set()
This patch fixes the logic calculating the trigger position as well as the
(hopefully) last remaining locale issue.
2014-03-25 20:48:58 +01:00
Matthias Heidbrink e83437ae20 serial-dmm: Implemented support for Voltcraft M-3650CR (driver voltcraft-m3650cr). 2014-03-24 22:57:27 +01:00
Matthias Heidbrink 1656e47def serial-dmm: Implemented support for Voltcraft ME-42 (driver voltcraft-me42). 2014-03-24 17:42:52 +01:00
Uwe Hermann 67bd805523 Switch to a non-recursive automake setup.
Instead of >= 44 Makefile.am's we now only have one top-level
Makefile.am, and use the 'subdir-objects' automake option to
handle the build via non-recursive (auto)make.

This has the advantage of fewer (boilerplate or other) files and less
clutter in general, as well as performance advantages since the new
setup can build many files in parallel (with 'make -j'), not only 2 or 3
files within the same (e.g. hardware/xxxx/* subdirectory) and also since
we no longer need to build intermediate libtool helper libs per subdirectory.

A quick, non-scientific test build on a quad-core laptop with 'make -j 4'
yields a build time reduction from 35s to 19s.

All autotools features that worked before are still intact without any
regressions, including the Make targets 'install', 'uninstall', 'check',
'dist', 'clean', 'distclean' and so on, as well as all the usual portability
handling (build works on any OS, with any Make implementation such as
GNU Make or BSD Make, with any shell such as sh/ksh/zsh/bash/dash, etc. etc.)
and features such as out-of-tree build support, cross-compile support,
testsuite support (also with colored output), "silent make rules", etc. etc.
2014-03-20 13:10:05 +01:00
Uwe Hermann 9ad05e6cd2 scpi_usbtmc_libusb.c: Fix two error checks.
Two error checks had a missing "ret = ", which lead to an incorrect
value being passed to libusb_error_name().

Also, lower the level for those messages from sr_err() to sr_dbg()
since they're not fatal.
2014-03-11 19:48:47 +01:00
Uwe Hermann d8cbd659ce scpi_usbtmc_libusb.c: Consistently check for < 0 (libusb calls). 2014-03-11 19:48:00 +01:00
Uwe Hermann a84f6ad389 Fix 'aquisition' typo in a few places. 2014-03-11 19:42:20 +01:00
Matthias Heidbrink 7f7f6a2e0c gmc-mh-1x-2x: Whitespace fixes (cosmetic). 2014-03-08 11:04:27 +01:00
Matthias Heidbrink dc05dd6069 visa: Fixed missing header warnings/uninitialized variable. 2014-03-08 10:56:16 +01:00
Matthias Heidbrink d1d3b7dff9 gmc-mh-1x-2x: Cosmetic fixes for Metrahit 25S. 2014-03-08 10:50:21 +01:00
Matthias Heidbrink c6c63b08af gmc-mh-1x-2x: Fixed 300 µA range scaling. 2014-03-08 10:40:38 +01:00
Fabio 0bc3ab92e6 Fluke189 support
I can confirm that the 189 uses the same "QM" command as the 187:
<-- QM\r
--> QM,+03.225 mV AC
2014-03-05 12:33:14 +01:00
Uwe Hermann 0ab702601d brymen-bm86x: Remove std_dev_clear() wrapper. 2014-02-28 13:13:09 +01:00
Aurelien Jacobs ecaa89af0e brymen-bm86x: actual driver implementation 2014-02-27 22:50:09 +01:00
Aurelien Jacobs 8d9c8554a5 brymen-bm86x: Initial driver skeleton. 2014-02-27 22:50:09 +01:00
Bert Vermeulen a66307424e Remove std_dev_clear() wrappers from drivers. 2014-02-26 21:37:18 +01:00
Uwe Hermann 0294a409b8 conrad-digi-35-cpu: Add missing Makefile.am, minor cosmetics. 2014-02-12 15:29:14 +01:00
Matthias Heidbrink c6a2843a58 conrad-digi-35-cpu: Implemented driver. 2014-02-12 15:10:07 +01:00
Matthias Heidbrink 823b4e5817 conrad-digi-35-cpu: Initial driver framework. 2014-02-12 15:10:06 +01:00
Uwe Hermann a90061e5d1 gmc-mh-1x-2x: Shorten driver names a bit. 2014-02-12 15:04:54 +01:00
Matthias Heidbrink fadd07072b gmc-mh-1x-2x: Support for interface SI232-II with driver gmc-mh-2x-bd232. 2014-02-11 18:05:25 +01:00
Matthias Heidbrink c90beca780 gmc-mh-1x-2x: Added new driver gmc-mh-2x-bd232. 2014-02-11 18:05:25 +01:00
Matthias Heidbrink 6392d5992b gmc-mh-1x-2x: Cleanup, docs, minor fixes. 2014-02-11 18:04:54 +01:00
Daniel Elstner d8b6b28b80 scpi_visa: Add missing callback parameter.
(scpi_visa_dev_inst_new): Fix serious compiler warning due to
missing drvc parameter in prototype.
2014-02-07 20:20:20 +01:00
Uwe Hermann 52f6951c4e scpi_usbtmc_libusb: Consistent libusb error handling. 2014-02-07 19:42:27 +01:00
Uwe Hermann ed840c8612 scpi: Disable scpi_usbtmc in favor of scpi_usbtmc_libusb for now.
Having both in the list will "find" the same device twice.
2014-02-07 19:01:45 +01:00
Aurelien Jacobs 2a0f6924d2 usb: remove unused sr_usb_find_usbtmc() 2014-02-07 18:53:04 +01:00
Aurelien Jacobs 20ed3ceee7 scpi: add a libusb based implementation of usbtmc 2014-02-07 18:53:04 +01:00
Aurelien Jacobs ca28abd6a5 hameg-hmo: use the new scpi scan API 2014-02-07 18:53:04 +01:00
Aurelien Jacobs 9d3ae01b37 rigol-ds: use the new scpi scan API 2014-02-07 18:53:04 +01:00
Aurelien Jacobs b541f8376d scpi: add a generic scan API and implement it in usbtmc and serial transport
note that sr_usb_find_serial() is copied from the hameg-hmo driver
2014-02-07 18:53:04 +01:00
Aurelien Jacobs 17bdda5868 scpi: add a struct drv_context parameter to scpi_dev_inst_new() 2014-02-07 18:53:04 +01:00
Aurelien Jacobs 6e94eb4142 rigol-ds: apply :KEY:LOCK DISABLE only to DS1K 2014-02-07 18:53:04 +01:00
Aurelien Jacobs 3918fbb0cf rigol-ds: properly end WAIT_TRIGGER event handling 2014-02-07 18:53:04 +01:00
Aurelien Jacobs 83dbd9f09c rigol-ds: properly deal with dev_close() getting called multiple times 2014-02-07 18:53:04 +01:00
Uwe Hermann 7ad4e2b80b scpi_visa.c: Minor cosmetics. 2014-02-03 00:24:13 +01:00
Martin Ling 1fb2312f99 Add librevisa SCPI backend. 2014-02-02 22:42:25 +01:00
Uwe Hermann a6c12f3f70 Drop unneeded comments. 2014-01-30 17:52:44 +01:00
Daniel Elstner 6358f0a956 sysclk-lwla: Implement SR_CONF_CLOCK_EDGE setting. 2014-01-30 12:04:42 +01:00
Bert Vermeulen 625763e2c2 ols: Code cleanup and more debug output. 2014-01-30 11:58:07 +01:00
Bert Vermeulen 016e72f30e ols: Fix endianness problems in protocol. 2014-01-29 15:34:24 +01:00
Daniel Elstner e6e54bd253 sysclk-lwla: Add support for external trigger input.
Implement the configuration setting TRIGGER_SOURCE with the
choices CH (logic channels) and TRG (external trigger input).
Also implement the TRIGGER_SLOPE setting for selecting the
edge to trigger on (rising or falling).
2014-01-28 23:34:53 +01:00
Daniel Elstner e0df15d436 sysclk-lwla: Simplify and optimize word extraction.
It turns out that all LWLA protocol responses consist either
of 32-bit units or of 32-bit units combined into 64-bit units.
Thus it makes sense to double the basic unit size for reading
from 16 bit to 32 bit.
We cannot do the same for command messages though, as those
actually do use 16-bit quantities in some places, and 32-bit
arguments are not always aligned to 32-bit boundaries.

(acquisition_state.xfer_buf_in): Change unit type to uint32_t,
and update related macros and code accordingly.
(LWLA_TO_UINT32): New macro to replace LWLA_READ32, operating
directly on 32-bit values instead of pointers to 16-bit units.
Make use of a compiler-recognized idiom for bitwise rotation
to efficiently swap the 16-bit halves of a 32-bit word.
(LWLA_TO_UINT16): New macro to replace LWLA_READ16.
(LWLA_READ64): Remove unused macro.
(LWLA_WORD_[0123]): Slightly simplify 16-bit word extraction.
2014-01-28 23:34:53 +01:00
Daniel Elstner 5413df1952 sysclk-lwla: Limit use of SR_ERR_ARG to user-supplied arguments.
The return code SR_ERR_ARG is intended for reporting unsupported
or inapplicable device configuration settings and is not a hard
error.  In order to indicate failure of internal sanity checks,
use SR_ERR_BUG instead.
2014-01-28 23:26:16 +01:00
poljar (Damir Jelić) 1c873c114c scpi: Limit the log message in get_string() to 70 characters. 2014-01-28 21:25:34 +01:00
poljar (Damir Jelić) 9d156555a5 demo: Cast to double while calculating the pattern frequency.
Without the cast non integer frequencies weren't possible (e.g. with a sampling
frequency of 50Hz we would end up with a signal frequency of 2Hz instead of
2.5Hz). The result were signals which had an incorrect number of samples per
period.

BugLink: http://sigrok.org/bugzilla/show_bug.cgi?id=297
2014-01-28 21:23:54 +01:00
Bert Vermeulen 464d49360a rigol-ds: Deal with dev_close() getting called multiple times. 2014-01-27 21:19:41 +01:00
Daniel Elstner ca9b9f4834 hwdriver: Change TRIGGER_SLOPE setting to string type.
Drivers interpreted the uint64 values to the SR_CONF_TRIGGER_SLOPE
configuration setting in different ways.  In order to orthogonalize
the API, change the type of the setting to a string with the same
format as uses for logic probes.
2014-01-27 20:55:01 +01:00
Bert Vermeulen fe90fbb782 demo: Require sample limit. 2014-01-25 21:20:29 +01:00
Daniel Elstner c2066c2104 sysclk-lwla: Load bitstream files in RBF format.
Modify the bitstream loading routine to work directly with the
Raw Binary Files (.rbf) generated by Altera tools.  Previously,
a custom format was used which was basically an RBF preceded by
a 4-byte header specifying the transfer length.
2014-01-25 20:44:42 +01:00
Bert Vermeulen 7f4975b440 demo: Keep separate counters for logic and analog sources.
Since they have different internal buffer sizes, their output counters
are not in sync. See bug 295.
2014-01-25 20:39:50 +01:00
Martin Ling fe0d9caa88 rigol-ds: Fix a couple of compile warnings. 2014-01-23 23:12:37 +01:00
Daniel Elstner ee38c8ba3e sysclk-lwla: Implement config_commit() callback.
Move pre-acquisition hardware setup to the new config_commit()
callback.  At the moment, the only setting applied at commit
time is switching the clock source, which involves uploading
a new bitstream to the FPGA.
2014-01-23 02:43:16 +01:00
Daniel Elstner 43db343618 sysclk-lwla: Implement config_probe_set() callback.
Move setup of channels and trigger masks to the new probe
configuration callback.  Although the actual hardware setup
still happens just before acquisition, the new approach
already has the advantage that invalid settings are caught
early.
Also, it turns out that the LWLA1034 allows triggering on
channels which are not enabled for data acquisition.  This
feature is now supported as well.
2014-01-23 02:36:13 +01:00
Daniel Elstner 50cad98d1b sysclk-lwla: Do not reset drv_context.instances on scan.
Apparently, frontends may call scan() more than once to accumulate
multiple devices, so do not reset the instance list pointer at the
start of each scan.  Also, number devices continuously across scans.
2014-01-23 02:36:13 +01:00
Daniel Elstner 99c76642aa sysclk-lwla: Advertise SR_CONF_CONN option. 2014-01-23 02:36:13 +01:00