aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/rfnoc/registry_factory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'host/lib/rfnoc/registry_factory.cpp')
-rw-r--r--host/lib/rfnoc/registry_factory.cpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/host/lib/rfnoc/registry_factory.cpp b/host/lib/rfnoc/registry_factory.cpp
index e9ad4f89c..d03cb183a 100644
--- a/host/lib/rfnoc/registry_factory.cpp
+++ b/host/lib/rfnoc/registry_factory.cpp
@@ -35,6 +35,17 @@ using block_descriptor_reg_t =
UHD_SINGLETON_FCN(block_descriptor_reg_t, get_descriptor_block_registry);
///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+// These registries are for blocks that have requested motherboard access
+using block_direct_mb_access_req_t = std::unordered_set<noc_block_base::noc_id_t>;
+UHD_SINGLETON_FCN(block_direct_mb_access_req_t, get_direct_block_mb_access_requested);
+//
+// This is the descriptor registry:
+using block_descriptor_mb_access_req_t = std::unordered_set<std::string>;
+UHD_SINGLETON_FCN(
+ block_descriptor_mb_access_req_t, get_descriptor_block_mb_access_requested);
+///////////////////////////////////////////////////////////////////////////////
+
/******************************************************************************
* Registry functions
*
@@ -68,6 +79,20 @@ void registry::register_block_descriptor(
get_descriptor_block_registry().emplace(block_key, std::move(factory_fn));
}
+void registry::request_mb_access(noc_block_base::noc_id_t noc_id)
+{
+ if (!get_direct_block_mb_access_requested().count(noc_id)) {
+ get_direct_block_mb_access_requested().emplace(noc_id);
+ }
+}
+
+void registry::request_mb_access(const std::string& block_key)
+{
+ if (!get_descriptor_block_mb_access_requested().count(block_key)) {
+ get_descriptor_block_mb_access_requested().emplace(block_key);
+ }
+}
+
/******************************************************************************
* Factory functions
*****************************************************************************/
@@ -87,3 +112,18 @@ std::pair<registry::factory_t, std::string> factory::get_block_factory(
auto& block_info = get_direct_block_registry().at(noc_id);
return {std::get<1>(block_info), std::get<0>(block_info)};
}
+
+bool factory::has_requested_mb_access(noc_block_base::noc_id_t noc_id)
+{
+ if (get_direct_block_mb_access_requested().count(noc_id)) {
+ return true;
+ }
+
+ // FIXME tbw:
+ // - Map noc_id to block key
+ // - Check that key's descriptor
+ // - If that block has requested MB access, stash the noc ID in
+ // get_direct_block_mb_access_requested() for faster lookups in the future
+
+ return false;
+}