aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2014-07-31 15:25:22 +0200
committerMartin Braun <martin.braun@ettus.com>2014-07-31 15:25:22 +0200
commit4999b5df50d4e859bc3c95c2cbe0efc58df5c42a (patch)
treecc80a46c215a2af8285a3b6353417c1135adbbcb /host/lib
parentcc6414ebcfa637cac5a66872c20848c30f2ee987 (diff)
parentfb47c829c2006ff42d5fc5e167060c801c463325 (diff)
downloaduhd-4999b5df50d4e859bc3c95c2cbe0efc58df5c42a.tar.gz
uhd-4999b5df50d4e859bc3c95c2cbe0efc58df5c42a.tar.bz2
uhd-4999b5df50d4e859bc3c95c2cbe0efc58df5c42a.zip
Merge branch 'maint'
Conflicts: host/utils/usrp_burn_mb_eeprom.cpp
Diffstat (limited to 'host/lib')
-rw-r--r--host/lib/usrp/b200/b200_impl.cpp5
-rw-r--r--host/lib/usrp/usrp2/usrp2_impl.cpp9
-rw-r--r--host/lib/usrp/x300/x300_impl.cpp28
-rw-r--r--host/lib/usrp/x300/x300_impl.hpp4
4 files changed, 35 insertions, 11 deletions
diff --git a/host/lib/usrp/b200/b200_impl.cpp b/host/lib/usrp/b200/b200_impl.cpp
index 245fbf4a9..49ed3f3f9 100644
--- a/host/lib/usrp/b200/b200_impl.cpp
+++ b/host/lib/usrp/b200/b200_impl.cpp
@@ -474,6 +474,11 @@ b200_impl::b200_impl(const device_addr_t &device_addr)
UHD_MSG(status) << "Initializing time to the internal GPSDO" << std::endl;
const time_t tp = time_t(_gps->get_sensor("gps_time").to_int()+1);
_tree->access<time_spec_t>(mb_path / "time" / "pps").set(time_spec_t(tp));
+
+ //wait for next PPS edge (timeout after 1 second)
+ time_spec_t pps_time = _tree->access<time_spec_t>(mb_path / "time" / "pps").get();
+ for (size_t i = 0; i < 10 && _tree->access<time_spec_t>(mb_path / "time" / "pps").get() == pps_time; i++)
+ boost::this_thread::sleep(boost::posix_time::milliseconds(100));
} else {
//init to internal clock and time source
_tree->access<std::string>(mb_path / "clock_source/value").set("internal");
diff --git a/host/lib/usrp/usrp2/usrp2_impl.cpp b/host/lib/usrp/usrp2/usrp2_impl.cpp
index ae2a6f81d..2ad15aade 100644
--- a/host/lib/usrp/usrp2/usrp2_impl.cpp
+++ b/host/lib/usrp/usrp2/usrp2_impl.cpp
@@ -35,6 +35,7 @@
#include <boost/assign/list_of.hpp>
#include <boost/asio/ip/address_v4.hpp>
#include <boost/asio.hpp> //used for htonl and ntohl
+#include <boost/thread.hpp>
using namespace uhd;
using namespace uhd::usrp;
@@ -761,7 +762,13 @@ usrp2_impl::usrp2_impl(const device_addr_t &_device_addr){
_tree->access<std::string>(root / "time_source/value").set("gpsdo");
_tree->access<std::string>(root / "clock_source/value").set("gpsdo");
UHD_MSG(status) << "Initializing time to the internal GPSDO" << std::endl;
- _mbc[mb].time64->set_time_next_pps(time_spec_t(time_t(_mbc[mb].gps->get_sensor("gps_time").to_int()+1)));
+ const time_t tp = time_t(_mbc[mb].gps->get_sensor("gps_time").to_int()+1);
+ _tree->access<time_spec_t>(root / "time" / "pps").set(time_spec_t(tp));
+
+ //wait for next PPS edge (timeout after 1 second)
+ time_spec_t pps_time = _tree->access<time_spec_t>(root / "time" / "pps").get();
+ for (size_t i = 0; i < 10 && _tree->access<time_spec_t>(root / "time" / "pps").get() == pps_time; i++)
+ boost::this_thread::sleep(boost::posix_time::milliseconds(100));
}
}
diff --git a/host/lib/usrp/x300/x300_impl.cpp b/host/lib/usrp/x300/x300_impl.cpp
index bb59763ee..365828679 100644
--- a/host/lib/usrp/x300/x300_impl.cpp
+++ b/host/lib/usrp/x300/x300_impl.cpp
@@ -832,8 +832,10 @@ void x300_impl::setup_mb(const size_t mb_i, const uhd::device_addr_t &dev_addr)
UHD_MSG(status) << "Initializing time to the GPSDO time" << std::endl;
const time_t tp = time_t(mb.gps->get_sensor("gps_time").to_int()+1);
_tree->access<time_spec_t>(mb_path / "time" / "pps").set(time_spec_t(tp));
- //wait for time to be set (timeout after 1 second)
- for (int i = 0; i < 10 && tp != (_tree->access<time_spec_t>(mb_path / "time" / "pps").get()).get_full_secs(); i++)
+
+ //wait for next PPS edge (timeout after 1 second)
+ time_spec_t pps_time = _tree->access<time_spec_t>(mb_path / "time" / "pps").get();
+ for (size_t i = 0; i < 10 && _tree->access<time_spec_t>(mb_path / "time" / "pps").get() == pps_time; i++)
boost::this_thread::sleep(boost::posix_time::milliseconds(100));
} else {
_tree->access<std::string>(mb_path / "clock_source" / "value").set("internal");
@@ -1079,9 +1081,13 @@ void x300_impl::setup_radio(const size_t mb_i, const std::string &slot_name)
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));
+ }
const fs_path db_rx_fe_path = db_path / "rx_frontends";
- BOOST_FOREACH(const std::string &name, _tree->list(db_rx_fe_path))
- {
+ 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));
}
@@ -1092,6 +1098,11 @@ void x300_impl::set_rx_fe_corrections(const uhd::fs_path &mb_path, const std::st
apply_rx_fe_corrections(this->get_tree()->subtree(mb_path), fe_name, lo_freq);
}
+void x300_impl::set_tx_fe_corrections(const uhd::fs_path &mb_path, const std::string &fe_name, const double lo_freq)
+{
+ apply_tx_fe_corrections(this->get_tree()->subtree(mb_path), fe_name, lo_freq);
+}
+
boost::uint32_t get_pcie_dma_channel(boost::uint8_t destination, boost::uint8_t prefix)
{
static const boost::uint32_t RADIO_GRP_SIZE = 3;
@@ -1108,8 +1119,7 @@ x300_impl::both_xports_t x300_impl::make_transport(
const boost::uint8_t& destination,
const boost::uint8_t& prefix,
const uhd::device_addr_t& args,
- boost::uint32_t& sid
-)
+ boost::uint32_t& sid)
{
mboard_members_t &mb = _mb[mb_index];
both_xports_t xports;
@@ -1206,10 +1216,10 @@ x300_impl::both_xports_t x300_impl::make_transport(
<< std::endl;
}
- size_t system_max_send_frame_size = (size_t) _max_frame_sizes.send_frame_size;
- size_t system_max_recv_frame_size = (size_t) _max_frame_sizes.recv_frame_size;
+ size_t system_max_send_frame_size = (size_t) _max_frame_sizes.send_frame_size;
+ size_t system_max_recv_frame_size = (size_t) _max_frame_sizes.recv_frame_size;
- // Make sure frame sizes do not exceed the max available value supported by UHD
+ // Make sure frame sizes do not exceed the max available value supported by UHD
default_buff_args.send_frame_size =
(prefix == X300_RADIO_DEST_PREFIX_TX)
? std::min(system_max_send_frame_size, X300_10GE_DATA_FRAME_MAX_SIZE)
diff --git a/host/lib/usrp/x300/x300_impl.hpp b/host/lib/usrp/x300/x300_impl.hpp
index 27f20fbd9..578e96383 100644
--- a/host/lib/usrp/x300/x300_impl.hpp
+++ b/host/lib/usrp/x300/x300_impl.hpp
@@ -211,7 +211,7 @@ private:
//perifs in each radio
radio_perifs_t radio_perifs[2]; //!< This is hardcoded s.t. radio_perifs[0] points to slot A and [1] to B
uhd::usrp::dboard_eeprom_t db_eeproms[8];
- //! Return the index of a radio component, given a slot name. This means DSPs, radio_perifs
+ //! Return the index of a radio component, given a slot name. This means DSPs, radio_perifs
size_t get_radio_index(const std::string &slot_name) {
UHD_ASSERT_THROW(slot_name == "A" or slot_name == "B");
return slot_name == "A" ? 0 : 1;
@@ -321,6 +321,8 @@ private:
uhd::dict<std::string, uhd::usrp::dboard_iface::sptr> _dboard_ifaces;
void set_rx_fe_corrections(const uhd::fs_path &mb_path, const std::string &fe_name, const double lo_freq);
+ void set_tx_fe_corrections(const uhd::fs_path &mb_path, const std::string &fe_name, const double lo_freq);
+
/*! Update the IQ MUX settings for the radio peripheral according to given subdev spec.
*