summaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/usrp2
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2011-06-22 07:41:56 -0700
committerJosh Blum <josh@joshknows.com>2011-06-22 07:41:56 -0700
commitcad0b57a94c8dc01cd322435259877dbffc26be8 (patch)
tree2f70d745518d6f2637ec59627d3f942214860d28 /host/lib/usrp/usrp2
parentb7f6d905af5993f6c0b554777ab2a4559a36db15 (diff)
parentab63a540883bf4c21980ac30b746045e00fffc0a (diff)
downloaduhd-cad0b57a94c8dc01cd322435259877dbffc26be8.tar.gz
uhd-cad0b57a94c8dc01cd322435259877dbffc26be8.tar.bz2
uhd-cad0b57a94c8dc01cd322435259877dbffc26be8.zip
Merge branch 'gps_work'
Diffstat (limited to 'host/lib/usrp/usrp2')
-rw-r--r--host/lib/usrp/usrp2/mboard_impl.cpp24
1 files changed, 20 insertions, 4 deletions
diff --git a/host/lib/usrp/usrp2/mboard_impl.cpp b/host/lib/usrp/usrp2/mboard_impl.cpp
index 6bf412a3e..61ceb95ca 100644
--- a/host/lib/usrp/usrp2/mboard_impl.cpp
+++ b/host/lib/usrp/usrp2/mboard_impl.cpp
@@ -149,7 +149,13 @@ usrp2_mboard_impl::usrp2_mboard_impl(
(_mimo_clocking_mode_is_master?"master":"slave") << std::endl;
//init the clock config
- _clock_config = clock_config_t::internal();
+ if(_iface->mb_eeprom["gpsdo"] == "internal" or
+ _iface->mb_eeprom["gpsdo"] == "external") {
+ _clock_config = clock_config_t::external();
+ }
+ else {
+ _clock_config = clock_config_t::internal();
+ }
update_clock_config();
//init the codec before the dboard
@@ -174,6 +180,13 @@ usrp2_mboard_impl::usrp2_mboard_impl(
_iface->poke32(U2_REG_RX_CTRL_CLEAR(i), 1); //resets sequence
}
//------------------------------------------------------------------
+
+ //initialize VITA time to GPS time
+ if( _gps_ctrl.get()
+ and _gps_ctrl->gps_detected()) {
+ UHD_MSG(status) << "Setting device time to GPS time...\n";
+ set_time_spec(time_spec_t(double(_gps_ctrl->get_sensor("gps_time").to_int()+1)), false);
+ }
}
usrp2_mboard_impl::~usrp2_mboard_impl(void){UHD_SAFE_CALL(
@@ -375,7 +388,10 @@ void usrp2_mboard_impl::get(const wax::obj &key_, wax::obj &val){
case SUBDEV_PROP_SENSOR_NAMES:{
prop_names_t names = boost::assign::list_of("mimo_locked")("ref_locked");
- if (_gps_ctrl.get()) names.push_back("gps_time");
+ if (_gps_ctrl.get()) {
+ std::vector<std::string> gs = _gps_ctrl->get_sensors();
+ names.insert(names.end(), gs.begin(), gs.end());
+ }
val = names;
}
return;
@@ -389,8 +405,8 @@ void usrp2_mboard_impl::get(const wax::obj &key_, wax::obj &val){
val = sensor_value_t("Ref", this->get_ref_locked(), "locked", "unlocked");
return;
}
- else if(key.name == "gps_time" and _gps_ctrl.get()) {
- val = sensor_value_t("GPS time", int(_gps_ctrl->get_epoch_time()), "seconds");
+ else if(uhd::has(_gps_ctrl->get_sensors(), key.name) and _gps_ctrl.get()) {
+ val = _gps_ctrl->get_sensor(key.name);
}
else {
UHD_THROW_PROP_GET_ERROR();