13#include <pybind11/pybind11.h>
14#include <pybind11/stl.h>
16namespace py = pybind11;
25 py::class_<timing::MasterNode, uhal::Node>(m,
"MasterNode")
26 .def(py::init<const uhal::Node&>())
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",
44 py::arg(
"clock_frequency_hz"))
53 py::arg(
"endpoint_address"),
57 py::class_<timing::UpstreamCDRNode, uhal::Node>(m,
"UpstreamCDRNode")
58 .def(py::init<const uhal::Node&>())
62 py::class_<timing::IRIGTimestampNode, uhal::Node>(m,
"IRIGTimestampNode")
63 .def(py::init<const uhal::Node&>())
std::string get_status(bool print_out=false) const override
Print the status of the timing node.
void set_ts_ticks_offset(int16_t ticks_offset) const
Set ticks offset.
void set_ts_epoch_value(uint64_t epoch_to_2000_seconds_tai, uint8_t epoch_to_2000_leap_seconds) const
Set custom epoch value.
void set_ts_seconds_offset(int8_t seconds_offset) const
Set seconds offset.
void set_ts_timebase(TimestampTimebase ts_timebase) const
Set custom epoch date.
void set_ts_epoch(TimestampEpoch ts_epoch) const
Set epoch: UNIX/custom.
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.
uint64_t read_timestamp() const override
Read the current timestamp word.
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.
void resync() const
Reync CDR.
std::string get_status(bool print_out=false) const override
Get status string, optionally print.
void register_master(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