Commit Graph

197 Commits

Author SHA1 Message Date
Uwe Hermann cb93f8a927 Other method to avoid "unused var" compiler warnings.
The '(void)varname' method is nicer than 'varname = varname' and also
prevents warnings when compiling sigrok with clang instead of gcc.
2011-11-24 22:57:48 +01:00
Uwe Hermann 719c5a934c Fix some compiler warnings. 2011-11-15 21:05:40 +01:00
Uwe Hermann 548b08e55c Drop unneeded skeleton files.
They're not too useful as they mostly consist of a list of function names,
and that list is already available in the respective struct. The wiki
API docs and the code in the various hardware/output drivers serve as
useful examples already, no need for additional files.
2011-05-05 13:06:12 +02:00
Uwe Hermann 02604ed6de Initial support for CSV as output format. 2011-04-27 00:25:57 +02:00
Uwe Hermann b53738baf7 Replace g_malloc{0,} with g_try_malloc{0,}.
The g_malloc()/g_malloc0() versions exit/segfault if not enough memory
is available, which is not a good thing in libsigrok.

Instead, we use the g_try_malloc()/g_try_malloc0() variants, which
return NULL if not enough memory is available, so that the caller can
handle the error properly.
2011-04-16 18:08:15 +02:00
Uwe Hermann 50959ddcdc gnuplot output: Optimize by only storing changes.
Only output new lines in gnuplot output if there have been changes in
the samples (similar to what VCD does). As long as the first and last
sample are output, the resulting plot looks OK.

This reduces the size of the output file from roughly 200MB to just 60KB
in one specific test setup (depends on the number of probes and on the
signal, of course). The time and CPU load required to generate the gnuplot
output and the resulting plot (PNG or other) is also drastically reduced
from multiple minutes to roughly 30 seconds (again, depends on various
things).

Thanks Ken Mobley of ChronoVu for the report.
2011-04-15 21:49:22 +02:00
Uwe Hermann b08024a836 libsigrok: Introduce sr_dbg/sr_info/sr_warn/sr_err.
We should use these (internal) functions in libsigrok exclusively from
now on, i.e. no more use of glib's g_debug() etc.

These functions are only for libsigrok, the frontends use whatever
logging mechanism is suitable there.
2011-04-14 10:11:08 +02:00
Uwe Hermann 8c48f17944 Add chronovu-la8 output file format. 2011-04-10 23:59:38 +02:00
Uwe Hermann 20ebd1fe1d gnuplot output: More error checks. 2011-04-10 23:03:34 +02:00
Uwe Hermann cdb3573ceb input/output formats: s/extension/id/.
The struct entry 'extension' is not really a (filename) extension, but
rather a unique ID used for input or output formats, e.g. in the sigrok
CLI or GUI interface. Thus, rename it accordingly.
2011-04-10 23:03:34 +02:00
Uwe Hermann 819184ee68 Binary output: Add more error checks. 2011-04-10 23:03:33 +02:00
Uwe Hermann d494a4aa9d input/output formats: Explicit struct member names.
This makes it immediately clear what an entry is supposed to be, no
need to look it up in some header file.
2011-04-10 23:03:33 +02:00
Uwe Hermann 847c21bc65 Hook up output/text directory with autotools.
This is needed for 'make distcheck' to work.

Also, add missing text.h to the list of source files.
2011-04-03 20:15:12 +02:00
Bert Vermeulen 4487177c79 output_ols: disabled cursors don't really need to be listed 2011-04-03 06:18:05 +02:00
Uwe Hermann 120b259ea8 Drop obsolete vcd_header. 2011-03-03 20:24:25 +01:00
Uwe Hermann d078d2e5f3 Make some more items 'static'. 2011-03-03 20:24:25 +01:00
Uwe Hermann 59df0c77e2 Add SR_ prefix to the KHZ/MHZ/GHZ macros. 2011-03-03 20:24:24 +01:00
Uwe Hermann 9688b443f6 Add SR_ prefix for MAX_NUM_PROBES/MAX_PROBENAME_LEN. 2011-02-20 21:16:26 +01:00
Uwe Hermann 54ac5277c5 Constify some more 'char *' parameters. 2011-02-20 21:16:26 +01:00
Uwe Hermann 809c5f2011 Add sr_ prefix for analog stuff some structs. 2011-02-20 21:16:24 +01:00
Uwe Hermann 77b454421a Disable analog bits/gnuplot output for now. 2011-02-20 21:16:20 +01:00
Bert Vermeulen 305bde4d42 implement version 1.3 of the OLS output format, now streaming 2011-02-12 06:18:16 +01:00
Uwe Hermann 2bf4aca64a Add sr_ prefix for device related API functions. 2011-02-08 22:28:02 +01:00
Uwe Hermann 1afe89897c Add sr_ prefix for 'struct probe'. 2011-02-08 22:27:58 +01:00
Bert Vermeulen 6e738600eb output_ols: now fully compliant with spec 2011-02-01 06:13:32 +01:00
Bert Vermeulen 3a28509817 don't just assume a device has a samplerate setting 2011-02-01 02:33:54 +01:00
Bert Vermeulen 40f5ddac01 move samplerate/period printers and parsers into libsigrok 2011-01-31 22:29:40 +01:00
Uwe Hermann 5a2326a71b SR_ prefix for all public enums. 2011-01-30 18:32:59 +01:00
Uwe Hermann a00ba01228 Change all sigrok_ prefixes to sr_. 2011-01-30 18:32:55 +01:00
Uwe Hermann f50f3f40d9 Add sr_ prefix to input/output structs. 2011-01-30 18:32:54 +01:00
Uwe Hermann e46b8fb154 Change SIGROK_ prefix to SR_. 2011-01-30 18:32:53 +01:00
Uwe Hermann ff35879bb7 Fix some compiler warnings. 2011-01-27 23:17:47 +01:00
Bert Vermeulen 97554432e8 split output_text into more manageable pieces 2011-01-22 04:35:02 +01:00
Uwe Hermann 5819184b22 Remove duplicate FIRMWARE_DIR includes.
We use AC_DEFINE_UNQUOTED in configure.ac now to put the FIRMWARE_DIR #define
in the config.h file, which is included where we need the #define.
2011-01-21 21:14:37 +01:00
Daniel Ribeiro 81bbdf6a6a add incomplete DF_ANALOG support to output_gnuplot.c
RAW->Voltage conversion is not implemented yet, its hardcoded for
signed 16bit conversion.
2011-01-21 16:11:44 -02:00
Daniel Ribeiro 6eb0e3ea95 change output_text.c to support analog
Only the "bits" output format was converted.
Analog values, are scaled down to A-Z letters.
2011-01-21 02:12:48 -02:00
Daniel Ribeiro f3163a6c2e make output_analog.c = output_text.c 2011-01-21 02:12:48 -02:00
Håvard Espeland 32c0551ba6 output_vcd: Make timestamp work on 32-bit machine. 2011-01-18 23:17:55 +01:00
Håvard Espeland afa8f8449a output_text: Mark trigger at correct position.
ASCII output does not separate groups of samples with
and must be handled separately.
2011-01-18 22:14:36 +01:00
Håvard Espeland 6ef7a8cb5d output_text: Fix ASCII edge case. 2011-01-18 22:13:50 +01:00
Håvard Espeland d4f228d094 output_text: Add ASCII output. 2011-01-17 22:56:14 +01:00
Håvard Espeland b33e7d7058 output_vcd: Emit timestamps as time, not sample num. 2011-01-16 17:55:51 +01:00
Håvard Espeland 08b488b848 output_vcd: Remember samples between packets.
Fixes two bugs in vcd output:
1) Waveform did not match original input when viewed in gtkwave.
2) No vcd output when using 1 MHz sampling on Sigma.
2011-01-16 17:34:49 +01:00
Uwe Hermann 10c471ab13 Fix warnings. 2011-01-16 14:18:26 +01:00
Bert Vermeulen fbf1ff5d22 clean up output_vcd module
use self-expanding strings, better standards conformance
2011-01-16 04:34:45 +01:00
Uwe Hermann ab224f7b61 Initial support for the OLS output format.
This is the file format for the OpenBench Logic Sniffer "Alternative" client.
Details: https://github.com/jawi/ols/wiki/OLS-data-file-format

This is work-in-progress.
Currently the number of samples is hardcoded to 10000. Also, this will
require a real logic analyzer as input at the moment, and will not yet
work with the "demo" driver.
2011-01-15 19:05:14 +01:00
Håvard Espeland 9d7ab9ba3b output_text: Allocate more memory for output
The trigger line was forgotten. Allocate 512 bytes extra.
2011-01-15 18:24:01 +01:00
Håvard Espeland 3aa403e858 output_text: Allocate enough memory for output 2011-01-15 16:12:12 +01:00
Uwe Hermann 484760d1a8 Cosmetics. 2011-01-15 15:57:54 +01:00
Bert Vermeulen f7606f9b75 fix hex output 2011-01-15 15:25:08 +01:00
Bert Vermeulen 9ab95e5408 make output modules a bit more crashproof
the event handler in output modules is now optional.
2011-01-13 07:55:35 +01:00
Bert Vermeulen 2507648e63 use us instead of µs in periods (VCD can't handle it) 2011-01-13 07:55:35 +01:00
Bert Vermeulen 78ed642035 code cleanup 2011-01-11 23:59:33 +01:00
Bert Vermeulen 655756e01d cli: new option to list output modules 2011-01-10 12:39:53 +01:00
Bert Vermeulen 9b36e360f3 output_analog: allow samples per line arg (default analog10) 2011-01-10 05:27:22 +01:00
Bert Vermeulen 1437e8934b add DF_ANALOG, and an analog output module
Samples in DF_ANALOG packets are fixed in length to sizeof(double).
2011-01-10 05:13:46 +01:00
Bert Vermeulen f0411b1d17 output modules now register the DF type they can use 2011-01-09 23:23:56 +01:00
Bert Vermeulen d4ae8eaa7c fix buffer size, various error checks 2011-01-08 15:50:14 +01:00
Bert Vermeulen 2a3f9541a4 add sigrok_period_string(), MAX_NUM_PROBES 2011-01-08 15:50:13 +01:00
Uwe Hermann 340f6e7aea Fix out-of-tree build.
Use libtool "noinst" local helper libs and use one Makefile.am per
subdir, which is the usual/preferred method. These helper libraries are
purely local and will not be installed.

This also fixes out-of-tree builds of sigrok, i.e. building in a
directory other than the sigrok source directory, e.g.

 $ cd /home/user
 $ git clone ...sigrok
 $ cd sigrok
 $ ./autogen.sh
 $ mkdir /tmp/foo
 $ cd /tmp/foo
 $ /home/user/sigrok/configure
 $ make
 $ make install

This will place all build results (.o files, .la files, etc) in the
local build directory (/tmp/foo) instead of the source directory
(/home/user/sigrok in this example). The installation directory is
selected via the --prefix configure option (/usr/local per default).
2011-01-08 03:32:25 +01:00
Uwe Hermann 757b8c628a Cosmetics, whitespace, simplifications.
Reduce code nesting a bit, constify some strings.
2011-01-08 01:49:47 +01:00
Bert Vermeulen 339729131d proper fix for output_text corner cases
limit probe names to 32 chars
2010-12-29 01:22:58 +01:00
Bert Vermeulen ee5f5e81ad fix corner cases/memory management (cli->text out) 2010-12-28 21:59:07 +01:00
Uwe Hermann 38ba252251 Use 'kHz' (not 'KHz') consistently. 2010-05-27 01:51:55 +02:00
Uwe Hermann fbe2f7945d VCD: Optimizations and fixes. 2010-05-09 22:06:30 +02:00
Uwe Hermann 086eac7c7b VCD/Gnuplot: Fix incorrect sample counter. 2010-05-09 22:06:30 +02:00
Uwe Hermann 114fb93f67 Gnuplot: Nicer output formatting. 2010-05-09 22:06:30 +02:00
Uwe Hermann 5f8c4cb363 Gnuplot: Improve column/probe name display.
This fixes incorrect probe name display if the user explicitly named
probes via '-p 1=CLK' etc.
2010-05-09 22:06:29 +02:00
Uwe Hermann e734b81a68 output_text: More error handling. 2010-05-09 22:06:29 +02:00
Uwe Hermann caf62e22c4 output_gnuplot: Simplify event(). 2010-05-09 22:06:28 +02:00
Uwe Hermann d20ba6490a output_binary: Code simplifications. 2010-05-09 22:06:28 +02:00
Uwe Hermann 1e32053cd0 Gnuplot quickfix: Increase malloc()'ed size. 2010-05-09 22:06:28 +02:00
Uwe Hermann 5cca9adbf2 VCD/Gnuplot: Store time/date in output. 2010-05-09 22:06:28 +02:00
Uwe Hermann 607b58de58 VCD/Gnuplot: Cosmetics, code simplifications. 2010-05-09 22:06:27 +02:00
Uwe Hermann a821069b34 Gnuplot output: More error handling. 2010-05-09 22:06:27 +02:00
Uwe Hermann 6b5e3ceefc VCD: Improve error handling/checking.
Check malloc()/calloc() return values and so on. Also, add missing
free() calls and some TODOs. Simplify some code.
2010-05-09 22:06:26 +02:00
Bert Vermeulen d2b36a10d7 output_text: always print sigrok version 2010-05-07 23:55:32 +02:00
Bert Vermeulen c9c1c6458c output_binary: rm TODO item
Yes, disabled probes are stripped by the filter before the
output module even gets data.
2010-05-07 23:55:32 +02:00
Bert Vermeulen 7aae74622e output: if device has no plugin, don't report samplerate 2010-05-07 23:52:48 +02:00
Håvard Espeland e273a9040e Output: Fix invalid pointer dereferencing in vcd and gnuplot. 2010-05-04 19:44:39 +02:00
Håvard Espeland 5045c217e6 cli: Show trigger event in bits plugin. 2010-05-01 00:04:07 +02:00
Bert Vermeulen 9601818842 simplify code for unused features 2010-04-18 10:57:13 -07:00
Uwe Hermann 408e719989 Refactoring and code simplifications. 2010-04-15 23:21:30 +02:00
Uwe Hermann 99c1fc59ed output: Coding style fixes. 2010-04-15 20:36:04 +02:00
Uwe Hermann 02076d69f9 Rename "bin" output module to "bits" everywhere. 2010-04-12 23:21:12 +02:00
Uwe Hermann 1c5b9d302c Add raw binary output format.
Also, rename the "bin" format to "bits" for now to avoid confusion.
2010-04-12 21:22:58 +02:00
Uwe Hermann afc8e4deb6 Fix all warnings and re-enable -Wextra. 2010-04-09 22:18:46 +02:00
Bert Vermeulen 37aea2d35c better buffer size calculation 2010-04-08 16:50:27 +02:00
Bert Vermeulen d2cd86ac26 fix off-by-one error 2010-04-08 16:50:27 +02:00
Uwe Hermann 25e7d9b115 Factor out common sigrok_samplerate_string(). 2010-04-07 20:13:57 +02:00
Uwe Hermann bc010c054b VCD output: Handle disabled probes correctly. 2010-04-06 16:54:39 +02:00
Uwe Hermann e2ad47b5b0 Gnuplot output format support. 2010-04-06 16:54:37 +02:00
Uwe Hermann e31b636df6 Start unification of libsigrok return codes.
We have SIGROK_OK for functions calls where no errors occured. All
error code names start with SIGROK_ERR and are globally unique,
negative values.

The value SIGROK_ERR is a generic/unspecified error code, all others,
such as SIGROK_ERR_MALLOC, refer to a specific error condition.

This commit renames the old SIGROK_NOK etc.
2010-04-05 18:30:14 +02:00
Uwe Hermann 5a8fda158b Allow output_format.init() to return errors. 2010-04-05 18:30:08 +02:00
Uwe Hermann 4c100f3244 More consistent spelling of "samplerate". 2010-04-05 18:30:02 +02:00
Uwe Hermann 4c9ffa83cf Initial Value Change Dump (VCD) output support. 2010-04-04 13:19:20 +02:00
Uwe Hermann a1bb33afbd Start of code base layout restructuring. 2010-04-02 20:27:54 +02:00