aboutsummaryrefslogtreecommitdiffstats
path: root/host
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2011-06-27 21:17:11 -0700
committerJosh Blum <josh@joshknows.com>2011-06-27 21:17:11 -0700
commit0ad65e551369d3242e941489d90c8d527be7c7ce (patch)
tree9545e583f64ddd14fbac51860187a07d59000207 /host
parent5aab802b600dae2d8728ae11550cc2a4e6ba6895 (diff)
downloaduhd-0ad65e551369d3242e941489d90c8d527be7c7ce.tar.gz
uhd-0ad65e551369d3242e941489d90c8d527be7c7ce.tar.bz2
uhd-0ad65e551369d3242e941489d90c8d527be7c7ce.zip
usrp2: added gps ctrl and mboard and gps sensors
Diffstat (limited to 'host')
-rw-r--r--host/lib/usrp2/usrp2_impl.cpp73
-rw-r--r--host/lib/usrp2/usrp2_impl.hpp6
2 files changed, 59 insertions, 20 deletions
diff --git a/host/lib/usrp2/usrp2_impl.cpp b/host/lib/usrp2/usrp2_impl.cpp
index 53e0c51ac..3e39b7d23 100644
--- a/host/lib/usrp2/usrp2_impl.cpp
+++ b/host/lib/usrp2/usrp2_impl.cpp
@@ -230,8 +230,8 @@ usrp2_impl::usrp2_impl(const device_addr_t &_device_addr){
////////////////////////////////////////////////////////////////
// create codec control objects
////////////////////////////////////////////////////////////////
- property_tree::path_type rx_codec_path = mb_path / "rx_codecs/0";
- property_tree::path_type tx_codec_path = mb_path / "tx_codecs/0";
+ property_tree::path_type rx_codec_path = mb_path / "rx_codecs/A";
+ property_tree::path_type tx_codec_path = mb_path / "tx_codecs/A";
_mboard_stuff[mb].codec = usrp2_codec_ctrl::make(_mboard_stuff[mb].iface);
switch(_mboard_stuff[mb].iface->get_rev()){
case usrp2_iface::USRP_N200:
@@ -239,15 +239,13 @@ usrp2_impl::usrp2_impl(const device_addr_t &_device_addr){
case usrp2_iface::USRP_N200_R4:
case usrp2_iface::USRP_N210_R4:{
_tree->create(rx_codec_path / "name", property<std::string>("ads62p44"));
- _tree->create(rx_codec_path / "gains/0/name", property<std::string>("digital"));
- _tree->create(rx_codec_path / "gains/0/range", property<meta_range_t>(meta_range_t(0, 6.0, 0.5)));
+ _tree->create(rx_codec_path / "gains/digital/range", property<meta_range_t>(meta_range_t(0, 6.0, 0.5)));
property<double> dig_gain_prop, fine_gain_prop;
dig_gain_prop.subscribe(boost::bind(&usrp2_codec_ctrl::set_rx_digital_gain, _mboard_stuff[mb].codec, _1));
- _tree->create(rx_codec_path / "gains/0/value", dig_gain_prop);
- _tree->create(rx_codec_path / "gains/1/name", property<std::string>("digital-fine"));
- _tree->create(rx_codec_path / "gains/1/range", property<meta_range_t>(meta_range_t(0, 0.5, 0.05)));
+ _tree->create(rx_codec_path / "gains/digital/value", dig_gain_prop);
+ _tree->create(rx_codec_path / "gains/fine/range", property<meta_range_t>(meta_range_t(0, 0.5, 0.05)));
fine_gain_prop.subscribe(boost::bind(&usrp2_codec_ctrl::set_rx_digital_fine_gain, _mboard_stuff[mb].codec, _1));
- _tree->create(rx_codec_path / "gains/0/value", fine_gain_prop);
+ _tree->create(rx_codec_path / "gains/fine/value", fine_gain_prop);
}break;
case usrp2_iface::USRP2_REV3:
@@ -264,13 +262,42 @@ usrp2_impl::usrp2_impl(const device_addr_t &_device_addr){
////////////////////////////////////////////////////////////////
// create gpsdo control objects
////////////////////////////////////////////////////////////////
- //TODO
- //TODO register sensors
+ if (_mboard_stuff[mb].iface->mb_eeprom["gpsdo"] == "internal"){
+ _mboard_stuff[mb].gps = gps_ctrl::make(
+ _mboard_stuff[mb].iface->get_gps_write_fn(),
+ _mboard_stuff[mb].iface->get_gps_read_fn()
+ );
+ BOOST_FOREACH(const std::string &name, _mboard_stuff[mb].gps->get_sensors()){
+ property<sensor_value_t> sensor_prop;
+ sensor_prop.publish(boost::bind(&gps_ctrl::get_sensor, _mboard_stuff[mb].gps, name));
+ _tree->create(mb_path / "sensors" / name, sensor_prop);
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////
+ // and do the misc mboard sensors
+ ////////////////////////////////////////////////////////////////
+ property<sensor_value_t> mimo_lock_sensor_prop;
+ mimo_lock_sensor_prop.publish(boost::bind(&usrp2_impl::get_mimo_locked, this, mb));
+ _tree->create(mb_path / "sensors/mimo_locked", mimo_lock_sensor_prop);
+ property<sensor_value_t> ref_lock_sensor_prop;
+ ref_lock_sensor_prop.publish(boost::bind(&usrp2_impl::get_ref_locked, this, mb));
+ _tree->create(mb_path / "sensors/ref_locked", ref_lock_sensor_prop);
+
- //TODO other sensors
+
+
+
+ //TODO //initialize VITA time to GPS time
//TODO clock source, time source
+
+
+
+
+
+
////////////////////////////////////////////////////////////////
// create frontend control objects
////////////////////////////////////////////////////////////////
@@ -353,15 +380,15 @@ usrp2_impl::usrp2_impl(const device_addr_t &_device_addr){
//create the properties and register subscribers
property<dboard_eeprom_t> rx_db_eeprom_prop(rx_db_eeprom), tx_db_eeprom_prop(tx_db_eeprom), gdb_eeprom_prop(gdb_eeprom);
rx_db_eeprom_prop.subscribe(boost::bind(&usrp2_impl::set_db_eeprom, this, mb, "rx", _1));
- _tree->create(mb_path / "dboards/0/rx_eeprom", rx_db_eeprom_prop);
+ _tree->create(mb_path / "dboards/A/rx_eeprom", rx_db_eeprom_prop);
tx_db_eeprom_prop.subscribe(boost::bind(&usrp2_impl::set_db_eeprom, this, mb, "tx", _1));
- _tree->create(mb_path / "dboards/0/tx_eeprom", tx_db_eeprom_prop);
+ _tree->create(mb_path / "dboards/A/tx_eeprom", tx_db_eeprom_prop);
gdb_eeprom_prop.subscribe(boost::bind(&usrp2_impl::set_db_eeprom, this, mb, "gdb", _1));
- _tree->create(mb_path / "dboards/0/gdb_eeprom", gdb_eeprom_prop);
+ _tree->create(mb_path / "dboards/A/gdb_eeprom", gdb_eeprom_prop);
//create a new dboard interface and manager
_mboard_stuff[mb].dboard_iface = make_usrp2_dboard_iface(_mboard_stuff[mb].iface, _mboard_stuff[mb].clock);
- _tree->create(mb_path / "dboards/0/iface", property<dboard_iface::sptr>(_mboard_stuff[mb].dboard_iface));
+ _tree->create(mb_path / "dboards/A/iface", property<dboard_iface::sptr>(_mboard_stuff[mb].dboard_iface));
_mboard_stuff[mb].dboard_manager = dboard_manager::make(
rx_db_eeprom.id,
((gdb_eeprom.id == dboard_id_t::none())? tx_db_eeprom : gdb_eeprom).id,
@@ -369,19 +396,17 @@ usrp2_impl::usrp2_impl(const device_addr_t &_device_addr){
);
BOOST_FOREACH(const std::string &name, _mboard_stuff[mb].dboard_manager->get_rx_subdev_names()){
dboard_manager::populate_prop_tree_from_subdev(
- _tree, mb_path / "rx_rf_frontends" / name,
+ _tree, mb_path / "dboards/A/rx_frontends" / name,
_mboard_stuff[mb].dboard_manager->get_rx_subdev(name)
);
}
BOOST_FOREACH(const std::string &name, _mboard_stuff[mb].dboard_manager->get_tx_subdev_names()){
dboard_manager::populate_prop_tree_from_subdev(
- _tree, mb_path / "tx_rf_frontends" / name,
+ _tree, mb_path / "dboards/A/tx_frontends" / name,
_mboard_stuff[mb].dboard_manager->get_tx_subdev(name)
);
}
-
}
-
}
usrp2_impl::~usrp2_impl(void){UHD_SAFE_CALL(
@@ -399,3 +424,13 @@ void usrp2_impl::set_db_eeprom(const size_t which_mb, const std::string &type, c
if (type == "tx") db_eeprom.store(*_mboard_stuff[which_mb].iface, USRP2_I2C_ADDR_TX_DB);
if (type == "gdb") db_eeprom.store(*_mboard_stuff[which_mb].iface, USRP2_I2C_ADDR_TX_DB ^ 5);
}
+
+sensor_value_t usrp2_impl::get_mimo_locked(const size_t which_mb){
+ const bool lock = (_mboard_stuff[which_mb].iface->peek32(U2_REG_IRQ_RB) & (1<<10)) != 0;
+ return sensor_value_t("MIMO", lock, "locked", "unlocked");
+}
+
+sensor_value_t usrp2_impl::get_ref_locked(const size_t which_mb){
+ const bool lock = (_mboard_stuff[which_mb].iface->peek32(U2_REG_IRQ_RB) & (1<<11)) != 0;
+ return sensor_value_t("Ref", lock, "locked", "unlocked");
+}
diff --git a/host/lib/usrp2/usrp2_impl.hpp b/host/lib/usrp2/usrp2_impl.hpp
index fe82af40a..47fc10d8d 100644
--- a/host/lib/usrp2/usrp2_impl.hpp
+++ b/host/lib/usrp2/usrp2_impl.hpp
@@ -66,7 +66,7 @@ uhd::usrp::dboard_iface::sptr make_usrp2_dboard_iface(
*/
class usrp2_impl{
public:
- usrp2_impl(const uhd::device_addr_t &_device_addr);
+ usrp2_impl(const uhd::device_addr_t &);
~usrp2_impl(void);
uhd::property_tree::sptr _tree;
private:
@@ -74,6 +74,7 @@ private:
usrp2_iface::sptr iface;
usrp2_clock_ctrl::sptr clock;
usrp2_codec_ctrl::sptr codec;
+ gps_ctrl::sptr gps;
rx_frontend_core_200::sptr rx_fe;
tx_frontend_core_200::sptr tx_fe;
std::vector<rx_dsp_core_200::sptr> rx_dsps;
@@ -89,6 +90,9 @@ private:
void set_mb_eeprom(const size_t which_mb, const uhd::usrp::mboard_eeprom_t &mb_eeprom);
void set_db_eeprom(const size_t which_mb, const std::string &type, const uhd::usrp::dboard_eeprom_t &db_eeprom);
+ uhd::sensor_value_t get_mimo_locked(const size_t which_mb);
+ uhd::sensor_value_t get_ref_locked(const size_t which_mb);
+
};
#endif /* INCLUDED_USRP2_IMPL_HPP */