Commit graph

3,069 commits

Author SHA1 Message Date
Rey Tucker
bfe1b7ca86 host: bladeRF-cli: ADDING_COMMANDS: convert to markdown, freshen
clean up formatting

fix typos

expand discussion of generate.bash
2018-12-06 22:07:26 -05:00
Rey Tucker
18e79836bd hdl: nios: devices_rfic: implement missing frequency reset in standby
oops
2018-12-06 14:45:24 -05:00
Rey Tucker
b8d8667722 hdl: nios: devices_rfic: add standby state, refactor initialization
hdl: nios: devices_rfic: add a standby initialization state

this will be used to indicate that the board is not actively
being driven, but is still initialized and ready to go

improve debugging output

enforce a hard reset at the start of initialization

hdl: nios: devices_rfic: perform init/tuneup on FPGA

Move some of the initialization tasks, previously done on the host and
forwarded up, to the Nios.

Also wee bit of refactoring/cleanup.
2018-12-06 14:45:24 -05:00
Rey Tucker
4e96014457 fpga_common: define bladerf_rfic_init_state enum 2018-12-06 14:45:24 -05:00
Rey Tucker
d3aaf3730a hdl: nios: retune2: invalidate RFIC ctrl freq when fastlocking
hdl: nios: devices_rfic: implement frequency invalidation

when doing a retune via direct SPI writes, libad936x's idea of state is
totally destroyed until the next time a "normal" retune is performed.

hdl: nios: pkt_retune2: inval freq on profile_activate

After doing direct SPI fastlock activities, _rfic_cmd_rd_freq can no
longer provide a valid answer until the next _rfic_cmd_wr_freq. Signal
to the RFIC driver that this has happened, so it can govern itself
accordingly.
2018-12-06 14:45:24 -05:00
Rey Tucker
fbfc4f6373 hdl: nios: devices_rfic: implement BLADERF_RFIC_COMMAND_FASTLOCK 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
dc8440c44b hdl: nios: devices: fix shift in adi_rfspdt_select
p->spdt was not being shifted into the right place, so the SPDTs
were not being properly set on a retune

also reference the magic numbers back to bladerf2_common.h
2018-12-06 14:45:24 -05:00
Rey Tucker
38ab5a0cfb hdl: nios: clean up Makefile indentation
Apparently indentation must consist of a single tab character,
and GNU make is serious about that.

However, elsewhere, use spaces.
2018-12-06 14:45:24 -05:00
Rey Tucker
0e58bbc796 hdl: FPGA version -> v0.10.1 fpga_v0.10.1 2018-12-06 14:45:24 -05:00
Rey Tucker
a964f22786 hdl: nios: implement Nios-based RFIC control
hdl: nios: implement a queuing strategy for RFIC commands

hdl: devices_rfic: all writes now go to queue

hdl: devices_rfic: move queue stuff into its own file

hdl: devices_rfic: cleanup includes, etc

hdl: devices_rfic: debugging improvements...

hdl: devices_rfic: code cleanup/formatting/streamlining

hdl: devices_rfic: track return value of queued jobs

stores a .rv member in the queue entry struct, then copies that to the
queue's .last_rv member at job completion.

standardizes _rfic_command_write_init args for future
function-pointerization.

hdl: devices_rfic: use function pointers

hdl: devices_rfic: remove inline hint, log_error->DBG

hdl: devices_rfic: swap read/write in rfic_command_fns for consistency

hdl: nios/devices_rfic: move stuff into a state struct

hdl: nios/Makefiles: dont build devices_rfic* on bladerf1

devices_rfic.c: remove stubs

devices_rfic.c: formatting

devices_rfic.h: only include if required

pkt_16x64: guard around bladerf2

pkt_16x64: more guards

pkt_16x64 brf2 guard tweak

pkt_16x64.h: guard the PKT_16x64 define

hdl: nios: devices_rfic: implement INIT command

hdl: devices_rfic: de-assert txnrx/enable

hdl: devices_rfic: move init read to its own fn

hdl: nios: devices_rfic: implement FREQUENCY command

hdl: nios: use shortened _rffe_*_enabled fn names

hdl: nios: devices_rfic: implement STATUS command

hdl: devices_rfic: implement RFIC status register

hdl: nios: implement _rfic_command_read_status

hdl: nios: devices_rfic: implement SAMPLERATE command

hdl: nios: devices_rfic: implement BANDWIDTH command

hdl: nios: devices_rfic: implement GAINMODE command

hdl: nios: devices_rfic: implement GAIN command

hdl: nios: devices_rfic: implement ENABLE command

hdl: nios: devices_rfic: implement RSSI command

hdl: nios: devices_rfic: use new common #defines

hdl: nios: devices_rfic: implement FILTER command

hdl: nios: devices_rfic: implement TXMUTE command
2018-12-06 14:45:24 -05:00
Rey Tucker
9c4a2cb091 hdl: build libad936x for bladerf-micro platform
hdl: bladeRF_nios: add missing PRI*64 defines

hdl: nios: add typedef for stubbing out pthread types

hdl: nios: fixup makefile stuff

hdl: nios: include host/common resources

hdl: nios: build system adjustments

hardware-specific includes

hdl: nios: fix typo in bladerf-micro

hdl: nios: clean up include dirs

hdl: nios: conditional define for BLADERF_NIOS_LIBAD936X
2018-12-06 14:45:24 -05:00
Rey Tucker
608bf0b673 hdl: nios: split up build files by platform 2018-12-06 14:45:24 -05:00
Rey Tucker
863b2a75b8 hdl: add build ancillaries for libad936x on nios
hdl: build libad936x for bladerf-micro platform

hdl: nios: initial build skeleton

hdl: nios: make ad936x config.h platform-specific

hdl: nios: libad936x: allow build-time logging configuration

hdl: adi: cmakelists: reduce overly-restrictive version req

hdl: nios: libad936x: build with new ad936x_params.c

hdl: nios/adi: add ARRAY_SIZE to stub host_config.h
2018-12-06 14:45:24 -05:00
Rey Tucker
e3fdf7d7bb hdl: nios: clean up devices.c, wrap fns in platform ifdefs 2018-12-06 14:45:24 -05:00
Rey Tucker
22760ca6b2 hdl: nios: rename ad9361_* accessors
libad936x has its own ad9361_* functions, so rename our local ones
to adi_*
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
817d07331c thirdparty: adi: add bladerf2_headless platform
this is distinct enough from platform_bladerf2 that it's worth splitting
it off

thirdparty: adi/brf2_hl: use multiply for msec->usec conversion

This is slightly more accurate than shifting by 10, and matches other
msleep() implementations.

thirdparty: adi: make config.h platform-specific (bladerf2_headless)

thirdparty/adi: disable split gain tables, verbose logging on nios

thirdparty: adi/brf2_hl: run clang-format on these files

they're new on this branch, so i can do this :)

thirdparty: adi: brf2_hl: reduce ad9361 logging

thirdparty: adi: rm vestigial params.c (bladerf2_headless)
2018-12-06 14:45:24 -05:00
Rey Tucker
3cb4671148 hdl: nios: platform-specific guards for pkt_*.c
significantly reduces memory consumption on smaller FPGAs
2018-12-06 14:45:24 -05:00
Rey Tucker
f5de4e2303 hdl: bladerf-micro: nios: gratuitous screen placebo
ensure there is some console output every second or so, to
keep me from doubting my sanity
2018-12-06 14:45:24 -05:00
Rey Tucker
b9e50e68ca hdl: nios: fixup DBG printf formats
alt_printf will only do %x. not %02x, not %d, just %x and %s and %c.

hdl: nios: pkt_legacy: stub out DBG to reduce screen clutter
2018-12-06 14:45:24 -05:00
Rey Tucker
c0c3a6b6e9 hdl: nios: remove duplicate #includes 2018-12-06 14:45:24 -05:00
Rey Tucker
bdac315aab host: common: range.c: only build these if necessary on Nios 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
a20fd82aca fpga_common: lms.c: fix up vtune_str ifdefs
we also need this if BLADERF_NIOS_DEBUG is enabled
2018-12-06 14:45:24 -05:00
Rey Tucker
9e8bd237bc host: bladerf2: fix double-mutexing in low-samplerate-mode
During the recent refactor, the RFIC FIR filter functions got
wrapped in a MUTEX_LOCK.  This is incompatible with their use
by bladerf2_set_sample_rate, which is called within a MUTEX_LOCK.
🤦‍♀️
2018-12-06 14:09:20 -05:00
Brian Glod
3db286e3ec
nios: update README.md for GDB debugging
Edited for typos and clarity.
2018-12-04 17:55:12 -05:00
Brian Glod
5ff598a1b1
nios: update README.md for GDB debugging
- Add tutorial for command-line GDB debugging for those who want to avoid eclipse.
- Add debugging tips (increasing timeouts, disabling compiler optimization)
2018-12-03 17:08:51 -05:00
Rey Tucker
79b936a811 fpga_common: ad936x_helpers: fix for loop initial declaration 2018-11-26 18:03:45 -05:00
Rey Tucker
8eade905b1 host: libbladeRF: bladerf2: cleanup sched retune fns, channel iterators
Fixes up new code introduced by scheduled retune support

Also updates a few places to use FOR_EACH_DIRECTION and
FOR_EACH_CHANNEL.
2018-11-26 18:03:45 -05:00
Rey Tucker
f644ceca63 host: common: add iterators.h
Adds iterators.h, which contains macros useful for iterating over
directions and/or channels.
2018-11-26 18:03:45 -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
Rey Tucker
fd77d9f4a9 hdl: build: parameterize nios2 RAM size by platform/size
On xA4/xA9, we can have a larger memory footprint, and we need
it for libad936x, which is a hefty boi
2018-11-26 16:16:10 -05:00
Rey Tucker
0988f86d71 host: libbladeRF_test: fix decimal const warning on i386
Fixes the following error:

`error: this decimal constant is unsigned only in ISO C90 [-Werror]`

which was introduced by Nuand/bladeRF#706
2018-11-26 16:05:49 -05:00
Rey Tucker
a5044baaf5 host: libbladeRF_test: fix Windows build 2018-11-26 16:03:46 -05:00
Brian Glod
e9347af38d nios: preload bladeRF2 fast lock profiles
Try to load bladeRF2 fast lock profiles into the RFFE as the scheduled
retune requests are enqueued. This has the potential to speed up retune
times because the profile will be ready before the request goes 'live'.
2018-11-26 16:03:46 -05:00
Brian Glod
20a61ce17c nios: GCC option: treat warnings as errors
Add -Werror option to GCC to treat warnings as errors when compiling the
Nios code.
2018-11-26 16:03:46 -05:00
Brian Glod
b2149ebbb5 nios: GCC option: enable short-enums
The '-fshort-enums' optimization will tell GCC to pack enums into the
smallest data type it can instead of defaulting to 32 bits. This means
most enums will be packed into 8-bit data types, saving some
memory. On newer processors, 8-bit data access can be slower than
32-bit or 64-bit accesses, but that should not be a problem on something
like the Nios.
2018-11-26 16:03:46 -05:00
Brian Glod
643ddd0984 host: libbladeRF_test/scheduled_retune: add bladeRF2 support 2018-11-26 16:03:46 -05:00
Brian Glod
7a83b2da8e host: libbladeRF/bladerf2: cancel scheduled retunes at device open/close
Clear out any scheduled retunes that may exist in the Nios during
bladerf2_open() and bladerf2_close(). This helps prevent unexpected
behavior if the device is (re)opened later.
2018-11-26 16:03:46 -05:00
Brian Glod
881c3e1fd4 host: common/devcfg: check board name before setting gains
Wrap bladeRF1-only gain functions around a conditional so they are not
executed on bladeRF2 boards.

This commit is intended to be a stopgap to get the quick tune tests to
build and function on bladeRF2 devices. A follow-up commit using the
more generic 'system gain' functions would be optimal.
2018-11-26 16:03:46 -05:00
Brian Glod
1bf42db93f host: libbladeRF_test/tune_timing: add bladeRF2 support 2018-11-26 16:03:46 -05:00
Brian Glod
d140bbb787 host: libbladeRF/bladeRF2: implement bladerf2_get/set_tuning_mode()
Only valid mode is HOST, but the functions won't blindly return
UNSUPPORTED.
2018-11-26 16:03:46 -05:00
Brian Glod
2806663825 host: libbladeRF_test/quick_retune: add randomized hopping
Add support for "randomized" hopping. Minor cleanup.
2018-11-26 16:03:46 -05:00
Brian Glod
9e3ff911ab host: libbladeRF_test/quick_retune: support N freqs
Add support for any number of retune frequencies and spacing of these
frequencies.

Limitation: this test program does not support command arguments (never
has), so the number of frequencies, frequency spacing, and center
frequency must be set in the code before building.
2018-11-26 16:03:46 -05:00
Brian Glod
0f5f09adf3 host: libbladeRF/bladeRF2: implement bladerf2_cancel_scheduled_retunes() 2018-11-26 16:03:46 -05:00
Brian Glod
274d08d4b0 host: libbladeRF/bladeRF2: implement bladerf2_schedule_retune()
Adds schedule retune functionality to bladeRF2.
2018-11-26 16:03:46 -05:00
Brian Glod
6516cfa8e9 host: libbladeRF/bladeRF2: handle quick tune profile numbering
Let libbladeRF handle the quick tune profile numbering for bladeRF2
devices. This makes it so that existing bladeRF1 applications using the
quick tune feature should "just work" with bladeRF2.
2018-11-26 16:03:46 -05:00