diff options
author | Josh Blum <josh@joshknows.com> | 2010-12-10 14:04:07 -0800 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2010-12-11 18:43:10 -0800 |
commit | 9e75fadc0476b93ea73a7cab905d0fcbbc74d2df (patch) | |
tree | f648472d218eb00caf9e3605622d8a97db1dda2f /host/lib/usrp | |
parent | 1bf0619c9ed076bfc85856138309e2fa9be8e371 (diff) | |
download | uhd-9e75fadc0476b93ea73a7cab905d0fcbbc74d2df.tar.gz uhd-9e75fadc0476b93ea73a7cab905d0fcbbc74d2df.tar.bz2 uhd-9e75fadc0476b93ea73a7cab905d0fcbbc74d2df.zip |
usrp2: set time over serdes when slave, added constants to top of cpp file
Diffstat (limited to 'host/lib/usrp')
-rw-r--r-- | host/lib/usrp/usrp2/mboard_impl.cpp | 19 | ||||
-rw-r--r-- | host/lib/usrp/usrp2/usrp2_regs.cpp | 1 | ||||
-rw-r--r-- | host/lib/usrp/usrp2/usrp2_regs.hpp | 1 |
3 files changed, 15 insertions, 6 deletions
diff --git a/host/lib/usrp/usrp2/mboard_impl.cpp b/host/lib/usrp/usrp2/mboard_impl.cpp index 29867cf9d..ac447d209 100644 --- a/host/lib/usrp/usrp2/mboard_impl.cpp +++ b/host/lib/usrp/usrp2/mboard_impl.cpp @@ -27,6 +27,10 @@ #include <iostream> #include <boost/date_time/posix_time/posix_time.hpp> +static const double mimo_clock_delay_usrp2_rev4 = 4.18e-9; +static const double mimo_clock_delay_usrp_n2xx = 0; //TODO +static const int mimo_clock_sync_delay_cycles = 134; + using namespace uhd; using namespace uhd::usrp; using namespace boost::posix_time; @@ -196,27 +200,30 @@ void usrp2_mboard_impl::update_clock_config(void){ // - Masters always drive the clock over serdes. // - Slaves always lock to this serdes clock. // - Slaves lock their time over the serdes. - const bool master_mode = bool(_iface->peek32(_iface->regs.status) & (1 << 8)); - _clock_ctrl->enable_mimo_clock_out(master_mode); - if (master_mode){ + if (_iface->peek32(_iface->regs.status) & (1 << 8)){ + _clock_ctrl->enable_mimo_clock_out(true); switch(_iface->get_rev()){ case usrp2_iface::USRP_N200: case usrp2_iface::USRP_N210: - _clock_ctrl->set_mimo_clock_delay(0/*TODO*/); + _clock_ctrl->set_mimo_clock_delay(mimo_clock_delay_usrp_n2xx); break; case usrp2_iface::USRP2_REV4: - _clock_ctrl->set_mimo_clock_delay(3.08e-9); + _clock_ctrl->set_mimo_clock_delay(mimo_clock_delay_usrp2_rev4); break; default: break; //not handled } + _iface->poke32(_iface->regs.time64_mimo_sync, 0); } else{ _iface->poke32(_iface->regs.misc_ctrl_clock, 0x15); _clock_ctrl->enable_external_ref(true); + _clock_ctrl->enable_mimo_clock_out(false); + _iface->poke32(_iface->regs.time64_mimo_sync, + (1 << 8) | (mimo_clock_sync_delay_cycles & 0xff) + ); } - //TODO slaves lock time over the serdes... } diff --git a/host/lib/usrp/usrp2/usrp2_regs.cpp b/host/lib/usrp/usrp2/usrp2_regs.cpp index 0590082f6..82ad30f08 100644 --- a/host/lib/usrp/usrp2/usrp2_regs.cpp +++ b/host/lib/usrp/usrp2/usrp2_regs.cpp @@ -57,6 +57,7 @@ usrp2_regs_t usrp2_get_regs(bool use_n2xx_map) { x.time64_flags = sr_addr(misc_output_base, x.sr_time64 + 2); x.time64_imm = sr_addr(misc_output_base, x.sr_time64 + 3); x.time64_tps = sr_addr(misc_output_base, x.sr_time64 + 4); + x.time64_mimo_sync = sr_addr(misc_output_base, x.sr_time64 + 5); x.status = bp_base + 4*8; x.time64_secs_rb = bp_base + 4*10; x.time64_ticks_rb = bp_base + 4*11; diff --git a/host/lib/usrp/usrp2/usrp2_regs.hpp b/host/lib/usrp/usrp2/usrp2_regs.hpp index 40c3635fb..0311ac625 100644 --- a/host/lib/usrp/usrp2/usrp2_regs.hpp +++ b/host/lib/usrp/usrp2/usrp2_regs.hpp @@ -57,6 +57,7 @@ typedef struct { int time64_flags; // flags -- see chart below int time64_imm; // set immediate (0=latch on next pps, 1=latch immediate, default=0) int time64_tps; // ticks per second rollover count + int time64_mimo_sync; int status; int time64_secs_rb; int time64_ticks_rb; |