kal_uint16 BF3905MIPI_read_cmos_sensor(kal_uint32 addr)
{
	kal_uint16 get_byte=0;
    char puSendCmd = {(char)(addr & 0xFF)};
	iReadRegI2C(&puSendCmd , 1, (u8*)&get_byte,1,BF3905MIPI_WRITE_ID);
    return get_byte;
}
Пример #2
0
kal_uint16 HI704_read_cmos_sensor(kal_uint8 addr)
{
    kal_uint16 get_byte=0;
    char puSendCmd = { (char)(addr & 0xFF) };
    iReadRegI2C(&puSendCmd , 1, (u8*)&get_byte,1,HI704_WRITE_ID);
    return get_byte;
}
kal_uint16 MT9V114_read_cmos_sensor(kal_uint32 addr)
{
	kal_uint16 get_byte=0;
    char puSendCmd[2] = {(char)(addr >> 8) , (char)(addr & 0xFF) };
	iReadRegI2C(puSendCmd , 2, (u8*)&get_byte,2,MT9V114_WRITE_ID);
    return ((get_byte<<8)&0xff00)|((get_byte>>8)&0x00ff);
}
BYTE imx135_byteread_cmos_sensor(kal_uint32 addr)
{
    BYTE get_byte=0;
    char puSendCmd[2] = {(char)(addr >> 8) , (char)(addr & 0xFF) };
    iReadRegI2C(puSendCmd , 2, (u8*)&get_byte,1,IMX135MIPI_WRITE_ID);
    return get_byte;
}
static bool selective_read_eeprom(kal_uint16 addr, unsigned char * data)
{
	char pu_send_cmd[2] = {(char)(addr >> 8) , (char)(addr & 0xFF) };
	
	if(iReadRegI2C(pu_send_cmd, 2, (u8*)data, 1, S5K3M2_DEVICE_ID)<0)
		return false;
    return true;
}
Пример #6
0
kal_uint16 OV2722MIPI_read_cmos_sensor(kal_uint32 addr)
{
	kal_uint16 get_byte=0;
    char puSendCmd[2] = {(char)(addr >> 8) , (char)(addr & 0xFF) };
	iReadRegI2C(puSendCmd , 2, (u8*)&get_byte,1,OV2722MIPI_WRITE_ID);
		
    return get_byte;
}
kal_uint16 GC0313MIPI_read_cmos_sensor(kal_uint8 addr)
{
	kal_uint16 get_byte=0;
    char puSendCmd = { (char)(addr & 0xFF) };
	iReadRegI2C(&puSendCmd , 1, (u8*)&get_byte, 1, GC0313MIPI_READ_ID);
	
    return get_byte;
}
static kal_uint16 read_cmos_sensor(kal_uint32 addr)
{
	kal_uint16 get_byte=0;

	char pu_send_cmd[2] = {(char)(addr >> 8), (char)(addr & 0xFF) };
	iReadRegI2C(pu_send_cmd, 2, (u8*)&get_byte, 1, imgsensor.i2c_write_id);

	return get_byte;
}
Пример #9
0
static  kal_uint16 ov13850r2a_read_cmos_sensor(kal_uint8 slaveID,kal_uint32 addr)
{
  kal_uint16 get_byte=0;

  char pu_send_cmd[2] = {(char)(addr >> 8), (char)(addr & 0xFF) };
  iReadRegI2C(pu_send_cmd, 2, (u8*)&get_byte, 1, slaveID);
  
  return get_byte;
}
//Address: 2Byte, Data: 1Byte
int iReadCAM_CAL(u16 a_u2Addr, u32 ui4_length, u8 * a_puBuff)
{
    int  i4RetValue = 0;
    u8  Device_id;

	
	if(a_u2Addr <= 0xA0FF)
		{
			Device_id = 0xA0;
		}
	else if((a_u2Addr >= 0xA200)&&(a_u2Addr <= 0xA2FF ))
		{
			Device_id = 0xA2;		
		}
	else if((a_u2Addr >= 0xA300)&&(a_u2Addr <= 0xA3FF))
		{
			Device_id = 0xA4;
		}
	else
		{
		    //g_pstI2Cclient->addr = ov16825OTP_LSC1_DEVICE_ID>>1;
			Device_id = 0xA0;
			CAM_CALDB("[CAM_CAL] Note In LSC Block1 Info a_u2Addr is %x \n",a_u2Addr);
		}

    kal_uint16 get_byte=0;
    char puSendCmd = { (char)(a_u2Addr & 0xFF) };
    iReadRegI2C(&puSendCmd , 1, (u8*)&get_byte,1,	Device_id);
	*a_puBuff = get_byte;
    return 0;

     /*char   puReadCmd[2] = {(char)(a_u2Addr >> 8) , (char)(a_u2Addr & 0xFF)};

    //CAM_CALDB("[CAM_CAL] iReadCAM_CAL!! \n");   
    //CAM_CALDB("[CAM_CAL] i2c_master_send \n");
    i4RetValue = i2c_master_send(g_pstI2Cclient, puReadCmd, 2);
	
    if (i4RetValue != 2)
    {
        CAM_CALDB("[CAM_CAL] I2C send read address failed!! \n");
        return -1;
    }

    //CAM_CALDB("[CAM_CAL] i2c_master_recv \n");
    i4RetValue = i2c_master_recv(g_pstI2Cclient, (char *)a_puBuff, ui4_length);
	CAM_CALDB("[CAM_CAL][iReadCAM_CAL] Read 0x%x=0x%x \n", a_u2Addr, a_puBuff[0]);
    if (i4RetValue != ui4_length)
    {
        CAM_CALDB("[CAM_CAL] I2C read data failed!! \n");
        return -1;
    } 

    //CAM_CALDB("[CAM_CAL] iReadCAM_CAL done!! \n");
    return 0;*/
}
int selective_read_region(u32 addr, BYTE* data,u16 i2c_id,u32 size)
{
  //  u32 page = addr/PAGE_SIZE; /* size of page was 256 */
	//u32 offset = addr%PAGE_SIZE;
	BYTE* buff = data;
	u32 size_to_read = size;
	//kdSetI2CSpeed(EEPROM_I2C_SPEED);
	int ret = 0;

    while(size_to_read>0) {
		if(selective_read_byte(addr,(u8*)buff,S5K3M2_DEVICE_ID)){
			addr+=1;
			buff+=1;
			size_to_read-=1;
    		ret+=1;
		} else {
			break;

		}
#if 0
		if(size_to_read > BUFF_SIZE) {
			CAM_CALDB("offset =%x size %d\n", offset,BUFF_SIZE);
			if(iReadRegI2C(&offset, 1, (u8*)buff, BUFF_SIZE, i2c_id+(page<<1))<0)
				break;
			ret += BUFF_SIZE;
			buff += BUFF_SIZE;
			offset +=BUFF_SIZE;
			size_to_read -= BUFF_SIZE;
			page += offset/PAGE_SIZE_;

		} else {
		    CAM_CALDB("offset =%x size %d\n", offset,size_to_read);
			if(iReadRegI2C(&offset, 1, (u8*)buff, (u16) size_to_read, i2c_id+(page<<1))<0)
				break;
			ret += size_to_read;
			size_to_read =0;
		}
#endif
    }
	CAM_CALDB("selective_read_region addr =%x size %d data read = %d\n", addr,size, ret);
    return ret;
}
Пример #12
0
/*************************************************************************
* FUNCTION
*    GC2035_read_cmos_sensor
*
* DESCRIPTION
*    This function read data from CMOS sensor through I2C.
*
* PARAMETERS
*    addr: the 16bit address of register
*
* RETURNS
*    8bit data read through I2C
*
* LOCAL AFFECTED
*
*************************************************************************/
static kal_uint8 GC2355MIPI_read_cmos_sensor(kal_uint8 addr)
{
  kal_uint8 in_buff[1] = {0xFF};
  kal_uint8 out_buff[1];
  
  out_buff[0] = addr;

    if (0 != iReadRegI2C((u8*)out_buff , (u16) sizeof(out_buff), (u8*)in_buff, (u16) sizeof(in_buff), GC2355MIPI_WRITE_ID)) {
        SENSORDB("ERROR: GC2355MIPI_read_cmos_sensor \n");
    }
  return in_buff[0];
}
bool selective_read_byte(u32 addr, BYTE* data,u16 i2c_id)
{
//	CAM_CALDB("selective_read_byte\n");

    u8 page = addr/PAGE_SIZE_; /* size of page was 256 */
	u8 offset = addr%PAGE_SIZE_;
	kdSetI2CSpeed(EEPROM_I2C_SPEED);

	if(iReadRegI2C(&offset, 1, (u8*)data, 1, i2c_id+(page<<1))<0) {
		CAM_CALERR("fail selective_read_byte addr =0x%x data = 0x%x,page %d, offset 0x%x", addr, *data,page,offset);
		return false;
	}
	//CAM_CALDB("selective_read_byte addr =0x%x data = 0x%x,page %d, offset 0x%x", addr, *data,page,offset);
    return true;
}
Пример #14
0
static kal_uint8 OV7675_read_cmos_sensor(kal_uint8 addr)
{
  kal_uint8 in_buff[1] = {0xFF};
  kal_uint8 out_buff[1];
  
  out_buff[0] = addr;
   
    if (0 != iReadRegI2C((u8*)out_buff , (u16) sizeof(out_buff), (u8*)in_buff, (u16) sizeof(in_buff), OV7675_WRITE_ID)) {
        SENSORDB("ERROR: OV7675_read_cmos_sensor \n");
    }

#if (defined(__OV7675_DEBUG_TRACE__))
  if (size != rt) printk("I2C read %x error\n", addr);
#endif

  return in_buff[0];
}
Пример #15
0
static int read_cmos_sensor(kal_uint16 slave_id,kal_uint32 addr,u8* data)
{
	char pu_send_cmd[2] = {(char)(addr & 0xFF) };
	kdSetI2CSpeed(I2C_SPEED);
    return iReadRegI2C(pu_send_cmd, 1, data, 1, slave_id);//0 for good
}