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

Class for the timing FMC board. More...

#include <GIBV2IONode.hpp>

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

Public Member Functions

 GIBV2IONode (const uhal::Node &node)
 
virtual ~GIBV2IONode ()
 
uint8_t read_sfps_los () const override
 Retrive SFP LOS status for all SFPs.
 
uint8_t read_sfps_fault () const override
 Retrive SFP fault status for all SFPs.
 
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)
 
- Public Member Functions inherited from dunedaq::timing::GIBIONode
 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.
 
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 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

uint8_t get_sfp_tx_disable_bitmap () const override
 
uint8_t get_num_sfps () const override
 
- Protected Member Functions inherited from dunedaq::timing::GIBIONode
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 GIBV2IONode.hpp.

Constructor & Destructor Documentation

◆ GIBV2IONode()

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

Definition at line 20 of file GIBV2IONode.cpp.

21 : GIBIONode(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", "i2c" })
22{
23}
GIBIONode(const uhal::Node &node)
Definition GIBIONode.cpp:21

◆ ~GIBV2IONode()

dunedaq::timing::GIBV2IONode::~GIBV2IONode ( )
virtual

Definition at line 27 of file GIBV2IONode.cpp.

27{}

Member Function Documentation

◆ clocks_ok()

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

Clocks ready?

Reimplemented from dunedaq::timing::GIBIONode.

Definition at line 68 of file GIBV2IONode.cpp.

69{
70 std::stringstream status;
71
72 auto states = read_sub_nodes(getNode("csr.stat"));
73 bool pll_lol = states.find("clk_gen_lol")->second.value();
74 //bool pll_interrupt = states.find("clk_gen_intr")->second.value();
75 bool mmcm_ok = states.find("mmcm_ok")->second.value();
76
77 TLOG_DEBUG(5) << "pll lol: " << pll_lol << ", mmcm ok: " << mmcm_ok;
78
79 return !pll_lol && mmcm_ok;
80}
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_num_sfps()

uint8_t dunedaq::timing::GIBV2IONode::get_num_sfps ( ) const
overrideprotectedvirtual

Reimplemented from dunedaq::timing::GIBIONode.

Definition at line 119 of file GIBV2IONode.cpp.

119 { // NOLINT(build/unsigned)
120 // 7 SFPs on GIBv2/3
121 return 7;
122}

◆ get_sfp_tx_disable_bitmap()

uint8_t dunedaq::timing::GIBV2IONode::get_sfp_tx_disable_bitmap ( ) const
overrideprotectedvirtual

Reimplemented from dunedaq::timing::GIBIONode.

Definition at line 111 of file GIBV2IONode.cpp.

111 { // NOLINT(build/unsigned)
112 // First 6 bits and the 8th bit are tx disable for GIBv2/3
113 return 0x40;
114}

◆ read_sfps_fault()

uint8_t dunedaq::timing::GIBV2IONode::read_sfps_fault ( ) const
overridevirtual

Retrive SFP fault status for all SFPs.

Reimplemented from dunedaq::timing::GIBIONode.

Reimplemented in dunedaq::timing::GIBV3IONode.

Definition at line 50 of file GIBV2IONode.cpp.

50 { // NOLINT(build/unsigned)
51 uint32_t expander_bits = read_io_expanders();
52
53 // A-CLK fault is 2nd bit
54 uint8_t fault_bits = static_cast<uint8_t>(expander_bits & 0b10);
55
56 for (uint8_t sfp = 0; sfp<6; sfp++) {
57 // Each SFP has 4 bits, the 4th bit is the fault
58 // Adds the SFPs in inverse order
59 fault_bits = (fault_bits << 1) + ((expander_bits >> (3 + 20 - 4*sfp)) & 1);
60 }
61
62 return fault_bits;
63}
virtual uint32_t read_io_expanders() const
Read the contents of the IO expanders.

◆ read_sfps_los()

uint8_t dunedaq::timing::GIBV2IONode::read_sfps_los ( ) const
overridevirtual

Retrive SFP LOS status for all SFPs.

Reimplemented from dunedaq::timing::GIBIONode.

Reimplemented in dunedaq::timing::GIBV3IONode.

Definition at line 32 of file GIBV2IONode.cpp.

32 { // NOLINT(build/unsigned)
33 uint32_t expander_bits = read_io_expanders();
34
35 // A-CLK LOS is 1st bit
36 uint8_t los_bits = static_cast<uint8_t>(expander_bits & 0b01);
37
38 for (uint8_t sfp = 0; sfp<6; sfp++) {
39 // Each SFP has 4 bits, the 3rd bit is the LOS
40 // Adds the SFPs in inverse order
41 los_bits = (los_bits << 1) + ((expander_bits >> (2 + 20 - 4*sfp)) & 1);
42 }
43
44 return los_bits;
45}

◆ switch_sfp_tx()

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

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

Reimplemented from dunedaq::timing::GIBIONode.

Definition at line 85 of file GIBV2IONode.cpp.

85 { // NOLINT(build/unsigned)
86 validate_sfp_id(sfp_id);
87
88 // A-CLK is the 7th SFP, but is in slot 7 not 6
89 // TODO make this a map dlindebaum 25/10/02
90 sfp_id = sfp_id + (sfp_id/6);
91
92 auto sfp_expander_1 = get_i2c_device<I2CExpanderSlave>(m_uid_i2c_bus, "SFPExpander1");
93 uint8_t current_sfp_tx_control_flags = sfp_expander_1->read_outputs_config(1); // NOLINT(build/unsigned)
94
95 uint8_t new_sfp_tx_control_flags; // NOLINT(build/unsigned)
96 if (turn_on)
97 {
98 new_sfp_tx_control_flags = current_sfp_tx_control_flags & ~(1UL << sfp_id);
99 }
100 else
101 {
102 new_sfp_tx_control_flags = current_sfp_tx_control_flags | (1UL << sfp_id);
103 }
104
105 sfp_expander_1->set_outputs(1, new_sfp_tx_control_flags);
106}
void validate_sfp_id(uint32_t sfp_id) 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

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