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

Class for the timing FMC board. More...

#include <GIBIONode.hpp>

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

Public Member Functions

 GIBIONode (const uhal::Node &node)
 
virtual ~GIBIONode ()
 
std::string get_uid_address_parameter_name () const override
 Get the UID address parameter name.
 
std::string get_status (bool print_out=false) const override
 Get status string, optionally print.
 
std::unique_ptr< const SI534xSlave > get_pll () const override
 GET PLL I2C interface.
 
std::string get_hardware_info (bool print_out) const override
 Print hardware information.
 
void reset (const std::string &clock_config_file) const override
 Reset GIB IO.
 
std::string get_sfp_status (uint32_t sfp_id, bool print_out=false) const override
 Print status of on-board SFP.
 
void switch_sfp_soft_tx_control_bit (uint32_t sfp_id, bool turn_on) const override
 control tx laser of on-board SFP softly (I2C command)
 
bool clocks_ok () const override
 Clocks ready?
 
void switch_sfp_tx (uint32_t sfp_id, bool turn_on) const override
 control tx laser of on-board SFP softly (I2C command)
 
void set_i2c_mux_channels (uint8_t mux_channel_bitmask) const
 Fill hardware monitoring structure.
 
virtual void reset (const ClockSource &clock_source) const
 Reset timing node with clock file lookup.
 
- Public Member Functions inherited from dunedaq::timing::IONode
 IONode (const uhal::Node &node, std::string uid_i2c_bus, std::string pll_i2c_bus, std::string pll_i2c_device, std::vector< std::string > clock_names, std::vector< std::string > sfp_i2c_buses)
 
virtual ~IONode ()
 
virtual uint32_t read_board_type () const
 Read the word identifying the timing board.
 
virtual uint32_t read_carrier_type () const
 Read the word identifying the FPFA carrier board.
 
virtual uint32_t read_design_type () const
 Read the word identifying the firmware design in the FPGA.
 
virtual uint32_t read_firmware_frequency () const
 Read the word identifying the frequency [units of Hz] of the firmware in the FPGA.
 
virtual uint64_t read_board_uid () const
 Read the word containing the timing board UID.
 
virtual BoardRevision get_board_revision () const
 Read the word identifying the timing board.
 
virtual std::string get_full_clock_config_file_path (const ClockSource &clock_source) const
 Get the full config path.
 
template<class T >
std::unique_ptr< const T > get_i2c_device (const std::string &i2c_bus_name, const std::string &i2c_device_name) const
 Get the an I2C chip.
 
virtual void configure_pll (const std::string &clock_config_file="") const
 Configure clock chip.
 
virtual std::vector< double > read_clock_frequencies () const
 Read frequencies of on-board clocks.
 
virtual std::string get_clock_frequencies_table (bool print_out=false) const
 Print frequencies of on-board clocks.
 
virtual std::string get_pll_status (bool print_out=false) const
 Print status of on-board PLL.
 
virtual void soft_reset () const
 Reset timing node.
 
virtual void get_info (timinghardwareinfo::TimingPLLMonitorData &mon_data) const
 
- 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.
 

Private Member Functions

void validate_sfp_id (uint32_t sfp_id) const
 

Additional Inherited Members

- Static Public Member Functions inherited from dunedaq::timing::IONode
static const std::map< BoardType, std::string > & get_board_type_map ()
 
static const std::map< CarrierType, std::string > & get_carrier_type_map ()
 
static const std::map< BoardRevision, std::string > & get_board_revision_map ()
 
static const std::map< uint64_t, BoardRevision > & get_board_uid_revision_map ()
 
static const std::map< DesignType, std::string > & get_design_type_map ()
 
static const std::map< std::string, std::string > & get_clock_config_map ()
 
static const std::vector< BoardType > & get_library_supported_boards ()
 
static const std::vector< DesignType > & get_library_supported_designs ()
 
- Protected Member Functions inherited from dunedaq::timing::IONode
virtual void write_soft_reset_register () const
 Write soft reset register.
 
- Static Protected Member Functions inherited from dunedaq::timing::IONode
static std::string clock_source_to_string (const ClockSource &source)
 
- Protected Attributes inherited from dunedaq::timing::IONode
const std::string m_uid_i2c_bus
 
const std::string m_pll_i2c_bus
 
const std::string m_pll_i2c_device
 
const std::vector< std::string > m_clock_names
 
const std::vector< std::string > m_sfp_i2c_buses
 
- Static Protected Attributes inherited from dunedaq::timing::IONode
static const std::map< BoardType, std::string > board_type_map
 
static const std::map< CarrierType, std::string > carrier_type_map
 
static const std::map< BoardRevision, std::string > board_revision_map
 
static const std::map< DesignType, std::string > design_type_map
 
static const std::map< uint64_t, BoardRevisionboard_uid_revision_map
 
static const std::map< ClockSource, std::string > clock_source_map
 
static const std::map< std::string, std::string > clock_config_map
 
static const std::vector< BoardTypelibrary_supported_boards
 
static const std::vector< DesignTypelibrary_supported_designs
 

Detailed Description

Class for the timing FMC board.

Definition at line 32 of file GIBIONode.hpp.

Constructor & Destructor Documentation

◆ GIBIONode()

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

Definition at line 20 of file GIBIONode.cpp.

21 : IONode(node, "i2c", "i2c", { "PLL" }, { "PLL", "SFP CDR 0", "SFP CDR 1", "SFP CDR 2", "SFP CDR 3", "SFP CDR 4", "SFP CDR 5", "10 MHz" }, { "i2c", "i2c", "i2c", "i2c", "i2c", "i2c" })
22{
23}
IONode(const uhal::Node &node, std::string uid_i2c_bus, std::string pll_i2c_bus, std::string pll_i2c_device, std::vector< std::string > clock_names, std::vector< std::string > sfp_i2c_buses)
Definition IONode.cpp:25

◆ ~GIBIONode()

dunedaq::timing::GIBIONode::~GIBIONode ( )
virtual

Definition at line 27 of file GIBIONode.cpp.

27{}

Member Function Documentation

◆ clocks_ok()

bool dunedaq::timing::GIBIONode::clocks_ok ( ) const
overridevirtual

Clocks ready?

Implements dunedaq::timing::IONode.

Definition at line 168 of file GIBIONode.cpp.

169{
170 std::stringstream status;
171
172 auto states = read_sub_nodes(getNode("csr.stat"));
173 bool pll_lol = states.find("clk_gen_lol")->second.value();
174 bool pll_interrupt = states.find("clk_gen_intr")->second.value();
175 bool mmcm_ok = states.find("mmcm_ok")->second.value();
176 bool mmcm_10_ok = states.find("mmcm_ok")->second.value();
177
178 TLOG_DEBUG(5) << "pll lol: " << pll_lol << ", pll intr: " << pll_interrupt
179 << ", mmcm ok: " << mmcm_ok << ", mmcm 10MHz ok: " << mmcm_10_ok;
180
181 return !pll_lol && mmcm_ok && mmcm_10_ok;
182}
std::map< std::string, uhal::ValWord< uint32_t > > read_sub_nodes(const uhal::Node &node, bool dispatch=true) const
Read subnodes.
#define TLOG_DEBUG(lvl,...)
Definition Logging.hpp:112

◆ get_hardware_info()

std::string dunedaq::timing::GIBIONode::get_hardware_info ( bool print_out) const
overridevirtual

Print hardware information.

Reimplemented from dunedaq::timing::IONode.

Definition at line 65 of file GIBIONode.cpp.

66{
67 // enable pll/uid channel 0 only
69 return IONode::get_hardware_info(print_out);
70}
void set_i2c_mux_channels(uint8_t mux_channel_bitmask) const
Fill hardware monitoring structure.
virtual std::string get_hardware_info(bool print_out=false) const
Print hardware information.
Definition IONode.cpp:118

◆ get_pll()

std::unique_ptr< const SI534xSlave > dunedaq::timing::GIBIONode::get_pll ( ) const
overridevirtual

GET PLL I2C interface.

Reimplemented from dunedaq::timing::IONode.

Definition at line 55 of file GIBIONode.cpp.

56{
57 // enable pll channel 0 only
60}
const std::string m_pll_i2c_bus
Definition IONode.hpp:201
const std::string m_pll_i2c_device
Definition IONode.hpp:202
std::unique_ptr< const T > get_i2c_device(const std::string &i2c_bus_name, const std::string &i2c_device_name) const
Get the an I2C chip.
Definition IONode.hxx:6

◆ get_sfp_status()

std::string dunedaq::timing::GIBIONode::get_sfp_status ( uint32_t sfp_id,
bool print_out = false ) const
overridevirtual

Print status of on-board SFP.

Reimplemented from dunedaq::timing::IONode.

Definition at line 145 of file GIBIONode.cpp.

145 { // NOLINT(build/unsigned)
146 std::stringstream status;
147
148 validate_sfp_id(sfp_id);
149
150 uint8_t i2c_mux_bitmask = 1UL << (sfp_id+1);
151
152 set_i2c_mux_channels(i2c_mux_bitmask);
153
154 auto sfp = get_i2c_device<I2CSFPSlave>(m_sfp_i2c_buses.at(sfp_id), "SFP_EEProm");
155
156 status << "SFP " << sfp_id << ":" << std::endl;
157 status << sfp->get_status();
158
159 if (print_out)
160 TLOG() << status.str();
161
162 return status.str();
163}
void validate_sfp_id(uint32_t sfp_id) const
const std::vector< std::string > m_sfp_i2c_buses
Definition IONode.hpp:204
#define TLOG(...)
Definition macro.hpp:22

◆ get_status()

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

Get status string, optionally print.

Implements dunedaq::timing::TimingNode.

Definition at line 40 of file GIBIONode.cpp.

41{
42 std::stringstream status;
43
44 auto subnodes = read_sub_nodes(getNode("csr.stat"));
45 status << format_reg_table(subnodes, "GIB IO state");
46
47 if (print_out)
48 TLOG() << std::endl << status.str();
49 return status.str();
50}
std::string format_reg_table(T data, std::string title, std::vector< std::string > headers)
Format reg-value table.
Definition toolbox.hxx:166

◆ get_uid_address_parameter_name()

std::string dunedaq::timing::GIBIONode::get_uid_address_parameter_name ( ) const
overridevirtual

Get the UID address parameter name.

Returns
{ description_of_the_return_value }

Implements dunedaq::timing::IONode.

Definition at line 32 of file GIBIONode.cpp.

33{
34 return "UID_PROM";
35}

◆ reset() [1/2]

void dunedaq::timing::IONode::reset ( const ClockSource & clock_source) const
virtual

Reset timing node with clock file lookup.

Reimplemented from dunedaq::timing::IONode.

Definition at line 179 of file IONode.cpp.

315{
316 // Find the right pll config file
317 std::string clock_config = get_full_clock_config_file_path(clock_source);
318 reset(clock_config);
319}
void reset(const std::string &clock_config_file) const override
Reset GIB IO.
Definition GIBIONode.cpp:75
virtual std::string get_full_clock_config_file_path(const ClockSource &clock_source) const
Get the full config path.
Definition IONode.cpp:167

◆ reset() [2/2]

void dunedaq::timing::GIBIONode::reset ( const std::string & clock_config_file) const
overridevirtual

Reset GIB IO.

Implements dunedaq::timing::IONode.

Definition at line 75 of file GIBIONode.cpp.

76{
77
79
80 // Reset I2C switch and expander, active low
81 getNode("csr.ctrl.i2c_sw_rst").write(0x0);
82 getNode("csr.ctrl.i2c_exten_rst").write(0x0);
83 getNode("csr.ctrl.clk_gen_rst").write(0x0);
84 getClient().dispatch();
85
86 millisleep(1);
87
88 // End reset
89 getNode("csr.ctrl.i2c_sw_rst").write(0x1);
90 getNode("csr.ctrl.i2c_exten_rst").write(0x1);
91 getNode("csr.ctrl.clk_gen_rst").write(0x1);
92 getClient().dispatch();
93
95
96 // enclustra i2c switch stuff
97 if (carrier_type == kCarrierEnclustraA35) {
98 try {
99 getNode<I2CMasterNode>(m_uid_i2c_bus).get_slave("AX3_Switch").write_i2c(0x01, 0x7f);
100 } catch (const std::exception& e) {
101 ers::warning(EnclustraSwitchFailure(ERS_HERE, e));
102 }
103 }
104
105 getNode("csr.ctrl.gps_clk_en").write(0x0);
106
107 // Set filter to full bandwidth mode A = B = 0x0
108 getNode("csr.ctrl.gps_clk_fltr_a").write(0x0);
109 getNode("csr.ctrl.gps_clk_fltr_b").write(0x0);
110 getClient().dispatch();
111
112 // Upload config file to PLL
113 configure_pll(clock_config_file);
114
115 getNode("csr.ctrl.rst").write(0x1);
116 getNode("csr.ctrl.rst").write(0x0);
117 getClient().dispatch();
118
119 auto sfp_expander_0 = get_i2c_device<I2CExpanderSlave>(m_uid_i2c_bus, "SFPExpander0");
120 auto sfp_expander_1 = get_i2c_device<I2CExpanderSlave>(m_uid_i2c_bus, "SFPExpander1");
121
122 // Set invert registers to default for both (0,1) banks
123 sfp_expander_0->set_inversion(0, 0x00);
124 sfp_expander_0->set_inversion(1, 0x00);
125 sfp_expander_1->set_inversion(0, 0x00);
126 sfp_expander_1->set_inversion(1, 0x00);
127
128 // 0: pin set as output, 1: pin set as input
129 sfp_expander_0->set_io(0, 0xff); // set all pins of bank 0 as inputs
130 sfp_expander_0->set_io(1, 0xff); // set all pins of bank 1 as inputs
131
132 sfp_expander_1->set_io(0, 0xff); // set all pins of bank 0 as inputs
133 sfp_expander_1->set_io(1, 0x00); // set all pins of bank 1 as outputs
134
135 // Set SFP disable
136 // Set pins 1-6 low, i.e. enable SFP 1-6 (pins 7,8 unused)
137 sfp_expander_1->set_outputs(1, 0xC0);
138
139 TLOG() << "Reset done";
140}
#define ERS_HERE
virtual void write_soft_reset_register() const
Write soft reset register.
Definition IONode.cpp:296
virtual uint32_t read_carrier_type() const
Read the word identifying the FPFA carrier board.
Definition IONode.cpp:58
const std::string m_uid_i2c_bus
Definition IONode.hpp:200
virtual void configure_pll(const std::string &clock_config_file="") const
Configure clock chip.
Definition IONode.cpp:247
CarrierType convert_value_to_carrier_type(uint32_t darrier_type)
Definition toolbox.cpp:287
void millisleep(const double &time_in_milliseconds)
Definition toolbox.cpp:83
void warning(const Issue &issue)
Definition ers.hpp:115

◆ set_i2c_mux_channels()

void dunedaq::timing::GIBIONode::set_i2c_mux_channels ( uint8_t mux_channel_bitmask) const

Fill hardware monitoring structure.

Give info to collector.

Configure which mux channels are on using a bitmask

Definition at line 245 of file GIBIONode.cpp.

245 { // NOLINT(build/unsigned)
246
247 uint8_t mux_channel_config = mux_channel_bitmask & 0x7f;
248
249 auto i2c_bus = getNode<I2CMasterNode>("i2c");
250 i2c_bus.write_i2cPrimitive(0x70, {mux_channel_config});
251}

◆ switch_sfp_soft_tx_control_bit()

void dunedaq::timing::GIBIONode::switch_sfp_soft_tx_control_bit ( uint32_t sfp_id,
bool turn_on ) const
overridevirtual

control tx laser of on-board SFP softly (I2C command)

Reimplemented from dunedaq::timing::IONode.

Definition at line 187 of file GIBIONode.cpp.

187 { // NOLINT(build/unsigned)
188 validate_sfp_id(sfp_id);
189
190 auto sfp = get_i2c_device<I2CSFPSlave>(m_sfp_i2c_buses.at(sfp_id), "SFP_EEProm");
191 sfp->switch_soft_tx_control_bit(turn_on);
192}

◆ switch_sfp_tx()

void dunedaq::timing::GIBIONode::switch_sfp_tx ( uint32_t sfp_id,
bool turn_on ) const
overridevirtual

control tx laser of on-board SFP softly (I2C command)

Implements dunedaq::timing::IONode.

Definition at line 197 of file GIBIONode.cpp.

197 { // NOLINT(build/unsigned)
198 validate_sfp_id(sfp_id);
199
200 auto sfp_expander_1 = get_i2c_device<I2CExpanderSlave>(m_uid_i2c_bus, "SFPExpander1");
201 uint8_t current_sfp_tx_control_flags = sfp_expander_1->read_outputs_config(1); // NOLINT(build/unsigned)
202
203 uint8_t new_sfp_tx_control_flags; // NOLINT(build/unsigned)
204 if (turn_on)
205 {
206 new_sfp_tx_control_flags = current_sfp_tx_control_flags & ~(1UL << sfp_id);
207 }
208 else
209 {
210 new_sfp_tx_control_flags = current_sfp_tx_control_flags | (1UL << sfp_id);
211 }
212
213 sfp_expander_1->set_outputs(1, new_sfp_tx_control_flags);
214}

◆ validate_sfp_id()

void dunedaq::timing::GIBIONode::validate_sfp_id ( uint32_t sfp_id) const
private

Definition at line 235 of file GIBIONode.cpp.

235 { // NOLINT(build/unsigned)
236 // on this board we have 6 SFPs
237 if (sfp_id > 5) {
238 throw InvalidSFPId(ERS_HERE, format_reg_value(sfp_id));
239 }
240}
std::string format_reg_value(T reg_value, uint32_t base)
Definition toolbox.hxx:117

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