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

📄 tmhpidemod_hpi.c

📁 卫星接收机器卫星 自动搜索, 包括优化处理
💻 C
📖 第 1 页 / 共 5 页
字号:
//-----------------------------------------------------------------------------
// $Header: S:/SYSOL/SOURCE/SDE_RWE/comps/tmhpi/comps/tmhpiDemod/src/RCS/tmhpiDemod_Hpi.c,v 1.5 2003/07/03 14:18:15 frq03592 Exp $
// (C) Copyright 2000 Philips Semiconductors, All rights reserved
//
// This source code and any compilation or derivative thereof is the sole
// property of Philips Corporation and is provided pursuant to a Software
// License Agreement.  This code is the proprietary information of Philips
// Corporation and is confidential in nature.  Its use and dissemination by
// any party other than Philips Corporation is strictly limited by the
// confidential information provisions of the Agreement referenced above.
//-----------------------------------------------------------------------------
// FILE NAME:    tmHpiDemod_Hpi.c
//
// DESCRIPTION:  This file contains the private declaration of the Demod device 
//               library
//
// DOCUMENT REF: DVP Software Coding Guidelines Specification
//               SRS HPI Demod
//               SDD HPI Demod
//
// NOTES:
//
// HISTORY :
// (copy the lines below, before filling them)
//
//***********************
// Author       : Xavier RAZAVET
// Date         : 31.03.03
// Description  : first implementation
//
//
//-----------------------------------------------------------------------------
/*
  Date          Modified by CRPRNr  TASKNr  Maintenance description
  -------------|-----------|-------|-------|------------------------------------
  30-Jun-2004  | Lambert   |  1033 |  2857 | Create synchronisation between HPI Demod/Dmux 
*/

//-----------------------------------------------------------------------------
// Standard include files:
//-----------------------------------------------------------------------------
//
#include <tmtypes.h>
#include <tmosal.h>
#include <dv_dbg.h>			// Debug functionalities available with the DV_DEBUG option
#include <string.h>

//-----------------------------------------------------------------------------
// Project include files:
//-----------------------------------------------------------------------------
//
#include  "tmhpiCommonTypes_Int.h"


#ifdef DV_DEBUG
#include "tmdlFeDbg.h"      // print msg
#endif

#include  "tmdlFe.h"
#include  "tmhpiDemod_Hpi.h"                
#include  "tmhpiDemod_Local.h"    
#include "tmhpiDemod_StreamingApi.h"       

//-----------------------------------------------------------------------------
// Types and defines:
//-----------------------------------------------------------------------------
//

void
HPIv2_eDemodConvertVideoMode(
    HPIv2_eDemodVideoMode_t mode,
    tmdlFeVideoMode_t *ptmdlFeMode
    
    );


//-----------------------------------------------------------------------------
// Internal Prototypes:
//-----------------------------------------------------------------------------
HPIv2_tDemodTerCapability   TerCapabilityDVB_S = 
{
    {
        HPIv2_eDemodTerDVB
    },
    {
        HPIv2_eDemodTerHierarchyNonHierarchy, 	    /* DVB non hierarchical */
        HPIv2_eDemodTerHierarchyAlpha1, 		    /* DVB alpha = 1 	    */
        HPIv2_eDemodTerHierarchyAlpha2, 		    /* DVB alpha = 2 	    */
        HPIv2_eDemodTerHierarchyAlpha4, 		    /* DVB alpha = 4 	    */
        HPIv2_eDemodTerHierarchyAutoDetect   	    /* automatic choice	    */
    },
    {
        HPIv2_eDemodTerRate12, 		                /* DVB 			        */
        HPIv2_eDemodTerRate23, 		                /* DVB  /  ATSC		    */
        HPIv2_eDemodTerRate34, 		                /* DVB	 		        */
        HPIv2_eDemodTerRate56, 		                /* DVB 			        */
        HPIv2_eDemodTerRate78, 		                /* DVB 			        */
        HPIv2_eDemodTerRateAutoDetect	            /* automatic choice 	*/
    },
    {
        HPIv2_eDemodTerGuardInterval32, 		    /* DVB guard interval 1/32 	*/
        HPIv2_eDemodTerGuardInterval16, 		    /* DVB guard interval 1/16 	*/
        HPIv2_eDemodTerGuardInterval8, 		        /* DVB guard interval 1/8 	*/
        HPIv2_eDemodTerGuardInterval4, 		        /* DVB guard interval 1/4 	*/
        HPIv2_eDemodTerGuardIntervalAutoDetect	    /* automatic choice	 	    */
    },
    {
        HPIv2_eDemodTerTransmissionMode2K, 		    /* DVB 2K mode */
        HPIv2_eDemodTerTransmissionMode8K, 		    /* DVB 8K mode */
        HPIv2_eDemodTerTransmissionModeAutoDetect 	/* DVB automatic choice*/
    },
    {
        HPIv2_eDemodTerPriorityHigh, 	            /* DVB Output high priority stream */
        HPIv2_eDemodTerPriorityLow		            /* DVB Output low priority stream */
    }
};

HPIv2_tDemodTerCapability   TerCapabilityVSB_S = 
{
    {
        HPIv2_eDemodTerATSC
    },
    {
        0,
        0,
        0,
        0,
        0 
    },
    {
        HPIv2_eDemodTerRate23, 		                /* DVB  /  ATSC		    */
        0,
        0,
        0,
        0 
    },
    {
        0,
        0,
        0,
        0,
        0 
    },
    {
        0,
        0,
        0 
    },
    {
        0,
        0 
    }
};



//-----------------------------------------------------------------------------
// Global variable
//-----------------------------------------------------------------------------

tmhpiDemodCtx_t	             DemodContext ; /* context */
tmdlFeConfig_t               Config_S;
Bool						 bChangeBand = False;
Bool						 AutoScan = False;

extern  tmhpiDemod_ScbDefinition_t  gtmhpiDemodStrCb;

HPIv2_tDemodSearchConfig        gSearchCfg_S;
HPIv2_tDemodSearchConfig        *pgSearchCfg_S = &gSearchCfg_S;

HPIv2_tDemodSearchConfig        gSearchCfgAutoscan_S;
HPIv2_tDemodSearchConfig        *pgSearchCfgAutoscan_S = &gSearchCfgAutoscan_S;

//-----------------------------------------------------------------------------
// FUNCTION     : tmGetSatelliteBISFrequency
//
// DESCRIPTION  : This function returns the satellite frequency in the BIS range to set
//                the demodulator.
//
// RETURN       : Error code.
//
// NOTES        : 
//-----------------------------------------------------------------------------
static  HPIv2_tDEMOD_REPORT tmGetSatelliteBISFrequency( UInt32 uFrequency, HPIv2_eDemodSatTone *pTone, UInt32 *pBisFrequency, tmhpiDemodCtx_t *pDemodCtx)
{
    UInt32 uiBandKuFreqMid, uiLFreqLowMax, uiLFreqHighMin, uiLFreqCurrent=0;
    HPIv2_tDEMOD_REPORT retVal_E = HPIv2_eDEMOD_OK;
    HPIv2_eDemodSatTone Tone = HPIv2_eDemodToneOff;


    // BIS Frequency calculation in Hz regarding current band type
    switch (pDemodCtx->DriverConfig_S.Specific.uDrvCfg.Sat.OlBand.BandType)
    {           
        case HPIv2_eDemodSatDualBandKU:
            // Current Frequency which separate the Low/High Band KU.
            uiBandKuFreqMid  = pDemodCtx->DriverConfig_S.Specific.uDrvCfg.Sat.OlBand.Lo[TMHPI_DEMOD_LO_LOW];
            uiBandKuFreqMid += pDemodCtx->DriverConfig_S.Specific.uDrvCfg.Sat.OlBand.Lo[TMHPI_DEMOD_LO_HIGH];
            uiBandKuFreqMid += TMHPI_DEMOD_BAND_L_FREQ_MIN + TMHPI_DEMOD_BAND_L_FREQ_MAX;       
            uiBandKuFreqMid /= 2;
 
            // BIS Low max Frequency <=> 1975MHz with universal LNB -> Low Band KU [950-1975]
            uiLFreqLowMax  = uiBandKuFreqMid;
            uiLFreqLowMax -= pDemodCtx->DriverConfig_S.Specific.uDrvCfg.Sat.OlBand.Lo[TMHPI_DEMOD_LO_LOW];
            uiLFreqLowMax *= 1000;    //Hz 
        
            // BIS High min Frequency <=> 1125MHz with universal LNB -> High Band KU [1125-2150]
            uiLFreqHighMin  = uiBandKuFreqMid;
            uiLFreqHighMin -= pDemodCtx->DriverConfig_S.Specific.uDrvCfg.Sat.OlBand.Lo[TMHPI_DEMOD_LO_HIGH];
            uiLFreqHighMin *= 1000;    //Hz 

            // test if the calculated frequency is in the BIS Band.
            if ( uFrequency > uiBandKuFreqMid )
            {
                uiLFreqCurrent = (uFrequency - pDemodCtx->DriverConfig_S.Specific.uDrvCfg.Sat.OlBand.Lo[TMHPI_DEMOD_LO_HIGH])*1000;
                Tone = HPIv2_eDemodToneOn;

                if (uiLFreqCurrent <  uiLFreqHighMin
                    || uiLFreqCurrent > TMDL_FE_CFG_FREQ_TUNER_MAX_SAT )
                {    
                    retVal_E = HPIv2_eDEMOD_BAD_PARAMETER;
                }
            }
            else
            {
                uiLFreqCurrent = ( uFrequency - pDemodCtx->DriverConfig_S.Specific.uDrvCfg.Sat.OlBand.Lo[TMHPI_DEMOD_LO_LOW])*1000;
                Tone = HPIv2_eDemodToneOff;
                
                if (uiLFreqCurrent <  TMDL_FE_CFG_FREQ_TUNER_MIN_SAT
                    || uiLFreqCurrent > uiLFreqLowMax )

                {   
                    retVal_E = HPIv2_eDEMOD_BAD_PARAMETER;           
                }
             }

            break;

        case HPIv2_eDemodSatMonoBandKU:
            uiLFreqCurrent = ( uFrequency - pDemodCtx->DriverConfig_S.Specific.uDrvCfg.Sat.OlBand.Lo[TMHPI_DEMOD_LO_LOW])*1000;
            Tone = HPIv2_eDemodToneOff;

            if (uiLFreqCurrent <  TMDL_FE_CFG_FREQ_TUNER_MIN_SAT
                || uiLFreqCurrent > TMDL_FE_CFG_FREQ_TUNER_MAX_SAT )
            {
                retVal_E = HPIv2_eDEMOD_BAD_PARAMETER;           
            }

            break;

        case HPIv2_eDemodSatBandC:
            uiLFreqCurrent = (pDemodCtx->DriverConfig_S.Specific.uDrvCfg.Sat.OlBand.Lo[TMHPI_DEMOD_LO_LOW] - uFrequency )*1000;
            Tone = HPIv2_eDemodToneOff;

            if (uiLFreqCurrent <  TMDL_FE_CFG_FREQ_TUNER_MIN_SAT
                || uiLFreqCurrent > TMDL_FE_CFG_FREQ_TUNER_MAX_SAT )
            {    
                retVal_E = HPIv2_eDEMOD_BAD_PARAMETER;           
            }

            break;
    }
    
    // Update the BIS frequency to be returned to the caller
    if( retVal_E == HPIv2_eDEMOD_OK )
    {
        *pBisFrequency = uiLFreqCurrent;
        *pTone = Tone;
    }

    return( retVal_E );
}



//-----------------------------------------------------------------------------
// FUNCTION     : tmDemodCallBackEventStatus
//
// DESCRIPTION  : This function report the events to the upper software layer.
//
// RETURN       : none.
//
// NOTES        : 
//-----------------------------------------------------------------------------
static void tmDemodCallBackEventStatus(UInt32 events, Void* pData, UInt32 userData)
{
	tmhpiDemodCtx_t*       pDemodCtx;
        tmErrorCode_t     ErrorCode;
     
    // for compilation issue
    if (userData){}

	pDemodCtx = (tmhpiDemodCtx_t*)userData;
	
	// Front-End instance
	pDemodCtx->DemodEvent_S.Handle = (HPIv2_INT32)pDemodCtx;

    switch(events)
    {
     
        case TMDL_FE_EVENT_CARRIER_TUNED:
            APP_DBG_PRINT_MSG(FE_DBG_HPI, FE_DBG_HPI_LEVEL, FE_DBG_HPI_CALLBACK_DLFE, FE_DBG_HPI_CB_DLFE_CARRIER_TUNED, 0, 0);
                
            pDemodCtx->DemodEvent_S.EventType = DEMOD_CARRIER_TUNED;
            
            // send the Front-End Event to the upper layer.
            pDemodCtx->pCarrierEvtCallback(&pDemodCtx->DemodEvent_S);

            break;
            
        case TMDL_FE_EVENT_CARRIER_FOUND:
            APP_DBG_PRINT_MSG(FE_DBG_HPI, FE_DBG_HPI_LEVEL, FE_DBG_HPI_CALLBACK_DLFE, FE_DBG_HPI_CB_DLFE_CARRIER_FOUND, 0, 0);

            pDemodCtx->DemodEvent_S.Status    = *((HPIv2_tDemodStatus*)pData);

⌨️ 快捷键说明

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