ilp0100_error Ilp0100_readFileInBuffer(struct msm_sensor_ctrl_t *s_ctrl, uint8_t *pFileName,uint8_t **pAdd, uint32_t* SizeOfBuffer)
{
	ilp0100_error Ret=ILP0100_ERROR_NONE;

#ifdef ST_SPECIFIC
	FILE *pFile;
	uint8_t *pBuffer;
	uint32_t Result;
	uint32_t Size;
#else
	const struct firmware *fw_rawchip2 = NULL;
	int rc = 0;
	unsigned char *rawchipII_data_fw;
	u32 rawchipII_fw_size;
#endif /*ST_SPECIFIC*/

	ILP0100_LOG_FUNCTION_START((void*)&pFileName, (void*)&pAdd);

#ifdef ST_SPECIFIC
	//! Open the binary File
	pFile = fopen ( pFileName , "rb" );
	//ILP0100_DEBUG_LOG("FileName %s",pFileName);
	if (pFile==NULL)
	{
		ILP0100_ERROR_LOG("\nFile error ");
		ILP0100_LOG_FUNCTION_END(Ret);
		return ILP0100_ERROR;
	}

	//! Obtain file size:
	fseek (pFile , 0 , SEEK_END);
	Size = ftell (pFile);
	rewind (pFile);

	//! allocate buffer of file size
	pBuffer= (uint8_t*) malloc (sizeof(uint8_t)*Size);
	if (pBuffer == NULL)
	{
		ILP0100_ERROR_LOG ("\n Memory allocation failed");
		ILP0100_LOG_FUNCTION_END(Ret);
	   	return ILP0100_ERROR;
	}

	//! Load the file in Buffer
	Result = fread (pBuffer,1,Size,pFile);
	if (Result != Size)
	{
		Ret=ILP0100_ERROR;
		ILP0100_ERROR_LOG("\n File Reading to buffer error");
		ILP0100_ERROR_LOG("\n Result read=%d", Result);
		free(pBuffer); 	//! Free the allocated buffer in case of error
		ILP0100_LOG_FUNCTION_END(Ret);
		return Ret;
	}

	*pAdd= (uint8_t*)pBuffer;
	*SizeOfBuffer=Size;
	fclose(pFile);
#else/*hTC*//*TODO:use request firmware*/
	//HTC_CAM chuck add the mechanism of request FW.
	rc = request_firmware(&fw_rawchip2, pFileName, &(s_ctrl->pdev->dev));
	if (rc!=0) {
		pr_info("request_firmware for error %d\n", rc);
		Ret = ILP0100_ERROR;
		return Ret;
	}
	Ilp0100_store_firmwarwe(fw_rawchip2);
	rawchipII_data_fw = (unsigned char *)fw_rawchip2->data;
	rawchipII_fw_size = (u32) fw_rawchip2->size;

	*pAdd = (uint8_t*)rawchipII_data_fw;
	*SizeOfBuffer = rawchipII_fw_size;
	//HTC_CAM_END
#endif /*ST_SPECIFIC*/
	ILP0100_LOG_FUNCTION_END(Ret);
	return Ret;
}
ilp0100_error Ilp0100_readFileInBuffer(struct msm_sensor_ctrl_t *s_ctrl, uint8_t *pFileName,uint8_t **pAdd, uint32_t* SizeOfBuffer)
{
	ilp0100_error Ret=ILP0100_ERROR_NONE;

#ifdef ST_SPECIFIC
	FILE *pFile;
	uint8_t *pBuffer;
	uint32_t Result;
	uint32_t Size;
#else
	const struct firmware *fw_rawchip2 = NULL;
	int rc = 0;
	unsigned char *rawchipII_data_fw;
	u32 rawchipII_fw_size;
#endif 

	ILP0100_LOG_FUNCTION_START((void*)&pFileName, (void*)&pAdd);

#ifdef ST_SPECIFIC
	
	pFile = fopen ( pFileName , "rb" );
	
	if (pFile==NULL)
	{
		ILP0100_ERROR_LOG("\nFile error ");
		ILP0100_LOG_FUNCTION_END(Ret);
		return ILP0100_ERROR;
	}

	
	fseek (pFile , 0 , SEEK_END);
	Size = ftell (pFile);
	rewind (pFile);

	
	pBuffer= (uint8_t*) malloc (sizeof(uint8_t)*Size);
	if (pBuffer == NULL)
	{
		ILP0100_ERROR_LOG ("\n Memory allocation failed");
		ILP0100_LOG_FUNCTION_END(Ret);
	   	return ILP0100_ERROR;
	}

	
	Result = fread (pBuffer,1,Size,pFile);
	if (Result != Size)
	{
		Ret=ILP0100_ERROR;
		ILP0100_ERROR_LOG("\n File Reading to buffer error");
		ILP0100_ERROR_LOG("\n Result read=%d", Result);
		free(pBuffer); 	
		ILP0100_LOG_FUNCTION_END(Ret);
		return Ret;
	}

	*pAdd= (uint8_t*)pBuffer;
	*SizeOfBuffer=Size;
	fclose(pFile);
#else
	
	rc = request_firmware(&fw_rawchip2, pFileName, &(s_ctrl->sensor_i2c_client->client->dev));
	if (rc!=0) {
		pr_info("request_firmware for error %d\n", rc);
		Ret = ILP0100_ERROR;
		return Ret;
	}
	Ilp0100_store_firmwarwe(fw_rawchip2);
	rawchipII_data_fw = (unsigned char *)fw_rawchip2->data;
	rawchipII_fw_size = (u32) fw_rawchip2->size;

	*pAdd = (uint8_t*)rawchipII_data_fw;
	*SizeOfBuffer = rawchipII_fw_size;
	
#endif 
	ILP0100_LOG_FUNCTION_END(Ret);
	return Ret;
}