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

📄 tmbsltuner.c

📁 TDA10046驱动源代码.TDA10046是PHILIPS的一款DVB-T TUNER
💻 C
📖 第 1 页 / 共 2 页
字号:
//-----------------------------------------------------------------------------
// $Header: 
// (C) Copyright 2001 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:    tmbslTuner.c
//
// DESCRIPTION:  Function for the Null tuner 
//
// DOCUMENT REF: <References to specification or other documents related to
//               this module>
//
// NOTES:        1.4 03/29/02 15:36:14
//-----------------------------------------------------------------------------
//

//-----------------------------------------------------------------------------
// Standard include files:
//-----------------------------------------------------------------------------
//

#include "..\..\Include\tmhalFEtypes.h"

//-----------------------------------------------------------------------------
// Project include files:
//-----------------------------------------------------------------------------
//
#include "..\..\Include\tmbslTuner.h"
#include "tmbslTunerlocal.h"

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

//-----------------------------------------------------------------------------
// Global data:
//-----------------------------------------------------------------------------
//

//-----------------------------------------------------------------------------
// Internal Prototypes:
//-----------------------------------------------------------------------------
//

Bool
t1316CalcReg (
    ptm1316object_t p1316object,    // I: tuner object
    UInt32          uRf             // I: frequency in hertz
    );

//-----------------------------------------------------------------------------
// Exported functions:
//-----------------------------------------------------------------------------
//

//-----------------------------------------------------------------------------
// FUNCTION:    tmbsl1316Init:
//
// DESCRIPTION: create an instance of a 1316 tuner
//
// RETURN:      TMBSL_ERR_TUNER_BAD_UNIT_NUMBER
//              TM_OK
//  
// NOTES:
//-----------------------------------------------------------------------------
//
tmErrorCode_t
tmbsl1316Init(
    tmUnitSelect_t     TunerUnit,    //  I: Tuner unit number
    tmbslTuParam_t     sParam        //  I: setup parameters
    )
{
    //----------------------
    // test input parameters
    //----------------------
    // test the max number
    if (TunerUnit > MAX_UNITS)
        return TMBSL_ERR_TUNER_BAD_UNIT_NUMBER;

    //----------------------
    // initialize the object
    //----------------------
    // return if already initialized
    if(g1316Instance[TunerUnit].init == True)
        return TM_OK;

    //----------------
    // init the object
    //----------------
    // initialize the object by default values
    g1316Instance[TunerUnit].uHwAddress = sParam.uHwAddress;
    g1316Instance[TunerUnit].systemFunc = sParam.systemFunc;
    g1316Instance[TunerUnit].init = True;

    return TM_OK;
}


//-----------------------------------------------------------------------------
// FUNCTION:    tmbsl1316DeInit:
//
// DESCRIPTION: destroy an instance of a 1316 tuner
//
// RETURN:      TMBSL_ERR_TUNER_BAD_UNIT_NUMBER
//              TMBSL_ERR_TUNER_NOT_INITIALIZED
//              TM_OK
//
// NOTES:
//-----------------------------------------------------------------------------
//
tmErrorCode_t 
tmbsl1316DeInit (
    tmUnitSelect_t TunerUnit     //  I: Tuner unit number
    )
{
    //----------------------
    // test input parameters
    //----------------------
    // test the instance number
    if (TunerUnit > MAX_UNITS)
        return TMBSL_ERR_TUNER_BAD_UNIT_NUMBER;

    // test the object
    if (g1316Instance[TunerUnit].init == False)
        return TMBSL_ERR_TUNER_NOT_INITIALIZED;

    //-------------------------
    // De-initialize the object
    //-------------------------
    g1316Instance[TunerUnit].init = False;

    return TM_OK;
}


//-----------------------------------------------------------------------------
// FUNCTION:    tmbsl1316GetSWVersion:
//
// DESCRIPTION: Return the version of this device
//
// RETURN:      TM_OK
//
// NOTES:       Values defined in the tmbsl1316local.h file
//-----------------------------------------------------------------------------
//
tmErrorCode_t   
tmbsl1316GetSWVersion (
    ptmSWVersion_t     pSWVersion        //  I: Receives SW Version 
    )
{

    pSWVersion->compatibilityNr = BSL_COMP_NUM;
    pSWVersion->majorVersionNr  = BSL_MAJOR_VER;
    pSWVersion->minorVersionNr  = BSL_MINOR_VER;

    return TM_OK;
}


//-----------------------------------------------------------------------------
// FUNCTION:    tmbsl1316SetPowerState:
//
// DESCRIPTION: Set the power state of this device.
//
// RETURN:      TMBSL_ERR_TUNER_BAD_UNIT_NUMBER
//              TMBSL_ERR_TUNER_NOT_INITIALIZED
//              TM_OK
//
// NOTES:       NOT implemented
//-----------------------------------------------------------------------------
//
tmErrorCode_t
tmbsl1316SetPowerState (
    tmUnitSelect_t      TunerUnit,      //  I: Tuner unit number
    tmPowerState_t      powerState      //  I: Power state of this device
)
{
    //----------------------
    // test input parameters
    //----------------------
    // test the instance number
    if (TunerUnit > MAX_UNITS)
        return TMBSL_ERR_TUNER_BAD_UNIT_NUMBER;

    // test the object
    if (g1316Instance[TunerUnit].init == False)
        return TMBSL_ERR_TUNER_NOT_INITIALIZED;

    //--------------
    // set the value
    //--------------
    // TO DO : power on off standy suspend

    // store the value
    g1316Instance[TunerUnit].curPowerState = powerState;

    return TM_OK;
}


//-----------------------------------------------------------------------------
// FUNCTION:    tmbsl1316GetPowerState:
//
// DESCRIPTION: Get the power state of this device.
//
// RETURN:      TMBSL_ERR_TUNER_BAD_UNIT_NUMBER
//              TMBSL_ERR_TUNER_NOT_INITIALIZED
//              TM_OK
//
// NOTES:
//-----------------------------------------------------------------------------
//
tmErrorCode_t
tmbsl1316GetPowerState (
    tmUnitSelect_t      TunerUnit,      //  I: Tuner unit number
    tmPowerState_t     *pPowerState     //  O: Power state of this device
)
{
    //----------------------
    // test input parameters
    //----------------------
    // test the instance number
    if (TunerUnit > MAX_UNITS)
        return TMBSL_ERR_TUNER_BAD_UNIT_NUMBER;

    // test the object
    if (g1316Instance[TunerUnit].init == False)
        return TMBSL_ERR_TUNER_NOT_INITIALIZED;

    //--------------
    // get the value
    //--------------
    *pPowerState = g1316Instance[TunerUnit].curPowerState;

    return TM_OK;
}


//-----------------------------------------------------------------------------
// FUNCTION:    tmbsl1316Write:
//
// DESCRIPTION: Write in the tuner.
//
// RETURN:      TMBSL_ERR_TUNER_BAD_UNIT_NUMBER
//              TMBSL_ERR_TUNER_NOT_INITIALIZED
//              TMBSL_ERR_TUNER_BAD_PARAMETER
//              TMBSL_ERR_IIC_ERR
//              TM_OK
//
// NOTES:       
//-----------------------------------------------------------------------------
//
tmErrorCode_t
tmbsl1316Write (
    tmUnitSelect_t      TunerUnit,      //  I: Tuner unit number
    UInt32              uIndex,         //  I: Start index to write
    UInt32              uNbBytes,       //  I: Number of bytes to write
    UInt32*             puBytes         //  I: Pointer on an array of bytes
)
{
    UInt32   uCounter;

    //----------------------
    // test input parameters
    //----------------------
    // test the instance number
    if (TunerUnit > MAX_UNITS)
        return TMBSL_ERR_TUNER_BAD_UNIT_NUMBER;

    // test the object
    if (g1316Instance[TunerUnit].init == False)
        return TMBSL_ERR_TUNER_NOT_INITIALIZED;

    // test the object
    if (uIndex > NB_REGISTERS-1 || uNbBytes > NB_REGISTERS)
        return TMBSL_ERR_TUNER_BAD_PARAMETER;

    //--------------
    // set the value
    //--------------
    // the four registers must be written in the same time
    for (uCounter = 0; uCounter < uNbBytes; uCounter++)
        g1316Instance[TunerUnit].pTunerReg[uCounter+uIndex] = puBytes[uCounter];

    // write in the tuner
  if (g1316Instance[TunerUnit].systemFunc.SY_Write(
        g1316Instance[TunerUnit].uHwAddress,
        0,NB_REGISTERS, g1316Instance[TunerUnit].pTunerReg) != 1)
        return TMBSL_ERR_IIC_ERR;

    return TM_OK;
}


//-----------------------------------------------------------------------------
// FUNCTION:    tmbsl1316WriteBit:
//
// DESCRIPTION: Write in the tuner.
//
// RETURN:      TM_ERR_NOT_SUPPORTED
//
// NOTES:
//-----------------------------------------------------------------------------
//
tmErrorCode_t
tmbsl1316WriteBit (
    tmUnitSelect_t      TunerUnit,      //  I: Tuner unit number
    UInt32              uIndex,         //  I: Start index to write
    UInt32              uBitMask,       //  I: bit mask
    UInt32              uBytes          //  I: bit value
)
{
    return TM_ERR_NOT_SUPPORTED;
}


//-----------------------------------------------------------------------------
// FUNCTION:    tmbsl1316Read:
//
// DESCRIPTION: Read in the tuner.
//
// RETURN:      TMBSL_ERR_TUNER_BAD_UNIT_NUMBER
//              TMBSL_ERR_TUNER_NOT_INITIALIZED
//              TMBSL_ERR_TUNER_BAD_PARAMETER
//              TMBSL_ERR_IIC_ERR
//              TM_OK
//
// NOTES:       
//-----------------------------------------------------------------------------
//
tmErrorCode_t
tmbsl1316Read (
    tmUnitSelect_t      TunerUnit,      //  I: Tuner unit number
    UInt32              uIndex,         //  I: Start index to read
    UInt32              uNbBytes,       //  I: Number of bytes to read
    UInt32*             puBytes         //  I: Pointer on an array of bytes
)
{
    //----------------------
    // test input parameters
    //----------------------
    // test the instance number

⌨️ 快捷键说明

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