Line data Source code
1 : /**
2 : * @file master.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/MasterNode.hpp"
10 : #include "timing/UpstreamCDRNode.hpp"
11 : #include "timing/IRIGTimestampNode.hpp"
12 :
13 : #include <pybind11/pybind11.h>
14 : #include <pybind11/stl.h>
15 :
16 : namespace py = pybind11;
17 :
18 : namespace dunedaq {
19 : namespace timing {
20 : namespace python {
21 :
22 : void
23 0 : register_master(py::module& m)
24 : {
25 0 : py::class_<timing::MasterNode, uhal::Node>(m, "MasterNode")
26 0 : .def(py::init<const uhal::Node&>())
27 0 : .def("switch_endpoint_sfp", &timing::MasterNode::switch_endpoint_sfp)
28 0 : .def("enable_upstream_endpoint", &timing::MasterNode::enable_upstream_endpoint)
29 0 : .def("reset_command_counters", &timing::MasterNode::reset_command_counters)
30 0 : .def("transmit_async_packet", &timing::MasterNode::transmit_async_packet, py::arg("packet"), py::arg("timeout") = 500) //timeout [us]
31 0 : .def("write_endpoint_data", &timing::MasterNode::write_endpoint_data)
32 0 : .def("read_endpoint_data", &timing::MasterNode::read_endpoint_data)
33 0 : .def("send_fl_cmd",
34 0 : &timing::MasterNode::send_fl_cmd,
35 0 : py::arg("command"),
36 0 : py::arg("channel"),
37 0 : py::arg("number_of_commands") = 1)
38 0 : .def<void (timing::MasterNode::*)(uint32_t, uint32_t, double, bool, uint32_t) const>("enable_periodic_fl_cmd",
39 : &timing::MasterNode::enable_periodic_fl_cmd,
40 0 : py::arg("command"),
41 0 : py::arg("channel"),
42 0 : py::arg("rate"),
43 0 : py::arg("poisson"),
44 0 : py::arg("clock_frequency_hz"))
45 0 : .def("disable_periodic_fl_cmd", &timing::MasterNode::disable_periodic_fl_cmd)
46 0 : .def("get_status", &timing::MasterNode::get_status, py::arg("print_out") = false)
47 0 : .def("get_status_with_date", &timing::MasterNode::get_status_with_date, py::arg("clock_frequency_hz"), py::arg("print_out") = false)
48 0 : .def("sync_timestamp", &timing::MasterNode::sync_timestamp, py::arg("source"))
49 0 : .def("read_timestamp", &timing::MasterNode::read_timestamp)
50 0 : .def("disable_timestamp_broadcast", &timing::MasterNode::disable_timestamp_broadcast)
51 0 : .def("enable_timestamp_broadcast", &timing::MasterNode::enable_timestamp_broadcast)
52 0 : .def("configure_endpoint_command_decoder", &timing::MasterNode::configure_endpoint_command_decoder,
53 0 : py::arg("endpoint_address"),
54 0 : py::arg("slot"),
55 0 : py::arg("command"));
56 :
57 0 : py::class_<timing::UpstreamCDRNode, uhal::Node>(m, "UpstreamCDRNode")
58 0 : .def(py::init<const uhal::Node&>())
59 0 : .def("get_status", &timing::UpstreamCDRNode::get_status, py::arg("print_out") = false)
60 0 : .def("resync", &timing::UpstreamCDRNode::resync);
61 :
62 0 : py::class_<timing::IRIGTimestampNode, uhal::Node>(m, "IRIGTimestampNode")
63 0 : .def(py::init<const uhal::Node&>())
64 0 : .def("get_status", &timing::IRIGTimestampNode::get_status, py::arg("print_out") = false)
65 0 : .def("set_ts_timebase", &timing::IRIGTimestampNode::set_ts_timebase, py::arg("ts_timebase"))
66 0 : .def("set_ts_epoch", &timing::IRIGTimestampNode::set_ts_epoch, py::arg("ts_epoch"))
67 0 : .def("set_ts_epoch_value", &timing::IRIGTimestampNode::set_ts_epoch_value, py::arg("epoch_to_2000_seconds_tai"), py::arg("epoch_to_2000_leap_seconds"))
68 0 : .def("set_ts_seconds_offset", &timing::IRIGTimestampNode::set_ts_seconds_offset, py::arg("seconds_offset"))
69 0 : .def("set_ts_ticks_offset", &timing::IRIGTimestampNode::set_ts_ticks_offset, py::arg("ticks_offset"))
70 : ;
71 :
72 0 : }
73 :
74 : } // namespace python
75 : } // namespace timing
76 : } // namespace dunedaq
|