From 5b4cbfe4616492d96ad1b48578cf2d94e1216bf4 Mon Sep 17 00:00:00 2001 From: Nick Foster Date: Tue, 12 Oct 2010 16:26:19 -0700 Subject: USRP2P: mboard rev works through props interface. Added usrp2_burn_mb_rev.cpp to utils. It is not installed to the utils install dir. Not all happy with the mboard_rev setup -- is_usrp2p() is too specific for a generalized mboard_rev concept. I'm not sure where else to put it so for now it stays. --- host/lib/usrp/usrp2/mboard_impl.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'host/lib/usrp/usrp2/mboard_impl.cpp') diff --git a/host/lib/usrp/usrp2/mboard_impl.cpp b/host/lib/usrp/usrp2/mboard_impl.cpp index 6ee6d03a1..3a7048cdd 100644 --- a/host/lib/usrp/usrp2/mboard_impl.cpp +++ b/host/lib/usrp/usrp2/mboard_impl.cpp @@ -51,7 +51,7 @@ usrp2_mboard_impl::usrp2_mboard_impl( //extract the mboard rev numbers byte_vector_t rev_bytes = _iface->read_eeprom(USRP2_I2C_ADDR_MBOARD, USRP2_EE_MBOARD_REV, 2); - _iface->set_hw_rev(mboard_rev_t::from_uint16(rev_bytes.at(0) | (revbytes.at(1) << 8))); + _iface->set_hw_rev(mboard_rev_t::from_uint16(rev_bytes.at(0) | (rev_bytes.at(1) << 8))); //contruct the interfaces to mboard perifs _clock_ctrl = usrp2_clock_ctrl::make(_iface); @@ -158,7 +158,7 @@ void usrp2_mboard_impl::update_clock_config(void){ _iface->poke32(_iface->regs.time64_flags, pps_flags); //clock source ref 10mhz - if(_iface->get_hw_rev() >= USRP2P_FIRST_HW_REV) { + if(_iface->get_hw_rev().is_usrp2p()) { switch(_clock_config.ref_source){ case clock_config_t::REF_INT : _iface->poke32(_iface->regs.misc_ctrl_clock, 0x12); break; case clock_config_t::REF_SMA : _iface->poke32(_iface->regs.misc_ctrl_clock, 0x1C); break; @@ -176,7 +176,7 @@ void usrp2_mboard_impl::update_clock_config(void){ //clock source ref 10mhz bool use_external = (_clock_config.ref_source != clock_config_t::REF_INT) - || (_iface->get_hw_rev() >= USRP2P_FIRST_HW_REV); //USRP2P has an internal 10MHz TCXO + || (_iface->get_hw_rev().is_usrp2p()); //USRP2P has an internal 10MHz TCXO _clock_ctrl->enable_external_ref(use_external); } @@ -224,10 +224,11 @@ void usrp2_mboard_impl::get(const wax::obj &key_, wax::obj &val){ } if (key.as() == "hw-rev"){ - //extract the mboard rev numbers + //extract the mboard rev number val = _iface->get_hw_rev().to_string(); return; } + } //handle the get request conditioned on the key switch(key.as()){ @@ -327,12 +328,13 @@ void usrp2_mboard_impl::set(const wax::obj &key, const wax::obj &val){ if (key.as() == "hw-rev"){ mboard_rev_t rev = mboard_rev_t::from_string(val.as()); - byte_vector_t revbytes(2); - revbytes(1) = rev.to_uint16() >> 8; - revbytes(0) = rev.to_uint16() & 0xff; - _iface->write_eeprom(USRP2_I2C_ADDR_MBOARD, USRP2_EE_MBOARD_REV, revbytes); + byte_vector_t rev_bytes(2); + rev_bytes[1] = rev.to_uint16() >> 8; + rev_bytes[0] = rev.to_uint16() & 0xff; + _iface->write_eeprom(USRP2_I2C_ADDR_MBOARD, USRP2_EE_MBOARD_REV, rev_bytes); _iface->set_hw_rev(rev); //so the iface knows what rev it is return; + } } //handle the set request conditioned on the key -- cgit v1.2.3