/******************************************************************************/ /** * * \file mid_sat_antenna.h * * \brief DVB satellie antenna controler * * \note Copyright (c) 2014 Sunplus Technology Co., Ltd. \n * All rights reserved. * * \author * ******************************************************************************/ #ifndef _MID_SAT_ANTENNA_H #define _MID_SAT_ANTENNA_H #ifdef CONFIG_DVB_SYSTEM_DVBS_SUPPORT /******************************************************************** Including Files ********************************************************************/ #include #include "drv_types.h" #include "cdbi.h" #include "mid_common.h" /******************************************************************** Macros ********************************************************************/ /******************************************************************** Type definitions ********************************************************************/ // DUAL LNB FREQUENCY #define LNB1_9750 (9750) /**< 9750 MHz */ #define LNB1_10600 (10600) /**< 10600 MHz */ #define LNB1_9750_HIGH_FREQ (11700) /**< Low band: 11700 MHz */ #define LNB2_9750 (9750) /**< 9750 MHz */ #define LNB2_10750 (10750) /**< 10750 MHz */ #define LNB2_9750_HIGH_FREQ (11800) /**< High band: 11800 MHz */ #define LNB3_5150 (5150) /**< 5150 MHz */ #define LNB3_5750 (5750) /**< 5750 MHz */ #define LNB3_5150_HIGH_IF_FREQ (1550) /**< IF High band: 1550 MHz */ #define LNB_C_Ku_DEVIDING_LINE (6400) #ifdef CONFIG_DVB_SYSTEM_DVBS_UNICABLE_SUPPORT #define UnicableCMDDelay 270 #define UniCableShiftConstant 350 #define UnicableStepFreqMHz 4 #endif /******************************************************************** Enumeration ********************************************************************/ typedef enum { HW_RESET = 0, /**< DiSEqC reset type HW Reset */ SW_RESET, /**< DiSEqC reset type SW Reset */ ALL_RESET /**< DiSEqC reset type Both HW and SW Reset */ } Ant_DiSEqC_ResetType_e; typedef enum { DISEQC_NONE = 0, /**< Without any DiSEqC device */ DISEQC_10, /**< DiSEqC 1.0 switch */ DISEQC_11, /**< DiSEqC 1.1 switch */ DISEQC_10_11, /**< DiSEqC 1.0 switch with DiSEqC 1.1. switch */ DISEQC_Type_Max, /**< The max index of DiSEqC type */ }Ant_DisEqc_Type_e; typedef enum { DISEQC10_A = 0, /**< DiSEqC 1.0 port A */ DISEQC10_B, /**< DiSEqC 1.0 port B */ DISEQC10_C, /**< DiSEqC 1.0 port C */ DISEQC10_D, /**< DiSEqC 1.0 port D */ DISEQC10_NONE, /**< DiSEqC 1.0 disable */ DISEQC10_Switch_Max, /**< The max index of DiSEqC 1.0 port */ }Ant_DisEqc10_SwitchNum_e; typedef enum { DISEQC11_1 = 0, /**< DiSEqC 1.1 port 1 */ DISEQC11_2, /**< DiSEqC 1.1 port 2 */ DISEQC11_3, /**< DiSEqC 1.1 port 3 */ DISEQC11_4, /**< DiSEqC 1.1 port 4 */ DISEQC11_5, /**< DiSEqC 1.1 port 5 */ DISEQC11_6, /**< DiSEqC 1.1 port 6 */ DISEQC11_7, /**< DiSEqC 1.1 port 7 */ DISEQC11_8, /**< DiSEqC 1.1 port 8 */ DISEQC11_9, /**< DiSEqC 1.1 port 9 */ DISEQC11_10, /**< DiSEqC 1.1 port 10 */ DISEQC11_11, /**< DiSEqC 1.1 port 11 */ DISEQC11_12, /**< DiSEqC 1.1 port 12 */ DISEQC11_13, /**< DiSEqC 1.1 port 13 */ DISEQC11_14, /**< DiSEqC 1.1 port 14 */ DISEQC11_15, /**< DiSEqC 1.1 port 15 */ DISEQC11_16, /**< DiSEqC 1.1 port 16 */ DISEQC11_NONE, /**< DiSEqC 1.1 disable */ DISEQC11_Switch_Max, /**< The max index of DiSEqC 1.1 port */ }Ant_DisEqc11_SwitchNum_e; typedef enum { DISEQC12_DISABLE = 0, /**< Disable DiSEqC 1.2 option */ DISEQC12_ENABLE, /**< Enable DiSEqC 1.2 option */ DISEQC12_ENABLE_MAX, /**< The max index of DiSEqC 1.2 state */ }Ant_DISEQC12_SWITCH_e; typedef enum { DISEQC_CMD_RESET = 0, /**< when standby for loop_through facility */ DISEQC_CMD_DISEQCAUTO, /**< auto set diseqc and toneburst */ DISEQC_CMD_DISEQC10, DISEQC_CMD_DISEQC11, DISEQC_CMD_TONEBURST, DISEQC_CMD_LOWLNB, /**< select the low oscillator frequence */ DISEQC_CMD_HIGHLNB, /**< Select the High Local Oscillator frequency */ DISEQC_CMD_VR, /**< Select Vertical Polarisation (or Right circular) */ DISEQC_CMD_HL, /**< Select Horizontal Polarisation (or Left circular) */ DISEQC_CMD_POSA, /**< Select Satellite position A (or position C) */ DISEQC_CMD_POSB, /**< Select Satellite position B (or position D) */ DISEQC_CMD_S0A, /**< Select Switch Option A (e.g. positions A/B) */ DISEQC_CMD_S0B, /**< Select Switch Option A (e.g. positions A/B) */ DISEQC_CMD_MAX, } Ant_DiseqcCmdType_e; typedef enum { MOTOR_DISABLE = 0, /**< Disable motor option */ DISEQC12_ON, /**< DiSEqC 1.2 mode */ USALS_ON, /**< USALS mode */ MOTOR_MODE_MAX, /**< The max index of motor mode */ }Ant_MOTOR_MODE_e; typedef enum { TONE22K_ON = 0, /**< Enable 22KHz tone */ TONE22K_OFF, /**< Disable 22KHz tone */ TONE22K_AUTO /**< The max index of 22KHz tone state */ }Ant_TONE22K_TYPE_e; typedef enum { TONE_BURST_A = 0, /**< Tone burst A */ TONE_BURST_B, /**< Tone burst B */ TONE_BURST_OFF /**< Tone burst off */ }Ant_TONEBurst_TYPE_e; typedef enum { TONEVolt12_OFF = 0, /**< Disable 12V */ TONEVolt12_ON /**< Enable 12V */ }Ant_TONEVolt12_TYPE_e; typedef enum { LNBPOWER_OFF = 0, /**< Disable LNB power */ LNBPOWER_ON, /**< Enable LNB power */ LNBPOWER_MAX, }Ant_LNBPOWER_TYPE_e; typedef enum { LNB_POWER_LEVEL_OFF = 0, /**< Disable LNB power */ LNB_POWER_LEVEL_LOW, LNB_POWER_LEVEL_HIGH, LNB_POWER_LEVEL_MAX, }Ant_LNB_POWER_LEVEL_e; typedef enum { LNB_TYPE_CBAND = 0, /**< C band LNB */ LNB_TYPE_KUBAND, /**< Ku band LNB */ LNB_TYPE_USER, /**< User defined LNB */ LNB_TYPE_NONE, /***/ UINT8 ucCode_rate; /***/ UINT8 ucSpec_inver; /***/ } Ant_TRANSPONDER_st, *Ant_LP_TRANSPONDER_st; /**< Long pointer of Ant_TRANSPONDER_st */ typedef struct { UINT8 u8IsUniEnable; /**< Unicable enable or not */ UINT8 u8UniSatPos; /**< Unicable Sat Postion */ UINT8 u8UniIfIdx; /**< Unicable User Band If Index */ UINT16 usUniIfFreq; /**< Unicable User Band If Freq */ } Ant_UNICABLE_st, *Ant_LP_UNICABLE_st; /**< Long pointer of Ant_UNICABLE_st */ typedef struct { UINT8 u8msg [6]; /**< { framing, address, command, data [3] } */ UINT8 u8msg_len; /**< valid values are 3...6 */ }Ant_DiseqcMasterCmd; typedef struct { UINT8 u8ToneBurstPort; UINT8 u8DiSEqCMode; UINT8 u8DiSEqCPort10; UINT8 u8DiSEqCPort11; } Ant_DiseqcSwitchPara_st; typedef struct { Ant_DiseqcCmdType_e emCmdType; void *pPara1; void *pPara2; } Ant_DiseqcCmdPara_st; typedef struct { UINT8 u8LatitudeDirection; UINT8 u8LongitudeDirection; UINT16 u16Latitude; UINT16 u16Longitude; } Ant_UsalsSetting_UserLocation_st; typedef struct { UINT32 u32SatLongitude; UINT32 u32SatLongitudeDirection; } Ant_UsalsSetting_SatLocation_st; typedef struct { Ant_UsalsSetting_UserLocation_st UserLocation; Ant_UsalsSetting_SatLocation_st SatLocation; } Ant_UsalsSetting_st; typedef struct { Ant_DiSEqC1_2_Cmd_e enMode; Ant_SPEED_e enSpeed; int iSatNum; }Ant_DISEQC_1_2_st; typedef struct { Ant_UniDiSEqCStaticCmd_e command; UINT8 UserBand; UINT8 SatBank; UINT32 TPFreq; UINT8 Polar; UINT32 OFreq; UINT32 CurLnbFreq; UINT32 UBFreq; UINT32 StepValue; UINT32 ShiftConstant; } Ant_UnicableDiSEqCCmd_st; typedef struct { Ant_UniDiSEqCMode_e enMode; Ant_UnicableDiSEqCCmd_st enCmd; } Ant_UnicableDiSEqC_st; typedef struct _Ant_satellite_control { // modification flag Boolean bHasInit; /**< has init or not */ // common switch control parameters UINT8 u8LNBPower; /**< LNB power state */ UINT8 u812V; /**< 12V state */ UINT8 u822KHz; /**< 22KHz state */ // Basic DiSEqC control parameters UINT8 u8ToneBurstMode; /**< ToneBurst mode */ UINT8 u8DiSEqCMode; /**< DiSEqC mode */ UINT8 u8DiSEqC10Port; /**< DiSEqC 1.0 port */ UINT8 u8DiSEqC11Port; /**< DiSEqC 1.1 port */ UINT8 u8MotorMode; /**< DiSEqC 1.2/1.3 motor mode */ UINT8 u8Position; /**< DiSEqC 1.2 position */ // DiSEqC 1.2 & USALS control parameters Ant_TRANSPONDER_st stCurrentTp; /**< Current transponder */ Ant_LNB_CONTROL_st stLNBCtrl; /**< LNB controller */ Ant_UNICABLE_st stUnicableCtrl; /**< Unicable controller */ } Ant_SATELLITE_CONTROL_st, *Ant_LP_SATELLITE_CONTROL_st; /**< Long pointer of Ant_SATELLITE_CONTROL_st */ #ifdef CONFIG_DVB_SYSTEM_DVBS_UNICABLE_SUPPORT typedef int (*UniQueryBankFunPtr)(void); #endif /******************************************************************** Function prototypes ********************************************************************/ /**************************************************************************** ** Function: MID_SatCtrl_GetLnbFreqFromDualLNB ** ** Inputs: : UINT32 uiTuningFreqMHz ** ** UINT32 uiLnbFreq: Dobule LNB Frequency ** ** Outputs: NONE ** ** Returns: ** Current LNB Frequency ** ** Description: ** ******************************************************************************/ UINT32 MID_SatCtrl_GetLnbFreqFromDualLNB(UINT32 uiTuningFreqMHz, UINT32 uiLnbFreq); /** * @fn UINT32 MID_SatCtrl_GetIfFrequency(UINT32 TpFreqMHz); * @brief get the intermediate frequency of assigned transponder. * @param TpFreqMHz: Tp frequency (MHz) * @return u32Freq: intermediate frequency */ UINT32 MID_SatCtrl_GetIfFrequency(UINT32 TpFreqMHz); UINT32 MID_SatCtrl_GetTpFrequency(UINT32 u32TLNBFrequency, UINT32 u32Freq_IF_Mhz); /** * @fn int MID_SatCtrl_SetUsalsLocation(UINT8 Mode,UsalsSetting_UserLocation_t *UserLocal, UsalsSetting_SatLocation_t *SatLocal); * @brief Set User Location and Satellite Location for Usals * @param Mode: USER: Set User Location; SAT: Set Satellite Location * @param UserLocal: User Location param * @param SatLocal: Satellite Location param * @return void */ void MID_SatCtrl_SetUsalsLocation(Ant_MotorSel_e Mode,Ant_UsalsSetting_UserLocation_st *UserLocal, Ant_UsalsSetting_SatLocation_st *SatLocal); int MID_SatCtrl_SetCurrentSatelliteInfo(Ant_SatInfo_e Cmd, UINT8 value, SDBNetworkInfo_t *pstSat); int MID_SatCtrl_GetCurrentSatelliteInfo(Ant_SatInfo_e Cmd, UINT8 *value,Ant_LP_SATELLITE_CONTROL_st pstSat); /** * @fn int MID_SatCtrl_ConnectCurrentSatellite(void); * @brief Connect Satellite * @param ForceMotor * @return void */ int MID_SatCtrl_ConnectCurrentSatellite(UINT8 ForceMotor); void MID_SatCtrl_LNBPowerOff(void); /** * @fn int MID_SatCtrl_SetCurrentTpInfo(Ant_TpInfo_e Cmd, UINT16 value,Ant_LP_TRANSPONDER_st pstTp) * @brief Set current TP param, TP frequency only is RF Freq * @param Cmd: change one TP param or change all * @param value: if change one TP param, use this * @param pstTp: if change all TP param, use this * @return 0 */ int MID_SatCtrl_SetCurrentTpInfo(Ant_TpInfo_e Cmd, UINT32 value,Ant_LP_TRANSPONDER_st pstTp); void MID_SatCtrl_GetCurrentTpInfo( Ant_LP_TRANSPONDER_st pTp); void MID_SatCtrl_LNBCtrlSetFreq( UINT32 uwFreq ); UINT32 MID_SatCtrl_LNBCtrlGetFreq(void); UINT16 MID_SatCtrl_LNBCtrlGetHighFreq(void); UINT16 MID_SatCtrl_LNBCtrlGetLowFreq(void); void MID_SatCtrl_CBand_DualLNBSetType(UINT16 Freq); UINT16 MID_SatCtrl_CBand_DualLNBGetType(void); void MID_SatCtrl_Init(Ant_TunerID_e TunerId); void MID_SatCtrl_ChangeTuner(Ant_TunerID_e TunerId); int MID_SatCtrl_SetPolarPositioner(Ant_DiSEqC1_2_Cmd_e enMode, Ant_SPEED_e enSpeed, int iSatNum ); int MID_SatCtrl_GotoReference(void); int MID_SatCtrl_GotoXX(void); void MID_SatCtrl_SetPosition(INT32 i32Position); int MID_SatCtrl_SetMotorMode(Ant_MOTOR_MODE_e u8MotorMode,UINT8 u8MotorPosition); MID_Status_t MID_Playback_DVBSConnectCurrentTp(void); void MID_SatCtrl_LNBSetPowerLevel(void); #ifdef CONFIG_DVB_SYSTEM_DVBS_UNICABLE_SUPPORT void MID_SatCtrl_Unicable_LFSRPreSet(UINT16 userBand); UINT16 MID_SatCtrl_Unicable_GetDelayTime(void); UINT8 MID_SatCtrl_Unicable_IsUnicableOff(void); UINT16 MID_SatCtrl_Unicable_GetFreqbyIndex(UINT8 index); void MID_SatCtrl_Unicable_SetIfFreq(UINT16 Freq); void MID_SatCtrl_Unicable_GetIfFreq(UINT16 *Freq); /** * @fn UINT16 MID_SatCtrl_Unicable_Connect(UINT16 Freq, UINT8 Polar) * @brief Connect to Unicable equipment * @param Freq: IF Freq of normal tuning TP Param * @param Polar: Polarization of normal tuning TP Param * @return Unicable User band IF Freq, if return 0 , something error occur */ UINT16 MID_SatCtrl_Unicable_Connect(UINT16 Freq, UINT8 Polar); #endif int MID_SatCtrl_ReLoad_22KHz(void); void MID_SatCtrl_FrontendCtrl(UINT32 dCmd, void *pdPara); #endif //#if defined(CONFIG_DVB_SYSTEM_DVBS_SUPPORT) #endif //#ifndef _MID_SAT_ANTENNA_H