aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2012-02-29 09:30:03 -0800
committerJosh Blum <josh@joshknows.com>2012-02-29 09:31:31 -0800
commitfedad06362e22f8a171bfe8ae0b747492d22de1d (patch)
tree0fed2afb7967b08ae19492fc4103abb4198afd1c
parent84567c2033fcd6aa5e297ab76ea3684baef0c665 (diff)
downloaduhd-fedad06362e22f8a171bfe8ae0b747492d22de1d.tar.gz
uhd-fedad06362e22f8a171bfe8ae0b747492d22de1d.tar.bz2
uhd-fedad06362e22f8a171bfe8ae0b747492d22de1d.zip
usrp2: device locking tweaks
1) use bottom bit for force lock condition, that way we never check the time after proper shutdown 2) dont allow lock condition under fpga compat mismatch
-rw-r--r--host/lib/usrp/usrp2/usrp2_iface.cpp15
1 files changed, 6 insertions, 9 deletions
diff --git a/host/lib/usrp/usrp2/usrp2_iface.cpp b/host/lib/usrp/usrp2/usrp2_iface.cpp
index 170447b6e..123910166 100644
--- a/host/lib/usrp/usrp2/usrp2_iface.cpp
+++ b/host/lib/usrp/usrp2/usrp2_iface.cpp
@@ -106,13 +106,6 @@ public:
_protocol_compat = ntohl(ctrl_data.proto_ver);
mb_eeprom = mboard_eeprom_t(*this, mboard_eeprom_t::MAP_N100);
-
- //----------------------- special temporary warning ------------
- if (mb_eeprom["gpsdo"] == "internal" and _protocol_compat < USRP2_FW_COMPAT_NUM){
- UHD_MSG(warning) << "You must upgrade your USRP's firmware to use the GPSDO" << std::endl;
- }
- //--------------------------------------------------------------
-
}
~usrp2_iface_impl(void){UHD_SAFE_CALL(
@@ -130,11 +123,14 @@ public:
}
else{
_lock_task.reset(); //shutdown the task
- this->get_reg<boost::uint32_t, USRP2_REG_ACTION_FW_POKE32>(U2_FW_REG_LOCK_TIME, 0xfffffff0); //unlock
+ this->get_reg<boost::uint32_t, USRP2_REG_ACTION_FW_POKE32>(U2_FW_REG_LOCK_TIME, 0); //unlock
}
}
bool is_device_locked(void){
+ //never assume lock with fpga image mismatch
+ if ((this->peek32(U2_REG_COMPAT_NUM_RB) >> 16) != USRP2_FPGA_COMPAT_NUM) return false;
+
boost::uint32_t lock_time = this->get_reg<boost::uint32_t, USRP2_REG_ACTION_FW_PEEK32>(U2_FW_REG_LOCK_TIME);
boost::uint32_t lock_gpid = this->get_reg<boost::uint32_t, USRP2_REG_ACTION_FW_PEEK32>(U2_FW_REG_LOCK_GPID);
@@ -142,6 +138,7 @@ public:
const boost::uint32_t lock_timeout_time = boost::uint32_t(3*100e6);
//if the difference is larger, assume not locked anymore
+ if ((lock_time & 1) == 0) return false; //bit0 says unlocked
const boost::uint32_t time_diff = this->get_curr_time() - lock_time;
if (time_diff >= lock_timeout_time) return false;
@@ -157,7 +154,7 @@ public:
}
boost::uint32_t get_curr_time(void){
- return this->peek32(U2_REG_TIME64_LO_RB_IMM);
+ return this->peek32(U2_REG_TIME64_LO_RB_IMM) | 1; //bit 1 says locked
}
/***********************************************************************