Commit Graph

72 Commits

Author SHA1 Message Date
Eric Wild dadabeceaf cmake: actually make linking work
Appending to lists from subdirs does not work as expected, so work
around that to allow collecting the necessary libs.
2020-08-03 02:20:16 +02:00
Clayton Smith 52fcb0935f A lot of Boost functionality is available in C++11. Since GNU Radio is moving away from Boost, it probably makes sense to do so in gr-osmosdr as well.
This change removes all usage of boost::mutex,
boost::mutex::scoped_lock, boost::unique_lock, and
boost::condition_variable. It also removes usage of boost::shared_ptr
and boost::weak_ptr outside of block definitions (which must continue to
use Boost until GNU Radio 3.9).

Signed-off-by: Eric Wild <ewild@sysmocom.de>
2020-08-02 23:52:25 +02:00
Piotr Krysik 8cf6840da1 cmake: Go back CMake min ver. 3.8 by removing need for CMP0079
CMake 3.13 is not present in older (~2 years old)
Linux distributions and GNU Radio requires min CMake
version 3.8.

All that is needed in order to avoid bumping CMake version
is to not use 'target_link_libraries' in subdirectories.
Here this is done by creating a list of needed
libraries and adding them for linking at the end (like
it was done in gr-osmosdr before porting to GNU Radio 3.8).

One thing that is lost here is 'PRIVATE' statement in case
of FCD libraries linking.

Signed-off-by: Eric Wild <ewild@sysmocom.de>
2020-08-02 22:17:05 +02:00
Sylvain Munaut 5d59e56ff9 build: Update build system to GR 3.8 standards
Part of GNURadio 3.8 migration

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2020-02-16 09:52:00 +01:00
Sylvain Munaut 982945a477 build: Update CMakeLists.txt copyright header
Part of GNURadio 3.8 migration

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2020-02-16 09:51:37 +01:00
Robert Ghilduta 4d83c6067f bladerf: update bladerf to catch up with libbladeRF 2018-08-15 19:53:26 +02:00
Rey Tucker c06db96489 bladeRF: add support for biastee on bladeRF micro 2018-08-15 19:53:26 +02:00
Rey Tucker 2e2ff98c83 bladerf: remove vestigial map 2018-08-15 19:53:26 +02:00
Rey Tucker b4e69137f3 bladerf: use bladerf_get_channel_count where available 2018-08-15 19:53:26 +02:00
Rey Tucker bee32d9f0d bladerf: compatibility with older libbladeRF
Implement compatibility with older libbladeRF versions
2018-08-15 19:53:26 +02:00
Rey Tucker 8f8b137cee bladerf: add support for MIMO
Squashed commit of rtucker-bladerf-hierarchy branch:

commit 35442da7d390919f6f9cbae3f69d6dc32ca595bb
through
commit 9026136cfdbc7116f55af18cb06d1731330fa13f
2018-08-15 19:53:26 +02:00
Rey Tucker c4a0781367 bladerf_common: tweak buffer/transfer settings
Based on experimentation, a good value for transfers seems to be 16, but
more buffers are definitely warranted for an optimal default experience.
2018-08-15 19:53:26 +02:00
Ryan Tucker c8e69edb7b bladerf: add set_rx_mux_mode functionality
Also plumb through as rxmux= device argument
2018-08-15 19:53:26 +02:00
Ryan Tucker 68ba383fd5 bladerf: add firmware loopback mode 2018-08-15 19:53:26 +02:00
Ryan Tucker ea6cc4beb9 bladerf_common: add agc= option to set gain mode 2018-08-15 19:53:26 +02:00
Ryan Tucker 0132f6c494 bladerf: use nchan option to enable multi-channels
By default, the bladeRF source and sink will expose 1 channel, unless
nchan is set, in which case it will expose either that number of
channels, or the number of channels supported by the device if lesser.

If nchan > 1 (after validation), MIMO mode is enabled.
2018-08-15 19:53:26 +02:00
Ryan Tucker 814fe0809c bladerf: fix get_gain_names population
Instead of haphazardly iterating through the gain strings, just use the
count returned.
2018-08-15 19:53:26 +02:00
Ryan Tucker 077697cb2d bladerf: formatting/style fixes on .h files 2018-08-15 19:53:26 +02:00
Ryan Tucker 399db91385 bladerf: formatting/consistency fixes 2018-08-15 19:53:26 +02:00
Ryan Tucker ed4dda192b bladerf_common: formatting/whitespace/consistency 2018-08-15 19:53:26 +02:00
Ryan Tucker cee878536a bladerf: replace bladerf_module with bladerf_direction
More closely matches the handling in the API
2018-08-15 19:53:26 +02:00
Ryan Tucker 07babe997d bladerf_common: cleanup on set_gain_mode
Turns out that source/sink_impl already handle the AGC->MGC gain
preservation, so this was redundant and counterproductive.

Also DRY the code a bit.
2018-08-15 19:53:26 +02:00
Ryan Tucker 3523097e00 bladeRF: fix identification of channels 2018-08-15 19:52:57 +02:00
Ryan Tucker 855ac41c12 bladeRF: remove set_bb_gain
This is not meaningful with bladeRF hardware
2018-08-15 19:52:57 +02:00
Rey Tucker 4ffccd1363 update copyright dates 2018-08-15 19:52:57 +02:00
Rey Tucker a6209e3250 formatting/wording tweaks 2018-08-15 19:52:56 +02:00
Ryan Tucker 107b35bee3 bladerf2: add get_gain_mode and set_gain_mode 2018-08-15 19:52:56 +02:00
Ryan Tucker 708096f6e4 WIP: libbladeRF rev2 refactoring etc 2018-08-15 19:52:56 +02:00
Ryan Tucker 4395c3e6c7 WIP: more port work 2018-08-15 19:52:56 +02:00
Rey Tucker 56da34f7f2 bladerf: initial support for new bladeRF hardware
Relies on some new libbladeRF API calls. Has been tested
with gqrx on new bladeRF hardware (as a source) but have
not yet tested sink, or existing bladeRF hardware.
2018-08-15 19:52:56 +02:00
Dimitri Stolnikov e9dde9afd7 bladerf: discover and use Volk 2017-02-27 23:23:54 +01:00
Sylvain Munaut 71846180f5 bladeRF: Use VOLK for type conversion
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2017-02-27 23:03:43 +01:00
Dimitri Stolnikov 2b79811350 bladerf: implement options for clock configuration
Since firmware 2016.01-rc1 bladeRF has the ability to lock to an
external reference as well as produce arbitrary frequency signal
(25 MHz here) on its clock output.

Use gr-osmosdr source with the following arguments to produce 25
MHz on the SMB connector:

osmocom_fft -a bladerf,smb=25e6

smb=25e6

To lock the bladeRF itself to an external GPSDO reference, use
additional arguments tamer=external for 10MHz or tamer=external_1pps for
1PPS GPSDO signals.

osmocom_fft -a bladerf,smb=25e6,tamer=external

tamer={internal,external_1pps,external}

The described method requires https://github.com/Nuand/bladeRF/releases/
tag/2016.01-rc1

Carefully *read the instructions for external reference locking*
(especially max allowed voltage levels) on Nuand's blog https://
www.nuand.com/blog/2016-01-rc1-release/
2016-02-28 17:45:54 +01:00
Jon Szymaniak 86ad584204 bladeRF: Support opening via a (subset of a) serial number, using any backend
The bladerf=X,[arguments] string now supports the following, where X is:

    - The "device instance" which represents the Nth bladeRF connected.
      This is 0-indexed, in the order displayed by `bladeRF-cli --probe`.

    - The device's serial number.
        For libbladeRF >= 1.4.1, a subset of the serial number is
        supported. The subset must be at least the first three
        characters of the serial number.

The backend specifier has been changed from "libusb" to the wildcard
("*"), allowing any available backend to be used.
2015-07-17 17:09:30 +02:00
Jon Szymaniak 43a00ae785 bladeRF: Added SOB/EOB stream tag handling support to bladerf_sink
When running with metadata mode enabled, the bladerf_sink supports 'tx_sob' and
'tx_eob' stream tags. Anything not in the burst will be dropped, and a warning
will be printed.

Use of the bladeRF metadata can be enabled via a 'enable_metadata'
device argument. If running full-duplex, this must be provided to both
the source and the sink. This does not currently any additional features
to the sink.
2015-07-17 17:09:23 +02:00
Josh Blum 3532d60c11 osmo: minor msvc fixes for bladerf_common.h 2015-04-28 22:27:53 +02:00
Dimitri Stolnikov 48045b597d bladerf: include rxvga1 to the BB gain setting
Patch provided by Samu Laaja
2015-01-10 14:01:09 +01:00
Jon Szymaniak 8d9e6b58bb bladeRF: Fixed incorrectly placed 'else'
This addresses a defect introduced in 6e75abf which causes the
_consecutive_failures count to get reset with every failure, rather
then upon a successful return value.
2014-11-06 21:30:32 +01:00
Jon Szymaniak 6e75abf198 bladeRF: Don't fail out until 3 consecutive errors have occurred
This change is intended to make the bladeRF source/sink implementations
slightly more resilient to any transient issues in a flow graph.

For poor choices of buffers/transfers or under high CPU load, an RX or
TX operation might time out. Instead of immediately reporting WORK_DONE
and bailing out, an error message is now printed and the device will
attempt to continue transmitting/receiving samples.

After 3 consecutive errors have occurred on an RX/TX operation, the
device will report WORK_DONE; in this situation, something is likely
very wrong.
2014-11-03 23:24:04 +01:00
Jon Szymaniak 7f82d289a6 bladeRF: Default num_transfers to min(32, num_buffers/2)
This avoids inadvertently attempting to use a larger number of transfers
than the underlying USB library/interface allows by specifying a large
value for num_buffers.

Users can specify up to (num_buffers - 1) transfers. However, it is
generally recommended to use half as many transfers as buffers.
2014-11-03 23:23:59 +01:00
Jon Szymaniak 23b1b9cdb1 bladeRF: Removed unused bladerf_metadata parameter from rx/tx calls
It is safe (and preferred) to pass NULL for the metadata paremeter when
using a format that does utilize the metadata structure.
2014-11-03 23:23:54 +01:00
Robert Ghilduta 9cb023b00a bladeRF: Add XB-200 support
This commit adds support for the bladeRF XB-200 transverter expansion
board. To enable the expansion board and to allow the osmocom source or
sink to tune down to 0Hz, parameter xb200 has to be set. XB-200 comes
with 4 filter banks which can be selected by passing their name as
a value of the xb200 parameter. Automatic filter selection will be
enabled if no value is given to the xb200 parameter.

Example:

osmocom_fft -a bladerf,xb200
osmocom_fft -a bladerf,xb200=50M

The following values are valid:
   "custom"  : custom band
   "50M"     :  50MHz band
   "144M"    : 144MHz band
   "222M"    : 222MHz band
   "auto3db" : Select fiterbank based on -3dB filter points
   "auto"    : Select filerbank based on -1dB filter points (default)
2014-07-11 16:53:23 +02:00
Jon Szymaniak c65d205d3b bladerf: Accept 'loopback' parameter only on a source
To alleviate some confusion (described below), the 'loopback' parameter
may now only be applied to a bladeRF source. A warning will be printed
if it is applied to a sink.

This is intended to help users avoid the case where two different
loopback options are applied to the same device. In this case, the
loopback setting on whichever initializes last will be applied. This,
coupled with the fact that not specifying a loopback defaults to
loopback=none, yields rather unintuitive behavior.
2014-05-06 22:39:06 +02:00
Jon Szymaniak 00b579532c bladerf: Apply 'verbosity' parameter before performing other operations
Setting the libbladeRF verbosity level needs to be performed prior to
other operations. Otherwise, the desired diagnostic output will not
appear for startup operations (e.g., device opening, enabling loopback).
2014-05-06 22:39:01 +02:00
Jon Szymaniak 23ea2fcfb4 bladeRF: Fixed typo in handling 'stream_timeout_ms' device argument 2014-04-14 00:30:17 +02:00
Jon Szymaniak 542a3dbb2b bladerf: Fixed bug in cached device cleanup
A couple issues were present in bladerf_common::close, which caused
entries in the _devs list (our "device cache") to not be removed. This
would result in a stale device handle being used upon attempting to
reopen the device.

Two issues were associated with this bug:
 - The weak_ptr expired() conditional was incorrect; the logic was
   inverted.
 - The list item removal and iterator increment was done incorrectly
   and would result in a crash after the first item was fixed.
2014-03-10 15:36:59 +01:00
Brian Padalino 4e0a2c28e3 bladerf: Updated source/sink to use libbladeRF's sync interface 2014-03-10 15:34:19 +01:00
Jon Szymaniak 7a1f12cfcf bladeRF: RXVGA2 range is [0, 30]
While the RXVGA2 gain can technically go up to 60 dB, the LMS6002D
datasheet recommends it be clamped to 30dB. libbladeRF clamps to a max
of 30dB, so there's no use in setting max to 60 dB here.
2014-02-16 09:00:05 +01:00
Jon Szymaniak 751ad0f582 bladerf: Added 'verbosity' and 'loopback' device parameters
The 'verbosity' parameter may be used to increase or suppress output from
libbladeRF. The available log levels are, in order of decreasing
verbosity are:
    verbose, debug, info, warning, critical, silent

The 'loopback' parameter may be used to put the bladeRF into one of the
supported loopback modes.  The valid modes are listed below. Their
descriptions may be found in the libbladeRF documentation:

      bb_txlpf_rxvga2, bb_txlpf_rxlpf bb_txvga1_rxvga2, bb_txvga1_rxlpf
      rf_lna1, rf_lna2, rf_lna3
2014-02-16 08:59:58 +01:00
Brian Padalino d960d1119c bladeRF: Modifying correction calls.
Modifying correction function calls to match libbladeRF API.
2014-01-18 20:20:19 +01:00