19UHAL_REGISTER_DERIVED_NODE(IRIGTimestampNode)
35 std::stringstream status;
36 status <<
"Timestamp: 0x" << std::hex <<
read_timestamp() << std::endl;
58 TLOG() << status.str();
64uhal::ValVector<uint32_t>
67 auto timestamp = getNode(
"tstamp").readBlock(2);
69 getClient().dispatch();
86 getNode(
"csr.ctrl.ts_timebase").write(timebase);
87 getClient().dispatch();
95 getNode(
"csr.ctrl.ts_epoch").write(epoch);
96 getClient().dispatch();
104 uint32_t epoch_l = epoch_to_2000_seconds_tai;
105 uint32_t epoch_h = epoch_to_2000_seconds_tai >> 32;
106 getNode(
"csr.seconds_from_sw_epoch_l").write(epoch_l);
107 getNode(
"csr.seconds_from_sw_epoch_h").write(epoch_h);
108 getNode(
"csr.offsets.leap_seconds_from_sw_epoch").write(epoch_to_2000_leap_seconds);
109 getClient().dispatch();
117 auto counter = getNode(
"pps_ctr").read();
118 getClient().dispatch();
119 return counter.value();
127 auto seconds_since_epoch = getNode(
"seconds_since_epoch").readBlock(2);
128 getClient().dispatch();
138 getNode(
"csr.offsets.seconds_offset").write((uint8_t)seconds_offset);
139 getClient().dispatch();
148 getNode(
"csr.offsets.ticks_offset").write((uint16_t)ticks_offset);
149 getClient().dispatch();
Class for timestamp generator node.
std::string get_status(bool print_out=false) const override
Print the status of the timing node.
uint64_t read_timestamp() const
Read the current timestamp words.
void set_ts_ticks_offset(int16_t ticks_offset) const
Set ticks offset.
virtual ~IRIGTimestampNode()
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.
uint64_t read_seconds_since_epoch() const
Read the current seconds since epoch words.
void set_ts_epoch(TimestampEpoch ts_epoch) const
Set epoch: UNIX/custom.
uhal::ValVector< uint32_t > read_raw_timestamp(bool dispatch=true) const
Read the current timestamp words.
uint32_t read_pps_counter() const
Read the current pps ctr word.
Base class for timing nodes.
std::map< std::string, uhal::ValWord< uint32_t > > read_sub_nodes(const uhal::Node &node, bool dispatch=true) const
Read subnodes.
std::string format_reg_table(T data, std::string title, std::vector< std::string > headers)
Format reg-value table.
uint64_t tstamp2int(uhal::ValVector< uint32_t > raw_timestamp)