aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/x300
diff options
context:
space:
mode:
authorAshish Chaudhari <ashish@ettus.com>2015-08-25 21:09:06 -0700
committerAshish Chaudhari <ashish@ettus.com>2016-02-11 14:36:20 -0800
commit27a08ccddc94c4945d48445b14c23fe6d186f9ef (patch)
treeaa0675904822e6dba9358cddc4ca1d66a3df3b7b /host/lib/usrp/x300
parent0d74d16093c9350205eb704b1aa6a4bcefa5667d (diff)
downloaduhd-27a08ccddc94c4945d48445b14c23fe6d186f9ef.tar.gz
uhd-27a08ccddc94c4945d48445b14c23fe6d186f9ef.tar.bz2
uhd-27a08ccddc94c4945d48445b14c23fe6d186f9ef.zip
prop_tree: Multiple API enhancements to uhd::property
- Added desired and coerced values and accessors to property - Added support to register desired subscribers - set APIs don't reallocate storage for a property value - Renamed callback method registration APIs - Registering 2 coercers or publishers for a property will throw - Registering a coercer and a publisher for the same property will throw
Diffstat (limited to 'host/lib/usrp/x300')
-rw-r--r--host/lib/usrp/x300/x300_impl.cpp60
1 files changed, 30 insertions, 30 deletions
diff --git a/host/lib/usrp/x300/x300_impl.cpp b/host/lib/usrp/x300/x300_impl.cpp
index 9a31ac98e..fc8e2090b 100644
--- a/host/lib/usrp/x300/x300_impl.cpp
+++ b/host/lib/usrp/x300/x300_impl.cpp
@@ -578,7 +578,7 @@ void x300_impl::setup_mb(const size_t mb_i, const uhd::device_addr_t &dev_addr)
const mboard_eeprom_t mb_eeprom(*eeprom16, "X300");
_tree->create<mboard_eeprom_t>(mb_path / "eeprom")
.set(mb_eeprom)
- .subscribe(boost::bind(&x300_impl::set_mb_eeprom, this, mb.zpu_i2c, _1));
+ .add_coerced_subscriber(boost::bind(&x300_impl::set_mb_eeprom, this, mb.zpu_i2c, _1));
bool recover_mb_eeprom = dev_addr.has_key("recover_mb_eeprom");
if (recover_mb_eeprom) {
@@ -700,7 +700,7 @@ void x300_impl::setup_mb(const size_t mb_i, const uhd::device_addr_t &dev_addr)
// create clock properties
////////////////////////////////////////////////////////////////////
_tree->create<double>(mb_path / "tick_rate")
- .publish(boost::bind(&x300_clock_ctrl::get_master_clock_rate, mb.clock));
+ .set_publisher(boost::bind(&x300_clock_ctrl::get_master_clock_rate, mb.clock));
_tree->create<time_spec_t>(mb_path / "time" / "cmd");
@@ -729,7 +729,7 @@ void x300_impl::setup_mb(const size_t mb_i, const uhd::device_addr_t &dev_addr)
BOOST_FOREACH(const std::string &name, mb.gps->get_sensors())
{
_tree->create<sensor_value_t>(mb_path / "sensors" / name)
- .publish(boost::bind(&gps_ctrl::get_sensor, mb.gps, name));
+ .set_publisher(boost::bind(&gps_ctrl::get_sensor, mb.gps, name));
}
}
else
@@ -801,35 +801,35 @@ void x300_impl::setup_mb(const size_t mb_i, const uhd::device_addr_t &dev_addr)
{
_tree->create<boost::uint32_t>(mb_path / "gpio" / "FP0" / attr.second)
.set(0)
- .subscribe(boost::bind(&gpio_atr_3000::set_gpio_attr, mb.fp_gpio, attr.first, _1));
+ .add_coerced_subscriber(boost::bind(&gpio_atr_3000::set_gpio_attr, mb.fp_gpio, attr.first, _1));
}
_tree->create<boost::uint32_t>(mb_path / "gpio" / "FP0" / "READBACK")
- .publish(boost::bind(&gpio_atr_3000::read_gpio, mb.fp_gpio));
+ .set_publisher(boost::bind(&gpio_atr_3000::read_gpio, mb.fp_gpio));
////////////////////////////////////////////////////////////////////
// register the time keepers - only one can be the highlander
////////////////////////////////////////////////////////////////////
_tree->create<time_spec_t>(mb_path / "time" / "now")
- .publish(boost::bind(&time_core_3000::get_time_now, mb.radio_perifs[0].time64))
- .subscribe(boost::bind(&x300_impl::sync_times, this, mb, _1))
+ .set_publisher(boost::bind(&time_core_3000::get_time_now, mb.radio_perifs[0].time64))
+ .add_coerced_subscriber(boost::bind(&x300_impl::sync_times, this, mb, _1))
.set(0.0);
_tree->create<time_spec_t>(mb_path / "time" / "pps")
- .publish(boost::bind(&time_core_3000::get_time_last_pps, mb.radio_perifs[0].time64))
- .subscribe(boost::bind(&time_core_3000::set_time_next_pps, mb.radio_perifs[0].time64, _1))
- .subscribe(boost::bind(&time_core_3000::set_time_next_pps, mb.radio_perifs[1].time64, _1));
+ .set_publisher(boost::bind(&time_core_3000::get_time_last_pps, mb.radio_perifs[0].time64))
+ .add_coerced_subscriber(boost::bind(&time_core_3000::set_time_next_pps, mb.radio_perifs[0].time64, _1))
+ .add_coerced_subscriber(boost::bind(&time_core_3000::set_time_next_pps, mb.radio_perifs[1].time64, _1));
////////////////////////////////////////////////////////////////////
// setup time sources and properties
////////////////////////////////////////////////////////////////////
_tree->create<std::string>(mb_path / "time_source" / "value")
.set("internal")
- .subscribe(boost::bind(&x300_impl::update_time_source, this, boost::ref(mb), _1));
+ .add_coerced_subscriber(boost::bind(&x300_impl::update_time_source, this, boost::ref(mb), _1));
static const std::vector<std::string> time_sources = boost::assign::list_of("internal")("external")("gpsdo");
_tree->create<std::vector<std::string> >(mb_path / "time_source" / "options").set(time_sources);
//setup the time output, default to ON
_tree->create<bool>(mb_path / "time_source" / "output")
- .subscribe(boost::bind(&x300_impl::set_time_source_out, this, boost::ref(mb), _1))
+ .add_coerced_subscriber(boost::bind(&x300_impl::set_time_source_out, this, boost::ref(mb), _1))
.set(true);
////////////////////////////////////////////////////////////////////
@@ -837,7 +837,7 @@ void x300_impl::setup_mb(const size_t mb_i, const uhd::device_addr_t &dev_addr)
////////////////////////////////////////////////////////////////////
_tree->create<std::string>(mb_path / "clock_source" / "value")
.set("internal")
- .subscribe(boost::bind(&x300_impl::update_clock_source, this, boost::ref(mb), _1));
+ .add_coerced_subscriber(boost::bind(&x300_impl::update_clock_source, this, boost::ref(mb), _1));
static const std::vector<std::string> clock_source_options = boost::assign::list_of("internal")("external")("gpsdo");
_tree->create<std::vector<std::string> >(mb_path / "clock_source" / "options").set(clock_source_options);
@@ -853,12 +853,12 @@ void x300_impl::setup_mb(const size_t mb_i, const uhd::device_addr_t &dev_addr)
//setup the clock output, default to ON
_tree->create<bool>(mb_path / "clock_source" / "output")
- .subscribe(boost::bind(&x300_clock_ctrl::set_ref_out, mb.clock, _1));
+ .add_coerced_subscriber(boost::bind(&x300_clock_ctrl::set_ref_out, mb.clock, _1));
//initialize tick rate (must be done before setting time)
_tree->access<double>(mb_path / "tick_rate")
- .subscribe(boost::bind(&x300_impl::set_tick_rate, this, boost::ref(mb), _1))
- .subscribe(boost::bind(&x300_impl::update_tick_rate, this, boost::ref(mb), _1))
+ .add_coerced_subscriber(boost::bind(&x300_impl::set_tick_rate, this, boost::ref(mb), _1))
+ .add_coerced_subscriber(boost::bind(&x300_impl::update_tick_rate, this, boost::ref(mb), _1))
.set(mb.clock->get_master_clock_rate());
////////////////////////////////////////////////////////////////////
@@ -868,15 +868,15 @@ void x300_impl::setup_mb(const size_t mb_i, const uhd::device_addr_t &dev_addr)
_tree->create<std::vector<size_t> >(mb_path / "rx_chan_dsp_mapping").set(default_map);
_tree->create<std::vector<size_t> >(mb_path / "tx_chan_dsp_mapping").set(default_map);
_tree->create<subdev_spec_t>(mb_path / "rx_subdev_spec")
- .subscribe(boost::bind(&x300_impl::update_subdev_spec, this, "rx", mb_i, _1));
+ .add_coerced_subscriber(boost::bind(&x300_impl::update_subdev_spec, this, "rx", mb_i, _1));
_tree->create<subdev_spec_t>(mb_path / "tx_subdev_spec")
- .subscribe(boost::bind(&x300_impl::update_subdev_spec, this, "tx", mb_i, _1));
+ .add_coerced_subscriber(boost::bind(&x300_impl::update_subdev_spec, this, "tx", mb_i, _1));
////////////////////////////////////////////////////////////////////
// and do the misc mboard sensors
////////////////////////////////////////////////////////////////////
_tree->create<sensor_value_t>(mb_path / "sensors" / "ref_locked")
- .publish(boost::bind(&x300_impl::get_ref_locked, this, mb));
+ .set_publisher(boost::bind(&x300_impl::get_ref_locked, this, mb));
////////////////////////////////////////////////////////////////////
// do some post-init tasks
@@ -1008,7 +1008,7 @@ void x300_impl::setup_radio(const size_t mb_i, const std::string &slot_name, con
self_cal_adc_capture_delay(mb, radio_index, dev_addr.has_key("self_cal_adc_delay"));
_tree->access<time_spec_t>(mb_path / "time" / "cmd")
- .subscribe(boost::bind(&radio_ctrl_core_3000::set_time, perif.ctrl, _1));
+ .add_coerced_subscriber(boost::bind(&radio_ctrl_core_3000::set_time, perif.ctrl, _1));
////////////////////////////////////////////////////////////////
// create codec control objects
@@ -1020,7 +1020,7 @@ void x300_impl::setup_radio(const size_t mb_i, const std::string &slot_name, con
_tree->create<meta_range_t>(mb_path / "rx_codecs" / slot_name / "gains" / "digital" / "range").set(meta_range_t(0, 6.0, 0.5));
_tree->create<double>(mb_path / "rx_codecs" / slot_name / "gains" / "digital" / "value")
- .subscribe(boost::bind(&x300_adc_ctrl::set_gain, perif.adc, _1)).set(0);
+ .add_coerced_subscriber(boost::bind(&x300_adc_ctrl::set_gain, perif.adc, _1)).set(0);
////////////////////////////////////////////////////////////////////
// front end corrections
@@ -1034,10 +1034,10 @@ void x300_impl::setup_radio(const size_t mb_i, const std::string &slot_name, con
const fs_path rx_dsp_path = mb_path / "rx_dsps" / str(boost::format("%u") % radio_index);
perif.ddc->populate_subtree(_tree->subtree(rx_dsp_path));
_tree->access<double>(rx_dsp_path / "rate" / "value")
- .subscribe(boost::bind(&x300_impl::update_rx_samp_rate, this, boost::ref(mb), radio_index, _1))
+ .add_coerced_subscriber(boost::bind(&x300_impl::update_rx_samp_rate, this, boost::ref(mb), radio_index, _1))
;
_tree->create<stream_cmd_t>(rx_dsp_path / "stream_cmd")
- .subscribe(boost::bind(&rx_vita_core_3000::issue_stream_command, perif.framer, _1));
+ .add_coerced_subscriber(boost::bind(&rx_vita_core_3000::issue_stream_command, perif.framer, _1));
////////////////////////////////////////////////////////////////////
// connect tx dsp control objects
@@ -1045,7 +1045,7 @@ void x300_impl::setup_radio(const size_t mb_i, const std::string &slot_name, con
const fs_path tx_dsp_path = mb_path / "tx_dsps" / str(boost::format("%u") % radio_index);
perif.duc->populate_subtree(_tree->subtree(tx_dsp_path));
_tree->access<double>(tx_dsp_path / "rate" / "value")
- .subscribe(boost::bind(&x300_impl::update_tx_samp_rate, this, boost::ref(mb), radio_index, _1))
+ .add_coerced_subscriber(boost::bind(&x300_impl::update_tx_samp_rate, this, boost::ref(mb), radio_index, _1))
;
////////////////////////////////////////////////////////////////////
@@ -1055,13 +1055,13 @@ void x300_impl::setup_radio(const size_t mb_i, const std::string &slot_name, con
const size_t j = (slot_name == "B")? 0x2 : 0x0;
_tree->create<dboard_eeprom_t>(db_path / "rx_eeprom")
.set(mb.db_eeproms[X300_DB0_RX_EEPROM | j])
- .subscribe(boost::bind(&x300_impl::set_db_eeprom, this, mb.zpu_i2c, (0x50 | X300_DB0_RX_EEPROM | j), _1));
+ .add_coerced_subscriber(boost::bind(&x300_impl::set_db_eeprom, this, mb.zpu_i2c, (0x50 | X300_DB0_RX_EEPROM | j), _1));
_tree->create<dboard_eeprom_t>(db_path / "tx_eeprom")
.set(mb.db_eeproms[X300_DB0_TX_EEPROM | j])
- .subscribe(boost::bind(&x300_impl::set_db_eeprom, this, mb.zpu_i2c, (0x50 | X300_DB0_TX_EEPROM | j), _1));
+ .add_coerced_subscriber(boost::bind(&x300_impl::set_db_eeprom, this, mb.zpu_i2c, (0x50 | X300_DB0_TX_EEPROM | j), _1));
_tree->create<dboard_eeprom_t>(db_path / "gdb_eeprom")
.set(mb.db_eeproms[X300_DB0_GDB_EEPROM | j])
- .subscribe(boost::bind(&x300_impl::set_db_eeprom, this, mb.zpu_i2c, (0x50 | X300_DB0_GDB_EEPROM | j), _1));
+ .add_coerced_subscriber(boost::bind(&x300_impl::set_db_eeprom, this, mb.zpu_i2c, (0x50 | X300_DB0_GDB_EEPROM | j), _1));
//create a new dboard interface
x300_dboard_iface_config_t db_config;
@@ -1090,19 +1090,19 @@ void x300_impl::setup_radio(const size_t mb_i, const std::string &slot_name, con
//now that dboard is created -- register into rx antenna event
const std::string fe_name = _tree->list(db_path / "rx_frontends").front();
_tree->access<std::string>(db_path / "rx_frontends" / fe_name / "antenna" / "value")
- .subscribe(boost::bind(&x300_impl::update_atr_leds, this, mb.radio_perifs[radio_index].leds, _1));
+ .add_coerced_subscriber(boost::bind(&x300_impl::update_atr_leds, this, mb.radio_perifs[radio_index].leds, _1));
this->update_atr_leds(mb.radio_perifs[radio_index].leds, ""); //init anyway, even if never called
//bind frontend corrections to the dboard freq props
const fs_path db_tx_fe_path = db_path / "tx_frontends";
BOOST_FOREACH(const std::string &name, _tree->list(db_tx_fe_path)) {
_tree->access<double>(db_tx_fe_path / name / "freq" / "value")
- .subscribe(boost::bind(&x300_impl::set_tx_fe_corrections, this, mb_path, slot_name, _1));
+ .add_coerced_subscriber(boost::bind(&x300_impl::set_tx_fe_corrections, this, mb_path, slot_name, _1));
}
const fs_path db_rx_fe_path = db_path / "rx_frontends";
BOOST_FOREACH(const std::string &name, _tree->list(db_rx_fe_path)) {
_tree->access<double>(db_rx_fe_path / name / "freq" / "value")
- .subscribe(boost::bind(&x300_impl::set_rx_fe_corrections, this, mb_path, slot_name, _1));
+ .add_coerced_subscriber(boost::bind(&x300_impl::set_rx_fe_corrections, this, mb_path, slot_name, _1));
}
}