/**

@see   DVBT_NIM_FP_UPDATE_FUNCTION

*/
int
rtl2832_fc0013_UpdateFunction(
	DVBT_NIM_MODULE *pNim
	)
{
	DVBT_DEMOD_MODULE *pDemod;
	RTL2832_FC0013_EXTRA_MODULE *pNimExtra;


	// Get demod module.
	pDemod = pNim->pDemod;

	// Get NIM extra module.
	pNimExtra = &(pNim->Extra.Rtl2832Fc0013);


	// Update demod particular registers.
	if(pDemod->UpdateFunction(pDemod) != FUNCTION_SUCCESS)
		goto error_status_execute_function;


	// Increase tuner LNA_GAIN update waiting time.
	pNimExtra->LnaUpdateWaitTime += 1;


	// Check if need to update tuner LNA_GAIN according to update waiting time.
	if(pNimExtra->LnaUpdateWaitTime == pNimExtra->LnaUpdateWaitTimeMax)
	{
		// Reset update waiting time.
		pNimExtra->LnaUpdateWaitTime = 0;

		// Enable demod DVBT_IIC_REPEAT.
		if(pDemod->SetRegBitsWithPage(pDemod, DVBT_IIC_REPEAT, 0x1) != FUNCTION_SUCCESS)
			goto error_status_set_registers;

		// Update tuner LNA gain with RSSI.
		if(rtl2832_fc0013_UpdateTunerLnaGainWithRssi(pNim) != FUNCTION_SUCCESS)
			goto error_status_execute_function;

		// Disable demod DVBT_IIC_REPEAT.
		if(pDemod->SetRegBitsWithPage(pDemod, DVBT_IIC_REPEAT, 0x0) != FUNCTION_SUCCESS)
			goto error_status_set_registers;
	}


	return FUNCTION_SUCCESS;


error_status_set_registers:
error_status_execute_function:
	return FUNCTION_ERROR;
}
Exemplo n.º 2
0
/**

@see   DVBT_NIM_FP_UPDATE_FUNCTION

*/
s32
dvbt_nim_default_UpdateFunction(
	DVBT_NIM_MODULE *pNim
	)
{
	DVBT_DEMOD_MODULE *pDemod;


	// Get demod module.
	pDemod = pNim->pDemod;


	// Update demod particular registers.
	if(pDemod->UpdateFunction(pDemod) != FUNCTION_SUCCESS)
		goto error_status_execute_function;


	return FUNCTION_SUCCESS;


error_status_execute_function:
	return FUNCTION_ERROR;
}
Exemplo n.º 3
0
/**

@see   DVBT_NIM_FP_UPDATE_FUNCTION

*/
int
rtl2832_mt2266_UpdateFunction(
	DVBT_NIM_MODULE *pNim
	)
{
	TUNER_MODULE *pTuner;
	DVBT_DEMOD_MODULE *pDemod;
	MT2266_EXTRA_MODULE *pMt2266Extra;
	RTL2832_MT2266_EXTRA_MODULE *pRtl2832Mt2266Extra;

	Handle_t Mt2266Handle;
	UData_t Status;



	// Get tuner module and demod module.
	pTuner = pNim->pTuner;
	pDemod = pNim->pDemod;

	// Get tuner extra module and tuner handle.
	pMt2266Extra = (MT2266_EXTRA_MODULE *)pTuner->pExtra;
	pMt2266Extra->GetHandle(pTuner, &Mt2266Handle);

	// Get NIM extra module.
	pRtl2832Mt2266Extra = (RTL2832_MT2266_EXTRA_MODULE *)pNim->pExtra;


	// Update demod particular registers.
	if(pDemod->UpdateFunction(pDemod) != FUNCTION_SUCCESS)
		goto error_status_execute_function;


	// Enable demod DVBT_IIC_REPEAT.
	if(pDemod->SetRegBitsWithPage(pDemod, DVBT_IIC_REPEAT, 0x1) != FUNCTION_SUCCESS)
		goto error_status_set_registers;

	// Update demod and tuner register setting.
	Status = demod_pdcontrol(
		pDemod,
		Mt2266Handle,
		&pRtl2832Mt2266Extra->LnaConfig,
		&pRtl2832Mt2266Extra->UhfSens,
		&pRtl2832Mt2266Extra->AgcCurrentState,
		(uint32_t *)&pRtl2832Mt2266Extra->LnaGainOld
		);

	if(MT_IS_ERROR(Status))
		goto error_status_execute_function;

	// Disable demod DVBT_IIC_REPEAT.
	if(pDemod->SetRegBitsWithPage(pDemod, DVBT_IIC_REPEAT, 0x0) != FUNCTION_SUCCESS)
		goto error_status_set_registers;


	return FUNCTION_SUCCESS;


error_status_execute_function:
error_status_set_registers:
	return FUNCTION_ERROR;
}
/**

@see   DVBT_NIM_FP_UPDATE_FUNCTION

*/
int
rtl2832_mt2266_UpdateFunction(
	DVBT_NIM_MODULE *pNim
	)
{
	TUNER_MODULE *pTuner;
	DVBT_DEMOD_MODULE *pDemod;
	MT2266_EXTRA_MODULE *pTunerExtra;
	RTL2832_MT2266_EXTRA_MODULE *pNimExtra;

	Handle_t Mt2266Handle;
	UData_t Status;
	


	// Get tuner module and demod module.
	pTuner = pNim->pTuner;
	pDemod = pNim->pDemod;

	// Get tuner extra module and tuner handle.
	pTunerExtra = &(pTuner->Extra.Mt2266);
	pTunerExtra->GetHandle(pTuner, &Mt2266Handle);

	// Get NIM extra module.
	pNimExtra = &(pNim->Extra.Rtl2832Mt2266);


	// Update demod particular registers.
	if(pDemod->UpdateFunction(pDemod) != FUNCTION_SUCCESS)
		goto error_status_execute_function;


	// Enable demod DVBT_IIC_REPEAT.
	if(pDemod->SetRegBitsWithPage(pDemod, DVBT_IIC_REPEAT, 0x1) != FUNCTION_SUCCESS)
		goto error_status_set_registers;

	// Update demod and tuner register setting.
	Status = demod_pdcontrol(
		pDemod,
		Mt2266Handle,
		&pNimExtra->LnaConfig,
		&pNimExtra->UhfSens,
		&pNimExtra->AgcCurrentState,
		&pNimExtra->LnaGainOld
		);

/*
	handle_t demod_handle,
	handle_t tuner_handle,
	unsigned char* lna_config,
	unsigned char* uhf_sens,
	unsigned char *agc_current_state,
	unsigned long *lna_gain_old
	
	unsigned char LnaConfig;
	unsigned char UhfSens;
	unsigned char AgcCurrentState;
	unsigned long LnaGainOld;	
	
*/

	if(MT_IS_ERROR(Status))
		goto error_status_execute_function;

	// Disable demod DVBT_IIC_REPEAT.
	if(pDemod->SetRegBitsWithPage(pDemod, DVBT_IIC_REPEAT, 0x0) != FUNCTION_SUCCESS)
		goto error_status_set_registers;


	return FUNCTION_SUCCESS;


error_status_execute_function:
error_status_set_registers:
	return FUNCTION_ERROR;
}