Commit graph

64 commits

Author SHA1 Message Date
Rey Tucker
3eb52ea834 fpga_common: ad936x.h: remove unused struct member
This is not present in ad9361_api.h, removing to avoid conflicts...
2018-12-21 15:09:08 -05:00
Rey Tucker
8fa6c84856 fpga_common: ad936x.h: sync with adi's structs 2018-12-17 20:28:07 -05:00
Rey Tucker
54fefeb7ac fpga_common: defines and enums for FPGA RFIC control 2018-12-12 16:42:52 -05:00
Rey Tucker
3cdf9419ca hdl: nios/devices_rfic: fix gainmode setting
Somehow, bladerf2_rfic_init_params.gc_rx1_mode is being set to 0,
causing BLADERF_GAIN_DEFAULT to default to MGC.

This also reduces image size by removing dependency on a couple
functions, and pruning gainmode down to uint8_t.
2018-12-12 14:22:07 -05:00
Rey Tucker
f2c24d2872 fpga_common: assign user-defined space in bladerf_rfic_command 2018-12-11 12:17:55 -05:00
Rey Tucker
4e96014457 fpga_common: define bladerf_rfic_init_state enum 2018-12-06 14:45:24 -05:00
Rey Tucker
8a590e8e0b fpga_common: add BLADERF_RFIC_COMMAND_FASTLOCK 2018-12-06 14:45:24 -05:00
Rey Tucker
57b9970421 fpga_common: nios: NIOS_PKT_16x64_TARGET_RFIC definition
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
2018-12-06 14:45:24 -05:00
Rey Tucker
caf3497d7f fpga_common: ad936x_helpers: omit on non-libad936x Nios builds 2018-12-06 14:45:24 -05:00
Rey Tucker
05f7fd571a host: refactoring bladerf2.c
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
2018-11-26 18:03:45 -05:00
Rey Tucker
1c09cad506 host: bladerf2: use higher-level fns for ad936x TX atten
ad9361_api.h already has good functions for handling TX
attenuation, so use those instead.
2018-11-26 18:03:45 -05:00
Rey Tucker
7939453551 host/fpga_common/thirdparty: move ad936x.h, params.c, config.h
Move these files into more common places, so they can be
used from the FPGA side of the world as well.
2018-11-26 18:03:45 -05:00
Brian Glod
4d9cc217f9 nios: add fast lock save via 8x32 packet ID 0x05
When an 8x32 packet is received with target ID 0x05, the
ad9361_fastlock_save() function is executed. The packet requires an
address to be specified, which is used to determine whether the
operation is for the RX or TX module. Valid addresses are:

  0x00  : receive module
  0x01  : transmit module
  others: do not use, but would be passed to the receive module
2018-11-26 16:03:46 -05:00
Brian Glod
28ea59c83b fpga_common: add retune2 Nios packet format
This is the retune packet for use with bladeRF2 devices.
2018-11-26 16:03:46 -05:00
Rey Tucker
146215e2f3 fpga_common: lms.h: check return val in lms_set_frequency (fixes #691)
If lms_calculate_tuning_params is unsuccessful, then
lms_set_precalculated_frequency is called with an uninitialized
lms_freq struct.
2018-11-12 17:20:33 -05:00
Vanya A. Sergeev
ca0dc6b348 fpga_common: fix overrun in 16x64 NIOS II packet packing 2017-12-21 12:54:57 -05:00
Robert Ghilduta
026e4d11f6 Add INA219 FPGA read/write elements 2017-12-21 12:54:56 -05:00
Robert Ghilduta
b8719317b2 Add ADI AXI FPGA read/write elements 2017-12-21 12:54:56 -05:00
Brian Glod
85b0af2b88 bladerf-micro: nios: Connect ADF400x to 8x32 target 2017-12-21 12:54:55 -05:00
Brian Glod
134d061c2f bladerf-micro: nios: Connect AD5621 to 8x16 packet 2017-12-21 12:54:55 -05:00
Brian Glod
b235397036 bladerf-micro: nios: Add NIOS_PKT_8x32_TARGET_RFFE_CSR
This new 8x32 target is for a 32-bit GPIO for controlling RFFE
signals. Examples include TX/RX band selection switches, resets, and
readback of status outputs.

New default is such that AD9361 is held in reset and not enabled. The
host will have to deassert reset and assert the enable signal before the
AD9361 can be configured.
2017-12-21 12:54:55 -05:00
Vanya A. Sergeev
604337d7d6 fpga_common: add 16x64 NIOS II packet format 2017-12-15 18:15:56 -05:00
Vanya A. Sergeev
562243c80d libbladeRF: refactor codebase for multi-board support
Includes fixups for clean rebase atop bladeRF commit 8b420eb
2017-12-15 18:15:06 -05:00
Robert Ghilduta
d8aa462e6a add libbladeRF and bladeRF-cli support for setting AGC DC correction LUT 2017-07-05 08:58:53 -07:00
Jan Dohl
0d765b70ab fpga_common: Added 8x8 packet IDs RX & TX trigger control packets 2016-05-08 23:17:05 -04:00
Jon Szymaniak
ccce423cff libbladeRF: Added BLADERF_MODULE_INVALID enumeration value 2015-12-28 22:20:20 -05:00
Jon Szymaniak
9cdfbedd5d libbladeRF: Adding VCTCXO tamer mode selection support 2015-12-14 15:29:59 -05:00
Jon Szymaniak
77b8e019f4 nios: Added VCTCXO tamer mode access via 8x8 packet ID 0x02 2015-12-14 15:29:59 -05:00
Jon Szymaniak
75e7793636 libbladeRF: Added bug catcher for CID 1308077
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.
2015-08-12 15:50:00 -04:00
Jon Szymaniak
23ecfad9ed fpga_common: Fixed data unpacking for pkt_8x16 format 2015-06-23 23:12:04 -04:00
Jon Szymaniak
be019d6a3a fpga_common: Addressed MSVC type conversion warnings
These type conversions (and associated truncations) are intentional.
2015-06-18 20:20:58 -04:00
Jon Szymaniak
81a330f010 fpga_common: Added missing #include's 2015-06-18 20:20:58 -04:00
Jon Szymaniak
d28a953ab9 libbladeRF: Use updated NIOS II packet formats for FPGA >= v0.3.0 2015-06-18 20:20:58 -04:00
Jon Szymaniak
8a9572780c hdl, nios: Added 8x8, 8x16, 8x32, 8x64, and 32x32 packet handlers
This packet handlers replace the pkt_legacy function to use
message formats that require only a single request to perform
the specific action.
2015-06-18 20:20:58 -04:00
Jon Szymaniak
3b0d65ca7f nios: Added VCTCXO trim DAC read routine 2015-06-18 20:20:58 -04:00
Jon Szymaniak
a219666893 libbladeRF: Decoupling correction calls from USB code
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.
2015-06-18 20:20:57 -04:00
Jon Szymaniak
9bd4ce9157 nios, libbladeRF: Macro renaming, added PIO addr defs
The legacy packet format uses magic values for the "address" for
PIO accesses. This commit adds some definitions of these to be shared
between the NIOS II code and the host code, to help reduce the
use of magic values.

Some general macro naming has been done to keep the macro naming
scheme for packet handlers more consistent.
2015-06-18 20:20:57 -04:00
Jon Szymaniak
4f37d2b202 libbladeRF, fpga_common: Fixed typo in legacy subdevice address macro 2015-06-18 20:20:57 -04:00
Jon Szymaniak
f4a9ec5dca fpga_common: Added <addr>x<data> packet format definitions 2015-06-18 20:20:57 -04:00
Jon Szymaniak
88bb372cf5 fpga_common: Cleaned up header for NIOS II legacy packet format
Removed unused struct and union.

Added summary of the packet format and its response.
2015-06-18 18:34:30 -04:00
Jon Szymaniak
56916e3c54 fpga_common: Updated NIOS Retune packet format to include queue clear 2015-06-18 18:34:29 -04:00
Jon Szymaniak
196abbbea3 nios: Time all operations performed by retune handler 2015-06-18 18:34:29 -04:00
Jon Szymaniak
6c9d15c518 fpga_common: Updated retune packet Success/Failure flag semantics 2015-06-18 18:34:29 -04:00
Jon Szymaniak
c9fefe0cb5 lms: Added lms_get_quick_tune() implementation 2015-06-18 18:34:29 -04:00
Jon Szymaniak
bf24f9ae50 fpga_common: Fixed retune packet pack() param order 2015-06-18 18:34:29 -04:00
Jon Szymaniak
37eebaf9d9 nios: Added "Quick Tune" flag to retune packet 2015-06-18 18:34:28 -04:00
Jon Szymaniak
9f0c6fd2f7 lms: Added flags with "force VCOCAP" option 2015-06-18 18:34:28 -04:00
Jon Szymaniak
80fb8ee526 lms: Struct re-order nitpick 2015-06-18 18:34:28 -04:00
Jon Szymaniak
cbcca71de5 lms: Provided VCOCAP back to caller 2015-06-18 18:34:28 -04:00
Jon Szymaniak
090c05d6bd libbladeRF, nios: Added VCOCAP hint to nios retune pkt 2015-06-18 18:34:28 -04:00