aboutsummaryrefslogtreecommitdiffstats
path: root/lib/bladerf
diff options
context:
space:
mode:
authorRobert Ghilduta <robert.ghilduta@nuand.com>2014-06-11 01:11:09 -0700
committerDimitri Stolnikov <horiz0n@gmx.net>2014-07-11 16:53:23 +0200
commit9cb023b00a36d04ad8ea7e0bf08ad0623ab3e95f (patch)
tree83dea109c90ca1a8ffec0c2a06a766d699bb7448 /lib/bladerf
parentc65d205d3b7cc734f97284b66054e16c90886df2 (diff)
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)
Diffstat (limited to 'lib/bladerf')
-rw-r--r--lib/bladerf/bladerf_common.cc39
-rw-r--r--lib/bladerf/bladerf_common.h2
2 files changed, 38 insertions, 3 deletions
diff --git a/lib/bladerf/bladerf_common.cc b/lib/bladerf/bladerf_common.cc
index 7516020..3308c13 100644
--- a/lib/bladerf/bladerf_common.cc
+++ b/lib/bladerf/bladerf_common.cc
@@ -48,7 +48,13 @@ using namespace boost::assign;
boost::mutex bladerf_common::_devs_mutex;
std::list<boost::weak_ptr<struct bladerf> > bladerf_common::_devs;
-bladerf_common::bladerf_common() : _conv_buf(NULL), _conv_buf_size(4096) {}
+bladerf_common::bladerf_common() :
+ _conv_buf(NULL),
+ _conv_buf_size(4096),
+ _xb_200_attached(false)
+{
+
+}
bladerf_common::~bladerf_common()
{
@@ -301,11 +307,38 @@ void bladerf_common::init(dict_t &dict, bladerf_module module)
"and will have no effect. This parameter should be "
"specified on the associated bladeRF source."
<< std::endl;
+ }
+ if ( dict.count("xb200") ) {
+ if (bladerf_expansion_attach(_dev.get(), BLADERF_XB_200)) {
+ std::cerr << _pfx << "Could not attach XB-200" << std::endl;
+ } else {
+ _xb_200_attached = true;
+
+ bladerf_xb200_filter filter = BLADERF_XB200_AUTO_1DB;
+
+ if ( dict["xb200"] == "custom" ) {
+ filter = BLADERF_XB200_CUSTOM;
+ } else if ( dict["xb200"] == "50M" ) {
+ filter = BLADERF_XB200_50M;
+ } else if ( dict["xb200"] == "144M" ) {
+ filter = BLADERF_XB200_144M;
+ } else if ( dict["xb200"] == "222M" ) {
+ filter = BLADERF_XB200_222M;
+ } else if ( dict["xb200"] == "auto3db" ) {
+ filter = BLADERF_XB200_AUTO_3DB;
+ } else if ( dict["xb200"] == "auto" ) {
+ filter = BLADERF_XB200_AUTO_1DB;
+ } else {
+ filter = BLADERF_XB200_AUTO_1DB;
+ }
+ if (bladerf_xb200_set_filterbank(_dev.get(), module, filter)) {
+ std::cerr << _pfx << "Could not set XB-200 filter" << std::endl;
+ }
+ }
}
-
/* Show some info about the device we've opened */
std::cerr << _pfx << "Using nuand LLC bladeRF #" << device_number;
@@ -387,7 +420,7 @@ void bladerf_common::init(dict_t &dict, bladerf_module module)
osmosdr::freq_range_t bladerf_common::freq_range()
{
/* assuming the same for RX & TX */
- return osmosdr::freq_range_t( 300e6, 3.8e9 );
+ return osmosdr::freq_range_t( _xb_200_attached ? 0 : 300e6, 3.8e9 );
}
osmosdr::meta_range_t bladerf_common::sample_rates()
diff --git a/lib/bladerf/bladerf_common.h b/lib/bladerf/bladerf_common.h
index b13a6cf..3b1cb0b 100644
--- a/lib/bladerf/bladerf_common.h
+++ b/lib/bladerf/bladerf_common.h
@@ -82,6 +82,8 @@ protected:
std::string _pfx;
+ bool _xb_200_attached;
+
/* BladeRF IQ correction parameters */
static const int16_t DCOFF_SCALE = 2048;
static const int16_t GAIN_SCALE = 4096;