Line data Source code
1 : /**
2 : * @file top_designs.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/BoreasDesign.hpp"
10 : #include "timing/ChronosDesign.hpp"
11 : #include "timing/FanoutDesign.hpp"
12 : #include "timing/OuroborosDesign.hpp"
13 : #include "timing/OuroborosMuxDesign.hpp"
14 : #include "timing/EndpointDesign.hpp"
15 : #include "timing/KerberosDesign.hpp"
16 : #include "timing/GaiaDesign.hpp"
17 : #include "timing/HadesDesign.hpp"
18 :
19 : #include <pybind11/pybind11.h>
20 : #include <pybind11/stl.h>
21 :
22 : namespace py = pybind11;
23 :
24 : namespace dunedaq {
25 : namespace timing {
26 : namespace python {
27 :
28 : void
29 0 : register_top_designs(py::module& m)
30 : {
31 : // Boreas
32 0 : py::class_<timing::BoreasDesign, uhal::Node>(m, "BoreasDesign")
33 0 : .def("read_firmware_version", &timing::BoreasDesign::read_firmware_version)
34 0 : .def("validate_firmware_version", &timing::BoreasDesign::validate_firmware_version)
35 0 : .def("sync_timestamp", &timing::BoreasDesign::sync_timestamp)
36 0 : .def("get_status", &timing::BoreasDesign::get_status)
37 0 : .def<void (timing::BoreasDesign::*)(uint32_t, double, bool) const>("enable_periodic_fl_cmd",
38 : &timing::BoreasDesign::enable_periodic_fl_cmd,
39 0 : py::arg("channel"),
40 0 : py::arg("rate"),
41 0 : py::arg("poisson"))
42 0 : .def<void (timing::BoreasDesign::*)(uint32_t, uint32_t, double, bool) const>("enable_periodic_fl_cmd",
43 : &timing::BoreasDesign::enable_periodic_fl_cmd,
44 0 : py::arg("command"),
45 0 : py::arg("channel"),
46 0 : py::arg("rate"),
47 0 : py::arg("poisson"))
48 0 : .def("apply_endpoint_delay",
49 0 : &timing::BoreasDesign::apply_endpoint_delay,
50 0 : py::arg("address"),
51 0 : py::arg("coarse_delay"),
52 0 : py::arg("fine_delay"),
53 0 : py::arg("phase_delay"),
54 0 : py::arg("measure_rtt") = false,
55 0 : py::arg("control_sfp") = true,
56 0 : py::arg("sfp_mux") = -1)
57 0 : .def("measure_endpoint_rtt",
58 0 : &timing::BoreasDesign::measure_endpoint_rtt,
59 0 : py::arg("address"),
60 0 : py::arg("control_sfp") = true,
61 0 : py::arg("sfp_mux") = -1)
62 0 : .def("get_hsi_node", &timing::BoreasDesign::get_hsi_node)
63 0 : .def("configure_hsi",
64 0 : &timing::BoreasDesign::configure_hsi,
65 0 : py::arg("src"),
66 0 : py::arg("re_mask"),
67 0 : py::arg("fe_mask"),
68 0 : py::arg("inv_mask"),
69 0 : py::arg("rate"),
70 0 : py::arg("dispatch") = true)
71 0 : .def("configure", &timing::BoreasDesign::configure, py::arg("clock_source"), py::arg("ts_source"))
72 : ;
73 :
74 : // Fanout
75 0 : py::class_<timing::FanoutDesign, uhal::Node>(m, "FanoutDesign")
76 0 : .def("read_firmware_version", &timing::FanoutDesign::read_firmware_version)
77 0 : .def("validate_firmware_version", &timing::FanoutDesign::validate_firmware_version)
78 0 : .def("switch_mux", &timing::FanoutDesign::switch_mux, py::arg("mux"), py::arg("resync_cdr") = false)
79 0 : .def("read_active_mux", &timing::FanoutDesign::read_active_mux)
80 0 : .def("configure", &timing::FanoutDesign::configure, py::arg("clock_source"))
81 : ;
82 :
83 : // Ouroboros mux
84 0 : py::class_<timing::OuroborosMuxDesign, uhal::Node>(m, "OuroborosMuxDesign")
85 0 : .def("read_firmware_version", &timing::OuroborosMuxDesign::read_firmware_version)
86 0 : .def("validate_firmware_version", &timing::OuroborosMuxDesign::validate_firmware_version)
87 0 : .def("sync_timestamp", &timing::OuroborosMuxDesign::sync_timestamp)
88 0 : .def<void (timing::OuroborosMuxDesign::*)(uint32_t, double, bool) const>("enable_periodic_fl_cmd",
89 : &timing::OuroborosMuxDesign::enable_periodic_fl_cmd,
90 0 : py::arg("channel"),
91 0 : py::arg("rate"),
92 0 : py::arg("poisson"))
93 0 : .def<void (timing::OuroborosMuxDesign::*)(uint32_t, uint32_t, double, bool) const>("enable_periodic_fl_cmd",
94 : &timing::OuroborosMuxDesign::enable_periodic_fl_cmd,
95 0 : py::arg("command"),
96 0 : py::arg("channel"),
97 0 : py::arg("rate"),
98 0 : py::arg("poisson"))
99 0 : .def("switch_mux", &timing::OuroborosMuxDesign::switch_mux, py::arg("mux"), py::arg("resync_cdr") = false)
100 0 : .def("read_active_mux", &timing::OuroborosMuxDesign::read_active_mux)
101 0 : .def("apply_endpoint_delay",
102 0 : &timing::OuroborosMuxDesign::apply_endpoint_delay,
103 0 : py::arg("address"),
104 0 : py::arg("coarse_delay"),
105 0 : py::arg("fine_delay"),
106 0 : py::arg("phase_delay"),
107 0 : py::arg("measure_rtt") = false,
108 0 : py::arg("control_sfp") = true,
109 0 : py::arg("sfp_mux") = -1)
110 0 : .def("measure_endpoint_rtt",
111 0 : &timing::OuroborosMuxDesign::measure_endpoint_rtt,
112 0 : py::arg("address"),
113 0 : py::arg("control_sfp") = true,
114 0 : py::arg("sfp_mux") = -1)
115 0 : .def("scan_sfp_mux", &timing::OuroborosMuxDesign::scan_sfp_mux)
116 0 : .def("configure", &timing::OuroborosMuxDesign::configure, py::arg("clock_source"), py::arg("ts_source"))
117 : ;
118 :
119 : // Master mux
120 0 : py::class_<timing::MasterMuxDesign, uhal::Node>(m, "MasterMuxDesign")
121 0 : .def("read_firmware_version", &timing::MasterMuxDesign::read_firmware_version)
122 0 : .def("validate_firmware_version", &timing::MasterMuxDesign::validate_firmware_version)
123 0 : .def("sync_timestamp", &timing::MasterMuxDesign::sync_timestamp)
124 0 : .def<void (timing::MasterMuxDesign::*)(uint32_t, double, bool) const>("enable_periodic_fl_cmd",
125 : &timing::MasterMuxDesign::enable_periodic_fl_cmd,
126 0 : py::arg("channel"),
127 0 : py::arg("rate"),
128 0 : py::arg("poisson"))
129 0 : .def<void (timing::MasterMuxDesign::*)(uint32_t, uint32_t, double, bool) const>("enable_periodic_fl_cmd",
130 : &timing::MasterMuxDesign::enable_periodic_fl_cmd,
131 0 : py::arg("command"),
132 0 : py::arg("channel"),
133 0 : py::arg("rate"),
134 0 : py::arg("poisson"))
135 0 : .def("switch_mux", &timing::MasterMuxDesign::switch_mux, py::arg("mux"), py::arg("resync_cdr") = false)
136 0 : .def("read_active_mux", &timing::MasterMuxDesign::read_active_mux)
137 0 : .def("apply_endpoint_delay",
138 0 : &timing::MasterMuxDesign::apply_endpoint_delay,
139 0 : py::arg("address"),
140 0 : py::arg("coarse_delay"),
141 0 : py::arg("fine_delay"),
142 0 : py::arg("phase_delay"),
143 0 : py::arg("measure_rtt") = false,
144 0 : py::arg("control_sfp") = true,
145 0 : py::arg("sfp_mux") = -1)
146 0 : .def("measure_endpoint_rtt",
147 0 : &timing::MasterMuxDesign::measure_endpoint_rtt,
148 0 : py::arg("address"),
149 0 : py::arg("control_sfp") = true,
150 0 : py::arg("sfp_mux") = -1)
151 0 : .def("scan_sfp_mux", &timing::MasterMuxDesign::scan_sfp_mux)
152 0 : .def("configure", &timing::MasterMuxDesign::configure, py::arg("clock_source"), py::arg("ts_source"))
153 : ;
154 :
155 : // Master
156 0 : py::class_<timing::MasterDesign, uhal::Node>(m, "MasterDesign")
157 0 : .def("read_firmware_version", &timing::MasterDesign::read_firmware_version)
158 0 : .def("validate_firmware_version", &timing::MasterDesign::validate_firmware_version)
159 0 : .def("sync_timestamp", &timing::MasterDesign::sync_timestamp)
160 0 : .def("get_status", &timing::MasterDesign::get_status)
161 0 : .def<void (timing::MasterDesign::*)(uint32_t, double, bool) const>("enable_periodic_fl_cmd",
162 : &timing::MasterDesign::enable_periodic_fl_cmd,
163 0 : py::arg("channel"),
164 0 : py::arg("rate"),
165 0 : py::arg("poisson"))
166 0 : .def<void (timing::MasterDesign::*)(uint32_t, uint32_t, double, bool) const>("enable_periodic_fl_cmd",
167 : &timing::MasterDesign::enable_periodic_fl_cmd,
168 0 : py::arg("command"),
169 0 : py::arg("channel"),
170 0 : py::arg("rate"),
171 0 : py::arg("poisson"))
172 0 : .def("apply_endpoint_delay",
173 0 : &timing::MasterDesign::apply_endpoint_delay,
174 0 : py::arg("address"),
175 0 : py::arg("coarse_delay"),
176 0 : py::arg("fine_delay"),
177 0 : py::arg("phase_delay"),
178 0 : py::arg("measure_rtt") = false,
179 0 : py::arg("control_sfp") = true,
180 0 : py::arg("sfp_mux") = -1)
181 0 : .def("measure_endpoint_rtt",
182 0 : &timing::MasterDesign::measure_endpoint_rtt,
183 0 : py::arg("address"),
184 0 : py::arg("control_sfp") = true,
185 0 : py::arg("sfp_mux") = -1)
186 0 : .def("configure", &timing::MasterDesign::configure, py::arg("clock_source"), py::arg("ts_source"))
187 : ;
188 :
189 : // Ouroboros
190 0 : py::class_<timing::OuroborosDesign, uhal::Node>(m, "OuroborosDesign")
191 0 : .def("read_firmware_version", &timing::OuroborosDesign::read_firmware_version)
192 0 : .def("validate_firmware_version", &timing::OuroborosDesign::validate_firmware_version)
193 0 : .def("sync_timestamp", &timing::OuroborosDesign::sync_timestamp)
194 0 : .def("get_status", &timing::OuroborosDesign::get_status)
195 0 : .def<void (timing::OuroborosDesign::*)(uint32_t, double, bool) const>("enable_periodic_fl_cmd",
196 : &timing::OuroborosDesign::enable_periodic_fl_cmd,
197 0 : py::arg("channel"),
198 0 : py::arg("rate"),
199 0 : py::arg("poisson"))
200 0 : .def<void (timing::OuroborosDesign::*)(uint32_t, uint32_t, double, bool) const>("enable_periodic_fl_cmd",
201 : &timing::OuroborosDesign::enable_periodic_fl_cmd,
202 0 : py::arg("command"),
203 0 : py::arg("channel"),
204 0 : py::arg("rate"),
205 0 : py::arg("poisson"))
206 0 : .def("apply_endpoint_delay",
207 0 : &timing::OuroborosDesign::apply_endpoint_delay,
208 0 : py::arg("address"),
209 0 : py::arg("coarse_delay"),
210 0 : py::arg("fine_delay"),
211 0 : py::arg("phase_delay"),
212 0 : py::arg("measure_rtt") = false,
213 0 : py::arg("control_sfp") = true,
214 0 : py::arg("sfp_mux") = -1)
215 0 : .def("measure_endpoint_rtt",
216 0 : &timing::OuroborosDesign::measure_endpoint_rtt,
217 0 : py::arg("address"),
218 0 : py::arg("control_sfp") = true,
219 0 : py::arg("sfp_mux") = -1)
220 0 : .def("configure", &timing::OuroborosDesign::configure, py::arg("clock_source"), py::arg("ts_source"))
221 : ;
222 :
223 : // Endpoint
224 0 : py::class_<timing::EndpointDesign, uhal::Node>(m, "EndpointDesign")
225 0 : .def("read_firmware_version", &timing::EndpointDesign::read_firmware_version)
226 0 : .def("validate_firmware_version", &timing::EndpointDesign::validate_firmware_version)
227 0 : .def("get_status", &timing::EndpointDesign::get_status)
228 0 : .def("configure", &timing::EndpointDesign::configure, py::arg("clock_source"))
229 : ;
230 :
231 : // Chronos
232 0 : py::class_<timing::ChronosDesign, uhal::Node>(m, "ChronosDesign")
233 0 : .def("read_firmware_version", &timing::ChronosDesign::read_firmware_version)
234 0 : .def("validate_firmware_version", &timing::ChronosDesign::validate_firmware_version)
235 0 : .def("get_status", &timing::ChronosDesign::get_status)
236 0 : .def("get_hsi_node", &timing::ChronosDesign::get_hsi_node)
237 0 : .def("configure_hsi",
238 0 : &timing::ChronosDesign::configure_hsi,
239 0 : py::arg("src"),
240 0 : py::arg("re_mask"),
241 0 : py::arg("fe_mask"),
242 0 : py::arg("inv_mask"),
243 0 : py::arg("rate"),
244 0 : py::arg("dispatch") = true)
245 0 : .def("configure", &timing::ChronosDesign::configure, py::arg("clock_source"))
246 : ;
247 :
248 : // Hades
249 0 : py::class_<timing::HadesDesign, uhal::Node>(m, "HadesDesign")
250 0 : .def("read_firmware_version", &timing::HadesDesign::read_firmware_version)
251 0 : .def("validate_firmware_version", &timing::HadesDesign::validate_firmware_version)
252 0 : .def("get_status", &timing::HadesDesign::get_status)
253 0 : .def("get_hsi_node", &timing::HadesDesign::get_hsi_node)
254 0 : .def("configure_hsi",
255 0 : &timing::HadesDesign::configure_hsi,
256 0 : py::arg("src"),
257 0 : py::arg("re_mask"),
258 0 : py::arg("fe_mask"),
259 0 : py::arg("inv_mask"),
260 0 : py::arg("rate"),
261 0 : py::arg("dispatch") = true)
262 0 : .def("configure", &timing::HadesDesign::configure, py::arg("clock_source"))
263 : ;
264 :
265 : // Kerberos
266 0 : py::class_<timing::KerberosDesign, uhal::Node>(m, "KerberosDesign")
267 0 : .def("read_firmware_version", &timing::KerberosDesign::read_firmware_version)
268 0 : .def("validate_firmware_version", &timing::KerberosDesign::validate_firmware_version)
269 0 : .def("sync_timestamp", &timing::KerberosDesign::sync_timestamp)
270 0 : .def<void (timing::KerberosDesign::*)(uint32_t, double, bool) const>("enable_periodic_fl_cmd",
271 : &timing::KerberosDesign::enable_periodic_fl_cmd,
272 0 : py::arg("channel"),
273 0 : py::arg("rate"),
274 0 : py::arg("poisson"))
275 0 : .def<void (timing::KerberosDesign::*)(uint32_t, uint32_t, double, bool) const>("enable_periodic_fl_cmd",
276 : &timing::KerberosDesign::enable_periodic_fl_cmd,
277 0 : py::arg("command"),
278 0 : py::arg("channel"),
279 0 : py::arg("rate"),
280 0 : py::arg("poisson"))
281 0 : .def("apply_endpoint_delay",
282 0 : &timing::KerberosDesign::apply_endpoint_delay,
283 0 : py::arg("address"),
284 0 : py::arg("coarse_delay"),
285 0 : py::arg("fine_delay"),
286 0 : py::arg("phase_delay"),
287 0 : py::arg("measure_rtt") = false,
288 0 : py::arg("control_sfp") = true,
289 0 : py::arg("sfp_mux") = -1)
290 0 : .def("measure_endpoint_rtt",
291 0 : &timing::KerberosDesign::measure_endpoint_rtt,
292 0 : py::arg("address"),
293 0 : py::arg("control_sfp") = true,
294 0 : py::arg("sfp_mux") = -1)
295 0 : .def("switch_mux", &timing::KerberosDesign::switch_mux, py::arg("mux"), py::arg("resync_cdr") = false)
296 0 : .def("read_active_mux", &timing::KerberosDesign::read_active_mux)
297 0 : .def("configure", &timing::KerberosDesign::configure, py::arg("clock_source"), py::arg("ts_source"))
298 0 : .def("switch_timing_source_mux", &timing::KerberosDesign::switch_timing_source_mux, py::arg("mux_channel"))
299 0 : .def("read_active_timing_source_mux", &timing::KerberosDesign::read_active_timing_source_mux)
300 : ;
301 :
302 : // Gaia
303 0 : py::class_<timing::GaiaDesign, uhal::Node>(m, "GaiaDesign")
304 0 : .def("read_firmware_version", &timing::GaiaDesign::read_firmware_version)
305 0 : .def("validate_firmware_version", &timing::GaiaDesign::validate_firmware_version)
306 0 : .def("sync_timestamp", &timing::GaiaDesign::sync_timestamp)
307 0 : .def<void (timing::GaiaDesign::*)(uint32_t, double, bool) const>("enable_periodic_fl_cmd",
308 : &timing::GaiaDesign::enable_periodic_fl_cmd,
309 0 : py::arg("channel"),
310 0 : py::arg("rate"),
311 0 : py::arg("poisson"))
312 0 : .def<void (timing::GaiaDesign::*)(uint32_t, uint32_t, double, bool) const>("enable_periodic_fl_cmd",
313 : &timing::GaiaDesign::enable_periodic_fl_cmd,
314 0 : py::arg("command"),
315 0 : py::arg("channel"),
316 0 : py::arg("rate"),
317 0 : py::arg("poisson"))
318 0 : .def("apply_endpoint_delay",
319 0 : &timing::GaiaDesign::apply_endpoint_delay,
320 0 : py::arg("address"),
321 0 : py::arg("coarse_delay"),
322 0 : py::arg("fine_delay"),
323 0 : py::arg("phase_delay"),
324 0 : py::arg("measure_rtt") = false,
325 0 : py::arg("control_sfp") = true,
326 0 : py::arg("sfp_mux") = -1)
327 0 : .def("measure_endpoint_rtt",
328 0 : &timing::GaiaDesign::measure_endpoint_rtt,
329 0 : py::arg("address"),
330 0 : py::arg("control_sfp") = true,
331 0 : py::arg("sfp_mux") = -1)
332 0 : .def("switch_mux", &timing::GaiaDesign::switch_mux, py::arg("mux"), py::arg("resync_cdr") = false)
333 0 : .def("read_active_mux", &timing::GaiaDesign::read_active_mux)
334 0 : .def<void (timing::GaiaDesign::*)(ClockSource, TimestampSource, TimestampTimebase) const>("configure", &timing::GaiaDesign::configure, py::arg("clock_source"), py::arg("ts_source"), py::arg("timebase"))
335 : ;
336 0 : } // NOLINT
337 :
338 : } // namespace python
339 : } // namespace timing
340 : } // namespace dunedaq
|