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

📄 reg0297.c

📁 st7710的tuner标准驱动
💻 C
📖 第 1 页 / 共 2 页
字号:
/* ----------------------------------------------------------------------------
File Name: reg0297.c (was reg0297.c)

Description:

Copyright (C) 1999-2001 STMicroelectronics

   date: 01-October-2001
version: 3.2.0
 author: from STV0299 and MB validation drivers.
comment: Write for multi-instance/multi-FrontEnd.

Revision History:

Reference:
    ST API Definition "TUNER Driver API" DVD-API-06
---------------------------------------------------------------------------- */


/* Includes ---------------------------------------------------------------- */

/* C libs */
#include <string.h>

/* Standard includes */
#include "stlite.h"

/* STAPI */
#include "sttbx.h"
#include "sttuner.h"

/* local to sttuner */
#include "util.h"       /* generic utility functions for sttuner */
#include "dbtypes.h"    /* data types for databases */
#include "sysdbase.h"   /* functions to accesss system data */
#include "ioarch.h"     /* IO access layer */
#include "ioreg.h"      /* register mapping */

#include "d0297.h"      /* top level driver header */
#include "reg0297.h"    /* header for this file */



/* functions --------------------------------------------------------------- */

/* ----------------------------------------------------------------------------
Name: Reg0297_Install()

Description:
    install driver register table

Parameters:

Return Value:
---------------------------------------------------------------------------- */
ST_ErrorCode_t Reg0297_Install(STTUNER_IOREG_DeviceMap_t *DeviceMap)
{
#ifdef STTUNER_DEBUG_MODULE_CABDRV_REG0297
    const char *identity = "STTUNER reg0297.c Reg0297_Install()";
#endif
   ST_ErrorCode_t Error = ST_NO_ERROR;

   
    if (Error != ST_NO_ERROR)
    {
#ifdef STTUNER_DEBUG_MODULE_CABDRV_REG0297
        STTBX_Print(("%s fail error=%d\n", identity, Error));
#endif
    }
    {
#ifdef STTUNER_DEBUG_MODULE_CABDRV_REG0297
        STTBX_Print(("%s installed ok\n", identity));
#endif
    }

    return (Error);
}



/* ----------------------------------------------------------------------------
Name: Reg0297_Open()

Description:

Parameters:

Return Value:
---------------------------------------------------------------------------- */
ST_ErrorCode_t Reg0297_Open(STTUNER_IOREG_DeviceMap_t *DeviceMap, U32 ExternalClock)
{
#ifdef STTUNER_DEBUG_MODULE_CABDRV_REG0297
    const char *identity = "STTUNER reg0297.c Reg0297_Open()";
#endif
    ST_ErrorCode_t Error = ST_NO_ERROR;

    DeviceMap->RegExtClk = ExternalClock;

#ifdef STTUNER_DEBUG_MODULE_CABDRV_REG0297
    STTBX_Print(("%s External clock=%u KHz\n", identity, ExternalClock));
#endif
    return(Error);
}


/* ----------------------------------------------------------------------------
Name: Reg0297_Close()

Description:

Parameters:

Return Value:
---------------------------------------------------------------------------- */
ST_ErrorCode_t Reg0297_Close(STTUNER_IOREG_DeviceMap_t *DeviceMap)
{
#ifdef STTUNER_DEBUG_MODULE_CABDRV_REG0297
    const char *identity = "STTUNER reg0297.c Reg0297_Close()";
#endif
    ST_ErrorCode_t Error = ST_NO_ERROR;

#ifdef STTUNER_DEBUG_MODULE_CABDRV_REG0297
    STTBX_Print(("%s\n", identity));
#endif
    return(Error);
}

/* ----------------------------------------------------------------------------
Name: Reg0297_UnInstall()

Description:

Parameters:

Return Value:
---------------------------------------------------------------------------- */
ST_ErrorCode_t Reg0297_UnInstall(STTUNER_IOREG_DeviceMap_t *DeviceMap)
{
#ifdef STTUNER_DEBUG_MODULE_CABDRV_REG0297
    const char *identity = "STTUNER reg0297.c Reg0297_UnInstall()";
#endif
    ST_ErrorCode_t Error = ST_NO_ERROR;

#ifdef STTUNER_DEBUG_MODULE_CABDRV_REG0297
    STTBX_Print(("%s\n", identity));
#endif
    return(Error);
}


/* ----------------------------------------------------------------------------
Name: Reg0297_SetQAMSize()

Description:

Parameters:

Return Value:
---------------------------------------------------------------------------- */
void Reg0297_SetQAMSize(STTUNER_IOREG_DeviceMap_t *DeviceMap, IOARCH_Handle_t IOHandle, STTUNER_Modulation_t Value)
{
#ifdef STTUNER_DEBUG_MODULE_CABDRV_REG0297
    const char *identity = "STTUNER reg0297.c Reg0297_SetQAMSize()";
#endif

    switch(Value)
    {
        case STTUNER_MOD_16QAM:
#ifdef STTUNER_DEBUG_MODULE_CABDRV_REG0297
            STTBX_Print(("%s QAM16\n", identity));
#endif
            STTUNER_IOREG_SetField(DeviceMap, IOHandle, F0297_MODE_SELECT, D0297_QAM16);
            break;
        case STTUNER_MOD_32QAM:
#ifdef STTUNER_DEBUG_MODULE_CABDRV_REG0297
            STTBX_Print(("%s QAM32\n", identity));
#endif
            STTUNER_IOREG_SetField(DeviceMap, IOHandle, F0297_MODE_SELECT, D0297_QAM32);
            break;
        case STTUNER_MOD_64QAM:
#ifdef STTUNER_DEBUG_MODULE_CABDRV_REG0297
            STTBX_Print(("%s QAM64\n", identity));
#endif
            STTUNER_IOREG_SetField(DeviceMap, IOHandle, F0297_MODE_SELECT, D0297_QAM64);
            break;
        case STTUNER_MOD_128QAM:
#ifdef STTUNER_DEBUG_MODULE_CABDRV_REG0297
            STTBX_Print(("%s QAM128\n", identity));
#endif
            STTUNER_IOREG_SetField(DeviceMap, IOHandle, F0297_MODE_SELECT, D0297_QAM128);
            break;
        case STTUNER_MOD_256QAM:
#ifdef STTUNER_DEBUG_MODULE_CABDRV_REG0297
            STTBX_Print(("%s QAM256\n", identity));
#endif
            STTUNER_IOREG_SetField(DeviceMap, IOHandle, F0297_MODE_SELECT, D0297_QAM256);
            break;
        default:
#ifdef STTUNER_DEBUG_MODULE_CABDRV_REG0297
            STTBX_Print(("%s fail Bad Parameter\n", identity));
#endif
            break;
    }
}

/* ----------------------------------------------------------------------------
Name: Reg0297_GetQAMSize()

Description:

Parameters:

Return Value:
---------------------------------------------------------------------------- */
STTUNER_Modulation_t Reg0297_GetQAMSize(STTUNER_IOREG_DeviceMap_t *DeviceMap, IOARCH_Handle_t IOHandle)
{
#ifdef STTUNER_DEBUG_MODULE_CABDRV_REG0297
    const char *identity = "STTUNER reg0297.c Reg0297_GetQAMSize()";
#endif
    STTUNER_Modulation_t Value;

    Value = STTUNER_IOREG_GetField(DeviceMap, IOHandle, F0297_MODE_SELECT);

    switch(Value)
    {
        case D0297_QAM16:
#ifdef STTUNER_DEBUG_MODULE_CABDRV_REG0297
            STTBX_Print(("%s QAM16\n", identity));
#endif
            return STTUNER_MOD_16QAM;
        case D0297_QAM32:
#ifdef STTUNER_DEBUG_MODULE_CABDRV_REG0297
            STTBX_Print(("%s QAM32\n", identity));
#endif
            return STTUNER_MOD_32QAM;
        case D0297_QAM64:
#ifdef STTUNER_DEBUG_MODULE_CABDRV_REG0297
            STTBX_Print(("%s QAM64\n", identity));
#endif
            return STTUNER_MOD_64QAM;
        case D0297_QAM128:
#ifdef STTUNER_DEBUG_MODULE_CABDRV_REG0297
            STTBX_Print(("%s QAM128\n", identity));
#endif
            return STTUNER_MOD_128QAM;
        case D0297_QAM256:
#ifdef STTUNER_DEBUG_MODULE_CABDRV_REG0297
            STTBX_Print(("%s QAM256\n", identity));
#endif
            return STTUNER_MOD_256QAM;
        default:
#ifdef STTUNER_DEBUG_MODULE_CABDRV_REG0297
            STTBX_Print(("%s fail Bad Parameter\n", identity));
#endif
            return STTUNER_MOD_ALL;
            break;
    }
}


/* ----------------------------------------------------------------------------
Name: Reg0297_WBAGCOff()

Description:

Parameters:

Return Value:
---------------------------------------------------------------------------- */
void Reg0297_WBAGCOff(STTUNER_IOREG_DeviceMap_t *DeviceMap, IOARCH_Handle_t IOHandle)
{
#ifdef STTUNER_DEBUG_MODULE_CABDRV_REG0297
    const char *identity = "STTUNER reg0297.c Reg0297_WBAGCOff()";
#endif

#ifdef STTUNER_DEBUG_MODULE_CABDRV_REG0297
    STTBX_Print(("%s ==> WAGCOFF\n", identity));
#endif

    STTUNER_IOREG_SetRegister(DeviceMap, IOHandle, R0297_WBAGC_3, D0297_WBAGCON);
}

/* ----------------------------------------------------------------------------
Name: Reg0297_WBAGCOn()

Description:

Parameters:

Return Value:
---------------------------------------------------------------------------- */
void Reg0297_WBAGCOn(STTUNER_IOREG_DeviceMap_t *DeviceMap, IOARCH_Handle_t IOHandle)
{
#ifdef STTUNER_DEBUG_MODULE_CABDRV_REG0297
    const char *identity = "STTUNER reg0297.c Reg0297_WBAGCOn()";
#endif

#ifdef STTUNER_DEBUG_MODULE_CABDRV_REG0297
    STTBX_Print(("%s ==> WAGCON\n", identity));
#endif

    STTUNER_IOREG_SetRegister(DeviceMap, IOHandle, R0297_WBAGC_3, D0297_WBAGCOFF);
}

/* ----------------------------------------------------------------------------
Name: Reg0297_SetAGC2()

Description:

Parameters:

Return Value:
---------------------------------------------------------------------------- */
void Reg0297_SetAGC2(STTUNER_IOREG_DeviceMap_t *DeviceMap, IOARCH_Handle_t IOHandle, U16 Value)
{
#ifdef STTUNER_DEBUG_MODULE_CABDRV_REG0297
    const char *identity = "STTUNER reg0297.c Reg0297_SetAGC2()";
#endif

#ifdef STTUNER_DEBUG_MODULE_CABDRV_REG0297
    STTBX_Print(("%s ==> AGC2 %u\n", identity, Value));
#endif
U8 temp[1],try1;
    
    try1=STTUNER_IOREG_GetRegister(DeviceMap,IOHandle,R0297_WBAGC_2);

    temp[0]=(int)(MAC0297_B0(Value));
    try1=try1&0xFC;
    temp[1]=try1|(int)(MAC0297_B1(Value));
    STTUNER_IOREG_SetContigousRegisters(DeviceMap, IOHandle, R0297_WBAGC_1, temp, 2);

}

/* ----------------------------------------------------------------------------
Name: Reg0297_GetAGC()

Description:

Parameters:

Return Value:
---------------------------------------------------------------------------- */
U16 Reg0297_GetAGC(STTUNER_IOREG_DeviceMap_t *DeviceMap, IOARCH_Handle_t IOHandle)
{
#ifdef STTUNER_DEBUG_MODULE_CABDRV_REG0297
    const char *identity = "STTUNER reg0297.c Reg0297_GetAGC()";
#endif

⌨️ 快捷键说明

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