From 6ec8cf3eeac70d4458ad7a4f7f1eea4f082c140d Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Thu, 30 May 2019 14:21:41 -0700 Subject: rfnoc: Add default block controller The default block controller should get instantiated when no other suitable block controller can be found. --- host/lib/rfnoc/CMakeLists.txt | 1 + host/lib/rfnoc/block_control.cpp | 24 ++++++++++++++++++++++++ host/lib/rfnoc/block_ctrl_base.cpp | 2 +- host/lib/rfnoc/registry_factory.cpp | 3 ++- host/lib/usrp/device3/device3_impl.cpp | 2 +- 5 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 host/lib/rfnoc/block_control.cpp (limited to 'host/lib') 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 +#include +#include +#include + +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 #include +#include #include #include #include @@ -81,7 +82,7 @@ std::pair 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; -- cgit v1.2.3