DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
EndpointDesign.cpp
Go to the documentation of this file.
1
10
11#include <sstream>
12#include <string>
13
14namespace dunedaq::timing {
15
16UHAL_REGISTER_DERIVED_NODE(EndpointDesign)
17
18//-----------------------------------------------------------------------------
20 : TopDesignInterface(node)
21 , TopDesign(node)
23
24{}
25//-----------------------------------------------------------------------------
26
27//-----------------------------------------------------------------------------
30//-----------------------------------------------------------------------------
31
32//-----------------------------------------------------------------------------
33std::string
34EndpointDesign::get_status(bool print_out) const
35{
36 std::stringstream status;
38 size_t number_of_endpoint_nodes = EndpointDesign::get_number_of_endpoint_nodes();
39 for (size_t i = 0; i < number_of_endpoint_nodes; ++i) {
40 status << "Endpoint node " << i << " status" << std::endl;
41 status << get_endpoint_node_plain(i)->get_status();
42 }
43 if (print_out)
44 TLOG() << status.str();
45 return status.str();
46}
47//-----------------------------------------------------------------------------
48
49//-----------------------------------------------------------------------------
50void
52{
53 TopDesign::configure(clock_source);
54
55 for (uint i=0; i < get_number_of_endpoint_nodes(); ++i)
56 {
58 std::this_thread::sleep_for(std::chrono::milliseconds(1000));
60 if (!get_endpoint_node_plain(i)->endpoint_ready())
61 {
62 ers::error(EndpointNotReady(ERS_HERE, "Endpoint "+std::to_string(i)+" not ready!", get_endpoint_node_plain(i)->read_endpoint_state()));
63 }
64 }
65}
66//-----------------------------------------------------------------------------
67
68//-----------------------------------------------------------------------------
69uint32_t // NOLINT(build/unsigned)
71{
72 return 0; //TODO
73 //return get_endpoint_node_plain(0)->read_version();
74}
75//-----------------------------------------------------------------------------
76
77//-----------------------------------------------------------------------------
78void
80{
81// TODO
82// auto firmware_version = read_firmware_version();
83//
84// int major_firmware_version = (firmware_version >> 16) & 0xff;
85// int minor_firmware_version = (firmware_version >> 8) & 0xff;
86// int patch_firmware_version = (firmware_version >> 0) & 0xff;
87//
88// if (major_firmware_version != g_required_major_endpoint_firmware_version)
89// ers::error(IncompatibleMajorEndpointFirmwareVersion(ERS_HERE, major_firmware_version, g_required_major_endpoint_firmware_version));
90// if (minor_firmware_version != g_required_minor_endpoint_firmware_version)
91// ers::warning(IncompatibleMinorEndpointFirmwareVersion(ERS_HERE, minor_firmware_version, g_required_minor_endpoint_firmware_version));
92// if (patch_firmware_version != g_required_patch_endpoint_firmware_version)
93// ers::warning(IncompatiblePatchEndpointFirmwareVersion(ERS_HERE, patch_firmware_version, g_required_patch_endpoint_firmware_version));
94}
95//-----------------------------------------------------------------------------
96
97void
103} // namespace dunedaq::timing
#define ERS_HERE
Base class for timing endpoint design nodes.
virtual void get_info(uint32_t ept_id, timingendpointinfo::TimingEndpointInfo &mon_data) const
Give info to collector.
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.
Base class for timing endpoint design nodes.
uint32_t read_firmware_version() const override
Give info to collector.
void configure(ClockSource clock_source) const override
Prepare the timing endpoint for data taking.
void get_info(timingfirmwareinfo::TimingDeviceInfo &mon_data) const override
Give info to collector.
std::string get_status(bool print_out=false) const override
Get status string, optionally print.
void validate_firmware_version() const override
Validate endpoint firmware version.
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
virtual std::string get_status(bool print_out=false) const =0
Get the status string of the timing node. Optionally print it.
Base class for timing top design nodes.
Base class for timing top design nodes with IO class.
Definition TopDesign.hpp:39
void configure(ClockSource clock_source) const override
Prepare the timing device for data taking.
Definition TopDesign.hpp:81
void get_info(timingfirmwareinfo::TimingDeviceInfo &mon_data) const override
Give info to collector.
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 error(const Issue &issue)
Definition ers.hpp:81
timingendpointinfo::TimingEndpointInfo endpoint_info
Definition Structs.hpp:117