From faa4786e025e787c196eec99f213da0d51a1f87e Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Fri, 31 May 2019 22:11:42 -0700 Subject: rfnoc: Add mb_controller API The mb_controller is an interface to hardware-specific functions of the motherboard. The API works in two ways: - The user can request access to it, and thus interact directly with the motherboard - RFNoC blocks can request access to it, if they need to interact with the motherboard themselves. --- host/lib/rfnoc/rfnoc_graph.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'host/lib/rfnoc/rfnoc_graph.cpp') diff --git a/host/lib/rfnoc/rfnoc_graph.cpp b/host/lib/rfnoc/rfnoc_graph.cpp index fef2ccccb..22c9b7294 100644 --- a/host/lib/rfnoc/rfnoc_graph.cpp +++ b/host/lib/rfnoc/rfnoc_graph.cpp @@ -6,6 +6,7 @@ #include #include +#include #include #include #include @@ -90,6 +91,16 @@ public: throw uhd::not_implemented_error(""); } + std::shared_ptr get_mb_controller(const size_t mb_index = 0) + { + if (!_mb_controllers.count(mb_index)) { + throw uhd::index_error( + std::string("Could not get mb controller for motherboard index ") + + std::to_string(mb_index)); + } + return _mb_controllers.at(mb_index); + } + private: /************************************************************************** * Device Setup @@ -148,6 +159,8 @@ private: //! Reference to the graph std::unique_ptr _graph; + //! Stash a list of motherboard controllers + std::unordered_map _mb_controllers; }; /* class rfnoc_graph_impl */ -- cgit v1.2.3