DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
KerberosDesign.cpp
Go to the documentation of this file.
2
3#include <sstream>
4#include <string>
5
6namespace dunedaq::timing {
7
8UHAL_REGISTER_DERIVED_NODE(KerberosDesign)
9
10//-----------------------------------------------------------------------------
20//-----------------------------------------------------------------------------
21
22//-----------------------------------------------------------------------------
25//-----------------------------------------------------------------------------
26
27//-----------------------------------------------------------------------------
28std::string
29KerberosDesign::get_status(bool print_out) const
30{
31 std::stringstream status;
32 status << get_io_node_plain()->get_pll_status();
34 // TODO fanout specific status
35 if (print_out)
36 TLOG() << status.str();
37 return status.str();
38}
39//-----------------------------------------------------------------------------
40
41//-----------------------------------------------------------------------------
42void
44{
45 if (clock_source == kFreeRun)
46 {
47 TopDesign::configure(clock_source); // kerberos normally takes clock from upstream SFP
48 this->sync_timestamp(ts_source);
49 }
50 else
51 {
52 switch_timing_source(clock_source);
53
54 for (uint i=0; i < get_number_of_endpoint_nodes(); ++i)
55 {
56 try
57 {
59 std::this_thread::sleep_for(std::chrono::milliseconds(1500));
61
62 if (!get_endpoint_node_plain(i)->endpoint_ready())
63 {
64 if (i==clock_source)
65 {
66 ers::error(EndpointNotReady(ERS_HERE, "MIB endpoint "+std::to_string(i)+" not ready!", get_endpoint_node_plain(i)->read_endpoint_state()));
67 }
68 else
69 {
70 ers::warning(EndpointNotReady(ERS_HERE, "MIB endpoint "+std::to_string(i)+" not ready!", get_endpoint_node_plain(i)->read_endpoint_state()));
71 }
72 }
73 }
74 catch (const std::exception& e)
75 {
76 if (i==clock_source)
77 {
78 ers::error(EndpointNotReady(ERS_HERE, "MIB endpoint "+std::to_string(i)+" has no clock!", get_endpoint_node_plain(i)->read_endpoint_state(),e));
79 }
80 else
81 {
82 ers::warning(EndpointNotReady(ERS_HERE, "MIB endpoint "+std::to_string(i)+" has no clock!", get_endpoint_node_plain(i)->read_endpoint_state(), e));
83 }
84 }
85 }
86
87 this->sync_timestamp(ts_source);
88 }
89}
90//-----------------------------------------------------------------------------
91
92//-----------------------------------------------------------------------------
93void
95{
96 // Hard reset
97 TopDesign::configure(clock_source); //TODO add option not to reprogram pll config
98
99 switch_timing_source_mux(clock_source);
100}
101//-----------------------------------------------------------------------------
102
103//-----------------------------------------------------------------------------
104//void
105//KerberosDesign::get_info(opmonlib::InfoCollector& ci, int level) const
106//{
107// opmonlib::InfoCollector master_collector;
108// this->get_master_node_plain()->get_info(master_collector, level);
109// ci.add("master", master_collector);
110
111// opmonlib::InfoCollector hardware_collector;
112// this->get_io_node_plain()->get_info(hardware_collector, level);
113// ci.add("io", hardware_collector);
114
115// opmonlib::InfoCollector endpoint_collector;
116// get_endpoint_node_plain(0)->get_info(endpoint_collector, level);
117// ci.add("endpoint", endpoint_collector);
118// }
119//-----------------------------------------------------------------------------
120
121}
#define ERS_HERE
Base class for timing endpoint design nodes.
Base class for timing endpoint design nodes.
virtual const EndpointNodeInterface * get_endpoint_node_plain(uint32_t ept_id) const
Return the timing endpoint node.
virtual uint32_t get_number_of_endpoint_nodes() const
Return the timing endpoint node.
virtual void reset(uint32_t address=0, uint32_t partition=0) const =0
Reset the endpoint.
virtual std::string get_pll_status(bool print_out=false) const
Print status of on-board PLL.
Definition IONode.cpp:288
Class for timing fanout designs.
std::string get_status(bool print_out=false) const override
Get status string, optionally print.
void configure(ClockSource clock_source, TimestampSource ts_source) const override
Give info to collector.
void switch_timing_source(ClockSource clock_source) const override
Switch timing source.
Base class for timing master designs.
Base class for timing master designs.
const MasterNodeInterface * get_master_node_plain() const override
Get master node pointer.
void sync_timestamp(TimestampSource source) const override
Sync timestamp to current machine value.
Base class for timing endpoint design nodes.
virtual std::string get_status(bool print_out=false) const =0
Get the status string of the timing node. Optionally print it.
virtual void switch_timing_source_mux(uint8_t mux_channel) const
Switch timing source mux.
Base class for timing top design nodes.
void configure(ClockSource clock_source) const override
Prepare the timing device for data taking.
Definition TopDesign.hpp:81
const IONode * get_io_node_plain() const override
Get io node pointer.
Definition TopDesign.hpp:48
#define TLOG(...)
Definition macro.hpp:22
< Message parameters
void warning(const Issue &issue)
Definition ers.hpp:115
void error(const Issue &issue)
Definition ers.hpp:81