From ccd681e45937216b400f6bda326f11627a7e6def Mon Sep 17 00:00:00 2001 From: "Kevin Gilbert (kegilbert)" Date: Wed, 7 Dec 2016 15:09:34 -0600 Subject: Move motherboard index increment to after channel map index. This will properly map the channel index to the motherboard in chan_to_mcp(...). --- host/lib/rfnoc/legacy_compat.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/host/lib/rfnoc/legacy_compat.cpp b/host/lib/rfnoc/legacy_compat.cpp index 631e89273..e235bdbbd 100644 --- a/host/lib/rfnoc/legacy_compat.cpp +++ b/host/lib/rfnoc/legacy_compat.cpp @@ -446,8 +446,7 @@ private: // methods mboard_idx = 0; mb_chan_idx = chan; while (mb_chan_idx >= chan_map[mboard_idx].size()) { - mboard_idx++; - mb_chan_idx -= chan_map[mboard_idx].size(); + mb_chan_idx -= chan_map[mboard_idx++].size(); } if (mboard_idx >= chan_map.size()) { throw uhd::index_error(str( -- cgit v1.2.3 From a2e59940dcdeb7ba120339a823c34f8d31cf322e Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Tue, 6 Dec 2016 12:34:22 -0800 Subject: x300: Make PCIe muxing and connection multi-usrp capable --- host/lib/usrp/x300/x300_impl.cpp | 12 ++++++------ host/lib/usrp/x300/x300_impl.hpp | 22 +++++++++++++--------- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/host/lib/usrp/x300/x300_impl.cpp b/host/lib/usrp/x300/x300_impl.cpp index 959245135..494598bf3 100644 --- a/host/lib/usrp/x300/x300_impl.cpp +++ b/host/lib/usrp/x300/x300_impl.cpp @@ -1025,14 +1025,14 @@ x300_impl::~x300_impl(void) } } -uint32_t x300_impl::allocate_pcie_dma_chan(const uhd::sid_t &tx_sid, const xport_type_t xport_type) +uint32_t x300_impl::mboard_members_t::allocate_pcie_dma_chan(const uhd::sid_t &tx_sid, const xport_type_t xport_type) { static const uint32_t CTRL_CHANNEL = 0; static const uint32_t FIRST_DATA_CHANNEL = 1; if (xport_type == CTRL) { return CTRL_CHANNEL; } else { - // sid_t has no comparison defined + // sid_t has no comparison defined, so we need to convert it uint32_t uint32_t raw_sid = tx_sid.get(); if (_dma_chan_pool.count(raw_sid) == 0) { @@ -1067,10 +1067,10 @@ uhd::both_xports_t x300_impl::make_transport( xports.send_sid = this->allocate_sid(mb, address, X300_SRC_ADDR0, X300_XB_DST_PCI); xports.recv_sid = xports.send_sid.reversed(); - uint32_t dma_channel_num = allocate_pcie_dma_chan(xports.send_sid, xport_type); + uint32_t dma_channel_num = mb.allocate_pcie_dma_chan(xports.send_sid, xport_type); if (xport_type == CTRL) { //Transport for control stream - if (_ctrl_dma_xport.get() == NULL) { + if (not mb.ctrl_dma_xport) { //One underlying DMA channel will handle //all control traffic zero_copy_xport_params ctrl_buff_args; @@ -1082,10 +1082,10 @@ uhd::both_xports_t x300_impl::make_transport( zero_copy_if::sptr base_xport = nirio_zero_copy::make( mb.rio_fpga_interface, dma_channel_num, ctrl_buff_args, uhd::device_addr_t()); - _ctrl_dma_xport = muxed_zero_copy_if::make(base_xport, extract_sid_from_pkt, X300_PCIE_MAX_MUXED_XPORTS); + mb.ctrl_dma_xport = muxed_zero_copy_if::make(base_xport, extract_sid_from_pkt, X300_PCIE_MAX_MUXED_XPORTS); } //Create a virtual control transport - xports.recv = _ctrl_dma_xport->make_stream(xports.recv_sid.get_dst()); + xports.recv = mb.ctrl_dma_xport->make_stream(xports.recv_sid.get_dst()); } else { //Transport for data stream default_buff_args.send_frame_size = diff --git a/host/lib/usrp/x300/x300_impl.hpp b/host/lib/usrp/x300/x300_impl.hpp index ff18b1a22..db5396008 100644 --- a/host/lib/usrp/x300/x300_impl.hpp +++ b/host/lib/usrp/x300/x300_impl.hpp @@ -191,6 +191,19 @@ private: std::string current_refclk_src; std::vector radios; + + // PCIe specific components: + + //! Maps SID -> DMA channel + std::map _dma_chan_pool; + //! Control transport for one PCIe connection + uhd::transport::muxed_zero_copy_if::sptr ctrl_dma_xport; + + /*! Allocate or return a previously allocated PCIe channel pair + * + * Note the SID is always the transmit SID (i.e. from host to device). + */ + uint32_t allocate_pcie_dma_chan(const uhd::sid_t &tx_sid, const xport_type_t xport_type); }; std::vector _mb; @@ -224,15 +237,6 @@ private: */ frame_size_t determine_max_frame_size(const std::string &addr, const frame_size_t &user_mtu); - std::map _dma_chan_pool; - uhd::transport::muxed_zero_copy_if::sptr _ctrl_dma_xport; - - /*! Allocate or return a previously allocated PCIe channel pair - * - * Note the SID is always the transmit SID (i.e. from host to device). - */ - uint32_t allocate_pcie_dma_chan(const uhd::sid_t &tx_sid, const xport_type_t xport_type); - //////////////////////////////////////////////////////////////////// // //Caching for transport interface re-use -- like sharing a DMA. -- cgit v1.2.3 From 5efe1c0f124d1068bbc9bd882db5530ca2ca0377 Mon Sep 17 00:00:00 2001 From: Andrej Rode Date: Thu, 17 Nov 2016 16:12:47 -0800 Subject: X300: dont stop x300_find if receiving wrong flags Just skip current receive buffer and do not stop processing udp packets completely. --- host/lib/usrp/x300/x300_impl.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/host/lib/usrp/x300/x300_impl.cpp b/host/lib/usrp/x300/x300_impl.cpp index 494598bf3..fffd6ecac 100644 --- a/host/lib/usrp/x300/x300_impl.cpp +++ b/host/lib/usrp/x300/x300_impl.cpp @@ -105,8 +105,8 @@ static device_addrs_t x300_find_with_addr(const device_addr_t &hint) const size_t nbytes = comm->recv(asio::buffer(buff), 0.050); if (nbytes == 0) break; const x300_fw_comms_t *reply = (const x300_fw_comms_t *)buff; - if (request.flags != reply->flags) break; - if (request.sequence != reply->sequence) break; + if (request.flags != reply->flags) continue; + if (request.sequence != reply->sequence) continue; device_addr_t new_addr; new_addr["type"] = "x300"; new_addr["addr"] = comm->get_recv_addr(); -- cgit v1.2.3 From 548e14cfd6ee03ebb66bcad13648529d4a17f4e4 Mon Sep 17 00:00:00 2001 From: michael-west Date: Fri, 9 Dec 2016 16:15:40 -0800 Subject: GPIO: Set CTRL register before OUT register in GPIO example. --- host/examples/gpio.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/host/examples/gpio.cpp b/host/examples/gpio.cpp index 1a1b2982f..02c73e96b 100644 --- a/host/examples/gpio.cpp +++ b/host/examples/gpio.cpp @@ -228,6 +228,9 @@ int UHD_SAFE_MAIN(int argc, char *argv[]) //set data direction register (DDR) usrp->set_gpio_attr(gpio, "DDR", ddr, mask); + //set control register + usrp->set_gpio_attr(gpio, "CTRL", ctrl, mask); + //set output values (OUT) usrp->set_gpio_attr(gpio, "OUT", out, mask); @@ -237,9 +240,6 @@ int UHD_SAFE_MAIN(int argc, char *argv[]) usrp->set_gpio_attr(gpio, "ATR_TX", atr_tx, mask); usrp->set_gpio_attr(gpio, "ATR_XX", atr_duplex, mask); - //set control register - usrp->set_gpio_attr(gpio, "CTRL", ctrl, mask); - //print out initial state of FP GPIO std::cout << "\nConfigured GPIO values:" << std::endl; output_reg_values(gpio, usrp, num_bits); -- cgit v1.2.3 From d5ba9fab6a5133bf6a1a88d9fae0f200b1993ba5 Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Fri, 9 Dec 2016 19:15:27 -0800 Subject: tests: Added bitbang test, added to x3x0 devtest --- host/tests/devtest/bitbang_test.py | 48 ++++++++++++++++++++++++++++++++++++++ host/tests/devtest/devtest_x3x0.py | 1 + host/tests/devtest/gpio_test.py | 2 +- 3 files changed, 50 insertions(+), 1 deletion(-) create mode 100755 host/tests/devtest/bitbang_test.py diff --git a/host/tests/devtest/bitbang_test.py b/host/tests/devtest/bitbang_test.py new file mode 100755 index 000000000..24295c5cd --- /dev/null +++ b/host/tests/devtest/bitbang_test.py @@ -0,0 +1,48 @@ +# +# Copyright 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 . +# +""" Test for gpio --bitbang. """ + +import re +from uhd_test_base import uhd_example_test_case + +class bitbang_test(uhd_example_test_case): + """ Run gpio --bitbang. """ + tests = {'default': {},} + + def setup_example(self): + """ + Set args. + """ + self.test_params = bitbang_test.tests + + def run_test(self, test_name, test_args): + """ Run the app and scrape for the success message. """ + self.log.info('Running test {n}'.format(n=test_name,)) + # Run example: + args = [ + self.create_addr_args_str(), + '--bitbang', + ] + (app, run_results) = self.run_example('gpio', args) + # Evaluate pass/fail: + run_results['passed'] = all([ + app.returncode == 0, + # re.search('All tests passed!', app.stdout) is not None, + ]) + self.report_example_results(test_name, run_results) + return run_results + diff --git a/host/tests/devtest/devtest_x3x0.py b/host/tests/devtest/devtest_x3x0.py index dd62d8910..fc6e6b8ef 100755 --- a/host/tests/devtest/devtest_x3x0.py +++ b/host/tests/devtest/devtest_x3x0.py @@ -62,4 +62,5 @@ uhd_benchmark_rate_test.tests = { from tx_bursts_test import uhd_tx_bursts_test from test_pps_test import uhd_test_pps_test from gpio_test import gpio_test +from bitbang_test import bitbang_test diff --git a/host/tests/devtest/gpio_test.py b/host/tests/devtest/gpio_test.py index d764a8d96..6ea4413f4 100755 --- a/host/tests/devtest/gpio_test.py +++ b/host/tests/devtest/gpio_test.py @@ -14,7 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -""" Test for test_pps_input. """ +""" Test for gpio. """ import re from uhd_test_base import uhd_example_test_case -- cgit v1.2.3 From fcce983e417b2868a1b66f435fad52780c9a2dc6 Mon Sep 17 00:00:00 2001 From: michael-west Date: Mon, 12 Dec 2016 18:07:51 -0800 Subject: Fix typo causing channel list generation to fail. --- host/lib/usrp/device3/device3_io_impl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/host/lib/usrp/device3/device3_io_impl.cpp b/host/lib/usrp/device3/device3_io_impl.cpp index 386b4d66e..b4aac71bf 100644 --- a/host/lib/usrp/device3/device3_io_impl.cpp +++ b/host/lib/usrp/device3/device3_io_impl.cpp @@ -114,7 +114,7 @@ void generate_channel_list( if (args.args.has_key(key)) { chan_list_[i] = args.args.pop(key); } else if (args.args.has_key("block_id")) { - chan_list[i] = args.args["block_id"]; + chan_list_[i] = args.args["block_id"]; } else { throw uhd::runtime_error(str( boost::format("Cannot create streamers: No block_id specified for channel %d.") -- cgit v1.2.3 From 289dd9446285ab3a04e8e26370159a050f6c5e09 Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Mon, 12 Dec 2016 17:12:57 -0800 Subject: rfnoc: Removed stray print in legacy_compat --- host/lib/rfnoc/legacy_compat.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/host/lib/rfnoc/legacy_compat.cpp b/host/lib/rfnoc/legacy_compat.cpp index e235bdbbd..a396fd677 100644 --- a/host/lib/rfnoc/legacy_compat.cpp +++ b/host/lib/rfnoc/legacy_compat.cpp @@ -349,7 +349,6 @@ public: } } BOOST_FOREACH(const size_t this_chan, chans_to_change) { - UHD_MSG(status) << "setting rate on chan " << this_chan << " " << rate << std::endl; size_t mboard, mb_chan; chan_to_mcp(this_chan, _rx_channel_map, mboard, mb_chan); const size_t dsp_index = _rx_channel_map[mboard][mb_chan].radio_index; -- cgit v1.2.3 From 582553984cfd70ae11f5c12da568e4a0a74888d2 Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Tue, 13 Dec 2016 10:43:45 -0800 Subject: x300: Made MTU throttling more explicit in x300 header files --- host/lib/usrp/x300/x300_impl.cpp | 2 +- host/lib/usrp/x300/x300_impl.hpp | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/host/lib/usrp/x300/x300_impl.cpp b/host/lib/usrp/x300/x300_impl.cpp index fffd6ecac..50a7f3ded 100644 --- a/host/lib/usrp/x300/x300_impl.cpp +++ b/host/lib/usrp/x300/x300_impl.cpp @@ -652,7 +652,7 @@ void x300_impl::setup_mb(const size_t mb_i, const uhd::device_addr_t &dev_addr) } _tree->create(mb_path / "mtu/recv").set(_max_frame_sizes.recv_frame_size); - _tree->create(mb_path / "mtu/send").set(std::min(_max_frame_sizes.send_frame_size, X300_1GE_DATA_FRAME_MAX_SIZE)); + _tree->create(mb_path / "mtu/send").set(std::min(_max_frame_sizes.send_frame_size, X300_ETH_DATA_FRAME_MAX_TX_SIZE)); _tree->create(mb_path / "link_max_rate").set(X300_MAX_RATE_10GIGE); } diff --git a/host/lib/usrp/x300/x300_impl.hpp b/host/lib/usrp/x300/x300_impl.hpp index db5396008..e292e2d68 100644 --- a/host/lib/usrp/x300/x300_impl.hpp +++ b/host/lib/usrp/x300/x300_impl.hpp @@ -67,6 +67,8 @@ static const size_t X300_PCIE_MAX_MUXED_XPORTS = 32; static const size_t X300_10GE_DATA_FRAME_MAX_SIZE = 8000; // CHDR packet size in bytes static const size_t X300_1GE_DATA_FRAME_MAX_SIZE = 1472; // CHDR packet size in bytes static const size_t X300_ETH_MSG_FRAME_SIZE = uhd::transport::udp_simple::mtu; //bytes +// MTU throttling for ethernet/TX (see above): +static const size_t X300_ETH_DATA_FRAME_MAX_TX_SIZE = 2000; static const double X300_THREAD_BUFFER_TIMEOUT = 0.1; // Time in seconds -- cgit v1.2.3