diff options
author | Thomas Tsou <ttsou@vt.edu> | 2010-08-18 11:06:57 -0700 |
---|---|---|
committer | Thomas Tsou <ttsou@vt.edu> | 2010-08-18 19:22:06 -0700 |
commit | 024377afa9628c282a5f7584ca5cc8991dd1296f (patch) | |
tree | eab06d8b6e6a5c059090b19982867af431a5597f /host/lib/usrp/usrp1/dsp_impl.cpp | |
parent | e4c12fbfb2a928574b33260f04f9622e3c876700 (diff) | |
download | uhd-024377afa9628c282a5f7584ca5cc8991dd1296f.tar.gz uhd-024377afa9628c282a5f7584ca5cc8991dd1296f.tar.bz2 uhd-024377afa9628c282a5f7584ca5cc8991dd1296f.zip |
usrp1: Refactor mboard tuning code
Diffstat (limited to 'host/lib/usrp/usrp1/dsp_impl.cpp')
-rw-r--r-- | host/lib/usrp/usrp1/dsp_impl.cpp | 26 |
1 files changed, 4 insertions, 22 deletions
diff --git a/host/lib/usrp/usrp1/dsp_impl.cpp b/host/lib/usrp/usrp1/dsp_impl.cpp index 0db3cb473..ce0c12e4b 100644 --- a/host/lib/usrp/usrp1/dsp_impl.cpp +++ b/host/lib/usrp/usrp1/dsp_impl.cpp @@ -73,31 +73,13 @@ void usrp1_impl::rx_dsp_get(const wax::obj &key, wax::obj &val) /*********************************************************************** * RX DDC Set **********************************************************************/ -unsigned int compute_freq_word(double master, double target) -{ - static const int NBITS = 14; - int v = (int) rint (target / master * pow(2.0, 32.0)); - - if (0) - v = (v >> (32 - NBITS)) << (32 - NBITS); // keep only top NBITS - - double actual_freq = v * master / pow(2.0, 32.0); - - if (0) std::cerr << boost::format( - "compute_freq_control_word_fpga: target = %g actual = %g delta = %g\n" - ) % target % actual_freq % (actual_freq - target); - - return (unsigned int) v; -} - void usrp1_impl::rx_dsp_set(const wax::obj &key, const wax::obj &val) { switch(key.as<dsp_prop_t>()) { case DSP_PROP_FREQ_SHIFT: { double new_freq = val.as<double>(); - boost::uint32_t hw_freq_word = compute_freq_word( - _clock_ctrl->get_master_clock_freq(), new_freq); - _iface->poke32(FR_RX_FREQ_0, hw_freq_word); + _iface->poke32(FR_RX_FREQ_0, + -dsp_type1::calc_cordic_word_and_update(new_freq, _clock_ctrl->get_master_clock_freq())); _tx_dsp_freq = new_freq; return; } @@ -173,15 +155,15 @@ void usrp1_impl::tx_dsp_set(const wax::obj &key, const wax::obj &val) { switch(key.as<dsp_prop_t>()) { + // TODO: Set both codec frequencies until we have duality properties case DSP_PROP_FREQ_SHIFT: { double new_freq = val.as<double>(); _codec_ctrls[DBOARD_SLOT_A]->set_duc_freq(new_freq); + _codec_ctrls[DBOARD_SLOT_B]->set_duc_freq(new_freq); _tx_dsp_freq = new_freq; return; } - //TODO freq prop secondary: DBOARD_SLOT_B codec... - case DSP_PROP_HOST_RATE: { unsigned int rate = _clock_ctrl->get_master_clock_freq() * 2 / val.as<double>(); |