From 43e5480dee9f6068ffe84bf1b86526189043ee87 Mon Sep 17 00:00:00 2001 From: Thomas Tsou Date: Mon, 16 Aug 2010 17:03:06 -0700 Subject: usrp1: Remove hard coded clock values Get clock values from clock control, where the master setting lives. --- host/lib/usrp/usrp1/dsp_impl.cpp | 10 ++++++---- host/lib/usrp/usrp1/usrp1_impl.hpp | 2 -- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/host/lib/usrp/usrp1/dsp_impl.cpp b/host/lib/usrp/usrp1/dsp_impl.cpp index 260c01ea8..0db3cb473 100644 --- a/host/lib/usrp/usrp1/dsp_impl.cpp +++ b/host/lib/usrp/usrp1/dsp_impl.cpp @@ -36,7 +36,7 @@ void usrp1_impl::rx_dsp_init(void) boost::bind(&usrp1_impl::rx_dsp_get, this, _1, _2), boost::bind(&usrp1_impl::rx_dsp_set, this, _1, _2)); - rx_dsp_set(DSP_PROP_HOST_RATE, double(64e6/10)); //FIXME magic number + rx_dsp_set(DSP_PROP_HOST_RATE, _clock_ctrl->get_master_clock_freq() / 16); } /*********************************************************************** @@ -95,7 +95,9 @@ void usrp1_impl::rx_dsp_set(const wax::obj &key, const wax::obj &val) switch(key.as()) { case DSP_PROP_FREQ_SHIFT: { double new_freq = val.as(); - _iface->poke32(FR_RX_FREQ_0, compute_freq_word(64e6, new_freq)); //FIXME magic rate + 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); _tx_dsp_freq = new_freq; return; } @@ -130,7 +132,7 @@ void usrp1_impl::tx_dsp_init(void) boost::bind(&usrp1_impl::tx_dsp_set, this, _1, _2)); //initial config and update - tx_dsp_set(DSP_PROP_HOST_RATE, double(64e6/10)); //FIXME magic number + tx_dsp_set(DSP_PROP_HOST_RATE, _clock_ctrl->get_master_clock_freq() * 2 / 16); } /*********************************************************************** @@ -152,7 +154,7 @@ void usrp1_impl::tx_dsp_get(const wax::obj &key, wax::obj &val) return; case DSP_PROP_CODEC_RATE: - val = MASTER_CLOCK_RATE; + val = _clock_ctrl->get_master_clock_freq() * 2; return; case DSP_PROP_HOST_RATE: diff --git a/host/lib/usrp/usrp1/usrp1_impl.hpp b/host/lib/usrp/usrp1/usrp1_impl.hpp index 5166f989f..f57f9a09a 100644 --- a/host/lib/usrp/usrp1/usrp1_impl.hpp +++ b/host/lib/usrp/usrp1/usrp1_impl.hpp @@ -33,8 +33,6 @@ #ifndef INCLUDED_USRP1_IMPL_HPP #define INCLUDED_USRP1_IMPL_HPP -static const double MASTER_CLOCK_RATE = 64e6; //TODO get from clock control - /*! * Simple wax obj proxy class: * Provides a wax obj interface for a set and a get function. -- cgit v1.2.3