Line data Source code
1 : #include "timing/FanoutDesign.hpp"
2 :
3 : #include <sstream>
4 : #include <string>
5 :
6 : namespace dunedaq::timing {
7 :
8 0 : UHAL_REGISTER_DERIVED_NODE(FanoutDesign)
9 :
10 : //-----------------------------------------------------------------------------
11 0 : FanoutDesign::FanoutDesign(const uhal::Node& node)
12 : : TopDesignInterface(node)
13 : , MuxDesignInterface(node)
14 : , TopDesign(node)
15 : , EndpointDesignInterface(node)
16 0 : , CDRMuxDesignInterface(node)
17 0 : {}
18 : //-----------------------------------------------------------------------------
19 :
20 : //-----------------------------------------------------------------------------
21 0 : FanoutDesign::~FanoutDesign()
22 0 : {}
23 : //-----------------------------------------------------------------------------
24 :
25 : //-----------------------------------------------------------------------------
26 : std::string
27 0 : FanoutDesign::get_status(bool print_out) const
28 : {
29 0 : std::stringstream status;
30 0 : status << get_io_node_plain()->get_pll_status();
31 : // TODO fanout specific status
32 0 : if (print_out)
33 0 : TLOG() << status.str();
34 0 : return status.str();
35 0 : }
36 : //-----------------------------------------------------------------------------
37 :
38 : //-----------------------------------------------------------------------------
39 : void
40 0 : FanoutDesign::validate_firmware_version() const
41 : {
42 0 : TLOG() << "Firmware version not available in fanout";
43 0 : }
44 : //-----------------------------------------------------------------------------
45 :
46 : //-----------------------------------------------------------------------------
47 : uint32_t
48 0 : FanoutDesign::read_firmware_version() const
49 : {
50 0 : TLOG() << "Firmware version not available in fanout";
51 0 : return 0;
52 : }
53 : //-----------------------------------------------------------------------------
54 :
55 : //-----------------------------------------------------------------------------
56 : void
57 0 : FanoutDesign::configure(ClockSource clock_source) const
58 : {
59 : // Hard reset
60 0 : TopDesign::configure(clock_source); // fanout design is nominally FIB with input from backplane
61 :
62 0 : get_endpoint_node_plain(0)->reset(0x20); //TODO set correct address
63 0 : std::this_thread::sleep_for(std::chrono::milliseconds(1000));
64 0 : get_endpoint_node_plain(0)->get_status(true);
65 0 : if (!get_endpoint_node_plain(0)->endpoint_ready())
66 : {
67 0 : throw EndpointNotReady(ERS_HERE, "Fanout endpoint not ready!", get_endpoint_node_plain(0)->read_endpoint_state());
68 : }
69 0 : }
70 : //-----------------------------------------------------------------------------
71 :
72 : //-----------------------------------------------------------------------------
73 : void
74 0 : FanoutDesign::get_info(timingfirmwareinfo::TimingDeviceInfo& mon_data) const
75 : {
76 0 : TopDesign::get_info(mon_data);
77 0 : EndpointDesignInterface::get_info(0, mon_data.endpoint_info);
78 0 : }
79 : //-----------------------------------------------------------------------------
80 :
81 : }
|