Commit graph

111 commits

Author SHA1 Message Date
Ryan Thompson
e2f5b369d4 libbladeRF: usleep no longer necessary per fix to stream format config 2023-02-13 03:28:19 -08:00
Ryan Thompson
4150c8fa9b host: test_digital_loopback bitmode select added
The digital loopback test now allows for the selection of 8bit or 16bit
mode from the command line using -b or --bitmode command line
arguments.
2023-02-13 03:28:19 -08:00
Ryan Thompson
6c20bc9e06 host: test_digital_loopback RX stream enable fix
rx module in test_digital_loopback now waits for a running tx stream before enabling
2023-02-13 03:28:19 -08:00
Ryan Thompson
ea0edf3f52 host: comments added to test_digital_loopback
clarified rx, tx, and loopback initializations and enabled stream
sections
2023-02-13 03:28:19 -08:00
Ryan Thompson
15b7d9c3b6 host: squashed cmake warnings
updated cmake requirement from 2.8 to 2.8.12
2023-02-13 03:28:19 -08:00
Milosch Meriac
0ffb795c45 Fix broken memcpy
Code copies data from pointer location instead from pointer target - resulting in invalid copied data and overreading from the pointer pointr position.
2022-07-24 05:17:02 -07:00
Robert Ghilduta
7740242c7b add bladeRF 2.0 micro xA5 support to libbladeRF and FPGA 2022-04-03 19:39:10 -07:00
Rey Tucker
d1a9c8e12a host: libbladeRF_test: fixup test_gain on bladerf2
Works around a minor bug in fpga v0.10.2 where the frequency
post-init is not valid, which makes bladerf_enable_module fail
until a frequency change is done.

Also only enable RX channels, not TX channels.

Also don't try to change gain modes on TX channels.
2018-12-21 15:18:47 -05:00
Rey Tucker
9665189852 host: libbladeRF_test/quick_retune: add ctrl-C handler; modernize
aborting without calling bladerf_close() causes some confusion
with FPGA-based RFIC control.  this likely needs dealt with at
the protocol level, but in the meantime, we can ensure that
bladerf_close() happens and everything spins down by trapping
ctrl-C.

also shift to using BLADERF_CHANNEL_TX(0) instead of
BLADERF_MODULE_TX, BLADERF_TX_X1 for sync_config, and
other minor tweaks
2018-12-12 16:42:52 -05:00
Rey Tucker
d1fd240b2f host: libbladeRF-test/repeated_stream: fix impossible uninit var
I believe this particular situation is impossible in actual
practice (it would require params.rx being false initially but
set to true by the TX thread very quickly, or vice versa), but
it's easy enough to clean up.

Bug reported by the clang static analyzer.

Description: 1st function call argument is an uninitialized value
File: /root/bladeRF/host/libraries/libbladeRF_test/test_repeated_stream/src/main.c
Line: 283
2018-12-07 19:30:07 -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
643ddd0984 host: libbladeRF_test/scheduled_retune: add bladeRF2 support 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
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
Rey Tucker
0bc1f8cfcd host: test_ctrl: fix rounding, types, and casts
Windows build fixes...
2018-11-19 16:14:59 -05:00
Rey Tucker
2c7ceb5560 host: test_ctrl: improved direction/channel iterators
Windows was not happy with how I was doing things. And honestly, I
wasn't entirely happy either :)

This seems to work better, with less weird punctuation.
2018-11-19 16:14:59 -05:00
Rey Tucker
dc72e2cc64 host: test_ctrl: typedef failure_count as an alias for size_t 2018-11-19 16:14:59 -05:00
Rey Tucker
3a9f1ceaa8 host: test_repeated_stream: don't initialize pthreads
On Windows, pthread_t is a struct {void *p; unsigned int x;} and
initializing it to 0 is unwise.

On Linux, pthread_t is unsigned long int.

Fixes MSVC Error C2440
2018-11-19 16:14:59 -05:00
Rey Tucker
a4bdef90d4 host: test_ctrl: skip test_threads if using bladerf2+host tuning
This puts the RFIC driver into a bad state, and I'm not entirely sure
why yet.
2018-11-19 13:23:04 -05:00
Rey Tucker
4f1d9c08fd host: test_ctrl: fix lockup during test_threads
test_gain now enables a channel before poking the gain, which is
required to pass the test on bladerf2.  however, test_threads
already enables the channels in question, which resulted in the
test locking up and failing.
2018-11-19 13:23:04 -05:00
Rey Tucker
9425859a48 host: test_ctrl: fix up gain test to work with bladerf2 2018-11-19 13:23:04 -05:00
Rey Tucker
df5354b156 host: test_ctrl: factor out direction/channel iteration 2018-11-19 13:23:04 -05:00
Rey Tucker
9c77978195 host: test_ctrl: update channel types, clang-format
Replaces bladerf_module with bladerf_channel throughout.

Cleans up formatting, code style, etc
2018-11-19 13:23:04 -05:00
Rey Tucker
812b54cbbd host: test_ctrl: fixup some tests to work with bladerf2 2018-11-19 13:23:04 -05:00
Rey Tucker
2d3b53f9ea host: test_ctrl: exit early if hardware is not supported 2018-11-19 13:23:04 -05:00
Rey Tucker
8ba6223638 host: test_ctrl: add --tuningmode command line option 2018-11-19 13:23:04 -05:00
Rey Tucker
6f4c155077 libbladeRF_test: fix spurious uninitialized variable warning (fixes #695) 2018-11-12 17:20:33 -05:00
Rey Tucker
85fd6da22a
host: fix builds on 32-bit platforms (#573)
Builds were failing in various ways on 32-bit platforms, due to various assumptions (and the fact that pretty much everything is 64-bit nowadays). This PR should fix all of them so that it builds clean.

* host: libbladeRF/thirdparty/adi: fix build error on 32-bit systems

sizeof(void*) is not necessarily equal to sizeof(uint64_t)

* host: libbladeRF/doc: fix 32-bit build failure on doc example

sizeof(size_t) does not always equal sizeof(uint64_t)

* host: docker: remove centos-7-i386 build

it doesn't work, and this is an edgy-enough case that i think we'll be
okay with the ubuntu i386 builds

* host: libbladeRF/bladerf2: explicitly note constant types

On non-64-bit platforms, these integer constants can be ambiguous, which
throws compiler warnings.

* host: libbladeRF_test: explicitly note constant types

On non-64-bit platforms, these integer constants can be ambiguous, which
throws compiler warnings.
2018-08-16 18:57:52 -04:00
Rey Tucker
21059b2a68 host: libbladeRF_test: fix printf of int64_t value
Fixes build failure on macOS
2018-08-07 18:23:19 -04:00
Robert Ghilduta
5efc05eec7 test_repeater: fixup test 2018-08-07 11:22:19 -05:00
Robert Ghilduta
75836c52f3 test_peripheral_timing: add testing for RFIC 2018-08-07 11:22:19 -05:00
Rey Tucker
a6a58e5ed6
host: Windows build fixes (#62) 2018-06-01 18:29:02 -04:00
Rey Tucker
87a90c7682 host: libbladeRF_test: fix missing main() return 2018-06-01 16:43:25 -04:00
Rey Tucker
fff07e422c
host: bladeRF_cli: add support for MIMO RX and TX (#57)
Adds support for multi-channel RX and TX via the bladeRF-cli utility
2018-05-30 15:27:54 -04:00
Rey Tucker
1dc6317b93
host: make low-level API calls generic by removing part numbers (#49)
Instead of using specific part numbers for low-level API calls on the bladeRF micro, use generic functionality-based names.
2018-05-25 10:55:04 -04:00
Rey Tucker
5023f0cb03
host: fix build errors and clang-scan warnings (#47)
* devinfo: fix strncpy error

Fix two build errors on Arch:

/root/bladeRF/host/libraries/libbladeRF/src/devinfo.c:308:5:
error: ‘strncpy’ destination unchanged after copying no bytes
[-Werror=stringop-truncation]
/root/bladeRF/host/libraries/libbladeRF/src/devinfo.c:308:5:
error: ‘strncpy’ output truncated before terminating nul copying as many
bytes from a string as its length [-Werror=stringop-truncation]

* bladerf2/params: fix implicit conversion error

/root/bladeRF/host/libraries/libbladeRF/src/board/bladerf2/params.c:437:7:
error: implicit conversion from 'int' to 'int16_t' (aka 'short') changes
value from 32768 to -32768 [-Werror,-Wconstant-conversion]
      32768,      0,      0,      0,      0,      0,      0,      0,
      ^~~~~

* Doxyfile: fix CLANG_ASSISTED_PARSING warning

fixes:

warning: Tag `CLANG_ASSISTED_PARSING' at line 1033 of file
`/root/bladeRF/build/host/libraries/libbladeRF/doc/doxygen/Doxyfile'
belongs to an option that was not enabled at compile time.
         To avoid this warning please remove this line from your
configuration file or upgrade it using "doxygen -u", or recompile
doxygen with this feature enabled.
warning: Tag `CLANG_OPTIONS' at line 1041 of file
`/root/bladeRF/build/host/libraries/libbladeRF/doc/doxygen/Doxyfile'
belongs to an option that was not enabled at compile time.
         To avoid this warning please remove this line from your
configuration file or upgrade it using "doxygen -u", or recompile
doxygen with this feature enabled.

* libbladeRF: fix doxygen build error

fixes:
/home/rtucker/dev/privatebladeRF/host/libraries/libbladeRF/include/libbladeRF.h:2284:
warning: unable to resolve link to `sync_tx_meta.html' for \link command

* bladeRF-fsk: fix clangscan warning

/root/bladeRF/host/utilities/bladeRF-fsk/c/src/correlator.c:261:59:
warning: The left operand of '/' is a garbage value
        corr->ins1->real = corr->ins2->real = samples[i].i/2048.0f;
                                              ~~~~~~~~~~~~^
1 warning generated.

* fpga_common/lms.c: fix clangscan warning

/root/bladeRF/fpga_common/src/lms.c:2329:14: warning: 3rd function call
argument is an uninitialized value
    status = write_vcocap(dev, base, f->vcocap, vcocap_reg_state);
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.

* test_repeated_stream: fix clangscan warning

/root/bladeRF/host/libraries/libbladeRF_test/test_repeated_stream/src/main.c:284:9:
warning: 1st function call argument is an uninitialized value
        pthread_join(rx_thread, NULL);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.

* test_interleaver: fix clangscan warning

/root/bladeRF/host/libraries/libbladeRF_test/test_interleaver/src/main.c:119:17:
warning: 4th function call argument is an uninitialized value
                snprintf((rowstr + rowidx), rowsize - rowidx, "%02x",
*u8buf++);
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.

* test_tx_gmsk_bursts: fix clangscan warning

/root/bladeRF/host/libraries/libbladeRF_test/test_timestamps/src/test_tx_gmsk_bursts.c:69:5:
warning: 2nd function call argument is an uninitialized value
    printf("  Frequency: %u\n", s->frequency);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.

* ad9361_api.c: fix clangscan warning

/root/bladeRF/host/libraries/libbladeRF/src/driver/thirdparty/adi/ad9361_api.c:445:3: warning: Value stored to 'ret' is never read
                ret = -ENODEV;
                ^     ~~~~~~~
1 warning generated.

* correlator: another attempt to fix clangscan warning

* Revert "fpga_common/lms.c: fix clangscan warning"

This reverts commit 8cbb5f03f0d0927befa5053e9564df06d13ede72.

* test_interleaver: fixup clang-scan warning

some sloppy init, some messy iteration, the usual :)

/root/bladeRF/host/libraries/libbladeRF_test/test_interleaver/src/main.c:124:17:
warning: 4th function call argument is an uninitialized value

* Revert "ad9361_api.c: fix clangscan warning"

This reverts commit 14a7f8f53f84aeff721a752259ca9596a13e3a2a.

* bladeRF-fsk: fixup clang-scan warning fix
2018-05-23 12:14:26 -04:00
Rey Tucker
ee55f859b9
host: clean up build warnings across multiple platforms (#21)
With this commit, we build without warnings on Arch Linux; CentOS 7; Debian 8 and 9; latest Fedora; Ubuntu 14.04, 16.04, 17.10, and 18.04; Visual Studio 2017; and macOS 10.13.3 w/ Homebrew.

* host: libbladeRF: compile AD9361 srcs with -std=gnu11

Fixes compile errors involving ‘for’ loop initial declarations only
allowed in C99 or C11 mode, on older GCCs.

* host: libbladeRF/adi: remove stdbool workaround

This is not necessary now that we're building to -std=gnu11, and in
fact, it seems to create a conflict.

* host: libbladeRF: pre-declare loop variables

Some compilers are not happy with declaring the loop variable in the for
statement.  Begrudgingly placate them.

* host: libbladeRF_test: pre-declare loop variables

Some compilers are not happy with declaring the loop variable in the for
statement.  Begrudgingly placate them.

* host: bladeRF-cli: pre-declare loop variables

Some compilers are not happy with declaring the loop variable in the for
statement.  Begrudgingly placate them.

* host: libbladeRF: remove refs to strings.h

Windows doesn't have strings.h, but string.h seems to do just fine.

* host: libbladeRF: fix windows compile errors (WIP)

* host: libbladeRF/ad9361: fix windows compile error

"IGNORE" is #define'd in the Windows environment, creating a conflict.
Renaming this to solve the conflict.

* host: common: add setenv implementation for Windows

* host: libbladeRF: build setenv.c stub on Windows

* host: bladeRF-cli: use setenv stub on Windows

* host: common: fixup spacing consistency in setenv

* host: libbladeRF: cast channel macros to bladerf_channel

Visual Studio is picky about this, and throws warnings.

* host: libbladeRF: bladerf2.c: undo workaround for bladerf_channel

* host: libbladeRF: bladerf_get_gain_stages count type is now size_t

This fixes a Windows compile error, and is also generally more sensible.

* host: bladeRF-cli: fix windows compile errors

* host: ad9361: fix variadic macro syntax

Fixes Windows build errors

* host: ad9361: rename _DEBUG to AD9361_DEBUG

Visual Studio automagically sets _DEBUG if the /MDd option is set. Turns
out that a lot of the debugging sections don't build in Visual Studio,
so this accounts for a large number of the build errors...

* host: libbladeRF: fixes for Visual Studio builds

* host: common: fixes for Visual Studio builds

* host: libbladeRF/ad9361: fixes for Visual Studio builds

* host: libbladeRF_test: fixes for Visual Studio builds

* host: bladeRF-cli: fixes for Visual Studio builds

* host: bladeRF-cli: fix static analysis warnings

Fixes potential memory leak in main

Fixes unused values in set_adf_refclk, set_samplerate

* host: common: fix static analysis warnings

fixes:
unread variable in perform_rx_cal
memory leaks in add_arg, add_opt

* host: libbladeRF: fix static analysis warnings

fixes unused variables in bladerf2_set_gain and xb100_enable
2018-04-03 18:20:51 -04:00
Rey Tucker
f670bedc86 host: test: fix compile errors on test_config_file (#551)
On older compilers, 'for' loop initial declarations are not allowed by
default. So, use the old style for maximum compatibility.

h/t Christophe Devine
2018-03-30 14:05:08 -04:00
Rey Tucker
dc7094abb9 host: libbladeRF_test: win32 fixes for test_config_file (#546)
* host: common: add mkdtemp implementation for Win32

Windows does not have mkdtemp, which is something used by at least one
test case. This is a simple-enough implementation thereof.

* host: common/host_config: add more defs on Win32

chdir, getcwd, rmdir, unlink, and mkdir are all somewhat special on
Win32, so they need special handling.

* host: test_config_file: fix builds on Win32
2018-03-30 14:04:40 -04:00
Rey Tucker
9761a90ec2 host: libbladeRF: Add documentation and test program for config file handling (#539)
* host: libbladeRF: fix typo of "bandwidth" cfg file key

* host: libbladeRF: add documentation for config files

* host: libbladeRF: config.c: minor typo fix

* host: libbladeRF_test: add test case for config file parsing

Creates a surrogate config file with a few different scope restrictions,
then makes sure the configuration is applied appropriately in the end.
2018-03-30 14:01:32 -04:00
Brian Glod
f06679bf78 host: libbladeRF_test: Fix GCC undefined operation
"state->idx = (++state->idx)" is undefined behavior for the compiler
2018-01-15 13:31:24 -05:00
Rey Tucker
1b066d7ca9 host: libbladeRF_test: test_digital_loopback fixes
Make test_digital_loopback work with bladeRF micro

General cleanup/modernization
2018-01-12 18:07:19 -05:00
Rey Tucker
470480d32f host: libbladeRF_test: fix cmake error from merge 2017-12-21 12:55:09 -05:00
Rey Tucker
b3aa319240 interleave: add stub func in bladerf.c for consistency 2017-12-21 12:55:07 -05:00
Rey Tucker
eda91f13aa test_interleaver: formatting, optimization, cleanup 2017-12-21 12:55:07 -05:00
Rey Tucker
0558444a77 WIP: test_interleaver 2017-12-21 12:55:07 -05:00
Rey Tucker
b35c875eb3 test_interleaver: WIP 2017-12-21 12:55:07 -05:00
Rey Tucker
a66afa93ab WIP: add interleaver unit test, move to helpers 2017-12-21 12:55:07 -05:00