DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
master.cpp
Go to the documentation of this file.
1
12
13#include <pybind11/pybind11.h>
14#include <pybind11/stl.h>
15
16namespace py = pybind11;
17
18namespace dunedaq {
19namespace timing {
20namespace python {
21
22void
23register_master(py::module& m)
24{
25 py::class_<timing::MasterNode, uhal::Node>(m, "MasterNode")
26 .def(py::init<const uhal::Node&>())
27 .def("switch_endpoint_sfp", &timing::MasterNode::switch_endpoint_sfp)
28 .def("enable_upstream_endpoint", &timing::MasterNode::enable_upstream_endpoint)
29 .def("reset_command_counters", &timing::MasterNode::reset_command_counters)
30 .def("transmit_async_packet", &timing::MasterNode::transmit_async_packet, py::arg("packet"), py::arg("timeout") = 500) //timeout [us]
31 .def("write_endpoint_data", &timing::MasterNode::write_endpoint_data)
32 .def("read_endpoint_data", &timing::MasterNode::read_endpoint_data)
33 .def("send_fl_cmd",
35 py::arg("command"),
36 py::arg("channel"),
37 py::arg("number_of_commands") = 1)
38 .def<void (timing::MasterNode::*)(uint32_t, uint32_t, double, bool, uint32_t) const>("enable_periodic_fl_cmd",
40 py::arg("command"),
41 py::arg("channel"),
42 py::arg("rate"),
43 py::arg("poisson"),
44 py::arg("clock_frequency_hz"))
45 .def("disable_periodic_fl_cmd", &timing::MasterNode::disable_periodic_fl_cmd)
46 .def("get_status", &timing::MasterNode::get_status, py::arg("print_out") = false)
47 .def("get_status_with_date", &timing::MasterNode::get_status_with_date, py::arg("clock_frequency_hz"), py::arg("print_out") = false)
48 .def("sync_timestamp", &timing::MasterNode::sync_timestamp, py::arg("source"))
49 .def("disable_timestamp_broadcast", &timing::MasterNode::disable_timestamp_broadcast)
50 .def("enable_timestamp_broadcast", &timing::MasterNode::enable_timestamp_broadcast)
51 .def("configure_endpoint_command_decoder", &timing::MasterNode::configure_endpoint_command_decoder,
52 py::arg("endpoint_address"),
53 py::arg("slot"),
54 py::arg("command"));
55
56 py::class_<timing::UpstreamCDRNode, uhal::Node>(m, "UpstreamCDRNode")
57 .def(py::init<const uhal::Node&>())
58 .def("get_status", &timing::UpstreamCDRNode::get_status, py::arg("print_out") = false)
59 .def("resync", &timing::UpstreamCDRNode::resync);
60
61 py::class_<timing::IRIGTimestampNode, uhal::Node>(m, "IRIGTimestampNode")
62 .def(py::init<const uhal::Node&>())
63 .def("get_status", &timing::IRIGTimestampNode::get_status, py::arg("print_out") = false)
64 .def("set_irig_epoch", &timing::IRIGTimestampNode::set_irig_epoch, py::arg("irig_epoch"))
65 ;
66
67}
68
69} // namespace python
70} // namespace timing
71} // namespace dunedaq
std::string get_status(bool print_out=false) const override
Print the status of the timing node.
void set_irig_epoch(IRIGEpoch irig_epoch) const
Set IRIG epoch: TAI/UNIX.
virtual void enable_periodic_fl_cmd(uint32_t channel, double rate, bool poisson, uint32_t clock_frequency_hz) const
Configure fake trigger generator.
virtual void disable_periodic_fl_cmd(uint32_t channel) const
Clear fake trigger configuration.
Class for PD-II/DUNE master timing nodes.
std::string get_status(bool print_out=false) const override
Print the status of the timing node.
std::string get_status_with_date(uint32_t clock_frequency_hz, bool print_out=false) const
Print the status of the timing node.
std::vector< uint32_t > transmit_async_packet(const std::vector< uint32_t > &packet, int timeout=500) const
Send an async packet.
void enable_timestamp_broadcast() const
Enable timestamp sending.
std::vector< uint32_t > read_endpoint_data(uint16_t endpoint_address, uint8_t reg_address, uint8_t data_length, bool address_mode) const
Read some data from endpoint registers.
void switch_endpoint_sfp(uint32_t address, bool turn_on) const override
Control the tx line of endpoint sfp.
void disable_timestamp_broadcast() const
Disable timestamp sending.
void enable_upstream_endpoint() const override
Enable RTT endpoint.
void sync_timestamp(TimestampSource source) const override
Set timestamp to current machine time.
void configure_endpoint_command_decoder(uint16_t endpoint_address, uint8_t slot, uint8_t command) const
Configure endpoint command decoder.
void reset_command_counters() const
Read some data from endpoint registers.
void write_endpoint_data(uint16_t endpoint_address, uint8_t reg_address, std::vector< uint8_t > data, bool address_mode) const
Write some data to endpoint registers.
void send_fl_cmd(uint32_t command, uint32_t channel, uint32_t number_of_commands=1) const override
Send a fixed length command.
std::string get_status(bool print_out=false) const override
Get status string, optionally print.
void register_master(py::module &m)
Definition master.cpp:23
Including Qt Headers.