21UHAL_REGISTER_DERIVED_NODE(EchoMonitorNode)
37 std::stringstream status;
41 TLOG() << status.str();
51 getNode(
"csr.ctrl.go").write(0x1);
52 getClient().dispatch();
54 auto start = std::chrono::high_resolution_clock::now();
56 uhal::ValWord<uint32_t> done;
57 uhal::ValWord<uint32_t> delta_t;
61 done = getNode(
"csr.stat.rx_done").read();
62 delta_t = getNode(
"csr.stat.deltat").read();
63 getClient().dispatch();
65 TLOG_DEBUG(6) <<
"rx done: " << done.value() <<
", delta_t: " << delta_t.value();
69 if (delta_t.value() == 0xffff)
79 auto now = std::chrono::high_resolution_clock::now();
80 auto ms_since_start = std::chrono::duration_cast<std::chrono::milliseconds>(
now - start);
82 if (ms_since_start.count() > timeout)
83 throw EchoFlagTimeout(
ERS_HERE, timeout);
85 std::this_thread::sleep_for(std::chrono::microseconds(10));
90 return delta_t.value();
Class for master global node.
virtual ~EchoMonitorNode()
virtual uint64_t send_echo_and_measure_delay(int64_t timeout=500) const
Send echo and measure the round-trip time between master and endpoint.
std::string get_status(bool print_out=false) const override
Get status string, optionally print.
Base class for timing nodes.
std::map< std::string, uhal::ValWord< uint32_t > > read_sub_nodes(const uhal::Node &node, bool dispatch=true) const
Read subnodes.
#define TLOG_DEBUG(lvl,...)
std::string format_reg_table(T data, std::string title, std::vector< std::string > headers)
Format reg-value table.
std::string format_reg_value(T reg_value, uint32_t base)