12#include <pybind11/pybind11.h>
13#include <pybind11/stl.h>
15namespace py = pybind11;
25 py::class_<timing::HSINode, uhal::Node>(m,
"HSINode")
26 .def(py::init<const uhal::Node&>())
35 py::arg(
"clock_frequency_hz"),
36 py::arg(
"dispatch") =
true)
40 .def(
"get_data_buffer_table",
42 py::arg(
"read_all") =
false,
43 py::arg(
"print_out") =
false)
48 py::class_<timing::EndpointNode, uhal::Node>(m,
"EndpointNode")
49 .def(py::init<const uhal::Node&>())
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.
bool read_buffer_warning() const
Read butffer warning flag.
std::string get_status(bool print_out=false) const override
Print the status of the timing node.
void stop_hsi(bool dispatch=true) const
Stop HSI triggering.
bool read_buffer_error() const
Read butffer error flag.
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.
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.
void start_hsi(bool dispatch=true) const
Start HSI triggering.
std::string get_data_buffer_table(bool read_all=false, bool print_out=false) const
Print the contents of the endpoint data buffer.
void reset_hsi(bool dispatch=true) const
Reset HSI.
void register_endpoint(py::module &m)
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