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
12ERS_DECLARE_ISSUE(hermesmodules, LinkDoesNotExist, "Hermes Link " << lid << " does not exist", ((int)lid));
13
15 InputBufferDoesNotExist,
16 "Hermes Input Buffer " << bid << " does not exist",
17 ((int)bid));
18
19ERS_DECLARE_ISSUE(hermesmodules, MgtDoesNotExist, "Hermes MGT " << mgtid << " does not exist", ((int)mgtid));
20
22 MagicNumberError,
23 "Hermes Magic number failed " << found << " (" << expected << ")",
24 ((uint32_t)found)((uint32_t)expected));
25
27 LinkInError,
28 "Hermes Link " << link << " is in error (err:" << err << ", eth_rdy:" << eth_rdy
29 << ", src_rdy:" << src_rdy << ", udp_rdy:" << udp_rdy << " )",
30 ((uint16_t)link)((bool)err)((bool)eth_rdy)((bool)src_rdy)((bool)udp_rdy));
31
32namespace hermesmodules {
33
35{
36
37public:
38 struct CoreInfo
39 {
40 uint32_t design;
41 uint32_t major;
42 uint32_t minor;
43 uint32_t patch;
44 uint32_t n_mgt;
45 uint32_t n_src;
46 uint32_t ref_freq;
47 uint32_t srcs_per_mux;
48 };
49
51 {
52 uint16_t detid;
53 uint16_t crateid;
54 uint16_t slotid;
55 };
56
57 explicit HermesCoreController(uhal::HwInterface, std::string readout_id = "");
58 virtual ~HermesCoreController();
59
60 const CoreInfo& get_info() const { return m_core_info; }
61
62 void sel_tx_mux(uint16_t i);
63
64 void sel_tx_mux_buf(uint16_t i);
65
66 void sel_udp_core(uint16_t i);
67
68 void reset(bool nuke = false);
69
70 bool is_link_in_error(uint16_t link, bool do_throw = false);
71
72 void enable(uint16_t link, bool enable);
73
74 void config_mux(uint16_t link, uint16_t det, uint16_t crate, uint16_t slot);
75
76 void config_udp(uint16_t link,
77 uint64_t src_mac,
78 uint32_t src_ip,
79 uint16_t src_port,
80 uint64_t dst_mac,
81 uint32_t dst_ip,
82 uint16_t dst_port,
83 uint32_t filters);
84
85 void config_fake_src(uint16_t link, uint16_t n_src, uint16_t data_len, uint16_t rate);
86
87 LinkGeoInfo read_link_geo_info(uint16_t link);
88
89 opmon::LinkInfo read_link_stats(uint16_t link);
90
91private:
92 void load_hw_info();
93
94 uhal::HwInterface m_hw;
95
96 const uhal::Node& m_readout;
97
99};
100
101}
102}
103
104#endif /* HERMESMODULES_INCLUDE_HERMESCORECONTROLLER_HPP_ */
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.
ERS_DECLARE_ISSUE(cibmodules, CIBCommunicationError, " CIB Hardware Communication Error: "<< descriptor,((std::string) descriptor)) ERS_DECLARE_ISSUE(cibmodules