17UHAL_REGISTER_DERIVED_NODE(GIBV3IONode)
34 std::stringstream status;
45 std::vector<std::string> sfp_vec;
46 std::vector<uint8_t> los_vec;
47 std::vector<uint8_t> fault_vec;
52 los_vec.push_back(0x4C - 4*((sfp_los >> i) & 1));
53 fault_vec.push_back(0x4C - 4*((sfp_fault >> i) & 1));
56 status <<
"-----IO expander------" << std::endl;
57 status <<
"SFP: " <<
vec_fmt(sfp_vec) << std::endl;
58 status <<
"LOS: " <<
vec_fmt(los_vec) << std::endl;
59 status <<
"Fault: " <<
vec_fmt(fault_vec) << std::endl;
64 TLOG() << std::endl << status.str();
74 uint32_t expander_bits = sfp_expander_0->read_inputs(1);
75 expander_bits = (expander_bits << 8) + sfp_expander_0->read_inputs(0);
87 uint8_t los_bits =
static_cast<uint8_t
>(expander_bits & 1);
89 uint32_t los_bitmask = 0x003f;
91 uhal::ValWord<uint32_t> los_reg_data = getNode(
"csr.stat.sfp_los").read();
92 getClient().dispatch();
94 los_bits = (los_bits << 6) + static_cast<uint8_t>(los_reg_data & los_bitmask);
106 uint8_t fault_bits =
static_cast<uint8_t
>((expander_bits >> 1) & 1);
108 for (uint8_t sfp = 0; sfp<6; sfp++) {
111 fault_bits = (fault_bits << 1) + ((expander_bits >> (8 + 5 - sfp)) & 1);
Class for the timing FMC board.
uint8_t get_num_sfps() const override
Class for the timing FMC board.
uint32_t read_io_expanders() const override
Read the contents of the IO expanders.
uint8_t read_sfps_los() const override
Retrive SFP LOS status for all SFPs.
uint8_t read_sfps_fault() const override
Retrive SFP fault status for all SFPs.
std::string get_status(bool print_out=false) const override
Get status string, optionally print.
const std::string m_uid_i2c_bus
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.
std::string format_reg_table(T data, std::string title, std::vector< std::string > headers)
Format reg-value table.
std::string vec_fmt(const std::vector< T > &vec)
std::string to_string(const T &v)