Exemple #1
0
int fci_i2c_rf_write(HANDLE hDevice, u8 chip, u8 addr, u8 alen, u8 *data, u8 len)
{
	int ret;

	ret = fci_i2c_transfer(hDevice, I2C_RF_WRITE, chip << 1, &addr, alen, data, len);
	if(ret != I2C_OK) {
		PRINTF(hDevice, "fci_i2c_rf_write() result=%d, addr= %x, data=%x\n", ret, addr, *data);
	}

	return ret;
}
Exemple #2
0
int fci_i2c_write(HANDLE hDevice, fci_u8 chip, fci_u8 addr, fci_u8 alen, fci_u8 *data, fci_u8 len)
{
	int ret;
	fci_u8 *paddr = &addr;

	ret = fci_i2c_transfer(hDevice, I2C_WRITE, chip << 1, paddr, alen, data, len);
	if(ret != I2C_OK) {
		PRINTF(hDevice, "fci_i2c_write() result=%d, addr= %x, data=%x\n\r", ret, addr, data);
	}

	return ret;
}
Exemple #3
0
int fci_i2c_read(HANDLE hDevice, u8 chip, u8 addr, u8 alen, u8 *data, u8 len)
{
	int ret;

	mutex_lock(&fci_tuner_lock);
	ret = fci_i2c_transfer(hDevice, I2C_READ, chip << 1, &addr, alen, data, len);
	mutex_unlock(&fci_tuner_lock);
	if(ret != I2C_OK) {
		PRINTF(hDevice, "fci_i2c_read() result=%d, addr = %x, data=%x\n", ret, addr, *data);
		return ret;
	}

	return ret;
}
Exemple #4
0
int fci_i2c_read(HANDLE hDevice, fci_u8 chip, fci_u8 addr, fci_u8 alen, fci_u8 *data, fci_u8 len)
{
	int ret;
	fci_u8 tmp[4] = {0xcc, 0xcc, 0xcc, 0xcc};

	ret = fci_i2c_transfer(hDevice, I2C_READ, chip << 1, &addr, alen, &tmp[0], len);
	if(ret != I2C_OK) {
		PRINTF(hDevice, "fci_i2c_read() result=%d, addr = %x, data=%x\n\r", ret, addr, *data);
		return ret;
	}

	*data = tmp[0];
	
	return ret;
}
int fci_i2c_write(HANDLE hDevice, u8 chip, u8 addr, u8 alen, u8 *data, u8 len)
{
  int ret;
  u8 *paddr = &addr;

#ifndef FC8050_USE_QUP_I2C
  mutex_lock(&fc8050_i2c_lock);
#endif

  ret = fci_i2c_transfer(hDevice, I2C_WRITE, chip << 1, paddr, alen, data, len);
  if(ret != I2C_OK)
  {
    //PRINTF(hDevice, "fci_i2c_write() result=%d, addr= %x, data=%x\n\r", ret, addr, data);
  }

#ifndef FC8050_USE_QUP_I2C
  mutex_unlock(&fc8050_i2c_lock);
#endif

  return ret;
}
int fci_i2c_read(HANDLE hDevice, u8 chip, u8 addr, u8 alen, u8 *data, u8 len)
{
  int ret;
  u8 tmp[4] = {0xcc, 0xcc, 0xcc, 0xcc};

#ifndef FC8050_USE_QUP_I2C
  mutex_lock(&fc8050_i2c_lock);
#endif

  ret = fci_i2c_transfer(hDevice, I2C_READ, chip << 1, &addr, alen, &tmp[0], len);
  if(ret != I2C_OK)
  {
    //PRINTF(hDevice, "fci_i2c_read() result=%d, addr = %x, data=%x\n\r", ret, addr, *data);
    return ret;
  }

#ifndef FC8050_USE_QUP_I2C
  mutex_unlock(&fc8050_i2c_lock);
#endif

  *data = tmp[0];

  return ret;
}