summaryrefslogtreecommitdiffstats
path: root/host/lib
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2011-06-29 12:20:19 -0700
committerJosh Blum <josh@joshknows.com>2011-06-29 12:20:19 -0700
commit35a0bce9f01e354c527806b4c8f6f2ef493db2f6 (patch)
tree8986bd9e104f06fc9cda77d27bb2bf8dd07d9b05 /host/lib
parent54b8be72fd07bb51568ad5c4bad678b081a8dbe5 (diff)
downloaduhd-35a0bce9f01e354c527806b4c8f6f2ef493db2f6.tar.gz
uhd-35a0bce9f01e354c527806b4c8f6f2ef493db2f6.tar.bz2
uhd-35a0bce9f01e354c527806b4c8f6f2ef493db2f6.zip
uhd: make sure things are initialized
Diffstat (limited to 'host/lib')
-rw-r--r--host/lib/usrp/dboard_manager.cpp32
-rw-r--r--host/lib/usrp/multi_usrp.cpp2
-rw-r--r--host/lib/usrp2/usrp2_impl.cpp13
3 files changed, 36 insertions, 11 deletions
diff --git a/host/lib/usrp/dboard_manager.cpp b/host/lib/usrp/dboard_manager.cpp
index d5e7d5b8a..5fa10f215 100644
--- a/host/lib/usrp/dboard_manager.cpp
+++ b/host/lib/usrp/dboard_manager.cpp
@@ -415,8 +415,11 @@ static sensor_value_t get_sensor(wax::obj subdev, const std::string &name){
return subdev[named_prop_t(SUBDEV_PROP_SENSOR, name)].as<sensor_value_t>();
}
-static double get_set_gain(wax::obj subdev, const std::string &name, const double gain){
+static void set_gain(wax::obj subdev, const std::string &name, const double gain){
subdev[named_prop_t(SUBDEV_PROP_GAIN, name)] = gain;
+}
+
+static double get_gain(wax::obj subdev, const std::string &name){
return subdev[named_prop_t(SUBDEV_PROP_GAIN, name)].as<double>();
}
@@ -424,8 +427,11 @@ static meta_range_t get_gain_range(wax::obj subdev, const std::string &name){
return subdev[named_prop_t(SUBDEV_PROP_GAIN_RANGE, name)].as<meta_range_t>();
}
-static double get_set_freq(wax::obj subdev, const double freq){
+static void set_freq(wax::obj subdev, const double freq){
subdev[SUBDEV_PROP_FREQ] = freq;
+}
+
+static double get_freq(wax::obj subdev){
return subdev[SUBDEV_PROP_FREQ].as<double>();
}
@@ -433,8 +439,11 @@ static meta_range_t get_freq_range(wax::obj subdev){
return subdev[SUBDEV_PROP_FREQ_RANGE].as<meta_range_t>();
}
-static std::string get_set_ant(wax::obj subdev, const std::string &ant){
+static void set_ant(wax::obj subdev, const std::string &ant){
subdev[SUBDEV_PROP_ANTENNA] = ant;
+}
+
+static std::string get_ant(wax::obj subdev){
return subdev[SUBDEV_PROP_ANTENNA].as<std::string>();
}
@@ -461,8 +470,11 @@ static bool get_set_enb(wax::obj subdev, const bool enb){
return subdev[SUBDEV_PROP_ENABLED].as<bool>();
}
-static double get_set_bw(wax::obj subdev, const double freq){
+static void set_bw(wax::obj subdev, const double freq){
subdev[SUBDEV_PROP_BANDWIDTH] = freq;
+}
+
+static double get_bw(wax::obj subdev){
return subdev[SUBDEV_PROP_BANDWIDTH].as<double>();
}
@@ -483,19 +495,22 @@ void dboard_manager::populate_prop_tree_from_subdev(
tree->create<int>(root / "gains"); //phony property so this dir exists
BOOST_FOREACH(const std::string &name, gain_names){
tree->create<double>(root / "gains" / name / "value")
- .coerce(boost::bind(&get_set_gain, subdev, name, _1));
+ .publish(boost::bind(&get_gain, subdev, name))
+ .subscribe(boost::bind(&set_gain, subdev, name, _1));
tree->create<meta_range_t>(root / "gains" / name / "range")
.publish(boost::bind(&get_gain_range, subdev, name));
}
tree->create<double>(root / "freq/value")
- .coerce(boost::bind(&get_set_freq, subdev, _1));
+ .publish(boost::bind(&get_freq, subdev))
+ .subscribe(boost::bind(&set_freq, subdev, _1));
tree->create<meta_range_t>(root / "freq/range")
.publish(boost::bind(&get_freq_range, subdev));
tree->create<std::string>(root / "antenna/value")
- .coerce(boost::bind(&get_set_ant, subdev, _1));
+ .publish(boost::bind(&get_ant, subdev))
+ .subscribe(boost::bind(&set_ant, subdev, _1));
tree->create<std::vector<std::string> >(root / "antenna/options")
.publish(boost::bind(&get_ants, subdev));
@@ -510,5 +525,6 @@ void dboard_manager::populate_prop_tree_from_subdev(
.publish(boost::bind(&get_use_lo_off, subdev));
tree->create<double>(root / "bandwidth/value")
- .coerce(boost::bind(&get_set_bw, subdev, _1));
+ .publish(boost::bind(&get_bw, subdev))
+ .subscribe(boost::bind(&set_bw, subdev, _1));
}
diff --git a/host/lib/usrp/multi_usrp.cpp b/host/lib/usrp/multi_usrp.cpp
index c3926b6c4..e60a706ad 100644
--- a/host/lib/usrp/multi_usrp.cpp
+++ b/host/lib/usrp/multi_usrp.cpp
@@ -544,7 +544,7 @@ 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);
- do_tune_freq_warning_message(tune_request.target_freq, get_tx_freq(chan), "RX");
+ do_tune_freq_warning_message(tune_request.target_freq, get_tx_freq(chan), "TX");
return r;
}
diff --git a/host/lib/usrp2/usrp2_impl.cpp b/host/lib/usrp2/usrp2_impl.cpp
index 4c0eed7cc..e00924ebd 100644
--- a/host/lib/usrp2/usrp2_impl.cpp
+++ b/host/lib/usrp2/usrp2_impl.cpp
@@ -361,10 +361,10 @@ usrp2_impl::usrp2_impl(const device_addr_t &_device_addr){
_tree->create<std::string>(rx_codec_path / "name").set("ads62p44");
_tree->create<meta_range_t>(rx_codec_path / "gains/digital/range").set(meta_range_t(0, 6.0, 0.5));
_tree->create<double>(rx_codec_path / "gains/digital/value")
- .subscribe(boost::bind(&usrp2_codec_ctrl::set_rx_digital_gain, _mbc[mb].codec, _1));
+ .subscribe(boost::bind(&usrp2_codec_ctrl::set_rx_digital_gain, _mbc[mb].codec, _1)).set(0);
_tree->create<meta_range_t>(rx_codec_path / "gains/fine/range").set(meta_range_t(0, 0.5, 0.05));
_tree->create<double>(rx_codec_path / "gains/fine/value")
- .subscribe(boost::bind(&usrp2_codec_ctrl::set_rx_digital_fine_gain, _mbc[mb].codec, _1));
+ .subscribe(boost::bind(&usrp2_codec_ctrl::set_rx_digital_fine_gain, _mbc[mb].codec, _1)).set(0);
}break;
case usrp2_iface::USRP2_REV3:
@@ -548,6 +548,15 @@ usrp2_impl::usrp2_impl(const device_addr_t &_device_addr){
BOOST_FOREACH(const std::string &mb, _mbc.keys()){
property_tree::path_type root = "/mboards/" + mb;
_tree->access<double>(root / "tick_rate").update();
+
+ //and now that the tick rate is set, init the host rates to something
+ BOOST_FOREACH(const std::string &name, _tree->list(root / "rx_dsps")){
+ _tree->access<double>(root / "rx_dsps" / name / "rate" / "value").set(1e6);
+ }
+ BOOST_FOREACH(const std::string &name, _tree->list(root / "tx_dsps")){
+ _tree->access<double>(root / "tx_dsps" / name / "rate" / "value").set(1e6);
+ }
+
_tree->access<subdev_spec_t>(root / "rx_subdev_spec").set(subdev_spec_t("A:"+_mbc[mb].dboard_manager->get_rx_subdev_names()[0]));
_tree->access<subdev_spec_t>(root / "tx_subdev_spec").set(subdev_spec_t("A:"+_mbc[mb].dboard_manager->get_tx_subdev_names()[0]));
_tree->access<std::string>(root / "ref_source/value").set("internal");