SQ50 patches for libsigrok
Go to file
Lars-Peter Clausen 5af666a94e sr: fx2lafw: Calculate buffer size and timeout based on sample rate
Currently timeout and buffer size are hard-coded in the fx2lafw driver which is
non-optimal if we want to get good results at both high and low sample rates.

The timeout is hard-coded to 40ms, which doesn't work well when sampling at
a low sample rate. E.g. at 20kHz filling all available buffer space alone takes
6 seconds. So naturally we'll see a lot of transfers timeout in this case.

The buffer size is hard-coded to 4096 bytes, which does not work well with high
sample rates. E.g. at 24MHz these 4096 bytes are enough space for 0.17ms of
data. The total buffer size is enough for about 5ms of data. Sooner or later the
application won't be able to resubmit a transfer within this time span and the
device will abort data acquisition. Usually this happens within the first few
seconds of sampling.

This patch adds a few new helper functions which calculate the buffer size and
timeout based on the current sample rate.

The buffer size is chosen to be large enough to hold about 10ms of data and it
also must be a multiple of 512 bytes since the firmware will send us the data
in 512 byte chunks.

The timeout is set to the time it would take to fill the whole available buffer
space plus a 25% headroom to accommodate for jitter. This is more than enough,
but there is no need to make the timeout a tight deadline, since it is only
meant as a last resort in case the device stops submitting data. And in this
case data acquisition will be aborted anyway.

The patch also limits the the number of transfers so that the total buffer
space is not much more of 500ms. This will ensure that we do not have to
wait too long when aborting data acquisition.

This patch also significantly reduces the number of context switches when
sampling at a higher sample rate. On my system for example the CPU load of
sigrok-cli when sampling at 24MHz goes down from ~25% to 3-4%.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2012-06-28 00:40:52 +02:00
contrib sr: add udev entry for Victor 70C multimeter 2012-06-05 18:18:23 +02:00
hardware sr: fx2lafw: Calculate buffer size and timeout based on sample rate 2012-06-28 00:40:52 +02:00
input sr: change all drivers to use SR_DF_META_LOGIC 2012-05-30 23:55:36 +02:00
output sr: new output format 'float', just floating point values 2012-06-19 02:05:28 +02:00
.gitignore sr/srd: Add ChangeLog to ignore list, it's generated. 2012-03-31 12:05:20 +02:00
COPYING sr/srd: Move some files to their resp. dirs. 2011-12-30 11:14:05 +01:00
Doxyfile Doxygen config files: Initial configuration. 2011-02-08 23:59:14 +01:00
Makefile.am sr: New default firmware dir: $prefix/share/sigrok-firmware. 2012-05-30 00:00:33 +02:00
NEWS cli/gtk/qt: Now all require libsigrok >= 0.2.0 (API changes). 2012-06-01 00:36:52 +02:00
README sr/srd/cli: require glib version >= 2.28 2012-06-23 01:26:20 +02:00
autogen.sh sr/srd/cli: Fix compiling with Homebrew. 2012-05-15 20:58:20 +02:00
backend.c sr: No need for dynamic hardware driver registration. 2012-02-23 00:28:20 +01:00
configure.ac sr/srd/cli: require glib version >= 2.28 2012-06-23 01:26:20 +02:00
datastore.c sr: backend/zeroplus: Improve debug output. 2012-06-19 23:33:50 +02:00
device.c sr: Made hwcap const 2012-05-31 19:51:09 +01:00
filter.c sr: out: Use uint8_t (not char) for buffers. 2012-03-31 11:33:43 +02:00
hwdriver.c sr: Unfinished Mastech VA18B (DMM) support. 2012-06-21 23:56:24 +02:00
libsigrok.pc.in sr: SR_PACKAGE_VERSION_* for consistency. 2012-03-31 11:35:47 +02:00
log.c sr/srd: s/handler/callback/. 2012-03-04 15:10:10 +01:00
session.c sr: backend/zeroplus: Improve debug output. 2012-06-19 23:33:50 +02:00
session_driver.c sr: Made the dev_config_set parameter a const pointer 2012-05-31 19:51:11 +01:00
session_file.c sr: s/err/ret/ for consistency. 2012-03-21 23:20:06 +01:00
sigrok-internal.h sr: fx2lafw: Fix a firmware upload bug on 32bit systems. 2012-05-30 09:30:18 +02:00
sigrok-proto.h sr: Made hwcap const 2012-05-31 19:51:09 +01:00
sigrok.h.in sr: analog: Add MQ and UNIT enums. 2012-06-20 23:55:23 +02:00
strutil.c sr: Made the dev_info_get return value const 2012-05-31 19:51:10 +01:00
version.c sr: Add functions to query sr version(s). 2012-04-15 20:33:45 +02:00

README

-------------------------------------------------------------------------------
README
-------------------------------------------------------------------------------

The sigrok project aims at creating a portable, cross-platform,
Free/Libre/Open-Source logic analyzer software that supports various
logic analyzer hardware products.

libsigrok is a shared library written in C which provides the basic API
for talking to logic analyzer hardware and reading/writing the acquired data
into various input/output file formats.


Requirements
------------

 - git
 - gcc (>= 4.0)
 - make
 - autoconf >= 2.63
 - automake >= 1.11
 - libtool
 - pkg-config >= 0.22
 - libglib >= 2.28.0
 - libusb >= 1.0.5 (for most logic analyzer hardware)
 - libzip >= 0.8
 - libftdi >= 0.16 (for some logic analyzer hardware)
 - libudev >= 151 (for some logic analyzer hardware)


Building and installing
-----------------------

In order to get the libsigrok source code and build it, run:

 $ git clone git://sigrok.git.sourceforge.net/gitroot/sigrok/sigrok
 $ cd sigrok/libsigrok
 $ ./autogen.sh
 $ ./configure
 $ make

For installing libsigrok:

 $ make install

Please see the following wiki pages for more detailed instructions:

 http://sigrok.org/wiki/Linux
 http://sigrok.org/wiki/Mac_OS_X
 http://sigrok.org/wiki/Windows
 http://sigrok.org/wiki/FreeBSD


Firmware
--------

Some devices supported by libsigrok need a firmware to be uploaded before the
device can be used. 

The default location where libsigrok expects the firmware files is:

  $prefix/share/sigrok-firmware

($prefix is usually /usr/local or /usr, depending on your ./configure options)

For further information see:

  http://sigrok.org/wiki/Firmware


Mailing lists
-------------

There are two mailing lists for sigrok/libsigrok:

 https://lists.sourceforge.net/lists/listinfo/sigrok-devel
 https://lists.sourceforge.net/lists/listinfo/sigrok-commits


IRC
---

You can find the sigrok developers in the #sigrok IRC channel on Freenode.


Website
-------

http://sigrok.org