fpga_common: nios: stub out NIOS_PKT_16x64_TARGET_RFIC
fpga_common: add a status register for RFIC control
fpga_common: add 16x64 RFIC status register bit
fpga_common: add NIOS_PKT_16x64_RFIC_TXMUTE target addr
fpga_common: add RSSI readback shifts/masks
fpga_common: clean up old RFIC cmd defines from pkt_16x64
fpga_common: only build bladerf2_common if required
General documentation cleanup, function name adjustments, merging of
redundant structures, etc.
fpga_common/ad936x_helpers:
Contains wrappers for AD936x RFIC functionality.
fpga_common/bladerf2_common:
Contains bladeRF2-specific helper functions and constants.
fpga_common/ad936x_params:
Reformat (no more tabs, phew)
Move ina219 shunt const to bladerf2_common
host/common/range:
Move functions and macros for handling bladerf_range structs
../libbladeRF/include/bladeRF2.h:
Explicitly index RX/TX FIR enums
Update references to ad936x_params.c
../libbladeRF/src/board/bladerf2/common:
New macros for boilerplate:
- WITH_MUTEX: wrap around locked blocks
- CHECK_STATUS: calls function, checks return code
- CHECK_AD936X: calls function, checks return code, translates
from AD936x to libbladeRF error codes
- CHECK_*_LOCKED: above, but unlocks mutex before erroring
- NULL_CHECK: checks a var for null
Move helper functions into here
../libbladeRF/src/board/bladerf2/bladerf2.c:
Use new macros
Code style fixes
Remove redundant code
In terms of avoiding interference from external signals, the
internal termination may be a better option than exposing the
signal path to external pads.
Both the host and NIOS II FPGA retuning modes now make use of
FPGA v0.4.0's atomic write of the LMS6002D NINT and NFRAC PLL registers.
This helps avoid changing the PLL multiple times when attempting to
configure it.
The cause of tuning failures in "FPGA tuning" mode is caused by
long VTUNE settling times when switching between the search for
VTUNE HIGH and VTUNE LOW.
We now try to force VTUNE to the opposite value and poll for the
expected change instead of simply delaying and hoping VTUNE
has settled before we sample it. If we don't hit the expected VTUNE
value, we'll attempt to walk VTUNE into that region.
With the addition of a warning to the lms.c code, we've been seeing
some codes hit a max VCOCAP value before hitting a VCO limit, indicating
that we're too close to the edge of a band.
This addresses an item picked up by Coverity. Defects in bands[] or
frequency checks could potentially cause an out-of-bounds memory access.
A bounds check has been added to avoid an invalid access, should one of
the aforementioned defect ever creep in.
The backend interface now presents functions for IQ gain/phase
access, instead of lumping it all under "FPGA corrections."
There is no need for the USB code to know anything about LMS
corrections, so this has been moved back up the top level,
with bladerf.c calling into the lms.c functions that now
provide this functionality.
The USB backend now hooks up calls to nios_legacy_* routines.
In the future we can maintain a USB backend that uses these, while
another backend structure proivdes the use of new NIOS packet handlers.
A VCOCAP hint is used as a starting point. The algorithm then walks
either up or down to first find the high or low limit, and then walks
the other way to find the other limit.
These seems to be working well, except we commonly run into a situation
where we never actually see VTUNE = LOW when our estimate is 54 or 55.
This only needs to be done once per initialization, not every time
the device is re-tuned. Moved this to init_device() to cut down
on SPI transactions required to complete tuning operation.
After retuning, the high or low band must be selected. This requires
a few control register ("CONFIG_GPIO") and LMS6 accesses. Moving these
to the retune operation already in the NIOS II removes some extra
USB communication time.
To allow the LMS6002D code to be build into the NIOS II code,
lms.c has been moved to fpga_common and its license has been
changed from LGPLv2 to MIT.
Currently, only the subset of functions required for
frequency tuning are used during a NIOS II build.