With this commit, we build without warnings on Arch Linux; CentOS 7; Debian 8 and 9; latest Fedora; Ubuntu 14.04, 16.04, 17.10, and 18.04; Visual Studio 2017; and macOS 10.13.3 w/ Homebrew.
* host: libbladeRF: compile AD9361 srcs with -std=gnu11
Fixes compile errors involving ‘for’ loop initial declarations only
allowed in C99 or C11 mode, on older GCCs.
* host: libbladeRF/adi: remove stdbool workaround
This is not necessary now that we're building to -std=gnu11, and in
fact, it seems to create a conflict.
* host: libbladeRF: pre-declare loop variables
Some compilers are not happy with declaring the loop variable in the for
statement. Begrudgingly placate them.
* host: libbladeRF_test: pre-declare loop variables
Some compilers are not happy with declaring the loop variable in the for
statement. Begrudgingly placate them.
* host: bladeRF-cli: pre-declare loop variables
Some compilers are not happy with declaring the loop variable in the for
statement. Begrudgingly placate them.
* host: libbladeRF: remove refs to strings.h
Windows doesn't have strings.h, but string.h seems to do just fine.
* host: libbladeRF: fix windows compile errors (WIP)
* host: libbladeRF/ad9361: fix windows compile error
"IGNORE" is #define'd in the Windows environment, creating a conflict.
Renaming this to solve the conflict.
* host: common: add setenv implementation for Windows
* host: libbladeRF: build setenv.c stub on Windows
* host: bladeRF-cli: use setenv stub on Windows
* host: common: fixup spacing consistency in setenv
* host: libbladeRF: cast channel macros to bladerf_channel
Visual Studio is picky about this, and throws warnings.
* host: libbladeRF: bladerf2.c: undo workaround for bladerf_channel
* host: libbladeRF: bladerf_get_gain_stages count type is now size_t
This fixes a Windows compile error, and is also generally more sensible.
* host: bladeRF-cli: fix windows compile errors
* host: ad9361: fix variadic macro syntax
Fixes Windows build errors
* host: ad9361: rename _DEBUG to AD9361_DEBUG
Visual Studio automagically sets _DEBUG if the /MDd option is set. Turns
out that a lot of the debugging sections don't build in Visual Studio,
so this accounts for a large number of the build errors...
* host: libbladeRF: fixes for Visual Studio builds
* host: common: fixes for Visual Studio builds
* host: libbladeRF/ad9361: fixes for Visual Studio builds
* host: libbladeRF_test: fixes for Visual Studio builds
* host: bladeRF-cli: fixes for Visual Studio builds
* host: bladeRF-cli: fix static analysis warnings
Fixes potential memory leak in main
Fixes unused values in set_adf_refclk, set_samplerate
* host: common: fix static analysis warnings
fixes:
unread variable in perform_rx_cal
memory leaks in add_arg, add_opt
* host: libbladeRF: fix static analysis warnings
fixes unused variables in bladerf2_set_gain and xb100_enable
* host: common: add mkdtemp implementation for Win32
Windows does not have mkdtemp, which is something used by at least one
test case. This is a simple-enough implementation thereof.
* host: common/host_config: add more defs on Win32
chdir, getcwd, rmdir, unlink, and mkdir are all somewhat special on
Win32, so they need special handling.
* host: test_config_file: fix builds on Win32
GCC 7.x adds a warning for implicit fallthroughs in switch cases. We
intentionally do this sometimes, so adding an EXPLICIT_FALLTHROUGH macro
to denote this.
The __attribute__((fallthrough)) on a null statement is only supported
by GCC 7.x as well, hence the macro.
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