Line data Source code
1 : /**
2 : * @file SwitchyardNode.cpp
3 : *
4 : * This is part of the DUNE DAQ Software Suite, copyright 2020.
5 : * Licensing/copyright details are in the COPYING file that you should have
6 : * received with this code.
7 : */
8 :
9 : #include "timing/SwitchyardNode.hpp"
10 :
11 : #include "timing/toolbox.hpp"
12 : #include "logging/Logging.hpp"
13 :
14 : #include <string>
15 :
16 : namespace dunedaq {
17 : namespace timing {
18 :
19 0 : UHAL_REGISTER_DERIVED_NODE(SwitchyardNode)
20 :
21 : //-----------------------------------------------------------------------------
22 0 : SwitchyardNode::SwitchyardNode(const uhal::Node& node)
23 0 : : TimingNode(node)
24 0 : {}
25 : //-----------------------------------------------------------------------------
26 :
27 : //-----------------------------------------------------------------------------
28 0 : SwitchyardNode::~SwitchyardNode() {}
29 : //-----------------------------------------------------------------------------
30 :
31 : //-----------------------------------------------------------------------------
32 : std::string
33 0 : SwitchyardNode::get_status(bool print_out) const
34 : {
35 0 : std::stringstream status;
36 0 : auto subnodes = read_sub_nodes(getNode("csr.ctrl"));
37 0 : status << format_reg_table(subnodes, "Switchyard state");
38 :
39 0 : if (print_out)
40 0 : TLOG() << status.str();
41 0 : return status.str();
42 0 : }
43 : //-----------------------------------------------------------------------------
44 :
45 : //-----------------------------------------------------------------------------
46 : void
47 0 : SwitchyardNode::configure_master_source(uint8_t master_source, bool dispatch) const // NOLINT(build/unsigned)
48 : {
49 0 : getNode("csr.ctrl.master_src").write(master_source);
50 0 : if (dispatch)
51 0 : getClient().dispatch();
52 0 : }
53 : //-----------------------------------------------------------------------------
54 :
55 : //-----------------------------------------------------------------------------
56 : void
57 0 : SwitchyardNode::configure_endpoint_source(uint8_t endpoint_source, bool dispatch) const // NOLINT(build/unsigned)
58 : {
59 0 : getNode("csr.ctrl.ep_src").write(endpoint_source);
60 0 : if (dispatch)
61 0 : getClient().dispatch();
62 0 : }
63 : //-----------------------------------------------------------------------------
64 :
65 : } // namespace timing
66 : } // namespace dunedaq
|