diff options
-rw-r--r-- | host/include/uhd/rfnoc/blocks/radio_magnesium.xml | 60 | ||||
-rw-r--r-- | host/lib/usrp/CMakeLists.txt | 1 | ||||
-rw-r--r-- | host/lib/usrp/magnesium/CMakeLists.txt | 24 | ||||
-rw-r--r-- | host/lib/usrp/magnesium/magnesium_radio_ctrl_impl.cpp | 99 | ||||
-rw-r--r-- | host/lib/usrp/magnesium/magnesium_radio_ctrl_impl.hpp | 72 | ||||
-rw-r--r-- | host/lib/usrp/netd/netd_impl.cpp | 25 |
6 files changed, 279 insertions, 2 deletions
diff --git a/host/include/uhd/rfnoc/blocks/radio_magnesium.xml b/host/include/uhd/rfnoc/blocks/radio_magnesium.xml new file mode 100644 index 000000000..55065d0d3 --- /dev/null +++ b/host/include/uhd/rfnoc/blocks/radio_magnesium.xml @@ -0,0 +1,60 @@ +<!--This defines one NoC-Block.--> +<nocblock> + <name>Radio (Magnesium)</name> + <blockname>Radio</blockname> + <key>MagnesiumRadio</key> + <!--There can be several of these:--> + <ids> + <id revision="0">12AD100000000003</id> + </ids> + <!-- Registers --> + <registers> + <!--<setreg>--> + <!--<name>FFT_RESET</name>--> + <!--<address>131</address>--> + <!--</setreg>--> + <!--<readback>--> + <!--<name>RB_MAGNITUDE_OUT</name>--> + <!--<address>1</address>--> + <!--</readback>--> + </registers> + <!-- Args --> + <args> + <arg> + <name>spp</name> + <type>int</type> + <value>364</value> + <!--<value>256</value>--> + <!--<check>GE($spp, 16) AND LE($spp, 4096) AND IS_PWR_OF_2($spp)</check>--> + <!--<check_message>FFT size must be in [16, 4096] and a power of two.</check_message>--> + <!--<action>SR_WRITE("FFT_SIZE_LOG2", LOG2($spp)) AND SR_WRITE("AXIS_CONFIG_BUS", ADD(873472, LOG2($spp)))</action>--> + </arg> + </args> + <ports> + <sink> + <name>in0</name> + <type>sc16</type> + <!--<vlen>$spp</vlen>--> + <!--<pkt_size>%vlen</pkt_size>--> + </sink> + <sink> + <name>in1</name> + <type>sc16</type> + <!--<vlen>$spp</vlen>--> + <!--<pkt_size>%vlen</pkt_size>--> + </sink> + <source> + <name>out0</name> + <type>sc16</type> + <!--<vlen>$spp</vlen>--> + <!--<pkt_size>%vlen</pkt_size>--> + </source> + <source> + <name>out1</name> + <type>sc16</type> + <!--<vlen>$spp</vlen>--> + <!--<pkt_size>%vlen</pkt_size>--> + </source> + </ports> +</nocblock> + diff --git a/host/lib/usrp/CMakeLists.txt b/host/lib/usrp/CMakeLists.txt index 0f8172d41..6d69093e9 100644 --- a/host/lib/usrp/CMakeLists.txt +++ b/host/lib/usrp/CMakeLists.txt @@ -49,3 +49,4 @@ INCLUDE_SUBDIRECTORY(e300) INCLUDE_SUBDIRECTORY(x300) INCLUDE_SUBDIRECTORY(b200) INCLUDE_SUBDIRECTORY(n230) +INCLUDE_SUBDIRECTORY(magnesium) diff --git a/host/lib/usrp/magnesium/CMakeLists.txt b/host/lib/usrp/magnesium/CMakeLists.txt new file mode 100644 index 000000000..6d3f53fba --- /dev/null +++ b/host/lib/usrp/magnesium/CMakeLists.txt @@ -0,0 +1,24 @@ +# +# Copyright 2017 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/>. +# + +IF(ENABLE_NETD) + LIST(APPEND MAGNESIUM_SOURCES + ${CMAKE_CURRENT_SOURCE_DIR}/magnesium_radio_ctrl_impl.cpp + ) + LIBUHD_APPEND_SOURCES(${MAGNESIUM_SOURCES}) +ENDIF(ENABLE_NETD) + diff --git a/host/lib/usrp/magnesium/magnesium_radio_ctrl_impl.cpp b/host/lib/usrp/magnesium/magnesium_radio_ctrl_impl.cpp new file mode 100644 index 000000000..6bac969ed --- /dev/null +++ b/host/lib/usrp/magnesium/magnesium_radio_ctrl_impl.cpp @@ -0,0 +1,99 @@ +// +// Copyright 2017 Ettus Research +// +// 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 "magnesium_radio_ctrl_impl.hpp" + +#include <uhd/utils/log.hpp> +#include <uhd/rfnoc/node_ctrl_base.hpp> +#include <uhd/transport/chdr.hpp> +#include <uhd/utils/math.hpp> +#include <boost/algorithm/string.hpp> +#include <boost/make_shared.hpp> +#include <boost/date_time/posix_time/posix_time_io.hpp> + +using namespace uhd; +using namespace uhd::usrp; +using namespace uhd::rfnoc; + +static const size_t IO_MASTER_RADIO = 0; + +UHD_RFNOC_RADIO_BLOCK_CONSTRUCTOR(magnesium_radio_ctrl) +{ + std::cout << "magnesium_radio_ctrl_impl::ctor() " << std::endl; +} + +magnesium_radio_ctrl_impl::~magnesium_radio_ctrl_impl() +{ +} + + +double magnesium_radio_ctrl_impl::set_rate(double rate) +{ +} + +void magnesium_radio_ctrl_impl::set_tx_antenna(const std::string &ant, const size_t chan) +{ +} + +void magnesium_radio_ctrl_impl::set_rx_antenna(const std::string &ant, const size_t chan) +{ +} + +double magnesium_radio_ctrl_impl::set_tx_frequency(const double freq, const size_t chan) +{ +} + +double magnesium_radio_ctrl_impl::set_rx_frequency(const double freq, const size_t chan) +{ +} + +double magnesium_radio_ctrl_impl::set_rx_bandwidth(const double bandwidth, const size_t chan) +{ +} + +double magnesium_radio_ctrl_impl::get_tx_frequency(const size_t chan) +{ +} + +double magnesium_radio_ctrl_impl::get_rx_frequency(const size_t chan) +{ +} + +double magnesium_radio_ctrl_impl::get_rx_bandwidth(const size_t chan) +{ +} + +double magnesium_radio_ctrl_impl::set_tx_gain(const double gain, const size_t chan) +{ +} + +double magnesium_radio_ctrl_impl::set_rx_gain(const double gain, const size_t chan) +{ +} + +size_t magnesium_radio_ctrl_impl::get_chan_from_dboard_fe(const std::string &fe, const direction_t dir) +{ +} + +std::string magnesium_radio_ctrl_impl::get_dboard_fe_from_chan(const size_t chan, const direction_t dir) { +} + +double magnesium_radio_ctrl_impl::get_output_samp_rate(size_t port) +{ +} + +UHD_RFNOC_BLOCK_REGISTER(magnesium_radio_ctrl, "MagnesiumRadio"); diff --git a/host/lib/usrp/magnesium/magnesium_radio_ctrl_impl.hpp b/host/lib/usrp/magnesium/magnesium_radio_ctrl_impl.hpp new file mode 100644 index 000000000..ea8282532 --- /dev/null +++ b/host/lib/usrp/magnesium/magnesium_radio_ctrl_impl.hpp @@ -0,0 +1,72 @@ +// +// Copyright 2017 Ettus Research +// +// 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_RFNOC_MAGNESIUM_RADIO_CTRL_IMPL_HPP +#define INCLUDED_LIBUHD_RFNOC_MAGNESIUM_RADIO_CTRL_IMPL_HPP + +#include "radio_ctrl_impl.hpp" +#include <uhd/usrp/dboard_manager.hpp> +#include <uhd/usrp/gpio_defs.hpp> + +namespace uhd { + namespace rfnoc { + +/*! \brief Provide access to an Magnesium radio. + */ +class magnesium_radio_ctrl_impl : public radio_ctrl_impl +{ +public: + typedef boost::shared_ptr<magnesium_radio_ctrl_impl> sptr; + + /************************************************************************ + * Structors + ***********************************************************************/ + UHD_RFNOC_RADIO_BLOCK_CONSTRUCTOR_DECL(magnesium_radio_ctrl) + virtual ~magnesium_radio_ctrl_impl(); + + /************************************************************************ + * API calls + ***********************************************************************/ + double set_rate(double rate); + + void set_tx_antenna(const std::string &ant, const size_t chan); + void set_rx_antenna(const std::string &ant, const size_t chan); + + double set_tx_frequency(const double freq, const size_t chan); + double set_rx_frequency(const double freq, const size_t chan); + double set_rx_bandwidth(const double bandwidth, const size_t chan); + double get_tx_frequency(const size_t chan); + double get_rx_frequency(const size_t chan); + double get_rx_bandwidth(const size_t chan); + + double set_tx_gain(const double gain, const size_t chan); + double set_rx_gain(const double gain, const size_t chan); + + size_t get_chan_from_dboard_fe(const std::string &fe, const direction_t dir); + std::string get_dboard_fe_from_chan(const size_t chan, const direction_t dir); + + double get_output_samp_rate(size_t port); + + + +}; /* class radio_ctrl_impl */ + +}} /* namespace uhd::rfnoc */ + +#endif /* INCLUDED_LIBUHD_RFNOC_MAGNESIUM_RADIO_CTRL_IMPL_HPP */ +// vim: sw=4 et: + diff --git a/host/lib/usrp/netd/netd_impl.cpp b/host/lib/usrp/netd/netd_impl.cpp index 555aedea5..5a8b3e59c 100644 --- a/host/lib/usrp/netd/netd_impl.cpp +++ b/host/lib/usrp/netd/netd_impl.cpp @@ -71,6 +71,15 @@ netd_mboard_impl::netd_mboard_impl(const std::string& addr) //} //} } + +uhd::sid_t netd_mboard_impl::allocate_sid(const uint16_t port, + const uhd::sid_t address, + const uint32_t xbar_src_addr, + const uint32_t xbar_src_port){ + const uint32_t sid = rpc.call<uint32_t>("allocate_sid", _rpc_token, port, + address.get(), xbar_src_addr, xbar_src_port); + return sid; +} netd_mboard_impl::~netd_mboard_impl() {} netd_mboard_impl::uptr netd_mboard_impl::make(const std::string& addr) @@ -84,8 +93,7 @@ netd_mboard_impl::uptr netd_mboard_impl::make(const std::string& addr) bool netd_mboard_impl::claim() { return rpc.call<bool>("reclaim", _rpc_token); } netd_impl::netd_impl(const device_addr_t& device_addr) : - usrp::device3_impl(), - _sid_framer(0) + usrp::device3_impl(), _sid_framer(0) { UHD_LOGGER_INFO("NETD") << "NETD initialization sequence..."; _tree->create<std::string>("/name").set("NETD - Series device"); @@ -94,6 +102,19 @@ netd_impl::netd_impl(const device_addr_t& device_addr) : for (size_t mb_i = 0; mb_i < device_args.size(); ++mb_i) { _mb.push_back(setup_mb(mb_i, device_args[mb_i])); } + + try { + enumerate_rfnoc_blocks( + 0, + 1, + 3, /* base port */ + uhd::sid_t(0x0200), + device_addr + ); + } catch (...) { + printf("%s Derp\n", __func__); + } + } netd_impl::~netd_impl() {} |