From 3da938f1242219fdf993576dcfdce7440a63c044 Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Thu, 13 Jun 2019 13:34:11 -0700 Subject: rfnoc: Add clock selection to blocks During registration, blocks must now specify which clock they are using for the timebase (i.e., for timed commands) and for the ctrlport (this is used to determine the length of sleeps and polls). For example, the X300 provides bus_clk and radio_clk; typically, the former is used for the control port, and the latter for the timebase clock. Another virtual clock is called "__graph__", and it means the clock is derived from property propagation via the graph. The actual clocks are provided by the mb_iface. It has two new API calls: get_timebase_clock() and get_ctrlport_clock(), which take an argument as to which clock exactly is requested. On block initialization, those clock_iface objects are copied into the block controller. The get_tick_rate() API call for blocks now exclusively checks the timebase clock_iface, and will no longer cache the current tick rate in a separate _tick_rate member variable. Block controllers can't manually modify the clock_iface, unless they also have access to the mb_controller (like the radio block), and that mb_controller has provided said access. This commit also adds the clock selection API changes to the DDC block, the Null block, and the default block. --- host/lib/rfnoc/registry_factory.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'host/lib/rfnoc/registry_factory.cpp') diff --git a/host/lib/rfnoc/registry_factory.cpp b/host/lib/rfnoc/registry_factory.cpp index d03cb183a..117b60e96 100644 --- a/host/lib/rfnoc/registry_factory.cpp +++ b/host/lib/rfnoc/registry_factory.cpp @@ -24,9 +24,8 @@ using namespace uhd::rfnoc; // descriptor file // // This is the direct registry: -using block_direct_reg_t = std::unordered_map>; +using block_direct_reg_t = + std::unordered_map; UHD_SINGLETON_FCN(block_direct_reg_t, get_direct_block_registry); // // This is the descriptor registry: @@ -54,6 +53,8 @@ UHD_SINGLETON_FCN( *****************************************************************************/ void registry::register_block_direct(noc_block_base::noc_id_t noc_id, const std::string& block_name, + const std::string& timebase_clock, + const std::string& ctrlport_clock, factory_t factory_fn) { if (get_direct_block_registry().count(noc_id)) { @@ -63,8 +64,9 @@ void registry::register_block_direct(noc_block_base::noc_id_t noc_id, << std::hex << noc_id << std::dec << std::endl; return; } - get_direct_block_registry().emplace( - noc_id, std::make_tuple(block_name, std::move(factory_fn))); + get_direct_block_registry().emplace(noc_id, + block_factory_info_t{ + block_name, timebase_clock, ctrlport_clock, std::move(factory_fn)}); } void registry::register_block_descriptor( @@ -96,8 +98,7 @@ void registry::request_mb_access(const std::string& block_key) /****************************************************************************** * Factory functions *****************************************************************************/ -std::pair factory::get_block_factory( - noc_block_base::noc_id_t noc_id) +block_factory_info_t factory::get_block_factory(noc_block_base::noc_id_t noc_id) { // First, check the descriptor registry // FIXME TODO @@ -109,8 +110,7 @@ std::pair factory::get_block_factory( << std::hex << std::setw(sizeof(noc_block_base::noc_id_t) * 2) << noc_id); 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)}; + return get_direct_block_registry().at(noc_id); } bool factory::has_requested_mb_access(noc_block_base::noc_id_t noc_id) -- cgit v1.2.3