diff options
Diffstat (limited to 'host')
| -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 | 
9 files changed, 100 insertions, 14 deletions
| 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 &); | 
