aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp
diff options
context:
space:
mode:
Diffstat (limited to 'host/lib/usrp')
-rw-r--r--host/lib/usrp/dboard/db_dbsrx.cpp11
-rw-r--r--host/lib/usrp/dboard/db_rfx.cpp12
-rw-r--r--host/lib/usrp/dboard/db_tvrx.cpp2
-rw-r--r--host/lib/usrp/dboard_manager.cpp15
-rw-r--r--host/lib/usrp/misc_utils.cpp13
-rw-r--r--host/lib/usrp/multi_usrp.cpp34
-rw-r--r--host/lib/usrp/single_usrp.cpp34
-rw-r--r--host/lib/usrp/usrp1/codec_impl.cpp24
-rw-r--r--host/lib/usrp/usrp1/dboard_impl.cpp2
-rw-r--r--host/lib/usrp/usrp2/dboard_impl.cpp2
10 files changed, 88 insertions, 61 deletions
diff --git a/host/lib/usrp/dboard/db_dbsrx.cpp b/host/lib/usrp/dboard/db_dbsrx.cpp
index 939a79e58..aecd7249d 100644
--- a/host/lib/usrp/dboard/db_dbsrx.cpp
+++ b/host/lib/usrp/dboard/db_dbsrx.cpp
@@ -162,15 +162,10 @@ static dboard_base::sptr make_dbsrx(dboard_base::ctor_args_t args){
return dboard_base::sptr(new dbsrx(args));
}
-//dbid for USRP2 version
UHD_STATIC_BLOCK(reg_dbsrx_dboard){
- //register the factory function for the rx dbid
+ //register the factory function for the rx dbid (others version)
dboard_manager::register_dboard(0x000D, &make_dbsrx, "DBSRX");
-}
-
-//dbid for USRP1 version
-UHD_STATIC_BLOCK(reg_dbsrx_on_usrp1_dboard){
- //register the factory function for the rx dbid
+ //register the factory function for the rx dbid (USRP1 version)
dboard_manager::register_dboard(0x0002, &make_dbsrx, "DBSRX");
}
@@ -241,8 +236,10 @@ void dbsrx::set_lo_freq(double target_freq){
bool update_filter_settings = false;
//choose refclock
std::vector<double> clock_rates = this->get_iface()->get_clock_rates(dboard_iface::UNIT_RX);
+ const double max_clock_rate = std::sorted(clock_rates).back();
BOOST_FOREACH(ref_clock, std::reversed(std::sorted(clock_rates))){
if (ref_clock > 27.0e6) continue;
+ if (size_t(max_clock_rate/ref_clock)%2 == 1) continue; //reject asymmetric clocks (odd divisors)
//choose m_divider such that filter tuning constraint is met
m = 31;
diff --git a/host/lib/usrp/dboard/db_rfx.cpp b/host/lib/usrp/dboard/db_rfx.cpp
index cfc34381e..3c24d90db 100644
--- a/host/lib/usrp/dboard/db_rfx.cpp
+++ b/host/lib/usrp/dboard/db_rfx.cpp
@@ -152,12 +152,12 @@ static dboard_base::sptr make_rfx_flex2400(dboard_base::ctor_args_t args){
}
UHD_STATIC_BLOCK(reg_rfx_dboards){
- dboard_manager::register_dboard(0x0024, 0x0028, &make_rfx_flex400, "Flex 400 MIMO B");
- dboard_manager::register_dboard(0x0025, 0x0029, &make_rfx_flex900, "Flex 900 MIMO B");
- dboard_manager::register_dboard(0x0034, 0x0035, &make_rfx_flex1800, "Flex 1800 MIMO B");
- dboard_manager::register_dboard(0x0026, 0x002a, &make_rfx_flex1200, "Flex 1200 MIMO B");
- dboard_manager::register_dboard(0x002c, 0x002d, &make_rfx_flex2200, "Flex 2200 MIMO B");
- dboard_manager::register_dboard(0x0027, 0x002b, &make_rfx_flex2400, "Flex 2400 MIMO B");
+ dboard_manager::register_dboard(0x0024, 0x0028, &make_rfx_flex400, "RFX400");
+ dboard_manager::register_dboard(0x0025, 0x0029, &make_rfx_flex900, "RFX900");
+ dboard_manager::register_dboard(0x0034, 0x0035, &make_rfx_flex1800, "RFX1800");
+ dboard_manager::register_dboard(0x0026, 0x002a, &make_rfx_flex1200, "RFX1200");
+ dboard_manager::register_dboard(0x002c, 0x002d, &make_rfx_flex2200, "RFX2200");
+ dboard_manager::register_dboard(0x0027, 0x002b, &make_rfx_flex2400, "RFX2400");
}
/***********************************************************************
diff --git a/host/lib/usrp/dboard/db_tvrx.cpp b/host/lib/usrp/dboard/db_tvrx.cpp
index 10be8d1c3..d39dc3bf8 100644
--- a/host/lib/usrp/dboard/db_tvrx.cpp
+++ b/host/lib/usrp/dboard/db_tvrx.cpp
@@ -179,7 +179,7 @@ static dboard_base::sptr make_tvrx(dboard_base::ctor_args_t args){
UHD_STATIC_BLOCK(reg_tvrx_dboard){
//register the factory function for the rx dbid
- dboard_manager::register_dboard(0x0040, &make_tvrx, "tvrx");
+ dboard_manager::register_dboard(0x0040, &make_tvrx, "TVRX");
}
/***********************************************************************
diff --git a/host/lib/usrp/dboard_manager.cpp b/host/lib/usrp/dboard_manager.cpp
index 78daa1b4d..d73a698ae 100644
--- a/host/lib/usrp/dboard_manager.cpp
+++ b/host/lib/usrp/dboard_manager.cpp
@@ -69,20 +69,21 @@ void dboard_manager::register_dboard(
const prop_names_t &subdev_names
){
//regular registration for ids
- register_dboard(rx_dboard_id, dboard_ctor, name + " RX", subdev_names);
- register_dboard(tx_dboard_id, dboard_ctor, name + " TX", subdev_names);
+ register_dboard(rx_dboard_id, dboard_ctor, name, subdev_names);
+ register_dboard(tx_dboard_id, dboard_ctor, name, subdev_names);
//register xcvr mapping for ids
get_xcvr_id_to_id_map()[rx_dboard_id] = tx_dboard_id;
get_xcvr_id_to_id_map()[tx_dboard_id] = rx_dboard_id;
}
+std::string dboard_id_t::to_cname(void) const{
+ if (not get_id_to_args_map().has_key(*this)) return "Unknown";
+ return get_id_to_args_map()[*this].get<1>();
+}
+
std::string dboard_id_t::to_pp_string(void) const{
- std::string name = "unknown";
- if (get_id_to_args_map().has_key(*this)){
- name = get_id_to_args_map()[*this].get<1>();
- }
- return str(boost::format("%s (%s)") % name % this->to_string());
+ return str(boost::format("%s (%s)") % this->to_cname() % this->to_string());
}
/***********************************************************************
diff --git a/host/lib/usrp/misc_utils.cpp b/host/lib/usrp/misc_utils.cpp
index 05308baba..5856d706f 100644
--- a/host/lib/usrp/misc_utils.cpp
+++ b/host/lib/usrp/misc_utils.cpp
@@ -80,6 +80,7 @@ static void set_subdev_gain(wax::obj subdev, const std::string &name, float gain
* gain group factory function for usrp
**********************************************************************/
gain_group::sptr usrp::make_gain_group(
+ const dboard_id_t &dboard_id,
wax::obj subdev, wax::obj codec,
gain_group_policy_t gain_group_policy
){
@@ -87,6 +88,8 @@ gain_group::sptr usrp::make_gain_group(
const size_t codec_gain_priority = (gain_group_policy == GAIN_GROUP_POLICY_RX)?
(subdev_gain_priority - 1): //RX policy, codec gains fill last (lower priority)
(subdev_gain_priority + 1); //TX policy, codec gains fill first (higher priority)
+ const std::string subdev_prefix = dboard_id.to_cname() + "-";
+ const std::string codec_prefix = (gain_group_policy == GAIN_GROUP_POLICY_RX)? "ADC-" : "DAC-";
gain_group::sptr gg = gain_group::make();
gain_fcns_t fcns;
@@ -95,7 +98,7 @@ gain_group::sptr usrp::make_gain_group(
fcns.get_range = boost::bind(&get_subdev_gain_range, subdev, name);
fcns.get_value = boost::bind(&get_subdev_gain, subdev, name);
fcns.set_value = boost::bind(&set_subdev_gain, subdev, name, _1);
- gg->register_fcns(fcns, subdev_gain_priority);
+ gg->register_fcns(subdev_prefix+name, fcns, subdev_gain_priority);
}
//add all the codec gains last (antenna to dsp order)
BOOST_FOREACH(const std::string &name, codec[CODEC_PROP_GAIN_NAMES].as<prop_names_t>()){
@@ -119,7 +122,7 @@ gain_group::sptr usrp::make_gain_group(
fcns.set_value = boost::bind(&set_codec_gain_q, codec, name, _1);
break;
}
- gg->register_fcns(fcns, codec_gain_priority);
+ gg->register_fcns(codec_prefix+name, fcns, codec_gain_priority);
}
return gg;
}
@@ -161,13 +164,13 @@ static void verify_xx_subdev_spec(
}
//sanity check that the dboard/subdevice names exist for this mboard
- BOOST_FOREACH(const subdev_spec_pair_t &pair, subdev_spec){
+ BOOST_FOREACH(subdev_spec_pair_t &pair, subdev_spec){
//empty db name means select dboard automatically
if (pair.db_name.empty()){
if (dboard_names.size() != 1) throw std::runtime_error(
"A daughterboard name must be provided for multi-slot motherboards: " + subdev_spec.to_string()
);
- pair.db_name == dboard_names.front();
+ pair.db_name = dboard_names.front();
}
uhd::assert_has(dboard_names, pair.db_name, xx_type + " dboard name");
wax::obj dboard = mboard[named_prop_t(dboard_prop, pair.db_name)];
@@ -178,7 +181,7 @@ static void verify_xx_subdev_spec(
if (subdev_names.size() != 1) throw std::runtime_error(
"A subdevice name must be provided for multi-subdev daughterboards: " + subdev_spec.to_string()
);
- pair.sd_name == subdev_names.front();
+ pair.sd_name = subdev_names.front();
}
uhd::assert_has(subdev_names, pair.sd_name, xx_type + " subdev name");
}
diff --git a/host/lib/usrp/multi_usrp.cpp b/host/lib/usrp/multi_usrp.cpp
index 027530f31..443b91594 100644
--- a/host/lib/usrp/multi_usrp.cpp
+++ b/host/lib/usrp/multi_usrp.cpp
@@ -35,6 +35,8 @@
using namespace uhd;
using namespace uhd::usrp;
+const std::string multi_usrp::ALL_GAINS = "";
+
/***********************************************************************
* Simple USRP Implementation
**********************************************************************/
@@ -228,16 +230,20 @@ public:
return add_dsp_shift(_rx_subdev(chan)[SUBDEV_PROP_FREQ_RANGE].as<freq_range_t>(), _rx_dsp(chan/rx_cpm()));
}
- void set_rx_gain(float gain, size_t chan){
- return _rx_gain_group(chan)->set_value(gain);
+ void set_rx_gain(float gain, const std::string &name, size_t chan){
+ return _rx_gain_group(chan)->set_value(gain, name);
+ }
+
+ float get_rx_gain(const std::string &name, size_t chan){
+ return _rx_gain_group(chan)->get_value(name);
}
- float get_rx_gain(size_t chan){
- return _rx_gain_group(chan)->get_value();
+ gain_range_t get_rx_gain_range(const std::string &name, size_t chan){
+ return _rx_gain_group(chan)->get_range(name);
}
- gain_range_t get_rx_gain_range(size_t chan){
- return _rx_gain_group(chan)->get_range();
+ std::vector<std::string> get_rx_gain_names(size_t chan){
+ return _rx_gain_group(chan)->get_names();
}
void set_rx_antenna(const std::string &ant, size_t chan){
@@ -328,16 +334,20 @@ public:
return add_dsp_shift(_tx_subdev(chan)[SUBDEV_PROP_FREQ_RANGE].as<freq_range_t>(), _tx_dsp(chan/tx_cpm()));
}
- void set_tx_gain(float gain, size_t chan){
- return _tx_gain_group(chan)->set_value(gain);
+ void set_tx_gain(float gain, const std::string &name, size_t chan){
+ return _tx_gain_group(chan)->set_value(gain, name);
+ }
+
+ float get_tx_gain(const std::string &name, size_t chan){
+ return _tx_gain_group(chan)->get_value(name);
}
- float get_tx_gain(size_t chan){
- return _tx_gain_group(chan)->get_value();
+ gain_range_t get_tx_gain_range(const std::string &name, size_t chan){
+ return _tx_gain_group(chan)->get_range(name);
}
- gain_range_t get_tx_gain_range(size_t chan){
- return _tx_gain_group(chan)->get_range();
+ std::vector<std::string> get_tx_gain_names(size_t chan){
+ return _tx_gain_group(chan)->get_names();
}
void set_tx_antenna(const std::string &ant, size_t chan){
diff --git a/host/lib/usrp/single_usrp.cpp b/host/lib/usrp/single_usrp.cpp
index 2faa1280c..5e57849b8 100644
--- a/host/lib/usrp/single_usrp.cpp
+++ b/host/lib/usrp/single_usrp.cpp
@@ -33,6 +33,8 @@
using namespace uhd;
using namespace uhd::usrp;
+const std::string single_usrp::ALL_GAINS = "";
+
/***********************************************************************
* Simple USRP Implementation
**********************************************************************/
@@ -164,16 +166,20 @@ public:
return add_dsp_shift(_rx_subdev(chan)[SUBDEV_PROP_FREQ_RANGE].as<freq_range_t>(), _rx_dsp());
}
- void set_rx_gain(float gain, size_t chan){
- return _rx_gain_group(chan)->set_value(gain);
+ void set_rx_gain(float gain, const std::string &name, size_t chan){
+ return _rx_gain_group(chan)->set_value(gain, name);
+ }
+
+ float get_rx_gain(const std::string &name, size_t chan){
+ return _rx_gain_group(chan)->get_value(name);
}
- float get_rx_gain(size_t chan){
- return _rx_gain_group(chan)->get_value();
+ gain_range_t get_rx_gain_range(const std::string &name, size_t chan){
+ return _rx_gain_group(chan)->get_range(name);
}
- gain_range_t get_rx_gain_range(size_t chan){
- return _rx_gain_group(chan)->get_range();
+ std::vector<std::string> get_rx_gain_names(size_t chan){
+ return _rx_gain_group(chan)->get_names();
}
void set_rx_antenna(const std::string &ant, size_t chan){
@@ -252,16 +258,20 @@ public:
return add_dsp_shift(_tx_subdev(chan)[SUBDEV_PROP_FREQ_RANGE].as<freq_range_t>(), _tx_dsp());
}
- void set_tx_gain(float gain, size_t chan){
- return _tx_gain_group(chan)->set_value(gain);
+ void set_tx_gain(float gain, const std::string &name, size_t chan){
+ return _tx_gain_group(chan)->set_value(gain, name);
+ }
+
+ float get_tx_gain(const std::string &name, size_t chan){
+ return _tx_gain_group(chan)->get_value(name);
}
- float get_tx_gain(size_t chan){
- return _tx_gain_group(chan)->get_value();
+ gain_range_t get_tx_gain_range(const std::string &name, size_t chan){
+ return _tx_gain_group(chan)->get_range(name);
}
- gain_range_t get_tx_gain_range(size_t chan){
- return _tx_gain_group(chan)->get_range();
+ std::vector<std::string> get_tx_gain_names(size_t chan){
+ return _tx_gain_group(chan)->get_names();
}
void set_tx_antenna(const std::string &ant, size_t chan){
diff --git a/host/lib/usrp/usrp1/codec_impl.cpp b/host/lib/usrp/usrp1/codec_impl.cpp
index 1756c1ed4..db53be53e 100644
--- a/host/lib/usrp/usrp1/codec_impl.cpp
+++ b/host/lib/usrp/usrp1/codec_impl.cpp
@@ -45,7 +45,7 @@ void usrp1_impl::codec_init(void)
/***********************************************************************
* RX Codec Properties
**********************************************************************/
-static const std::string ad9862_pga_gain_name = "ad9862 pga";
+static const std::string adc_pga_gain_name = "PGA";
void usrp1_impl::rx_codec_get(const wax::obj &key_, wax::obj &val, dboard_slot_t dboard_slot)
{
@@ -62,21 +62,21 @@ void usrp1_impl::rx_codec_get(const wax::obj &key_, wax::obj &val, dboard_slot_t
return;
case CODEC_PROP_GAIN_NAMES:
- val = prop_names_t(1, ad9862_pga_gain_name);
+ val = prop_names_t(1, adc_pga_gain_name);
return;
case CODEC_PROP_GAIN_RANGE:
- UHD_ASSERT_THROW(key.name == ad9862_pga_gain_name);
+ UHD_ASSERT_THROW(key.name == adc_pga_gain_name);
val = usrp1_codec_ctrl::rx_pga_gain_range;
return;
case CODEC_PROP_GAIN_I:
- UHD_ASSERT_THROW(key.name == ad9862_pga_gain_name);
+ UHD_ASSERT_THROW(key.name == adc_pga_gain_name);
val = _codec_ctrls[dboard_slot]->get_rx_pga_gain('A');
return;
case CODEC_PROP_GAIN_Q:
- UHD_ASSERT_THROW(key.name == ad9862_pga_gain_name);
+ UHD_ASSERT_THROW(key.name == adc_pga_gain_name);
val = _codec_ctrls[dboard_slot]->get_rx_pga_gain('B');
return;
@@ -91,12 +91,12 @@ void usrp1_impl::rx_codec_set(const wax::obj &key_, const wax::obj &val, dboard_
//handle the set request conditioned on the key
switch(key.as<codec_prop_t>()) {
case CODEC_PROP_GAIN_I:
- UHD_ASSERT_THROW(key.name == ad9862_pga_gain_name);
+ UHD_ASSERT_THROW(key.name == adc_pga_gain_name);
_codec_ctrls[dboard_slot]->set_rx_pga_gain(val.as<float>(), 'A');
return;
case CODEC_PROP_GAIN_Q:
- UHD_ASSERT_THROW(key.name == ad9862_pga_gain_name);
+ UHD_ASSERT_THROW(key.name == adc_pga_gain_name);
_codec_ctrls[dboard_slot]->set_rx_pga_gain(val.as<float>(), 'B');
return;
@@ -107,6 +107,8 @@ void usrp1_impl::rx_codec_set(const wax::obj &key_, const wax::obj &val, dboard_
/***********************************************************************
* TX Codec Properties
**********************************************************************/
+static const std::string dac_pga_gain_name = "PGA";
+
void usrp1_impl::tx_codec_get(const wax::obj &key_, wax::obj &val, dboard_slot_t dboard_slot)
{
named_prop_t key = named_prop_t::extract(key_);
@@ -122,17 +124,17 @@ void usrp1_impl::tx_codec_get(const wax::obj &key_, wax::obj &val, dboard_slot_t
return;
case CODEC_PROP_GAIN_NAMES:
- val = prop_names_t(1, ad9862_pga_gain_name);
+ val = prop_names_t(1, dac_pga_gain_name);
return;
case CODEC_PROP_GAIN_RANGE:
- UHD_ASSERT_THROW(key.name == ad9862_pga_gain_name);
+ UHD_ASSERT_THROW(key.name == dac_pga_gain_name);
val = usrp1_codec_ctrl::tx_pga_gain_range;
return;
case CODEC_PROP_GAIN_I: //only one gain for I and Q
case CODEC_PROP_GAIN_Q:
- UHD_ASSERT_THROW(key.name == ad9862_pga_gain_name);
+ UHD_ASSERT_THROW(key.name == dac_pga_gain_name);
val = _codec_ctrls[dboard_slot]->get_tx_pga_gain();
return;
@@ -148,7 +150,7 @@ void usrp1_impl::tx_codec_set(const wax::obj &key_, const wax::obj &val, dboard_
switch(key.as<codec_prop_t>()){
case CODEC_PROP_GAIN_I: //only one gain for I and Q
case CODEC_PROP_GAIN_Q:
- UHD_ASSERT_THROW(key.name == ad9862_pga_gain_name);
+ UHD_ASSERT_THROW(key.name == dac_pga_gain_name);
_codec_ctrls[dboard_slot]->set_tx_pga_gain(val.as<float>());
return;
diff --git a/host/lib/usrp/usrp1/dboard_impl.cpp b/host/lib/usrp/usrp1/dboard_impl.cpp
index 3a8480e1b..2a2762a82 100644
--- a/host/lib/usrp/usrp1/dboard_impl.cpp
+++ b/host/lib/usrp/usrp1/dboard_impl.cpp
@@ -124,6 +124,7 @@ void usrp1_impl::rx_dboard_get(const wax::obj &key_, wax::obj &val, dboard_slot_
case DBOARD_PROP_GAIN_GROUP:
val = make_gain_group(
+ _rx_db_eeproms[dboard_slot].id,
_dboard_managers[dboard_slot]->get_rx_subdev(key.name),
_rx_codec_proxies[dboard_slot]->get_link(),
GAIN_GROUP_POLICY_RX
@@ -188,6 +189,7 @@ void usrp1_impl::tx_dboard_get(const wax::obj &key_, wax::obj &val, dboard_slot_
case DBOARD_PROP_GAIN_GROUP:
val = make_gain_group(
+ _tx_db_eeproms[dboard_slot].id,
_dboard_managers[dboard_slot]->get_tx_subdev(key.name),
_tx_codec_proxies[dboard_slot]->get_link(),
GAIN_GROUP_POLICY_TX
diff --git a/host/lib/usrp/usrp2/dboard_impl.cpp b/host/lib/usrp/usrp2/dboard_impl.cpp
index a462b93c2..540c9fefb 100644
--- a/host/lib/usrp/usrp2/dboard_impl.cpp
+++ b/host/lib/usrp/usrp2/dboard_impl.cpp
@@ -89,6 +89,7 @@ void usrp2_mboard_impl::rx_dboard_get(const wax::obj &key_, wax::obj &val){
case DBOARD_PROP_GAIN_GROUP:
val = make_gain_group(
+ _rx_db_eeprom.id,
_dboard_manager->get_rx_subdev(key.name),
_rx_codec_proxy->get_link(),
GAIN_GROUP_POLICY_RX
@@ -145,6 +146,7 @@ void usrp2_mboard_impl::tx_dboard_get(const wax::obj &key_, wax::obj &val){
case DBOARD_PROP_GAIN_GROUP:
val = make_gain_group(
+ _tx_db_eeprom.id,
_dboard_manager->get_tx_subdev(key.name),
_tx_codec_proxy->get_link(),
GAIN_GROUP_POLICY_TX