Line data Source code
1 : /**
2 : * @file io.cpp
3 : *
4 : * This is part of the DUNE DAQ Software Suite, copyright 2020.
5 : * Licensing/copyright details are in the COPYING file that you should have
6 : * received with this code.
7 : */
8 :
9 : #include "timing/FMCIONode.hpp"
10 : #include "timing/IONode.hpp"
11 : #include "timing/PC059IONode.hpp"
12 : #include "timing/FIBIONode.hpp"
13 : #include "timing/FIBV2IONode.hpp"
14 : #include "timing/SIMIONode.hpp"
15 : #include "timing/TLUIONode.hpp"
16 : #include "timing/MIBIONode.hpp"
17 : #include "timing/SwitchyardNode.hpp"
18 : #include "timing/MIBV2IONode.hpp"
19 : #include "timing/GIBIONode.hpp"
20 : #include "timing/GIBV2IONode.hpp"
21 : #include "timing/GIBV3IONode.hpp"
22 :
23 : #include <pybind11/pybind11.h>
24 : #include <pybind11/stl.h>
25 :
26 : #include <string>
27 :
28 : namespace py = pybind11;
29 :
30 : namespace dunedaq {
31 : namespace timing {
32 : namespace python {
33 :
34 : void
35 0 : register_io(py::module& m)
36 : {
37 :
38 0 : py::class_<timing::IONode, uhal::Node>(m, "IONode");
39 :
40 0 : py::class_<timing::FMCIONode, timing::IONode, uhal::Node>(m, "FMCIONode")
41 0 : .def(py::init<const uhal::Node&>())
42 0 : .def<void (timing::FMCIONode::*)(const std::string&) const>(
43 0 : "reset", &timing::FMCIONode::reset, py::arg("clock_config_file"))
44 0 : .def<void (timing::FMCIONode::*)(const timing::ClockSource&) const>(
45 0 : "reset", &timing::FMCIONode::reset, py::arg("clock_source"))
46 0 : .def("soft_reset", &timing::FMCIONode::soft_reset)
47 0 : .def("read_firmware_frequency", &timing::FMCIONode::read_firmware_frequency)
48 0 : .def("get_clock_frequencies_table", &timing::FMCIONode::get_clock_frequencies_table, py::arg("print_out") = false)
49 0 : .def("get_status", &timing::FMCIONode::get_status, py::arg("print_out") = false)
50 0 : .def("get_pll_status", &timing::FMCIONode::get_pll_status, py::arg("print_out") = false)
51 0 : .def("get_hardware_info", &timing::FMCIONode::get_hardware_info, py::arg("print_out") = false)
52 0 : .def("get_sfp_status", &timing::FMCIONode::get_sfp_status, py::arg("sfp_id"), py::arg("print_out") = false)
53 0 : .def("switch_sfp_soft_tx_control_bit", &timing::FMCIONode::switch_sfp_soft_tx_control_bit)
54 0 : .def("switch_sfp_tx", &timing::FMCIONode::switch_sfp_tx);
55 :
56 0 : py::class_<timing::PC059IONode, timing::IONode, uhal::Node>(m, "PC059IONode")
57 0 : .def(py::init<const uhal::Node&>())
58 0 : .def<void (timing::PC059IONode::*)(const std::string&) const>(
59 0 : "reset", &timing::PC059IONode::reset, py::arg("clock_config_file"))
60 0 : .def<void (timing::PC059IONode::*)(const timing::ClockSource&) const>(
61 0 : "reset", &timing::PC059IONode::reset, py::arg("clock_source"))
62 0 : .def("soft_reset", &timing::PC059IONode::soft_reset)
63 0 : .def("read_firmware_frequency", &timing::PC059IONode::read_firmware_frequency)
64 0 : .def("get_clock_frequencies_table", &timing::PC059IONode::get_clock_frequencies_table, py::arg("print_out") = false)
65 0 : .def("get_status", &timing::PC059IONode::get_status, py::arg("print_out") = false)
66 0 : .def("get_pll_status", &timing::PC059IONode::get_pll_status, py::arg("print_out") = false)
67 0 : .def("get_hardware_info", &timing::PC059IONode::get_hardware_info, py::arg("print_out") = false)
68 0 : .def("get_sfp_status", &timing::PC059IONode::get_sfp_status, py::arg("sfp_id"), py::arg("print_out") = false)
69 0 : .def("switch_sfp_soft_tx_control_bit", &timing::PC059IONode::switch_sfp_soft_tx_control_bit)
70 0 : .def("switch_sfp_mux_channel", &timing::PC059IONode::switch_sfp_mux_channel, py::arg("mux_channel"))
71 0 : .def("read_active_sfp_mux_channel", &timing::PC059IONode::read_active_sfp_mux_channel)
72 0 : .def("switch_sfp_tx", &timing::PC059IONode::switch_sfp_tx);
73 :
74 0 : py::class_<timing::FIBIONode, timing::IONode, uhal::Node>(m, "FIBIONode")
75 0 : .def(py::init<const uhal::Node&>())
76 0 : .def<void (timing::FIBIONode::*)(const std::string&) const>(
77 0 : "reset", &timing::FIBIONode::reset, py::arg("clock_config_file"))
78 0 : .def<void (timing::FIBIONode::*)(const timing::ClockSource&) const>(
79 0 : "reset", &timing::FIBIONode::reset, py::arg("clock_source"))
80 0 : .def("soft_reset", &timing::FIBIONode::soft_reset)
81 0 : .def("read_firmware_frequency", &timing::FIBIONode::read_firmware_frequency)
82 0 : .def("get_clock_frequencies_table", &timing::FIBIONode::get_clock_frequencies_table, py::arg("print_out") = false)
83 0 : .def("get_status", &timing::FIBIONode::get_status, py::arg("print_out") = false)
84 0 : .def("get_pll_status", &timing::FIBIONode::get_pll_status, py::arg("print_out") = false)
85 0 : .def("get_hardware_info", &timing::FIBIONode::get_hardware_info, py::arg("print_out") = false)
86 0 : .def("get_sfp_status", &timing::FIBIONode::get_sfp_status, py::arg("sfp_id"), py::arg("print_out") = false)
87 0 : .def("switch_sfp_soft_tx_control_bit", &timing::FIBIONode::switch_sfp_soft_tx_control_bit)
88 0 : .def("switch_sfp_mux_channel", &timing::FIBIONode::switch_sfp_mux_channel, py::arg("mux_channel"))
89 0 : .def("read_active_sfp_mux_channel", &timing::FIBIONode::read_active_sfp_mux_channel)
90 0 : .def("switch_sfp_tx", &timing::FIBIONode::switch_sfp_tx);
91 :
92 0 : py::class_<timing::FIBV2IONode, timing::IONode, uhal::Node>(m, "FIBV2IONode")
93 0 : .def(py::init<const uhal::Node&>())
94 0 : .def<void (timing::FIBV2IONode::*)(const timing::ClockSource&) const>(
95 0 : "reset", &timing::FIBV2IONode::reset, py::arg("clock_source"))
96 0 : .def("soft_reset", &timing::FIBV2IONode::soft_reset)
97 0 : .def("read_firmware_frequency", &timing::FIBV2IONode::read_firmware_frequency)
98 0 : .def("get_clock_frequencies_table", &timing::FIBV2IONode::get_clock_frequencies_table, py::arg("print_out") = false)
99 0 : .def("get_status", &timing::FIBV2IONode::get_status, py::arg("print_out") = false)
100 0 : .def("get_pll_status", &timing::FIBV2IONode::get_pll_status, py::arg("print_out") = false)
101 0 : .def("get_hardware_info", &timing::FIBV2IONode::get_hardware_info, py::arg("print_out") = false)
102 0 : .def("get_sfp_status", &timing::FIBV2IONode::get_sfp_status, py::arg("sfp_id"), py::arg("print_out") = false)
103 0 : .def("switch_sfp_soft_tx_control_bit", &timing::FIBV2IONode::switch_sfp_soft_tx_control_bit)
104 0 : .def("switch_sfp_tx", &timing::FIBV2IONode::switch_sfp_tx)
105 0 : .def("read_board_temperature", &timing::FIBV2IONode::read_board_temperature)
106 : ;
107 :
108 0 : py::class_<timing::TLUIONode, timing::IONode, uhal::Node>(m, "TLUIONode")
109 0 : .def(py::init<const uhal::Node&>())
110 0 : .def<void (timing::TLUIONode::*)(const std::string&) const>(
111 0 : "reset", &timing::TLUIONode::reset, py::arg("clock_config_file"))
112 0 : .def<void (timing::TLUIONode::*)(const timing::ClockSource&) const>(
113 0 : "reset", &timing::TLUIONode::reset, py::arg("clock_source"))
114 0 : .def("soft_reset", &timing::TLUIONode::soft_reset)
115 0 : .def("read_firmware_frequency", &timing::TLUIONode::read_firmware_frequency)
116 0 : .def("get_clock_frequencies_table", &timing::TLUIONode::get_clock_frequencies_table, py::arg("print_out") = false)
117 0 : .def("get_status", &timing::TLUIONode::get_status, py::arg("print_out") = false)
118 0 : .def("get_pll_status", &timing::TLUIONode::get_pll_status, py::arg("print_out") = false)
119 0 : .def("get_hardware_info", &timing::TLUIONode::get_hardware_info, py::arg("print_out") = false)
120 0 : .def("get_sfp_status", &timing::TLUIONode::get_sfp_status, py::arg("sfp_id"), py::arg("print_out") = false)
121 0 : .def("switch_sfp_soft_tx_control_bit", &timing::TLUIONode::switch_sfp_soft_tx_control_bit)
122 0 : .def("configure_dac",
123 0 : &timing::TLUIONode::configure_dac,
124 0 : py::arg("dac_id"),
125 0 : py::arg("dac_value"),
126 0 : py::arg("internal_ref") = false)
127 0 : .def("switch_sfp_tx", &timing::TLUIONode::switch_sfp_tx);
128 :
129 0 : py::class_<timing::SIMIONode, timing::IONode, uhal::Node>(m, "SIMIONode")
130 0 : .def(py::init<const uhal::Node&>())
131 0 : .def<void (timing::SIMIONode::*)(const std::string&) const>(
132 0 : "reset", &timing::SIMIONode::reset, py::arg("clock_config_file"))
133 0 : .def<void (timing::SIMIONode::*)(const timing::ClockSource&) const>(
134 0 : "reset", &timing::SIMIONode::reset, py::arg("clock_source"))
135 0 : .def("soft_reset", &timing::SIMIONode::soft_reset)
136 0 : .def("read_firmware_frequency", &timing::SIMIONode::read_firmware_frequency)
137 0 : .def("get_clock_frequencies_table", &timing::SIMIONode::get_clock_frequencies_table, py::arg("print_out") = false)
138 0 : .def("get_status", &timing::SIMIONode::get_status, py::arg("print_out") = false)
139 0 : .def("get_pll_status", &timing::SIMIONode::get_pll_status, py::arg("print_out") = false)
140 0 : .def("get_hardware_info", &timing::SIMIONode::get_hardware_info, py::arg("print_out") = false)
141 0 : .def("get_sfp_status", &timing::SIMIONode::get_sfp_status, py::arg("sfp_id"), py::arg("print_out") = false)
142 0 : .def("switch_sfp_soft_tx_control_bit", &timing::SIMIONode::switch_sfp_soft_tx_control_bit)
143 0 : .def("switch_sfp_tx", &timing::SIMIONode::switch_sfp_tx);
144 :
145 0 : py::class_<timing::MIBIONode, timing::IONode, uhal::Node>(m, "MIBIONode")
146 0 : .def(py::init<const uhal::Node&>())
147 0 : .def<void (timing::MIBIONode::*)(const std::string&) const>(
148 0 : "reset", &timing::MIBIONode::reset, py::arg("clock_config_file"))
149 0 : .def<void (timing::MIBIONode::*)(const timing::ClockSource&) const>(
150 0 : "reset", &timing::MIBIONode::reset, py::arg("clock_source"))
151 0 : .def("soft_reset", &timing::MIBIONode::soft_reset)
152 0 : .def("read_firmware_frequency", &timing::MIBIONode::read_firmware_frequency)
153 0 : .def("get_clock_frequencies_table", &timing::MIBIONode::get_clock_frequencies_table, py::arg("print_out") = false)
154 0 : .def("get_status", &timing::MIBIONode::get_status, py::arg("print_out") = false)
155 0 : .def("get_pll_status", &timing::MIBIONode::get_pll_status, py::arg("print_out") = false)
156 0 : .def("get_pll", &timing::MIBIONode::get_pll)
157 0 : .def("get_hardware_info", &timing::MIBIONode::get_hardware_info, py::arg("print_out") = false)
158 0 : .def("get_sfp_status", &timing::MIBIONode::get_sfp_status, py::arg("sfp_id"), py::arg("print_out") = false)
159 0 : .def("switch_sfp_soft_tx_control_bit", &timing::MIBIONode::switch_sfp_soft_tx_control_bit)
160 0 : .def("switch_sfp_tx", &timing::MIBIONode::switch_sfp_tx)
161 : ;
162 :
163 0 : py::class_<timing::SwitchyardNode, uhal::Node>(m, "SwitchyardNode")
164 0 : .def("get_status", &timing::SwitchyardNode::get_status, py::arg("print_out") = false)
165 0 : .def("configure_master_source", &timing::SwitchyardNode::configure_master_source, py::arg("master_source"), py::arg("dispatch") = true)
166 0 : .def("configure_endpoint_source", &timing::SwitchyardNode::configure_endpoint_source, py::arg("endpoint_source"), py::arg("dispatch") = true);
167 :
168 0 : py::class_<timing::MIBV2IONode, timing::IONode, uhal::Node>(m, "MIBV2IONode")
169 0 : .def(py::init<const uhal::Node&>())
170 0 : .def<void (timing::MIBV2IONode::*)(const std::string&) const>(
171 0 : "reset", &timing::MIBV2IONode::reset, py::arg("clock_config_file"))
172 0 : .def<void (timing::MIBV2IONode::*)(const timing::ClockSource&) const>(
173 0 : "reset", &timing::MIBV2IONode::reset, py::arg("clock_source"))
174 0 : .def("soft_reset", &timing::MIBV2IONode::soft_reset)
175 0 : .def("read_firmware_frequency", &timing::MIBV2IONode::read_firmware_frequency)
176 0 : .def("get_clock_frequencies_table", &timing::MIBV2IONode::get_clock_frequencies_table, py::arg("print_out") = false)
177 0 : .def("get_status", &timing::MIBV2IONode::get_status, py::arg("print_out") = false)
178 0 : .def("get_pll_status", &timing::MIBV2IONode::get_pll_status, py::arg("print_out") = false)
179 0 : .def("get_pll", &timing::MIBV2IONode::get_pll)
180 0 : .def("get_hardware_info", &timing::MIBV2IONode::get_hardware_info, py::arg("print_out") = false)
181 0 : .def("get_sfp_status", &timing::MIBV2IONode::get_sfp_status, py::arg("sfp_id"), py::arg("print_out") = false)
182 0 : .def("switch_sfp_soft_tx_control_bit", &timing::MIBV2IONode::switch_sfp_soft_tx_control_bit)
183 0 : .def("switch_sfp_tx", &timing::MIBV2IONode::switch_sfp_tx)
184 : ;
185 :
186 : // TODO fix missing binding and add GIBv2/3 inheritance, dlindebaum, 2025.10.06
187 0 : py::class_<timing::GIBIONode, timing::IONode, uhal::Node>(m, "GIBIONode")
188 0 : .def(py::init<const uhal::Node&>())
189 0 : .def<void (timing::GIBIONode::*)(const std::string&) const>(
190 0 : "reset", &timing::GIBIONode::reset, py::arg("clock_config_file"))
191 0 : .def<void (timing::GIBIONode::*)(const timing::ClockSource&) const>(
192 0 : "reset", &timing::GIBIONode::reset, py::arg("clock_source"))
193 0 : .def("configure_pll", &timing::GIBIONode::configure_pll, py::arg("clock_config_file"))
194 0 : .def("soft_reset", &timing::GIBIONode::soft_reset)
195 0 : .def("read_firmware_frequency", &timing::GIBIONode::read_firmware_frequency)
196 0 : .def("get_clock_frequencies_table", &timing::GIBIONode::get_clock_frequencies_table, py::arg("print_out") = false)
197 0 : .def("get_full_clock_config_file_path", &timing::GIBIONode::get_full_clock_config_file_path, py::arg("clock_source"))
198 0 : .def("get_status", &timing::GIBIONode::get_status, py::arg("print_out") = false)
199 0 : .def("get_pll_status", &timing::GIBIONode::get_pll_status, py::arg("print_out") = false)
200 0 : .def("get_pll", &timing::GIBIONode::get_pll)
201 0 : .def("get_hardware_info", &timing::GIBIONode::get_hardware_info, py::arg("print_out") = false)
202 0 : .def("set_up_io_infrastructure", &timing::GIBIONode::set_up_io_infrastructure)
203 0 : .def("configure_expander", &timing::GIBIONode::configure_expander)
204 0 : .def("reset_pll", &timing::GIBIONode::reset_pll)
205 0 : .def("get_sfp_status", &timing::GIBIONode::get_sfp_status, py::arg("sfp_id"), py::arg("print_out") = false)
206 0 : .def("read_io_expanders", &timing::GIBIONode::read_io_expanders)
207 0 : .def("read_sfps_los", &timing::GIBIONode::read_sfps_los)
208 0 : .def("read_sfps_fault", &timing::GIBIONode::read_sfps_fault)
209 0 : .def("clocks_ok", &timing::GIBIONode::clocks_ok)
210 0 : .def("switch_sfp_soft_tx_control_bit", &timing::GIBIONode::switch_sfp_soft_tx_control_bit)
211 0 : .def("set_i2c_mux_channels", &timing::GIBIONode::set_i2c_mux_channels)
212 0 : .def("switch_sfp_tx", &timing::GIBIONode::switch_sfp_tx)
213 : ;
214 :
215 0 : py::class_<timing::GIBV2IONode, timing::IONode, uhal::Node>(m, "GIBV2IONode")
216 0 : .def(py::init<const uhal::Node&>())
217 0 : .def<void (timing::GIBV2IONode::*)(const std::string&) const>(
218 0 : "reset", &timing::GIBV2IONode::reset, py::arg("clock_config_file"))
219 0 : .def<void (timing::GIBV2IONode::*)(const timing::ClockSource&) const>(
220 0 : "reset", &timing::GIBV2IONode::reset, py::arg("clock_source"))
221 0 : .def("configure_pll", &timing::GIBV2IONode::configure_pll, py::arg("clock_config_file"))
222 0 : .def("soft_reset", &timing::GIBV2IONode::soft_reset)
223 0 : .def("read_firmware_frequency", &timing::GIBV2IONode::read_firmware_frequency)
224 0 : .def("get_full_clock_config_file_path", &timing::GIBV2IONode::get_full_clock_config_file_path, py::arg("clock_source"))
225 0 : .def("get_clock_frequencies_table", &timing::GIBV2IONode::get_clock_frequencies_table, py::arg("print_out") = false)
226 0 : .def("get_status", &timing::GIBV2IONode::get_status, py::arg("print_out") = false)
227 0 : .def("get_pll_status", &timing::GIBV2IONode::get_pll_status, py::arg("print_out") = false)
228 0 : .def("get_pll", &timing::GIBV2IONode::get_pll)
229 0 : .def("get_hardware_info", &timing::GIBV2IONode::get_hardware_info, py::arg("print_out") = false)
230 0 : .def("set_up_io_infrastructure", &timing::GIBV2IONode::set_up_io_infrastructure)
231 0 : .def("configure_expander", &timing::GIBV2IONode::configure_expander)
232 0 : .def("reset_pll", &timing::GIBV2IONode::reset_pll)
233 0 : .def("get_sfp_status", &timing::GIBV2IONode::get_sfp_status, py::arg("sfp_id"), py::arg("print_out") = false)
234 0 : .def("read_io_expanders", &timing::GIBV2IONode::read_io_expanders)
235 0 : .def("read_sfps_los", &timing::GIBV2IONode::read_sfps_los)
236 0 : .def("read_sfps_fault", &timing::GIBV2IONode::read_sfps_fault)
237 0 : .def("clocks_ok", &timing::GIBV2IONode::clocks_ok)
238 0 : .def("switch_sfp_soft_tx_control_bit", &timing::GIBV2IONode::switch_sfp_soft_tx_control_bit)
239 0 : .def("set_i2c_mux_channels", &timing::GIBV2IONode::set_i2c_mux_channels)
240 0 : .def("switch_sfp_tx", &timing::GIBV2IONode::switch_sfp_tx)
241 : ;
242 :
243 0 : py::class_<timing::GIBV3IONode, timing::IONode, uhal::Node>(m, "GIBV3IONode")
244 0 : .def(py::init<const uhal::Node&>())
245 0 : .def<void (timing::GIBV3IONode::*)(const std::string&) const>(
246 0 : "reset", &timing::GIBV3IONode::reset, py::arg("clock_config_file"))
247 0 : .def<void (timing::GIBV3IONode::*)(const timing::ClockSource&) const>(
248 0 : "reset", &timing::GIBV3IONode::reset, py::arg("clock_source"))
249 0 : .def("configure_pll", &timing::GIBV3IONode::configure_pll, py::arg("clock_config_file"))
250 0 : .def("soft_reset", &timing::GIBV3IONode::soft_reset)
251 0 : .def("read_firmware_frequency", &timing::GIBV3IONode::read_firmware_frequency)
252 0 : .def("get_full_clock_config_file_path", &timing::GIBV3IONode::get_full_clock_config_file_path, py::arg("clock_source"))
253 0 : .def("get_clock_frequencies_table", &timing::GIBV3IONode::get_clock_frequencies_table, py::arg("print_out") = false)
254 0 : .def("get_status", &timing::GIBV3IONode::get_status, py::arg("print_out") = false)
255 0 : .def("get_pll_status", &timing::GIBV3IONode::get_pll_status, py::arg("print_out") = false)
256 0 : .def("get_pll", &timing::GIBV3IONode::get_pll)
257 0 : .def("get_hardware_info", &timing::GIBV3IONode::get_hardware_info, py::arg("print_out") = false)
258 0 : .def("set_up_io_infrastructure", &timing::GIBV3IONode::set_up_io_infrastructure)
259 0 : .def("configure_expander", &timing::GIBV3IONode::configure_expander)
260 0 : .def("reset_pll", &timing::GIBV3IONode::reset_pll)
261 0 : .def("get_sfp_status", &timing::GIBV3IONode::get_sfp_status, py::arg("sfp_id"), py::arg("print_out") = false)
262 0 : .def("read_io_expanders", &timing::GIBV3IONode::read_io_expanders)
263 0 : .def("read_sfps_los", &timing::GIBV3IONode::read_sfps_los)
264 0 : .def("read_sfps_fault", &timing::GIBV3IONode::read_sfps_fault)
265 0 : .def("clocks_ok", &timing::GIBV3IONode::clocks_ok)
266 0 : .def("switch_sfp_soft_tx_control_bit", &timing::GIBV3IONode::switch_sfp_soft_tx_control_bit)
267 0 : .def("set_i2c_mux_channels", &timing::GIBV3IONode::set_i2c_mux_channels)
268 0 : .def("switch_sfp_tx", &timing::GIBV3IONode::switch_sfp_tx)
269 : ;
270 :
271 0 : } // NOLINT
272 :
273 : } // namespace python
274 : } // namespace timing
275 : } // namespace dunedaq
|