16UHAL_REGISTER_DERIVED_NODE(TLUIONode)
20 :
IONode(node, "i2c", "i2c", "SI5345", {
"PLL" }, {})
21 , m_dac_devices({
"DAC1",
"DAC2" })
42 std::stringstream status;
46 TLOG() << status.str();
61 getNode(
"csr.ctrl.pll_rst").write(0x1);
62 getNode(
"csr.ctrl.pll_rst").write(0x0);
64 getNode(
"csr.ctrl.rst_i2c").write(0x1);
65 getNode(
"csr.ctrl.rst_i2c").write(0x0);
67 getClient().dispatch();
71 getNode<I2CMasterNode>(
m_uid_i2c_bus).get_slave(
"AX3_Switch").write_i2c(0x01, 0x7f);
72 }
catch (
const std::exception& e) {
81 si_chip->write_i2cArray(0x113, { 0x9, 0x33 });
84 getNode(
"csr.ctrl.rst").write(0x1);
85 getNode(
"csr.ctrl.rst").write(0x0);
86 getClient().dispatch();
93 ic_6->set_inversion(0, 0x00);
94 ic_6->set_io(0, 0x00);
95 ic_6->set_outputs(0, 0x00);
98 ic_6->set_inversion(1, 0x00);
99 ic_6->set_io(1, 0x00);
100 ic_6->set_outputs(1, 0x88);
103 ic_7->set_inversion(0, 0x00);
104 ic_7->set_io(0, 0x00);
105 ic_7->set_outputs(0, 0xf0);
108 ic_7->set_inversion(1, 0x00);
109 ic_7->set_io(1, 0x00);
110 ic_7->set_outputs(1, 0xf0);
113 uint32_t bi_signal_threshold = 0x589D;
118 TLOG_DEBUG(0) <<
"DAC1 and DAC2 set to " << std::hex << bi_signal_threshold;
120 TLOG() <<
"Reset done";
128 std::string dac_device;
130 dac_device = m_dac_devices.at(dac_id);
131 }
catch (
const std::out_of_range& e) {
134 auto dac = get_i2c_device<DACSlave>(m_uid_i2c_bus, dac_device);
135 dac->set_interal_ref(internal_ref);
136 dac->set_dac(7, dac_value);
144 TLOG() <<
"TLU does not support SFP I2C";
153 std::stringstream status;
157 bool mmcm_ok = states.find(
"mmcm_ok")->second.value();
169 TLOG() <<
"TLU does not support SFP I2C";
177 validate_sfp_id(sfp_id);
179 getNode(
"csr.ctrl.sfp_tx_dis").write(turn_on);
180 getClient().dispatch();
Base class for timing IO nodes.
virtual void write_soft_reset_register() const
Write soft reset register.
const std::string m_uid_i2c_bus
virtual std::unique_ptr< const SI534xSlave > get_pll() const
Get the PLL chip.
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.
void reset(const std::string &clock_config_file) const override
Reset IO node.
void switch_sfp_tx(uint32_t, bool) const override
Control tx laser of on-board SFP softly (I2C command)
void validate_sfp_id(uint32_t sfp_id) const
void configure_dac(uint32_t dac_id, uint32_t dac_value, bool internal_ref=false) const
Configure on-board DAC.
std::string get_status(bool print_out=false) const
Print the status of the timing node.
bool clocks_ok() const override
Clocks ready?
std::string get_uid_address_parameter_name() const override
Get the UID address parameter name.
void switch_sfp_soft_tx_control_bit(uint32_t, bool) const override
Control tx laser of on-board SFP softly (I2C command)
std::string get_sfp_status(uint32_t sfp_id, bool print_out=false) const override
Print status of on-board SFP.
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)
void warning(const Issue &issue)