17UHAL_REGISTER_DERIVED_NODE(GIBIONode)
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" })
42 std::stringstream status;
48 TLOG() << std::endl << status.str();
54std::unique_ptr<const SI534xSlave>
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();
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();
97 if (carrier_type == kCarrierEnclustraA35) {
99 getNode<I2CMasterNode>(
m_uid_i2c_bus).get_slave(
"AX3_Switch").write_i2c(0x01, 0x7f);
100 }
catch (
const std::exception& e) {
105 getNode(
"csr.ctrl.gps_clk_en").write(0x0);
108 getNode(
"csr.ctrl.gps_clk_fltr_a").write(0x0);
109 getNode(
"csr.ctrl.gps_clk_fltr_b").write(0x0);
110 getClient().dispatch();
115 getNode(
"csr.ctrl.rst").write(0x1);
116 getNode(
"csr.ctrl.rst").write(0x0);
117 getClient().dispatch();
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);
129 sfp_expander_0->set_io(0, 0xff);
130 sfp_expander_0->set_io(1, 0xff);
132 sfp_expander_1->set_io(0, 0xff);
133 sfp_expander_1->set_io(1, 0x00);
137 sfp_expander_1->set_outputs(1, 0xC0);
139 TLOG() <<
"Reset done";
146 std::stringstream status;
150 uint8_t i2c_mux_bitmask = 1UL << (sfp_id+1);
156 status <<
"SFP " << sfp_id <<
":" << std::endl;
157 status << sfp->get_status();
160 TLOG() << status.str();
170 std::stringstream status;
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();
178 TLOG_DEBUG(5) <<
"pll lol: " << pll_lol <<
", pll intr: " << pll_interrupt
179 <<
", mmcm ok: " << mmcm_ok <<
", mmcm 10MHz ok: " << mmcm_10_ok;
181 return !pll_lol && mmcm_ok && mmcm_10_ok;
191 sfp->switch_soft_tx_control_bit(turn_on);
201 uint8_t current_sfp_tx_control_flags = sfp_expander_1->read_outputs_config(1);
203 uint8_t new_sfp_tx_control_flags;
206 new_sfp_tx_control_flags = current_sfp_tx_control_flags & ~(1UL << sfp_id);
210 new_sfp_tx_control_flags = current_sfp_tx_control_flags | (1UL << sfp_id);
213 sfp_expander_1->set_outputs(1, new_sfp_tx_control_flags);
247 uint8_t mux_channel_config = mux_channel_bitmask & 0x7f;
249 auto i2c_bus = getNode<I2CMasterNode>(
"i2c");
250 i2c_bus.write_i2cPrimitive(0x70, {mux_channel_config});
Class for the timing FMC board.
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.
void reset(const std::string &clock_config_file) const override
Reset GIB IO.
std::unique_ptr< const SI534xSlave > get_pll() const override
GET PLL I2C interface.
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 validate_sfp_id(uint32_t sfp_id) const
std::string get_hardware_info(bool print_out) const override
Print hardware information.
std::string get_uid_address_parameter_name() const override
Get the UID address parameter name.
std::string get_sfp_status(uint32_t sfp_id, bool print_out=false) const override
Print status of on-board SFP.
std::string get_status(bool print_out=false) const override
Get status string, optionally print.
bool clocks_ok() const override
Clocks ready?
Base class for timing IO nodes.
virtual void write_soft_reset_register() const
Write soft reset register.
const std::string m_pll_i2c_bus
const std::string m_pll_i2c_device
virtual uint32_t read_carrier_type() const
Read the word identifying the FPFA carrier board.
virtual std::string get_hardware_info(bool print_out=false) const
Print hardware information.
const std::string m_uid_i2c_bus
const std::vector< std::string > m_sfp_i2c_buses
virtual void configure_pll(const std::string &clock_config_file="") const
Configure clock chip.
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.
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,...)
CarrierType convert_value_to_carrier_type(uint32_t darrier_type)
std::string format_reg_table(T data, std::string title, std::vector< std::string > headers)
Format reg-value table.
std::string format_reg_value(T reg_value, uint32_t base)
void millisleep(const double &time_in_milliseconds)
void warning(const Issue &issue)