log_get_verbosity returns the current logging level, which may be useful
for situations where a lot of processing is required for verbose
logging, etc.
Fixes:
host/common/src/parse.c:378:14: error: 'strncpy' specified bound depends
on the length of the source argument [-Werror=stringop-overflow=]
Allocating 128 bytes all the time resolves this.
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.
MSVC warns of loss of precision on implicit conversion from float to
int16_t. Instead of relying on truncation, do a proper round with
bounds-checking.
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 nominal DC offset values were being left up to the caller to
apply. However, the bladeRF-cli was not doing this.
For convenience, these functions now apply the resulting nominal
values identified before exiting.
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.
host/common/src/dc_calibration.c:584:19: error: ‘q_est’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
const int16_t max_est = (i_est > q_est) ? i_est : q_est;
^
host/common/src/dc_calibration.c:679:20: note: ‘q_est’ was declared here
int16_t i_est, q_est;
^
host/common/src/dc_calibration.c:584:19: error: ‘i_est’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
const int16_t max_est = (i_est > q_est) ? i_est : q_est;
^
host/common/src/dc_calibration.c:679:13: note: ‘i_est’ was declared here
int16_t i_est, q_est;
^
Ensure i_est and q_est are assigned fallback values in error cases.
Addresses CID 1346524.
This should never happen because the count input is assigned
from a compile-time constant.
However, this check and assert() are worth having to verify
this assumption, should someone break the code later...
In the case where the timestamp was in the past we want to
try to resynchronize with the hardware's timestamp counter
rather than blindly increment the timestamp.
This addresses CID 1346525 due to the removal of a return
if status != 0 (rather than handling BLADERF_ERR_TIME_PAST).
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.