DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
HermesCoreController.hpp
Go to the documentation of this file.
1
2#ifndef HERMESMODULES_INCLUDE_HERMESCORECONTROLLER_HPP_
3#define HERMESMODULES_INCLUDE_HERMESCORECONTROLLER_HPP_
4
5#include "ers/Issue.hpp"
6#include "logging/Logging.hpp" // NOTE: if ISSUES ARE DECLARED BEFORE include logging/Logging.hpp, TLOG_DEBUG<<issue wont work.
7#include "uhal/uhal.hpp"
8
10namespace dunedaq {
11
13 LinkDoesNotExist,
14 "Hermes Link " << lid << " does not exist",
15 ((int)lid)
16 );
17
19 InputBufferDoesNotExist,
20 "Hermes Input Buffer " << bid << " does not exist",
21 ((int)bid)
22 );
23
24
26 MgtDoesNotExist,
27 "Hermes MGT " << mgtid << " does not exist",
28 ((int)mgtid)
29 );
30
32 MagicNumberError,
33 "Hermes Magic number failed " << found << " (" << expected << ")",
34 ((uint32_t)found)((uint32_t)expected)
35 );
36
37
39 LinkInError,
40 "Hermes Link " << link << " is in error (err:" << err << ", eth_rdy:" << eth_rdy << ", src_rdy:" << src_rdy << ", udp_rdy:" << udp_rdy <<" )",
41 ((uint16_t)link)((bool)err)((bool)eth_rdy)((bool)src_rdy)((bool)udp_rdy)
42 );
43
44namespace hermesmodules {
45
47
48public:
49
50 struct CoreInfo {
51 uint32_t design;
52 uint32_t major;
53 uint32_t minor;
54 uint32_t patch;
55 uint32_t n_mgt;
56 uint32_t n_src;
57 uint32_t ref_freq;
58 uint32_t srcs_per_mux;
59 };
60
61 struct LinkGeoInfo {
62 uint16_t detid;
63 uint16_t crateid;
64 uint16_t slotid;
65 };
66
67 explicit HermesCoreController(uhal::HwInterface, std::string readout_id="");
68 virtual ~HermesCoreController();
69
70 const CoreInfo& get_info() const { return m_core_info; }
71
72 void sel_tx_mux(uint16_t i) ;
73
74 void sel_tx_mux_buf(uint16_t i);
75
76 void sel_udp_core(uint16_t i);
77
78 void reset(bool nuke=false);
79
80 bool is_link_in_error(uint16_t link, bool do_throw=false);
81
82 void enable(uint16_t link, bool enable);
83
84 void config_mux(uint16_t link, uint16_t det, uint16_t crate, uint16_t slot);
85
86 void config_udp(uint16_t link, uint64_t src_mac, uint32_t src_ip, uint16_t src_port, uint64_t dst_mac, uint32_t dst_ip, uint16_t dst_port, uint32_t filters);
87
88 void config_fake_src(uint16_t link, uint16_t n_src, uint16_t data_len, uint16_t rate);
89
90 LinkGeoInfo read_link_geo_info(uint16_t link);
91
92 opmon::LinkInfo read_link_stats(uint16_t link);
93
94
95private:
96
97 void load_hw_info();
98
99 uhal::HwInterface m_hw;
100
101 const uhal::Node& m_readout;
102
104
105};
106
107}
108}
109
110#endif /* HERMESMODULES_INCLUDE_HERMESCORECONTROLLER_HPP_ */
#define ERS_DECLARE_ISSUE(namespace_name, class_name, message, attributes)
HermesCoreController(uhal::HwInterface, std::string readout_id="")
void config_udp(uint16_t link, uint64_t src_mac, uint32_t src_ip, uint16_t src_port, uint64_t dst_mac, uint32_t dst_ip, uint16_t dst_port, uint32_t filters)
void config_mux(uint16_t link, uint16_t det, uint16_t crate, uint16_t slot)
bool is_link_in_error(uint16_t link, bool do_throw=false)
void config_fake_src(uint16_t link, uint16_t n_src, uint16_t data_len, uint16_t rate)
The DUNE-DAQ namespace.