diff options
Diffstat (limited to 'host')
| -rw-r--r-- | host/examples/benchmark_rate.cpp | 53 | ||||
| -rw-r--r-- | host/lib/rfnoc/legacy_compat.cpp | 11 | ||||
| -rw-r--r-- | host/lib/usrp/b200/CMakeLists.txt | 1 | ||||
| -rw-r--r-- | host/lib/usrp/b200/b200_impl.cpp | 12 | ||||
| -rw-r--r-- | host/lib/usrp/b200/b200_impl.hpp | 10 | ||||
| -rw-r--r-- | host/lib/usrp/b200/b200_io_impl.cpp | 2 | ||||
| -rw-r--r-- | host/lib/usrp/b200/b200_radio_ctrl_core.cpp | 347 | ||||
| -rw-r--r-- | host/lib/usrp/b200/b200_radio_ctrl_core.hpp | 64 | ||||
| -rw-r--r-- | host/lib/usrp/dboard/twinrx/twinrx_experts.hpp | 6 | ||||
| -rw-r--r-- | host/lib/usrp/x300/x300_impl.cpp | 17 | 
10 files changed, 74 insertions, 449 deletions
| diff --git a/host/examples/benchmark_rate.cpp b/host/examples/benchmark_rate.cpp index b024c3a20..1ea754ef2 100644 --- a/host/examples/benchmark_rate.cpp +++ b/host/examples/benchmark_rate.cpp @@ -268,7 +268,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){      std::string rx_otw, tx_otw;      std::string rx_cpu, tx_cpu;      std::string mode, ref, pps; -    std::string channel_list; +    std::string channel_list, rx_channel_list, tx_channel_list;      bool random_nsamps = false;      atomic_bool burst_timer_elapsed(false); @@ -291,6 +291,8 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){          ("mode", po::value<std::string>(&mode), "DEPRECATED - use \"ref\" and \"pps\" instead (none, mimo)")          ("random", "Run with random values of samples in send() and recv() to stress-test the I/O.")          ("channels", po::value<std::string>(&channel_list)->default_value("0"), "which channel(s) to use (specify \"0\", \"1\", \"0,1\", etc)") +        ("rx_channels", po::value<std::string>(&rx_channel_list), "which RX channel(s) to use (specify \"0\", \"1\", \"0,1\", etc)") +        ("tx_channels", po::value<std::string>(&tx_channel_list), "which TX channel(s) to use (specify \"0\", \"1\", \"0,1\", etc)")      ;      po::variables_map vm;      po::store(po::parse_command_line(argc, argv, desc), vm); @@ -394,20 +396,45 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){         }      } -    //detect which channels to use +    //check that the device has sufficient RX and TX channels available      std::vector<std::string> channel_strings; -    std::vector<size_t> channel_nums; -    boost::split(channel_strings, channel_list, boost::is_any_of("\"',")); -    for(size_t ch = 0; ch < channel_strings.size(); ch++){ -        size_t chan = boost::lexical_cast<int>(channel_strings[ch]); -        if(chan >= usrp->get_tx_num_channels() or chan >= usrp->get_rx_num_channels()){ -            throw std::runtime_error("Invalid channel(s) specified."); +    std::vector<size_t> rx_channel_nums; +    if (vm.count("rx_rate")) { +        if (!vm.count("rx_channels")) { +            rx_channel_list = channel_list; +        } + +        boost::split(channel_strings, rx_channel_list, boost::is_any_of("\"',")); +        for (size_t ch = 0; ch < channel_strings.size(); ch++) { +            size_t chan = boost::lexical_cast<int>(channel_strings[ch]); +            if (chan >= usrp->get_rx_num_channels()) { +                throw std::runtime_error("Invalid channel(s) specified."); +            } else { +                rx_channel_nums.push_back(boost::lexical_cast<int>(channel_strings[ch])); +            } +        } +    } + +    std::vector<size_t> tx_channel_nums; +    if (vm.count("tx_rate")) { +        if (!vm.count("tx_channels")) { +            tx_channel_list = channel_list; +        } + +        boost::split(channel_strings, tx_channel_list, boost::is_any_of("\"',")); +        for (size_t ch = 0; ch < channel_strings.size(); ch++) { +            size_t chan = boost::lexical_cast<int>(channel_strings[ch]); +            if (chan >= usrp->get_tx_num_channels()) { +                throw std::runtime_error("Invalid channel(s) specified."); +            } else { +                tx_channel_nums.push_back(boost::lexical_cast<int>(channel_strings[ch])); +            }          } -        else channel_nums.push_back(boost::lexical_cast<int>(channel_strings[ch]));      }      std::cout << boost::format("Setting device timestamp to 0...") << std::endl; -    if (pps == "mimo" or ref == "mimo" or channel_nums.size() == 1) { +    bool sync_channels = (pps == "mimo" or ref == "mimo" or (rx_channel_nums.size() <= 1 and tx_channel_nums.size() <= 1));   +    if (!sync_channels) {         usrp->set_time_now(0.0);      } else {         usrp->set_time_unknown_pps(uhd::time_spec_t(0.0)); @@ -418,7 +445,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){          usrp->set_rx_rate(rx_rate);          //create a receive streamer          uhd::stream_args_t stream_args(rx_cpu, rx_otw); -        stream_args.channels = channel_nums; +        stream_args.channels = rx_channel_nums;          uhd::rx_streamer::sptr rx_stream = usrp->get_rx_stream(stream_args);          thread_group.create_thread(boost::bind(&benchmark_rx_rate, usrp, rx_cpu, rx_stream, random_nsamps, boost::ref(burst_timer_elapsed)));      } @@ -428,7 +455,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){          usrp->set_tx_rate(tx_rate);          //create a transmit streamer          uhd::stream_args_t stream_args(tx_cpu, tx_otw); -        stream_args.channels = channel_nums; +        stream_args.channels = tx_channel_nums;          uhd::tx_streamer::sptr tx_stream = usrp->get_tx_stream(stream_args);          thread_group.create_thread(boost::bind(&benchmark_tx_rate, usrp, tx_cpu, tx_stream, boost::ref(burst_timer_elapsed), random_nsamps));          thread_group.create_thread(boost::bind(&benchmark_tx_rate_async_helper, tx_stream, boost::ref(burst_timer_elapsed))); @@ -439,7 +466,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){      const long usecs = long((duration - secs)*1e6);      boost::this_thread::sleep(boost::posix_time::seconds(secs)              + boost::posix_time::microseconds(usecs) -            + boost::posix_time::milliseconds( (channel_nums.size() == 1) ? 0 : (INIT_DELAY * 1000)) +            + boost::posix_time::milliseconds( (rx_channel_nums.size() <= 1 and tx_channel_nums.size() <= 1) ? 0 : (INIT_DELAY * 1000))      );      //interrupt and join the threads diff --git a/host/lib/rfnoc/legacy_compat.cpp b/host/lib/rfnoc/legacy_compat.cpp index 843cdea34..2c8e10c4a 100644 --- a/host/lib/rfnoc/legacy_compat.cpp +++ b/host/lib/rfnoc/legacy_compat.cpp @@ -38,7 +38,7 @@ using uhd::usrp::subdev_spec_pair_t;  using uhd::stream_cmd_t;  /************************************************************************ - * Constants + * Constants and globals   ***********************************************************************/  static const std::string RADIO_BLOCK_NAME = "Radio";  static const std::string DFIFO_BLOCK_NAME = "DmaFIFO"; @@ -47,6 +47,7 @@ static const std::string DUC_BLOCK_NAME = "DUC";  static const size_t MAX_BYTES_PER_HEADER =          uhd::transport::vrt::chdr::max_if_hdr_words64 * sizeof(uint64_t);  static const size_t BYTES_PER_SAMPLE = 4; // We currently only support sc16 +static boost::mutex _make_mutex;  /************************************************************************   * Static helpers @@ -700,15 +701,13 @@ legacy_compat::sptr legacy_compat::make(          uhd::device3::sptr device,          const uhd::device_addr_t &args  ) { +    boost::lock_guard<boost::mutex> lock(_make_mutex);      UHD_ASSERT_THROW(bool(device));      static std::map<void *, boost::weak_ptr<legacy_compat> > legacy_cache; -    if (legacy_cache.count(device.get())) { +    if (legacy_cache.count(device.get()) and not legacy_cache.at(device.get()).expired()) {          legacy_compat::sptr legacy_compat_copy = legacy_cache.at(device.get()).lock(); -        if (not bool(legacy_compat_copy)) { -            throw uhd::runtime_error("Reference to existing legacy compat object expired prematurely!"); -        } - +        UHD_ASSERT_THROW(bool(legacy_compat_copy));          UHD_LEGACY_LOG() << "[legacy_compat] Using existing legacy compat object for this device." << std::endl;          return legacy_compat_copy;      } diff --git a/host/lib/usrp/b200/CMakeLists.txt b/host/lib/usrp/b200/CMakeLists.txt index d953acb19..4b9e2de55 100644 --- a/host/lib/usrp/b200/CMakeLists.txt +++ b/host/lib/usrp/b200/CMakeLists.txt @@ -30,6 +30,5 @@ IF(ENABLE_B200)          ${CMAKE_CURRENT_SOURCE_DIR}/b200_io_impl.cpp          ${CMAKE_CURRENT_SOURCE_DIR}/b200_uart.cpp          ${CMAKE_CURRENT_SOURCE_DIR}/b200_cores.cpp -        ${CMAKE_CURRENT_SOURCE_DIR}/b200_radio_ctrl_core.cpp      )  ENDIF(ENABLE_B200) diff --git a/host/lib/usrp/b200/b200_impl.cpp b/host/lib/usrp/b200/b200_impl.cpp index 9526ae2d1..aed1204d3 100644 --- a/host/lib/usrp/b200/b200_impl.cpp +++ b/host/lib/usrp/b200/b200_impl.cpp @@ -466,7 +466,7 @@ b200_impl::b200_impl(const uhd::device_addr_t& device_addr, usb_device_handle::s      ////////////////////////////////////////////////////////////////////      // Local control endpoint      //////////////////////////////////////////////////////////////////// -    _local_ctrl = b200_radio_ctrl_core::make(false/*lilE*/, _ctrl_transport, zero_copy_if::sptr()/*null*/, B200_LOCAL_CTRL_SID); +    _local_ctrl = radio_ctrl_core_3000::make(false/*lilE*/, _ctrl_transport, zero_copy_if::sptr()/*null*/, B200_LOCAL_CTRL_SID);      _local_ctrl->hold_task(_async_task);      _async_task_data->local_ctrl = _local_ctrl; //weak      this->check_fpga_compat(); @@ -625,9 +625,9 @@ b200_impl::b200_impl(const uhd::device_addr_t& device_addr, usb_device_handle::s      {          _codec_mgr->loopback_self_test(              boost::bind( -                &b200_radio_ctrl_core::poke32, perif.ctrl, TOREG(SR_CODEC_IDLE), _1 +                &radio_ctrl_core_3000::poke32, perif.ctrl, TOREG(SR_CODEC_IDLE), _1              ), -            boost::bind(&b200_radio_ctrl_core::peek64, perif.ctrl, RB64_CODEC_READBACK) +            boost::bind(&radio_ctrl_core_3000::peek64, perif.ctrl, RB64_CODEC_READBACK)          );      } @@ -756,7 +756,7 @@ void b200_impl::setup_radio(const size_t dspno)      ////////////////////////////////////////////////////////////////////      // radio control      //////////////////////////////////////////////////////////////////// -    perif.ctrl = b200_radio_ctrl_core::make( +    perif.ctrl = radio_ctrl_core_3000::make(              false/*lilE*/,              _ctrl_transport,              zero_copy_if::sptr()/*null*/, @@ -764,9 +764,9 @@ void b200_impl::setup_radio(const size_t dspno)      perif.ctrl->hold_task(_async_task);      _async_task_data->radio_ctrl[dspno] = perif.ctrl; //weak      _tree->access<time_spec_t>(mb_path / "time" / "cmd") -        .add_coerced_subscriber(boost::bind(&b200_radio_ctrl_core::set_time, perif.ctrl, _1)); +        .add_coerced_subscriber(boost::bind(&radio_ctrl_core_3000::set_time, perif.ctrl, _1));      _tree->access<double>(mb_path / "tick_rate") -        .add_coerced_subscriber(boost::bind(&b200_radio_ctrl_core::set_tick_rate, perif.ctrl, _1)); +        .add_coerced_subscriber(boost::bind(&radio_ctrl_core_3000::set_tick_rate, perif.ctrl, _1));      this->register_loopback_self_test(perif.ctrl);      //////////////////////////////////////////////////////////////////// diff --git a/host/lib/usrp/b200/b200_impl.hpp b/host/lib/usrp/b200/b200_impl.hpp index 3ca76fce6..130e93891 100644 --- a/host/lib/usrp/b200/b200_impl.hpp +++ b/host/lib/usrp/b200/b200_impl.hpp @@ -28,7 +28,7 @@  #include "tx_vita_core_3000.hpp"  #include "time_core_3000.hpp"  #include "gpio_atr_3000.hpp" -#include "b200_radio_ctrl_core.hpp" +#include "radio_ctrl_core_3000.hpp"  #include "rx_dsp_core_3000.hpp"  #include "tx_dsp_core_3000.hpp"  #include <uhd/device.hpp> @@ -131,7 +131,7 @@ private:      //controllers      b200_iface::sptr _iface; -    b200_radio_ctrl_core::sptr _local_ctrl; +    radio_ctrl_core_3000::sptr _local_ctrl;      uhd::usrp::ad9361_ctrl::sptr _codec_ctrl;      uhd::usrp::ad936x_manager::sptr _codec_mgr;      b200_local_spi_core::sptr _spi_iface; @@ -154,8 +154,8 @@ private:      struct AsyncTaskData      {          boost::shared_ptr<async_md_type> async_md; -        boost::weak_ptr<b200_radio_ctrl_core> local_ctrl; -        boost::weak_ptr<b200_radio_ctrl_core> radio_ctrl[2]; +        boost::weak_ptr<radio_ctrl_core_3000> local_ctrl; +        boost::weak_ptr<radio_ctrl_core_3000> radio_ctrl[2];          b200_uart::sptr gpsdo_uart;      };      boost::shared_ptr<AsyncTaskData> _async_task_data; @@ -179,7 +179,7 @@ private:      //perifs in the radio core      struct radio_perifs_t      { -        b200_radio_ctrl_core::sptr ctrl; +        radio_ctrl_core_3000::sptr ctrl;          uhd::usrp::gpio_atr::gpio_atr_3000::sptr atr;          uhd::usrp::gpio_atr::gpio_atr_3000::sptr fp_gpio;          time_core_3000::sptr time64; diff --git a/host/lib/usrp/b200/b200_io_impl.cpp b/host/lib/usrp/b200/b200_io_impl.cpp index d186ec907..283091140 100644 --- a/host/lib/usrp/b200/b200_io_impl.cpp +++ b/host/lib/usrp/b200/b200_io_impl.cpp @@ -318,7 +318,7 @@ boost::optional<uhd::msg_task::msg_type_t> b200_impl::handle_async_task(      case B200_RESP1_MSG_SID:      case B200_LOCAL_RESP_SID:      { -    	b200_radio_ctrl_core::sptr ctrl; +    	radio_ctrl_core_3000::sptr ctrl;          if (sid == B200_RESP0_MSG_SID) ctrl = data->radio_ctrl[0].lock();          if (sid == B200_RESP1_MSG_SID) ctrl = data->radio_ctrl[1].lock();          if (sid == B200_LOCAL_RESP_SID) ctrl = data->local_ctrl.lock(); diff --git a/host/lib/usrp/b200/b200_radio_ctrl_core.cpp b/host/lib/usrp/b200/b200_radio_ctrl_core.cpp deleted file mode 100644 index b6d8f95df..000000000 --- a/host/lib/usrp/b200/b200_radio_ctrl_core.cpp +++ /dev/null @@ -1,347 +0,0 @@ -// -// 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 -// 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 "b200_radio_ctrl_core.hpp" -#include "async_packet_handler.hpp" -#include <uhd/exception.hpp> -#include <uhd/utils/msg.hpp> -#include <uhd/utils/byteswap.hpp> -#include <uhd/utils/safe_call.hpp> -#include <uhd/transport/bounded_buffer.hpp> -#include <uhd/transport/vrt_if_packet.hpp> -#include <boost/thread/mutex.hpp> -#include <boost/thread/thread.hpp> -#include <boost/format.hpp> -#include <boost/bind.hpp> -#include <queue> - -using namespace uhd; -using namespace uhd::usrp; -using namespace uhd::transport; - -static const double ACK_TIMEOUT = 2.0; //supposed to be worst case practical timeout -static const double MASSIVE_TIMEOUT = 10.0; //for when we wait on a timed command -static const size_t SR_READBACK = 32; - -b200_radio_ctrl_core::~b200_radio_ctrl_core(void){ -    /* NOP */ -} - -class b200_radio_ctrl_core_impl: public b200_radio_ctrl_core -{ -public: - -    b200_radio_ctrl_core_impl(const bool big_endian, -            uhd::transport::zero_copy_if::sptr ctrl_xport, -            uhd::transport::zero_copy_if::sptr resp_xport, -            const boost::uint32_t sid, const std::string &name) : -            _link_type(vrt::if_packet_info_t::LINK_TYPE_CHDR), _packet_type( -                    vrt::if_packet_info_t::PACKET_TYPE_CONTEXT), _bige( -                    big_endian), _ctrl_xport(ctrl_xport), _resp_xport( -                    resp_xport), _sid(sid), _name(name), _seq_out(0), _timeout( -                    ACK_TIMEOUT), _resp_queue(128/*max response msgs*/), _resp_queue_size( -                    _resp_xport ? _resp_xport->get_num_recv_frames() : 15) -    { -        if (resp_xport) -        { -            while (resp_xport->get_recv_buff(0.0)) {} //flush -        } -        this->set_time(uhd::time_spec_t(0.0)); -        this->set_tick_rate(1.0); //something possible but bogus -    } - -    ~b200_radio_ctrl_core_impl(void) -    { -        _timeout = ACK_TIMEOUT; //reset timeout to something small -        UHD_SAFE_CALL( -            this->peek32(0);//dummy peek with the purpose of ack'ing all packets -            _async_task.reset();//now its ok to release the task -        ) -    } - -    /******************************************************************* -     * Peek and poke 32 bit implementation -     ******************************************************************/ -    void poke32(const wb_addr_type addr, const boost::uint32_t data) -    { -        boost::mutex::scoped_lock lock(_mutex); -        this->send_pkt(addr/4, data); -        this->wait_for_ack(false); -    } - -    boost::uint32_t peek32(const wb_addr_type addr) -    { -        boost::mutex::scoped_lock lock(_mutex); -        this->send_pkt(SR_READBACK, addr/8); -        const boost::uint64_t res = this->wait_for_ack(true); -        const boost::uint32_t lo = boost::uint32_t(res & 0xffffffff); -        const boost::uint32_t hi = boost::uint32_t(res >> 32); -        return ((addr/4) & 0x1)? hi : lo; -    } - -    boost::uint64_t peek64(const wb_addr_type addr) -    { -        boost::mutex::scoped_lock lock(_mutex); -        this->send_pkt(SR_READBACK, addr/8); -        return this->wait_for_ack(true); -    } - -    /******************************************************************* -     * Update methods for time -     ******************************************************************/ -    void set_time(const uhd::time_spec_t &time) -    { -        boost::mutex::scoped_lock lock(_mutex); -        _time = time; -        _use_time = _time != uhd::time_spec_t(0.0); -        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; -    } - -private: -    // This is the buffer type for messages in radio control core. -    struct resp_buff_type -    { -        boost::uint32_t data[8]; -    }; - -    /******************************************************************* -     * Primary control and interaction private methods -     ******************************************************************/ -    UHD_INLINE void send_pkt(const boost::uint32_t addr, const boost::uint32_t data = 0) -    { -        managed_send_buffer::sptr buff = _ctrl_xport->get_send_buff(0.0); -        if (not buff) { -            throw uhd::runtime_error("fifo ctrl timed out getting a send buffer"); -        } -        boost::uint32_t *pkt = buff->cast<boost::uint32_t *>(); - -        //load packet info -        vrt::if_packet_info_t packet_info; -        packet_info.link_type = _link_type; -        packet_info.packet_type = _packet_type; -        packet_info.num_payload_words32 = 2; -        packet_info.num_payload_bytes = packet_info.num_payload_words32*sizeof(boost::uint32_t); -        packet_info.packet_count = _seq_out; -        packet_info.tsf = _time.to_ticks(_tick_rate); -        packet_info.sob = false; -        packet_info.eob = false; -        packet_info.sid = _sid; -        packet_info.has_sid = true; -        packet_info.has_cid = false; -        packet_info.has_tsi = false; -        packet_info.has_tsf = _use_time; -        packet_info.has_tlr = false; - -        //load header -        if (_bige) vrt::if_hdr_pack_be(pkt, packet_info); -        else vrt::if_hdr_pack_le(pkt, packet_info); - -        //load payload -        pkt[packet_info.num_header_words32+0] = (_bige)? uhd::htonx(addr) : uhd::htowx(addr); -        pkt[packet_info.num_header_words32+1] = (_bige)? uhd::htonx(data) : uhd::htowx(data); -        //UHD_MSG(status) << boost::format("0x%08x, 0x%08x\n") % addr % data; -        //send the buffer over the interface -        _outstanding_seqs.push(_seq_out); -        buff->commit(sizeof(boost::uint32_t)*(packet_info.num_packet_words32)); - -        _seq_out++;//inc seq for next call -    } - -    UHD_INLINE boost::uint64_t wait_for_ack(const bool readback) -    { -        while (readback or (_outstanding_seqs.size() >= _resp_queue_size)) -        { -            //get seq to ack from outstanding packets list -            UHD_ASSERT_THROW(not _outstanding_seqs.empty()); -            const size_t seq_to_ack = _outstanding_seqs.front(); -            _outstanding_seqs.pop(); - -            //parse the packet -            vrt::if_packet_info_t packet_info; -            resp_buff_type resp_buff; -            memset(&resp_buff, 0x00, sizeof(resp_buff)); -            boost::uint32_t const *pkt = NULL; -            managed_recv_buffer::sptr buff; - -            //get buffer from response endpoint - or die in timeout -            if (_resp_xport) -            { -                buff = _resp_xport->get_recv_buff(_timeout); -                try -                { -                    UHD_ASSERT_THROW(bool(buff)); -                    UHD_ASSERT_THROW(buff->size() > 0); -                } -                catch(const std::exception &ex) -                { -                    throw uhd::io_error(str(boost::format("Radio ctrl (%s) no response packet - %s") % _name % ex.what())); -                } -                pkt = buff->cast<const boost::uint32_t *>(); -                packet_info.num_packet_words32 = buff->size()/sizeof(boost::uint32_t); -            } - -            //get buffer from response endpoint - or die in timeout -            else -            { -                /* -                 * Couldn't get message with haste. -                 * Now check both possible queues for messages. -                 * Messages should come in on _resp_queue, -                 * but could end up in dump_queue. -                 * If we don't get a message --> Die in timeout. -                 */ -                double accum_timeout = 0.0; -                const double short_timeout = 0.005; // == 5ms -                while(not ((_resp_queue.pop_with_haste(resp_buff)) -                        || (check_dump_queue(resp_buff)) -                        || (_resp_queue.pop_with_timed_wait(resp_buff, short_timeout)) -                        )){ -                    /* -                     * If a message couldn't be received within a given timeout -                     * --> throw AssertionError! -                     */ -                    accum_timeout += short_timeout; -                    UHD_ASSERT_THROW(accum_timeout < _timeout); -                } - -                pkt = resp_buff.data; -                packet_info.num_packet_words32 = sizeof(resp_buff)/sizeof(boost::uint32_t); -            } - -            //parse the buffer -            try -            { -                packet_info.link_type = _link_type; -                if (_bige) vrt::if_hdr_unpack_be(pkt, packet_info); -                else vrt::if_hdr_unpack_le(pkt, packet_info); -            } -            catch(const std::exception &ex) -            { -                UHD_MSG(error) << "Radio ctrl bad VITA packet: " << ex.what() << std::endl; -                if (buff){ -                    UHD_VAR(buff->size()); -                } -                else{ -                    UHD_MSG(status) << "buff is NULL" << std::endl; -                } -                UHD_MSG(status) << std::hex << pkt[0] << std::dec << std::endl; -                UHD_MSG(status) << std::hex << pkt[1] << std::dec << std::endl; -                UHD_MSG(status) << std::hex << pkt[2] << std::dec << std::endl; -                UHD_MSG(status) << std::hex << pkt[3] << std::dec << std::endl; -            } - -            //check the buffer -            try -            { -                UHD_ASSERT_THROW(packet_info.has_sid); -                UHD_ASSERT_THROW(packet_info.sid == boost::uint32_t((_sid >> 16) | (_sid << 16))); -                UHD_ASSERT_THROW(packet_info.packet_count == (seq_to_ack & 0xfff)); -                UHD_ASSERT_THROW(packet_info.num_payload_words32 == 2); -                UHD_ASSERT_THROW(packet_info.packet_type == _packet_type); -            } -            catch(const std::exception &ex) -            { -                throw uhd::io_error(str(boost::format("Radio ctrl (%s) packet parse error - %s") % _name % ex.what())); -            } - -            //return the readback value -            if (readback and _outstanding_seqs.empty()) -            { -                const boost::uint64_t hi = (_bige)? uhd::ntohx(pkt[packet_info.num_header_words32+0]) : uhd::wtohx(pkt[packet_info.num_header_words32+0]); -                const boost::uint64_t lo = (_bige)? uhd::ntohx(pkt[packet_info.num_header_words32+1]) : uhd::wtohx(pkt[packet_info.num_header_words32+1]); -                return ((hi << 32) | lo); -            } -        } - -        return 0; -    } - -    /* -     * If ctrl_core waits for a message that didn't arrive it can search for it in the dump queue. -     * This actually happens during shutdown. -     * handle_async_task can't access radio_ctrl_cores queue anymore thus it returns the corresponding message. -     * msg_task class implements a dump_queue to store such messages. -     * With check_dump_queue we can check if a message we are waiting for got stranded there. -     * If a message got stuck we get it here and push it onto our own message_queue. -     */ -    bool check_dump_queue(resp_buff_type& b) { -        const size_t min_buff_size = 8; // Same value as in b200_io_impl->handle_async_task -        boost::uint32_t recv_sid = (((_sid)<<16)|((_sid)>>16)); -        uhd::msg_task::msg_payload_t msg; -        do{ -            msg = _async_task->get_msg_from_dump_queue(recv_sid); -        } -        while(msg.size() < min_buff_size && msg.size() != 0); - -        if(msg.size() >= min_buff_size) { -            memcpy(b.data, &msg.front(), std::min(msg.size(), sizeof(b.data))); -            return true; -        } -        return false; -    } - -    void push_response(const boost::uint32_t *buff) -    { -        resp_buff_type resp_buff; -        std::memcpy(resp_buff.data, buff, sizeof(resp_buff)); -        _resp_queue.push_with_haste(resp_buff); -    } - -    void hold_task(uhd::msg_task::sptr task) -    { -        _async_task = task; -    } - -    const vrt::if_packet_info_t::link_type_t _link_type; -    const vrt::if_packet_info_t::packet_type_t _packet_type; -    const bool _bige; -    const uhd::transport::zero_copy_if::sptr _ctrl_xport; -    const uhd::transport::zero_copy_if::sptr _resp_xport; -    uhd::msg_task::sptr _async_task; -    const boost::uint32_t _sid; -    const std::string _name; -    boost::mutex _mutex; -    size_t _seq_out; -    uhd::time_spec_t _time; -    bool _use_time; -    double _tick_rate; -    double _timeout; -    std::queue<size_t> _outstanding_seqs; -    bounded_buffer<resp_buff_type> _resp_queue; -    const size_t _resp_queue_size; -}; - -b200_radio_ctrl_core::sptr b200_radio_ctrl_core::make(const bool big_endian, -        zero_copy_if::sptr ctrl_xport, zero_copy_if::sptr resp_xport, -        const boost::uint32_t sid, const std::string &name) -{ -    return sptr( -            new b200_radio_ctrl_core_impl(big_endian, ctrl_xport, resp_xport, -                    sid, name)); -} diff --git a/host/lib/usrp/b200/b200_radio_ctrl_core.hpp b/host/lib/usrp/b200/b200_radio_ctrl_core.hpp deleted file mode 100644 index 51f7e3301..000000000 --- a/host/lib/usrp/b200/b200_radio_ctrl_core.hpp +++ /dev/null @@ -1,64 +0,0 @@ -// -// 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 -// 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_LIBUHD_USRP_B200_RADIO_CTRL_HPP -#define INCLUDED_LIBUHD_USRP_B200_RADIO_CTRL_HPP - -#include <uhd/utils/msg_task.hpp> -#include <uhd/types/time_spec.hpp> -#include <uhd/transport/zero_copy.hpp> -#include <uhd/types/wb_iface.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/utility.hpp> -#include <string> - -/*! - * Provide access to peek, poke for the radio ctrl module - */ -class b200_radio_ctrl_core : public uhd::timed_wb_iface -{ -public: -    typedef boost::shared_ptr<b200_radio_ctrl_core> sptr; - -    virtual ~b200_radio_ctrl_core(void) = 0; - -    //! Make a new control object -    static sptr make( -        const bool big_endian, -        uhd::transport::zero_copy_if::sptr ctrl_xport, -        uhd::transport::zero_copy_if::sptr resp_xport, -        const boost::uint32_t sid, -        const std::string &name = "0" -    ); - -    //! Hold a ref to a task thats feeding push response -    virtual void hold_task(uhd::msg_task::sptr task) = 0; - -    //! Push a response externall (resp_xport is NULL) -    virtual void push_response(const boost::uint32_t *buff) = 0; - -    //! 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; -}; - -#endif /* INCLUDED_LIBUHD_USRP_B200_RADIO_CTRL_HPP */ diff --git a/host/lib/usrp/dboard/twinrx/twinrx_experts.hpp b/host/lib/usrp/dboard/twinrx/twinrx_experts.hpp index f2601a09b..1617c9c80 100644 --- a/host/lib/usrp/dboard/twinrx/twinrx_experts.hpp +++ b/host/lib/usrp/dboard/twinrx/twinrx_experts.hpp @@ -266,12 +266,16 @@ public:      : experts::worker_node_t(prepend_ch("twinrx_nyquist_expert", ch)),        _channel          (ch),        _codec_conn       (ch=="0"?"II":"QQ"),    //Ch->ADC Port mapping +      _lo1_freq_d       (db, prepend_ch("los/LO1/freq/desired", ch)), +      _lo2_freq_d       (db, prepend_ch("los/LO2/freq/desired", ch)),        _if_freq_d        (db, prepend_ch("if_freq/desired", ch)),        _lo1_inj_side     (db, prepend_ch("ch/LO1/inj_side", ch)),        _lo2_inj_side     (db, prepend_ch("ch/LO2/inj_side", ch)),        _if_freq_c        (db, prepend_ch("if_freq/coerced", ch)),        _db_iface         (db_iface)      { +        bind_accessor(_lo1_freq_d); +        bind_accessor(_lo2_freq_d);          bind_accessor(_if_freq_d);          bind_accessor(_lo1_inj_side);          bind_accessor(_lo2_inj_side); @@ -284,6 +288,8 @@ private:      //Inputs      const std::string                                       _channel;      const std::string                                       _codec_conn; +    experts::data_reader_t<double>                          _lo1_freq_d; +    experts::data_reader_t<double>                          _lo2_freq_d;      experts::data_reader_t<double>                          _if_freq_d;      experts::data_reader_t<lo_inj_side_t>                   _lo1_inj_side;      experts::data_reader_t<lo_inj_side_t>                   _lo2_inj_side; diff --git a/host/lib/usrp/x300/x300_impl.cpp b/host/lib/usrp/x300/x300_impl.cpp index 5f47c35ed..7f7fcad09 100644 --- a/host/lib/usrp/x300/x300_impl.cpp +++ b/host/lib/usrp/x300/x300_impl.cpp @@ -626,10 +626,12 @@ void x300_impl::setup_mb(const size_t mb_i, const uhd::device_addr_t &dev_addr)          }          if ((mb.recv_args.has_key("recv_frame_size")) -                && (req_max_frame_size.recv_frame_size < _max_frame_sizes.recv_frame_size)) { +                && (req_max_frame_size.recv_frame_size > _max_frame_sizes.recv_frame_size)) {              UHD_MSG(warning)                  << boost::format("You requested a receive frame size of (%lu) but your NIC's max frame size is (%lu).") -                % req_max_frame_size.recv_frame_size << _max_frame_sizes.recv_frame_size << std::endl +                % req_max_frame_size.recv_frame_size +                % _max_frame_sizes.recv_frame_size +                << std::endl                  << boost::format("Please verify your NIC's MTU setting using '%s' or set the recv_frame_size argument appropriately.")                  % mtu_tool << std::endl                  << "UHD will use the auto-detected max frame size for this connection." @@ -637,10 +639,12 @@ void x300_impl::setup_mb(const size_t mb_i, const uhd::device_addr_t &dev_addr)          }          if ((mb.recv_args.has_key("send_frame_size")) -                && (req_max_frame_size.send_frame_size < _max_frame_sizes.send_frame_size)) { +                && (req_max_frame_size.send_frame_size > _max_frame_sizes.send_frame_size)) {              UHD_MSG(warning)                  << boost::format("You requested a send frame size of (%lu) but your NIC's max frame size is (%lu).") -                % req_max_frame_size.send_frame_size << _max_frame_sizes.send_frame_size << std::endl +                % req_max_frame_size.send_frame_size +                % _max_frame_sizes.send_frame_size +                << std::endl                  << boost::format("Please verify your NIC's MTU setting using '%s' or set the send_frame_size argument appropriately.")                  % mtu_tool << std::endl                  << "UHD will use the auto-detected max frame size for this connection." @@ -1494,10 +1498,11 @@ x300_impl::frame_size_t x300_impl::determine_max_frame_size(const std::string &a      if (!(uhd::ntohx<boost::uint32_t>(request->flags) & X300_MTU_DETECT_ECHO_REPLY))          throw uhd::not_implemented_error("Holler protocol not implemented"); +    //Reducing range of (min,max) by setting max value to 10gig max_frame_size as larger sizes are not supported      size_t min_recv_frame_size = sizeof(x300_mtu_t); -    size_t max_recv_frame_size = user_frame_size.recv_frame_size; +    size_t max_recv_frame_size = std::min(user_frame_size.recv_frame_size, X300_10GE_DATA_FRAME_MAX_SIZE) & size_t(~3);      size_t min_send_frame_size = sizeof(x300_mtu_t); -    size_t max_send_frame_size = user_frame_size.send_frame_size; +    size_t max_send_frame_size = std::min(user_frame_size.send_frame_size, X300_10GE_DATA_FRAME_MAX_SIZE) & size_t(~3);      UHD_MSG(status) << "Determining maximum frame size... ";      while (min_recv_frame_size < max_recv_frame_size) | 
