aboutsummaryrefslogtreecommitdiffstats
path: root/host/include
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2019-05-30 16:17:49 -0700
committerMartin Braun <martin.braun@ettus.com>2019-11-26 11:49:21 -0800
commitfff4fd59b7b7995904ecb2b010f05f78e9d0a0de (patch)
tree6bac20c68dbe9759471d17ef70cf576e71415aff /host/include
parent31449a44699b6484442c91394e8ff14e22cea246 (diff)
downloaduhd-fff4fd59b7b7995904ecb2b010f05f78e9d0a0de.tar.gz
uhd-fff4fd59b7b7995904ecb2b010f05f78e9d0a0de.tar.bz2
uhd-fff4fd59b7b7995904ecb2b010f05f78e9d0a0de.zip
rfnoc: noc_block_base: Handle the tick_rate property internally
All noc_block_base derivatives are now plugged into the tick rate system. Connected nodes can only have one tick rate among them. This implies there is also only ever one tick rate per block. set_tick_rate() is a protected API call which can be called by blocks such as radio blocks to actually set a tick rate. Other blocks would only ever read the tick rate, which is handled by the get_tick_rate() API call.
Diffstat (limited to 'host/include')
-rw-r--r--host/include/uhd/rfnoc/noc_block_base.hpp32
-rw-r--r--host/include/uhd/rfnoc/noc_block_make_args.hpp4
2 files changed, 36 insertions, 0 deletions
diff --git a/host/include/uhd/rfnoc/noc_block_base.hpp b/host/include/uhd/rfnoc/noc_block_base.hpp
index b671e6525..0959e5bdd 100644
--- a/host/include/uhd/rfnoc/noc_block_base.hpp
+++ b/host/include/uhd/rfnoc/noc_block_base.hpp
@@ -22,6 +22,8 @@
namespace uhd { namespace rfnoc {
+class clock_iface;
+
/*!
* The primary interface to a NoC block in the FPGA
*
@@ -83,10 +85,30 @@ public:
*/
const block_id_t& get_block_id() const { return _block_id; }
+ /*! Returns the tick rate of the current time base
+ *
+ * Note there is only ever one time base (or tick rate) per block.
+ */
+ double get_tick_rate() const { return _tick_rate; }
+
protected:
noc_block_base(make_args_ptr make_args);
+ /*! Update tick rate for this node and all the connected nodes
+ *
+ * Careful: Calling this function will trigger a property propagation to any
+ * block this block is connected to.
+ */
+ void set_tick_rate(const double tick_rate);
+
private:
+ /*! Update the tick rate of this block
+ *
+ * This will make sure that the underlying register_iface is notified of the
+ * change in timebase.
+ */
+ void _set_tick_rate(const double tick_rate);
+
//! This block's Noc-ID
noc_id_t _noc_id;
@@ -100,6 +122,16 @@ private:
//! Number of output ports
size_t _num_output_ports;
+
+ //! Container for the 'tick rate' property. This will hold one edge property
+ // 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;
+
+ std::shared_ptr<clock_iface> _clock_iface;
+
}; // class noc_block_base
}} /* namespace uhd::rfnoc */
diff --git a/host/include/uhd/rfnoc/noc_block_make_args.hpp b/host/include/uhd/rfnoc/noc_block_make_args.hpp
index c9b530589..d3679f973 100644
--- a/host/include/uhd/rfnoc/noc_block_make_args.hpp
+++ b/host/include/uhd/rfnoc/noc_block_make_args.hpp
@@ -14,6 +14,7 @@
namespace uhd { namespace rfnoc {
class clock_iface;
+
/*! Data structure to hold the arguments passed into the noc_block_base ctor
*
* We want to hide these from the user, so she can't futz around with them.
@@ -21,6 +22,8 @@ class clock_iface;
*/
struct noc_block_base::make_args_t
{
+ ~make_args_t();
+
//! Noc-ID
noc_id_t noc_id;
@@ -38,6 +41,7 @@ struct noc_block_base::make_args_t
//! Clock interface object that is shared with the reg_iface
std::shared_ptr<clock_iface> clk_iface;
+
//! The subtree for this block
uhd::property_tree::sptr tree;
};