aboutsummaryrefslogtreecommitdiffstats
path: root/host/include
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/include
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/include')
-rw-r--r--host/include/uhd/rfnoc/noc_block_base.hpp10
-rw-r--r--host/include/uhd/rfnoc/noc_block_make_args.hpp7
-rw-r--r--host/include/uhd/rfnoc/registry.hpp23
3 files changed, 23 insertions, 17 deletions
diff --git a/host/include/uhd/rfnoc/noc_block_base.hpp b/host/include/uhd/rfnoc/noc_block_base.hpp
index 45a1f5738..d9659862c 100644
--- a/host/include/uhd/rfnoc/noc_block_base.hpp
+++ b/host/include/uhd/rfnoc/noc_block_base.hpp
@@ -100,7 +100,7 @@ public:
*
* Note there is only ever one time base (or tick rate) per block.
*/
- double get_tick_rate() const { return _tick_rate; }
+ double get_tick_rate() const;
/*! Return the arguments that were passed into this block from the framework
*/
@@ -215,11 +215,11 @@ private:
// for all in- and output edges.
std::vector<property_t<double>> _tick_rate_props;
- //! The actual tick rate of the current time base
- double _tick_rate;
+ //! Reference to the ctrlport clock_iface object shared with the register_iface
+ std::shared_ptr<clock_iface> _ctrlport_clock_iface;
- //! Reference to the clock_iface object shared with the register_iface
- std::shared_ptr<clock_iface> _clock_iface;
+ //! Reference to the timebase clock_iface object shared with the register_iface
+ std::shared_ptr<clock_iface> _tb_clock_iface;
//! Stores a reference to this block's motherboard's controller, if this
// block had requested and was granted access
diff --git a/host/include/uhd/rfnoc/noc_block_make_args.hpp b/host/include/uhd/rfnoc/noc_block_make_args.hpp
index 8a5fbd46f..7ed191079 100644
--- a/host/include/uhd/rfnoc/noc_block_make_args.hpp
+++ b/host/include/uhd/rfnoc/noc_block_make_args.hpp
@@ -40,8 +40,11 @@ struct noc_block_base::make_args_t
//! Register interface to this block's register space
register_iface::sptr reg_iface;
- //! Clock interface object that is shared with the reg_iface
- std::shared_ptr<clock_iface> clk_iface;
+ //! Timebase clock interface object that is shared with the reg_iface
+ std::shared_ptr<clock_iface> tb_clk_iface;
+
+ //! Controlport clock interface object that is shared with the reg_iface
+ std::shared_ptr<clock_iface> ctrlport_clk_iface;
//! Reference to the motherboard controller associated with this block.
//
diff --git a/host/include/uhd/rfnoc/registry.hpp b/host/include/uhd/rfnoc/registry.hpp
index cc07d5c65..9815ce3c6 100644
--- a/host/include/uhd/rfnoc/registry.hpp
+++ b/host/include/uhd/rfnoc/registry.hpp
@@ -15,16 +15,17 @@
//! This macro must be placed inside a block implementation file
// after the class definition
-#define UHD_RFNOC_BLOCK_REGISTER_DIRECT(CLASS_NAME, NOC_ID, BLOCK_NAME) \
- uhd::rfnoc::noc_block_base::sptr CLASS_NAME##_make( \
- uhd::rfnoc::noc_block_base::make_args_ptr make_args) \
- { \
- return std::make_shared<CLASS_NAME##_impl>(std::move(make_args)); \
- } \
- UHD_STATIC_BLOCK(register_rfnoc_##CLASS_NAME) \
- { \
- uhd::rfnoc::registry::register_block_direct( \
- NOC_ID, BLOCK_NAME, &CLASS_NAME##_make); \
+#define UHD_RFNOC_BLOCK_REGISTER_DIRECT( \
+ CLASS_NAME, NOC_ID, BLOCK_NAME, TB_CLOCK, CTRL_CLOCK) \
+ uhd::rfnoc::noc_block_base::sptr CLASS_NAME##_make( \
+ uhd::rfnoc::noc_block_base::make_args_ptr make_args) \
+ { \
+ return std::make_shared<CLASS_NAME##_impl>(std::move(make_args)); \
+ } \
+ UHD_STATIC_BLOCK(register_rfnoc_##CLASS_NAME) \
+ { \
+ uhd::rfnoc::registry::register_block_direct( \
+ NOC_ID, BLOCK_NAME, TB_CLOCK, CTRL_CLOCK, &CLASS_NAME##_make); \
}
#define UHD_RFNOC_BLOCK_REQUEST_MB_ACCESS(NOC_ID) \
@@ -62,6 +63,8 @@ public:
*/
static void 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);
/*! Register a block that does use a block descriptor file