DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
dunedaq::timing::IRIGTimestampNode Class Reference

Class for timestamp generator node. More...

#include <IRIGTimestampNode.hpp>

Inheritance diagram for dunedaq::timing::IRIGTimestampNode:
[legend]
Collaboration diagram for dunedaq::timing::IRIGTimestampNode:
[legend]

Public Member Functions

 IRIGTimestampNode (const uhal::Node &node)
 
virtual ~IRIGTimestampNode ()
 
std::string get_status (bool print_out=false) const override
 Print the status of the timing node.
 
uhal::ValVector< uint32_t > read_raw_timestamp (bool dispatch=true) const
 Read the current timestamp words.
 
uint64_t read_timestamp () const
 Read the current timestamp words.
 
void set_ts_epoch (TimestampEpoch ts_epoch) const
 Set epoch: UNIX/custom.
 
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_timebase (TimestampTimebase ts_timebase) const
 Set custom epoch date.
 
void set_ts_seconds_offset (int8_t seconds_offset) const
 Set seconds offset.
 
void set_ts_ticks_offset (int16_t ticks_offset) const
 Set ticks offset.
 
uint32_t read_pps_counter () const
 Read the current pps ctr word.
 
uint64_t read_seconds_since_epoch () const
 Read the current seconds since epoch words.
 
- Public Member Functions inherited from dunedaq::timing::TimingNode
 TimingNode (const uhal::Node &node)
 
virtual ~TimingNode ()
 
std::map< std::string, uhal::ValWord< uint32_t > > read_sub_nodes (const uhal::Node &node, bool dispatch=true) const
 Read subnodes.
 
void reset_sub_nodes (const uhal::Node &node, uint32_t aValue=0x0, bool dispatch=true) const
 Reset subnodes.
 

Detailed Description

Class for timestamp generator node.

Definition at line 33 of file IRIGTimestampNode.hpp.

Constructor & Destructor Documentation

◆ IRIGTimestampNode()

dunedaq::timing::IRIGTimestampNode::IRIGTimestampNode ( const uhal::Node & node)
explicit

Definition at line 22 of file IRIGTimestampNode.cpp.

23 : TimingNode(node)
24{}
TimingNode(const uhal::Node &node)

◆ ~IRIGTimestampNode()

dunedaq::timing::IRIGTimestampNode::~IRIGTimestampNode ( )
virtual

Definition at line 28 of file IRIGTimestampNode.cpp.

28{}

Member Function Documentation

◆ get_status()

std::string dunedaq::timing::IRIGTimestampNode::get_status ( bool print_out = false) const
overridevirtual

Print the status of the timing node.

Implements dunedaq::timing::TimingNode.

Definition at line 33 of file IRIGTimestampNode.cpp.

34{
35 std::stringstream status;
36 status << "Timestamp: 0x" << std::hex << read_timestamp() << std::endl;
37
38 auto ctrl_subnodes = read_sub_nodes(getNode("csr.ctrl"));
39 status << format_reg_table(ctrl_subnodes, "IRIG ts ctrl");
40
41 auto stat_subnodes = read_sub_nodes(getNode("csr.stat"));
42 status << format_reg_table(stat_subnodes, "IRIG ts state");
43
44 auto date_subnodes = read_sub_nodes(getNode("csr.irig_date"));
45 status << format_reg_table(date_subnodes, "IRIG date");
46
47 auto time_subnodes = read_sub_nodes(getNode("csr.irig_time"));
48 status << format_reg_table(time_subnodes, "IRIG time");
49
50 auto sbs_subnodes = read_sub_nodes(getNode("csr.irig_sbs"));
51 status << format_reg_table(sbs_subnodes, "IRIG SBS");
52
53 status << "PPS counter: 0x" << std::hex << read_pps_counter() << std::endl;
54
55 status << "Seconds since epoch: 0x" << std::hex << read_seconds_since_epoch() << std::endl;
56
57 if (print_out)
58 TLOG() << status.str();
59 return status.str();
60}
uint64_t read_timestamp() const
Read the current timestamp words.
uint64_t read_seconds_since_epoch() const
Read the current seconds since epoch words.
uint32_t read_pps_counter() const
Read the current pps ctr word.
std::map< std::string, uhal::ValWord< uint32_t > > read_sub_nodes(const uhal::Node &node, bool dispatch=true) const
Read subnodes.
#define TLOG(...)
Definition macro.hpp:22
std::string format_reg_table(T data, std::string title, std::vector< std::string > headers)
Format reg-value table.
Definition toolbox.hxx:166

◆ read_pps_counter()

uint32_t dunedaq::timing::IRIGTimestampNode::read_pps_counter ( ) const

Read the current pps ctr word.

Returns
{ description_of_the_return_value }

Definition at line 115 of file IRIGTimestampNode.cpp.

116{
117 auto counter = getNode("pps_ctr").read();
118 getClient().dispatch();
119 return counter.value();
120}

◆ read_raw_timestamp()

uhal::ValVector< uint32_t > dunedaq::timing::IRIGTimestampNode::read_raw_timestamp ( bool dispatch = true) const

Read the current timestamp words.

Returns
{ description_of_the_return_value }

Definition at line 65 of file IRIGTimestampNode.cpp.

66{
67 auto timestamp = getNode("tstamp").readBlock(2);
68 if (dispatch)
69 getClient().dispatch();
70 return timestamp;
71}

◆ read_seconds_since_epoch()

uint64_t dunedaq::timing::IRIGTimestampNode::read_seconds_since_epoch ( ) const

Read the current seconds since epoch words.

Returns
{ description_of_the_return_value }

Definition at line 125 of file IRIGTimestampNode.cpp.

126{
127 auto seconds_since_epoch = getNode("seconds_since_epoch").readBlock(2);
128 getClient().dispatch();
129 return tstamp2int(seconds_since_epoch);
130}
uint64_t tstamp2int(uhal::ValVector< uint32_t > raw_timestamp)
Definition toolbox.cpp:175

◆ read_timestamp()

uint64_t dunedaq::timing::IRIGTimestampNode::read_timestamp ( ) const

Read the current timestamp words.

Returns
{ description_of_the_return_value }

Definition at line 76 of file IRIGTimestampNode.cpp.

77{
79}
uhal::ValVector< uint32_t > read_raw_timestamp(bool dispatch=true) const
Read the current timestamp words.

◆ set_ts_epoch()

void dunedaq::timing::IRIGTimestampNode::set_ts_epoch ( TimestampEpoch ts_epoch) const

Set epoch: UNIX/custom.

Definition at line 93 of file IRIGTimestampNode.cpp.

94{
95 getNode("csr.ctrl.ts_epoch").write(epoch);
96 getClient().dispatch();
97}

◆ set_ts_epoch_value()

void dunedaq::timing::IRIGTimestampNode::set_ts_epoch_value ( uint64_t epoch_to_2000_seconds_tai,
uint8_t epoch_to_2000_leap_seconds ) const

Set custom epoch value.

Definition at line 102 of file IRIGTimestampNode.cpp.

103{
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();
110}

◆ set_ts_seconds_offset()

void dunedaq::timing::IRIGTimestampNode::set_ts_seconds_offset ( int8_t seconds_offset) const

Set seconds offset.

Definition at line 135 of file IRIGTimestampNode.cpp.

136{
137 // cast to uint8_t to avoid erroneous auto conversion
138 getNode("csr.offsets.seconds_offset").write((uint8_t)seconds_offset);
139 getClient().dispatch();
140}

◆ set_ts_ticks_offset()

void dunedaq::timing::IRIGTimestampNode::set_ts_ticks_offset ( int16_t ticks_offset) const

Set ticks offset.

Definition at line 145 of file IRIGTimestampNode.cpp.

146{
147 // cast to uint16_t to avoid erroneous auto conversion
148 getNode("csr.offsets.ticks_offset").write((uint16_t)ticks_offset); // NOLINT(build/unsigned)
149 getClient().dispatch();
150}

◆ set_ts_timebase()

void dunedaq::timing::IRIGTimestampNode::set_ts_timebase ( TimestampTimebase ts_timebase) const

Set custom epoch date.

Set timebase: TAI/UTC

Definition at line 84 of file IRIGTimestampNode.cpp.

85{
86 getNode("csr.ctrl.ts_timebase").write(timebase);
87 getClient().dispatch();
88}

The documentation for this class was generated from the following files: