/*!
 * \fn			ilp0100_error Ilp0100_readFirmware(Ilp0100_structInitFirmware *InitFirmwareData)
 * \brief		Ilp0100 Read firmware function.
 * \ingroup		Platform_Functions
 * \param[out]	InitFirmware
 * \retval		ILP0100_ERROR_NONE : Success
 * \retval		"Other Error Code" : Failure
 */
ilp0100_error Ilp0100_readFirmware(struct msm_sensor_ctrl_t *s_ctrl, Ilp0100_structInitFirmware *InitFirmwareData)
{
	ilp0100_error Ret=ILP0100_ERROR_NONE;
	
#ifdef ST_SPECIFIC
	uint8_t *pFileName[3];
#else
	uint8_t *pFileName[READ_FIRMWARE_COUNT];
#endif /*ST_SPECIFIC*/

	ILP0100_LOG_FUNCTION_START((void*)&InitFirmwareData);

#ifdef ST_SPECIFIC
	//! Fimware Binary to be read
	//pFileName[0]="/prj/imgsw/users/sheenaj/SB_1308/CVerifEnv/Ztrans/Csource/api/Ilp0100_Basic_IPM_Code_out.bin";
	pFileName[0]=".\\ILP0100_IPM_Code_out.bin";

	//! Copy the contents of Firmware Binary in a Buffer
	Ret=Ilp0100_readFileInBuffer(pFileName[0],&InitFirmwareData->pIlp0100Firmware, &InitFirmwareData->Ilp0100FirmwareSize );
	if(Ret!=ILP0100_ERROR_NONE)
	{
		ILP0100_ERROR_LOG("\n Error in Reading Firmware code Binary");
		ILP0100_LOG_FUNCTION_END(Ret);
		return Ret;
	}
	//! Calib Data Binary to be read
	pFileName[1]=".\\ILP0100_IPM_Data_out.bin";

	//! Copy the contents of Calib Data Binary in a Buffer
	Ret=Ilp0100_readFileInBuffer(pFileName[1],&InitFirmwareData->pIlp0100SensorGenericCalibData, &InitFirmwareData->Ilp0100SensorGenericCalibDataSize );
	if (Ret!=ILP0100_ERROR_NONE)
	{
		ILP0100_ERROR_LOG("\n Error in Reading Calib Data");
		ILP0100_LOG_FUNCTION_END(Ret);
		return Ret;
	}

	//! For part to part Calibration Data
	/*InitFirmwareData->pIlp0100SensorRawPart2PartCalibData =0x0;
	InitFirmwareData->Ilp0100SensorRawPart2PartCalibDataSize= 0;
	*/
	//! Part to Part Calib Data Binary to be read
	pFileName[2]=".\\ILP0100_lscbuffer_out.bin";

	//! Copy the contents of Part to PArt Calib Data Binary in a Buffer
	Ret=Ilp0100_readFileInBuffer(pFileName[2],&InitFirmwareData->pIlp0100SensorRawPart2PartCalibData, &InitFirmwareData->Ilp0100SensorRawPart2PartCalibDataSize );
	if(Ret!=ILP0100_ERROR_NONE)
	{
		ILP0100_ERROR_LOG("\n Error in Reading Part to Part Calib Data Binary");
		ILP0100_LOG_FUNCTION_END(Ret);
		return Ret;
	}
#else /*hTC*/

	/*Fimware Binary to be read*/
	pFileName[0]="ILP0100_IPM_Code_out.bin";

	/*Copy the contents of Firmware Binary in a Buffer*/
	Ret=Ilp0100_readFileInBuffer(s_ctrl, pFileName[0],
		&InitFirmwareData->pIlp0100Firmware, 
		&(InitFirmwareData->Ilp0100FirmwareSize));
	if(Ret!=ILP0100_ERROR_NONE)
	{
		ILP0100_ERROR_LOG("\n Error in Reading Firmware code Binary");
		ILP0100_LOG_FUNCTION_END(Ret);
		return Ret;
	}

	/*Calib Data Binary to be read*/
	pFileName[1]="ILP0100_IPM_Data_out.bin";

	/*Copy the contents of Calib Data Binary in a Buffer*/
	Ret=Ilp0100_readFileInBuffer(s_ctrl, pFileName[1],
		&InitFirmwareData->pIlp0100SensorGenericCalibData,
		&(InitFirmwareData->Ilp0100SensorGenericCalibDataSize));
	if (Ret!=ILP0100_ERROR_NONE)
	{
		ILP0100_ERROR_LOG("\n Error in Reading Calib Data");
		ILP0100_LOG_FUNCTION_END(Ret);
		return Ret;
	}

	pFileName[2]="lscbuffer_rev2.bin";

	//! Copy the contents of Part to PArt Calib Data Binary in a Buffer
	Ret=Ilp0100_readFileInBuffer(s_ctrl, pFileName[2],&InitFirmwareData->pIlp0100SensorRawPart2PartCalibData, &InitFirmwareData->Ilp0100SensorRawPart2PartCalibDataSize );
	if(Ret!=ILP0100_ERROR_NONE)
	{
		ILP0100_ERROR_LOG("\n Error in Reading Part to Part Calib Data Binary");
		ILP0100_LOG_FUNCTION_END(Ret);
		return Ret;
	}

#endif /*ST_SPECIFIC*/

	ILP0100_LOG_FUNCTION_END(Ret);
	return Ret;

}
ilp0100_error Ilp0100_readFirmware(struct msm_sensor_ctrl_t *s_ctrl, Ilp0100_structInitFirmware *InitFirmwareData)
{
	ilp0100_error Ret=ILP0100_ERROR_NONE;
	
#ifdef ST_SPECIFIC
	uint8_t *pFileName[3];
#else
	uint8_t *pFileName[READ_FIRMWARE_COUNT];
#endif 

	ILP0100_LOG_FUNCTION_START((void*)&InitFirmwareData);

#ifdef ST_SPECIFIC
	
	
	pFileName[0]=".\\ILP0100_IPM_Code_out.bin";

	
	Ret=Ilp0100_readFileInBuffer(pFileName[0],&InitFirmwareData->pIlp0100Firmware, &InitFirmwareData->Ilp0100FirmwareSize );
	if(Ret!=ILP0100_ERROR_NONE)
	{
		ILP0100_ERROR_LOG("\n Error in Reading Firmware code Binary");
		ILP0100_LOG_FUNCTION_END(Ret);
		return Ret;
	}
	
	pFileName[1]=".\\ILP0100_IPM_Data_out.bin";

	
	Ret=Ilp0100_readFileInBuffer(pFileName[1],&InitFirmwareData->pIlp0100SensorGenericCalibData, &InitFirmwareData->Ilp0100SensorGenericCalibDataSize );
	if (Ret!=ILP0100_ERROR_NONE)
	{
		ILP0100_ERROR_LOG("\n Error in Reading Calib Data");
		ILP0100_LOG_FUNCTION_END(Ret);
		return Ret;
	}

	
	
	pFileName[2]=".\\ILP0100_lscbuffer_out.bin";

	
	Ret=Ilp0100_readFileInBuffer(pFileName[2],&InitFirmwareData->pIlp0100SensorRawPart2PartCalibData, &InitFirmwareData->Ilp0100SensorRawPart2PartCalibDataSize );
	if(Ret!=ILP0100_ERROR_NONE)
	{
		ILP0100_ERROR_LOG("\n Error in Reading Part to Part Calib Data Binary");
		ILP0100_LOG_FUNCTION_END(Ret);
		return Ret;
	}
#else 

	
	pFileName[0]="ILP0100_IPM_Code_out.bin";

	
	Ret=Ilp0100_readFileInBuffer(s_ctrl, pFileName[0],
		&InitFirmwareData->pIlp0100Firmware, 
		&(InitFirmwareData->Ilp0100FirmwareSize));
	if(Ret!=ILP0100_ERROR_NONE)
	{
		ILP0100_ERROR_LOG("\n Error in Reading Firmware code Binary");
		ILP0100_LOG_FUNCTION_END(Ret);
		return Ret;
	}

	
	pFileName[1]="ILP0100_IPM_Data_out.bin";

	
	Ret=Ilp0100_readFileInBuffer(s_ctrl, pFileName[1],
		&InitFirmwareData->pIlp0100SensorGenericCalibData,
		&(InitFirmwareData->Ilp0100SensorGenericCalibDataSize));
	if (Ret!=ILP0100_ERROR_NONE)
	{
		ILP0100_ERROR_LOG("\n Error in Reading Calib Data");
		ILP0100_LOG_FUNCTION_END(Ret);
		return Ret;
	}

	pFileName[2]="lscbuffer_rev2.bin";

	
	Ret=Ilp0100_readFileInBuffer(s_ctrl, pFileName[2],&InitFirmwareData->pIlp0100SensorRawPart2PartCalibData, &InitFirmwareData->Ilp0100SensorRawPart2PartCalibDataSize );
	if(Ret!=ILP0100_ERROR_NONE)
	{
		ILP0100_ERROR_LOG("\n Error in Reading Part to Part Calib Data Binary");
		ILP0100_LOG_FUNCTION_END(Ret);
		return Ret;
	}

#endif 

	ILP0100_LOG_FUNCTION_END(Ret);
	return Ret;

}