DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
endpoint.cpp
Go to the documentation of this file.
1
10#include "timing/HSINode.hpp"
11
12#include <pybind11/pybind11.h>
13#include <pybind11/stl.h>
14
15namespace py = pybind11;
16
17namespace dunedaq {
18namespace timing {
19namespace python {
20
21void
22register_endpoint(py::module& m)
23{
24
25 py::class_<timing::HSINode, uhal::Node>(m, "HSINode")
26 .def(py::init<const uhal::Node&>())
27 .def("get_status", &timing::HSINode::get_status, py::arg("print_out") = false)
28 .def("configure_hsi",
30 py::arg("src"),
31 py::arg("re_mask"),
32 py::arg("fe_mask"),
33 py::arg("inv_mask"),
34 py::arg("rate"),
35 py::arg("clock_frequency_hz"),
36 py::arg("dispatch") = true)
37 .def("start_hsi", &timing::HSINode::start_hsi, py::arg("dispatch") = true)
38 .def("stop_hsi", &timing::HSINode::stop_hsi, py::arg("dispatch") = true)
39 .def("reset_hsi", &timing::HSINode::reset_hsi, py::arg("dispatch") = true)
40 .def("get_data_buffer_table",
42 py::arg("read_all") = false,
43 py::arg("print_out") = false)
44 .def("read_buffer_warning", &timing::HSINode::read_buffer_warning)
45 .def("read_buffer_error", &timing::HSINode::read_buffer_error)
46 .def<uhal::ValVector<uint32_t> (timing::HSINode::*)(uint16_t&, bool, bool) const>("read_data_buffer", &timing::HSINode::read_data_buffer);
47
48 py::class_<timing::EndpointNode, uhal::Node>(m, "EndpointNode")
49 .def(py::init<const uhal::Node&>())
50 .def("disable", &timing::EndpointNode::disable)
51 .def("enable", &timing::EndpointNode::enable, py::arg("address") = 0, py::arg("partition") = 0)
52 .def("reset", &timing::EndpointNode::reset, py::arg("address") = 0, py::arg("partition") = 0)
53 .def("get_status", &timing::EndpointNode::get_status, py::arg("print_out") = false);
54}
55
56} // namespace python
57} // namespace timing
58} // namespace dunedaq
void enable(uint32_t address=0, uint32_t partition=0) const override
Enable the endpoint.
void reset(uint32_t address=0, uint32_t partition=0) const override
Reset the endpoint.
void disable() const override
Disable the endpoint.
std::string get_status(bool print_out=false) const override
Print the status of the timing node.
Class for HSI nodes.
Definition HSINode.hpp:37
bool read_buffer_warning() const
Read butffer warning flag.
Definition HSINode.cpp:267
std::string get_status(bool print_out=false) const override
Print the status of the timing node.
Definition HSINode.cpp:36
void stop_hsi(bool dispatch=true) const
Stop HSI triggering.
Definition HSINode.cpp:238
bool read_buffer_error() const
Read butffer error flag.
Definition HSINode.cpp:277
void configure_hsi(uint32_t src, uint32_t re_mask, uint32_t fe_mask, uint32_t inv_mask, double rate, uint32_t clock_frequency_hz, bool dispatch=true) const
Configure HSI triggering.
Definition HSINode.cpp:174
uhal::ValVector< uint32_t > read_data_buffer(uint16_t &n_words, bool read_all=false, bool fail_on_error=false) const
Read the contents of the endpoint data buffer.
Definition HSINode.cpp:90
void start_hsi(bool dispatch=true) const
Start HSI triggering.
Definition HSINode.cpp:228
std::string get_data_buffer_table(bool read_all=false, bool print_out=false) const
Print the contents of the endpoint data buffer.
Definition HSINode.cpp:150
void reset_hsi(bool dispatch=true) const
Reset HSI.
Definition HSINode.cpp:248
void register_endpoint(py::module &m)
Definition endpoint.cpp:22
The DUNE-DAQ namespace.
Definition DataStore.hpp:57
Unknown serialization type<< t,((char) t)) template< typename T > inline std::string datatype_to_string() { return "Unknown";} namespace serialization { template< typename T > struct is_serializable :std::false_type {};enum SerializationType { kMsgPack };inline SerializationType from_string(const std::string s) { if(s=="msgpack") return kMsgPack;throw UnknownSerializationTypeString(ERS_HERE, s);} constexpr uint8_t serialization_type_byte(SerializationType stype) { switch(stype) { case kMsgPack:return 'M';default:throw UnknownSerializationTypeEnum(ERS_HERE);} } constexpr SerializationType DEFAULT_SERIALIZATION_TYPE=kMsgPack;template< class T > std::vector< uint8_t > serialize(const T &obj, SerializationType stype=DEFAULT_SERIALIZATION_TYPE) { switch(stype) { case kMsgPack:{ msgpack::sbuffer buf;msgpack::pack(buf, obj);std::vector< uint8_t > ret(buf.size()+1);ret[0]=serialization_type_byte(stype);std::copy(buf.data(), buf.data()+buf.size(), ret.begin()+1);return ret;} default:throw UnknownSerializationTypeEnum(ERS_HERE);} } template< class T, typename CharType=unsigned char > T deserialize(const std::vector< CharType > &v) { switch(v[0]) { case serialization_type_byte(kMsgPack):{ try { msgpack::object_handle oh=msgpack::unpack(const_cast< char * >(reinterpret_cast< const char * >(v.data()+1)), v.size() - 1,[](msgpack::type::object_type, std::size_t, void *) -> bool