16UHAL_REGISTER_DERIVED_NODE(FMCIONode)
20 :
IONode(node, "uid_i2c", "pll_i2c", "i2caddr", {
"PLL",
"CDR" }, {
"sfp_i2c" })
35 if (carrier_type == kCarrierNexusVideo || carrier_type ==
kCarrierAFC) {
36 return "FMC_UID_PROM_NEXUS";
38 return "FMC_UID_PROM";
47 std::stringstream status;
53 TLOG() << std::endl << status.str();
67 getNode(
"csr.ctrl.pll_rst").write(0x1);
68 getNode(
"csr.ctrl.pll_rst").write(0x0);
69 getClient().dispatch();
74 if (carrier_type == kCarrierEnclustraA35) {
76 getNode<I2CMasterNode>(
m_uid_i2c_bus).get_slave(
"AX3_Switch").write_i2c(0x01, 0x7f);
77 }
catch (
const std::exception& e) {
86 getNode(
"csr.ctrl.rst").write(0x1);
87 getNode(
"csr.ctrl.rst").write(0x0);
88 getClient().dispatch();
91 getNode(
"csr.ctrl.sfp_tx_dis").write(0x0);
94 uint32_t cdr_rx_edge = 0x0;
95 uint32_t sfp_rx_edge = 0x0;
96 uint32_t rj45_rx_edge = 0x0;
99 uint32_t sfp_tx_edge = 0x0;
100 uint32_t rj45_tx_edge = 0x0;
103 getNode(
"csr.ctrl.cdr_rx_edge").write(cdr_rx_edge);
104 getNode(
"csr.ctrl.sfp_rx_edge").write(sfp_rx_edge);
105 getNode(
"csr.ctrl.rj45_rx_edge").write(rj45_rx_edge);
108 getNode(
"csr.ctrl.sfp_tx_edge").write(sfp_tx_edge);
109 getNode(
"csr.ctrl.rj45_tx_edge").write(rj45_tx_edge);
111 getClient().dispatch();
113 TLOG() <<
"Reset done";
121 std::vector<std::string> clock_names( {
"PLL",
"CDR"});
123 auto no_cdr = getNode(
"config.no_cdr").read();
124 getClient().dispatch();
127 clock_names.push_back(
"SMPL");
130 return getNode<FrequencyCounterNode>(
"freq").measure_frequencies(clock_names.size());
138 std::vector<std::string> clock_names( {
"PLL",
"CDR"});
140 auto no_cdr = getNode(
"config.no_cdr").read();
141 getClient().dispatch();
144 clock_names.push_back(
"SMPL");
146 std::stringstream table;
148 for (uint8_t i = 0; i < frequencies.size(); ++i) {
149 table << clock_names.at(i) <<
" freq: " << std::setprecision(12) << frequencies.at(i) << std::endl;
153 TLOG() << table.str();
162 std::stringstream status;
166 bool mmcm_ok = states.find(
"mmcm_ok")->second.value();
221 validate_sfp_id(sfp_id);
223 getNode(
"csr.ctrl.sfp_tx_dis").write(!turn_on);
224 getClient().dispatch();
Class for the timing FMC board.
bool clocks_ok() const override
Clocks ready?
std::string get_uid_address_parameter_name() const override
Get the UID address parameter name.
std::string get_clock_frequencies_table(bool print_out=false) const override
Print frequencies of on-board clocks.
std::string get_status(bool print_out=false) const override
Get status string, optionally print.
std::vector< double > read_clock_frequencies() const override
Read frequencies of on-board clocks.
void validate_sfp_id(uint32_t sfp_id) const
Fill hardware monitoring structure.
void reset(const std::string &clock_config_file) const override
Reset FMC IO.
void switch_sfp_tx(uint32_t sfp_id, bool turn_on) const override
control tx laser of on-board SFP
Base class for timing IO nodes.
virtual void write_soft_reset_register() const
Write soft reset register.
virtual uint32_t read_carrier_type() const
Read the word identifying the FPFA carrier board.
const std::string m_uid_i2c_bus
virtual void configure_pll(const std::string &clock_config_file="") const
Configure clock 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)