📄 d0360_drv.c
字号:
pParams->Channel_6M_Trl[0] = STTUNER_IOREG_GetField(DeviceMap,IOHandle,TRL_NOMRATE_LSB);
pParams->Channel_6M_Trl[1] = STTUNER_IOREG_GetField(DeviceMap,IOHandle,TRL_NOMRATE_LO);
pParams->Channel_6M_Trl[2] = STTUNER_IOREG_GetField(DeviceMap,IOHandle,TRL_NOMRATE_HI);
}
if(pParams->ChannelBWStatus == STTUNER_CHAN_BW_7M)
{
pParams->Channel_7M_Trl_Done = TRUE;
pParams->Channel_7M_Trl[0] = STTUNER_IOREG_GetField(DeviceMap,IOHandle,TRL_NOMRATE_LSB);
pParams->Channel_7M_Trl[1] = STTUNER_IOREG_GetField(DeviceMap,IOHandle,TRL_NOMRATE_LO);
pParams->Channel_7M_Trl[2] = STTUNER_IOREG_GetField(DeviceMap,IOHandle,TRL_NOMRATE_HI);
}
if(pParams->ChannelBWStatus == STTUNER_CHAN_BW_8M)
{
pParams->Channel_8M_Trl_Done = TRUE;
pParams->Channel_8M_Trl[0] = STTUNER_IOREG_GetField(DeviceMap,IOHandle,TRL_NOMRATE_LSB);
pParams->Channel_8M_Trl[1] = STTUNER_IOREG_GetField(DeviceMap,IOHandle,TRL_NOMRATE_LO);
pParams->Channel_8M_Trl[2] = STTUNER_IOREG_GetField(DeviceMap,IOHandle,TRL_NOMRATE_HI);
}
}/*** End of if(pParams->TrlNormRateTunning == FALSE) ***/
/* end of fine tuning */
}
else
pResult->Locked = FALSE;
error = FE_SEARCH_FAILED;
}
else
error = FE_BAD_PARAMETER;
}
else
error = FE_INVALID_HANDLE;
pResult->SignalStatus = pParams->State;
pResult->State = STTUNER_IOREG_GetField(DeviceMap,IOHandle,CORE_STATE_STAT);
STTUNER_IOREG_SetField(DeviceMap,IOHandle,FORCE, (pParams->Force & 2)>>1);
return error;
}
/*****************************************************
--FUNCTION :: FE_360_Search
--ACTION :: Search for a valid transponder
--PARAMS IN :: Handle ==> Front End Handle
pSearch ==> Search parameters
pResult ==> Result of the search
--PARAMS OUT:: NONE
--RETURN :: Error (if any)
--***************************************************/
FE_360_Error_t FE_360_Search(STTUNER_IOREG_DeviceMap_t *DeviceMap, IOARCH_Handle_t IOHandle,FE_360_InternalParams_t *pParams, FE_360_SearchResult_t *pResult,STTUNER_tuner_instance_t *TunerInstance)
{
FE_360_Error_t error = FE_NO_ERROR;
U8 trl_ctl[3],gain_src[2];
U8 Rgain_src,Rtrl_ctl;
STTUNER_InstanceDbase_t *Inst;
Inst = STTUNER_GetDrvInst();
#ifndef HOST_PC
if (pParams->ChannelBW == STTUNER_CHAN_BW_6M)
{
Rgain_src=STTUNER_IOREG_GetRegister(DeviceMap,IOHandle,R_GAIN_SRC1);
gain_src[0]=(Rgain_src & 0xf0) | M6_F_GAIN_SRC_HI;
gain_src[1]=M6_F_GAIN_SRC_LO;
STTUNER_IOREG_SetContigousRegisters(DeviceMap,IOHandle,R_GAIN_SRC1,gain_src,2);
if (Inst->TRL_IOCTL_Set_Flag==FALSE)
{
if(pParams->Channel_6M_Trl_Done == FALSE)
{
if(pParams->Tuner == STTUNER_TUNER_DTT7592)
{
Rtrl_ctl=STTUNER_IOREG_GetRegister(DeviceMap,IOHandle,R_TRL_CTL);
trl_ctl[0]=(Rtrl_ctl & 0x7f) | (0x00<<7);
trl_ctl[1]=0xfe;
trl_ctl[2]=0x40;
}
else
{
Rtrl_ctl=STTUNER_IOREG_GetRegister(DeviceMap,IOHandle,R_TRL_CTL);
trl_ctl[0]=(Rtrl_ctl & 0x7f) | (M6_F_TRL_NOMRATE0<<7);
trl_ctl[1]=M6_F_TRL_NOMRATE8_1;
trl_ctl[2]=M6_F_TRL_NOMRATE16_9;
}
}/*** end of if(pParams->Channel_6M_Trl_Done == FALSE)**/
else
{
Rtrl_ctl=STTUNER_IOREG_GetRegister(DeviceMap,IOHandle,R_TRL_CTL);
trl_ctl[0]=(Rtrl_ctl & 0x7f) | (pParams->Channel_6M_Trl[0]<<7);
trl_ctl[1]=pParams->Channel_6M_Trl[1];
trl_ctl[2]=pParams->Channel_6M_Trl[2];
}/*** end of ELSE of if(pParams->Channel_6M_Trl_Done == FALSE)**/
STTUNER_IOREG_SetContigousRegisters(DeviceMap,IOHandle,R_TRL_CTL,trl_ctl,3);
}
}
else if ((pParams->ChannelBW == STTUNER_CHAN_BW_7M))
{
Rgain_src=STTUNER_IOREG_GetRegister(DeviceMap,IOHandle,R_GAIN_SRC1);
gain_src[0]=(Rgain_src & 0xf0) | M7_F_GAIN_SRC_HI;
gain_src[1]=M7_F_GAIN_SRC_LO;
STTUNER_IOREG_SetContigousRegisters(DeviceMap,IOHandle,R_GAIN_SRC1,gain_src,2);
if (Inst->TRL_IOCTL_Set_Flag==FALSE)
{
if(pParams->Channel_7M_Trl_Done == FALSE)
{
if(pParams->Tuner == STTUNER_TUNER_DTT7592)
{
Rtrl_ctl=STTUNER_IOREG_GetRegister(DeviceMap,IOHandle,R_TRL_CTL);
trl_ctl[0]=(Rtrl_ctl & 0x7f) | (0x00<<7);
trl_ctl[1]=0xd3;
trl_ctl[2]=0x4b;
}
else
{
Rtrl_ctl=STTUNER_IOREG_GetRegister(DeviceMap,IOHandle,R_TRL_CTL);
trl_ctl[0]=(Rtrl_ctl & 0x7f) | (M7_F_TRL_NOMRATE0<<7);
trl_ctl[1]=M7_F_TRL_NOMRATE8_1;
trl_ctl[2]=M7_F_TRL_NOMRATE16_9;
}
}/*** end of if(pParams->Channel_7M_Trl_Done == FALSE) **/
else
{
Rtrl_ctl=STTUNER_IOREG_GetRegister(DeviceMap,IOHandle,R_TRL_CTL);
trl_ctl[0]=(Rtrl_ctl & 0x7f) | (pParams->Channel_7M_Trl[0]<<7);
trl_ctl[1]=pParams->Channel_7M_Trl[1];
trl_ctl[2]=pParams->Channel_7M_Trl[2];
}/*** end of ELSE if(pParams->Channel_7M_Trl_Done == FALSE) **/
STTUNER_IOREG_SetContigousRegisters(DeviceMap,IOHandle,R_TRL_CTL,trl_ctl,3);
}
}
else /* Channel Bandwidth = 8M) */
{
Rgain_src=STTUNER_IOREG_GetRegister(DeviceMap,IOHandle,R_GAIN_SRC1);
gain_src[0]=(Rgain_src & 0xf0) | M8_F_GAIN_SRC_HI;
gain_src[1]=M8_F_GAIN_SRC_LO;
STTUNER_IOREG_SetContigousRegisters(DeviceMap,IOHandle,R_GAIN_SRC1,gain_src,2);
if (Inst->TRL_IOCTL_Set_Flag==FALSE)
{
if(pParams->Channel_8M_Trl_Done == FALSE)
{
if(pParams->Tuner == STTUNER_TUNER_DTT7592)
{
Rtrl_ctl=STTUNER_IOREG_GetRegister(DeviceMap,IOHandle,R_TRL_CTL);
trl_ctl[0]=(Rtrl_ctl & 0x7f) | (0x00<<7);
trl_ctl[1]=0xa8;
trl_ctl[2]=0x56;
}
else
{
Rtrl_ctl=STTUNER_IOREG_GetRegister(DeviceMap,IOHandle,R_TRL_CTL);
trl_ctl[0]=(Rtrl_ctl & 0x7f) | (M8_F_TRL_NOMRATE0<<7);
trl_ctl[1]=M8_F_TRL_NOMRATE8_1;
trl_ctl[2]=M8_F_TRL_NOMRATE16_9;
}
}/*** end of if(pParams->Channel_8M_Trl_Done == FALSE) **/
else
{
Rtrl_ctl=STTUNER_IOREG_GetRegister(DeviceMap,IOHandle,R_TRL_CTL);
trl_ctl[0]=(Rtrl_ctl & 0x7f) | (pParams->Channel_8M_Trl[0]<<7);
trl_ctl[1]=pParams->Channel_8M_Trl[1];
trl_ctl[2]=pParams->Channel_8M_Trl[2];
}/*** end of ELSE of if(pParams->Channel_8M_Trl_Done == FALSE) **/
STTUNER_IOREG_SetContigousRegisters(DeviceMap,IOHandle,R_TRL_CTL,trl_ctl,3);
}
}
#endif
STTUNER_IOREG_SetField(DeviceMap,IOHandle,LONG_ECHO,pParams->EchoPos);
/* dcdc */
#ifdef HOST_PC
repeator = TunerGetRepeator();
TunerSetRepeator(1);
#endif
/*FE_360_TunerSet(TunerInstance->DrvHandle,&pParams->Frequency,(STTUNER_TunerType_t)pParams->Tuner); */
/** error checking is done here for the fix of the bug GNBvd20315 **/
error=FE_360_TunerSet(TunerInstance->DrvHandle,pParams);
if(error != FE_NO_ERROR )
{
return error;
}
/*TunerSetRepeator(0);*/
/* dcdc */
STTUNER_IOREG_SetField(DeviceMap,IOHandle,VTH0,0x1E);
STTUNER_IOREG_SetField(DeviceMap,IOHandle,VTH1,0x14);
STTUNER_IOREG_SetField(DeviceMap,IOHandle,VTH2,0xF);
STTUNER_IOREG_SetField(DeviceMap,IOHandle,VTH3,0x9);
STTUNER_IOREG_SetField(DeviceMap,IOHandle,VTH4,0x0);
STTUNER_IOREG_SetField(DeviceMap,IOHandle,VTH5,0x5);
STTUNER_IOREG_SetRegister(DeviceMap,IOHandle,R_PR,0xAF);
STTUNER_IOREG_SetRegister(DeviceMap,IOHandle,R_VSEARCH,0x30);
STTUNER_IOREG_SetField(DeviceMap,IOHandle,FORCE,(pParams->Force & 1) );
STTUNER_IOREG_SetField(DeviceMap,IOHandle,FRAPTCR,1);
/****/
STTUNER_IOREG_SetField(DeviceMap,IOHandle,BDI_LPSEL,0x00);
SystemWaitFor(200);
/***/
if (pParams->Inv == STTUNER_INVERSION_NONE)
STTUNER_IOREG_SetField(DeviceMap,IOHandle,INV_SPECTR,1);
else if (pParams->Inv == STTUNER_INVERSION)
STTUNER_IOREG_SetField(DeviceMap,IOHandle,INV_SPECTR,0);
else if (pParams->Inv == STTUNER_INVERSION_AUTO)
{
if (pParams->Sense==1) STTUNER_IOREG_SetField(DeviceMap,IOHandle,INV_SPECTR,0);
else STTUNER_IOREG_SetField(DeviceMap,IOHandle,INV_SPECTR,1);
}
else if ( (pParams->Inv == STTUNER_INVERSION_UNK) && (!pParams->first_lock))
{
if (pParams->Sense==1) STTUNER_IOREG_SetField(DeviceMap,IOHandle,INV_SPECTR,0);
else STTUNER_IOREG_SetField(DeviceMap,IOHandle,INV_SPECTR,1);
}
if ((pParams->Frequency == 0) || (pParams->Tuner == STTUNER_TUNER_NONE))
{
error = FE_MISSING_PARAMETER;
}
else
{
pParams->State = FE_360_SearchRun(DeviceMap, IOHandle,pParams,TunerInstance);
FE_360_SearchTerm(DeviceMap, IOHandle,pParams,pResult);
}
/** end of first else **/
return error;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -