From e16aec1af589742798261a2958aaa998ac349196 Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Wed, 27 Mar 2024 11:24:20 +0100 Subject: rfnoc: Allow vectors of NoC-IDs in registry This allows registering RFNoC blocks that have the same implementation for multiple NoC-IDs. --- host/include/uhd/rfnoc/registry.hpp | 10 ++++++++++ host/lib/rfnoc/registry_factory.cpp | 21 ++++++++++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/host/include/uhd/rfnoc/registry.hpp b/host/include/uhd/rfnoc/registry.hpp index 362899ccc..3d96abd53 100644 --- a/host/include/uhd/rfnoc/registry.hpp +++ b/host/include/uhd/rfnoc/registry.hpp @@ -92,6 +92,16 @@ public: const std::string& ctrlport_clock, factory_t factory_fn); + /*! Same as above, but with multiple noc_ids + */ + static void register_block_direct(std::vector noc_ids, + device_type_t device_id, + const std::string& block_name, + bool mb_access, + const std::string& timebase_clock, + const std::string& ctrlport_clock, + factory_t factory_fn); + /*! Register a block that does use a block descriptor file * * Use this registry function for blocks that also have a textual diff --git a/host/lib/rfnoc/registry_factory.cpp b/host/lib/rfnoc/registry_factory.cpp index debe59133..0a1ad5327 100644 --- a/host/lib/rfnoc/registry_factory.cpp +++ b/host/lib/rfnoc/registry_factory.cpp @@ -19,7 +19,7 @@ using namespace uhd::rfnoc; -/*! Pair type for device depended block definitions. */ +/*! Pair type for device dependent block definitions. */ using block_device_pair_t = std::pair; @@ -72,6 +72,25 @@ void registry::register_block_direct(noc_id_t noc_id, std::move(factory_fn)}); } +void registry::register_block_direct(std::vector noc_ids, + device_type_t device_id, + const std::string& block_name, + bool mb_access, + const std::string& timebase_clock, + const std::string& ctrlport_clock, + factory_t factory_fn) +{ + for (auto noc_id : noc_ids) { + register_block_direct(noc_id, + device_id, + block_name, + mb_access, + timebase_clock, + ctrlport_clock, + std::move(factory_fn)); + } +} + void registry::register_block_descriptor( const std::string& block_key, factory_t factory_fn) { -- cgit v1.2.3-59-g8ed1b