Commit graph

151 commits

Author SHA1 Message Date
Jon Szymaniak
9cdfbedd5d libbladeRF: Adding VCTCXO tamer mode selection support 2015-12-14 15:29:59 -05:00
Jon Szymaniak
7af3de8280 libbladeRF: Added bladerf_vctcxo_tamer_mode enumeration
This enumeration will be used to control the upcoming VCTCXO tamer
module in the FPGA.
2015-12-14 15:29:59 -05:00
Mathieu Rene
0d55229719 libbladeRF: Added helper function for setting the FPGA's rx_mux
This function provides simpler access to the FPGA's RX mux,
whose settings are controlled by FX3 <-> FPGA GPIOs.
2015-12-09 23:31:16 -05:00
Jon Szymaniak
0c58c553db libbladeRF: Use empty API_EXPORT definition for MATLAB thunk builds
MATLAB's loadlibrary() implementation becomes quite confused
when presented with __attribute__ ((visibility ("default"))).
2015-11-22 20:31:43 -05:00
Jon Szymaniak
f0f3783f13 libbladeRF: Added bladerf_submit_stream_buffer_nb()
This provides a non-blocking variant of bladerf_submit_stream_buffer(),
which provides API users with more control over how they might want
to handle asynchronous buffer submission.

This API functionality has been exposed to allow users to implement
schemes similar to that used to address Issue #438.
2015-11-20 15:38:06 -05:00
Jon Szymaniak
f84df2601d libbladeRF: Added BLADERF_ERR_WOULD_BLOCK
This will be returned by API functions when an operation would need
to block to complete, but the caller has requested non-blocking
operation.  In this situation, the caller may need to wait and
resubmit the request at a later time.
2015-11-20 15:38:00 -05:00
Jon Szymaniak
8a7986f9ae libbladeRF.h: Corrected description of gain correction 2015-11-13 13:20:01 -05:00
Adam Greig
2cc2609d80 Fix SMB max freq at 200MHz 2015-09-09 17:58:41 -04:00
Adam Greig
f7f26d5bb7 Add support for setting SMB clock output to arbitrary frequency 2015-09-09 17:58:41 -04:00
Jon Szymaniak
82191d8dee libbladeRF: Added masked XB GPIO write routines and XB GPIO macro definitions 2015-09-01 13:11:35 -04:00
Jon Szymaniak
2afcc6a895 libbladeRF: Added error code to denote insufficient permissions 2015-08-25 14:13:40 -04:00
Brian Padalino
9f94bf1fee libbladeRF: Removing si5338 functions.
Functions were replaced/removed long ago and were not stripped
from the header file.
2015-08-20 18:33:01 -04:00
Jon Szymaniak
1e9432abe8 libbladeRF.h: Added explicit mention of UPDATE_TIMESTAMP flag 2015-07-25 15:30:19 -04:00
Jon Szymaniak
df4125634b libbladeRF.h: Removed description of burst zero-pad requirement.
libbladeRF now takes care of this for the API user, as of v1.3.0.
2015-07-25 15:30:19 -04:00
Jon Szymaniak
948fbad00b libbladeRF: Added additional notes about bladerf_dac_read() 2015-06-23 23:17:11 -04:00
Jon Szymaniak
c9acfecef4 libbladeRF: Added vctcxo trim dac readback support 2015-06-22 22:47:18 -04:00
Jon Szymaniak
d28a953ab9 libbladeRF: Use updated NIOS II packet formats for FPGA >= v0.3.0 2015-06-18 20:20:58 -04:00
Jon Szymaniak
cd880565d6 libbladeRF: Updated copyright date in API header 2015-06-18 20:20:57 -04:00
Jon Szymaniak
cac4301939 libbladeRF: Added retune queue cancellation 2015-06-18 18:34:29 -04:00
Jon Szymaniak
59d31545d5 libbladeRF: Added "Queue full" status code
This "Queue full" event may occur when using the scheduled
retunes. Since this is an event that the user can respond to
and act upon, an appropriate status/error code has been added.
2015-06-18 18:34:29 -04:00
Jon Szymaniak
df31bf8072 libbladeRF: Noted precondition for bladerf_schedule_retune() 2015-06-18 18:34:29 -04:00
Jon Szymaniak
51e4a84791 libbladeRF: Added quick tune and scheduled retune API functions
At this point, the underlying implementations of these
still need to be completed.
2015-06-18 18:34:29 -04:00
Jon Szymaniak
830fa74848 libbladeRF: Braces style nitpick 2015-06-18 18:34:28 -04:00
Jon Szymaniak
064104436c libbladeRF: Added device retune mode selection
As of FPGA v0.2.0, the frequency tuning algorithm is run in the FPGA to
eliminate time wasted by communicating LMS6002D registers over USB. This
is now the default if the FPGA version is >= v0.2.0.

This default can be overridden via a BLADERF_DEFAULT_TUNE_MODE
environment variable, with options being "host" or "fpga".
2015-06-18 18:34:28 -04:00
Jon Szymaniak
3cdf642614 libbladeRF/doc: Overhauled API docs main page and added examples
The main landing page in the Doxygen is now filled out with
some general information.

Existing examples have been simplified and moved to
dedicated pages that are linked to from the main page and
relevant sections of the documentation elsewhere.
2015-06-06 17:01:19 -04:00
Jon Szymaniak
37c5b38499 libbladeRF/doc: Fixed doc copy/paste errors in flash write routines 2015-03-31 10:42:20 -04:00
Jon Szymaniak
6326dbad88 libbladeRF: Increased minimum freq to 237.5 MHz
This change was made to avoid the API accepting/using a frequency
so low that it could cause PLLs to unlock.
2015-03-19 11:28:48 -04:00
Jon Szymaniak
7059330d3f libbladeRF: Added support for zero-padding up to a specified timestamp 2015-03-17 16:16:43 -04:00
Jon Szymaniak
21eec5406d libbladeRF: Corrected reference to bladerf_config_gpio_write() in header 2015-03-10 10:21:36 -04:00
Jon Szymaniak
ed7773e84a libbladeRF: Added clarifications about BLADERF_SERIAL_LENGTH
Explicitly noted user buffer size required by bladerf_get_serial().

Made note of extraneous byte used by bladerf_image structure to
avoid confusion. This extra byte will be kept to avoid breaking
compatibility.
2015-03-08 13:41:51 -04:00
Jon Szymaniak
5ee4bcd59a libbladeRF: Removed prototype for removed bladerf_set_tx_gain() fn
This was combined into a unified bladerf_set_gain() function. No
bladerf_set_tx_gain() symbol exists in libbladeRF.
2015-03-08 13:25:25 -04:00
Jon Szymaniak
d283e876cc libbladeRF: Corrected description of bladerf_set_gain() 2015-03-08 13:25:25 -04:00
Jon Szymaniak
2c48ba9e53 libbladeRF: Perform port reset when opening device (Linux, USB 3.0)
This changeset is directly based upon a patch and suggestions kindly
provided by Marian and Diana from Null Team (www.null.ro) and YateBTS
(www.yatebts.com). The original patch may be found on the issue tracker
for issue #95.

Per issue #95, it has been found that on many Linux-based
USB 3.0 setups, it is not possible to re-connect to a bladeRF after
a previous application using the bladeRF failed to close its device
handle. (For example, as the result of an application crashing or being
killed.)

To recover from this situation, we now perform a USB port reset when
opening the device, prior to attempting to actually access it.

Should this behavior cause any new issues, it can be disabled...

    ... at compile-time by providing
        -DENABLE_LIBUSB_DEV_RESET_ON_OPEN=False to CMake

    ... at run-time via the bladerf_set_usb_reset_on_open(false),
        when the aforementioned compile-time flag is True.

A huge "thank you" goes out Marian, Diana, and everyone at Null Team and
YateBTS!
2015-01-12 13:52:37 -05:00
Jon Szymaniak
9a05e4b789 libbladeRF: Added API support for bootloader probe and recovery
API functionality to probe for FX3 bootloader devices and download
firmware to detected devices has been introduced.

This is based upon the boot image format/procedure documented in
Cypress's AN76405: "EZ-USB (R) FX3 (TM) Boot Options"
    http://www.cypress.com/?docID=49862
2014-12-18 17:38:06 -05:00
Jon Szymaniak
7706e92b08 libbladeRF: Do not include <stdbool.h> for C++ code in API header
This is unneccessary and causes build issues when building C++ programs
in Visual Studio 2012 and earlier.
2014-11-14 15:19:18 -05:00
Jon Szymaniak
837c15ffb9 libbladeRF: bladerf_open_with_devinfo() now handles NULL devinfo ptr
To be consistent with bladerf_open(NULL), this will open the first
available device.
2014-10-27 13:59:10 -04:00
Jon Szymaniak
f40e70b79a libbladeRF: Added bladerf_open_with_devinfo() example, updated docs 2014-10-27 13:59:10 -04:00
Jon Szymaniak
5a37690e98 libbladeRF: Updated dev info string information for bladerf_open() docs
Added note about "*:" being a valid backend specifier for "any available
backend," and removed reference to currently deprecated Linux kernel
backend.
2014-10-27 12:04:20 -04:00
Jon Szymaniak
d88ab63917 libbladeRF: Made enumeration value references Doxygen links 2014-10-21 08:01:29 -04:00
Jon Szymaniak
f7a4345257 libbladeRF: Added more complete examples for the synchronous interface
The existing bladerf_sync_rx() snippet in the libbladeRF API docs has
been replaced by a more complete snippet in libbladeRF/doc/examples.

From now on, major snippets and examples to be included in
Doxygen-generated documentation shall now be placed in the
libbladeRF/doc/examples directory, and must be buildable and testable.

The Doxygen "snippet" command to shall be used to include the relevant
code from the example program.

libbladeRF: [WIP] Use a simple delay to wait for TX samples in example
2014-10-21 08:01:28 -04:00
Jon Szymaniak
fbe0b6a81e libbladeRF: Introduced timestamp metadata support for sync data i/f
API support for timestamp metadata has been introduced. This is made
available when using the newly introduced BLADERF_FORMAT_SC16_Q11_META
format value.

When using the synchronous interface, metadata is exchanged between the
caller and the API via the updated bladerf_metadata structure. Users of
the asynchronous interface must currently manually manage the metadata
headers as desired, as documented in libbladeRF.h.

When using the BLADERF_FORMAT_SC16_Q11_META format in conjunction with
the synchronous interface, it is possible to retrieve the timestamp for
received samples and an indication of overrun.  An RX operation may also
be scheduled for at a specific timestamp value the future.  Similarly,
bursts of samples can be scheduled to be transmitted at a specific
timestamp value, or at the first available timestamp ("now").
2014-10-21 08:01:28 -04:00
Jon Szymaniak
5774aa0ad6 libbladeRF: Added API definition for FPGA counter mode enable bit 2014-10-21 11:07:38 -04:00
Jon Szymaniak
da19ed24d0 libbladeRF: Removed SC16_Q12 reverse compat macro
This has been scheduled for removal since RC1 and RC2.
2014-10-21 11:07:38 -04:00
Jon Szymaniak
3c48b55645 libbladeRF: Added additional elaboration to SC16Q11 format 2014-10-21 10:45:03 -04:00
Jon Szymaniak
0b7f43712c libbladeRF: Added support for Cypress Windows Driver & API backend
A USB backend based atop of the Cypress CyAPI (which is based atop the
Cypress CyUSB3 driver) has been introduced. This is intended to provide
Windows users with an additional driver to use if they encounter issues
with their USB host controller and libusb.

To build and use this backend, the Cypress FX3 SDK must be installed and
the following CMake flags should be provided:
    -DENABLE_BACKEND_CYAPI=Yes -DFX3_SDK_PATH=<path to SDK>

A modified cyusb3.inf is provided in host/drivers/windows/cyusb3. Upon
performing a build this inf file and the associated driver files from
the FX3 SDK will be copied into the "output" directory along with the
bladeRF.dll and bladeRF-cli.exe. To install the driver, point the
Windows driver update to this location and accept the warning about the
driver being unsigned; this occurs because the Cypress driver wasn't
signed with bladeRF VID/PID values.

The libbladeRF device string for this backend is: "cypress"

Many thanks go out to LazyDodo for all his efforts in spearheading the
development of this backend -- much of this code is either his doing or
is directly based upon his efforts.
2014-10-12 21:55:26 -04:00
Jon Szymaniak
4a60e10903 libbladeRF: Added additional information about XB filter & path options 2014-08-22 19:49:53 -04:00
Jon Szymaniak
0189d48512 libbladeRF: Return "unsupported" when trying to enable the XB-100
This addresses issue #309. The XB-100 isn't currently supported via
libbladeRF. This support will come in the future, after the necessary
functionality is presented in the FPGA/firmware to expose this to the
host.

xb_attach() in xb.c was written in a way that would result in a
successful error code being reported when provided with an invalid or
unsupported expansion board type. This has been addressed, with some
cleanup to this function.

In making this change, it was noted that setting BLADERF_XB_NONE was
not disabling an attached expansion board.  A FIXME was added here to
draw attention to this; I've registered an issue for this and will
assign it to the author of the XB code.
2014-08-18 21:58:27 -04:00
Jon Szymaniak
7b0cc24f95 libbladeRF: Introduced thread-safety to the API
Top-level API functions now acquire a per-device "control lock" before
performing control, programming, and low-level access operations.
(Specifically, these are the functions that manipulate the device handle
and utilize the FX3 <-> FPGA UART.)

Synchronous data transfer functions now hold a per-device, per-module
"sync lock" to ensure these operations are carried out atomically. The
control lock is also held during sync configuration, as upcoming changes
to introduce metadata support will require flipping some config bits on
the FPGA during this operation.

Only these top-level functions shall acquire these locks; the core logic
code should be able to assume that locks are already acquired.

To alleviate confusion, functions that are *not* part of the API, and
therefore are safe to call within the core logic, are stripped of the
bladerf_ prefix.

Now that pthreads is a required dependency, use of the sync API is
is no longer marked optional in the libbladeRF build.
ENABLE_LIBBLADERF_SYNC and related items have been removed from the
CMake build.
2014-08-02 19:22:49 -04:00
Jon Szymaniak
51170a05e5 libbladeRF: Added readback of FW loopback, disable it for LMS loopback
Added the ability to read back the state of FW loopback from devices
running FW v1.7.1. While it is possible to enable FW loopback mode in
v1.7.0 firmware, libbladeRF will now enforce the v1.7.1 requirement so
it can correctly read back and report the FW mode.

bladerf_set_loopback() has also been updated to ensure that the
FW loopback is disabled when switching to an LMS loopback mode.
2014-07-19 16:31:46 -04:00
Brian Padalino
13267cf1e3 libbladeRF: Correct equation for samplerate.
Corrected a samplerate equation calculation which helps determine how
many transfers should be outstanding over any timeout period at a
specific samplerate.  The samplerate should always be greater than the
calculated number, not less than.
2014-07-19 13:13:19 -04:00