📄 tmhpidemod_hpi.c
字号:
||
pDriverCfg_S->Specific.HwConfig.DemodType > HPIv2_eDemodTerrestrial)
retVal_E = HPIv2_eDEMOD_BAD_PARAMETER;
}
// FA on the 31th of March
// Check the parameters before doing the configuration of the Demodulator Device Library
if( pDriverCfg_S->Specific.HwConfig.DemodType == HPIv2_eDemodSatellite )
{
if (pDriverCfg_S->Specific.uCfgType.Sat == HPIv2_eDemodSatCfgLnbDef)
{
// Check that the LnbPower parameter is in the supported range
if( pDriverCfg_S->Specific.uDrvCfg.Sat.LnbDefinition.Power < HPIv2_eDemodSatInternalSupply
|| pDriverCfg_S->Specific.uDrvCfg.Sat.LnbDefinition.Power >= HPIv2_eDemodSatPowerMax )
{
retVal_E = HPIv2_eDEMOD_BAD_PARAMETER;
}
// Check that the Switch frequency value. It shall be higher than 0.
if( pDriverCfg_S->Specific.uDrvCfg.Sat.LnbDefinition.SwitchFrequency <= 0 )
{
retVal_E = HPIv2_eDEMOD_BAD_PARAMETER;
}
// Check that the vertical and the horizontal voltages are not the same
if( pDriverCfg_S->Specific.uDrvCfg.Sat.LnbDefinition.vertical
== pDriverCfg_S->Specific.uDrvCfg.Sat.LnbDefinition.horizontal )
{
retVal_E = HPIv2_eDEMOD_BAD_PARAMETER;
}
// Check that the vertical voltage is in the supported range
if( pDriverCfg_S->Specific.uDrvCfg.Sat.LnbDefinition.vertical < HPIv2_eDemodSat14V
|| pDriverCfg_S->Specific.uDrvCfg.Sat.LnbDefinition.vertical > HPIv2_eDemodSat18V )
{
retVal_E = HPIv2_eDEMOD_BAD_PARAMETER;
}
// Check that the horizontal voltage is in the supported range
if( pDriverCfg_S->Specific.uDrvCfg.Sat.LnbDefinition.horizontal < HPIv2_eDemodSat14V
|| pDriverCfg_S->Specific.uDrvCfg.Sat.LnbDefinition.horizontal > HPIv2_eDemodSat18V )
{
retVal_E = HPIv2_eDEMOD_BAD_PARAMETER;
}
}
if (pDriverCfg_S->Specific.uCfgType.Sat == HPIv2_eDemodSatCfgOlBand)
{
if( pDriverCfg_S->Specific.uDrvCfg.Sat.OlBand.BandType < HPIv2_eDemodSatBandC
|| pDriverCfg_S->Specific.uDrvCfg.Sat.OlBand.BandType > HPIv2_eDemodSatDualBandKU)
{
retVal_E = HPIv2_eDEMOD_BAD_PARAMETER;
}
else
{
if ( ( pDriverCfg_S->Specific.uDrvCfg.Sat.OlBand.BandType == HPIv2_eDemodSatBandC )
&& ( pDriverCfg_S->Specific.uDrvCfg.Sat.OlBand.Lo[TMHPI_DEMOD_LO_LOW] < (TMHPI_DEMOD_BAND_BIS_FREQ_MIN + TMHPI_DEMOD_BAND_C_FREQ_MAX)
|| pDriverCfg_S->Specific.uDrvCfg.Sat.OlBand.Lo[TMHPI_DEMOD_LO_LOW] > (TMHPI_DEMOD_BAND_BIS_FREQ_MAX + TMHPI_DEMOD_BAND_C_FREQ_MIN) ))
{
retVal_E = HPIv2_eDEMOD_BAD_PARAMETER;
}
else
{
if ( ( pDriverCfg_S->Specific.uDrvCfg.Sat.OlBand.BandType == HPIv2_eDemodSatMonoBandKU)
&& ( pDriverCfg_S->Specific.uDrvCfg.Sat.OlBand.Lo[TMHPI_DEMOD_LO_LOW] < (TMHPI_DEMOD_BAND_KU_FREQ_MIN - TMHPI_DEMOD_BAND_BIS_FREQ_MAX)
|| pDriverCfg_S->Specific.uDrvCfg.Sat.OlBand.Lo[TMHPI_DEMOD_LO_LOW] > (TMHPI_DEMOD_BAND_KU_FREQ_MAX - TMHPI_DEMOD_BAND_BIS_FREQ_MIN )))
{
retVal_E = HPIv2_eDEMOD_BAD_PARAMETER;
}
else
{
if ( ( pDriverCfg_S->Specific.uDrvCfg.Sat.OlBand.BandType == HPIv2_eDemodSatDualBandKU)
&& ( pDriverCfg_S->Specific.uDrvCfg.Sat.OlBand.Lo[TMHPI_DEMOD_LO_LOW] < ( TMHPI_DEMOD_BAND_KU_FREQ_MIN - TMHPI_DEMOD_BAND_BIS_FREQ_LOW_MAX )
|| pDriverCfg_S->Specific.uDrvCfg.Sat.OlBand.Lo[TMHPI_DEMOD_LO_LOW] > ( TMHPI_DEMOD_BAND_KU_FREQ_MID - TMHPI_DEMOD_BAND_BIS_FREQ_MIN )))
{
retVal_E = HPIv2_eDEMOD_BAD_PARAMETER;
}
else
{
if ( ( pDriverCfg_S->Specific.uDrvCfg.Sat.OlBand.BandType == HPIv2_eDemodSatDualBandKU)
&& ( pDriverCfg_S->Specific.uDrvCfg.Sat.OlBand.Lo[TMHPI_DEMOD_LO_HIGH] < (TMHPI_DEMOD_BAND_KU_FREQ_MID - TMHPI_DEMOD_BAND_BIS_FREQ_MAX)
|| pDriverCfg_S->Specific.uDrvCfg.Sat.OlBand.Lo[TMHPI_DEMOD_LO_HIGH] > (TMHPI_DEMOD_BAND_KU_FREQ_MAX - TMHPI_DEMOD_BAND_BIS_FREQ_HIGH_MIN ) ) )
{
retVal_E = HPIv2_eDEMOD_BAD_PARAMETER;
}
}
}
}
}
}
if (pDriverCfg_S->Specific.uCfgType.Sat == HPIv2_eDemodSatCfgSwitch)
{
if( pDriverCfg_S->Specific.uDrvCfg.Sat.Switch.SwitchType < HPIv2_eDemodSatSwitchToneBurst
|| pDriverCfg_S->Specific.uDrvCfg.Sat.Switch.SwitchType >= HPIv2_eDemodSatSwitchMax )
retVal_E = HPIv2_eDEMOD_BAD_PARAMETER;
}
}
///////////////////////////////////////////////////////////////////////////////////////
// ONE OF THE CONFIGURATION PARAMETERS IS NOT CORRECT FOR THE DEMODULATION //
///////////////////////////////////////////////////////////////////////////////////////
if (retVal_E != HPIv2_eDEMOD_OK)
{
// release the mutex
ErrorCode = tmosalMutexExit(pDemodCtx->DemodMutex_H);
DV_DBG_ASSERT(ErrorCode == TM_OK);
return retVal_E;
}
// for the HPIv2_DemodGetCapability function
pDemodCtx->DriverCfgCall_F = True;
// Structure used for the HPIv2_DemodGetCapability function
//memcpy(&pDemodCtx->DriverConfig_S, pDriverCfg_S, sizeof(HPIv2_tDemodDriverConfig));
//SR not implemented
// HPIv2_UCHAR NbSrBw;
// HPIv2_uiDemodSrBw* SrBw;
// Demod Type registration
pDemodCtx->DemodType_E = pDriverCfg_S->Specific.HwConfig.DemodType;
// XR, the 14.04.04
// set hardware config
if (((pDriverCfg_S->Specific.uCfgType.Sat == HPIv2_eDemodSatCfgHardware)
&& (pDemodCtx->DemodType_E == HPIv2_eDemodSatellite))||
((pDriverCfg_S->Specific.uCfgType.Cbl == HPIv2_eDemodCblCfgHardware)
&& (pDemodCtx->DemodType_E == HPIv2_eDemodCable))||
((pDriverCfg_S->Specific.uCfgType.Sat == HPIv2_eDemodTerCfgHardware)
&& (pDemodCtx->DemodType_E == HPIv2_eDemodTerrestrial)))
{
FrontEndSetUp_S.HwCfg_S.FeType_E = pDriverCfg_S->Specific.HwConfig.DemodType;
FrontEndSetUp_S.HwCfg_S.DemodName_U = pDriverCfg_S->Specific.HwConfig.DemodName;
FrontEndSetUp_S.HwCfg_S.TunerName_U = pDriverCfg_S->Specific.HwConfig.TunerName;
FrontEndSetUp_S.HwCfg_S.DemodI2CAdd_BY = pDriverCfg_S->Specific.HwConfig.DemodI2CAdd;
FrontEndSetUp_S.HwCfg_S.TunerI2CAdd_BY = pDriverCfg_S->Specific.HwConfig.TunerI2CAdd;
FrontEndSetUp_S.HwCfg_S.I2CUnit_BY = pDriverCfg_S->Specific.HwConfig.I2CUnit;
FrontEndSetUp_S.HwCfg_S.PioCtl = pDriverCfg_S->Specific.HwConfig.PioCtl;
if ( (FrontEndSetUp_S.HwCfg_S.DemodName_U == 10021) &&
(FrontEndSetUp_S.HwCfg_S.TunerName_U == 8271) )
{
FrontEndSetUp_S.HwCfg_S.BoardType_U = TMDL_FE_CFG_CAB_BOARD_CFG;
}
else if ( (FrontEndSetUp_S.HwCfg_S.DemodName_U == 10021) &&
(FrontEndSetUp_S.HwCfg_S.TunerName_U == 1316) )
{
FrontEndSetUp_S.HwCfg_S.BoardType_U = TMDL_FE_CFG_CAB_BOARD_CFG_5755;
}
else if ( (FrontEndSetUp_S.HwCfg_S.DemodName_U == 10046) &&
(FrontEndSetUp_S.HwCfg_S.TunerName_U == 1316 ) )
{
FrontEndSetUp_S.HwCfg_S.BoardType_U = TMDL_FE_CFG_TER_BOARD_CFG;
}
else if ( (FrontEndSetUp_S.HwCfg_S.DemodName_U == 10046) &&
(FrontEndSetUp_S.HwCfg_S.TunerName_U == 8274 ) )
{
FrontEndSetUp_S.HwCfg_S.BoardType_U = TMDL_FE_CFG_TER_SI_TUNER_BOARD_CFG;
}
else if ( (FrontEndSetUp_S.HwCfg_S.DemodName_U == 10086) &&
(FrontEndSetUp_S.HwCfg_S.TunerName_U == 8262 ) )
{
FrontEndSetUp_S.HwCfg_S.BoardType_U = TMDL_FE_CFG_SAT_BOARD_CFG;
}
else if ( (FrontEndSetUp_S.HwCfg_S.DemodName_U == 10086) &&
(FrontEndSetUp_S.HwCfg_S.TunerName_U == 8260 ) )
{
FrontEndSetUp_S.HwCfg_S.BoardType_U = TMDL_FE_CFG_SAT_BOARD_CFG_52;
}
else
{
FrontEndSetUp_S.HwCfg_S.BoardType_U = 0;
}
// apply the config
ErrorCode= tmdlFeSetInstanceSetup(pDemodCtx->dlFeInstance_U, &FrontEndSetUp_S);
DV_DBG_ASSERT(ErrorCode == TM_OK);
if (ErrorCode != TM_OK)
{
// release the mutex
ErrorCode = tmosalMutexExit(pDemodCtx->DemodMutex_H);
DV_DBG_ASSERT(ErrorCode == TM_OK);
return HPIv2_eDEMOD_COMMAND_FAILED;
}
}
// XR, the 14.04.04
// Configure the LNB & local Oscillator
if (pDemodCtx->DemodType_E == HPIv2_eDemodSatellite)
{
switch (pDriverCfg_S->Specific.uCfgType.Sat)
{
case HPIv2_eDemodSatCfgLnbDef:
pDemodCtx->DriverConfig_S.Specific.uDrvCfg.Sat.LnbDefinition.Power = pDriverCfg_S->Specific.uDrvCfg.Sat.LnbDefinition.Power;
pDemodCtx->DriverConfig_S.Specific.uDrvCfg.Sat.LnbDefinition.SwitchFrequency = pDriverCfg_S->Specific.uDrvCfg.Sat.LnbDefinition.SwitchFrequency;
pDemodCtx->DriverConfig_S.Specific.uDrvCfg.Sat.LnbDefinition.vertical = pDriverCfg_S->Specific.uDrvCfg.Sat.LnbDefinition.vertical;
pDemodCtx->DriverConfig_S.Specific.uDrvCfg.Sat.LnbDefinition.horizontal = pDriverCfg_S->Specific.uDrvCfg.Sat.LnbDefinition.horizontal;
Config_S.Sat_S.ConfigType = tmdlFeSatInit;
Config_S.Sat_S.LnbPower_E = pDriverCfg_S->Specific.uDrvCfg.Sat.LnbDefinition.Power;
break;
case HPIv2_eDemodSatCfgOlBand:
pDemodCtx->DriverConfig_S.Specific.uDrvCfg.Sat.OlBand.Lo[0] = pDriverCfg_S->Specific.uDrvCfg.Sat.OlBand.Lo[0];
pDemodCtx->DriverConfig_S.Specific.uDrvCfg.Sat.OlBand.Lo[1] = pDriverCfg_S->Specific.uDrvCfg.Sat.OlBand.Lo[1];
pDemodCtx->DriverConfig_S.Specific.uDrvCfg.Sat.OlBand.BandType = pDriverCfg_S->Specific.uDrvCfg.Sat.OlBand.BandType;
break;
case HPIv2_eDemodSatCfgSwitch:
// In case SwitchType == HPIv2_eDemodSatSwitchManual NO toneBurst is allowed
if(pDriverCfg_S->Specific.uDrvCfg.Sat.Switch.SwitchType == HPIv2_eDemodSatSwitchManual)
{
Config_S.Sat_S.ConfigType = tmdlFeSatSwitchManual;
pDemodCtx->DriverConfig_S.Specific.uDrvCfg.Sat.Switch.SwitchType = HPIv2_eDemodSatSwitchManual;
Config_S.Sat_S.Manual22KHz_E = pDriverCfg_S->Specific.uDrvCfg.Sat.Switch.Manual22KHzValue;
}
else
{
Config_S.Sat_S.ConfigType = tmdlFeSatToneBurst;
Config_S.Sat_S.ToneBurst_S = pDriverCfg_S->Specific.uDrvCfg.Sat.Switch.uSw.ToneBurst;
}
break;
case HPIv2_eDemodSatCfgDiSEqCOther:
Config_S.Sat_S.ConfigType = tmdlFeSatDiseqc;
Config_S.Sat_S.DiSEqC_S.NbByte_C = pDriverCfg_S->Specific.uDrvCfg.Sat.DiSEqCOther.NbByte_C;
Config_S.Sat_S.DiSEqC_S.Frame_S.Frm = pDriverCfg_S->Specific.uDrvCfg.Sat.DiSEqCOther.Frame_S.Frm;
Config_S.Sat_S.DiSEqC_S.Frame_S.Add = pDriverCfg_S->Specific.uDrvCfg.Sat.DiSEqCOther.Frame_S.Add;
Config_S.Sat_S.DiSEqC_S.Frame_S.Cmd = pDriverCfg_S->Specific.uDrvCfg.Sat.DiSEqCOther.Frame_S.Cmd;
Config_S.Sat_S.DiSEqC_S.Frame_S.Data0 = pDriverCfg_S->Specific.uDrvCfg.Sat.DiSEqCOther.Frame_S.Data0;
Config_S.Sat_S.DiSEqC_S.Frame_S.Data1 = pDriverCfg_S->Specific.uDrvCfg.Sat.DiSEqCOther.Frame_S.Data1;
Config_S.Sat_S.DiSEqC_S.Frame_S.Data2 = pDriverCfg_S->Specific.uDrvCfg.Sat.DiSEqCOther.Frame_S.Data2;
break;
}
if (pDriverCfg_S->Specific.uCfgType.Sat == HPIv2_eDemodSatCfgLnbDef
|| pDriverCfg_S->Specific.uCfgType.Sat == HPIv2_eDemodSatCfgSwitch
|| pDriverCfg_S->Specific.uCfgType.Sat == HPIv2_eDemodSatCfgPositioner
|| pDriverCfg_S->Specific.uCfgType.Sat == HPIv2_eDemodSatCfgDiSEqCOther)
{
ErrorCode= tmdlFeSetConfig(pDemodCtx->dlFeInstance_U, &Config_S);
DV_DBG_ASSERT(ErrorCode == TM_OK);
if (ErrorCode != TM_OK)
{
// release the mutex
ErrorCode = tmosalMutexExit(pDemodCtx->DemodMutex_H);
DV_DBG_ASSERT(ErrorCode == TM_OK);
return HPIv2_eDEMOD_COMMAND_FAILED;
}
}
}
// release the mutex
ErrorCode = tmosalMutexExit(pDemodCtx->DemodMutex_H);
DV_DBG_ASSERT(ErrorCode == TM_OK);
return (HPIv2_eDEMOD_OK);
}
//-----------------------------------------------------------------------------
// FUNCTION : HPIv2_DemodGetDriverConfig
//
// DESCRIPTION : This function gets the structure (configuration).
//
// RETURN : HPIv2_tDEMOD_REPORT
//
// NOTES : reentrant
//-----------------------------------------------------------------------------
HPIv2_tDEMOD_REPORT HPIv2_DemodGetDriverConfig(
HPIv2_uiDemodInstance DemodInstance_U,
HPIv2_tDemodDriverConfig* pDriverCfg_S
)
{
tmErrorCode_t ErrorCode;
Int32 timeOut_L = 1000;
tmhpiDemodCtx_t* pDemodCtx = (tmhpiDemodCtx_t*)DemodInstance_U;
tmdlFeInstanceSetup_t FrontEndSetUp_S;
// test if initialized
if ( DemodInstance_U != pDemodCtx->Instance_U )
return HPIv2_eDEMOD_NOT_INITIALIZED;
// take the mutex
ErrorCode = tmosalMutexEnter(pDemodCtx->DemodMutex_H, &timeOut_L);
DV_DBG_ASSERT(ErrorCode == TM_OK);
if (ErrorCode != TM_OK)
return HPIv2_eDEMOD_COMMAND_FAILED;
// get the devlib instance setup especially, the demodulator name
ErrorCode= tmdlFeGetInstanceSetup(pDemodCtx->dlFeInstance_U, &FrontEndSetUp_S);
DV_DBG_ASSERT(ErrorCode == TM_OK);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -