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)
 
 GIBIONode (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 ~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 configure_expander () const
 Configure the GIB expander.
 
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.
 
virtual uint32_t read_io_expanders () const
 Read the contents of the IO expanders.
 
virtual uint8_t read_sfps_los () const
 Retrive SFP LOS status for all SFPs.
 
virtual uint8_t read_sfps_fault () const
 Retrive SFP fault status for all SFPs.
 
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.
 

Protected Member Functions

virtual uint8_t get_sfp_tx_disable_bitmap () const
 
virtual uint8_t get_num_sfps () const
 
void validate_sfp_id (uint32_t sfp_id) const
 
- Protected Member Functions inherited from dunedaq::timing::IONode
virtual void write_soft_reset_register () const
 Write soft reset register.
 

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 ()
 
- 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() [1/2]

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() [2/2]

dunedaq::timing::GIBIONode::GIBIONode ( 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 )
explicit

Definition at line 28 of file GIBIONode.cpp.

34 : IONode(node, uid_i2c_bus, pll_i2c_bus, pll_i2c_device, clock_names, sfp_i2c_buses)
35{
36}

◆ ~GIBIONode()

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

Definition at line 40 of file GIBIONode.cpp.

40{}

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

278{
279 std::stringstream status;
280
281 auto states = read_sub_nodes(getNode("csr.stat"));
282 bool pll_lol = states.find("clk_gen_lol")->second.value();
283 bool pll_interrupt = states.find("clk_gen_intr")->second.value();
284 bool mmcm_ok = states.find("mmcm_ok")->second.value();
285 bool mmcm_10_ok = states.find("mmcm_ok")->second.value();
286
287 TLOG_DEBUG(5) << "pll lol: " << pll_lol << ", pll intr: " << pll_interrupt
288 << ", mmcm ok: " << mmcm_ok << ", mmcm 10MHz ok: " << mmcm_10_ok;
289
290 return !pll_lol && mmcm_ok && mmcm_10_ok;
291}
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

◆ configure_expander()

void dunedaq::timing::GIBIONode::configure_expander ( ) const

Configure the GIB expander.

Definition at line 170 of file GIBIONode.cpp.

171{
172 auto sfp_expander_0 = get_i2c_device<I2CExpanderSlave>(m_uid_i2c_bus, "SFPExpander0");
173 auto sfp_expander_1 = get_i2c_device<I2CExpanderSlave>(m_uid_i2c_bus, "SFPExpander1");
174
175 // Set invert registers to default for both (0,1) banks
176 sfp_expander_0->set_inversion(0, 0x00);
177 sfp_expander_0->set_inversion(1, 0x00);
178 sfp_expander_1->set_inversion(0, 0x00);
179 sfp_expander_1->set_inversion(1, 0x00);
180
181 // 0: pin set as output, 1: pin set as input
182 sfp_expander_0->set_io(0, 0xff); // set all pins of bank 0 as inputs
183 sfp_expander_0->set_io(1, 0xff); // set all pins of bank 1 as inputs
184
185 sfp_expander_1->set_io(0, 0xff); // set all pins of bank 0 as inputs
186 sfp_expander_1->set_io(1, 0x00); // set all pins of bank 1 as outputs
187
188 // Set SFP disable
189 // Set tx disable pins low, i.e. enable the pins given in the bitmap
190 // (different between v1 and v2/3)
191 sfp_expander_1->set_outputs(1, get_sfp_tx_disable_bitmap());
192}
virtual uint8_t get_sfp_tx_disable_bitmap() const
const std::string m_uid_i2c_bus
Definition IONode.hpp:210
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_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 102 of file GIBIONode.cpp.

103{
104 // enable pll/uid channel 0 only
106 return IONode::get_hardware_info(print_out);
107}
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_num_sfps()

uint8_t dunedaq::timing::GIBIONode::get_num_sfps ( ) const
protectedvirtual

Reimplemented in dunedaq::timing::GIBV2IONode.

Definition at line 352 of file GIBIONode.cpp.

352 { // NOLINT(build/unsigned)
353 // 6 SFPs on GIBv1
354 return 6;
355}

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

93{
94 // enable pll channel 0 only
97}
const std::string m_pll_i2c_bus
Definition IONode.hpp:211
const std::string m_pll_i2c_device
Definition IONode.hpp:212

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

206 { // NOLINT(build/unsigned)
207 std::stringstream status;
208
209 validate_sfp_id(sfp_id);
210
211 uint8_t i2c_mux_bitmask = 1UL << (sfp_id+1);
212
213 set_i2c_mux_channels(i2c_mux_bitmask);
214
215 auto sfp = get_i2c_device<I2CSFPSlave>(m_sfp_i2c_buses.at(sfp_id), "SFP_EEProm");
216
217 status << "SFP " << sfp_id << ":" << std::endl;
218 status << sfp->get_status();
219
220 if (print_out)
221 TLOG() << status.str();
222
223 return status.str();
224}
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_sfp_tx_disable_bitmap()

uint8_t dunedaq::timing::GIBIONode::get_sfp_tx_disable_bitmap ( ) const
protectedvirtual

Reimplemented in dunedaq::timing::GIBV2IONode.

Definition at line 344 of file GIBIONode.cpp.

344 { // NOLINT(build/unsigned)
345 // First 6 bits are tx disable on GIBv1
346 return 0xC0;
347}

◆ get_status()

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

Get status string, optionally print.

Implements dunedaq::timing::TimingNode.

Reimplemented in dunedaq::timing::GIBV3IONode.

Definition at line 53 of file GIBIONode.cpp.

54{
55 std::stringstream status;
56
57 auto subnodes = read_sub_nodes(getNode("csr.stat"));
58 status << format_reg_table(subnodes, "GIB IO state");
59
60 auto subnodes_2 = read_sub_nodes(getNode("csr.ctrl"));
61 status << format_reg_table(subnodes_2, "GIB IO control");
62
63 uint8_t sfp_los = read_sfps_los();
64 uint8_t sfp_fault = read_sfps_fault();
65
66 std::vector<std::string> sfp_vec;
67 std::vector<uint8_t> los_vec;
68 std::vector<uint8_t> fault_vec;
69
70 for (int i=0; i<get_num_sfps(); i++) {
71 sfp_vec.push_back(to_string(i));
72 // L is 0x4C, H is L - 4
73 los_vec.push_back(0x4C - 4*((sfp_los >> i) & 1));
74 fault_vec.push_back(0x4C - 4*((sfp_fault >> i) & 1));
75 }
76
77 status << "------IO expander----" << std::endl;
78 status << "SFP: " << vec_fmt(sfp_vec) << std::endl;
79 status << "LOS: " << vec_fmt(los_vec) << std::endl;
80 status << "Fault: " << vec_fmt(fault_vec) << std::endl;
81
82 status << "Board temperature: " << read_board_temperature() << " [C]" << std::endl;
83
84 if (print_out)
85 TLOG() << std::endl << status.str();
86 return status.str();
87}
virtual uint8_t read_sfps_fault() const
Retrive SFP fault status for all SFPs.
virtual uint8_t get_num_sfps() const
virtual uint8_t read_sfps_los() const
Retrive SFP LOS status for all SFPs.
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
std::string vec_fmt(const std::vector< T > &vec)
Definition toolbox.hxx:382
std::string to_string(const T &v)
Definition toolbox.hxx:49

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

46{
47 return "UID_PROM";
48}

◆ read_board_temperature()

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

Read board temp.

Definition at line 381 of file GIBIONode.cpp.

382{
383 auto temp_mon = get_i2c_device<LM75Node>(m_pll_i2c_bus, "TEMP_MON");
384 return temp_mon->read_temperature();
385}

◆ read_io_expanders()

uint32_t dunedaq::timing::GIBIONode::read_io_expanders ( ) const
virtual

Read the contents of the IO expanders.

Reimplemented in dunedaq::timing::GIBV3IONode.

Definition at line 229 of file GIBIONode.cpp.

229 { // NOLINT(build/unsigned)
230 auto sfp_expander_0 = get_i2c_device<I2CExpanderSlave>(m_uid_i2c_bus, "SFPExpander0");
231 auto sfp_expander_1 = get_i2c_device<I2CExpanderSlave>(m_uid_i2c_bus, "SFPExpander1");
232
233 uint32_t expander_bits = sfp_expander_1->read_inputs(0);
234 expander_bits = (expander_bits << 8) + sfp_expander_0->read_inputs(1);
235 expander_bits = (expander_bits << 8) + sfp_expander_0->read_inputs(0);
236
237 return expander_bits;
238}

◆ read_sfps_fault()

uint8_t dunedaq::timing::GIBIONode::read_sfps_fault ( ) const
virtual

Retrive SFP fault status for all SFPs.

Reimplemented in dunedaq::timing::GIBV2IONode, and dunedaq::timing::GIBV3IONode.

Definition at line 260 of file GIBIONode.cpp.

260 { // NOLINT(build/unsigned)
261 uint32_t expander_bits = read_io_expanders();
262
263 uint8_t fault_bits = 0x00;
264
265 for (uint8_t sfp = 0; sfp<6; sfp++) {
266 // Each SFP has 4 bits, the 4th bit is the fault
267 // Adds the SFPs in inverse order
268 fault_bits = (fault_bits << 1) + ((expander_bits >> (3 + 20 - 4*sfp)) & 1);
269 }
270
271 return fault_bits;
272}
virtual uint32_t read_io_expanders() const
Read the contents of the IO expanders.

◆ read_sfps_los()

uint8_t dunedaq::timing::GIBIONode::read_sfps_los ( ) const
virtual

Retrive SFP LOS status for all SFPs.

Reimplemented in dunedaq::timing::GIBV2IONode, and dunedaq::timing::GIBV3IONode.

Definition at line 243 of file GIBIONode.cpp.

243 { // NOLINT(build/unsigned)
244 uint32_t expander_bits = read_io_expanders();
245
246 uint8_t los_bits = 0x00;
247
248 for (uint8_t sfp = 0; sfp<6; sfp++) {
249 // Each SFP has 4 bits, the 3rd bit is the LOS
250 // Adds the SFPs in inverse order
251 los_bits = (los_bits << 1) + ((expander_bits >> (2 + 20 - 4*sfp)) & 1);
252 }
253
254 return los_bits;
255}

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

145{
146 getNode("csr.ctrl.rst").write(0x1);
147 getNode("csr.ctrl.rst").write(0x0);
148 getClient().dispatch();
149
151
152 getNode("csr.ctrl.gps_clk_en").write(0x0);
153
154 // Set filter to full bandwidth mode A = B = 0x0
155 getNode("csr.ctrl.gps_clk_fltr_a").write(0x0);
156 getNode("csr.ctrl.gps_clk_fltr_b").write(0x0);
157 getClient().dispatch();
158
159 // Upload config file to PLL
160 configure_pll(clock_config_file);
161
163
164 TLOG() << "Reset done";
165}
void configure_expander() const
Configure the GIB expander.
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 197 of file GIBIONode.cpp.

198{
199 getNode("csr.ctrl.clk_gen_rst").write(0x0);
200 getNode("csr.ctrl.clk_gen_rst").write(0x1);
201}

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

370 { // NOLINT(build/unsigned)
371
372 uint8_t mux_channel_config = mux_channel_bitmask & 0x7f;
373
374 auto i2c_bus = getNode<I2CMasterNode>("i2c");
375 i2c_bus.write_i2cPrimitive(0x70, {mux_channel_config});
376}

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

113{
114 // enclustra i2c switch stuff
116 if (carrier_type == kCarrierEnclustraA35) {
117 try {
118 getNode<I2CMasterNode>(m_uid_i2c_bus).get_slave("AX3_Switch").write_i2c(0x01, 0x7f);
119 } catch (const std::exception& e) {
120 ers::warning(EnclustraSwitchFailure(ERS_HERE, e));
121 }
122 }
123
124 // Reset I2C switch and expander, active low
125 getNode("csr.ctrl.i2c_sw_rst").write(0x0);
126 getNode("csr.ctrl.i2c_exten_rst").write(0x0);
127 getNode("csr.ctrl.clk_gen_rst").write(0x0);
128 getClient().dispatch();
129
130 millisleep(1);
131
132 // End reset
133 getNode("csr.ctrl.i2c_sw_rst").write(0x1);
134 getNode("csr.ctrl.i2c_exten_rst").write(0x1);
135 getNode("csr.ctrl.clk_gen_rst").write(0x1);
136 getClient().dispatch();
137
139}
#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 296 of file GIBIONode.cpp.

296 { // NOLINT(build/unsigned)
297 validate_sfp_id(sfp_id);
298
299 auto sfp = get_i2c_device<I2CSFPSlave>(m_sfp_i2c_buses.at(sfp_id), "SFP_EEProm");
300 sfp->switch_soft_tx_control_bit(turn_on);
301}

◆ 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.

Reimplemented in dunedaq::timing::GIBV2IONode.

Definition at line 306 of file GIBIONode.cpp.

306 { // NOLINT(build/unsigned)
307 validate_sfp_id(sfp_id);
308
309 auto sfp_expander_1 = get_i2c_device<I2CExpanderSlave>(m_uid_i2c_bus, "SFPExpander1");
310 uint8_t current_sfp_tx_control_flags = sfp_expander_1->read_outputs_config(1); // NOLINT(build/unsigned)
311
312 uint8_t new_sfp_tx_control_flags; // NOLINT(build/unsigned)
313 if (turn_on)
314 {
315 new_sfp_tx_control_flags = current_sfp_tx_control_flags & ~(1UL << sfp_id);
316 }
317 else
318 {
319 new_sfp_tx_control_flags = current_sfp_tx_control_flags | (1UL << sfp_id);
320 }
321
322 sfp_expander_1->set_outputs(1, new_sfp_tx_control_flags);
323}

◆ validate_sfp_id()

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

Definition at line 360 of file GIBIONode.cpp.

360 { // NOLINT(build/unsigned)
361 // number of sfps on board defined by get_num_sfps
362 if (sfp_id >= get_num_sfps()) {
363 throw InvalidSFPId(ERS_HERE, format_reg_value(sfp_id));
364 }
365}
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: