diff options
author | Josh Blum <josh@joshknows.com> | 2010-04-01 15:16:29 +0000 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2010-04-01 15:16:29 +0000 |
commit | 8fd3ce07369a7962dc8eb5ace2007a80ad7dd907 (patch) | |
tree | bb4f5c61f8a7809af1c58d5513dc6c3e78c7a5b2 /host/lib/usrp/usrp2/mboard_impl.cpp | |
parent | 58d71729716a688af36ba4a413e6f6ee4729eefc (diff) | |
parent | f1f4865119605c66ffece113a621308d82512d23 (diff) | |
download | uhd-8fd3ce07369a7962dc8eb5ace2007a80ad7dd907.tar.gz uhd-8fd3ce07369a7962dc8eb5ace2007a80ad7dd907.tar.bz2 uhd-8fd3ce07369a7962dc8eb5ace2007a80ad7dd907.zip |
Merge branch 'master' of git@ettus.sourcerepo.com:ettus/uhd into usrp_e
Conflicts:
host/include/uhd/usrp/CMakeLists.txt
Diffstat (limited to 'host/lib/usrp/usrp2/mboard_impl.cpp')
-rw-r--r-- | host/lib/usrp/usrp2/mboard_impl.cpp | 57 |
1 files changed, 21 insertions, 36 deletions
diff --git a/host/lib/usrp/usrp2/mboard_impl.cpp b/host/lib/usrp/usrp2/mboard_impl.cpp index 35dfd6287..7594c85fa 100644 --- a/host/lib/usrp/usrp2/mboard_impl.cpp +++ b/host/lib/usrp/usrp2/mboard_impl.cpp @@ -15,11 +15,15 @@ // along with this program. If not, see <http://www.gnu.org/licenses/>. // +#include "usrp2_impl.hpp" +#include "usrp2_regs.hpp" +#include <uhd/usrp/mboard_props.hpp> #include <uhd/utils/assert.hpp> #include <uhd/types/mac_addr.hpp> -#include "usrp2_impl.hpp" +#include <uhd/types/dict.hpp> using namespace uhd; +using namespace uhd::usrp; /*********************************************************************** * Helper Methods @@ -46,55 +50,36 @@ void usrp2_impl::init_clock_config(void){ } void usrp2_impl::update_clock_config(void){ - //setup the out data - usrp2_ctrl_data_t out_data; - out_data.id = htonl(USRP2_CTRL_ID_HERES_A_NEW_CLOCK_CONFIG_BRO); - - //translate ref source enums - switch(_clock_config.ref_source){ - case clock_config_t::REF_INT: - out_data.data.clock_config.ref_source = USRP2_REF_SOURCE_INT; break; - case clock_config_t::REF_SMA: - out_data.data.clock_config.ref_source = USRP2_REF_SOURCE_SMA; break; - case clock_config_t::REF_MIMO: - out_data.data.clock_config.ref_source = USRP2_REF_SOURCE_MIMO; break; - default: throw std::runtime_error("usrp2: unhandled clock configuration ref source"); - } + boost::uint32_t pps_flags = 0; //translate pps source enums switch(_clock_config.pps_source){ - case clock_config_t::PPS_SMA: - out_data.data.clock_config.pps_source = USRP2_PPS_SOURCE_SMA; break; - case clock_config_t::PPS_MIMO: - out_data.data.clock_config.pps_source = USRP2_PPS_SOURCE_MIMO; break; + case clock_config_t::PPS_SMA: pps_flags |= FRF_TIME64_PPS_SMA; break; + case clock_config_t::PPS_MIMO: pps_flags |= FRF_TIME64_PPS_MIMO; break; default: throw std::runtime_error("usrp2: unhandled clock configuration pps source"); } //translate pps polarity enums switch(_clock_config.pps_polarity){ - case clock_config_t::PPS_POS: - out_data.data.clock_config.pps_source = USRP2_PPS_POLARITY_POS; break; - case clock_config_t::PPS_NEG: - out_data.data.clock_config.pps_source = USRP2_PPS_POLARITY_NEG; break; + case clock_config_t::PPS_POS: pps_flags |= FRF_TIME64_PPS_POSEDGE; break; + case clock_config_t::PPS_NEG: pps_flags |= FRF_TIME64_PPS_NEGEDGE; break; default: throw std::runtime_error("usrp2: unhandled clock configuration pps polarity"); } - //send and recv - usrp2_ctrl_data_t in_data = ctrl_send_and_recv(out_data); - ASSERT_THROW(htonl(in_data.id) == USRP2_CTRL_ID_GOT_THE_NEW_CLOCK_CONFIG_DUDE); + //set the pps flags + this->poke(FR_TIME64_FLAGS, pps_flags); + + //TODO clock source ref 10mhz (spi ad9510) } void usrp2_impl::set_time_spec(const time_spec_t &time_spec, bool now){ - //setup the out data - usrp2_ctrl_data_t out_data; - out_data.id = htonl(USRP2_CTRL_ID_GOT_A_NEW_TIME_FOR_YOU_BRO); - out_data.data.time_args.secs = htonl(time_spec.secs); - out_data.data.time_args.ticks = htonl(time_spec.ticks); - out_data.data.time_args.now = (now)? 1 : 0; - - //send and recv - usrp2_ctrl_data_t in_data = ctrl_send_and_recv(out_data); - ASSERT_THROW(htonl(in_data.id) == USRP2_CTRL_ID_SWEET_I_GOT_THAT_TIME_DUDE); + //set ticks and seconds + this->poke(FR_TIME64_SECS, time_spec.secs); + this->poke(FR_TIME64_TICKS, time_spec.ticks); + + //set the register to latch it all in + boost::uint32_t imm_flags = (now)? FRF_TIME64_LATCH_NOW : FRF_TIME64_LATCH_NEXT_PPS; + this->poke(FR_TIME64_IMM, imm_flags); } /*********************************************************************** |