📄 sat.c
字号:
/*****************************************************************************File Name : sat.cDescription : Wrapper layer for SAT component. All SAT function calls resolve to a device-specific implementation of the SAT layer e.g., STV0199 LNB control. Each SAT 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 SAT 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 "sat.h" /* SAT Device API */#include "sttbx.h"/* Private types/constants ------------------------------------------------ *//* Imported TNR modules */#ifdef INCLUDE_stv199 /* STV0199 LNB control */extern SAT_MapTable_t __STV0199LNBMapTable;#define STV0199LNBMAPTABLE &__STV0199LNBMapTable#else#define STV0199LNBMAPTABLE NULL#endif#ifdef INCLUDE_stv299 /* STV0299 LNB control */extern SAT_MapTable_t __STV0299LNBMapTable;#define STV0299LNBMAPTABLE &__STV0299LNBMapTable#else#define STV0299LNBMAPTABLE NULL#endif/* Private variables ------------------------------------------------------ *//* Private macros --------------------------------------------------------- *//* Private function prototypes -------------------------------------------- *//* Supported devices */static SAT_MapTable_t *SatMapTable[] ={ STV0199LNBMAPTABLE, STV0299LNBMAPTABLE};/* API routines ----------------------------------------------------------- *//*****************************************************************************Name: SAT_Init()Description: Initializes the SAT device for the ST LNBP.Parameters: InitParams_p, pointer to the initialization parameters.Return Value: SAT_NO_ERROR, the operation completed without error. SAT_ERROR_BAD_PARAMETER, one or more parameters were invalid. SAT_ERROR_LNB_HW, a hardware error in the LNB circuit.See Also: SAT_Term()*****************************************************************************/SAT_ErrorCode_t SAT_Init(SAT_InitParams_t *InitParams_p, SAT_Handle_t *Handle_p, SAT_Capability_t *Capability_p){ SAT_ErrorCode_t Error = SAT_NO_ERROR; SAT_MapTable_t *MapTable_p; /* Check whether or not the device is supported */ if (InitParams_p->SatType < SAT_DEVICE_UNKNOWN) { MapTable_p = SatMapTable[InitParams_p->SatType]; /* Call device initialization for required TNR */ if (MapTable_p != NULL) Error = MapTable_p->SAT_Init(InitParams_p, Handle_p, Capability_p); else Error = SAT_ERROR_BAD_PARAMETER; } else Error = SAT_ERROR_BAD_PARAMETER; return Error;} /* SAT_Init() *//*****************************************************************************Name: SAT_Term()Description: Performs any required tidying up in order to cleanly terminate the SAT device.Parameters: Sat_p, pointer to the SAT device.Return Value: SAT_NO_ERROR, the operation completed without error.See Also: SAT_Init()*****************************************************************************/SAT_ErrorCode_t SAT_Term(SAT_Handle_t Handle){ return (*((SAT_MapTable_t **)Handle))->SAT_Term(Handle);} /* SAT_Term() *//*****************************************************************************Name: SAT_GetConfig()Description: Obtains the current SAT device configuration and stores it in the configuration structure for the SAT device.Parameters: Sat_p, pointer to the SAT device. SatConfig_p, pointer to area to store current SAT config.Return Value: SAT_NO_ERROR, the operation completed without error. STI2C_xxxx, there was a problem accessing the device.See Also: SAT_SetConfig()*****************************************************************************/SAT_ErrorCode_t SAT_GetConfig(SAT_Handle_t Handle, SAT_Config_t *SatConfig_p){ return (*((SAT_MapTable_t **)Handle))->SAT_GetConfig( Handle, SatConfig_p);} /* SAT_GetConfig() *//*****************************************************************************Name: SAT_SetConfig()Description: Configures the SAT device's power/tone/polarization.Parameters: Sat_p, pointer to the SAT device. Config_p, pointer to the new device configuration.Return Value: SAT_NO_ERROR, the operation completed successfully. SAT_ERROR_BAD_PARAMETER, one of the parametes was invalid. STI2C_xxxx, there was a problem accessing the device.See Also: SAT_GetConfig()*****************************************************************************/SAT_ErrorCode_t SAT_SetConfig(SAT_Handle_t Handle, SAT_Config_t *Config_p){ return (*((SAT_MapTable_t **)Handle))->SAT_SetConfig( Handle, Config_p);} /* SAT_SetConfig() *//* End of sat.c */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -