summaryrefslogtreecommitdiffstats
path: root/host/lib/usrp
diff options
context:
space:
mode:
Diffstat (limited to 'host/lib/usrp')
-rw-r--r--host/lib/usrp/b100/b100_impl.cpp4
-rw-r--r--host/lib/usrp/dboard_manager.cpp30
-rw-r--r--host/lib/usrp/e100/e100_impl.cpp4
-rw-r--r--host/lib/usrp/multi_usrp.cpp68
-rw-r--r--host/lib/usrp/usrp1/usrp1_impl.cpp4
-rw-r--r--host/lib/usrp/usrp2/usrp2_impl.cpp4
6 files changed, 55 insertions, 59 deletions
diff --git a/host/lib/usrp/b100/b100_impl.cpp b/host/lib/usrp/b100/b100_impl.cpp
index b58e70694..2e2421ed3 100644
--- a/host/lib/usrp/b100/b100_impl.cpp
+++ b/host/lib/usrp/b100/b100_impl.cpp
@@ -366,13 +366,13 @@ b100_impl::b100_impl(const device_addr_t &device_addr){
);
BOOST_FOREACH(const std::string &name, _dboard_manager->get_rx_subdev_names()){
dboard_manager::populate_prop_tree_from_subdev(
- _tree, mb_path / "dboards/A/rx_frontends" / name,
+ _tree->subtree(mb_path / "dboards/A/rx_frontends" / name),
_dboard_manager->get_rx_subdev(name)
);
}
BOOST_FOREACH(const std::string &name, _dboard_manager->get_tx_subdev_names()){
dboard_manager::populate_prop_tree_from_subdev(
- _tree, mb_path / "dboards/A/tx_frontends" / name,
+ _tree->subtree(mb_path / "dboards/A/tx_frontends" / name),
_dboard_manager->get_tx_subdev(name)
);
}
diff --git a/host/lib/usrp/dboard_manager.cpp b/host/lib/usrp/dboard_manager.cpp
index fae3d35b3..3f4b5a511 100644
--- a/host/lib/usrp/dboard_manager.cpp
+++ b/host/lib/usrp/dboard_manager.cpp
@@ -478,52 +478,50 @@ static double get_bw(wax::obj subdev){
}
void dboard_manager::populate_prop_tree_from_subdev(
- property_tree::sptr tree,
- const property_tree::path_type &root,
- wax::obj subdev
+ property_tree::sptr subtree, wax::obj subdev
){
- tree->create<std::string>(root / "name").set(subdev[SUBDEV_PROP_NAME].as<std::string>());
+ subtree->create<std::string>("name").set(subdev[SUBDEV_PROP_NAME].as<std::string>());
const prop_names_t sensor_names = subdev[SUBDEV_PROP_SENSOR_NAMES].as<prop_names_t>();
BOOST_FOREACH(const std::string &name, sensor_names){
- tree->create<sensor_value_t>(root / "sensors" / name)
+ subtree->create<sensor_value_t>("sensors/" + name)
.publish(boost::bind(&get_sensor, subdev, name));
}
const prop_names_t gain_names = subdev[SUBDEV_PROP_GAIN_NAMES].as<prop_names_t>();
- tree->create<int>(root / "gains"); //phony property so this dir exists
+ subtree->create<int>("gains"); //phony property so this dir exists
BOOST_FOREACH(const std::string &name, gain_names){
- tree->create<double>(root / "gains" / name / "value")
+ subtree->create<double>("gains/" + name + "/value")
.publish(boost::bind(&get_gain, subdev, name))
.subscribe(boost::bind(&set_gain, subdev, name, _1));
- tree->create<meta_range_t>(root / "gains" / name / "range")
+ subtree->create<meta_range_t>("gains/" + name + "/range")
.publish(boost::bind(&get_gain_range, subdev, name));
}
- tree->create<double>(root / "freq/value")
+ subtree->create<double>("freq/value")
.publish(boost::bind(&get_freq, subdev))
.subscribe(boost::bind(&set_freq, subdev, _1));
- tree->create<meta_range_t>(root / "freq/range")
+ subtree->create<meta_range_t>("freq/range")
.publish(boost::bind(&get_freq_range, subdev));
- tree->create<std::string>(root / "antenna/value")
+ subtree->create<std::string>("antenna/value")
.publish(boost::bind(&get_ant, subdev))
.subscribe(boost::bind(&set_ant, subdev, _1));
- tree->create<std::vector<std::string> >(root / "antenna/options")
+ subtree->create<std::vector<std::string> >("antenna/options")
.publish(boost::bind(&get_ants, subdev));
- tree->create<std::string>(root / "connection")
+ subtree->create<std::string>("connection")
.publish(boost::bind(&get_conn, subdev));
- tree->create<bool>(root / "enabled")
+ subtree->create<bool>("enabled")
.coerce(boost::bind(&get_set_enb, subdev, _1));
- tree->create<bool>(root / "use_lo_offset")
+ subtree->create<bool>("use_lo_offset")
.publish(boost::bind(&get_use_lo_off, subdev));
- tree->create<double>(root / "bandwidth/value")
+ subtree->create<double>("bandwidth/value")
.publish(boost::bind(&get_bw, subdev))
.subscribe(boost::bind(&set_bw, subdev, _1));
}
diff --git a/host/lib/usrp/e100/e100_impl.cpp b/host/lib/usrp/e100/e100_impl.cpp
index a86a75816..cca4ee9b3 100644
--- a/host/lib/usrp/e100/e100_impl.cpp
+++ b/host/lib/usrp/e100/e100_impl.cpp
@@ -325,13 +325,13 @@ e100_impl::e100_impl(const uhd::device_addr_t &device_addr){
);
BOOST_FOREACH(const std::string &name, _dboard_manager->get_rx_subdev_names()){
dboard_manager::populate_prop_tree_from_subdev(
- _tree, mb_path / "dboards/A/rx_frontends" / name,
+ _tree->subtree(mb_path / "dboards/A/rx_frontends" / name),
_dboard_manager->get_rx_subdev(name)
);
}
BOOST_FOREACH(const std::string &name, _dboard_manager->get_tx_subdev_names()){
dboard_manager::populate_prop_tree_from_subdev(
- _tree, mb_path / "dboards/A/tx_frontends" / name,
+ _tree->subtree(mb_path / "dboards/A/tx_frontends" / name),
_dboard_manager->get_tx_subdev(name)
);
}
diff --git a/host/lib/usrp/multi_usrp.cpp b/host/lib/usrp/multi_usrp.cpp
index 2f416d93a..f9f5e675f 100644
--- a/host/lib/usrp/multi_usrp.cpp
+++ b/host/lib/usrp/multi_usrp.cpp
@@ -68,23 +68,23 @@ static void do_tune_freq_warning_message(
/***********************************************************************
* Gain helper functions
**********************************************************************/
-static double get_gain_value(property_tree::sptr tree, const property_tree::path_type &path){
- return tree->access<double>(path / "value").get();
+static double get_gain_value(property_tree::sptr subtree){
+ return subtree->access<double>("value").get();
}
-static void set_gain_value(property_tree::sptr tree, const property_tree::path_type &path, const double gain){
- tree->access<double>(path / "value").set(gain);
+static void set_gain_value(property_tree::sptr subtree, const double gain){
+ subtree->access<double>("value").set(gain);
}
-static meta_range_t get_gain_range(property_tree::sptr tree, const property_tree::path_type &path){
- return tree->access<meta_range_t>(path / "range").get();
+static meta_range_t get_gain_range(property_tree::sptr subtree){
+ return subtree->access<meta_range_t>("range").get();
}
-static gain_fcns_t make_gain_fcns_from_path(property_tree::sptr tree, const property_tree::path_type &path){
+static gain_fcns_t make_gain_fcns_from_subtree(property_tree::sptr subtree){
gain_fcns_t gain_fcns;
- gain_fcns.get_range = boost::bind(&get_gain_range, tree, path);
- gain_fcns.get_value = boost::bind(&get_gain_value, tree, path);
- gain_fcns.set_value = boost::bind(&set_gain_value, tree, path, _1);
+ gain_fcns.get_range = boost::bind(&get_gain_range, subtree);
+ gain_fcns.get_value = boost::bind(&get_gain_value, subtree);
+ gain_fcns.set_value = boost::bind(&set_gain_value, subtree, _1);
return gain_fcns;
}
@@ -96,20 +96,19 @@ static const double TX_SIGN = -1.0;
static tune_result_t tune_xx_subdev_and_dsp(
const double xx_sign,
- property_tree::sptr tree,
- const property_tree::path_type &dsp_path,
- const property_tree::path_type &rf_fe_path,
+ property_tree::sptr dsp_subtree,
+ property_tree::sptr rf_fe_subtree,
const tune_request_t &tune_request
){
//------------------------------------------------------------------
//-- calculate the LO offset, only used with automatic policy
//------------------------------------------------------------------
double lo_offset = 0.0;
- if (tree->access<bool>(rf_fe_path / "use_lo_offset").get()){
+ if (rf_fe_subtree->access<bool>("use_lo_offset").get()){
//If the local oscillator will be in the passband, use an offset.
//But constrain the LO offset by the width of the filter bandwidth.
- const double rate = tree->access<double>(dsp_path / "rate" / "value").get();
- const double bw = tree->access<double>(rf_fe_path / "bandwidth" / "value").get();
+ const double rate = dsp_subtree->access<double>("rate/value").get();
+ const double bw = rf_fe_subtree->access<double>("bandwidth/value").get();
if (bw > rate) lo_offset = std::min((bw - rate)/2, rate/2);
}
@@ -120,17 +119,17 @@ static tune_result_t tune_xx_subdev_and_dsp(
switch (tune_request.rf_freq_policy){
case tune_request_t::POLICY_AUTO:
target_rf_freq = tune_request.target_freq + lo_offset;
- tree->access<double>(rf_fe_path / "freq" / "value").set(target_rf_freq);
+ rf_fe_subtree->access<double>("freq/value").set(target_rf_freq);
break;
case tune_request_t::POLICY_MANUAL:
target_rf_freq = tune_request.rf_freq;
- tree->access<double>(rf_fe_path / "freq" / "value").set(target_rf_freq);
+ rf_fe_subtree->access<double>("freq/value").set(target_rf_freq);
break;
case tune_request_t::POLICY_NONE: break; //does not set
}
- const double actual_rf_freq = tree->access<double>(rf_fe_path / "freq" / "value").get();
+ const double actual_rf_freq = rf_fe_subtree->access<double>("freq/value").get();
//------------------------------------------------------------------
//-- calculate the dsp freq, only used with automatic policy
@@ -145,17 +144,17 @@ static tune_result_t tune_xx_subdev_and_dsp(
//------------------------------------------------------------------
switch (tune_request.dsp_freq_policy){
case tune_request_t::POLICY_AUTO:
- tree->access<double>(dsp_path / "freq" / "value").set(target_dsp_freq);
+ dsp_subtree->access<double>("freq/value").set(target_dsp_freq);
break;
case tune_request_t::POLICY_MANUAL:
target_dsp_freq = tune_request.dsp_freq;
- tree->access<double>(dsp_path / "freq" / "value").set(target_dsp_freq);
+ dsp_subtree->access<double>("freq/value").set(target_dsp_freq);
break;
case tune_request_t::POLICY_NONE: break; //does not set
}
- const double actual_dsp_freq = tree->access<double>(dsp_path / "freq" / "value").get();
+ const double actual_dsp_freq = dsp_subtree->access<double>("freq/value").get();
//------------------------------------------------------------------
//-- load and return the tune result
@@ -170,13 +169,12 @@ static tune_result_t tune_xx_subdev_and_dsp(
static double derive_freq_from_xx_subdev_and_dsp(
const double xx_sign,
- property_tree::sptr tree,
- const property_tree::path_type &dsp_path,
- const property_tree::path_type &rf_fe_path
+ property_tree::sptr dsp_subtree,
+ property_tree::sptr rf_fe_subtree
){
//extract actual dsp and IF frequencies
- const double actual_rf_freq = tree->access<double>(rf_fe_path / "freq" / "value").get();
- const double actual_dsp_freq = tree->access<double>(dsp_path / "freq" / "value").get();
+ const double actual_rf_freq = rf_fe_subtree->access<double>("freq/value").get();
+ const double actual_dsp_freq = dsp_subtree->access<double>("freq/value").get();
//invert the sign on the dsp freq for transmit
return actual_rf_freq - actual_dsp_freq * xx_sign;
@@ -434,13 +432,13 @@ public:
}
tune_result_t set_rx_freq(const tune_request_t &tune_request, size_t chan){
- tune_result_t r = tune_xx_subdev_and_dsp(RX_SIGN, _tree, rx_dsp_root(chan), rx_rf_fe_root(chan), tune_request);
+ tune_result_t r = tune_xx_subdev_and_dsp(RX_SIGN, _tree->subtree(rx_dsp_root(chan)), _tree->subtree(rx_rf_fe_root(chan)), tune_request);
do_tune_freq_warning_message(tune_request.target_freq, get_rx_freq(chan), "RX");
return r;
}
double get_rx_freq(size_t chan){
- return derive_freq_from_xx_subdev_and_dsp(RX_SIGN, _tree, rx_dsp_root(chan), rx_rf_fe_root(chan));
+ return derive_freq_from_xx_subdev_and_dsp(RX_SIGN, _tree->subtree(rx_dsp_root(chan)), _tree->subtree(rx_rf_fe_root(chan)));
}
freq_range_t get_rx_freq_range(size_t chan){
@@ -542,13 +540,13 @@ public:
}
tune_result_t set_tx_freq(const tune_request_t &tune_request, size_t chan){
- tune_result_t r = tune_xx_subdev_and_dsp(TX_SIGN, _tree, tx_dsp_root(chan), tx_rf_fe_root(chan), tune_request);
+ tune_result_t r = tune_xx_subdev_and_dsp(TX_SIGN, _tree->subtree(tx_dsp_root(chan)), _tree->subtree(tx_rf_fe_root(chan)), tune_request);
do_tune_freq_warning_message(tune_request.target_freq, get_tx_freq(chan), "TX");
return r;
}
double get_tx_freq(size_t chan){
- return derive_freq_from_xx_subdev_and_dsp(TX_SIGN, _tree, tx_dsp_root(chan), tx_rf_fe_root(chan));
+ return derive_freq_from_xx_subdev_and_dsp(TX_SIGN, _tree->subtree(tx_dsp_root(chan)), _tree->subtree(tx_rf_fe_root(chan)));
}
freq_range_t get_tx_freq_range(size_t chan){
@@ -670,10 +668,10 @@ private:
const subdev_spec_pair_t spec = get_rx_subdev_spec(mcp.mboard).at(mcp.chan);
gain_group::sptr gg = gain_group::make();
BOOST_FOREACH(const std::string &name, _tree->list(mb_root(mcp.mboard) / "rx_codecs" / spec.db_name / "gains")){
- gg->register_fcns("ADC-"+name, make_gain_fcns_from_path(_tree, mb_root(mcp.mboard) / "rx_codecs" / spec.db_name / "gains" / name), 0 /* low prio */);
+ gg->register_fcns("ADC-"+name, make_gain_fcns_from_subtree(_tree->subtree(mb_root(mcp.mboard) / "rx_codecs" / spec.db_name / "gains" / name)), 0 /* low prio */);
}
BOOST_FOREACH(const std::string &name, _tree->list(rx_rf_fe_root(chan) / "gains")){
- gg->register_fcns(name, make_gain_fcns_from_path(_tree, rx_rf_fe_root(chan) / "gains" / name), 1 /* high prio */);
+ gg->register_fcns(name, make_gain_fcns_from_subtree(_tree->subtree(rx_rf_fe_root(chan) / "gains" / name)), 1 /* high prio */);
}
return gg;
}
@@ -683,10 +681,10 @@ private:
const subdev_spec_pair_t spec = get_tx_subdev_spec(mcp.mboard).at(mcp.chan);
gain_group::sptr gg = gain_group::make();
BOOST_FOREACH(const std::string &name, _tree->list(mb_root(mcp.mboard) / "tx_codecs" / spec.db_name / "gains")){
- gg->register_fcns("ADC-"+name, make_gain_fcns_from_path(_tree, mb_root(mcp.mboard) / "tx_codecs" / spec.db_name / "gains" / name), 1 /* high prio */);
+ gg->register_fcns("ADC-"+name, make_gain_fcns_from_subtree(_tree->subtree(mb_root(mcp.mboard) / "tx_codecs" / spec.db_name / "gains" / name)), 1 /* high prio */);
}
BOOST_FOREACH(const std::string &name, _tree->list(tx_rf_fe_root(chan) / "gains")){
- gg->register_fcns(name, make_gain_fcns_from_path(_tree, tx_rf_fe_root(chan) / "gains" / name), 0 /* low prio */);
+ gg->register_fcns(name, make_gain_fcns_from_subtree(_tree->subtree(tx_rf_fe_root(chan) / "gains" / name)), 0 /* low prio */);
}
return gg;
}
diff --git a/host/lib/usrp/usrp1/usrp1_impl.cpp b/host/lib/usrp/usrp1/usrp1_impl.cpp
index 78137178b..f27fc0768 100644
--- a/host/lib/usrp/usrp1/usrp1_impl.cpp
+++ b/host/lib/usrp/usrp1/usrp1_impl.cpp
@@ -346,13 +346,13 @@ usrp1_impl::usrp1_impl(const device_addr_t &device_addr){
);
BOOST_FOREACH(const std::string &name, _dbc[db].dboard_manager->get_rx_subdev_names()){
dboard_manager::populate_prop_tree_from_subdev(
- _tree, mb_path / "dboards" / db/ "rx_frontends" / name,
+ _tree->subtree(mb_path / "dboards" / db/ "rx_frontends" / name),
_dbc[db].dboard_manager->get_rx_subdev(name)
);
}
BOOST_FOREACH(const std::string &name, _dbc[db].dboard_manager->get_tx_subdev_names()){
dboard_manager::populate_prop_tree_from_subdev(
- _tree, mb_path / "dboards" / db/ "tx_frontends" / name,
+ _tree->subtree(mb_path / "dboards" / db/ "tx_frontends" / name),
_dbc[db].dboard_manager->get_tx_subdev(name)
);
}
diff --git a/host/lib/usrp/usrp2/usrp2_impl.cpp b/host/lib/usrp/usrp2/usrp2_impl.cpp
index 390d1813b..a42d1aae0 100644
--- a/host/lib/usrp/usrp2/usrp2_impl.cpp
+++ b/host/lib/usrp/usrp2/usrp2_impl.cpp
@@ -551,13 +551,13 @@ usrp2_impl::usrp2_impl(const device_addr_t &_device_addr){
);
BOOST_FOREACH(const std::string &name, _mbc[mb].dboard_manager->get_rx_subdev_names()){
dboard_manager::populate_prop_tree_from_subdev(
- _tree, mb_path / "dboards/A/rx_frontends" / name,
+ _tree->subtree(mb_path / "dboards/A/rx_frontends" / name),
_mbc[mb].dboard_manager->get_rx_subdev(name)
);
}
BOOST_FOREACH(const std::string &name, _mbc[mb].dboard_manager->get_tx_subdev_names()){
dboard_manager::populate_prop_tree_from_subdev(
- _tree, mb_path / "dboards/A/tx_frontends" / name,
+ _tree->subtree(mb_path / "dboards/A/tx_frontends" / name),
_mbc[mb].dboard_manager->get_tx_subdev(name)
);
}