From ad4004f1f78d5b64dae50b6e456d0206e824978f Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Thu, 30 May 2019 13:54:44 -0700 Subject: rfnoc: node: Add default command time API --- host/include/uhd/rfnoc/node.hpp | 42 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'host/include') diff --git a/host/include/uhd/rfnoc/node.hpp b/host/include/uhd/rfnoc/node.hpp index 54c66c985..ffbfc3319 100644 --- a/host/include/uhd/rfnoc/node.hpp +++ b/host/include/uhd/rfnoc/node.hpp @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -55,9 +56,15 @@ public: DROP }; + static const size_t ANY_PORT = size_t(~0); + /************************************************************************** + * Structors + *************************************************************************/ node_t(); + virtual ~node_t() {} + /****************************************** * Basic Operations ******************************************/ @@ -137,6 +144,36 @@ public: const prop_data_t& get_property( const std::string& id, const size_t instance = 0) /* mutable */; + /*! Standard API for setting the command time + * + * There are instances where commands need a time associated with them. + * For example, a block could have a 'freq' user property, which should be + * changed at a certain time. In that case, the block would have to be + * written to handle command times. + * + * The reason there is no 'time' parameter in set_property() or other API + * calls is because there is no uniform definition of what the time means; + * it can change from block to block. The transformation of \p time to a + * tick count, for example, is non-standard. + * + * The default implementation will simply stash away the time; it can be + * retrieved by calling get_command_time(); + */ + virtual void set_command_time(uhd::time_spec_t time, const size_t instance); + + /*! Return a previously set command time + * + * When no time was set, this will return uhd::time_spec_t::ASAP + */ + virtual uhd::time_spec_t get_command_time(const size_t instance) const; + + /*! Standard API for resetting the command time + * + * This will clear the time previously set by set_command_time(). It + * defaults to calling set_command_time(time_spec_t(0.0), instance) + */ + virtual void clear_command_time(const size_t instance); + protected: /****************************************** * Internal Registration Functions @@ -488,6 +525,11 @@ private: // The default callback will simply drop actions action_handler_t _post_action_cb = [](const res_source_info&, action_info::sptr) { /* nop */ }; + + /************************************************************************** + * Other attributes + *************************************************************************/ + std::vector _cmd_timespecs; }; // class node_t }} /* namespace uhd::rfnoc */ -- cgit v1.2.3