diff options
Diffstat (limited to 'host')
-rw-r--r-- | host/include/uhd/rfnoc/CMakeLists.txt | 1 | ||||
-rw-r--r-- | host/include/uhd/rfnoc/block_control.hpp | 25 | ||||
-rw-r--r-- | host/include/uhd/rfnoc/constants.hpp | 9 | ||||
-rw-r--r-- | host/lib/rfnoc/CMakeLists.txt | 1 | ||||
-rw-r--r-- | host/lib/rfnoc/block_control.cpp | 24 | ||||
-rw-r--r-- | host/lib/rfnoc/block_ctrl_base.cpp | 2 | ||||
-rw-r--r-- | host/lib/rfnoc/registry_factory.cpp | 3 | ||||
-rw-r--r-- | host/lib/usrp/device3/device3_impl.cpp | 2 |
8 files changed, 59 insertions, 8 deletions
diff --git a/host/include/uhd/rfnoc/CMakeLists.txt b/host/include/uhd/rfnoc/CMakeLists.txt index dab5715d8..5b81ae6e1 100644 --- a/host/include/uhd/rfnoc/CMakeLists.txt +++ b/host/include/uhd/rfnoc/CMakeLists.txt @@ -10,6 +10,7 @@ if(ENABLE_RFNOC) # Infrastructure block_ctrl_base.hpp block_ctrl.hpp + block_control.hpp blockdef.hpp block_id.hpp constants.hpp diff --git a/host/include/uhd/rfnoc/block_control.hpp b/host/include/uhd/rfnoc/block_control.hpp new file mode 100644 index 000000000..5995f6865 --- /dev/null +++ b/host/include/uhd/rfnoc/block_control.hpp @@ -0,0 +1,25 @@ +// +// Copyright 2019 Ettus Research, a National Instruments Brand +// +// SPDX-License-Identifier: GPL-3.0-or-later +// + +#ifndef INCLUDED_LIBUHD_BLOCK_CONTROL_HPP +#define INCLUDED_LIBUHD_BLOCK_CONTROL_HPP + +#include <uhd/config.hpp> +#include <uhd/rfnoc/noc_block_base.hpp> + +namespace uhd { namespace rfnoc { + +/*! A default block controller for blocks that can't be found in the registry + */ +class UHD_API block_control : public noc_block_base +{ +public: + RFNOC_DECLARE_BLOCK(block_control) +}; + +}} // namespace uhd::rfnoc + +#endif /* INCLUDED_LIBUHD_BLOCK_CONTROL_HPP */ diff --git a/host/include/uhd/rfnoc/constants.hpp b/host/include/uhd/rfnoc/constants.hpp index d18494d4c..1a992378c 100644 --- a/host/include/uhd/rfnoc/constants.hpp +++ b/host/include/uhd/rfnoc/constants.hpp @@ -9,6 +9,7 @@ #define INCLUDED_LIBUHD_RFNOC_CONSTANTS_HPP #include <uhd/types/dict.hpp> +#include <uhd/rfnoc/defaults.hpp> #include <stdint.h> #include <boost/assign/list_of.hpp> #include <string> @@ -21,11 +22,9 @@ static const std::string XML_DEFAULT_PATH = "share/uhd/rfnoc"; //! The name of the environment variable storing the bath to the block definition files static const std::string XML_PATH_ENV = "UHD_RFNOC_DIR"; -//! If the block name can't be automatically detected, this name is used -static const std::string DEFAULT_BLOCK_NAME = "Block"; -static const uint64_t DEFAULT_NOC_ID = 0xFFFFFFFFFFFFFFFF; -static const size_t NOC_SHELL_COMPAT_MAJOR = 6; -static const size_t NOC_SHELL_COMPAT_MINOR = 0; +static const uint64_t DEFAULT_NOC_ID_64 = 0xFFFFFFFFFFFFFFFF; +static const size_t NOC_SHELL_COMPAT_MAJOR = 5; +static const size_t NOC_SHELL_COMPAT_MINOR = 1; static const size_t MAX_PACKET_SIZE = 8000; // bytes static const size_t DEFAULT_PACKET_SIZE = 1456; // bytes diff --git a/host/lib/rfnoc/CMakeLists.txt b/host/lib/rfnoc/CMakeLists.txt index 5ef84611a..4b36a8db4 100644 --- a/host/lib/rfnoc/CMakeLists.txt +++ b/host/lib/rfnoc/CMakeLists.txt @@ -45,6 +45,7 @@ LIBUHD_APPEND_SOURCES( ${CMAKE_CURRENT_SOURCE_DIR}/tx_stream_terminator.cpp ${CMAKE_CURRENT_SOURCE_DIR}/wb_iface_adapter.cpp # Default block control classes: + ${CMAKE_CURRENT_SOURCE_DIR}/block_control.cpp ${CMAKE_CURRENT_SOURCE_DIR}/ddc_block_control.cpp ${CMAKE_CURRENT_SOURCE_DIR}/ddc_block_ctrl_impl.cpp ${CMAKE_CURRENT_SOURCE_DIR}/duc_block_ctrl_impl.cpp diff --git a/host/lib/rfnoc/block_control.cpp b/host/lib/rfnoc/block_control.cpp new file mode 100644 index 000000000..78c390001 --- /dev/null +++ b/host/lib/rfnoc/block_control.cpp @@ -0,0 +1,24 @@ +// +// Copyright 2019 Ettus Research, a National Instruments Brand +// +// SPDX-License-Identifier: GPL-3.0-or-later +// + +#include <uhd/exception.hpp> +#include <uhd/rfnoc/block_control.hpp> +#include <uhd/rfnoc/defaults.hpp> +#include <uhd/rfnoc/registry.hpp> + +using namespace uhd::rfnoc; + +class block_control_impl : public block_control +{ +public: + RFNOC_BLOCK_CONSTRUCTOR(block_control) + { + set_prop_forwarding_policy(forwarding_policy_t::DROP); + set_action_forwarding_policy(forwarding_policy_t::DROP); + } +}; + +UHD_RFNOC_BLOCK_REGISTER_DIRECT(block_control, DEFAULT_NOC_ID, DEFAULT_BLOCK_NAME) diff --git a/host/lib/rfnoc/block_ctrl_base.cpp b/host/lib/rfnoc/block_ctrl_base.cpp index 911f1a4e0..d186910b9 100644 --- a/host/lib/rfnoc/block_ctrl_base.cpp +++ b/host/lib/rfnoc/block_ctrl_base.cpp @@ -44,7 +44,7 @@ block_ctrl_base::block_ctrl_base(const make_args_t& make_args) "No block definition found, using default block configuration " "for block with NOC ID: " + str(boost::format("0x%08X") % _noc_id)); - _block_def = blockdef::make_from_noc_id(DEFAULT_NOC_ID); + _block_def = blockdef::make_from_noc_id(DEFAULT_NOC_ID_64); } UHD_ASSERT_THROW(_block_def); // For the block ID, we start with block count 0 and increase until diff --git a/host/lib/rfnoc/registry_factory.cpp b/host/lib/rfnoc/registry_factory.cpp index cf7b897f7..e9ad4f89c 100644 --- a/host/lib/rfnoc/registry_factory.cpp +++ b/host/lib/rfnoc/registry_factory.cpp @@ -6,6 +6,7 @@ #include <uhd/exception.hpp> #include <uhd/rfnoc/registry.hpp> +#include <uhd/rfnoc/defaults.hpp> #include <uhd/utils/static.hpp> #include <uhdlib/rfnoc/factory.hpp> #include <unordered_map> @@ -81,7 +82,7 @@ std::pair<registry::factory_t, std::string> factory::get_block_factory( UHD_LOG_WARNING("RFNOC::BLOCK_FACTORY", "Could not find block with Noc-ID " << std::hex << std::setw(sizeof(noc_block_base::noc_id_t) * 2) << noc_id); - throw uhd::key_error("Block not found!"); + noc_id = DEFAULT_NOC_ID; } auto& block_info = get_direct_block_registry().at(noc_id); return {std::get<1>(block_info), std::get<0>(block_info)}; diff --git a/host/lib/usrp/device3/device3_impl.cpp b/host/lib/usrp/device3/device3_impl.cpp index ba88ed2e8..bc1cf9002 100644 --- a/host/lib/usrp/device3/device3_impl.cpp +++ b/host/lib/usrp/device3/device3_impl.cpp @@ -135,7 +135,7 @@ void device3_impl::enumerate_rfnoc_blocks(size_t device_index, "for block with NOC ID: " + str(boost::format("0x%08X") % noc_id)); block_def = - uhd::rfnoc::blockdef::make_from_noc_id(uhd::rfnoc::DEFAULT_NOC_ID); + uhd::rfnoc::blockdef::make_from_noc_id(uhd::rfnoc::DEFAULT_NOC_ID_64); } UHD_ASSERT_THROW(block_def); make_args.ctrl_ifaces[0] = ctrl; |