diff options
Diffstat (limited to 'host/lib/usrp/usrp2')
-rw-r--r-- | host/lib/usrp/usrp2/dboard_iface.cpp | 25 | ||||
-rw-r--r-- | host/lib/usrp/usrp2/usrp2_fifo_ctrl.cpp | 6 | ||||
-rw-r--r-- | host/lib/usrp/usrp2/usrp2_fifo_ctrl.hpp | 7 | ||||
-rw-r--r-- | host/lib/usrp/usrp2/usrp2_iface.cpp | 12 | ||||
-rw-r--r-- | host/lib/usrp/usrp2/usrp2_iface.hpp | 2 | ||||
-rw-r--r-- | host/lib/usrp/usrp2/usrp2_impl.hpp | 4 |
6 files changed, 42 insertions, 14 deletions
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; |