DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
CDRMuxDesignInterface.hpp
Go to the documentation of this file.
1
12#ifndef TIMING_INCLUDE_TIMING_CDRMUXDESIGNINTERFACE_HPP_
13#define TIMING_INCLUDE_TIMING_CDRMUXDESIGNINTERFACE_HPP_
14
15// PDT Headers
16#include "TimingIssues.hpp"
19
20// uHal Headers
21#include "uhal/DerivedNode.hpp"
22
23// C++ Headers
24#include <chrono>
25#include <sstream>
26#include <string>
27
28namespace dunedaq {
29namespace timing {
30
35{
36
37public:
38 explicit CDRMuxDesignInterface(const uhal::Node& node)
39 : TopDesignInterface(node)
40 , MuxDesignInterface(node) {}
42
48 uint8_t read_active_mux() const override // NOLINT(build/unsigned)
49 {
50 auto active_sfp_mux_channel = getNode("us_mux.csr.ctrl.src").read();
51 getClient().dispatch();
52 return active_sfp_mux_channel.value();
53 }
54
60 void switch_mux(uint8_t mux_channel, bool resync_cdr=false) const override // NOLINT(build/unsigned)
61 {
62 // TODO add mux channel validity check
63 getNode("us_mux.csr.ctrl.src").write(mux_channel);
64 getClient().dispatch();
65
66 if (resync_cdr)
67 {
69 }
70 }
71
77 void resync_active_cdr() const override // NOLINT(build/unsigned)
78 {
79 auto active_mux = read_active_mux();
80 std::string cdr_path("cdr"+std::to_string(active_mux));
81 getNode<UpstreamCDRNode>(cdr_path).resync();
82 }
83
84};
85
86} // namespace timing
87} // namespace dunedaq
88
89#endif // TIMING_INCLUDE_TIMING_CDRMUXDESIGNINTERFACE_HPP_
Base class for timing endpoint design nodes.
uint8_t read_active_mux() const override
Read cdr mux.
void switch_mux(uint8_t mux_channel, bool resync_cdr=false) const override
Switch cdr mux.
void resync_active_cdr() const override
Resync active cdr.
Base class for timing endpoint design nodes.
Base class for timing top design nodes.
Including Qt Headers.