Commit Graph

4073 Commits

Author SHA1 Message Date
Diego Asanza a04b28ce2c dslogic: Fix sampling for high samplerates.
This patch fixes sampling at 100MHz, 200MHz and 400MHz.

Signed-off-by: Diego Asanza <f.asanza@gmail.com>
2016-05-16 18:18:59 +02:00
Diego Asanza a9a9bfaa6a dslogic: Add support for long captures at high samplerates.
To capture more than 16MSamples the hardware run length encoding option
must be enabled, or captured data present errors.

RLE encoding/decoding is done in hardware. Data streamed to the USB interface
is not encoded.

This commit enables RLE encoding for captures longer than 16MSamples.

Signed-off-by: Diego Asanza <f.asanza@gmail.com>
2016-05-16 18:18:59 +02:00
Diego Asanza d9a58763d6 dslogic: Add support for external clock edge selection.
This commit expands support for acquisition using an external clock,
now allowing the user to select the clock edge.

Signed-off-by: Diego Asanza <f.asanza@gmail.com>
2016-05-16 18:18:59 +02:00
Diego Asanza 41dc254778 dslogic: Implement continuous mode
For low sampling speeds (up to 25MHz) DSLogic offers a streaming mode where
samples are sent directly to the USB interface, like a fx2lafw device.

For high sampling speeds (up to 400MHz) only buffer mode is supported.

This commit allows the user to set which mode should be used. The configuration
is done by using SR_CONF_CONTINUOUS.

Signed-off-by: Diego Asanza <f.asanza@gmail.com>
2016-05-16 18:18:58 +02:00
Diego Asanza 20d8ae41f4 Change type of SR_CONF_CONTINUOUS from SR_T_UINT64 to SR_T_BOOL
SR_CONF_CONTINUOUS is used to check if a device supports continuous sampling
or not. As such, the type boolean is better suited.

Signed-off-by: Diego Asanza <f.asanza@gmail.com>
2016-05-16 18:18:58 +02:00
Diego Asanza ea3a77c756 dslogic: Implement acquisition with external clock.
DSLogic hardware provides an external clock input.
This commit adds support for this capability.

Signed-off-by: Diego Asanza <f.asanza@gmail.com>
2016-05-16 18:18:58 +02:00
Diego Asanza 3fc3fbe46e dslogic: Add support for voltage threshold
The DSLogic provides two FPGA images: one for 3.3V and the other for 5V logic.
The DSLogic Pro allows to set an arbitrary voltage threshold via USB command.

This commit adds support for the DSLogic to load the FPGA image according to
an user-selectable voltage threshold.

For the DSLogic Pro, one of two fixed voltage thresholds are set, depending on
the user-selected value.

Tested with DSLogic and DSLogic Pro.

Signed-off-by: Diego Asanza <f.asanza@gmail.com>
Tested-by: Andrew Bradford <andrew@bradfordembedded.com>
2016-05-16 18:18:58 +02:00
Diego Asanza 4237fbcaac dslogic: Implement trigger functionality
This commit implements DSLogic trigger functionality.

The following triggers are working:

 - trigger on rising edge
 - trigger on falling edge
 - trigger on any edge
 - trigger on logic one
 - trigger on logic zero

Pre-trigger capture ratio is also working.

Signed-off-by: Diego Asanza <f.asanza@gmail.com>
Tested-by: Andrew Bradford <andrew@bradfordembedded.com>
2016-05-16 17:57:07 +02:00
Lars-Peter Clausen f18e0db3b8 demo: Handle the case when zero analog or logic channels were requested
The demo device has support for specifying the number of analog and logic
channels it should have. Currently this does not work correctly if one of
them is set to zero. Being able to set the number of channels to zero for
one of the channel types is quite useful for corner case testing though.

Make the following modifications to handle it correctly:

1) If the channel count is zero no channel group for that channel type
should be created since a channel group needs at least one channel.

2) Drop the check if logic_unitsize is less or equal to zero in
prepare_data() since this condition will always be true if the number of
logic channels is zero and it is not possible to create a demo device with
only analog channels.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2016-05-14 01:06:20 +02:00
Lars-Peter Clausen 7e2f42214a srzip: zip_append_analog(): Fix memory leaks
zip_append_analog() does not free most of the memory it allocates. Address
this by moving all sanity checks that do not rely on anything else at the
beginning of the function before any allocations are done. And then make
sure to properly free all allocated memory on all paths leaving the
function.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2016-05-14 01:02:00 +02:00
Lars-Peter Clausen 9906dbf5a4 srzip: Fix handling of analog channels with index 0
0 is a valid index for a channel. Using it as the value for the terminating
entry of analog_index_map causes zip_append_analog() to falsely assume that
no channel was found when a packet for a channel with index 0 was received.
This prevents the data for the channel to be added to the sigrok session
file.

Instead use -1, which is not a valid channel index, as
the terminating entry value.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2016-05-14 01:02:00 +02:00
Marvin Schmidt 4def782b6e gitignore: Add files generated when building Ruby bindings 2016-05-14 01:02:00 +02:00
Marvin Schmidt b571f84c84 build: Replace AX_CXX_COMPILE_STDCXX_11 with latest AX_CXX_COMPILE_STDCXX
The former appended the necessary switch to enable C++11 to the CXXFLAGS
whereas AX_CXX_COMPILE_STDCXX appends it to CXX which has the benefit
that all C++ sources are compiled using the same C++ standard. Therefore
it is no longer necessary to manually hardcode '-std=c++11' anywhere
like we did in the Ruby bindings linker command and assures that the
compilation of them is done with C++11 support as well.

This fixes bug #795
2016-05-14 00:36:43 +02:00
Marvin Schmidt c4a1015a29 build: Fix distribution of Ruby bindings
The bindings file was not listed in EXTRA_DIST and therefore not
distributed. We also need to provide an target to uninstall the Ruby
bindings and add it to UNINSTALL_EXTRA in order to make `make distcheck`
happy.

This fixes bug #741
2016-05-14 00:32:37 +02:00
Aurelien Jacobs 17165513f3 ruby: Fix out-of-tree build of the bindings.
This closes bug #797.
2016-05-12 23:08:21 +02:00
Uwe Hermann 45884333ff scan(): Consistently start out with SR_ST_INACTIVE.
A later call to open() will set the status to SR_ST_ACTIVE.

Only in the case of firmware/bitstream upload start with
SR_ST_INITIALIZING first.
2016-05-12 14:59:56 +02:00
Uwe Hermann e91d4ce2b2 fx2lafw: Fix a -Wself-assign compiler warning.
This closes bug #793.
2016-05-12 14:59:48 +02:00
Lars-Peter Clausen c2fdcc25a4 Remove unnecessary std_init() wrapper functions
Now that the signature of std_init() matches that of the driver init()
callback we can remove all wrapper functions around std_init() and use it
directly as the init() callback.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2016-05-09 15:10:26 +02:00
Lars-Peter Clausen c45c32ce47 std_init(): Drop check if pass in driver is non-NULL
std_init() checks if the pass in struct sr_dev_driver is non-NULL and
prints a error message and returns an error if it is NULL.

std_init() is exclusively called from driver init() callbacks for which the
core already checks if the struct sr_dev_driver is non-NULL before invoking
the callback. This means the check in std_init() will always evaluate to
false. So drop this check.

This also means that the prefix parameter that was used in the error
message is no longer needed and can be removed from the function signature.
Doing so will make the std_init() function signature identical to the
init() callback signature which will allow to directly use it as such.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2016-05-09 15:10:26 +02:00
Lars-Peter Clausen 1f8f5bc08e Match std_init() parameter order to the driver init() callback
The std_init() callback has the order of the first two paramters opposite
to the init() callback. This is primarily due to historical development.

Since the std_init() function is usually called from a driver's init()
callback aligning the order will allow direct register pass through rather
than having to swap them around. It also allow to eventually use the
std_init() function directly as the init() callback.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2016-05-09 15:10:26 +02:00
Lars-Peter Clausen 87629577fe zeroplus-logic-cube: Fix USB device list
The zeroplus-logic-cube driver uses libusb_get_device_list() but neglects
to call the matching libusb_device_list_free() on the error path. This will
leak the memory allocated for the list as well as all the devices.

To address the issue use sr_usb_open() instead of open-coding its
functionality. sr_usb_open() correctly handles freeing the device list.

The issue was discovered using the following coccinelle semantic patch:
// <smpl>
@@
identifier devlist;
expression ctx, ret;
statement S;
@@
(
 libusb_get_device_list(ctx, &devlist);
|
 ret = libusb_get_device_list(ctx, &devlist);
 if (ret < 0) S
)
... when != libusb_free_device_list(devlist, ...)
*return ...;
// </smpl>

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2016-05-09 14:17:33 +02:00
Lars-Peter Clausen 4af1f68f9a victor-dmm: Fix USB device list leak
The victor-dmm driver uses libusb_get_device_list() but neglects to call
the matching libusb_device_list_free() on the error path of libusb_open().
This will leak the memory allocated for the list as well as all the
devices.

To address the issue use sr_usb_open() instead of open-coding its
functionality. sr_usb_open() correctly handles freeing the device list.

The issue was discovered using the following coccinelle semantic patch:
// <smpl>
@@
identifier devlist;
expression ctx, ret;
statement S;
@@
(
 libusb_get_device_list(ctx, &devlist);
|
 ret = libusb_get_device_list(ctx, &devlist);
 if (ret < 0) S
)
... when != libusb_free_device_list(devlist, ...)
*return ...;
// </smpl>

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2016-05-09 14:17:08 +02:00
Lars-Peter Clausen b75dc14a94 testo: Fix USB device list leak
The testo driver uses libusb_get_device_list() but neglects to call the
matching libusb_device_list_free() on the error path. This will leak the
memory allocated for the list as well as all the devices.

To address the issue use sr_usb_open() instead of open-coding its
functionality. sr_usb_open() correctly handles freeing the device list.

The issue was discovered using the following coccinelle semantic patch:
// <smpl>
@@
identifier devlist;
expression ctx, ret;
statement S;
@@
(
 libusb_get_device_list(ctx, &devlist);
|
 ret = libusb_get_device_list(ctx, &devlist);
 if (ret < 0) S
)
... when != libusb_free_device_list(devlist, ...)
*return ...;
// </smpl>

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2016-05-09 13:32:23 +02:00
Lars-Peter Clausen ceb2da179f lascar-el-usb: lascar_scan(): Fix USB device list leak
lascar_scan() calls libusb_get_device_list() but never the matching
libusb_free_device_list(). This will leak the memory allocated for the
device list as well as all the devices. To fix this add the missing
libusb_free_device_list().

While we are at it also make sure to handle errors returned by
libusb_get_device_list().

The issue was discovered using the following coccinelle semantic patch:
// <smpl>
@@
identifier devlist;
expression ctx, ret;
statement S;
@@
(
 libusb_get_device_list(ctx, &devlist);
|
 ret = libusb_get_device_list(ctx, &devlist);
 if (ret < 0) S
)
... when != libusb_free_device_list(devlist, ...)
*return ...;
// </smpl>

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2016-05-09 13:32:23 +02:00
Soeren Apel 6266deb84d Input/trace32_ad: Make the sample rate an option 2016-05-09 13:02:47 +02:00
Soeren Apel ab4c27cfa6 Input/wav: Add reset() function 2016-05-09 13:02:47 +02:00
Soeren Apel f4b4725bce Input/vcd: Add reset() function 2016-05-09 13:02:47 +02:00
Soeren Apel 87616181f9 Input/trace32_ad: Add reset() function 2016-05-09 13:02:47 +02:00
Soeren Apel 4c55ea47a7 Input/raw_analog: Add reset() function 2016-05-09 13:02:47 +02:00
Soeren Apel ad93bfb0b9 Input/csv: Add reset() function 2016-05-09 13:02:47 +02:00
Soeren Apel ef9d3fefbc Input/chronovu_la8: Add reset() function 2016-05-09 13:02:29 +02:00
Soeren Apel 3781b65d19 Input/binary: Add reset() function 2016-05-09 13:02:29 +02:00
Soeren Apel b6b4f03e40 Input: Add reset() function 2016-05-09 13:02:29 +02:00
Soeren Apel 0221cbdde3 Bindings: Check for empty opts also in Configurable::config_keys() 2016-05-09 12:55:04 +02:00
Uwe Hermann c8f29d772b baylibre-acme: Drop unused last_sample_fin variable. 2016-05-09 12:44:42 +02:00
Lars-Peter Clausen cf9e86bc74 victor-dmm: Use software limit helpers
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2016-05-09 12:44:42 +02:00
Lars-Peter Clausen 8a63a4064e uni-t-dmm: Use software limit helpers
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2016-05-09 12:44:42 +02:00
Lars-Peter Clausen 2630f97ebb tondaj-sl-814: Use software limit helpers
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2016-05-09 12:44:41 +02:00
Lars-Peter Clausen 91b77e6b1d testo: Use software limit helpers
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2016-05-09 12:44:41 +02:00
Lars-Peter Clausen ffa5f177f1 teleinfo: Use software limit helpers
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2016-05-09 12:44:41 +02:00
Lars-Peter Clausen 9f51c463d1 serial-dmm: Use software limit helpers
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2016-05-09 12:44:41 +02:00
Lars-Peter Clausen 37dbffd15d norma-dmm: Use software limit helpers
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2016-05-09 12:44:41 +02:00
Lars-Peter Clausen 8aafc5e64d motech-lps-30x: Use software limit helpers
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2016-05-09 12:12:15 +02:00
Lars-Peter Clausen 301090aa58 mic-985xx: Use software limit helpers
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2016-05-09 12:12:15 +02:00
Lars-Peter Clausen 45b75c368f maynuo-m97: Use software limit helpers
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2016-05-09 12:12:15 +02:00
Lars-Peter Clausen a655b3fd08 manson-hcs-3xxx: Use software limit helpers
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2016-05-09 12:12:15 +02:00
Lars-Peter Clausen 597deef91e korad-kaxxxxp: Use software limit helpers
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2016-05-09 12:12:15 +02:00
Lars-Peter Clausen 7fc9dc31ac kern-scale: Use software limit helpers
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2016-05-09 12:12:14 +02:00
Lars-Peter Clausen 9edb98982a colead-slm: Use software limit helpers
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2016-05-09 12:12:14 +02:00
Lars-Peter Clausen 838f6906a4 center-3xx: Use software limit helpers
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2016-05-09 12:12:14 +02:00