From 64bbe1e39ca71499074b7af16a8df389b84203fd Mon Sep 17 00:00:00 2001 From: Ciro Nishiguchi Date: Fri, 28 Sep 2018 13:06:20 -0500 Subject: uhd: Add traffic counter to null source sink --- host/lib/rfnoc/null_block_ctrl_impl.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'host/lib') 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 #include #include +#include #include 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( + _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"); -- cgit v1.2.3