示例#1
0
/**

@see   DVBT_NIM_FP_GET_PARAMETERS

*/
s32
dvbt_nim_default_GetParameters(
	DVBT_NIM_MODULE *pNim,
	u64 *pRfFreqHz,
	s32 *pBandwidthMode
	)
{
	TUNER_MODULE *pTuner;
	DVBT_DEMOD_MODULE *pDemod;


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


	// Get tuner RF frequency in Hz.
	if(pTuner->GetRfFreqHz(pTuner, pRfFreqHz) != FUNCTION_SUCCESS)
		goto error_status_execute_function;

	// Get demod bandwidth mode.
	if(pDemod->GetBandwidthMode(pDemod, pBandwidthMode) != FUNCTION_SUCCESS)
		goto error_status_execute_function;


	return FUNCTION_SUCCESS;


error_status_execute_function:
	return FUNCTION_ERROR;
}
示例#2
0
UData_t
tuner_set_bw_normal(
	handle_t tuner_handle,
	handle_t demod_handle
	)
{
	DVBT_DEMOD_MODULE *pDemod;

	int DemodBandwidthMode;
	unsigned int TunerBandwidthHz;
	unsigned int TargetTunerBandwidthHz;


	// Get demod module.
	pDemod = (DVBT_DEMOD_MODULE *)demod_handle;

	// Get demod bandwidth mode.
	if(pDemod->GetBandwidthMode(pDemod, &DemodBandwidthMode) != FUNCTION_SUCCESS)
		goto error_status_execute_function;

	// Determine tuner target bandwidth.
	switch(DemodBandwidthMode)
	{
		case DVBT_BANDWIDTH_6MHZ:	TargetTunerBandwidthHz = MT2266_BANDWIDTH_6MHZ;		break;
		case DVBT_BANDWIDTH_7MHZ:	TargetTunerBandwidthHz = MT2266_BANDWIDTH_7MHZ;		break;
		default:
		case DVBT_BANDWIDTH_8MHZ:	TargetTunerBandwidthHz = MT2266_BANDWIDTH_8MHZ;		break;
	}

	// Get tuner bandwidth.
	if(MT_IS_ERROR(MT2266_GetParam(tuner_handle, MT2266_OUTPUT_BW, &TunerBandwidthHz)))
		goto error_status_get_tuner_bandwidth;

	// Set tuner bandwidth with normal setting according to demod bandwidth mode.
	if(TunerBandwidthHz != TargetTunerBandwidthHz)
	{
		if(MT_IS_ERROR(MT2266_SetParam(tuner_handle, MT2266_OUTPUT_BW, TargetTunerBandwidthHz)))
			goto error_status_set_tuner_bandwidth;
	}


	return MT_OK;


error_status_set_tuner_bandwidth:
error_status_get_tuner_bandwidth:
error_status_execute_function:
	return MT_COMM_ERR;
}
示例#3
0
UData_t
tuner_set_bw_narrow(
	handle_t tuner_handle,
	handle_t demod_handle
	)
{
	DVBT_DEMOD_MODULE *pDemod;

	int DemodBandwidthMode;
	unsigned long AciDetInd;
	unsigned int TunerBandwidthHz;
	unsigned int TargetTunerBandwidthHz;


	// Get demod module.
	pDemod = (DVBT_DEMOD_MODULE *)demod_handle;

	// Get demod bandwidth mode.
	if(pDemod->GetBandwidthMode(pDemod, &DemodBandwidthMode) != FUNCTION_SUCCESS)
		goto error_status_execute_function;

	// Get demod ACI_DET_IND.
	if(pDemod->GetRegBitsWithPage(pDemod, DVBT_ACI_DET_IND, &AciDetInd) != FUNCTION_SUCCESS)
		goto error_status_get_registers;

	// Determine tuner target bandwidth according to ACI_DET_IND.
	if(AciDetInd == 0x1)
	{
		// Choose narrow target bandwidth.
		switch(DemodBandwidthMode)
		{
			case DVBT_BANDWIDTH_6MHZ:	TargetTunerBandwidthHz = MT2266_BANDWIDTH_5MHZ;		break;
			case DVBT_BANDWIDTH_7MHZ:	TargetTunerBandwidthHz = MT2266_BANDWIDTH_6MHZ;		break;
			default:
			case DVBT_BANDWIDTH_8MHZ:	TargetTunerBandwidthHz = MT2266_BANDWIDTH_7MHZ;		break;
		}
	}
	else
	{
		// Choose normal target bandwidth.
		switch(DemodBandwidthMode)
		{
			case DVBT_BANDWIDTH_6MHZ:	TargetTunerBandwidthHz = MT2266_BANDWIDTH_6MHZ;		break;
			case DVBT_BANDWIDTH_7MHZ:	TargetTunerBandwidthHz = MT2266_BANDWIDTH_7MHZ;		break;
			default:
			case DVBT_BANDWIDTH_8MHZ:	TargetTunerBandwidthHz = MT2266_BANDWIDTH_8MHZ;		break;
		}
	}

	// Get tuner bandwidth.
	if(MT_IS_ERROR(MT2266_GetParam(tuner_handle, MT2266_OUTPUT_BW, &TunerBandwidthHz)))
		goto error_status_get_tuner_bandwidth;

	// Set tuner bandwidth with normal setting according to demod bandwidth mode.
	if(TunerBandwidthHz != TargetTunerBandwidthHz)
	{
		if(MT_IS_ERROR(MT2266_SetParam(tuner_handle, MT2266_OUTPUT_BW, TargetTunerBandwidthHz)))
			goto error_status_set_tuner_bandwidth;
	}


	return MT_OK;


error_status_set_tuner_bandwidth:
error_status_get_tuner_bandwidth:
error_status_get_registers:
error_status_execute_function:
	return MT_COMM_ERR;
}