This commit adds handlers for the following config option keys:
fpga - fpga file to load
frequency - set frequency
samplerate - set integer samplerate
bandwdith - set bandwidth
agc - enable or disable AGC
gpio - set GPIO register value
sampling - set internal or external sampling
trimdac - set trimdac value
vctcxo_tamer - set vctcxo tamer method
These options can be declared in a local or global bladeRF.conf. Square brackets
can used to restrict certain options by FPGA size and serial number.
Example bladeRF.conf file:
fpga /home/user/hostedx40.rbf
trimdac 592
frequency 2.4G
[*:serial=0be673dceaf87623dbefa412ecad6783]
frequency 2.4G
samplerate 20M
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.
We explicitly set VERSION_INFO_EXTRA to "" for release builds, which
causes (${VERSION_INFO_EXTRA} STREQUAL "") to evaluate to
( STREQUAL ""), a syntax error.
Quoting ${VERSION_INFO_EXTRA} should not cause the ambigious condition
foretold in CMP0054, so doing that.
This requires that the user get special additional drivers in addition
to the ones provided by the usual SDK; a URL will point in the right
direction.
Note that this does not remove the requirement for driver signing. Some
work will be needed to document how to do this.
When working on mutexes for the libusb backend, I noticed that I needed
to ReleaseMutex() when closing the device, or else that device would not
be usable again until all of the mutexes were released.
I have not tested this with CyAPI as yet, but I believe the same problem
will occur, and I also believe this may fix it.
Windows seems to allow multiple instances of libbladeRF to open the same
device, which is problematic in many ways. This borrows the mutex
approach from cyapi.c to enforce exclusivity.
With the pre-built binary pack, pthreadVC2.dll lives in a
dll/${ARCHITECTURE}/ directory. However, when compiling from scratch,
it just lives in the source code's root directory. Look in both places
and set a LIBPTHREADSWIN32_DLL variable accordingly.
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.
backend_fns_usb_legacy was missing a .set_agc_dc_correction member,
which causes issues with some compilers. Stubbed in
set_agc_dc_correction_unsupported.
On recent versions of Windows / Visual Studio, struct timespec is
already defined, and the definition is subtly different than what
pthreads-win32 is built with.
It may be possible to handle this in a more automatic fashion via CMake,
but this is TBD.
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 AGC depends on a newer DC cal table and FPGA version 0.7.0 being loaded. A
DC cal table version of 2 or greater is also required for the AGC to work.
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.