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.
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.
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.
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.
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"
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.
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.
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.
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.
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
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).
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.
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.
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.")
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.
The function to create cal data now is a wrapper around
bladerf_alloc_image() which initializes the returned image with
calibration data.
The associated CLI command now allows this to be either written to a
file or to the device directly.
API header cleanup: Pushed the lower level functions to to the end of
the header, so the functions people will use more frequently will be at
the top of the generated documentation.
Also added a missing API_EXPORT and made the Doxygen color scheme a little
more blue. (Tired of grayscale ;) )
Windows cleanup: Added get_timestamp() implementation, cleaned up
warnings, address some portability issues.