Commit Graph

2285 Commits

Author SHA1 Message Date
Aurelien Jacobs ea2d6d994f libsigrok-internal.h: endian neutral helper macro to write 8/16/32 bits integer to unaligned memory 2014-02-07 18:53:04 +01:00
Aurelien Jacobs a4f9c35b23 libsigrok-internal.h: add helper macro to read 8 bits integer
matching the 16 and 32 bits one
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
Martin Ling b84b7ee73d Fix building without librevisa. 2014-02-07 18:49:46 +01:00
Daniel Elstner fb9e91aed4 output/vcd: Extend output stream to last sample.
(receive): Write a dummy timestamp after the last sample
to indicate the length of the sampled stream.
2014-02-05 01:18:05 +01:00
Daniel Elstner 4f2dad42f4 input/vcd: Remove debug output from inner loops.
(parse_contents): Do not call sr_dbg() on every signal change.
This would be excessive even for sr_spew().
(read_until): Do not call ftell() just to be able to show some
number in a debug message later on.
2014-02-05 01:17:52 +01:00
Daniel Elstner cd1b0e8f79 input/vcd: Avoid truncation of shift to 32 bits.
(parse_contents): Cast constant 1 to uint64_t before shifting left.
Also fix whitespace errors.
2014-02-05 01:17:43 +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
Daniel Elstner 191c7e5f4b vcd: Remove bogus $dumpvars and $dumpoff commands.
These commands are superfluous and do not seem to make sense in
the context they were used.  Also, $dumpvars was missing an $end,
and $dumpoff was used without any content.
2014-01-30 22:11:10 +01:00
Daniel Elstner 2b6363b433 vcd: Output timestamp only once per change.
Avoid writing a new timestamp for every changed signal if multiple
signals change state simultaneously.  Also, keep signal transitions
on the same line with their timestamp to make the output easier to
inspect in a text editor.  (VCD does not care whether newlines or
spaces are used to separate tokens.)
2014-01-30 21:57:49 +01:00
Daniel Elstner 563080a8d1 vcd: Fix output for more than 8 channels.
(receive): Use probe index for sample byte selection too, not just
for bit selection.  Also simplify the indexing expressions a bit.
This fixes the problem of incorrect output for probes indices 8 to
31.
Also, use double rather than float in the timestamp calculation,
and format the result directly as floating point number rather than
converting it back to uint64_t.
Additionally, make sure that the state of all signals is written
for the very first sample in the stream.  This fixes the problem
that signals would be displayed as indeterminate until the first
change.
(context.samplecount): Make the sample counter part of the context
struct, rather than keeping it as a global static.
2014-01-30 21:23:26 +01:00
Uwe Hermann a6c12f3f70 Drop unneeded comments. 2014-01-30 17:52:44 +01:00
Uwe Hermann 85d8aa496e sr_probe->index is no longer deprecated (for now). 2014-01-30 17:48:10 +01:00
Uwe Hermann 7d4874c1b6 configure.ac: Only check for things we actually use.
Drop checks where we don't use the result (yet). We might bring back
some of those once we start actually using the result in the code.
2014-01-30 17:24:30 +01:00
Daniel Elstner 6358f0a956 sysclk-lwla: Implement SR_CONF_CLOCK_EDGE setting. 2014-01-30 12:04:42 +01:00
Daniel Elstner 860bc59b0f hwdriver: Add SR_CONF_CLOCK_EDGE option.
Allow the edge of an external clock input to be configured by
means of an SR_CONF_CLOCK_EDGE configuration setting.  This is
a string option with the same format as SR_CONF_TRIGGER_SLOPE.
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
Bert Vermeulen aa48adf960 Properly publish samplerate when loading session file. 2014-01-25 12:44:00 +01:00
Uwe Hermann 3a84104080 sr file format: Bump version to 2.
The *.sr (libsigrok session) file format has changed since the last
libsigrok release. Frontends using older libsigrok versions will not
be able to read *.sr files created by frontends using the new file format.

Thus, bump the version number of the file format to 2.

Current libsigrok will read both version 1 and version 2 files
correctly, and always write version 2 files.
2014-01-23 23:34:48 +01:00
Martin Ling fe0d9caa88 rigol-ds: Fix a couple of compile warnings. 2014-01-23 23:12:37 +01:00
Bert Vermeulen e36aae989c output/csv: Drop last separators as needed. 2014-01-23 23:11:34 +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
Martin Ling 4472867a9f rigol-ds: Don't run rigol_ds_block_wait() code unless supported. 2014-01-23 01:42:34 +01:00
Martin Ling aff00e4088 rigol-ds: Fix partial read handling in header parser. 2014-01-23 01:42:34 +01:00
Martin Ling 8943049cd4 scpi_serial: Reimplement to allow scpi_read_complete() to work correctly. 2014-01-23 01:42:34 +01:00
Martin Ling 824eb2acfd rigol-ds: Fix divide by zero when no analog probes selected. 2014-01-23 01:42:34 +01:00
Martin Ling 7d63347e90 rigol-ds: Stop capture cleanly on read errors. 2014-01-23 01:42:33 +01:00
Martin Ling ae3a191366 rigol-ds: Improve protocol debugging output, abort on read errors. 2014-01-23 01:42:33 +01:00
Martin Ling 2b399703d1 rigol-ds: Only protocol v3 adds trailing linefeeds to data blocks. 2014-01-23 01:42:33 +01:00
Martin Ling a849c43a50 scpi_usbtmc: Improve debugging output. 2014-01-23 01:42:33 +01:00
Martin Ling 569d4dbd3e rigol-ds: Overhaul vendor/series/model info and protocol variants. 2014-01-23 01:42:33 +01:00
Martin Ling e086b750fa rigol-ds: Overhaul VS5000 and DS1000 support.
This change moves the handling of series differences out to the points in the
code where they actually matter, unifying the overall structure of the code.

It also adds new VS5000/DS1000 series equivalents for commands that were
previously only implemented on the later models.

After this change, trigger waiting and the 'Memory' data source are supported
on the VS5000/DS1000 series.
2014-01-23 01:42:33 +01:00
Martin Ling 38354d9d9e rigol-ds: Use common rigol_ds_config_set() function throughout. 2014-01-23 01:42:33 +01:00