From fedad06362e22f8a171bfe8ae0b747492d22de1d Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Wed, 29 Feb 2012 09:30:03 -0800 Subject: 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 --- host/lib/usrp/usrp2/usrp2_iface.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'host/lib/usrp/usrp2') 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(U2_FW_REG_LOCK_TIME, 0xfffffff0); //unlock + this->get_reg(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(U2_FW_REG_LOCK_TIME); boost::uint32_t lock_gpid = this->get_reg(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 } /*********************************************************************** -- cgit v1.2.3