When making log_* calls, add these two lines to the corresponding
CMake file prior to add_library() or add_executable():
set(SRC_TO_SHORTEN ${MY_SRC_LIST})
include(ShortFileMacro)
Many thanks to LazyDodo for providing the CMake approach for doing this,
and to rwr for suggesting this change.
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.
And additional return value has been added to str2args in order to
differentiate between an unexpected fatal (e.g, memory) error and
unterminated quotes.
This was previously causing cmd_handle() to fall through to an
"Unknown error" case, which is treated as a fatal error, resulting in
the CLI being terminated.
Thank you to Jens Elofsson (jenselo) for tracking down and reporting the
underlying defect! (Issue #259)
On Linux and OSX, the following directories will be searched,
in the order listed:
~/.config/Nuand/bladeRF
~/.Nuand/bladeRF
/etc/Nuand/bladeRF
In Windows, %appdata%/Nuand/bladeRF will searched.
The following files will be loaded, if found in these search paths:
FPGA image: hostedx40.rbf or hostedx115.rbf, depending on the
size of the FPGA reported by the device.
DC Calibration tables: <serial>_dc_<rx|tx>.tbl
libbladeRF: Added Windows support to file_find
- Our surrogate inttypes.h is only needed for Visual Studio 2010 and
earlier, due to the lack of C99 support.
- Move all the inttypes.h includes into host_config.h, where we can
do the ugly in a centralized location
- MinGW on Linux is case-sensitive -- reflect that when including
windows.h.
This option allows interactive mode commands to be executed from the
command line. Multiple -e <cmd> arguments may be provided; they will be
executed in the order they are specified.
Operations/command are performed in the following order:
- Command line options (e.g., FPGA load, firmware flash)
- Commands from '-e <cmd>' arguments
- Commands from script files
- Interactive mode commands
This work is largely based upon or directly from contributions by LazyDodo.
To allow for other USB drivers (e.g., native host drivers, the CyAPI) to
be more easily integrated, all driver-agnostic bladeRF<->USB code has
been moved to a generic USB backend. The intent is here is to decouple
bladeRF-specific logic from these USB "driver" interfaces to remove
unnecessary code duplication.
The contained changes include:
- Splitting the libusb backend code into backend/usb/usb.c and
backend/usb/libusb.c, and some cleanup in the moved code.
- Removal of the flash_firmware() backend function. This is has been
moved to flash.c, and is implemented atop the backend flash
functions.
- Removal of legacy support in the USB code. All legacy support
is planned for removal and replacement with an appropriate
error code to denote that a FW upgrade is required.
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.
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.
These changes simplify the image format a bit; the metadata fields are
flattened into the image to simplify both image creation and manually
viewing/extracting contents from images.
The checksum has been moved to directly after the file format's magic
value (i.e., signature), to make it a bit easier to just extract data
via dd. Similar to the approach used by mkimage for U-Boot headers,
the checksum calculation is performed over the entire image, with the
checksum field zeroed out.
Touched up CLI backup/restore commands and separated <address>
and <length> to separate args.
Scripts can be invoked from within other scripts, using the "run"
command. An error is reported if a recursive loop is detected.
An "echo" command has been added for debug purposes.
Parameters may now be surrounded in double quotes to include spaces.
Removed extraneous error messages from main(); The preceding functions
print error messages if needed.
Removed error-out if no device is attached. This allows scripts to be
run if the device is not attached. Commands already verify that a device
is attached, if required.
Where possible (and with contributor permission), items have been
changed to LGPLv2.1 or MIT licenses to avoid issues with any proprietary
libraries from vendors (HDL and FW), allow static linking (with headless
mode operation in mind), and to generally present users with more
permissive licenses.
File headers and the COPYING have been updated accordingly. Third party
sources have been either removed, replaced, or relocated in the source
tree, in accordance with the licenses decided upon for each part of the tree.
Contributor Assignment Agreements have been added, and it is required
that these be submitted before significant patches and pull requests
are accepted.
CMake option added to disable log.c for libbladeRF. Adjustments made
to other files as needed to address warnings (becoming errors via
-Werror and /Wx).
Removed return values for log-related functions, as these were unused
and made it slightly more annoying to make this change. The libbladeRF
minor version has been bumped to note this change in the currently
unstable series v0.x.x series.
With future license-related cleanup, all GPLv2 programs will live
in the utilities directory. As such, ezusb.c has been moved out
of the library, and the bladeRF-cli utility has been modified to
use this directly.
The rx and tx CLI commands now use the asynchronous stream interface to
yield more acceptable performance, and this code has been overhauled for
better readability. Command parameters have been added to allow for
configuration of the stream.
Although a bit overzealous, as "lock it if you use it" approach is taken
here. Optimizations may follow later..
Some rx/tx parameters now support K/M/G suffixes, where relevant.
To support sample rate sanity checks, an API function to check the
current USB speed has been added to libbladeRF. This speed is now
reported in the CLI 'info' command.
The API now presents a version structure that includes major, minor, and
patch versions. It additionally provides a "describe" string which
includes these version items in a string format, with any additional
annotations (such as git revision and dirty flag).
This changeset removes the older version functions, breaking reverse
compatibility (intentionally). Bumped minor version to reflect this change.
(The 0.Y.Z series is considered unstable at this time.)
From the documentation:
"A value of zero causes the thread to relinquish the remainder of its
time slice to any other thread of equal priority that is ready to run.
If there are no other threads of equal priority ready to run, the
function returns immediately, and the thread continues execution."
Thanks Simon!
- Split RF, FPGA load, and firmware methods into seperate .c files
- Split several vendor requests to eliminate magic glEp0Idx and to allow
for better error handling
- Updated libbladeRF to use new vendor requests and properly check return
code.
- Changed glSpiPageSize from global to #define
- Move OTP handling into firmware.c
- Version bump
Conflicts:
fx3_firmware/bladeRF.c
Initializing, extracting, and comparing device identifier information
(struct bladerf_devinfo) is now exposed through the API. Among other
things, this allow users to check if a device specifier string matches a
device they already have a handle for.
To support this, a copy of bladerf_devinfo information is now kept around in
the device handle; backends are responsible for populating this in their
open() implementation. A couple of the fields were already present, so
this only adds a couple small variables worth of overhead.
Some re-arranging of the linux and libusb probe and open calls has been done
to achieve this. A few warnings and bugs were addressed in this process:
- The Linux backend was attempting to fill in a serial number via
a cached entry.
- There was some potential for a read of an uninitialized portion
of an otp buffer.
- Missing serial # has been made non-fatal. (Some developers'
device do not have serial numbers.)
Files associated with this functionality was moved from host/common
back into the library, which should now be used instead. bladeRF-flash
has been updated to use these new API functions.
Added a new conversion function that accepts a list of suffix to
multiplier mappings, and applies the appropriate multiplier to the input
value. Utilized this new conversion function in the CLI for set
bandwidth, set samplerate, and set frequency.
Added a mechanism to log messages with different priority levels, and to
filter which messages are output by setting a threshold level. The
function to set the current log level/verbosity is exposed through
libbladeRF.h, while the logging function/macros themselves are private
to this project, and are present in log.c/log.h. Callers should use the
convenience macros bladerf_log_[level]() to issue their log messages.
These macros piece together a format string that contains the message
priority and, for warning and higher priorities, the function and line
number on which the message was logged. Also, warning level and higher
level messages are output to stderr, rather than stdout.
This includes freqmod's fixes provided in pull request/issue #57,
in addition to some other misc. cleanup items noted while reviewing
the aforementioned changset.