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.
...just for the sake of being explicit. Sure, a compiler might
be "smart" enough to not use a double here, but it certainly doesn't
hurt to here "say what you mean."
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.
OpenBTS and YateBTS fork a transceiver sub-process and redirect stderr
and stdout, which effectively hide any bladerf logs. For debugging
time-critical code, printf debugging (or logging) is simple, yet
practically essential. libbladeRF logging via syslog is opt-in via the
CMake ENABLE_LIBBLADERF_SYSLOG option, which defaults to OFF.
To make this as transparent as possible, a generic mechanism for
initializing libraries without having to use any specific pre-known
function has been introduced (see init_fini.c). Currently its only real
purpose is to closelog() upon unloading library. Failing doing this is
an error affecting the case when the library is unloaded manually.
When the syslog support is enabled, the libbladeRF default log level is
reduced to WARNING, rather than INFO to avoid noise in logs.
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.