diff options
| author | Josh Blum <josh@joshknows.com> | 2010-05-10 16:37:12 -0700 | 
|---|---|---|
| committer | Josh Blum <josh@joshknows.com> | 2010-05-10 16:37:12 -0700 | 
| commit | 7c7b0d0a0dc8dd0cb4f0229fbc55978d6f2e253c (patch) | |
| tree | a5b27c2808a544c04c2963a1891896277c735e4a | |
| parent | bf7ef6aeb502839797894cac4d7518029a0d04c4 (diff) | |
| download | uhd-7c7b0d0a0dc8dd0cb4f0229fbc55978d6f2e253c.tar.gz uhd-7c7b0d0a0dc8dd0cb4f0229fbc55978d6f2e253c.tar.bz2 uhd-7c7b0d0a0dc8dd0cb4f0229fbc55978d6f2e253c.zip | |
Added a place for serdes control on the host.
Fix bug in codec control.
Comment out some clock control in fw code.
| -rw-r--r-- | firmware/microblaze/lib/clocks.c | 30 | ||||
| -rw-r--r-- | firmware/microblaze/lib/clocks.h | 10 | ||||
| -rw-r--r-- | host/lib/usrp/usrp2/CMakeLists.txt | 1 | ||||
| -rw-r--r-- | host/lib/usrp/usrp2/clock_ctrl.hpp | 6 | ||||
| -rw-r--r-- | host/lib/usrp/usrp2/codec_ctrl.cpp | 6 | ||||
| -rw-r--r-- | host/lib/usrp/usrp2/codec_ctrl.hpp | 6 | ||||
| -rw-r--r-- | host/lib/usrp/usrp2/mboard_impl.cpp | 4 | ||||
| -rw-r--r-- | host/lib/usrp/usrp2/serdes_ctrl.cpp | 46 | ||||
| -rw-r--r-- | host/lib/usrp/usrp2/serdes_ctrl.hpp | 40 | ||||
| -rw-r--r-- | host/lib/usrp/usrp2/usrp2_impl.cpp | 1 | ||||
| -rw-r--r-- | host/lib/usrp/usrp2/usrp2_impl.hpp | 4 | 
11 files changed, 120 insertions, 34 deletions
| diff --git a/firmware/microblaze/lib/clocks.c b/firmware/microblaze/lib/clocks.c index d9d4fcd3c..ccc4a7cc7 100644 --- a/firmware/microblaze/lib/clocks.c +++ b/firmware/microblaze/lib/clocks.c @@ -48,14 +48,14 @@ clocks_init(void)    clocks_mimo_config(MC_WE_DONT_LOCK);    // Set up other clocks -  clocks_enable_test_clk(false, 0); -  clocks_enable_tx_dboard(false, 0); -  clocks_enable_rx_dboard(false, 0); +  //clocks_enable_test_clk(false, 0); +  //clocks_enable_tx_dboard(false, 0); +  //clocks_enable_rx_dboard(false, 0);    clocks_enable_eth_phyclk(false, 0);    // Enable clock to ADCs and DACs -  clocks_enable_dac_clk(true, 1); -  clocks_enable_adc_clk(true, 1); +  //clocks_enable_dac_clk(true, 1); +  //clocks_enable_adc_clk(true, 1);  } @@ -168,11 +168,11 @@ clocks_enable_XXX_clk(bool enable, int divisor, int reg_en, int reg_div, int mod  }  // Clock 0 -void +/*void  clocks_enable_test_clk(bool enable, int divisor)  {    clocks_enable_XXX_clk(enable,divisor,0x3C,0x48,CLOCK_MODE_PECL); -} +}*/  // Clock 1  void @@ -211,29 +211,29 @@ clocks_enable_eth_phyclk(bool enable, int divisor)  }  // Clock 3 -void +/*void  clocks_enable_dac_clk(bool enable, int divisor)  {    clocks_enable_XXX_clk(enable,divisor,0x3F,0x4E,CLOCK_MODE_PECL); -} +}*/  // Clock 4 -void +/*void  clocks_enable_adc_clk(bool enable, int divisor)  {    clocks_enable_XXX_clk(enable,divisor,0x40,0x50,CLOCK_MODE_LVDS); -} +}*/  // Clock 6 -void +/*void  clocks_enable_tx_dboard(bool enable, int divisor)  {    clocks_enable_XXX_clk(enable,divisor,0x42,0x54,CLOCK_MODE_CMOS); -} +}*/  // Clock 7 -void +/*void  clocks_enable_rx_dboard(bool enable, int divisor)  {    clocks_enable_XXX_clk(enable,divisor,0x43,0x56,CLOCK_MODE_CMOS); -} +}*/ diff --git a/firmware/microblaze/lib/clocks.h b/firmware/microblaze/lib/clocks.h index 141fc61e0..43d5a05c2 100644 --- a/firmware/microblaze/lib/clocks.h +++ b/firmware/microblaze/lib/clocks.h @@ -53,7 +53,7 @@ bool clocks_lock_detect();  /*!   * \brief Enable or disable test clock (extra clock signal)   */ -void clocks_enable_test_clk(bool enable, int divisor); +//void clocks_enable_test_clk(bool enable, int divisor);  /*!   * \brief Enable or disable fpga clock.  Disabling would wedge and require a power cycle. @@ -73,23 +73,23 @@ void clocks_enable_eth_phyclk(bool enable, int divisor);  /*!   * \brief Enable or disable clock to DAC   */ -void clocks_enable_dac_clk(bool enable, int divisor); +//void clocks_enable_dac_clk(bool enable, int divisor);  /*!   * \brief Enable or disable clock to ADC   */ -void clocks_enable_adc_clk(bool enable, int divisor); +//void clocks_enable_adc_clk(bool enable, int divisor);  /*!   * \brief Enable or disable clock to Rx daughterboard   */ -void clocks_enable_rx_dboard(bool enable, int divisor); +//void clocks_enable_rx_dboard(bool enable, int divisor);  /*!   * \brief Enable or disable clock to Tx daughterboard   */ -void clocks_enable_tx_dboard(bool enable, int divisor); +//void clocks_enable_tx_dboard(bool enable, int divisor);  #endif /* INCLUDED_CLOCKS_H */ diff --git a/host/lib/usrp/usrp2/CMakeLists.txt b/host/lib/usrp/usrp2/CMakeLists.txt index 6c7881861..fee67dff9 100644 --- a/host/lib/usrp/usrp2/CMakeLists.txt +++ b/host/lib/usrp/usrp2/CMakeLists.txt @@ -25,6 +25,7 @@ LIBUHD_APPEND_SOURCES(      ${CMAKE_SOURCE_DIR}/lib/usrp/usrp2/dsp_impl.cpp      ${CMAKE_SOURCE_DIR}/lib/usrp/usrp2/io_impl.cpp      ${CMAKE_SOURCE_DIR}/lib/usrp/usrp2/mboard_impl.cpp +    ${CMAKE_SOURCE_DIR}/lib/usrp/usrp2/serdes_ctrl.cpp      ${CMAKE_SOURCE_DIR}/lib/usrp/usrp2/usrp2_iface.cpp      ${CMAKE_SOURCE_DIR}/lib/usrp/usrp2/usrp2_impl.cpp  ) diff --git a/host/lib/usrp/usrp2/clock_ctrl.hpp b/host/lib/usrp/usrp2/clock_ctrl.hpp index 3208008a9..706bf4246 100644 --- a/host/lib/usrp/usrp2/clock_ctrl.hpp +++ b/host/lib/usrp/usrp2/clock_ctrl.hpp @@ -15,8 +15,8 @@  // along with this program.  If not, see <http://www.gnu.org/licenses/>.  // -#ifndef INCLUDED_CLOCK_CONTROL_HPP -#define INCLUDED_CLOCK_CONTROL_HPP +#ifndef INCLUDED_CLOCK_CTRL_HPP +#define INCLUDED_CLOCK_CTRL_HPP  #include "usrp2_iface.hpp"  #include <boost/shared_ptr.hpp> @@ -57,4 +57,4 @@ public:  }; -#endif /* INCLUDED_CLOCK_CONTROL_HPP */ +#endif /* INCLUDED_CLOCK_CTRL_HPP */ diff --git a/host/lib/usrp/usrp2/codec_ctrl.cpp b/host/lib/usrp/usrp2/codec_ctrl.cpp index 452aa39b1..d1e16881b 100644 --- a/host/lib/usrp/usrp2/codec_ctrl.cpp +++ b/host/lib/usrp/usrp2/codec_ctrl.cpp @@ -53,7 +53,7 @@ public:          _ad9777_regs.qdac_offset_adjust_msb = 0;          //write all regs          for(boost::uint8_t addr = 0; addr <= 0xC; addr++){ -            send_ad9777_reg(addr); +            this->send_ad9777_reg(addr);          }          //power-up adc @@ -63,7 +63,7 @@ public:      ~codec_ctrl_impl(void){          //power-down dac          _ad9777_regs.power_down_mode = 1; -        send_ad9777_reg(0); +        this->send_ad9777_reg(0);          //power-down adc          _iface->poke32(FR_MISC_CTRL_ADC, FRF_MISC_CTRL_ADC_OFF); @@ -78,7 +78,7 @@ private:          if (codec_ctrl_debug) std::cout << "send_ad9777_reg: " << std::hex << reg << std::endl;          _iface->transact_spi(              SPI_SS_AD9777, spi_config_t::EDGE_RISE, -            reg, 6, false /*no rb*/ +            reg, 16, false /*no rb*/          );      }  }; diff --git a/host/lib/usrp/usrp2/codec_ctrl.hpp b/host/lib/usrp/usrp2/codec_ctrl.hpp index c34fb8159..0ee52f476 100644 --- a/host/lib/usrp/usrp2/codec_ctrl.hpp +++ b/host/lib/usrp/usrp2/codec_ctrl.hpp @@ -15,8 +15,8 @@  // along with this program.  If not, see <http://www.gnu.org/licenses/>.  // -#ifndef INCLUDED_CODEC_CONTROL_HPP -#define INCLUDED_CODEC_CONTROL_HPP +#ifndef INCLUDED_CODEC_CTRL_HPP +#define INCLUDED_CODEC_CTRL_HPP  #include "usrp2_iface.hpp"  #include <boost/shared_ptr.hpp> @@ -35,4 +35,4 @@ public:  }; -#endif /* INCLUDED_CODEC_CONTROL_HPP */ +#endif /* INCLUDED_CODEC_CTRL_HPP */ diff --git a/host/lib/usrp/usrp2/mboard_impl.cpp b/host/lib/usrp/usrp2/mboard_impl.cpp index 892e45f49..7e62bedf0 100644 --- a/host/lib/usrp/usrp2/mboard_impl.cpp +++ b/host/lib/usrp/usrp2/mboard_impl.cpp @@ -36,10 +36,6 @@ void usrp2_impl::mboard_init(void){          boost::bind(&usrp2_impl::mboard_get, this, _1, _2),          boost::bind(&usrp2_impl::mboard_set, this, _1, _2)      ); - -    //set up serdes -    _iface->poke32(FR_MISC_CTRL_SERDES, FRF_MISC_CTRL_SERDES_ENABLE | FRF_MISC_CTRL_SERDES_RXEN); -  }  void usrp2_impl::init_clock_config(void){ diff --git a/host/lib/usrp/usrp2/serdes_ctrl.cpp b/host/lib/usrp/usrp2/serdes_ctrl.cpp new file mode 100644 index 000000000..dde22b499 --- /dev/null +++ b/host/lib/usrp/usrp2/serdes_ctrl.cpp @@ -0,0 +1,46 @@ +// +// Copyright 2010 Ettus Research LLC +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program.  If not, see <http://www.gnu.org/licenses/>. +// + +#include "serdes_ctrl.hpp" +#include "usrp2_regs.hpp" + +using namespace uhd; + +/*! + * A usrp2 serdes control implementation + */ +class serdes_ctrl_impl : public serdes_ctrl{ +public: +    serdes_ctrl_impl(usrp2_iface::sptr iface){ +        _iface = iface; +        _iface->poke32(FR_MISC_CTRL_SERDES, FRF_MISC_CTRL_SERDES_ENABLE | FRF_MISC_CTRL_SERDES_RXEN); +    } + +    ~serdes_ctrl_impl(void){ +        _iface->poke32(FR_MISC_CTRL_SERDES, 0); //power-down +    } + +private: +    usrp2_iface::sptr _iface; +}; + +/*********************************************************************** + * Public make function for the usrp2 serdes control + **********************************************************************/ +serdes_ctrl::sptr serdes_ctrl::make(usrp2_iface::sptr iface){ +    return sptr(new serdes_ctrl_impl(iface)); +} diff --git a/host/lib/usrp/usrp2/serdes_ctrl.hpp b/host/lib/usrp/usrp2/serdes_ctrl.hpp new file mode 100644 index 000000000..586238739 --- /dev/null +++ b/host/lib/usrp/usrp2/serdes_ctrl.hpp @@ -0,0 +1,40 @@ +// +// Copyright 2010 Ettus Research LLC +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program.  If not, see <http://www.gnu.org/licenses/>. +// + +#ifndef INCLUDED_SERDES_CTRL_HPP +#define INCLUDED_SERDES_CTRL_HPP + +#include "usrp2_iface.hpp" +#include <boost/shared_ptr.hpp> +#include <boost/utility.hpp> + +class serdes_ctrl : boost::noncopyable{ +public: +    typedef boost::shared_ptr<serdes_ctrl> sptr; + +    /*! +     * Make a serdes control object for the usrp2 serdes port. +     * \param _iface a pointer to the usrp2 interface object +     * \return a new serdes control object +     */ +    static sptr make(usrp2_iface::sptr iface); + +    //TODO fill me in with virtual methods + +}; + +#endif /* INCLUDED_SERDES_CTRL_HPP */ diff --git a/host/lib/usrp/usrp2/usrp2_impl.cpp b/host/lib/usrp/usrp2/usrp2_impl.cpp index ef7754c33..5c1d7f9e3 100644 --- a/host/lib/usrp/usrp2/usrp2_impl.cpp +++ b/host/lib/usrp/usrp2/usrp2_impl.cpp @@ -149,6 +149,7 @@ usrp2_impl::usrp2_impl(      _iface = usrp2_iface::make(ctrl_transport);      _clock_ctrl = clock_ctrl::make(_iface);      _codec_ctrl = codec_ctrl::make(_iface); +    _serdes_ctrl = serdes_ctrl::make(_iface);      //load the allowed decim/interp rates      //_USRP2_RATES = range(4, 128+1, 1) + range(130, 256+1, 2) + range(260, 512+1, 4) diff --git a/host/lib/usrp/usrp2/usrp2_impl.hpp b/host/lib/usrp/usrp2/usrp2_impl.hpp index 871050356..c5b6af810 100644 --- a/host/lib/usrp/usrp2/usrp2_impl.hpp +++ b/host/lib/usrp/usrp2/usrp2_impl.hpp @@ -21,6 +21,7 @@  #include "usrp2_iface.hpp"  #include "clock_ctrl.hpp"  #include "codec_ctrl.hpp" +#include "serdes_ctrl.hpp"  #include <uhd/usrp/usrp2.hpp>  #include <uhd/types/dict.hpp>  #include <uhd/types/otw_type.hpp> @@ -115,9 +116,10 @@ private:      void set(const wax::obj &, const wax::obj &);      //interfaces +    usrp2_iface::sptr _iface;      clock_ctrl::sptr _clock_ctrl;      codec_ctrl::sptr _codec_ctrl; -    usrp2_iface::sptr _iface; +    serdes_ctrl::sptr _serdes_ctrl;      //the raw io interface (samples are in the usrp2 native format)      void recv_raw(uhd::rx_metadata_t &); | 
