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

📄 stv199.c

📁 这是DVB tuner驱动部分和其它相关的源码和一些技术资料文档.
💻 C
📖 第 1 页 / 共 4 页
字号:
Description:    This routine enables the caller to set n-bit values in an    arbitrary register on the STV0199A.  Each property is defined by a    bitmask, a register number and a signed/unsigned boolean.Parameters:    Hw_p,       pointer to the STV0199A device information.    Property,   property value to set - also contains data type.    Value_p,    pointer to value supplied by caller.Return Value:    STV0199A_NO_ERROR,      the operation completed without error.    STV0199A_ERROR_BUS,     unable to access device.See Also:    STV0199A_GetProperty()*****************************************************************************/STV0199A_ErrorCode_t STV0199A_SetProperty(STV0199A_Device_t *Hw_p,                                          STV0199A_Property_t Property,                                          U8 NewValue){    STV0199A_ErrorCode_t Error;    STV0199A_PropertyTable_t *Property_p;    U8 BitOffset = 0;    U8 Bits, Value;    Property_p = &PropertyTable[Property];#if 0 /* !! */    /* Attempt to read the property's register (existing value) */    Error = STV0199A_Read(Hw_p, &Value, Property_p->Register);#else    Error = STV0199A_NO_ERROR;    Value = Hw_p->RegisterMap[Property_p->Register];#endif    /* Can't continue unless we can read the current value */    if (Error == STV0199A_NO_ERROR)    {        /* We first calculate the bit offset of the first bit set in the mask */        Bits = Property_p->BitMask;        while ((Bits & 0x01) != 1)        {            BitOffset++;            Bits >>= 1;        }        Value &= ~(Property_p->BitMask); /* Clear all bits */        /* Shift the bits to the appropriate offset and apply the bitmask.         * Then "or" in the new bits for the register.         */        Value |= ((NewValue << BitOffset) & Property_p->BitMask);        /* Attempt to write the new register value */        Error = STV0199A_Write(Hw_p, Value, Property_p->Register);    }    return Error;} /* STV0199A_SetProperty() *//*****************************************************************************Name: STV0199A_GetMasterClock()Description:    Obtains the value of the master clock on the STV0119A.    The value is stored for future use in the STV0199A_Device_t structure.Parameters:    Hw_p,   pointer to the STV0199A device.Return Value:    STV0199A_NO_ERROR,  the operation completed without error.    STV0199A_ERROR_BUS, there was a problem accessing the device.See Also:    STV0199A_Device_t*****************************************************************************/STV0199A_ErrorCode_t STV0199A_GetMasterClock(STV0199A_Device_t *Hw_p){    STV0199A_ErrorCode_t Error;    U32 VCOFrequency;    U8 Value;    Error = STV0199A_GetProperty(Hw_p,                                 STV0199A_DIR_CLOCK,                                 &Value);    if (Error == ST_NO_ERROR)    {        if (Value == 1)        {            Hw_p->MasterClock = Hw_p->ExternalClock;        }        else        {            Error = STV0199A_GetProperty(Hw_p,                                         STV0199A_M_DIVISOR,                                         &Value);            if (Error == ST_NO_ERROR)            {                VCOFrequency = 8 * Hw_p->ExternalClock * (Value+1);                Error = STV0199A_GetProperty(Hw_p,                                             STV0199A_P_DIVISOR,                                             &Value);                if (Error == ST_NO_ERROR)                    Hw_p->MasterClock = VCOFrequency / ((Value+1) * 4);            }        }    }    return Error;} /* STV0199A_GetMasterClock() *//*****************************************************************************Name: STV0199A_GetSymbolRate()Description:    Obtains the value of the symbol rate on the STV0119A.    The value is stored for future use in the STV0199A_Device_t structure.    NOTE: Master clock value must be known before calling this routine.Parameters:    Hw_p,   pointer to the STV0199A device.Return Value:    STV0199A_NO_ERROR,  the operation completed without error.    STV0199A_ERROR_BUS, there was a problem accessing the device.See Also:    STV0199A_Device_t*****************************************************************************/STV0199A_ErrorCode_t STV0199A_GetSymbolRate(STV0199A_Device_t *Hw_p){    STV0199A_ErrorCode_t Error = STV0199A_NO_ERROR;    U8 Msb, Lsb;    Error = STV0199A_GetProperty(Hw_p,                                 STV0199A_SYMBOL_MSB,                                 &Msb);    if (Error == STV0199A_NO_ERROR)    {        Error = STV0199A_GetProperty(Hw_p,                                     STV0199A_SYMBOL_LSB,                                     &Lsb);        if (Error == STV0199A_NO_ERROR)        {            Hw_p->SymbolRate = ((U32)Msb*256) + (U32)Lsb;            Hw_p->SymbolRate *= (Hw_p->MasterClock/2048);            Hw_p->SymbolRate >>= 5; /* DIV 32 */        }    }    return Error;} /* STV0199A_GetSymbolRate() *//*****************************************************************************Name: STV0199A_DeltaSymbolRate()Description:    Applies a correction value to the current symbol rate.Parameters:    Hw_p,   pointer to the STV0199A device.Return Value:    STV0199A_NO_ERROR,  the operation completed without error.    STV0199A_ERROR_BUS, there was a problem accessing the device.See Also:    STV0199A_Device_t*****************************************************************************/STV0199A_ErrorCode_t STV0199A_DeltaSymbolRate(STV0199A_Device_t *Hw_p,                                              S32 Correction){    STV0199A_ErrorCode_t Error = STV0199A_NO_ERROR;    U8 Msb, Lsb;    U32 L;    U16 I;    Error = STV0199A_GetProperty(Hw_p,                                 STV0199A_SYMBOL_MSB,                                 &Msb);    if (Error == STV0199A_NO_ERROR)    {        Error = STV0199A_GetProperty(Hw_p,                                     STV0199A_SYMBOL_LSB,                                     &Lsb);        if (Error == STV0199A_NO_ERROR)        {            L = Msb*256;            L += Lsb;            L += Correction;            I = L/256;            Msb = I;            L -= I*256;            I = L;            Lsb = I;            Error = STV0199A_SetProperty(Hw_p,                                         STV0199A_SYMBOL_MSB,                                         Msb);            if (Error == STV0199A_NO_ERROR)            {                Error = STV0199A_SetProperty(Hw_p,                                             STV0199A_SYMBOL_LSB,                                             Lsb);                if (Error == STV0199A_NO_ERROR)                    Error = STV0199A_GetSymbolRate(Hw_p);            }        }    }    return Error;} /* STV0199A_DeltaSymbolRate() *//*****************************************************************************Name: STV0199A_GetRollOff()Description:    Obtains the value of the Roll Off on the STV0119A.    The value is stored for future use in the STV0199A_Device_t structure.Parameters:    Hw_p,   pointer to the STV0199A device.Return Value:    STV0199A_NO_ERROR,  the operation completed without error.    STV0199A_ERROR_BUS, there was a problem accessing the device.See Also:    STV0199A_Device_t*****************************************************************************/STV0199A_ErrorCode_t STV0199A_GetRollOff(STV0199A_Device_t *Hw_p){    STV0199A_ErrorCode_t Error;    U8 Value;    Error = STV0199A_GetProperty(Hw_p,                                 STV0199A_ROLL_OFF,                                 &Value);    if (Error == STV0199A_NO_ERROR)        Hw_p->RollOff = (Value==1)?20:35;    return Error;} /* STV0199A_GetRollOff() *//*****************************************************************************Name: STV0199A_GetIQ()Description:    Obtains the value of IQ on the STV0119A.    The value is stored for future use in the STV0199A_Device_t structure.Parameters:    Hw_p,   pointer to the STV0199A device.Return Value:    STV0199A_NO_ERROR,  the operation completed without error.    STV0199A_ERROR_BUS, there was a problem accessing the device.See Also:    STV0199A_Device_t*****************************************************************************/STV0199A_ErrorCode_t STV0199A_GetIQ(STV0199A_Device_t *Hw_p){    STV0199A_ErrorCode_t Error;    U8 Value;    Error = STV0199A_GetProperty(Hw_p,                                 STV0199A_IQ,                                 &Value);    if (Error == STV0199A_NO_ERROR)        Hw_p->IQ = Value;    return Error;} /* STV0199A_GetIQ() *//*****************************************************************************Name: STV0199A_GetCF()Description:    Obtains the value of CF on the STV0119A.    The value is stored for future use in the STV0199A_Device_t structure.Parameters:    Hw_p,   pointer to the STV0199A device.Return Value:    STV0199A_NO_ERROR,  the operation completed without error.    STV0199A_ERROR_BUS, there was a problem accessing the device.See Also:    STV0199A_Device_t*****************************************************************************/STV0199A_ErrorCode_t STV0199A_GetCF(STV0199A_Device_t *Hw_p){    STV0199A_ErrorCode_t Error;    U8 Value;    Error = STV0199A_GetProperty(Hw_p,                                 STV0199A_CF,                                 &Value);    if (Error == STV0199A_NO_ERROR)        Hw_p->CF = Value;    return Error;} /* STV0199A_GetCF() *//*****************************************************************************Name: STV0199A_GetLK()Description:    Obtains the value of LK on the STV0119A.    The value is stored for future use in the STV0199A_Device_t structure.Parameters:    Hw_p,   pointer to the STV0199A device.Return Value:    STV0199A_NO_ERROR,  the operation completed without error.    STV0199A_ERROR_BUS, there was a problem accessing the device.See Also:    STV0199A_Device_t*****************************************************************************/STV0199A_ErrorCode_t STV0199A_GetLK(STV0199A_Device_t *Hw_p){    STV0199A_ErrorCode_t Error;    U8 Value;    Error = STV0199A_GetProperty(Hw_p,                                 STV0199A_LK,                                 &Value);    if (Error == STV0199A_NO_ERROR)        Hw_p->LK = Value;    return Error;} /* STV0199A_GetLK() *//*****************************************************************************Name: STV0199A_GetSN()Description:    Obtains the value of SN on the STV0119A.    The value is stored for future use in the STV0199A_Device_t structure.Parameters:    Hw_p,   pointer to the STV0199A device.Return Value:    STV0199A_NO_ERROR,  the operation completed without error.    STV0199A_ERROR_BUS, there was a problem accessing the device.See Also:    STV0199A_Device_t*****************************************************************************/STV0199A_ErrorCode_t STV0199A_GetSN(STV0199A_Device_t *Hw_p){    STV0199A_ErrorCode_t Error;    U8 Value;    Error = STV0199A_GetProperty(Hw_p,                                 STV0199A_SN,                                 &Value);    if (Error == STV0199A_NO_ERROR)        Hw_p->SN = Value;    return Error;} /* STV0199A_GetSN() *//*****************************************************************************Name: STV0199A_GetTO()Description:    Obtains the value of TO on the STV0119A.    The value is stored for future use in the STV0199A_Device_t structure.Parameters:    Hw_p,   pointer to the STV0199A device.Return Value:    STV0199A_NO_ERROR,  the operation completed without error.    STV0199A_ERROR_BUS, there was a problem accessing the device.See Also:    STV0199A_Device_t*****************************************************************************/STV0199A_ErrorCode_t STV0199A_GetTO(STV0199A_Device_t *Hw_p){    STV0199A_ErrorCode_t Error;    U8 Value;    Error = STV0199A_GetProperty(Hw_p,                                 STV0199A_TO,                                 &Value);    if (Error == STV0199A_NO_ERROR)        Hw_p->TO = Value;    return Error;} /* STV0199A_GetTO() *//*****************************************************************************Name: STV0199A_GetH()Description:    Obtains the value of H on the STV0119A.    The value is stored for future use in the STV0199A_Device_t structure.Parameters:    Hw_p,   pointer to the STV0199A device.Return Value:    STV0199A_NO_ERROR,  the operation completed without error.    STV0199A_ERROR_BUS, there was a problem accessing the device.See Also:    STV0199A_Device_t*****************************************************************************/STV0199A_ErrorCode_t STV0199A_GetH(STV0199A_Device_t *Hw_p){    STV0199A_ErrorCode_t Error;    U8 Value;    Error = STV0199A_GetProperty(Hw_p,                                 STV0199A_H,                                 &Value);    if (Error == STV0199A_NO_ERROR)        Hw_p->H = Value;    return Error;} /* STV0199A_GetH() *//*****************************************************************************Name: STV0199A_GetE()Description:    Obtains the value of E on the STV0119A.    The value is stored for future use in the STV0199A_Device_t structure.Parameters:    Hw_p,   pointer to the STV0199A device.Return Value:    STV0199A_NO_ERROR,  the operation completed without error.    STV0199A_ERROR_BUS, there was a problem accessing the device.See Also:    STV0199A_Device_t*****************************************************************************/STV0199A_ErrorCode_t STV0199A_GetE(STV0199A_Device_t *Hw_p){    STV0199A_ErrorCode_t Error;    U8 Value;

⌨️ 快捷键说明

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