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

📄 tnr.c

📁 这是DVB tuner驱动部分和其它相关的源码和一些技术资料文档.
💻 C
字号:
/*****************************************************************************File Name   : tnr.cDescription : Wrapper layer for TNR component.              All TNR function calls resolve to a device-specific              implementation of the TNR layer e.g., S68G21.              Each TNR module must be imported via a function table that              should be externally referenced in this module.Copyright (C) 2000 STMicroelectronicsRevision History    :    24/01/00    Created module in anticipation of support for multiple                TNR devices connected.Reference           :ST API Definition "TUNER Driver API" DVD-API-06*****************************************************************************//* Includes --------------------------------------------------------------- */#include <string.h>                     /* C libs */ #include <stdio.h>#include "stlite.h"                     /* Standard includes */#include "stddefs.h"#include "sttuner.h"                    /* STAPI Error codes, etc */#include "stcommon.h"#include "tnr.h"                        /* TNR Device API */#include "sttbx.h"/* Private types/constants ------------------------------------------------ *//* Imported TNR modules */#ifdef INCLUDE_generic                  /* Generic tuner type */extern TNR_MapTable_t __GenericTunerMapTable;#define GENERICTUNERMAPTABLE  &__GenericTunerMapTable#else#define GENERICTUNERMAPTABLE  NULL#endif/* Private variables ------------------------------------------------------ *//* Private macros --------------------------------------------------------- *//* Private function prototypes -------------------------------------------- *//* Supported devices */static TNR_MapTable_t *TnrMapTable[] ={    GENERICTUNERMAPTABLE,               /* 68G21 */    GENERICTUNERMAPTABLE,               /* VG1011 */    GENERICTUNERMAPTABLE,               /* TUA6100 */    GENERICTUNERMAPTABLE                /* EVALMAX */};/* API routines ----------------------------------------------------------- *//*****************************************************************************Name: TNR_Init()Description:    Initializes the TNR API level -- makes appropriate calls to reset the    tuner hardware, and fills in tuner device type information.Parameters:    InitParams_p,   pointer to initialization parameters for guiding                    the initialization of this device.Return Value:    TNR_NO_ERROR,               the operation completed without error.    TNR_ERROR_BAD_PARAMETER,    the I2C handle passed was invalid.See Also:    TNR_Term()*****************************************************************************/TNR_ErrorCode_t TNR_Init(TNR_InitParams_t *InitParams_p,                         TNR_Handle_t *Handle_p){    TNR_ErrorCode_t Error = TNR_NO_ERROR;    TNR_MapTable_t *MapTable_p;    /* Check whether or not the device is supported */    if (InitParams_p->TunerType < TNR_DEVICE_UNKNOWN)    {        MapTable_p = TnrMapTable[InitParams_p->TunerType];        /* Call device initialization for required TNR */        if (MapTable_p != NULL)            Error = MapTable_p->TNR_Init(InitParams_p,                                         Handle_p);        else            Error = TNR_ERROR_BAD_PARAMETER;    }    else        Error = TNR_ERROR_BAD_PARAMETER;    return Error;} /* TNR_Init() *//*****************************************************************************Name: TNR_Term()Description:    Performs any required tidying up in order to cleanly terminate the    TNR device.Parameters:    Tnr_p,          pointer to the TNR device.Return Value:    TNR_NO_ERROR,   the operation completed without error.See Also:    TNR_Init()*****************************************************************************/TNR_ErrorCode_t TNR_Term(TNR_Handle_t Handle){    return (*((TNR_MapTable_t **)Handle))->TNR_Term(Handle);} /* TNR_Term() *//*****************************************************************************Name: TNR_SetFrequency()Description:    Sets the frequency on the tuner device.  The frequency must be a multiple    of the tuner step value (usually 125KHz) -- the new frequency value    may not be an exact match for the required frequency.Parameters:    Tnr_p,              pointer to the TNR device.    NewFrequency_p,     pointer to caller supplied area to store new value.Return Value:    TNR_NO_ERROR,       the operation completed without error.    STI2C_xxxx,         there was a problem accessing the device.See Also:    Nothing.*****************************************************************************/TNR_ErrorCode_t TNR_SetFrequency(TNR_Handle_t Handle,                                 U32 Frequency,                                 U32 *NewFrequency_p){    return (*((TNR_MapTable_t **)Handle))->TNR_SetFrequency(        Handle,        Frequency,        NewFrequency_p);} /* TNR_SetFrequency() *//*****************************************************************************Name: TNR_GetStatus()Description:    Reads the status of the TNR device.Parameters:    Tnr_p,      pointer to the TNR device.    Status_p,   caller supplied area to read the status data.Return Value:    TNR_NO_ERROR,   the operation completed without error.    STI2C_xxxx,         there was a problem accessing the device.See Also:    Nothing.*****************************************************************************/TNR_ErrorCode_t TNR_GetStatus(TNR_Handle_t Handle,                              TNR_Status_t *Status_p){    return (*((TNR_MapTable_t **)Handle))->TNR_GetStatus(        Handle,        Status_p);} /* TNR_GetStatus() *//*****************************************************************************Name: TNR_GetStatus()Description:    Reads the status of the TNR device and ascertains whether the tuner is    locked.Parameters:    Tnr_p,      pointer to the TNR device.    Locked_p,   memory to set to TRUE or FALSE to indicate locked status.Return Value:    TNR_NO_ERROR,   the operation completed without error.    STI2C_xxxx,     there was a problem accessing the device.See Also:    Nothing.*****************************************************************************/TNR_ErrorCode_t TNR_IsTunerLocked(TNR_Handle_t Handle,                                  BOOL *Locked_p){    return (*((TNR_MapTable_t **)Handle))->TNR_IsTunerLocked(        Handle,        Locked_p);} /* TNR_IsTunerLocked() *//*****************************************************************************Name: TNR_SetBandWidth()Description:    Selects the best bandwidth filtering for the device based on the    passed in value.Parameters:    Tnr_p,      pointer to the TNR device.    Bw,         required bandwidth.    NewBw_p,       stores actual bandwidth selected for device.Return Value:    TNR_NO_ERROR,   the operation completed without error.See Also:    Nothing.*****************************************************************************/TNR_ErrorCode_t TNR_SetBandWidth(TNR_Handle_t Handle,                                 U32 Bw,                                 U32 *NewBw_p){    return (*((TNR_MapTable_t **)Handle))->TNR_SetBandWidth(        Handle, Bw, NewBw_p);} /* TNR_IsTunerLocked() *//* End of tnr.c */

⌨️ 快捷键说明

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