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

Class for the FIB board. More...

#include <FIBIONode.hpp>

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

Public Member Functions

 FIBIONode (const uhal::Node &aNode)
 
virtual ~FIBIONode ()
 
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.
 
void reset (const std::string &clock_config_file) const override
 Reset FIB node.
 
void switch_sfp_mux_channel (uint32_t mux_channel) const override
 Switch the SFP mux channel.
 
uint32_t read_active_sfp_mux_channel () const override
 Read the active SFP mux channel.
 
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)
 
void reset_pll () const
 reset on-board PLL using I2C IO expanders
 
uint8_t read_sfp_los_flag (uint32_t sfp_id) const
 reset on-board SFP flags using I2C IO expanders
 
uint8_t read_sfp_fault_flag (uint32_t sfp_id) const
 reset on-board SFP flags using I2C IO expanders
 
uint8_t read_sfp_los_flags () const
 reset on-board SFP flags using I2C IO expanders
 
uint8_t read_sfp_fault_flags () const
 reset on-board SFP flags using I2C IO expanders
 
void switch_sfp_tx (uint32_t sfp_id, bool turn_on) const override
 reset on-board SFP flags using I2C IO expanders
 
bool clocks_ok () const override
 Clocks ready?
 
virtual void reset (const ClockSource &clock_source) const
 Reset IO, with clock file look up.
 
- Public Member Functions inherited from dunedaq::timing::SFPMuxIONode
 SFPMuxIONode (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 ~SFPMuxIONode ()
 
- 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_hardware_info (bool print_out=false) const
 Print hardware information.
 
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 std::unique_ptr< const SI534xSlave > get_pll () const
 Get the PLL 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
 Fill hardware monitoring structure.
 

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 FIB board.

Definition at line 32 of file FIBIONode.hpp.

Constructor & Destructor Documentation

◆ FIBIONode()

dunedaq::timing::FIBIONode::FIBIONode ( const uhal::Node & aNode)
explicit

Definition at line 22 of file FIBIONode.cpp.

22 :
23 SFPMuxIONode(aNode, "i2c", "i2c", "SI5345", {"PLL", "BKP DATA"}, {"i2c_sfp0", "i2c_sfp1", "i2c_sfp2", "i2c_sfp3", "i2c_sfp4", "i2c_sfp5", "i2c_sfp6", "i2c_sfp7"}) {
24}
SFPMuxIONode(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)

◆ ~FIBIONode()

dunedaq::timing::FIBIONode::~FIBIONode ( )
virtual

Definition at line 29 of file FIBIONode.cpp.

29 {
30}

Member Function Documentation

◆ clocks_ok()

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

Clocks ready?

Implements dunedaq::timing::IONode.

Definition at line 264 of file FIBIONode.cpp.

265{
266 std::stringstream status;
267
268 auto states = read_sub_nodes(getNode("csr.stat"));
269 bool pll_ok = states.find("pll_ok")->second.value();
270 bool mmcm_ok = states.find("mmcm_ok")->second.value();
271
272 TLOG_DEBUG(5) << "pll ok: " << pll_ok << ", mmcm ok: " << mmcm_ok;
273
274 return pll_ok && mmcm_ok;
275}
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_sfp_status()

std::string dunedaq::timing::FIBIONode::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 163 of file FIBIONode.cpp.

163 { // NOLINT(build/unsigned)
164 std::stringstream status;
165
166 validate_sfp_id(sfp_id);
167
168 std::string sfp_i2c_bus = "i2c_sfp" + std::to_string(sfp_id);
169 auto sfp = get_i2c_device<I2CSFPSlave>(sfp_i2c_bus, "SFP_EEProm");
170 status << "Fanout SFP " << sfp_id << ":" << std::endl;
171 status << sfp->get_status();
172
173 if (print_out)
174 TLOG() << status.str();
175
176 return status.str();
177}
void validate_sfp_id(uint32_t sfp_id) const
Fill hardware monitoring structure.
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
#define TLOG(...)
Definition macro.hpp:22

◆ get_status()

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

Get status string, optionally print.

Implements dunedaq::timing::TimingNode.

Definition at line 43 of file FIBIONode.cpp.

43 {
44 std::stringstream status;
45 auto subnodes = read_sub_nodes(getNode("csr.stat"));
46
47 uint32_t sfp_los_flags = read_sfp_los_flags(); // NOLINT(build/unsigned)
48 uint32_t sfp_fault_flags = read_sfp_fault_flags(); // NOLINT(build/unsigned)
49
50 std::vector<std::pair<std::string, std::string>> sfps_summary;
51 sfps_summary.push_back(std::make_pair("SFP LOS flags", format_reg_value(sfp_los_flags, 16)));
52 sfps_summary.push_back(std::make_pair("SFP fault flags", format_reg_value(sfp_fault_flags, 16)));
53
54 status << format_reg_table(subnodes, "FIB IO state") << std::endl;
55 status << format_reg_table(sfps_summary, "FIB SFPs state");
56
57 if (print_out)
58 TLOG() << status.str();
59
60 return status.str();
61}
uint8_t read_sfp_los_flags() const
reset on-board SFP flags using I2C IO expanders
uint8_t read_sfp_fault_flags() const
reset on-board SFP flags using I2C IO expanders
std::string format_reg_table(T data, std::string title, std::vector< std::string > headers)
Format reg-value table.
Definition toolbox.hxx:166
std::string format_reg_value(T reg_value, uint32_t base)
Definition toolbox.hxx:117

◆ get_uid_address_parameter_name()

std::string dunedaq::timing::FIBIONode::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 35 of file FIBIONode.cpp.

36{
37 return "UID_PROM";
38}

◆ read_active_sfp_mux_channel()

uint32_t dunedaq::timing::FIBIONode::read_active_sfp_mux_channel ( ) const
overridevirtual

Read the active SFP mux channel.

Implements dunedaq::timing::SFPMuxIONode.

Definition at line 153 of file FIBIONode.cpp.

153 {
154 auto active_sfp_mux_channel = getNode("csr.ctrl.inmux").read();
155 getClient().dispatch();
156 return active_sfp_mux_channel.value();
157}

◆ read_sfp_fault_flag()

uint8_t dunedaq::timing::FIBIONode::read_sfp_fault_flag ( uint32_t sfp_id) const

reset on-board SFP flags using I2C IO expanders

Definition at line 234 of file FIBIONode.cpp.

234 { // NOLINT(build/unsigned)
235 return read_sfp_fault_flags() & (1UL << sfp_id);
236}

◆ read_sfp_fault_flags()

uint8_t dunedaq::timing::FIBIONode::read_sfp_fault_flags ( ) const

reset on-board SFP flags using I2C IO expanders

Definition at line 216 of file FIBIONode.cpp.

216 {
217 auto ic_10 = get_i2c_device<I2CExpanderSlave>(m_uid_i2c_bus, "Expander1");
218
219 uint8_t sfp_fault_flags = ic_10->read_inputs(0x01); // NOLINT(build/unsigned)
220 return sfp_fault_flags;
221}
const std::string m_uid_i2c_bus
Definition IONode.hpp:200

◆ read_sfp_los_flag()

uint8_t dunedaq::timing::FIBIONode::read_sfp_los_flag ( uint32_t sfp_id) const

reset on-board SFP flags using I2C IO expanders

Definition at line 226 of file FIBIONode.cpp.

226 { // NOLINT(build/unsigned)
227 return read_sfp_los_flags() & (1UL << sfp_id);
228}

◆ read_sfp_los_flags()

uint8_t dunedaq::timing::FIBIONode::read_sfp_los_flags ( ) const

reset on-board SFP flags using I2C IO expanders

Definition at line 205 of file FIBIONode.cpp.

205 {
206 auto ic_23 = get_i2c_device<I2CExpanderSlave>(m_uid_i2c_bus, "Expander2");
207
208 uint8_t sfp_los_flags = ic_23->read_inputs(0x01); // NOLINT(build/unsigned)
209 return sfp_los_flags;
210}

◆ reset() [1/2]

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

Reset IO, with clock file look up.

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 FIB node.
Definition FIBIONode.cpp:67
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::FIBIONode::reset ( const std::string & clock_config_file) const
overridevirtual

Reset FIB node.

Implements dunedaq::timing::IONode.

Definition at line 67 of file FIBIONode.cpp.

67 {
68
69 // Soft reset
71
72 millisleep(1000);
73
74 // Reset I2C
75 getNode("csr.ctrl.rstb_i2c").write(0x1);
76 getNode("csr.ctrl.rstb_i2c").write(0x0);
77
78 getNode("csr.ctrl.rst").write(0x1);
79 getNode("csr.ctrl.rst").write(0x0);
80
81 getClient().dispatch();
82
84
85 if (carrier_type == kCarrierEnclustraA35) {
86 // enclustra i2c switch stuff
87 try {
88 getNode<I2CMasterNode>(m_uid_i2c_bus).get_slave("AX3_Switch").write_i2c(0x01, 0x7f);
89 } catch (const std::exception& e) {
90 ers::warning(EnclustraSwitchFailure(ERS_HERE, e));
91 }
92 }
93
94 // Configure I2C IO expanders
95 auto ic_10 = get_i2c_device<I2CExpanderSlave>(m_uid_i2c_bus, "Expander1");
96 auto ic_23 = get_i2c_device<I2CExpanderSlave>(m_uid_i2c_bus, "Expander2");
97
98 // Bank 0
99 ic_10->set_inversion(0, 0x00);
100
101 // all out, sfp tx disable
102 ic_10->set_io(0, 0x00);
103 // sfp laser on by default
104 ic_10->set_outputs(0, 0x00);
105
106 // Bank 1
107 ic_10->set_inversion(1, 0x00);
108 // all inputs, sfp fault
109 ic_10->set_io(1, 0xff);
110
111 // Bank 0
112 ic_23->set_inversion(0, 0x00);
113 // pin 0 - out: pll rst, pins 1-4 pll and cdr flags
114 ic_23->set_io(0, 0xfe);
115 ic_23->set_outputs(0, 0x01);
116
117 // Bank 1
118 ic_23->set_inversion(1, 0x00);
119 // all inputs, sfp los
120 ic_23->set_io(1, 0xff);
121
122 // reset pll via I2C IO expanders
123 reset_pll();
124
125 // Upload config file to PLL
126 configure_pll(clock_config_file);
127
128 //getNode("csr.ctrl.inmux").write(0);
129 //getClient().dispatch();
130
131// To be removed from firmware address maps also
132// getNode("csr.ctrl.rst_lock_mon").write(0x1);
133// getNode("csr.ctrl.rst_lock_mon").write(0x0);
134// getClient().dispatch();
135
136 TLOG() << "Reset done";
137}
#define ERS_HERE
void reset_pll() const
reset on-board PLL using I2C IO expanders
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
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

◆ reset_pll()

void dunedaq::timing::FIBIONode::reset_pll ( ) const

reset on-board PLL using I2C IO expanders

Definition at line 196 of file FIBIONode.cpp.

196 {
197 auto ic_23 = get_i2c_device<I2CExpanderSlave>(m_uid_i2c_bus, "Expander2");
198 ic_23->set_outputs(0, 0x00);
199 ic_23->set_outputs(0, 0x01);
200}

◆ switch_sfp_mux_channel()

void dunedaq::timing::FIBIONode::switch_sfp_mux_channel ( uint32_t mux_channel) const
overridevirtual

Switch the SFP mux channel.

Implements dunedaq::timing::SFPMuxIONode.

Definition at line 142 of file FIBIONode.cpp.

142 { // NOLINT(build/unsigned)
143 validate_sfp_id(mux_channel);
144 getNode("csr.ctrl.inmux").write(mux_channel);
145 getClient().dispatch();
146 TLOG_DEBUG(0) << "SFP input mux set to " << read_active_sfp_mux_channel();
147}
uint32_t read_active_sfp_mux_channel() const override
Read the active SFP mux channel.

◆ switch_sfp_soft_tx_control_bit()

void dunedaq::timing::FIBIONode::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 183 of file FIBIONode.cpp.

183 { // NOLINT(build/unsigned)
184 validate_sfp_id(sfp_id);
185
186 // on this board the 8 downstream sfps have their own i2c bus
187 std::string sfp_i2c_bus = "i2c_sfp" + std::to_string(sfp_id);
188 auto sfp = get_i2c_device<I2CSFPSlave>(sfp_i2c_bus, "SFP_EEProm");
189 sfp->switch_soft_tx_control_bit(turn_on);
190}

◆ switch_sfp_tx()

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

reset on-board SFP flags using I2C IO expanders

Switch on or off the SFP tx laser via the I2C IO expander controlling the sfp tx disable pin. aOn=1: laster transmitting, tx disable pin = 0; aOn=0: laster NOT transmitting, tx disable pin = 1.

Implements dunedaq::timing::IONode.

Definition at line 242 of file FIBIONode.cpp.

242 { // NOLINT(build/unsigned)
243 validate_sfp_id(sfp_id);
244
245 auto ic_10 = get_i2c_device<I2CExpanderSlave>(m_uid_i2c_bus, "Expander1");
246 uint8_t current_sfp_tx_control_flags = ic_10->read_outputs_config(0); // NOLINT(build/unsigned)
247
248 uint8_t new_sfp_tx_control_flags; // NOLINT(build/unsigned)
249 if (turn_on)
250 {
251 new_sfp_tx_control_flags = current_sfp_tx_control_flags & ~(1UL << sfp_id);
252 }
253 else
254 {
255 new_sfp_tx_control_flags = current_sfp_tx_control_flags | (1UL << sfp_id);
256 }
257
258 ic_10->set_outputs(0, new_sfp_tx_control_flags);
259}

◆ validate_sfp_id()

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

Fill hardware monitoring structure.

Give info to collector.

Definition at line 280 of file FIBIONode.cpp.

280 { // NOLINT(build/unsigned)
281 // on this board we have 8 downstream SFPs
282 if (sfp_id > 7) {
283 throw InvalidSFPId(ERS_HERE, format_reg_value(sfp_id));
284 }
285}

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