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

📄 stv299_i.c

📁 这是DVB tuner驱动部分和其它相关的源码和一些技术资料文档.
💻 C
📖 第 1 页 / 共 2 页
字号:
    Nothing.*****************************************************************************/static DEMOD_ErrorCode_t DEMOD_GetSignalQuality(DEMOD_Handle_t Handle,                                                U32 *SignalQuality_p,                                                U32 *Ber_p){    /* Read noise estimations for C/N and BER */    GetNoiseEstimator(STV0299_HANDLE(Handle),                      SignalQuality_p,                      Ber_p);    return DEMOD_NO_ERROR;} /* DEMOD_GetSignalQuality() *//*****************************************************************************Name: DEMOD_IsLocked()Description:    Checks the LK register i.e., are we demodulating a digital carrier.Parameters:    Demod_p,        pointer to the DEMOD device.    IsLocked_p,     pointer to area to store result (bool):                    TRUE -- we are locked.                    FALSE -- no lock.Return Value:    DEMOD_NO_ERROR,     the operation completed without error.    STI2C_xxx,          there was a problem accessing the device.See Also:    Nothing.*****************************************************************************/static DEMOD_ErrorCode_t DEMOD_IsLocked(DEMOD_Handle_t Handle,                                        BOOL *IsLocked_p){    *IsLocked_p = RegGetField(STV0299_HANDLE(Handle), LK) ? TRUE : FALSE;    return DEMOD_NO_ERROR;} /* DEMOD_IsLocked() *//*****************************************************************************Name: DEMOD_Tracking()Description:    This routine checks the carrier against a certain threshold value and will    perform derotator centering, if necessary -- using the ForceTracking    option ensures that derotator centering is always performed when    this routine is called.    This routine should be periodically called once a lock has been    established in order to maintain the lock.Parameters:    Demod_p,        pointer to the DEMOD device.    ForceTracking,  boolean to control whether to always perform                    derotator centering, regardless of the carrier.    NewFrequency_p, pointer to area where to store the new frequency                    value -- it may be changed when trying to optimize                    the derotator.    SignalFound_p,  indicates that whether or not we're still locked                    after optimization.Return Value:    DEMOD_NO_ERROR,     the operation completed without error.    STI2C_xxx,          there was a problem accessing the device.See Also:    Nothing.*****************************************************************************/static DEMOD_ErrorCode_t DEMOD_Tracking(DEMOD_Handle_t Handle,                                        BOOL ForceTracking,                                        U32 *NewFrequency_p,                                        BOOL *SignalFound_p){    CarrierTracking(STV0299_HANDLE(Handle));  /* STV0299 tracking algo */    *SignalFound_p = (STV0299_HANDLE(Handle)->Result.SignalType == RANGEOK);    *NewFrequency_p = (U32)STV0299_HANDLE(Handle)->Result.Frequency;    return DEMOD_NO_ERROR;} /* DEMOD_Tracking() *//*****************************************************************************Name: DEMOD_ScanFrequency()Description:    This routine will attempt to scan and find a QPSK signal based on the    passed in parameters.Parameters:    Demod_p,                pointer to the DEMOD device.    InitialFrequency,       IF value to commence scan (in kHz).    SymbolRate,             required symbol bit rate (in Hz).    MaxLNBOffset,           maximum allowed LNB offset (in Hz).    TunerStep,              Tuner's step value -- enables override of                            TNR device's internal setting.    DerotatorStep,          derotator step (usually 6).    ScanSuccess_p,          boolean that indicates QPSK search success.    NewFrequency_p,         pointer to area to store locked frequency.Return Value:    DEMOD_NO_ERROR,             the operation completed without error.    STI2C_xxx,                  there was a problem accessing the device.    DEMOD_ERROR_BAD_PARAMETER,  one or more params were invalid during                                computation.See Also:    Nothing.*****************************************************************************/static DEMOD_ErrorCode_t DEMOD_ScanFrequency(DEMOD_Handle_t Handle,                                             U32 InitialFrequency,                                             U32 SymbolRate,                                             U32 MaxLNBOffset,                                             U32 TunerStep,                                             U8 DerotatorStep,                                             BOOL *ScanSuccess_p,                                             U32 *NewFrequency_p){    InitParams(STV0299_HANDLE(Handle));    InitSearch(STV0299_HANDLE(Handle),               InitialFrequency,               SymbolRate,               MaxLNBOffset*2,               DerotatorStep);    AutoSearchAlgo(STV0299_HANDLE(Handle));       /*      Search carrier  */    if (STV0299_HANDLE(Handle)->Result.SignalType == RANGEOK)    {        /* Pass new frequency to caller */        *NewFrequency_p =(U32) STV0299_HANDLE(Handle)->Result.Frequency;    }    *ScanSuccess_p = (STV0299_HANDLE(Handle)->Result.SignalType == RANGEOK);    return DEMOD_NO_ERROR;} /* DEMOD_ScanFrequency() *//*****************************************************************************Name: DEMOD_GetModulation()Description:    This routine returns the modulation scheme in use by this device.    ** Currently only QPSK is supported.Parameters:    Demod_p,            pointer to the DEMOD device.    Modulation_p,       pointer to area to store modulation scheme.Return Value:    DEMOD_NO_ERROR,     the operation completed without error.    See Also:Nothing.*****************************************************************************/static DEMOD_ErrorCode_t DEMOD_GetModulation(DEMOD_Handle_t Handle,                                             DEMOD_Modulation_t *Modulation_p){    /* This implementation of the DEMOD device only supports one type     * of modulation.     */    *Modulation_p = DEMOD_MOD_QPSK;    return DEMOD_NO_ERROR;} /* DEMOD_GetModulation() *//*****************************************************************************Name: DEMOD_GetAGC()Description:    Obtains the current value from the AGC integrator register and computes    a look-up of power output.Parameters:    Demod_p,            pointer to the DEMOD device.    AGC_p,              pointer to area to store power output value.Return Value:    DEMOD_NO_ERROR,     the operation completed without error.    STI2C_xxx,          there was a problem accessing the device.See Also:    Nothing.*****************************************************************************/static DEMOD_ErrorCode_t DEMOD_GetAGC(DEMOD_Handle_t Handle,                                      U32 *AGC_p){    *AGC_p = GetPowerEstimator(STV0299_HANDLE(Handle));    return DEMOD_NO_ERROR;} /* DEMOD_GetAGC() *//*****************************************************************************Name: DEMOD_GetFECRate()Description:    Checks the VEN rate register to deduce the forward error correction    setting that is currently in use.Parameters:    Demod_p,        pointer to the DEMOD device.    FECRate_p,      pointer to area to store FEC rates in use.Return Value:    DEMOD_NO_ERROR,     the operation completed without error.    STI2C_xxx,          there was a problem accessing the device.See Also:    Nothing.*****************************************************************************/static DEMOD_ErrorCode_t DEMOD_GetFECRate(DEMOD_Handle_t Handle,                                          DEMOD_FECRate_t *FECRate_p){    DEMOD_FECRate_t FecRate = 0;    U8 Data;    Data = RegGetField(STV0299_HANDLE(Handle), CPR);    /* Convert venrate value to a DEMOD fecrate */    switch (Data)    {        case STV0299_VSTATUS_PR_1_2:            FecRate = DEMOD_FEC_1_2;            break;        case STV0299_VSTATUS_PR_2_3:            FecRate = DEMOD_FEC_2_3;            break;        case STV0299_VSTATUS_PR_3_4:            FecRate = DEMOD_FEC_3_4;            break;        case STV0299_VSTATUS_PR_5_6:            FecRate = DEMOD_FEC_5_6;            break;        case STV0299_VSTATUS_PR_7_8:            FecRate = DEMOD_FEC_7_8;            break;    }    /* Copy back for caller */    *FECRate_p = FecRate;    return DEMOD_NO_ERROR;} /* DEMOD_GetFECRates() *//*****************************************************************************Name: DEMOD_SetFECRates()Description:    Sets the FEC rates to be used during demodulation.    Parameters:Demod_p,        pointer to DEMOD device.    FECRates,       bitmask of FEC rates to be applied.Return Value:    DEMOD_NO_ERROR, the operation completed without error.    STI2C_xxx,      there was a problem accessing the device.See Also:    Nothing.*****************************************************************************/static DEMOD_ErrorCode_t DEMOD_SetFECRates(DEMOD_Handle_t Handle,                                           DEMOD_FECRate_t FECRates){    U8 Data = 0;    /* Convert DEMOD FEC rates to a VENRATE value to be applied to the     * STV0299.     */    if (FECRates & DEMOD_FEC_1_2)        Data |= STV0299_VENRATE_E0_MSK;    if (FECRates & DEMOD_FEC_2_3)        Data |= STV0299_VENRATE_E1_MSK;    if (FECRates & DEMOD_FEC_3_4)        Data |= STV0299_VENRATE_E2_MSK;    if (FECRates & DEMOD_FEC_5_6)        Data |= STV0299_VENRATE_E3_MSK;    if (FECRates & DEMOD_FEC_7_8)        Data |= STV0299_VENRATE_E4_MSK;    RegSetField(STV0299_HANDLE(Handle), RATE, Data);    return DEMOD_NO_ERROR;} /* DEMOD_SetFECRates() *//* Exported Map Table ------------------------------------------------------------ */DEMOD_MapTable_t __STV0299MapTable ={    DEMOD_Init,    DEMOD_Term,    DEMOD_IsAnalogCarrier,    DEMOD_GetSignalQuality,    DEMOD_GetModulation,    DEMOD_GetAGC,    DEMOD_GetFECRate,    DEMOD_IsLocked,    DEMOD_SetFECRates,    DEMOD_Tracking,    DEMOD_ScanFrequency};/* End of stv299_i.c */

⌨️ 快捷键说明

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