summaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/usrp2
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2011-06-25 20:22:12 -0700
committerJosh Blum <josh@joshknows.com>2011-06-25 20:22:12 -0700
commitb8d0dc0918c90c03b5e69593c8f79b5457aa5d7a (patch)
treea5003aa4e1e44b619b41e0b819700b09fc65cee5 /host/lib/usrp/usrp2
parent58679377fba07be56548874ed117a76eae79e846 (diff)
parent25d6e39c6af61acde0616cf50178d40741c4eace (diff)
downloaduhd-b8d0dc0918c90c03b5e69593c8f79b5457aa5d7a.tar.gz
uhd-b8d0dc0918c90c03b5e69593c8f79b5457aa5d7a.tar.bz2
uhd-b8d0dc0918c90c03b5e69593c8f79b5457aa5d7a.zip
Merge branch 'master' into next
Diffstat (limited to 'host/lib/usrp/usrp2')
-rw-r--r--host/lib/usrp/usrp2/mboard_impl.cpp24
-rw-r--r--host/lib/usrp/usrp2/usrp2_iface.cpp12
-rw-r--r--host/lib/usrp/usrp2/usrp2_impl.cpp4
3 files changed, 28 insertions, 12 deletions
diff --git a/host/lib/usrp/usrp2/mboard_impl.cpp b/host/lib/usrp/usrp2/mboard_impl.cpp
index 197296cf0..5583a4335 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();
diff --git a/host/lib/usrp/usrp2/usrp2_iface.cpp b/host/lib/usrp/usrp2/usrp2_iface.cpp
index ec1a2e94c..6ba364b28 100644
--- a/host/lib/usrp/usrp2/usrp2_iface.cpp
+++ b/host/lib/usrp/usrp2/usrp2_iface.cpp
@@ -179,7 +179,7 @@ public:
template <class T, usrp2_reg_action_t action>
T get_reg(boost::uint32_t addr, T data = 0){
//setup the out data
- usrp2_ctrl_data_t out_data;
+ usrp2_ctrl_data_t out_data = usrp2_ctrl_data_t();
out_data.id = htonl(USRP2_CTRL_ID_GET_THIS_REGISTER_FOR_ME_BRO);
out_data.data.reg_args.addr = htonl(addr);
out_data.data.reg_args.data = htonl(boost::uint32_t(data));
@@ -207,7 +207,7 @@ public:
;
//setup the out data
- usrp2_ctrl_data_t out_data;
+ usrp2_ctrl_data_t out_data = usrp2_ctrl_data_t();
out_data.id = htonl(USRP2_CTRL_ID_TRANSACT_ME_SOME_SPI_BRO);
out_data.data.spi_args.dev = htonl(which_slave);
out_data.data.spi_args.miso_edge = spi_edge_to_otw[config.miso_edge];
@@ -228,7 +228,7 @@ public:
**********************************************************************/
void write_i2c(boost::uint8_t addr, const byte_vector_t &buf){
//setup the out data
- usrp2_ctrl_data_t out_data;
+ usrp2_ctrl_data_t out_data = usrp2_ctrl_data_t();
out_data.id = htonl(USRP2_CTRL_ID_WRITE_THESE_I2C_VALUES_BRO);
out_data.data.i2c_args.addr = addr;
out_data.data.i2c_args.bytes = buf.size();
@@ -246,7 +246,7 @@ public:
byte_vector_t read_i2c(boost::uint8_t addr, size_t num_bytes){
//setup the out data
- usrp2_ctrl_data_t out_data;
+ usrp2_ctrl_data_t out_data = usrp2_ctrl_data_t();
out_data.id = htonl(USRP2_CTRL_ID_DO_AN_I2C_READ_FOR_ME_BRO);
out_data.data.i2c_args.addr = addr;
out_data.data.i2c_args.bytes = num_bytes;
@@ -276,7 +276,7 @@ public:
BOOST_FOREACH(std::string item, queue) {
//setup the out data
- usrp2_ctrl_data_t out_data;
+ usrp2_ctrl_data_t out_data = usrp2_ctrl_data_t();
out_data.id = htonl(USRP2_CTRL_ID_HEY_WRITE_THIS_UART_FOR_ME_BRO);
out_data.data.uart_args.dev = dev;
out_data.data.uart_args.bytes = item.size();
@@ -298,7 +298,7 @@ public:
std::string result;
while(readlen == 20) { //while we keep receiving full packets
//setup the out data
- usrp2_ctrl_data_t out_data;
+ usrp2_ctrl_data_t out_data = usrp2_ctrl_data_t();
out_data.id = htonl(USRP2_CTRL_ID_SO_LIKE_CAN_YOU_READ_THIS_UART_BRO);
out_data.data.uart_args.dev = dev;
out_data.data.uart_args.bytes = 20;
diff --git a/host/lib/usrp/usrp2/usrp2_impl.cpp b/host/lib/usrp/usrp2/usrp2_impl.cpp
index 9947e71e7..aa584ac8b 100644
--- a/host/lib/usrp/usrp2/usrp2_impl.cpp
+++ b/host/lib/usrp/usrp2/usrp2_impl.cpp
@@ -93,7 +93,7 @@ static device_addrs_t usrp2_find(const device_addr_t &hint_){
);
//send a hello control packet
- usrp2_ctrl_data_t ctrl_data_out;
+ usrp2_ctrl_data_t ctrl_data_out = usrp2_ctrl_data_t();
ctrl_data_out.proto_ver = uhd::htonx<boost::uint32_t>(USRP2_FW_COMPAT_NUM);
ctrl_data_out.id = uhd::htonx<boost::uint32_t>(USRP2_CTRL_ID_WAZZUP_BRO);
udp_transport->send(boost::asio::buffer(&ctrl_data_out, sizeof(ctrl_data_out)));
@@ -249,7 +249,7 @@ usrp2_impl::usrp2_impl(const device_addr_t &_device_addr){
//extract the user's requested MTU size or default
mtu_result_t user_mtu;
user_mtu.recv_mtu = size_t(device_addr.cast<double>("recv_frame_size", udp_simple::mtu));
- user_mtu.send_mtu = size_t(device_addr.cast<double>("recv_frame_size", udp_simple::mtu));
+ user_mtu.send_mtu = size_t(device_addr.cast<double>("send_frame_size", udp_simple::mtu));
try{
//calculate the minimum send and recv mtu of all devices