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 set_up_io_infrastructure () const override
 Set up i2c buses, enable ICs.
 
void reset (const std::string &clock_config_file) const override
 Reset GIB IO.
 
void reset_pll () const override
 Reset PLL.
 
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.
 
float read_board_temperature () const
 Read board temp.
 
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 21 of file GIBIONode.cpp.

22 : 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" })
23{
24}
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 28 of file GIBIONode.cpp.

28{}

Member Function Documentation

◆ clocks_ok()

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

Clocks ready?

Implements dunedaq::timing::IONode.

Reimplemented in dunedaq::timing::GIBV2IONode.

Definition at line 189 of file GIBIONode.cpp.

190{
191 std::stringstream status;
192
193 auto states = read_sub_nodes(getNode("csr.stat"));
194 bool pll_lol = states.find("clk_gen_lol")->second.value();
195 bool pll_interrupt = states.find("clk_gen_intr")->second.value();
196 bool mmcm_ok = states.find("mmcm_ok")->second.value();
197 bool mmcm_10_ok = states.find("mmcm_ok")->second.value();
198
199 TLOG_DEBUG(5) << "pll lol: " << pll_lol << ", pll intr: " << pll_interrupt
200 << ", mmcm ok: " << mmcm_ok << ", mmcm 10MHz ok: " << mmcm_10_ok;
201
202 return !pll_lol && mmcm_ok && mmcm_10_ok;
203}
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 71 of file GIBIONode.cpp.

72{
73 // enable pll/uid channel 0 only
75 return IONode::get_hardware_info(print_out);
76}
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 61 of file GIBIONode.cpp.

62{
63 // enable pll channel 0 only
66}
const std::string m_pll_i2c_bus
Definition IONode.hpp:211
const std::string m_pll_i2c_device
Definition IONode.hpp:212
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 166 of file GIBIONode.cpp.

166 { // NOLINT(build/unsigned)
167 std::stringstream status;
168
169 validate_sfp_id(sfp_id);
170
171 uint8_t i2c_mux_bitmask = 1UL << (sfp_id+1);
172
173 set_i2c_mux_channels(i2c_mux_bitmask);
174
175 auto sfp = get_i2c_device<I2CSFPSlave>(m_sfp_i2c_buses.at(sfp_id), "SFP_EEProm");
176
177 status << "SFP " << sfp_id << ":" << std::endl;
178 status << sfp->get_status();
179
180 if (print_out)
181 TLOG() << status.str();
182
183 return status.str();
184}
void validate_sfp_id(uint32_t sfp_id) const
const std::vector< std::string > m_sfp_i2c_buses
Definition IONode.hpp:214
#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 41 of file GIBIONode.cpp.

42{
43 std::stringstream status;
44
45 auto subnodes = read_sub_nodes(getNode("csr.stat"));
46 status << format_reg_table(subnodes, "GIB IO state");
47
48 auto subnodes_2 = read_sub_nodes(getNode("csr.ctrl"));
49 status << format_reg_table(subnodes_2, "GIB IO control");
50
51 status << "Board temperature: " << read_board_temperature() << " [C]" << std::endl;
52
53 if (print_out)
54 TLOG() << std::endl << status.str();
55 return status.str();
56}
float read_board_temperature() const
Read board temp.
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 33 of file GIBIONode.cpp.

34{
35 return "UID_PROM";
36}

◆ read_board_temperature()

float dunedaq::timing::GIBIONode::read_board_temperature ( ) const

Read board temp.

Definition at line 277 of file GIBIONode.cpp.

278{
279 auto temp_mon = get_i2c_device<LM75Node>(m_pll_i2c_bus, "TEMP_MON");
280 return temp_mon->read_temperature();
281}

◆ 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 184 of file IONode.cpp.

306{
307 TLOG() << "Setting IO preliminaries: I2C access, etc..";
309
310 // Find the right pll config file
311 std::string clock_config = get_full_clock_config_file_path(clock_source);
312 reset(clock_config);
313}
void reset(const std::string &clock_config_file) const override
Reset GIB IO.
void set_up_io_infrastructure() const override
Set up i2c buses, enable ICs.
Definition GIBIONode.cpp:81
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 113 of file GIBIONode.cpp.

114{
115 getNode("csr.ctrl.rst").write(0x1);
116 getNode("csr.ctrl.rst").write(0x0);
117 getClient().dispatch();
118
120
121 getNode("csr.ctrl.gps_clk_en").write(0x0);
122
123 // Set filter to full bandwidth mode A = B = 0x0
124 getNode("csr.ctrl.gps_clk_fltr_a").write(0x0);
125 getNode("csr.ctrl.gps_clk_fltr_b").write(0x0);
126 getClient().dispatch();
127
128 // Upload config file to PLL
129 configure_pll(clock_config_file);
130
131 auto sfp_expander_0 = get_i2c_device<I2CExpanderSlave>(m_uid_i2c_bus, "SFPExpander0");
132 auto sfp_expander_1 = get_i2c_device<I2CExpanderSlave>(m_uid_i2c_bus, "SFPExpander1");
133
134 // Set invert registers to default for both (0,1) banks
135 sfp_expander_0->set_inversion(0, 0x00);
136 sfp_expander_0->set_inversion(1, 0x00);
137 sfp_expander_1->set_inversion(0, 0x00);
138 sfp_expander_1->set_inversion(1, 0x00);
139
140 // 0: pin set as output, 1: pin set as input
141 sfp_expander_0->set_io(0, 0xff); // set all pins of bank 0 as inputs
142 sfp_expander_0->set_io(1, 0xff); // set all pins of bank 1 as inputs
143
144 sfp_expander_1->set_io(0, 0xff); // set all pins of bank 0 as inputs
145 sfp_expander_1->set_io(1, 0x00); // set all pins of bank 1 as outputs
146
147 // Set SFP disable
148 // Set pins 1-6 low, i.e. enable SFP 1-6 (pins 7,8 unused)
149 sfp_expander_1->set_outputs(1, 0xC0);
150
151 TLOG() << "Reset done";
152}
const std::string m_uid_i2c_bus
Definition IONode.hpp:210
virtual void configure_pll(const std::string &clock_config_file="") const
Configure clock chip.
Definition IONode.cpp:238

◆ reset_pll()

void dunedaq::timing::GIBIONode::reset_pll ( ) const
overridevirtual

Reset PLL.

Implements dunedaq::timing::IONode.

Definition at line 157 of file GIBIONode.cpp.

158{
159 getNode("csr.ctrl.clk_gen_rst").write(0x0);
160 getNode("csr.ctrl.clk_gen_rst").write(0x1);
161}

◆ 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 266 of file GIBIONode.cpp.

266 { // NOLINT(build/unsigned)
267
268 uint8_t mux_channel_config = mux_channel_bitmask & 0x7f;
269
270 auto i2c_bus = getNode<I2CMasterNode>("i2c");
271 i2c_bus.write_i2cPrimitive(0x70, {mux_channel_config});
272}

◆ set_up_io_infrastructure()

void dunedaq::timing::GIBIONode::set_up_io_infrastructure ( ) const
overridevirtual

Set up i2c buses, enable ICs.

Reimplemented from dunedaq::timing::IONode.

Definition at line 81 of file GIBIONode.cpp.

82{
83 // enclustra i2c switch stuff
85 if (carrier_type == kCarrierEnclustraA35) {
86 try {
87 getNode<I2CMasterNode>(m_uid_i2c_bus).get_slave("AX3_Switch").write_i2c(0x01, 0x7f);
88 } catch (const std::exception& e) {
89 ers::warning(EnclustraSwitchFailure(ERS_HERE, e));
90 }
91 }
92
93 // Reset I2C switch and expander, active low
94 getNode("csr.ctrl.i2c_sw_rst").write(0x0);
95 getNode("csr.ctrl.i2c_exten_rst").write(0x0);
96 getNode("csr.ctrl.clk_gen_rst").write(0x0);
97 getClient().dispatch();
98
99 millisleep(1);
100
101 // End reset
102 getNode("csr.ctrl.i2c_sw_rst").write(0x1);
103 getNode("csr.ctrl.i2c_exten_rst").write(0x1);
104 getNode("csr.ctrl.clk_gen_rst").write(0x1);
105 getClient().dispatch();
106
108}
#define ERS_HERE
virtual uint32_t read_carrier_type() const
Read the word identifying the FPFA carrier board.
Definition IONode.cpp:58
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

◆ 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 208 of file GIBIONode.cpp.

208 { // NOLINT(build/unsigned)
209 validate_sfp_id(sfp_id);
210
211 auto sfp = get_i2c_device<I2CSFPSlave>(m_sfp_i2c_buses.at(sfp_id), "SFP_EEProm");
212 sfp->switch_soft_tx_control_bit(turn_on);
213}

◆ 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 218 of file GIBIONode.cpp.

218 { // NOLINT(build/unsigned)
219 validate_sfp_id(sfp_id);
220
221 auto sfp_expander_1 = get_i2c_device<I2CExpanderSlave>(m_uid_i2c_bus, "SFPExpander1");
222 uint8_t current_sfp_tx_control_flags = sfp_expander_1->read_outputs_config(1); // NOLINT(build/unsigned)
223
224 uint8_t new_sfp_tx_control_flags; // NOLINT(build/unsigned)
225 if (turn_on)
226 {
227 new_sfp_tx_control_flags = current_sfp_tx_control_flags & ~(1UL << sfp_id);
228 }
229 else
230 {
231 new_sfp_tx_control_flags = current_sfp_tx_control_flags | (1UL << sfp_id);
232 }
233
234 sfp_expander_1->set_outputs(1, new_sfp_tx_control_flags);
235}

◆ validate_sfp_id()

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

Definition at line 256 of file GIBIONode.cpp.

256 { // NOLINT(build/unsigned)
257 // on this board we have 6 SFPs
258 if (sfp_id > 5) {
259 throw InvalidSFPId(ERS_HERE, format_reg_value(sfp_id));
260 }
261}
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: