Commit graph

103 commits

Author SHA1 Message Date
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
Robert Ghilduta
f7686fdab7 libbladeRF: add auto filtbank selection API
This commit introduces 1dB and 3dB rolloff point based filterbank selection.
bladerf_set_frequency() will set the appropriate filter based on frequency.
2014-07-10 04:30:45 -04:00
Robert Ghilduta
503ff35ac0 libbladeRF: introduce optimal gain functions 2014-07-10 04:30:45 -04:00
Jon Szymaniak
634ad2820b libbladeRF: Added FPGA and FW version compatibility checks
Error codes and warnings have been added to cases where a firmware
or FPGA upgrade is required for proper operation.
2014-07-07 00:41:07 -04:00
Jon Szymaniak
d2d848cc44 libbladeRF: Added BLADERF_FREQUENCY_MIN_XB200 definition to API header 2014-07-04 10:50:04 -04:00
Jon Szymaniak
3b6f70a883 libbladeRF: Removed old bladerf_xb200_attach() function from API
This is a vestige of earlier code. bladerf_expansion_attach() is the
function that performs the desired functionality.

As such bladerf_xb200_attach() has been made static and renamed in xb.c.
2014-07-04 10:15:20 -04:00
Jon Szymaniak
1b1a61bc88 libbladeRF: Removed 3.72GHz SW limit. Allow tuning up to 3.8GHz.
This was limited due to 3.72GHz being the maximum value show in the
LMS6002D programming guide's FREQSEL table. According to a response
on the limemicro-opensource Google group, we should be able to use
the same FREQSEL value from 3.72GHz - 3.8GHz.
2014-06-30 23:32:02 -04:00
Jon Szymaniak
e28f973a4b libbladeRF: Removed calibration load from public API
This will be replaced by some detection from a config file
2014-06-30 00:04:38 -04:00
Jon Szymaniak
bb1d618bf9 libbladeRF: Added a means to clear and disable calibration tables 2014-06-30 00:04:38 -04:00
Jon Szymaniak
eaa76ee831 libbladeRF: Added bladerf_load_calibration_table()
This function provides the ability to load DC offset tables, and will
be used to support loading of IQ balance correction tables in the future.
2014-06-30 00:04:38 -04:00
Jon Szymaniak
e05eb84e9b libbladeRF: Added image types for additional calibrations, typo fix 2014-06-30 00:04:37 -04:00
Jon Szymaniak
a1b9f80671 libbladeRF: Added functions to get/set LMS DC calibration values 2014-06-30 00:04:37 -04:00
Jon Szymaniak
4455994904 libbladeRF: Minor API header touch-ups and Doxygen fixes 2014-06-20 00:13:33 -04:00
Robert Ghilduta
cb0af5a16c libbladeRF: add initial XB-200 transverter support 2014-06-17 09:47:59 -07:00
Jon Szymaniak
ce1fcb9602 libbladeRF: Added "File not found" API return code
Operations that open files (e.g., firmware flash, FPGA load) now
return BLADERF_ERR_NO_FILE instead of BLADERF_ERR_IO when a file not
found. This is intended to help differentiate between user-error in the
aforementioned operations and a device-failure.
2014-05-25 00:51:18 -04:00
Jon Szymaniak
358160dcb1 libbladeRF: Support NULL 'actual' argument for bladerf_set_bandwidth()
This function now correctly handles the case where a caller specifies
NULL for the 'actual' parameter if (s)he does not wish to retrieve
the actual bandwidth set.

This fixes #245.
2014-05-11 15:03:15 -04:00
Jon Szymaniak
0d5efaa8ae libbladeRF: Added backend to string function and wildcard backend str
bladerf_backend_str() may be used to retrieve the string associated with
the <backend> portion of a device specifier string (for use with
bladerf_open()).

It is now possible to specify "*" to denote "any available backend":
    bladeRF-cli -i -d "*:instance=0"
2014-05-06 21:59:42 -04:00
Jon Szymaniak
96e9633604 libbladeRF: Further revisions and API changes to the SPI flash interface
After further discussion, it was concluded that little benefit is gained
by providing byte interfaces to the SPI flash; users using this API were
already forced to be aware of page/eraseblock alignment, and would have
to be aware of the underlying flash memory map.

Therefore, the following API changes have been made:

 - bladerf_erase_flash() now takes an erase_block number and an
    erase_block count.

 - bladerf_read_flash()/bladerf_write_flash() now take a page number,
    and a page count.

 - The unaligned flash read/write functions have been removed. If users
   are going to be working at a low-level with flash, they'll likely
   want to manage the read-modify-erase cycles themselves.

Internal to libbladeRF, these changes have been propagated down to the
backend interface. Although the flash on the current bladeRF is only
a 4 MiB part, the types have been kept as uint32_t, to accommodate
any future HW changes.
2014-05-06 21:59:42 -04:00
Jon Szymaniak
ff0fcecda2 libbladeRF: Flash interface cleanup and flash-related API changes
Performed cleanup and reorganization of flash-related code. The following
items have been changed in the libbladeRF API:

 - Fixed "sector" vs "erase block" misnomer. While the SPI flash on the
   bladeRF has "sectors", these are not the units actually being used
   in the firmware to perform erase operations. As such, the API and
   underlying code has been updated to perform erases in terms of the
   "erase block" unit.

 - Renamed bladerf_program_flash_unaligned() to
   bladerf_write_flash_unaligned() for consistency.

 - Flash-related API calls now only return 0 on success, or a
   BLADERF_ERR_* value upon failure. They no longer return the number of
   bytes read/written/erased. This is intended to be more consistent
   with the rest of the API. The requested size of the read/erase/write
   is guaranteed to be performed at requested size, so returning a byte
   count merely complicates the API "contract" and offers no usefulness.

 - To erase the FPGA stored in SPI flash for autoloading, a new
   function, bladerf_erase_stored_fpga(), has been introduced. This
   replaces the use of bladerf_flash_fpga(dev, "X").

Internally, the following changes have been made:

 - All flash-related code has been moved to flash.c (e.g., from bladerf.c).
   This is part of the ongoing effort to move logic out of bladerf.c and
   into the associated module, with the intent of the bladerf.c
   "API top-level" of only acquiring a per-device lock (in the future)
   and delegate actions to the module implementations.

 - Backend flash operations are now in units of erase blocks and pages,
   to alleviate backend code needing to deal with conversions.
2014-05-06 21:59:42 -04:00
David Brenner
7548a8b698 libbladeRF: Fixed minor comment typos 2014-05-04 15:36:00 -04:00
Jon Szymaniak
8f8db98720 libbladeRF: Typo and formatting touch-ups in libbladeRF.h 2014-04-26 20:56:47 -04:00
Jon Szymaniak
a9ad36f0ab libbladeRF: Added missing CALL_CONV's and corrected Doxygen annotations 2014-04-17 21:47:31 -04:00
Brian Padalino
106df3fee0 libbladeRF: Removing extra loopback function.
Removing the firmware loopback function in preference of adding an
enumerated type to the loopbacks.

NOTE: Currently the firmware loopback does not check for an appropriate
version before trying to set it.  Caution should be used while using
this function for now.
2014-04-06 23:34:31 -04:00
Robert Ghilduta
5cd41404ff libbladeRF: add support for enabling and disabling loopback in firmware
Since this affects the way FX3 DMA channels are created, the libusb code
contains two explicit interface changes.
2014-04-04 05:29:37 -07:00
Robert Ghilduta
1db147bb5d libbladeRF: add GPIO direction support to expansion board
This commit adds functions that help set the drectio of the expansion board GPIO pins.
2014-04-01 22:41:29 -07:00
Robert Ghilduta
50319a5904 libbladeRF: add GPIO value support to expansion board
Reading and writing the GPIO register will not correspond to the expansion board
headers.
2014-04-01 22:41:29 -07:00
Robert Ghilduta
baf4bc2e21 libbladeRF: add SPI support to expansion board 2014-04-01 22:41:29 -07:00
Robert Ghilduta
73e98ead61 libbladeRF: add the ability to query RX and TX timestamp counters 2014-04-01 22:41:28 -07:00
Jon Szymaniak
ace9909329 libbladeRF: Documentation touch-ups 2014-03-30 20:40:18 -04:00
Jon Szymaniak
2caa67a624 libbladeRF: Refactored async stream implementation, non-callback buf submission
To support cases where callbacks would need to block (which they can't),
the async stream implementation has been modified to support
bladerf_submit_stream_buffer(), which allows buffers to be submitted for
transfer outside of the callback functions.

There are some caveats to using this; the documentation has been updated
to note where care should be taken with lock acquisition.
2014-03-30 20:30:30 -04:00
Jon Szymaniak
fd072df449 libbladeRF: Hold lock while executing stream callbacks
Per the libusb documentation, the libusb async callbacks must be
executed atomically.

In half-duplex cases where one thread is sitting in a bladerf_stream()
call, this was a problem.  However, in full-duplex cases, we can have
two threads, each calling a libusb handle_events fn, enter the callback
for a single module. This would result in:
    - Buffers being passed to user callbacks in the wrong order
    - Stream state and error conditions being corrupted
2014-03-22 14:52:15 -04:00
Jon Szymaniak
d586e44bec libbladeRF: Moved stream code and definitions to stream.c/.h
Re-arranged some code in preparation for making changes to the async
stream implementation.
2014-03-22 14:10:55 -04:00
Jon Szymaniak
1fce2bffa1 libbladeRF: Corrected Windows header include for mingw compatibility
Thank you to sm5bsz for noting this issue and fix.
2014-03-16 19:51:09 -04:00
Jon Szymaniak
9e97a34ab4 libbladeRF: Improved range checks and associated documentation
API documentation changes:
    - Added min/max #defines for:
        RXVGA1, RXVGA2, TXVGA1, TXVGA2, sample rate, bandwidth,
        & frequency

    - Documented ranges and error/clamping behavior for:
        bladerf_set_sample_rate, bladerf_set_rational_sample_rate,
        bladerf_set_correction, bladerf_set_txvga1, bladerf_set_txvga2,
        bladerf_set_rxvga1, bladerf_set_rxvga2, bladerf_select_band,

Ensured the aforementioned functions clamp or return an error
for out-of-range input. The low-level functions have NOT been updated
for range checks. (e.g., bladerf_si5338_set_tx_freq).
2014-03-16 15:37:59 -04:00
Jon Szymaniak
2a0dde641f libbladeRF: Added further clarification to (Doxygen) documentation 2014-03-08 19:55:22 -05:00
Jon Szymaniak
daaa2e92c8 libbladeRF: Re-implemented sync interface, updated API docs, renamed timeout function
The sync interface has been re-implemented atop the existing
asynchronous interface. This is currently opt-in and only enable when
pthreads support is enabled and available.

Some clarifications have been made in the API documentation,
specifically in the explanations of the various stream parameters.

The bladerf_set_transfer_timeout and bladerf_get_transfer_timeout have
been named more appropriately, as these control stream transfer
timeouts, as opposed to all transfers.
2014-03-08 19:55:21 -05:00
Jon Szymaniak
215807088c libbladeRF: Documentation touch-up in bladerf_stream description
Noted that bladerf_enable_module() *must* be called prior to calling
bladerf_stream().
2014-03-08 00:24:32 -05:00
Jon Szymaniak
9ee9c765d4 libbladeRF: Refactored lms code, implemented baseband and RF loopback
Changes include stylistic and functional clean-up. LMS functions now
return and check status codes.

Finer grained loopback options have been added.
2014-02-13 15:34:46 -05:00
lazydodo
0189e8609d libbladeRF: Added dummy backend
This allows libbladeRF to be built with no other backends, which is
generally only useful when working on new backends.
2014-01-23 23:40:23 -05:00
modustollens
2051136130 libbladeRF: Normalize the DC offset set/get functions to +/- 2048, update comments to reflect this. 2014-01-19 10:42:55 -05:00
Jon Szymaniak
637c809e9c libbladeRF: Rearranged and cleaned up header, removed unimplemented bladerf_stats
Definitions and typedefs in the libbladeRF.h header have been moved to
their appropriate groups so that they show up in the relevant module in
Doxygen output.

The bladerf_stats structure and associated function have been removed,
as this functionality is not schedule for implementation in the near
future. This will be re-added when this functionality becomes available.

The bladerf_set_loopback() function has been marked unimplemented as it
currently does not function as desired, but is schedule to be
implemented.
2014-01-17 00:21:41 -05:00
modustollens
2c88580862 libbladeRF: Documented correction parameter values 2014-01-16 23:57:02 -05:00
Brian Padalino
5f08437051 libbladeRF, bladeRF-cli: Switch naming convention to BLADERF_CORR_<DEVICE>_<REG> 2014-01-16 23:57:02 -05:00
Jon Szymaniak
35ed384bc2 libbladeRF: Updated description of bladerf_log_set_verbosity 2014-01-16 23:57:02 -05:00
Jon Szymaniak
deb4d15987 host: Fixed sample format misnomer - Q12 -> Q11
The sample format was incorrectly named, as there are only 11 fraction
bits, not 12.

The enumeration value has been renamed, and a macro definition is
provided for reverse compatibility. (This macro def will be removed
prior to the first "release.")
2014-01-16 23:56:47 -05:00
Jon Szymaniak
971c5859ca libbladeRF: Refactored correction functions and enumeration. 2014-01-15 23:25:31 -05:00
Jon Szymaniak
3c2e10b8b1 libbladeRF: API change for get/set data transfer timeout
Addresses issue #202.

Fixed name and made return value an operation status rather than
returned value for consistency. We may need to make some
backend-specific calls here in the future, hence this interface
returning status.

The current implementation is not backend-specific, and has been moved
up to the top-level.
2014-01-15 23:25:30 -05:00
brent
5595f05975 IQ correction work improvements 2013-12-28 15:41:42 -05:00
Brian Padalino
30922a07a5 More fixes. 2013-12-28 12:46:43 -05:00