The line to argumenet parser uses a two pass approach. The first pass
finds beginning and end of arguments, and counts the number of quotes.
The second pass copies the characters into the argument buffers.
Instead of using version-based guessing on macOS (which appears to fail
with newer versions of Xcode on older versions of macOS), use an
explicit test for clock_gettime in CMake.
The DC calibration table will now include mean residual errors for 3 different
gains (that will be used by the AGC amont other things) including:
Max : LNA=6dB, RXVGA1=30dB, RXVGA2=15dB
Mid : LNA=6dB, RXVGA1=30dB, RXVGA2= 0dB
Low : LNA=3dB, RXVGA1=12dB, RXVGA2= 0dB
The DC cal table version has been bumped to 2. This commit will allow backward
compatibility with existing DC cal tables.
- Added round() and roundf() functions for VS version 2012 and below, since
they lack implementation of these functions
- Minor formatting edits to make the compiler (v17.00.50727.1) happy
The existing macros make use of functions, which cannot be used to
define constants on architectures where they are actually implemented
as functions (as opposed to macros).
These functions come with MSVC 2015 (vc14) as part of the c99 support.
The compatibility definitions in host_config.h.in were causing
a compilation error. This fix disables the compatibility definitions
when the more recent vc14 compiler is detected.
This code is a re-designed set of DC calibration functionality
built atop of libbladeRF.
This functionality provides the ability to:
- Run LMS6002D DC calibrations per module (or all at once)
- Search for nominal RX/TX DC correction values for a single
frequencies or a range of frequencies.
To avoid inducing issue #408 by utilizing a single stream,
rather than repeatedly starting and stopping streams.
No TX thread is used, as this is uneccessary; it is sufficient to
flush 0+0j samples through the TX path at the start of calibration
and allow the DAC to remain held in this state as the FPGA
(intentionally) underruns.
size_t or unsigned int are preferred for variables that describe
the length of an array.
This change fixes an additional MSVC build issue caused by
test_scheduled_retune.
It appears the 'inline' keyword still isn't supported as of VS2013
(MSVC 18.00). However, we shouldn't be re-defining it
if building with VS's C++ compiler.
Moved function to get string description to conversions.c.
There's a similar function within libbladeRF's backend.c, but that
is intended to be used in the device information string; this is
intended to be a bit more humand-readable.
Most of the libbladeRF_test items contain their own command line
argument handling, yielding repeated code and inconsistent invocations.
This commit introduces common command-line argument handling and device
configuration for the most used device parameters.
Future patches will migrate the tests over to using this functionality.
New tests should use this immediately.
Visual Studio 2013 now includes these headers, so they have
been moved as not to conflict (even though they are intended to
be equivalent.)
Our stdbool.h was providing an incorrect typedef; sizeof(bool)
should have been 1, not sizeof(int).
Per http://msdn.microsoft.com/en-us/library/tf4dy80a.aspx:
"In Visual C++4.2, the Standard C++ header files contained a typedef
that equated bool with int. In Visual C++ 5.0 and later, bool is
implemented as a built-in type with a size of 1 byte. That means
that for Visual C++ 4.2, a call of sizeof(bool) yields 4, while in
Visual C++ 5.0 and later, the same call yields 1. This can cause
memory corruption problems if you have defined structure members of
type bool in Visual C++ 4.2 and are mixing object files (OBJ) and/or
DLLs built with the 4.2 and 5.0 or later compilers."
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.