DUNE-DAQ
DUNE Trigger and Data Acquisition software
Toggle main menu visibility
Loading...
Searching...
No Matches
dunedaq
sourcecode
timing
src
VLCmdGeneratorNode.cpp
Go to the documentation of this file.
1
8
9
#include "
timing/VLCmdGeneratorNode.hpp
"
10
#include "
timing/toolbox.hpp
"
11
12
#include "
logging/Logging.hpp
"
13
14
#include <string>
15
16
namespace
dunedaq
{
17
namespace
timing
{
18
19
UHAL_REGISTER_DERIVED_NODE(
VLCmdGeneratorNode
)
20
21
//-----------------------------------------------------------------------------
22
VLCmdGeneratorNode
::
VLCmdGeneratorNode
(const
uhal
::Node& node)
23
:
TimingNode
(node)
24
{}
25
//-----------------------------------------------------------------------------
26
27
//-----------------------------------------------------------------------------
28
VLCmdGeneratorNode::~VLCmdGeneratorNode
() {}
29
//-----------------------------------------------------------------------------
30
31
//-----------------------------------------------------------------------------
32
std::string
33
VLCmdGeneratorNode::get_status
(
bool
print_out)
const
34
{
35
std::stringstream status;
36
auto
subnodes =
read_sub_nodes
(getNode(
"csr.stat"
));
37
status <<
format_reg_table
(subnodes,
"VL Cmd gen state"
);
38
39
if
(print_out)
40
TLOG
() << status.str();
41
return
status.str();
42
}
43
//-----------------------------------------------------------------------------
44
45
//-----------------------------------------------------------------------------
46
void
47
VLCmdGeneratorNode::switch_endpoint_sfp
(uint32_t
address
,
bool
enable
)
const
// NOLINT(build/unsigned)
48
{
49
TLOG_DEBUG
(3) <<
"Switching SFP for endpoint address: "
<<
address
<<
", to state: "
<<
enable
;
50
reset_sub_nodes
(getNode(
"csr.ctrl"
));
51
getNode(
"csr.ctrl.addr"
).write(
address
);
52
getNode(
"csr.ctrl.tx_en"
).write(
enable
);
53
getNode(
"csr.ctrl.go"
).write(0x1);
54
getNode(
"csr.ctrl.go"
).write(0x0);
55
getClient().dispatch();
56
}
57
//-----------------------------------------------------------------------------
58
59
//-----------------------------------------------------------------------------
60
void
61
VLCmdGeneratorNode::apply_endpoint_delay
(uint32_t
address
,
// NOLINT(build/unsigned)
62
uint32_t coarse_delay,
// NOLINT(build/unsigned)
63
uint32_t fine_delay,
// NOLINT(build/unsigned)
64
uint32_t phase_delay)
const
// NOLINT(build/unsigned)
65
{
66
reset_sub_nodes
(getNode(
"csr.ctrl"
),
false
);
67
getNode(
"csr.ctrl.tx_en"
).write(0x0);
68
getNode(
"csr.ctrl.addr"
).write(
address
);
69
getNode(
"csr.ctrl.cdel"
).write(coarse_delay);
70
getNode(
"csr.ctrl.fdel"
).write(fine_delay);
71
getNode(
"csr.ctrl.pdel"
).write(phase_delay);
72
getNode(
"csr.ctrl.update"
).write(0x1);
73
getNode(
"csr.ctrl.go"
).write(0x1);
74
getNode(
"csr.ctrl.go"
).write(0x0);
75
getClient().dispatch();
76
77
TLOG_DEBUG
(2) <<
"Coarse delay "
<<
format_reg_value
(coarse_delay) <<
" applied"
;
78
TLOG_DEBUG
(2) <<
"Fine delay "
<<
format_reg_value
(fine_delay) <<
" applied"
;
79
TLOG_DEBUG
(2) <<
"Phase delay "
<<
format_reg_value
(phase_delay) <<
" applied"
;
80
}
81
//-----------------------------------------------------------------------------
82
83
}
// namespace timing
84
}
// namespace dunedaq
VLCmdGeneratorNode.hpp
dunedaq::timing::TimingNode::reset_sub_nodes
void reset_sub_nodes(const uhal::Node &node, uint32_t aValue=0x0, bool dispatch=true) const
Reset subnodes.
Definition
TimingNode.cpp:45
dunedaq::timing::TimingNode::TimingNode
TimingNode(const uhal::Node &node)
Definition
TimingNode.cpp:18
dunedaq::timing::TimingNode::read_sub_nodes
std::map< std::string, uhal::ValWord< uint32_t > > read_sub_nodes(const uhal::Node &node, bool dispatch=true) const
Read subnodes.
Definition
TimingNode.cpp:29
dunedaq::timing::VLCmdGeneratorNode
Class for master global node.
Definition
VLCmdGeneratorNode.hpp:30
dunedaq::timing::VLCmdGeneratorNode::switch_endpoint_sfp
void switch_endpoint_sfp(uint32_t address, bool enable=false) const
Control the endpoint sfp tx laser.
Definition
VLCmdGeneratorNode.cpp:47
dunedaq::timing::VLCmdGeneratorNode::~VLCmdGeneratorNode
virtual ~VLCmdGeneratorNode()
Definition
VLCmdGeneratorNode.cpp:28
dunedaq::timing::VLCmdGeneratorNode::get_status
std::string get_status(bool print_out=false) const override
Print the status of the timing node.
Definition
VLCmdGeneratorNode.cpp:33
dunedaq::timing::VLCmdGeneratorNode::VLCmdGeneratorNode
VLCmdGeneratorNode(const uhal::Node &node)
Definition
VLCmdGeneratorNode.cpp:22
dunedaq::timing::VLCmdGeneratorNode::apply_endpoint_delay
void apply_endpoint_delay(uint32_t address, uint32_t coarse_delay, uint32_t fine_delay, uint32_t phase_delay) const
Adjust endpoint delay.
Definition
VLCmdGeneratorNode.cpp:61
Logging.hpp
TLOG_DEBUG
#define TLOG_DEBUG(lvl,...)
Definition
Logging.hpp:112
TLOG
#define TLOG(...)
Definition
macro.hpp:22
dunedaq::timing
< Message parameters
Definition
BoreasDesign.hpp:29
dunedaq::timing::format_reg_table
std::string format_reg_table(T data, std::string title, std::vector< std::string > headers)
Format reg-value table.
Definition
toolbox.hxx:166
dunedaq::timing::format_reg_value
std::string format_reg_value(T reg_value, uint32_t base)
Definition
toolbox.hxx:117
dunedaq
Including Qt Headers.
Definition
module.cpp:16
dunedaq::address
Invalid address
Definition
CommonIssues.hpp:29
enable
Definition
enable.py:1
uhal
Definition
ProtocolAxi4Lite.hpp:63
toolbox.hpp
Generated on
for DUNE-DAQ by
1.17.0