diff options
author | Martin Braun <martin.braun@ettus.com> | 2019-06-28 11:44:37 -0700 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2019-11-26 11:49:30 -0800 |
commit | a36fc4604f9b37c46fd203d6461d0d38065a97e9 (patch) | |
tree | 8f1687fceb7ffc05eaed91acc8d4c794a5e448f2 /host/tests/rfnoc_graph_mock_nodes.hpp | |
parent | dbca54be2480a9ea1e84dd4b73349fd07fcaafe9 (diff) | |
download | uhd-a36fc4604f9b37c46fd203d6461d0d38065a97e9.tar.gz uhd-a36fc4604f9b37c46fd203d6461d0d38065a97e9.tar.bz2 uhd-a36fc4604f9b37c46fd203d6461d0d38065a97e9.zip |
rfnoc: DDC: Fix property propagation
- Combine scaling and samp_rate resolvers
- Prioritize decim when user has set it for DDC:
When samp_rate_in changes, either the samp_rate_out or the decim
values may change to accommodate it. If decim has been set by the
user (which can be determined by the valid flag), prefer changing
samp_rate_out over decim.
Diffstat (limited to 'host/tests/rfnoc_graph_mock_nodes.hpp')
-rw-r--r-- | host/tests/rfnoc_graph_mock_nodes.hpp | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/host/tests/rfnoc_graph_mock_nodes.hpp b/host/tests/rfnoc_graph_mock_nodes.hpp index 2137e3336..63e8bc534 100644 --- a/host/tests/rfnoc_graph_mock_nodes.hpp +++ b/host/tests/rfnoc_graph_mock_nodes.hpp @@ -10,6 +10,7 @@ #include <uhd/rfnoc/defaults.hpp> #include <uhd/rfnoc/node.hpp> #include <uhd/types/stream_cmd.hpp> +#include <uhdlib/rfnoc/node_accessor.hpp> using namespace uhd::rfnoc; @@ -350,4 +351,64 @@ private: const size_t _num_ports; }; +/*! Terminator: Probe edge properties + */ +class mock_terminator_t : public node_t +{ +public: + static size_t counter; + + mock_terminator_t(const size_t num_ports) + : _num_ports(num_ports), _term_count(counter++) + { + set_prop_forwarding_policy(forwarding_policy_t::DROP); + set_action_forwarding_policy(forwarding_policy_t::DROP); + } + + std::string get_unique_id() const + { + return "MOCK_TERMINATOR" + std::to_string(_term_count); + } + + size_t get_num_input_ports() const + { + return _num_ports; + } + + size_t get_num_output_ports() const + { + return _num_ports; + } + + template <typename data_t> + void set_edge_property(const std::string& id, data_t val, res_source_info edge_info) + { + UHD_ASSERT_THROW(edge_info.type == res_source_info::INPUT_EDGE + || edge_info.type == res_source_info::OUTPUT_EDGE); + try { + set_property<data_t>(id, val, edge_info); + } catch (const uhd::lookup_error&) { + node_accessor_t node_accessor{}; + auto edge_info_inverted = edge_info; + edge_info_inverted.type = res_source_info::invert_edge(edge_info.type); + property_t<data_t> new_prop(id, val, edge_info_inverted); + node_accessor.forward_edge_property(this, edge_info.instance, &new_prop); + set_property<data_t>(id, val, edge_info); + } + } + + template <typename data_t> + data_t get_edge_property(const std::string& id, res_source_info edge_info) + { + UHD_ASSERT_THROW(edge_info.type == res_source_info::INPUT_EDGE + || edge_info.type == res_source_info::OUTPUT_EDGE); + return get_property<data_t>(id, edge_info); + } + +private: + const size_t _num_ports; + const size_t _term_count; +}; +size_t mock_terminator_t::counter = 0; + #endif /* INCLUDED_LIBUHD_TESTS_MOCK_NODES_HPP */ |