18UHAL_REGISTER_DERIVED_NODE(GIBIONode)
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" })
43 std::stringstream status;
54 TLOG() << std::endl << status.str();
60std::unique_ptr<const SI534xSlave>
85 if (carrier_type == kCarrierEnclustraA35) {
87 getNode<I2CMasterNode>(
m_uid_i2c_bus).get_slave(
"AX3_Switch").write_i2c(0x01, 0x7f);
88 }
catch (
const std::exception& e) {
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();
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();
115 getNode(
"csr.ctrl.rst").write(0x1);
116 getNode(
"csr.ctrl.rst").write(0x0);
117 getClient().dispatch();
121 getNode(
"csr.ctrl.gps_clk_en").write(0x0);
124 getNode(
"csr.ctrl.gps_clk_fltr_a").write(0x0);
125 getNode(
"csr.ctrl.gps_clk_fltr_b").write(0x0);
126 getClient().dispatch();
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);
141 sfp_expander_0->set_io(0, 0xff);
142 sfp_expander_0->set_io(1, 0xff);
144 sfp_expander_1->set_io(0, 0xff);
145 sfp_expander_1->set_io(1, 0x00);
149 sfp_expander_1->set_outputs(1, 0xC0);
151 TLOG() <<
"Reset done";
159 getNode(
"csr.ctrl.clk_gen_rst").write(0x0);
160 getNode(
"csr.ctrl.clk_gen_rst").write(0x1);
167 std::stringstream status;
171 uint8_t i2c_mux_bitmask = 1UL << (sfp_id+1);
177 status <<
"SFP " << sfp_id <<
":" << std::endl;
178 status << sfp->get_status();
181 TLOG() << status.str();
191 std::stringstream status;
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();
199 TLOG_DEBUG(5) <<
"pll lol: " << pll_lol <<
", pll intr: " << pll_interrupt
200 <<
", mmcm ok: " << mmcm_ok <<
", mmcm 10MHz ok: " << mmcm_10_ok;
202 return !pll_lol && mmcm_ok && mmcm_10_ok;
212 sfp->switch_soft_tx_control_bit(turn_on);
222 uint8_t current_sfp_tx_control_flags = sfp_expander_1->read_outputs_config(1);
224 uint8_t new_sfp_tx_control_flags;
227 new_sfp_tx_control_flags = current_sfp_tx_control_flags & ~(1UL << sfp_id);
231 new_sfp_tx_control_flags = current_sfp_tx_control_flags | (1UL << sfp_id);
234 sfp_expander_1->set_outputs(1, new_sfp_tx_control_flags);
268 uint8_t mux_channel_config = mux_channel_bitmask & 0x7f;
270 auto i2c_bus = getNode<I2CMasterNode>(
"i2c");
271 i2c_bus.write_i2cPrimitive(0x70, {mux_channel_config});
280 return temp_mon->read_temperature();
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.
void set_up_io_infrastructure() const override
Set up i2c buses, enable ICs.
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.
void reset_pll() const override
Reset PLL.
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?
float read_board_temperature() const
Read board temp.
Base class for timing IO nodes.
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)