diff options
29 files changed, 240 insertions, 112 deletions
diff --git a/host/CMakeLists.txt b/host/CMakeLists.txt index 2666aa1d3..6e364ba4c 100644 --- a/host/CMakeLists.txt +++ b/host/CMakeLists.txt @@ -284,8 +284,8 @@ UHD_INSTALL(FILES  #{{{IMG_SECTION  # This section is written automatically by /images/create_imgs_package.py  # Any manual changes in here will be overwritten. -SET(UHD_IMAGES_MD5SUM "164e052f2192f3652b03ee5976c9f53b") -SET(UHD_IMAGES_DOWNLOAD_SRC "uhd-images_003.008.002-release.zip") +SET(UHD_IMAGES_MD5SUM "f5f67a3b7037e254ecf47fbfee920743") +SET(UHD_IMAGES_DOWNLOAD_SRC "uhd-images_003.008.002-157-gbe03e694.zip")  #}}}  ######################################################################## diff --git a/host/docs/usrp_e3x0.dox b/host/docs/usrp_e3x0.dox index b55fa1054..91682f0b9 100644 --- a/host/docs/usrp_e3x0.dox +++ b/host/docs/usrp_e3x0.dox @@ -179,7 +179,6 @@ knowledge of Linux.   $ repo sync   $ TEMPLATECONF=`pwd`/meta-ettus/conf source ./oe-core/oe-init-build-env ./build ./bitbake  \endcode -  At this point you should review the file in conf/local.conf and make sure  path names make sense for your machine. @@ -198,19 +197,28 @@ When this completes, the files needed to create the SD card are in  \code{.sh}   $ bitbake -c populate_sdk gnuradio-dev-image  \endcode -  The sdk is in `tmp-glibc/deploy/sdk` -  Note that you can set the `MACHINE` variable in `local.conf so that you no  longer need to set it from the command line. +-# Using the environment  When you log back in, you will need to setup the OpenEmbedded environment  again by: +    \code{.sh} +     $ cd e300-oe-build/oe-core +     $ . oe-core/oe-init-build-env ./build ./bitbake +    \endcode -\code{.sh} - $ cd e300-oe-build/oe-core - $ . oe-core/oe-init-build-env ./build ./bitbake -\endcode +\section e3x0_upgrade_sd_card Upgrading / Writing image to sd card + +In order to upgrade or reinitialize a sd card for the first time, you can use the 'dd' tool. +Make sure that you are using the right block device for your sd card as failing to do so can wipe your harddrive. + +Replace <yourimage>.direct with your image file name and yoursdcard with your blockdevice e.g. /dev/mmcblk0 or /dev/sdb. + +    $ sudo dd if=<yourimage>.direct of=/dev/<yoursdcard> bs=1M + +Notes: The commands will wipe the entire sd card and reinitialize it. Newer images need a 8GB sd card.  \section e3x0_load_fpga_imgs Specifying a Non-standard FPGA Image diff --git a/host/include/uhd/types/wb_iface.hpp b/host/include/uhd/types/wb_iface.hpp index c508062e4..e24e9363e 100644 --- a/host/include/uhd/types/wb_iface.hpp +++ b/host/include/uhd/types/wb_iface.hpp @@ -1,5 +1,5 @@  // -// Copyright 2011-2013 Ettus Research LLC +// Copyright 2011-2013,2015 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 @@ -19,6 +19,7 @@  #define INCLUDED_UHD_TYPES_WB_IFACE_HPP  #include <uhd/config.hpp> +#include <uhd/types/time_spec.hpp>  #include <boost/cstdint.hpp>  #include <boost/shared_ptr.hpp> @@ -74,7 +75,24 @@ public:       * \return the 16bit data       */      virtual boost::uint16_t peek16(const wb_addr_type addr); +}; +class UHD_API timed_wb_iface : public wb_iface +{ +public: +    typedef boost::shared_ptr<timed_wb_iface> sptr; + +    /*! +     * Get the command time. +     * \return the command time +     */ +    virtual time_spec_t get_time(void) = 0; + +    /*! +     * Set the command time. +     * \param t the command time +     */ +    virtual void set_time(const time_spec_t& t) = 0;  };  } //namespace uhd diff --git a/host/include/uhd/usrp/dboard_iface.hpp b/host/include/uhd/usrp/dboard_iface.hpp index b0f92e2ab..f8f318a40 100644 --- a/host/include/uhd/usrp/dboard_iface.hpp +++ b/host/include/uhd/usrp/dboard_iface.hpp @@ -21,6 +21,7 @@  #include <uhd/config.hpp>  #include <uhd/utils/pimpl.hpp>  #include <uhd/types/serial.hpp> +#include <uhd/types/time_spec.hpp>  #include <boost/shared_ptr.hpp>  #include <boost/cstdint.hpp>  #include <string> @@ -280,6 +281,18 @@ public:       */      virtual double get_codec_rate(unit_t unit) = 0; +    /*! +     * Get the command time. +     * \return the command time +     */ +    virtual uhd::time_spec_t get_command_time(void); + +    /*! +     * Set the command time. +     * \param t the time +     */ +    virtual void set_command_time(const uhd::time_spec_t& t); +  private:      UHD_PIMPL_DECL(impl) _impl; diff --git a/host/lib/types/wb_iface.cpp b/host/lib/types/wb_iface.cpp index 6edfdfe2f..dc8d2a83e 100644 --- a/host/lib/types/wb_iface.cpp +++ b/host/lib/types/wb_iface.cpp @@ -1,5 +1,5 @@  // -// Copyright 2013 Ettus Research LLC +// Copyright 2013,2015 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 diff --git a/host/lib/usrp/b100/b100_impl.hpp b/host/lib/usrp/b100/b100_impl.hpp index dbca543be..5a8f70d73 100644 --- a/host/lib/usrp/b100/b100_impl.hpp +++ b/host/lib/usrp/b100/b100_impl.hpp @@ -68,7 +68,7 @@ static const size_t          B100_MAX_RATE_USB2  =  32000000; // bytes/s  //! Make a b100 dboard interface  uhd::usrp::dboard_iface::sptr make_b100_dboard_iface( -    uhd::wb_iface::sptr wb_iface, +    uhd::timed_wb_iface::sptr wb_iface,      uhd::i2c_iface::sptr i2c_iface,      uhd::spi_iface::sptr spi_iface,      b100_clock_ctrl::sptr clock, diff --git a/host/lib/usrp/b100/dboard_iface.cpp b/host/lib/usrp/b100/dboard_iface.cpp index efbba1c4c..325efeec1 100644 --- a/host/lib/usrp/b100/dboard_iface.cpp +++ b/host/lib/usrp/b100/dboard_iface.cpp @@ -34,7 +34,7 @@ class b100_dboard_iface : public dboard_iface{  public:      b100_dboard_iface( -        wb_iface::sptr wb_iface, +        timed_wb_iface::sptr wb_iface,          i2c_iface::sptr i2c_iface,          spi_iface::sptr spi_iface,          b100_clock_ctrl::sptr clock, @@ -72,6 +72,8 @@ public:      void _set_gpio_out(unit_t, boost::uint16_t);      void set_gpio_debug(unit_t, int);      boost::uint16_t read_gpio(unit_t); +    void set_command_time(const uhd::time_spec_t& t); +    uhd::time_spec_t get_command_time(void);      void write_i2c(boost::uint16_t, const byte_vector_t &);      byte_vector_t read_i2c(boost::uint16_t, size_t); @@ -97,7 +99,7 @@ public:      double get_codec_rate(unit_t);  private: -    wb_iface::sptr _wb_iface; +    timed_wb_iface::sptr _wb_iface;      i2c_iface::sptr _i2c_iface;      spi_iface::sptr _spi_iface;      b100_clock_ctrl::sptr _clock; @@ -109,7 +111,7 @@ private:   * Make Function   **********************************************************************/  dboard_iface::sptr make_b100_dboard_iface( -    wb_iface::sptr wb_iface, +    timed_wb_iface::sptr wb_iface,      i2c_iface::sptr i2c_iface,      spi_iface::sptr spi_iface,      b100_clock_ctrl::sptr clock, @@ -256,3 +258,13 @@ double b100_dboard_iface::read_aux_adc(dboard_iface::unit_t unit, aux_adc_t whic      ;      return _codec->read_aux_adc(unit_to_which_to_aux_adc[unit][which]);  } + +void b100_dboard_iface::set_command_time(const uhd::time_spec_t& t) +{ +    _wb_iface->set_time(t); +} + +uhd::time_spec_t b100_dboard_iface::get_command_time(void) +{ +    return _wb_iface->get_time(); +} diff --git a/host/lib/usrp/b200/b200_impl.cpp b/host/lib/usrp/b200/b200_impl.cpp index e1b106208..afc21d031 100644 --- a/host/lib/usrp/b200/b200_impl.cpp +++ b/host/lib/usrp/b200/b200_impl.cpp @@ -67,7 +67,7 @@ public:      digital_interface_delays_t get_digital_interface_timing() {          digital_interface_delays_t delays;          delays.rx_clk_delay = 0; -        delays.rx_data_delay = 0xF; +        delays.rx_data_delay = 0x6;          delays.tx_clk_delay = 0;          delays.tx_data_delay = 0xF;          return delays; diff --git a/host/lib/usrp/b200/b200_impl.hpp b/host/lib/usrp/b200/b200_impl.hpp index cff767b4b..b68293109 100644 --- a/host/lib/usrp/b200/b200_impl.hpp +++ b/host/lib/usrp/b200/b200_impl.hpp @@ -47,7 +47,7 @@  #include "recv_packet_demuxer_3000.hpp"  static const boost::uint8_t  B200_FW_COMPAT_NUM_MAJOR = 7;  static const boost::uint8_t  B200_FW_COMPAT_NUM_MINOR = 0; -static const boost::uint16_t B200_FPGA_COMPAT_NUM = 4; +static const boost::uint16_t B200_FPGA_COMPAT_NUM = 5;  static const double          B200_BUS_CLOCK_RATE = 100e6;  static const double          B200_DEFAULT_TICK_RATE = 32e6;  static const double          B200_DEFAULT_FREQ = 100e6; // Hz diff --git a/host/lib/usrp/common/fifo_ctrl_excelsior.cpp b/host/lib/usrp/common/fifo_ctrl_excelsior.cpp index 2ea5b66da..f55d1ef41 100644 --- a/host/lib/usrp/common/fifo_ctrl_excelsior.cpp +++ b/host/lib/usrp/common/fifo_ctrl_excelsior.cpp @@ -1,5 +1,5 @@  // -// Copyright 2012 Ettus Research LLC +// Copyright 2012,2015 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 @@ -207,6 +207,12 @@ public:          if (_use_time) _timeout = MASSIVE_TIMEOUT; //permanently sets larger timeout      } +    uhd::time_spec_t get_time(void) +    { +        boost::mutex::scoped_lock lock(_mutex); +        return _time; +    } +      void set_tick_rate(const double rate){          boost::mutex::scoped_lock lock(_mutex);          _tick_rate = rate; diff --git a/host/lib/usrp/common/fifo_ctrl_excelsior.hpp b/host/lib/usrp/common/fifo_ctrl_excelsior.hpp index bd7777ffa..759e2ccc9 100644 --- a/host/lib/usrp/common/fifo_ctrl_excelsior.hpp +++ b/host/lib/usrp/common/fifo_ctrl_excelsior.hpp @@ -1,5 +1,5 @@  // -// Copyright 2012 Ettus Research LLC +// Copyright 2012,2015 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 @@ -40,7 +40,7 @@ struct fifo_ctrl_excelsior_config  /*!   * Provide access to peek, poke, spi, and async messages.   */ -class fifo_ctrl_excelsior : public uhd::wb_iface, public uhd::spi_iface +class fifo_ctrl_excelsior : public uhd::timed_wb_iface, public uhd::spi_iface  {  public:      typedef boost::shared_ptr<fifo_ctrl_excelsior> sptr; @@ -51,9 +51,6 @@ public:          const fifo_ctrl_excelsior_config &config      ); -    //! Set the command time that will activate -    virtual void set_time(const uhd::time_spec_t &time) = 0; -      //! Set the tick rate (converting time into ticks)      virtual void set_tick_rate(const double rate) = 0; diff --git a/host/lib/usrp/cores/radio_ctrl_core_3000.cpp b/host/lib/usrp/cores/radio_ctrl_core_3000.cpp index 1c9b5c4fa..47cfaf3ca 100644 --- a/host/lib/usrp/cores/radio_ctrl_core_3000.cpp +++ b/host/lib/usrp/cores/radio_ctrl_core_3000.cpp @@ -1,5 +1,5 @@  // -// Copyright 2012-2014 Ettus Research LLC +// Copyright 2012-2015 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 @@ -111,6 +111,12 @@ public:          if (_use_time) _timeout = MASSIVE_TIMEOUT; //permanently sets larger timeout      } +    uhd::time_spec_t get_time(void) +    { +        boost::mutex::scoped_lock lock(_mutex); +        return _time; +    } +      void set_tick_rate(const double rate)      {          boost::mutex::scoped_lock lock(_mutex); diff --git a/host/lib/usrp/cores/radio_ctrl_core_3000.hpp b/host/lib/usrp/cores/radio_ctrl_core_3000.hpp index 1c25ceb2c..c1cc1d372 100644 --- a/host/lib/usrp/cores/radio_ctrl_core_3000.hpp +++ b/host/lib/usrp/cores/radio_ctrl_core_3000.hpp @@ -1,5 +1,5 @@  // -// Copyright 2012-2014 Ettus Research LLC +// Copyright 2012-2015 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 @@ -29,7 +29,7 @@  /*!   * Provide access to peek, poke for the radio ctrl module   */ -class radio_ctrl_core_3000 : public uhd::wb_iface +class radio_ctrl_core_3000 : public uhd::timed_wb_iface  {  public:      typedef boost::shared_ptr<radio_ctrl_core_3000> sptr; @@ -54,6 +54,9 @@ public:      //! Set the command time that will activate      virtual void set_time(const uhd::time_spec_t &time) = 0; +    //! Get the command time that will activate +    virtual uhd::time_spec_t get_time(void) = 0; +      //! Set the tick rate (converting time into ticks)      virtual void set_tick_rate(const double rate) = 0;  }; diff --git a/host/lib/usrp/dboard/db_tvrx2.cpp b/host/lib/usrp/dboard/db_tvrx2.cpp index 9300483d1..00c2fef50 100644 --- a/host/lib/usrp/dboard/db_tvrx2.cpp +++ b/host/lib/usrp/dboard/db_tvrx2.cpp @@ -1014,7 +1014,7 @@ tvrx2::tvrx2(ctor_args_t args) : rx_dboard_base(args){          _freq_scalar = (6*16.0e6)/this->get_iface()->get_clock_rate(dboard_iface::UNIT_RX);      } else if (ref_clock == 200e6)  { -        UHD_MSG(warning) << boost::format("ref_clock was 200e6, setting ref_clock divider for 100e6.") % ref_clock << std::endl; +        UHD_MSG(warning) << boost::format("ref_clock was 200e6, setting ref_clock divider for 100e6.") << std::endl;          this->get_iface()->set_clock_rate(dboard_iface::UNIT_RX, 100e6);          this->get_iface()->set_gpio_out(dboard_iface::UNIT_RX, REFCLOCK_DIV6); diff --git a/host/lib/usrp/dboard_iface.cpp b/host/lib/usrp/dboard_iface.cpp index 6be50130a..092e005f0 100644 --- a/host/lib/usrp/dboard_iface.cpp +++ b/host/lib/usrp/dboard_iface.cpp @@ -1,5 +1,5 @@  // -// Copyright 2010-2013 Ettus Research LLC +// Copyright 2010-2013,2015 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 @@ -81,3 +81,13 @@ void dboard_iface::set_gpio_out(  boost::uint16_t dboard_iface::get_gpio_out(unit_t unit){      return _impl->gpio_out_shadow[unit];  } + +void dboard_iface::set_command_time(const uhd::time_spec_t&) +{ +    throw uhd::not_implemented_error("timed command feature not implemented on this hardware"); +} + +uhd::time_spec_t dboard_iface::get_command_time() +{ +    return uhd::time_spec_t(0.0); +} diff --git a/host/lib/usrp/e100/dboard_iface.cpp b/host/lib/usrp/e100/dboard_iface.cpp index 07d0049c8..b5baf6c56 100644 --- a/host/lib/usrp/e100/dboard_iface.cpp +++ b/host/lib/usrp/e100/dboard_iface.cpp @@ -1,5 +1,5 @@  // -// Copyright 2010-2011 Ettus Research LLC +// Copyright 2010-2011,2015 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 @@ -34,7 +34,7 @@ class e100_dboard_iface : public dboard_iface{  public:      e100_dboard_iface( -        wb_iface::sptr wb_iface, +        timed_wb_iface::sptr wb_iface,          i2c_iface::sptr i2c_iface,          spi_iface::sptr spi_iface,          e100_clock_ctrl::sptr clock, @@ -72,6 +72,8 @@ public:      void _set_gpio_out(unit_t, boost::uint16_t);      void set_gpio_debug(unit_t, int);      boost::uint16_t read_gpio(unit_t); +    void set_command_time(const uhd::time_spec_t& t); +    uhd::time_spec_t get_command_time(void);      void write_i2c(boost::uint16_t, const byte_vector_t &);      byte_vector_t read_i2c(boost::uint16_t, size_t); @@ -97,7 +99,7 @@ public:      double get_codec_rate(unit_t);  private: -    wb_iface::sptr _wb_iface; +    timed_wb_iface::sptr _wb_iface;      i2c_iface::sptr _i2c_iface;      spi_iface::sptr _spi_iface;      e100_clock_ctrl::sptr _clock; @@ -109,7 +111,7 @@ private:   * Make Function   **********************************************************************/  dboard_iface::sptr make_e100_dboard_iface( -    wb_iface::sptr wb_iface, +    timed_wb_iface::sptr wb_iface,      i2c_iface::sptr i2c_iface,      spi_iface::sptr spi_iface,      e100_clock_ctrl::sptr clock, @@ -256,3 +258,13 @@ double e100_dboard_iface::read_aux_adc(dboard_iface::unit_t unit, aux_adc_t whic      ;      return _codec->read_aux_adc(unit_to_which_to_aux_adc[unit][which]);  } + +uhd::time_spec_t e100_dboard_iface::get_command_time() +{ +    return _wb_iface->get_time(); +} + +void e100_dboard_iface::set_command_time(const uhd::time_spec_t& t) +{ +    _wb_iface->set_time(t); +} diff --git a/host/lib/usrp/e100/e100_impl.hpp b/host/lib/usrp/e100/e100_impl.hpp index 0838bd8c4..4efc21427 100644 --- a/host/lib/usrp/e100/e100_impl.hpp +++ b/host/lib/usrp/e100/e100_impl.hpp @@ -1,5 +1,5 @@  // -// Copyright 2010-2012,2014 Ettus Research LLC +// Copyright 2010-2012,2014-2015 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 @@ -61,7 +61,7 @@ extern void e100_load_fpga(const std::string &bin_file);  //! Make an e100 dboard interface  uhd::usrp::dboard_iface::sptr make_e100_dboard_iface( -    uhd::wb_iface::sptr wb_iface, +    uhd::timed_wb_iface::sptr wb_iface,      uhd::i2c_iface::sptr i2c_iface,      uhd::spi_iface::sptr spi_iface,      e100_clock_ctrl::sptr clock, diff --git a/host/lib/usrp/e300/e300_remote_codec_ctrl.cpp b/host/lib/usrp/e300/e300_remote_codec_ctrl.cpp index c78946a6c..d3efdb812 100644 --- a/host/lib/usrp/e300/e300_remote_codec_ctrl.cpp +++ b/host/lib/usrp/e300/e300_remote_codec_ctrl.cpp @@ -245,7 +245,7 @@ private:          }          if (_args.action != _retval.action) -            throw std::runtime_error("e300_remote_codec_ctrl_impl trancation failed."); +            throw std::runtime_error("e300_remote_codec_ctrl_impl transaction failed.");      }      void _clear() { diff --git a/host/lib/usrp/usrp2/dboard_iface.cpp b/host/lib/usrp/usrp2/dboard_iface.cpp index 8f2d0f0dc..7bb69c7b7 100644 --- a/host/lib/usrp/usrp2/dboard_iface.cpp +++ b/host/lib/usrp/usrp2/dboard_iface.cpp @@ -1,5 +1,5 @@  // -// Copyright 2010-2012 Ettus Research LLC +// Copyright 2010-2012,2015 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 @@ -19,6 +19,7 @@  #include <uhd/types/serial.hpp>  #include "clock_ctrl.hpp"  #include "usrp2_regs.hpp" //wishbone address constants +#include "usrp2_fifo_ctrl.hpp"  #include <uhd/usrp/dboard_iface.hpp>  #include <uhd/types/dict.hpp>  #include <uhd/exception.hpp> @@ -36,7 +37,7 @@ using namespace boost::assign;  class usrp2_dboard_iface : public dboard_iface{  public:      usrp2_dboard_iface( -        wb_iface::sptr wb_iface, +        timed_wb_iface::sptr wb_iface,          uhd::i2c_iface::sptr i2c_iface,          uhd::spi_iface::sptr spi_iface,          usrp2_clock_ctrl::sptr clock_ctrl @@ -59,6 +60,8 @@ public:      void _set_gpio_out(unit_t, boost::uint16_t);      void set_gpio_debug(unit_t, int);      boost::uint16_t read_gpio(unit_t); +    void set_command_time(const uhd::time_spec_t& t); +    uhd::time_spec_t get_command_time(void);      void write_i2c(boost::uint16_t, const byte_vector_t &);      byte_vector_t read_i2c(boost::uint16_t, size_t); @@ -84,6 +87,7 @@ public:      );  private: +    timed_wb_iface::sptr _wb_iface;      uhd::i2c_iface::sptr _i2c_iface;      uhd::spi_iface::sptr _spi_iface;      usrp2_clock_ctrl::sptr _clock_ctrl; @@ -98,7 +102,7 @@ private:   * Make Function   **********************************************************************/  dboard_iface::sptr make_usrp2_dboard_iface( -    wb_iface::sptr wb_iface, +    timed_wb_iface::sptr wb_iface,      uhd::i2c_iface::sptr i2c_iface,      uhd::spi_iface::sptr spi_iface,      usrp2_clock_ctrl::sptr clock_ctrl @@ -110,11 +114,12 @@ dboard_iface::sptr make_usrp2_dboard_iface(   * Structors   **********************************************************************/  usrp2_dboard_iface::usrp2_dboard_iface( -    wb_iface::sptr wb_iface, +    timed_wb_iface::sptr wb_iface,      uhd::i2c_iface::sptr i2c_iface,      uhd::spi_iface::sptr spi_iface,      usrp2_clock_ctrl::sptr clock_ctrl  ): +    _wb_iface(wb_iface),      _i2c_iface(i2c_iface),      _spi_iface(spi_iface),      _clock_ctrl(clock_ctrl) @@ -246,7 +251,7 @@ void usrp2_dboard_iface::_write_aux_dac(unit_t unit){          (UNIT_TX, SPI_SS_TX_DAC)      ;      _spi_iface->write_spi( -        unit_to_spi_dac[unit], spi_config_t::EDGE_FALL,  +        unit_to_spi_dac[unit], spi_config_t::EDGE_FALL,          _dac_regs[unit].get_reg(), 24      );  } @@ -305,3 +310,13 @@ double usrp2_dboard_iface::read_aux_adc(unit_t unit, aux_adc_t which){      //convert to voltage and return      return 3.3*ad7922_regs.result/4095;  } + +uhd::time_spec_t usrp2_dboard_iface::get_command_time() +{ +    return _wb_iface->get_time(); +} + +void usrp2_dboard_iface::set_command_time(const uhd::time_spec_t& t) +{ +    _wb_iface->set_time(t); +} diff --git a/host/lib/usrp/usrp2/usrp2_fifo_ctrl.cpp b/host/lib/usrp/usrp2/usrp2_fifo_ctrl.cpp index 9e8687b94..0276a7a66 100644 --- a/host/lib/usrp/usrp2/usrp2_fifo_ctrl.cpp +++ b/host/lib/usrp/usrp2/usrp2_fifo_ctrl.cpp @@ -155,6 +155,12 @@ public:          if (_use_time) _timeout = MASSIVE_TIMEOUT; //permanently sets larger timeout      } +    uhd::time_spec_t get_time() +    { +        boost::mutex::scoped_lock lock(_mutex); +        return _time; +    } +      void set_tick_rate(const double rate){          boost::mutex::scoped_lock lock(_mutex);          _tick_rate = rate; diff --git a/host/lib/usrp/usrp2/usrp2_fifo_ctrl.hpp b/host/lib/usrp/usrp2/usrp2_fifo_ctrl.hpp index 13dfb5b46..5bc7f6676 100644 --- a/host/lib/usrp/usrp2/usrp2_fifo_ctrl.hpp +++ b/host/lib/usrp/usrp2/usrp2_fifo_ctrl.hpp @@ -1,5 +1,5 @@  // -// Copyright 2012 Ettus Research LLC +// Copyright 2012,2015 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 @@ -30,7 +30,7 @@   * The usrp2 FIFO control class:   * Provide high-speed peek/poke interface.   */ -class usrp2_fifo_ctrl : public uhd::wb_iface, public uhd::spi_iface +class usrp2_fifo_ctrl : public uhd::timed_wb_iface, public uhd::spi_iface  {  public:      typedef boost::shared_ptr<usrp2_fifo_ctrl> sptr; @@ -38,9 +38,6 @@ public:      //! Make a new FIFO control object      static sptr make(uhd::transport::zero_copy_if::sptr xport); -    //! Set the command time that will activate -    virtual void set_time(const uhd::time_spec_t &time) = 0; -      //! Set the tick rate (converting time into ticks)      virtual void set_tick_rate(const double rate) = 0;  }; diff --git a/host/lib/usrp/usrp2/usrp2_iface.cpp b/host/lib/usrp/usrp2/usrp2_iface.cpp index 3ffbf9aac..1d41173f8 100644 --- a/host/lib/usrp/usrp2/usrp2_iface.cpp +++ b/host/lib/usrp/usrp2/usrp2_iface.cpp @@ -1,5 +1,5 @@  // -// Copyright 2010-2012,2014 Ettus Research LLC +// Copyright 2010-2012,2014-2015 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 @@ -399,6 +399,16 @@ public:          }      } +    void set_time(const time_spec_t&) +    { +        throw uhd::not_implemented_error("Timed commands not supported"); +    } + +    time_spec_t get_time(void) +    { +        return (0.0); +    } +  private:      //this lovely lady makes it all possible      udp_simple::sptr _ctrl_transport; diff --git a/host/lib/usrp/usrp2/usrp2_iface.hpp b/host/lib/usrp/usrp2/usrp2_iface.hpp index a01f2ccfa..833016b7c 100644 --- a/host/lib/usrp/usrp2/usrp2_iface.hpp +++ b/host/lib/usrp/usrp2/usrp2_iface.hpp @@ -33,7 +33,7 @@   * Provides a set of functions to implementation layer.   * Including spi, peek, poke, control...   */ -class usrp2_iface : public uhd::wb_iface, public uhd::spi_iface, public uhd::i2c_iface +class usrp2_iface : public uhd::timed_wb_iface, public uhd::spi_iface, public uhd::i2c_iface  {  public:      typedef boost::shared_ptr<usrp2_iface> sptr; diff --git a/host/lib/usrp/usrp2/usrp2_impl.hpp b/host/lib/usrp/usrp2/usrp2_impl.hpp index fac4b3907..701403029 100644 --- a/host/lib/usrp/usrp2/usrp2_impl.hpp +++ b/host/lib/usrp/usrp2/usrp2_impl.hpp @@ -57,7 +57,7 @@ static const std::string USRP2_EEPROM_MAP_KEY = "N100";  //! Make a usrp2 dboard interface.  uhd::usrp::dboard_iface::sptr make_usrp2_dboard_iface( -    uhd::wb_iface::sptr wb_iface, +    uhd::timed_wb_iface::sptr wb_iface,      uhd::i2c_iface::sptr i2c_iface,      uhd::spi_iface::sptr spi_iface,      usrp2_clock_ctrl::sptr clk_ctrl @@ -83,7 +83,7 @@ private:          usrp2_iface::sptr iface;          usrp2_fifo_ctrl::sptr fifo_ctrl;          uhd::spi_iface::sptr spiface; -        uhd::wb_iface::sptr wbiface; +        uhd::timed_wb_iface::sptr wbiface;          usrp2_clock_ctrl::sptr clock;          usrp2_codec_ctrl::sptr codec;          uhd::gps_ctrl::sptr gps; diff --git a/host/lib/usrp/x300/x300_clock_ctrl.cpp b/host/lib/usrp/x300/x300_clock_ctrl.cpp index 22eba3eb3..3aebfea68 100644 --- a/host/lib/usrp/x300/x300_clock_ctrl.cpp +++ b/host/lib/usrp/x300/x300_clock_ctrl.cpp @@ -190,7 +190,7 @@ void set_master_clock_rate(double clock_rate) {              // PLL1 - 2 MHz compare frequency              _lmk04816_regs.PLL1_N_28 = 100;              _lmk04816_regs.PLL1_R_27 = 5; -            _lmk04816_regs.PLL1_CP_GAIN_27 = lmk04816_regs_t::PLL1_CP_GAIN_27_100UA; +            _lmk04816_regs.PLL1_CP_GAIN_27 = lmk04816_regs_t::PLL1_CP_GAIN_27_1600UA;              // PLL2 - 96 MHz compare frequency              _lmk04816_regs.PLL2_N_30 = 5; diff --git a/host/lib/usrp/x300/x300_dboard_iface.cpp b/host/lib/usrp/x300/x300_dboard_iface.cpp index eff5183e0..c286e805a 100644 --- a/host/lib/usrp/x300/x300_dboard_iface.cpp +++ b/host/lib/usrp/x300/x300_dboard_iface.cpp @@ -1,5 +1,5 @@  // -// Copyright 2013 Ettus Research LLC +// Copyright 2013,2015 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 @@ -50,6 +50,9 @@ public:      void _set_gpio_ddr(unit_t, boost::uint16_t);      void _set_gpio_out(unit_t, boost::uint16_t); +    void set_command_time(const uhd::time_spec_t& t); +    uhd::time_spec_t get_command_time(void); +      void set_gpio_debug(unit_t, int);      boost::uint16_t read_gpio(unit_t); @@ -331,3 +334,13 @@ double x300_dboard_iface::read_aux_adc(unit_t unit, aux_adc_t which)      //convert to voltage and return      return 3.3*ad7922_regs.result/4095;  } + +uhd::time_spec_t x300_dboard_iface::get_command_time() +{ +    return _config.cmd_time_ctrl->get_time(); +} + +void x300_dboard_iface::set_command_time(const uhd::time_spec_t& t) +{ +    _config.cmd_time_ctrl->set_time(t); +} diff --git a/host/lib/usrp/x300/x300_impl.cpp b/host/lib/usrp/x300/x300_impl.cpp index 641adc048..cab2ec491 100644 --- a/host/lib/usrp/x300/x300_impl.cpp +++ b/host/lib/usrp/x300/x300_impl.cpp @@ -1013,6 +1013,7 @@ void x300_impl::setup_radio(const size_t mb_i, const std::string &slot_name)      db_config.which_rx_clk = (slot_name == "A")? X300_CLOCK_WHICH_DB0_RX : X300_CLOCK_WHICH_DB1_RX;      db_config.which_tx_clk = (slot_name == "A")? X300_CLOCK_WHICH_DB0_TX : X300_CLOCK_WHICH_DB1_TX;      db_config.dboard_slot = (slot_name == "A")? 0 : 1; +    db_config.cmd_time_ctrl = perif.ctrl;      _dboard_ifaces[db_path] = x300_make_dboard_iface(db_config);      //create a new dboard manager diff --git a/host/lib/usrp/x300/x300_impl.hpp b/host/lib/usrp/x300/x300_impl.hpp index 9ad060c85..9042ad2ca 100644 --- a/host/lib/usrp/x300/x300_impl.hpp +++ b/host/lib/usrp/x300/x300_impl.hpp @@ -131,6 +131,7 @@ struct x300_dboard_iface_config_t      x300_clock_which_t which_rx_clk;      x300_clock_which_t which_tx_clk;      boost::uint8_t dboard_slot; +    uhd::timed_wb_iface::sptr cmd_time_ctrl;  };  uhd::usrp::dboard_iface::sptr x300_make_dboard_iface(const x300_dboard_iface_config_t &); diff --git a/host/tests/sid_t_test.cpp b/host/tests/sid_t_test.cpp index b5cdeb3d8..31eb4b458 100644 --- a/host/tests/sid_t_test.cpp +++ b/host/tests/sid_t_test.cpp @@ -30,12 +30,12 @@ BOOST_AUTO_TEST_CASE(test_sid_t) {      BOOST_CHECK_EQUAL(sid.is_set(), true);      BOOST_CHECK_EQUAL(sid.to_pp_string(), "1.2>3.16");      BOOST_CHECK_EQUAL(sid.to_pp_string_hex(), "01:02>03:10"); -    BOOST_CHECK_EQUAL(sid.get_src(), (uint32_t)0x0102); -    BOOST_CHECK_EQUAL(sid.get_dst(), (uint32_t)0x0310); -    BOOST_CHECK_EQUAL(sid.get_src_addr(), (uint32_t)0x01); -    BOOST_CHECK_EQUAL(sid.get_src_endpoint(), (uint32_t)0x02); -    BOOST_CHECK_EQUAL(sid.get_dst_addr(), (uint32_t)0x03); -    BOOST_CHECK_EQUAL(sid.get_dst_endpoint(), (uint32_t)0x10); +    BOOST_CHECK_EQUAL(sid.get_src(), (boost::uint32_t)0x0102); +    BOOST_CHECK_EQUAL(sid.get_dst(), (boost::uint32_t)0x0310); +    BOOST_CHECK_EQUAL(sid.get_src_addr(), (boost::uint32_t)0x01); +    BOOST_CHECK_EQUAL(sid.get_src_endpoint(), (boost::uint32_t)0x02); +    BOOST_CHECK_EQUAL(sid.get_dst_addr(), (boost::uint32_t)0x03); +    BOOST_CHECK_EQUAL(sid.get_dst_endpoint(), (boost::uint32_t)0x10);      BOOST_CHECK_EQUAL(sid == sid, true);      BOOST_CHECK_EQUAL(sid == sid_value, true); @@ -68,88 +68,88 @@ BOOST_AUTO_TEST_CASE(test_sid_t_set) {      sid_t sid(sid_value);      sid.set(0x01020304); -    BOOST_CHECK_EQUAL(sid.get(), (uint32_t)0x01020304); -    BOOST_CHECK_EQUAL(sid.get_src_addr(),(uint32_t)0x01); -    BOOST_CHECK_EQUAL(sid.get_src_endpoint(), (uint32_t)0x02); -    BOOST_CHECK_EQUAL(sid.get_dst_addr(), (uint32_t)0x03); -    BOOST_CHECK_EQUAL(sid.get_dst_endpoint(), (uint32_t)0x04); -    BOOST_CHECK_EQUAL(sid.get_dst_xbarport(), (uint32_t)0x0); -    BOOST_CHECK_EQUAL(sid.get_dst_blockport(), (uint32_t)0x4); +    BOOST_CHECK_EQUAL(sid.get(), (boost::uint32_t)0x01020304); +    BOOST_CHECK_EQUAL(sid.get_src_addr(),(boost::uint32_t)0x01); +    BOOST_CHECK_EQUAL(sid.get_src_endpoint(), (boost::uint32_t)0x02); +    BOOST_CHECK_EQUAL(sid.get_dst_addr(), (boost::uint32_t)0x03); +    BOOST_CHECK_EQUAL(sid.get_dst_endpoint(), (boost::uint32_t)0x04); +    BOOST_CHECK_EQUAL(sid.get_dst_xbarport(), (boost::uint32_t)0x0); +    BOOST_CHECK_EQUAL(sid.get_dst_blockport(), (boost::uint32_t)0x4);      sid.set_src_addr(0x0a); -    BOOST_CHECK_EQUAL(sid.get(), (uint32_t)0x0a020304); -    BOOST_CHECK_EQUAL(sid.get_src_addr(), (uint32_t)0x0a); -    BOOST_CHECK_EQUAL(sid.get_src_endpoint(), (uint32_t)0x02); -    BOOST_CHECK_EQUAL(sid.get_dst_addr(), (uint32_t)0x03); -    BOOST_CHECK_EQUAL(sid.get_dst_endpoint(), (uint32_t)0x04); +    BOOST_CHECK_EQUAL(sid.get(), (boost::uint32_t)0x0a020304); +    BOOST_CHECK_EQUAL(sid.get_src_addr(), (boost::uint32_t)0x0a); +    BOOST_CHECK_EQUAL(sid.get_src_endpoint(), (boost::uint32_t)0x02); +    BOOST_CHECK_EQUAL(sid.get_dst_addr(), (boost::uint32_t)0x03); +    BOOST_CHECK_EQUAL(sid.get_dst_endpoint(), (boost::uint32_t)0x04);      sid.set_src_endpoint(0x0b); -    BOOST_CHECK_EQUAL(sid.get(), (uint32_t)0x0a0b0304); -    BOOST_CHECK_EQUAL(sid.get_src_addr(), (uint32_t)0x0a); -    BOOST_CHECK_EQUAL(sid.get_src_endpoint(), (uint32_t)0x0b); -    BOOST_CHECK_EQUAL(sid.get_dst_addr(), (uint32_t)0x03); -    BOOST_CHECK_EQUAL(sid.get_dst_endpoint(), (uint32_t)0x04); +    BOOST_CHECK_EQUAL(sid.get(), (boost::uint32_t)0x0a0b0304); +    BOOST_CHECK_EQUAL(sid.get_src_addr(), (boost::uint32_t)0x0a); +    BOOST_CHECK_EQUAL(sid.get_src_endpoint(), (boost::uint32_t)0x0b); +    BOOST_CHECK_EQUAL(sid.get_dst_addr(), (boost::uint32_t)0x03); +    BOOST_CHECK_EQUAL(sid.get_dst_endpoint(), (boost::uint32_t)0x04);      sid.set_dst_addr(0x0c); -    BOOST_CHECK_EQUAL(sid.get(), (uint32_t)0x0a0b0c04); -    BOOST_CHECK_EQUAL(sid.get_src_addr(), (uint32_t)0x0a); -    BOOST_CHECK_EQUAL(sid.get_src_endpoint(), (uint32_t)0x0b); -    BOOST_CHECK_EQUAL(sid.get_dst_addr(), (uint32_t)0x0c); -    BOOST_CHECK_EQUAL(sid.get_dst_endpoint(), (uint32_t)0x04); +    BOOST_CHECK_EQUAL(sid.get(), (boost::uint32_t)0x0a0b0c04); +    BOOST_CHECK_EQUAL(sid.get_src_addr(), (boost::uint32_t)0x0a); +    BOOST_CHECK_EQUAL(sid.get_src_endpoint(), (boost::uint32_t)0x0b); +    BOOST_CHECK_EQUAL(sid.get_dst_addr(), (boost::uint32_t)0x0c); +    BOOST_CHECK_EQUAL(sid.get_dst_endpoint(), (boost::uint32_t)0x04);      sid.set_dst_endpoint(0x0d); -    BOOST_CHECK_EQUAL(sid.get(), (uint32_t)0x0a0b0c0d); -    BOOST_CHECK_EQUAL(sid.get_src_addr(), (uint32_t)0x0a); -    BOOST_CHECK_EQUAL(sid.get_src_endpoint(), (uint32_t)0x0b); -    BOOST_CHECK_EQUAL(sid.get_dst_addr(), (uint32_t)0x0c); -    BOOST_CHECK_EQUAL(sid.get_dst_endpoint(), (uint32_t)0x0d); +    BOOST_CHECK_EQUAL(sid.get(), (boost::uint32_t)0x0a0b0c0d); +    BOOST_CHECK_EQUAL(sid.get_src_addr(), (boost::uint32_t)0x0a); +    BOOST_CHECK_EQUAL(sid.get_src_endpoint(), (boost::uint32_t)0x0b); +    BOOST_CHECK_EQUAL(sid.get_dst_addr(), (boost::uint32_t)0x0c); +    BOOST_CHECK_EQUAL(sid.get_dst_endpoint(), (boost::uint32_t)0x0d);      sid.set_dst_xbarport(0xb); -    BOOST_CHECK_EQUAL(sid.get(), (uint32_t)0x0a0b0cbd); -    BOOST_CHECK_EQUAL(sid.get_src_addr(), (uint32_t)0x0a); -    BOOST_CHECK_EQUAL(sid.get_src_endpoint(), (uint32_t)0x0b); -    BOOST_CHECK_EQUAL(sid.get_dst_addr(), (uint32_t)0x0c); -    BOOST_CHECK_EQUAL(sid.get_dst_endpoint(), (uint32_t)0xbd); +    BOOST_CHECK_EQUAL(sid.get(), (boost::uint32_t)0x0a0b0cbd); +    BOOST_CHECK_EQUAL(sid.get_src_addr(), (boost::uint32_t)0x0a); +    BOOST_CHECK_EQUAL(sid.get_src_endpoint(), (boost::uint32_t)0x0b); +    BOOST_CHECK_EQUAL(sid.get_dst_addr(), (boost::uint32_t)0x0c); +    BOOST_CHECK_EQUAL(sid.get_dst_endpoint(), (boost::uint32_t)0xbd);      sid.set_dst_blockport(0xc); -    BOOST_CHECK_EQUAL(sid.get(), (uint32_t)0x0a0b0cbc); -    BOOST_CHECK_EQUAL(sid.get_src_addr(), (uint32_t)0x0a); -    BOOST_CHECK_EQUAL(sid.get_src_endpoint(), (uint32_t)0x0b); -    BOOST_CHECK_EQUAL(sid.get_dst_addr(), (uint32_t)0x0c); -    BOOST_CHECK_EQUAL(sid.get_dst_endpoint(), (uint32_t)0xbc); +    BOOST_CHECK_EQUAL(sid.get(), (boost::uint32_t)0x0a0b0cbc); +    BOOST_CHECK_EQUAL(sid.get_src_addr(), (boost::uint32_t)0x0a); +    BOOST_CHECK_EQUAL(sid.get_src_endpoint(), (boost::uint32_t)0x0b); +    BOOST_CHECK_EQUAL(sid.get_dst_addr(), (boost::uint32_t)0x0c); +    BOOST_CHECK_EQUAL(sid.get_dst_endpoint(), (boost::uint32_t)0xbc);      sid_t flipped_sid = sid.reversed(); -    BOOST_CHECK_EQUAL(flipped_sid.get(), (uint32_t)0x0cbc0a0b); +    BOOST_CHECK_EQUAL(flipped_sid.get(), (boost::uint32_t)0x0cbc0a0b);      // In-place      sid.reverse(); -    BOOST_CHECK_EQUAL(sid.get(), (uint32_t)0x0cbc0a0b); +    BOOST_CHECK_EQUAL(sid.get(), (boost::uint32_t)0x0cbc0a0b);  }  BOOST_AUTO_TEST_CASE(test_sid_t_from_str) {      sid_t sid("1.2>3.4"); -    BOOST_CHECK_EQUAL(sid.get_src_addr(), (uint32_t)1); -    BOOST_CHECK_EQUAL(sid.get_src_endpoint(), (uint32_t)2); -    BOOST_CHECK_EQUAL(sid.get_dst_addr(), (uint32_t)3); -    BOOST_CHECK_EQUAL(sid.get_dst_endpoint(), (uint32_t)4); +    BOOST_CHECK_EQUAL(sid.get_src_addr(), (boost::uint32_t)1); +    BOOST_CHECK_EQUAL(sid.get_src_endpoint(), (boost::uint32_t)2); +    BOOST_CHECK_EQUAL(sid.get_dst_addr(), (boost::uint32_t)3); +    BOOST_CHECK_EQUAL(sid.get_dst_endpoint(), (boost::uint32_t)4);      sid = "01:02>03:10"; -    BOOST_CHECK_EQUAL(sid.get_src_addr(), (uint32_t)1); -    BOOST_CHECK_EQUAL(sid.get_src_endpoint(), (uint32_t)2); -    BOOST_CHECK_EQUAL(sid.get_dst_addr(), (uint32_t)3); -    BOOST_CHECK_EQUAL(sid.get_dst_endpoint(), (uint32_t)16); +    BOOST_CHECK_EQUAL(sid.get_src_addr(), (boost::uint32_t)1); +    BOOST_CHECK_EQUAL(sid.get_src_endpoint(), (boost::uint32_t)2); +    BOOST_CHECK_EQUAL(sid.get_dst_addr(), (boost::uint32_t)3); +    BOOST_CHECK_EQUAL(sid.get_dst_endpoint(), (boost::uint32_t)16);      sid = "01:06/03:10"; -    BOOST_CHECK_EQUAL(sid.get_src_addr(), (uint32_t)1); -    BOOST_CHECK_EQUAL(sid.get_src_endpoint(), (uint32_t)6); -    BOOST_CHECK_EQUAL(sid.get_dst_addr(), (uint32_t)3); -    BOOST_CHECK_EQUAL(sid.get_dst_endpoint(), (uint32_t)16); +    BOOST_CHECK_EQUAL(sid.get_src_addr(), (boost::uint32_t)1); +    BOOST_CHECK_EQUAL(sid.get_src_endpoint(), (boost::uint32_t)6); +    BOOST_CHECK_EQUAL(sid.get_dst_addr(), (boost::uint32_t)3); +    BOOST_CHECK_EQUAL(sid.get_dst_endpoint(), (boost::uint32_t)16);      sid = "01:02:04:10"; -    BOOST_CHECK_EQUAL(sid.get_src_addr(), (uint32_t)1); -    BOOST_CHECK_EQUAL(sid.get_src_endpoint(), (uint32_t)2); -    BOOST_CHECK_EQUAL(sid.get_dst_addr(), (uint32_t)4); -    BOOST_CHECK_EQUAL(sid.get_dst_endpoint(), (uint32_t)16); +    BOOST_CHECK_EQUAL(sid.get_src_addr(), (boost::uint32_t)1); +    BOOST_CHECK_EQUAL(sid.get_src_endpoint(), (boost::uint32_t)2); +    BOOST_CHECK_EQUAL(sid.get_dst_addr(), (boost::uint32_t)4); +    BOOST_CHECK_EQUAL(sid.get_dst_endpoint(), (boost::uint32_t)16);      BOOST_REQUIRE_THROW(sid_t fail_sid("foobar"), uhd::value_error);      BOOST_REQUIRE_THROW(sid_t fail_sid("01:02:03:4"), uhd::value_error);  | 
