aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/include/uhdlib
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2019-06-13 13:34:11 -0700
committerMartin Braun <martin.braun@ettus.com>2019-11-26 11:49:27 -0800
commit3da938f1242219fdf993576dcfdce7440a63c044 (patch)
tree145b8999ba2c72ebc8e1115ceedd6a8a3a0d2210 /host/lib/include/uhdlib
parentde246ea6174e3a6d5fe0dd554d5208f24c2932bb (diff)
downloaduhd-3da938f1242219fdf993576dcfdce7440a63c044.tar.gz
uhd-3da938f1242219fdf993576dcfdce7440a63c044.tar.bz2
uhd-3da938f1242219fdf993576dcfdce7440a63c044.zip
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.
Diffstat (limited to 'host/lib/include/uhdlib')
-rw-r--r--host/lib/include/uhdlib/rfnoc/clock_iface.hpp3
-rw-r--r--host/lib/include/uhdlib/rfnoc/factory.hpp13
-rw-r--r--host/lib/include/uhdlib/rfnoc/mb_iface.hpp5
3 files changed, 18 insertions, 3 deletions
diff --git a/host/lib/include/uhdlib/rfnoc/clock_iface.hpp b/host/lib/include/uhdlib/rfnoc/clock_iface.hpp
index ae61a645e..06e54e67c 100644
--- a/host/lib/include/uhdlib/rfnoc/clock_iface.hpp
+++ b/host/lib/include/uhdlib/rfnoc/clock_iface.hpp
@@ -12,12 +12,15 @@
#include <uhd/utils/log.hpp>
#include <atomic>
#include <string>
+#include <memory>
namespace uhd { namespace rfnoc {
class clock_iface
{
public:
+ using sptr = std::shared_ptr<clock_iface>;
+
clock_iface(const std::string& name) : _name(name), _is_mutable(true)
{
_is_running = false;
diff --git a/host/lib/include/uhdlib/rfnoc/factory.hpp b/host/lib/include/uhdlib/rfnoc/factory.hpp
index 8d1fb27a0..be42a57e5 100644
--- a/host/lib/include/uhdlib/rfnoc/factory.hpp
+++ b/host/lib/include/uhdlib/rfnoc/factory.hpp
@@ -12,6 +12,14 @@
namespace uhd { namespace rfnoc {
+struct block_factory_info_t
+{
+ std::string block_name;
+ std::string timebase_clk;
+ std::string ctrlport_clk;
+ registry::factory_t factory_fn;
+};
+
/*! Container for factory functionality
*/
class factory
@@ -19,11 +27,10 @@ class factory
public:
/*! Return a factory function for an RFNoC block based on the Noc-ID
*
- * \returns a pair: factory function, and block name
+ * \returns a block_factory_info_t object
* \throws uhd::lookup_error if no block is found
*/
- static std::pair<registry::factory_t, std::string>
- get_block_factory(noc_block_base::noc_id_t noc_id);
+ static block_factory_info_t get_block_factory(noc_block_base::noc_id_t noc_id);
/*! Check if this block has requested access to the motherboard controller
*/
diff --git a/host/lib/include/uhdlib/rfnoc/mb_iface.hpp b/host/lib/include/uhdlib/rfnoc/mb_iface.hpp
index cca8dcab8..0a2790a34 100644
--- a/host/lib/include/uhdlib/rfnoc/mb_iface.hpp
+++ b/host/lib/include/uhdlib/rfnoc/mb_iface.hpp
@@ -9,6 +9,7 @@
#include <uhdlib/rfnoc/chdr_ctrl_xport.hpp>
#include <uhdlib/rfnoc/rfnoc_common.hpp>
+#include <uhdlib/rfnoc/clock_iface.hpp>
#include <memory>
namespace uhd { namespace rfnoc {
@@ -67,6 +68,10 @@ public:
*/
virtual void reset_network() = 0;
+ /*! Return a reference to a clock iface
+ */
+ virtual std::shared_ptr<clock_iface> get_clock_iface(const std::string& clock_name) = 0;
+
/*! Create a control transport
*
* This is usually called once per motherboard, since there is only one