diff options
author | Ciro Nishiguchi <ciro.nishiguchi@ni.com> | 2018-09-28 13:06:20 -0500 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2018-10-11 13:16:22 -0700 |
commit | 64bbe1e39ca71499074b7af16a8df389b84203fd (patch) | |
tree | 9680c58553925cc3730b2cf316d924556eb70828 /host/lib | |
parent | 71300593e5c0c6af4116d8706c9762f808dbf441 (diff) | |
download | uhd-64bbe1e39ca71499074b7af16a8df389b84203fd.tar.gz uhd-64bbe1e39ca71499074b7af16a8df389b84203fd.tar.bz2 uhd-64bbe1e39ca71499074b7af16a8df389b84203fd.zip |
uhd: Add traffic counter to null source sink
Diffstat (limited to 'host/lib')
-rw-r--r-- | host/lib/rfnoc/null_block_ctrl_impl.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/host/lib/rfnoc/null_block_ctrl_impl.cpp b/host/lib/rfnoc/null_block_ctrl_impl.cpp index 7e62a2b3e..568933e7a 100644 --- a/host/lib/rfnoc/null_block_ctrl_impl.cpp +++ b/host/lib/rfnoc/null_block_ctrl_impl.cpp @@ -7,6 +7,7 @@ #include <uhd/utils/log.hpp> #include <uhd/types/ranges.hpp> #include <uhd/rfnoc/null_block_ctrl.hpp> +#include <uhd/rfnoc/traffic_counter.hpp> #include <boost/format.hpp> using namespace uhd::rfnoc; @@ -30,6 +31,21 @@ public: }) .update() ; + + traffic_counter::write_reg_fn_t write = + [this](const uint32_t addr, const uint32_t data) { + const uint64_t traffic_counter_sr_base = 192; + sr_write(addr+traffic_counter_sr_base, data); + }; + + traffic_counter::read_reg_fn_t read = + [this](const uint32_t addr) { + const uint64_t traffic_counter_rb_base = 64; + return user_reg_read64(addr+traffic_counter_rb_base); + }; + + _traffic_counter = std::make_shared<traffic_counter>( + _tree, _root_path, write, read); } void set_line_delay_cycles(int cycles) @@ -101,6 +117,9 @@ public: } sr_write(SR_NEXT_DST_SID, sid.get(), output_block_port); } + +private: + traffic_counter::sptr _traffic_counter; }; UHD_RFNOC_BLOCK_REGISTER(null_block_ctrl, "NullSrcSink"); |