Beispiel #1
0
static kal_uint8 S5K3L2XX_ReadOtp(u8 address,unsigned char *iBuffer,unsigned int buffersize)
{
		kal_uint16 i = 0;
		u8 readbuff = 0;
		int ret ;
		u16 i2c_id = 0;
		CAM_CALDB("[CAM_CAL]ENTER  address:0x%x buffersize:%d\n ", address, buffersize);
		
		if (get_module_type() == LITEON_MODULE) {
			i2c_id = S5K3L2XXOTP_LITEON_DEVICE_ID;
			if (address == LITEON_LSC_START_ADDR ) {
				memcpy(iBuffer, liteon_lsc_data, LITEON_LSC_SIZE);
				return 0;
			}
		} else if (get_module_type() == PRIMAX_MODULE) {
			i2c_id = S5K3L2XXOTP_PRIMAX_DEVICE_ID;
			if (address == PRIMAX_LSC_START_ADDR ) {
				/*
				 * lsc data had been read out in sensor driver,
				 * so just copy it to user.
				 */
				memcpy(iBuffer, primax_lsc_data, PRIMAX_LSC_SIZE);
				return 0;
			}
		}

		for(i = 0; i<buffersize; i++)
		{				
			ret= iReadCAM_CAL(address+i,1, &readbuff, i2c_id);
			//CAM_CALDB("[CAM_CAL]address+i = 0x%x,readbuff = 0x%x\n",(address+i),readbuff );
			*(iBuffer+i) =(unsigned char)readbuff;
		}
		return 0;
}
Beispiel #2
0
static kal_uint8 OV5670_ReadOtp(u8 address,unsigned char *iBuffer,unsigned int buffersize)
{
		kal_uint16 i = 0;
		u8 readbuff = 0;
		int ret ;
		u16 i2c_id = 0;
		CAM_CALDB("[CAM_CAL_SUB]ENTER  address:0x%x buffersize:%d\n ", address, buffersize);
		
		if (get_module_type() == SUNNY_MODULE) {
			*(iBuffer) =(unsigned char)sunny_otp_data->module_id;
			*(iBuffer+1) =(unsigned char)sunny_otp_data->awb_rg_msb;
			*(iBuffer+2) =(unsigned char)sunny_otp_data->awb_bg_msb;
			*(iBuffer+3) =(unsigned char)sunny_otp_data->awb_lsb;
		} else if (get_module_type() == OFILM_MODULE) {
			*(iBuffer) =(unsigned char)ofilm_otp_data->module_id;
			*(iBuffer+1) =(unsigned char)ofilm_otp_data->awb_rg_msb;
			*(iBuffer+2) =(unsigned char)ofilm_otp_data->awb_bg_msb;
			*(iBuffer+3) =(unsigned char)ofilm_otp_data->awb_lsb;
		} else if (get_module_type() == QTECH_MODULE) {
			*(iBuffer) =(unsigned char)qtech_otp_data->module_id;
			*(iBuffer+1) =(unsigned char)qtech_otp_data->awb_rg_msb;
			*(iBuffer+2) =(unsigned char)qtech_otp_data->awb_bg_msb;
			*(iBuffer+3) =(unsigned char)qtech_otp_data->awb_lsb;
		}else
			return 0;

		for(i = 0; i<4; i++)
			CAM_CALDB("[CAM_CAL_SUB]ov5670 otp readbuff[%d] = 0x%x\n",i,*(iBuffer+i));
}
Beispiel #3
0
//Burst Write Data
static int iWriteData(u8  ui4_offset, unsigned int  ui4_length, unsigned char * pinputdata)
{
   int  i4RetValue = 0;
   int  i4ResidueDataLength;
   u32 u4IncOffset = 0;
   u32 u4CurrentOffset;
   u8 * pBuff;
   u16 i2c_id = 0;
   CAM_CALDB("[S24CAM_CAL_SUB] iWriteData\n" );

   if (get_module_type() == SUNNY_MODULE)
	i2c_id = OV5670_SUNNY_DEVICE_ID;
   else if (get_module_type() == OFILM_MODULE)
	i2c_id = OV5670_OFILM_DEVICE_ID;
   else if (get_module_type() == QTECH_MODULE)
	i2c_id = OV5670_QTECH_DEVICE_ID;

   i4ResidueDataLength = (int)ui4_length;
   u4CurrentOffset = ui4_offset;
   pBuff = pinputdata;   

   CAM_CALDB("[CAM_CAL_SUB] iWriteData u4CurrentOffset is %d \n",u4CurrentOffset);   

   do 
   {
       CAM_CALDB("[CAM_CAL_SUB][iWriteData] Write 0x%x=0x%x \n",u4CurrentOffset, pBuff[0]);
       i4RetValue = iWriteCAM_CAL((u8)u4CurrentOffset, 1, pBuff[0], i2c_id);
       if (i4RetValue != 0)
       {
            CAM_CALDB("[CAM_CAL_SUB] I2C iWriteData failed!! \n");
            return -1;
       }           
       u4IncOffset ++;
       i4ResidueDataLength --;
       u4CurrentOffset = ui4_offset + u4IncOffset;
       pBuff = pinputdata + u4IncOffset;
   }while (i4ResidueDataLength > 0);
   CAM_CALDB("[S24CAM_CAL_SUB] iWriteData done\n" );
 
   return 0;
}
Beispiel #4
0
	Value load_in_global_module(StringConstPtr _file) {
		std::string file;
		string_to_std_string(_file, file);
		std::string path;
		if (expand_load_path(file, path)) {
			ASSERT(get_module_type(path) == ModuleTypeSource); // only source modules are supported in load_in_global_module
			Value mod = get_global_module();
			if (compile_module(path, load_source(file), mod)) {
				return object_get_instance_variable(mod, snow::sym("__module_value__"));
			} else {
				fprintf(stderr, "ERROR: Could not compile module: %s\n", path.c_str());
				return NULL;
			}
		} else {
			throw_exception_with_description("File not found in any load path: %@", file.c_str());
			return NULL;
		}
	}