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 mktemp/wget workflow creates the data files chmod 0600, which breaks
loading of firmware for non-root users. Explicitly chmod 0444 to allow
all users to read.
This fixup allows the AGC LMS driver to select the appropriate LNA when changing
the LNA's gain. libbladeRF reads, masks, and writes this field, however for
performance reasons the AGC LMS driver should know the final value of the
register without first reading it.
Allow the AGC to choose the appropriate DC offset LUT setting for correcting
the DC offset. Essentially, libbladeRF loads the DC offset lookup table from a
previously computed DC calibration table, and NIOS exposes the correction for
each of the gains. The AGC the selects which correction it wants applied based
on its gain setting.
The AGC core runs in a different clock domain for that of the NiOS core. Three
synchrinozers have been added to allow the AGC core to drive signals in the
lms_rx_clock_out clock domain while communicating with the NiOS core in the
\80MHz\ clock domain.