⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tmhpidemod_hpi.c

📁 卫星接收机器卫星 自动搜索, 包括优化处理
💻 C
📖 第 1 页 / 共 5 页
字号:
    	    if ( 
    		    ( HwCfgModified_F == True ) 
    		    &&
    		    ( pDemodCtx->DriverConfig_S.Specific.uDrvCfg.Ter.Standard != TMDL_FE_CFG_STD_TER )
    	       )
    		pDemodCapability_S->Specific.Ter.Standard = pDemodCtx->DriverConfig_S.Specific.uDrvCfg.Ter.Standard;
    	    else
    		pDemodCapability_S->Specific.Ter.Standard = TMDL_FE_CFG_STD_TER;

            break;

        case HPIv2_eDemodSatellite:
            // FA update
            pDemodCapability_S->TunerMinFrequency     = TMDL_FE_CFG_FREQ_TUNER_MIN_SAT;
            pDemodCapability_S->TunerMaxFrequency     = TMDL_FE_CFG_FREQ_TUNER_MAX_SAT;
            pDemodCapability_S->MinFSymb_BW           = TMDL_FE_CFG_FS_BW_MIN_SAT;
            pDemodCapability_S->MaxFSymb_BW           = TMDL_FE_CFG_FS_BW_MAX_SAT;
            pDemodCapability_S->NbOfConst             = TMDL_FE_CFG_NBOFCONST_SAT;
            pDemodCapability_S->Const[0]              = HPIv2_eDemodConstellationAuto;
            pDemodCapability_S->Const[1]              = HPIv2_eDemodConstellationQpsk;
            pDemodCapability_S->Const[2]              = HPIv2_eDemodConstellationBpsk;
        
            break;
            
        case HPIv2_eDemodCable:
            // FA update
            pDemodCapability_S->TunerMinFrequency     = TMDL_FE_CFG_FREQ_TUNER_MIN_CAB;
            pDemodCapability_S->TunerMaxFrequency     = TMDL_FE_CFG_FREQ_TUNER_MAX_CAB;
            pDemodCapability_S->MinFSymb_BW           = TMDL_FE_CFG_FS_BW_MIN_CAB;
            pDemodCapability_S->MaxFSymb_BW           = TMDL_FE_CFG_FS_BW_MAX_CAB;
            pDemodCapability_S->NbOfConst             = TMDL_FE_CFG_NBOFCONST_CAB;
            pDemodCapability_S->Const[0]              = HPIv2_eDemodConstellationAuto;
            pDemodCapability_S->Const[1]              = HPIv2_eDemodConstellationQam16;
            pDemodCapability_S->Const[2]              = HPIv2_eDemodConstellationQam32;
            pDemodCapability_S->Const[3]              = HPIv2_eDemodConstellationQam64;
            pDemodCapability_S->Const[4]              = HPIv2_eDemodConstellationQam128;
            pDemodCapability_S->Const[5]              = HPIv2_eDemodConstellationQam256;
        
            break;
            
    }

    // release the mutex
    ErrorCode = tmosalMutexExit(pDemodCtx->DemodMutex_H);
    DV_DBG_ASSERT(ErrorCode == TM_OK);
    
	return (HPIv2_eDEMOD_OK);
}


//-----------------------------------------------------------------------------
// FUNCTION     : HPIv2_DemodGetStatus
//
// DESCRIPTION  : This function returns the value of  the bits selected in the 
//                input mask (bits set to 1). If dout is null, nothing is done.
//
// RETURN       : HPIv2_tDEMOD_REPORT
//
// NOTES        : reentrant
//-----------------------------------------------------------------------------
HPIv2_tDEMOD_REPORT HPIv2_DemodGetStatus(
                                                HPIv2_uiDemodInstance	    DemodInstance_U,
                                                HPIv2_uiDemodStatusMask     StatusMask,
                                                HPIv2_tDemodStatus*         pDemodStatus
                                           )
{
    tmErrorCode_t           ErrorCode;
    Int32                   timeOut_L = 1000;
	tmhpiDemodCtx_t*        pDemodCtx = (tmhpiDemodCtx_t*)DemodInstance_U;
    
    // 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;

    // call front-end function
    ErrorCode = tmdlFeGetStatus( pDemodCtx->dlFeInstance_U, StatusMask, (tmdlFeStatus_t*)pDemodStatus );
    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;
    }

    if (pDemodCtx->DemodType_E == HPIv2_eDemodSatellite)
    {
        // RF Frequency calculation in KHz regarding current band type
        switch (pDemodCtx->DriverConfig_S.Specific.uDrvCfg.Sat.OlBand.BandType)
        {           
            case HPIv2_eDemodSatDualBandKU:
                if ( pDemodStatus->Specific.Sat.Tone == 0 )
                    pDemodStatus->Frequency = pDemodStatus->Frequency/1000 + pDemodCtx->DriverConfig_S.Specific.uDrvCfg.Sat.OlBand.Lo[TMHPI_DEMOD_LO_LOW];
                else
                    pDemodStatus->Frequency = pDemodStatus->Frequency/1000 + pDemodCtx->DriverConfig_S.Specific.uDrvCfg.Sat.OlBand.Lo[TMHPI_DEMOD_LO_HIGH];

                break;
            
            case HPIv2_eDemodSatMonoBandKU:
                    pDemodStatus->Frequency = pDemodStatus->Frequency/1000 + pDemodCtx->DriverConfig_S.Specific.uDrvCfg.Sat.OlBand.Lo[TMHPI_DEMOD_LO_LOW];
                break;
                
            case HPIv2_eDemodSatBandC:
                    pDemodStatus->Frequency = pDemodStatus->Frequency/1000;
		    pDemodStatus->Frequency = pDemodCtx->DriverConfig_S.Specific.uDrvCfg.Sat.OlBand.Lo[TMHPI_DEMOD_LO_LOW]- pDemodStatus->Frequency;
					
		    //Inverse Purcentage of scan progress
		    //pDemodStatus->ScanProgress = 100 - pDemodStatus->ScanProgress;

                break;
         }
    }



    // release the mutex
    ErrorCode = tmosalMutexExit(pDemodCtx->DemodMutex_H);
    DV_DBG_ASSERT(ErrorCode == TM_OK);
    
    return HPIv2_eDEMOD_OK;
}


//-----------------------------------------------------------------------------
// FUNCTION     : HPIv2_DemodSetLowPowerMode
//
// DESCRIPTION  : This function is used to set or unset the hardware in low 
//                power mode.
//
// RETURN       : HPIv2_tDEMOD_REPORT
//
// NOTES        : reentrant
//-----------------------------------------------------------------------------
HPIv2_tDEMOD_REPORT HPIv2_DemodSetLowPowerMode(
                                                     HPIv2_uiDemodInstance	DemodInstance_U,
                                                     HPIv2_BOOL	  		PowerMode
                                                 )
{
    HPIv2_tDEMOD_REPORT retVal_E = HPIv2_eDEMOD_OK;
    tmErrorCode_t       ErrorCode;
    Int32               timeOut_L = 1000;
	tmhpiDemodCtx_t*    pDemodCtx = (tmhpiDemodCtx_t*)DemodInstance_U;

    // 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)
    {
        retVal_E = HPIv2_eDEMOD_COMMAND_FAILED;
    }
    else  // Parameters control
    {        
        if (PowerMode != False && PowerMode != True)
            retVal_E = HPIv2_eDEMOD_BAD_PARAMETER;
    }
    
    if (retVal_E != HPIv2_eDEMOD_OK)
    {
        // release the mutex
        ErrorCode = tmosalMutexExit(pDemodCtx->DemodMutex_H);
        DV_DBG_ASSERT(ErrorCode == TM_OK);
        return retVal_E;
    }

    // call front-end function
    ErrorCode = tmdlFeSetLowPowerMode( pDemodCtx->dlFeInstance_U, PowerMode );
    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;
}

HPIv2_tDEMOD_REPORT HPIv2_DemodSetModulatorParam(
                                                     HPIv2_uiDemodInstance   DemodInstance_U,
                                                     HPIv2_UINT32            frequency,
						     HPIv2_eDemodVideoMode_t mode
                                                 )
{
    tmErrorCode_t ErrorCode;
    tmhpiDemodCtx_t* pDemodCtx = (tmhpiDemodCtx_t*)DemodInstance_U;
    Int32 timeOut_L = 1000;
    tmdlFeVideoMode_t tmdlFeMode;

    // 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);


    HPIv2_eDemodConvertVideoMode(mode,
				 &tmdlFeMode
	);
    // call front-end function
    ErrorCode = tmdlFeSetModulatorParam( pDemodCtx->dlFeInstance_U,
					 frequency,
					 tmdlFeMode
	);
	
    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_DemodSetModulator
//
// DESCRIPTION  : This function is used to set the channel of the modulator
//
// RETURN       : HPIv2_tDEMOD_REPORT
//
// NOTES        : reentrant
//-----------------------------------------------------------------------------
HPIv2_tDEMOD_REPORT HPIv2_DemodSetModulator(
                                                     HPIv2_uiDemodInstance  DemodInstance_U,
                                                     HPIv2_UINT32           Channel
                                                 )
{
    tmErrorCode_t ErrorCode;
	tmhpiDemodCtx_t* pDemodCtx = (tmhpiDemodCtx_t*)DemodInstance_U;
    Int32 timeOut_L = 1000;

    // 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);

    // call front-end function
    ErrorCode = tmdlFeSetModulator( pDemodCtx->dlFeInstance_U, Channel );
    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_DemodSetDriverConfig
//
// DESCRIPTION  : This function sets and saves the structure (configuration) 
//                passed as input.
//
// RETURN       : HPIv2_tDEMOD_REPORT
//
// NOTES        : reentrant
//-----------------------------------------------------------------------------
HPIv2_tDEMOD_REPORT HPIv2_DemodSetDriverConfig(
                                                    HPIv2_uiDemodInstance	DemodInstance_U,
                                                    HPIv2_tDemodDriverConfig* 	pDriverCfg_S 
                                                 )
{
    HPIv2_tDEMOD_REPORT retVal_E = HPIv2_eDEMOD_OK;
    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)
    {
        retVal_E = HPIv2_eDEMOD_COMMAND_FAILED;
    }
    else  // Parameters control
    {        
        if (pDriverCfg_S->Specific.HwConfig.DemodType < HPIv2_eDemodSatellite

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -