123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535 |
- /******************************************************************************/
- /**
- *
- * \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 <string.h>
- #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, /**<None LNB */
- }Ant_LNB_TYPE_e;
- typedef enum
- {
- DRIVE_WEST=0,
- DRIVE_EAST=1,
- ElevationWestMove=2,
- ElevationEastMove=3,
- STORE_NN=4,
- GOTO_NN=5,
- LIMIT_WEST=6,
- LIMIT_EAST=7,
- LIMIT_OFF=8,
- STOP=9,
- RECALCULATE=10,
- GOTO_XX = 11,
- WRITE_N0 = 12,
- WRITE_N1 = 13,
- WRITE_N2 = 14,
- WRITE_N3 = 15,
- DISEQC_RESET = 16,
- STANDBY = 17,
- POWERON = 18
- }Ant_DiSEqC1_2_Cmd_e;
- typedef enum
- {
- FAST = 1,
- SLOW,
- CONTINUOUS
- }Ant_SPEED_e;
- typedef enum
- {
- SEC_VOLTAGE_13,
- SEC_VOLTAGE_18,
- SEC_VOLTAGE_OFF
- } Ant_Voltage_e;
- typedef enum
- {
- TUNER_ID_MAIN = 0,
- TUNER_ID_SUB,
- }Ant_TunerID_e;
- typedef enum
- {
- SATINFO_LNBPOWER,
- SATINFO_12V,
- SATINFO_22KHZ,
- SATINFO_TONEBURSTMODE,
- SATINFO_DISEQC10PORT,
- SATINFO_DISEQC11PORT,
- SATINFO_MOTORMODE,
- SATINFO_POSITION,
- SATINFO_UNICABLE,
- SATINFO_UNICABLEIDX,
- SATINFO_UNICABLEPOS,
- SATINFO_ALL,
- }Ant_SatInfo_e;
- typedef enum
- {
- TPINFO_FREQ,
- TPINFO_SYMBOLRATE,
- TPINFO_POLARIZATION,
- TPINFO_ALL,
- }Ant_TpInfo_e;
- typedef enum
- {
- MOTORSEL_USER = 1 << 0,
- MOTORSEL_SAT = 1 << 1,
- MOTORSEL_ALL = MOTORSEL_USER | MOTORSEL_SAT,
- }Ant_MotorSel_e;
- typedef enum
- {
- UNICABLE_OFF = 0, /**< Unicable Off */
- UNICABLE_ON /**< Unicable On */
- }Ant_UnicableState_e;
- typedef enum
- {
- UNICABLE_INDEX1 = 0, /**< Unicable Idx1.1210 */
- UNICABLE_INDEX2, /**< Unicable Idx2.1420 */
- UNICABLE_INDEX3, /**< Unicable Idx3.1680 */
- UNICABLE_INDEX4, /**< Unicable Idx4.2040 */
- UNICABLE_INDEX5, /**< Unicable Idx5.1284 */
- UNICABLE_INDEX6, /**< Unicable Idx6.1516 */
- UNICABLE_INDEX7, /**< Unicable Idx7.1632 */
- UNICABLE_INDEX8, /**< Unicable Idx8.1748 */
- }Ant_UnicableIdx_e;
- typedef enum
- {
- UNICABLE_SATA = 0, /**< Unicable Sat A */
- UNICABLE_SATB /**< Unicable Sat B */
- }Ant_UnicableSatPos_e;
- typedef enum
- {
- STATIC_MODE = 0,
- STATIC_MODE_MDU = 1,
- SPECIAL_MODE = 2,
- SPECIAL_MODE_MDU = 3
- } Ant_UniDiSEqCMode_e;
- typedef enum
- {
- STATIC_CHANGE_CHANNEL = 0,
- STATIC_POWER_OFF = 1,
- SPECIAL_UBXSIGNAL_ON = 2
- } Ant_UniDiSEqCStaticCmd_e;
- typedef enum
- {
- POLARITY_V,
- POLARITY_H,
- #ifdef DVBS_SUPPORT_RL_POLARITY
- POLARITY_L,
- POLARITY_R,
- #endif
- POLARITY_AUTO,
- }Polarity;
- /********************************************************************
- Type definitions of satellie connection control
- ********************************************************************/
- typedef struct
- {
- UINT16 usLowFreq; /**< LNB low frequency */
- UINT16 usHighFreq; /**< LNB high frequency */
- } Ant_LNB_CONTROL_st, *Ant_LP_LNB_CONTROL_st; /**< Long pointer of Ant_LNB_CONTROL_st */
- typedef struct
- {
- UINT32 usFreq; /**< Transponder frequency */
- UINT16 usSymRate; /**< Transponder symbol rate */
- UINT8 u8Polar; /**< Transponder polarzation */
- UINT8 u8TpType; /**< Transponder type S or S2 */
- UINT8 modulation; /**<Modulation type>*/
- UINT8 ucCode_rate; /**<Code rate>*/
- UINT8 ucSpec_inver; /**<Spectral inversion>*/
- } 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
|