/* Lock function */ int dni_i2c_lock_read( mux_info_t * mux_info, dev_info_t * dev_info) { int r_data=0; pthread_mutex_lock(&mutex); if(mux_info != NULL) { char cpld_path[100] = {0}; sprintf(cpld_path, "%s/%d-%04x", SYS_DEV_PATH, mux_info->bus, mux_info->addr); dni_lock_cpld_write_attribute(cpld_path, mux_info->offset, mux_info->channel); } if(dev_info->size == 1) r_data = onlp_i2c_readb(dev_info->bus, dev_info->addr, dev_info->offset, dev_info->flags); else r_data = onlp_i2c_readw(dev_info->bus, dev_info->addr, dev_info->offset, dev_info->flags); pthread_mutex_unlock(&mutex); return r_data; }
int onlp_i2c_dev_readw(onlp_i2c_dev_t* dev, uint8_t offset, uint32_t flags) { int error, rv; if( (error = dev_mux_channels_select__(dev, flags)) < 0) { return error; } if( (rv = onlp_i2c_readw(dev->bus, dev->addr, offset, flags)) < 0) { AIM_LOG_ERROR("Device %s: readw() failed: %d", dev->name, rv); return rv; } if( (error = dev_mux_channels_deselect__(dev, flags)) < 0) { return error; } return rv; }
int onlp_sfpi_dev_readw(int port, uint8_t devaddr, uint8_t addr) { int bus = FRONT_PORT_TO_MUX_INDEX(port); return onlp_i2c_readw(bus, devaddr, addr, ONLP_I2C_F_FORCE); }
int onlp_sfpi_dev_readw(int port, uint8_t devaddr, uint8_t addr) { int bus = front_port_to_cpld_mux_index(port); return onlp_i2c_readw(bus, devaddr, addr, ONLP_I2C_F_FORCE); }
int onlp_sfpi_dev_readw(int port, uint8_t devaddr, uint8_t addr) { int bus = onlp_sfpi_map_bus_index(port); return onlp_i2c_readw(bus, devaddr, addr, ONLP_I2C_F_FORCE); }