17UHAL_REGISTER_DERIVED_NODE(MIBV2IONode)
21 :
IONode(node, "i2c", "i2c", {
"PLL" }, {
"OSC",
"PLL",
"EP 0",
"EP 1",
"EP 2" }, {
"sfp0_i2c",
"sfp1_i2c",
"sfp2_i2c" })
42 std::stringstream status;
48 TLOG() << std::endl << status.str();
65 getNode(
"csr.ctrl.rst").write(0x1);
66 getNode(
"csr.ctrl.rst").write(0x0);
68 getClient().dispatch();
70 TLOG() <<
"Reset done";
88 if (clock_source != kFreeRun)
90 getNode(
"csr.ctrl.pll_in_sel").write(clock_source);
91 getClient().dispatch();
99 std::stringstream status;
105 status <<
"SFP " << sfp_id <<
":" << std::endl;
106 status << sfp->get_status();
109 TLOG() << status.str();
119 std::stringstream status;
122 bool pll_ok = states.find(
"pll_ok")->second.value();
123 bool mmcm_ok = states.find(
"mmcm_ok")->second.value();
125 TLOG_DEBUG(5) <<
"pll ok: " << pll_ok <<
", mmcm ok: " << mmcm_ok;
127 return pll_ok && mmcm_ok;
137 sfp->switch_soft_tx_control_bit(turn_on);
195 if (amc_slot < 1 || amc_slot > 12) {
Base class for timing IO nodes.
virtual void write_soft_reset_register() const
Write soft reset register.
virtual void reset(const std::string &clock_config_file) const =0
Reset timing node.
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.
Class for the timing FMC board.
void validate_sfp_id(uint32_t sfp_id) const
Fill hardware monitoring structure.
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(const std::string &clock_config_file) const override
Reset MIB v2 IO.
std::string get_sfp_status(uint32_t sfp_id, bool print_out=false) const override
Print status of on-board SFP.
void switch_clock_source(const ClockSource &clock_source) const
Switch clock input, with clock file look up and upload if necessary.
std::string get_status(bool print_out=false) const override
Get status string, optionally print.
void switch_sfp_tx(uint32_t sfp_id, bool turn_on) const override
control tx laser of on-board SFP
bool clocks_ok() const override
Clocks ready?
void validate_amc_slot(uint32_t amc_slot) const
std::string get_uid_address_parameter_name() const override
Get the UID address parameter name.
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,...)
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)