📄 dvb_nim.h
字号:
/**************************************************************************
(C)Copyright Cheertek Inc. 2002-2004,
D700, all right reserved.
Product : STB Firmware
****************************************************************************/
#ifndef __DVB_TUNER_H
#define __DVB_TUNER_H
/*! \file
* This module provides the tuner and demodulator control API.
*
*/
#include "dvb_type.h"
#include "db_defs.h"
#include "ap_defs.h"
#include "ap_scan.h"
/**
* Define the set tuner parameter mode.
*/
typedef enum
{
EN_TUNER_WAITING_NO,
/**< The function no check the frontend lock status. This is for change channel.
If the application want to know the lock status, need use \a DVB_TunerCheckLock() */
EN_TUNER_WAITING_LONG,
/**< The function wait long time to check the frontend lock status.
This is for transponder search.
The function's return value will indicate the lock status.*/
EN_TUNER_WAITING_SHORT
/**< The function wait short time to check the frontend lock status.
This is for auto scan.
The function's return value will indicate the lock status.*/
}EN_TUNER_WAITING;
/**
* Define the scan error type.
*/
typedef enum
{
EN_NIM_LOCKED,
EN_NIM_NO_LOCKED,
EN_NIM_ABORT
}EN_NIM_STATUS;
/**
* Define the scan type.
*/
typedef enum
{
EN_NIM_NORMAL,
EN_NIM_SCAN
}EN_NIM_SCAN_TYPE;
#ifdef PVR_ENABLE
/**
* Define the nim path.
*/
typedef enum
{
EN_NIM_DEVICE_ID_0 = 0,
EN_NIM_DEVICE_ID_1
}EN_NIM_DEVICE_ID;
#define DVB_NIM_TOUN_BURST_OFF (0)
#define DVB_NIM_TOUN_BURST_SA (1)
#define DVB_NIM_TOUN_BURST_SB (2)
bool8 DVB_NIM_SetActiveDeviceID(EN_NIM_DEVICE_ID enDevice);
/*! \fn bool8 DVB_NIM_SetActiveDeviceID(EN_NIM_DEVICE_ID enDevice)
\brief Set the NIM active Device ID.
The default NIM active device ID is EN_NIM_DEVICE_ID_0
\param enPath (Input)the NIM active Device ID.
\return TRUE - exist
\return FALSE - fail
*/
EN_NIM_DEVICE_ID DVB_NIM_GetActiveDeviceID(void);
/*! \fn EN_NIM_DEVICE_ID DVB_NIM_GetActiveDeviceID(void)
\brief get the NIM active device ID.
\return the NIM active device ID.
*/
#endif
void DVB_TunerReset(void);
/*! \fn void DVB_TunerReset(void)
\brief control hardware to reset the nim.
The interval time between DVB_TunerReset() and DVB_TunerInit() must over than 250ms.
The duration is depended the demodulator specific.
*/
bool8 DVB_TunerInit(void);
/*! \fn bool8 DVB_TunerInit(void)
\brief Initial the nim driver.
\return TRUE - success
\return FALSE - fail
*/
bool8 DVB_TunerCheckLock(void);
/*! \fn bool8 DVB_TunerCheckLock(void)
\brief Check the frontend lock status.
\return TRUE - The nim is locked.
\return FALSE - The nim is unlocked.
*/
u8 DVB_TunerGetStrength (void);
/*! \fn u8 DVB_TunerGetStrength (void)
\brief Get the signal strength.
\return Range: 0 to 100. When the nim is unlock, this value equal 0.
*/
u8 DVB_TunerGetQuality (void);
/*! \fn u8 DVB_TunerGetQuality (void)
\brief Get the signal quality.
\return Range: 0 to 100. When the nim is unlock, this value equal 0.
*/
void DVB_TunerLNBPower(bool8 b8Enable);
/*! \fn void DVB_TunerLNBPower(bool8 b8Enable)
\brief Set the LNB power on/off.
\param b8Enable (Input) Enable or disable the LNB power.
*/
bool8 DVB_TunerGetLNBPower(void);
/*! \fn bool8 DVB_TunerGetLNBPower(void)
\brief Get LNB power status.
\return TRUE for Power ON, FALSE for Power OFF.
*/
/**
* Define the motor contorl command type.
*/
typedef enum
{
EN_MOTOR_CMD_HALT, /**< Stop Positioner movement , igrone input parameter*/
EN_MOTOR_CMD_LIMIT_OFF, /**< Disable Limits , igrone input parameter*/
EN_MOTOR_CMD_LIMIT_EAST, /**< Set East Limit , igrone input parameter*/
EN_MOTOR_CMD_LIMIT_WEST, /**< Set West Limit , igrone input parameter*/
EN_MOTOR_CMD_DRIVE_EAST, /**< Drive Motor East , input parameter is Steps , move step and move continue both use this command */
EN_MOTOR_CMD_DRIVE_WEST, /**< Drive Motor West , input parameter is Steps , move step and move continue both use this command */
EN_MOTOR_CMD_STORE_POSITION, /**< Store Satellite Position XX, input parameter is Position Number */
EN_MOTOR_CMD_GOTO_POSITION, /**< Drive Motor to Satellite Position XX,, input parameter is Position Number */
EN_MOTOR_CMD_GOTO_REF, /**< Drive Motor to Reference Position , igrone input parameter*/
EN_MOTOR_CMD_GOTO_X /**< Drive Motor to a specific angle, input parameter range: -900(90.0 degree) < x <+ 900(90.0 degree) */
}EN_MOTOR_CMD;
#ifdef DVB_SYSTEM_S
bool8 DVB_MotorGotoX (u16 u16SatLongiatude, bool8 b8SatEast, u16 u16MyLatitude, bool8 b8MyNorth, u16 u16MyLongitude, bool8 b8MyEast);
/*! \fn bool8 DVB_MotorGotoX (u16 u16SatLongiatude, bool8 b8SatEast, u16 u16MyLatitude, bool8 b8MyNorth, u16 u16MyLongitude, bool8 b8MyEast)
\brief Goto X control for motor antenna.
\param u16SatLongiatude (Input) the value of satellite longiatude, this value is 10 times, example 123.4 degree==> 1234.
\param b8SatEast (Input) TRUE - Ease, FALSE - West
\param u16MyLatitude (Input) the value of satellite longiatude, this value is 10 times, example 123.4 degree==> 1234.
\param b8MyNorth (Input) TRUE - North, FALSE - South
\param u16MyLongitude (Input) the value of satellite longiatude, this value is 10 times, example 123.4 degree==> 1234.
\param b8MyEast (Input) TRUE - East, FALSE, West
\return TRUE - success
\return FALSE - fail
*/
bool8 DVB_MotorControl(EN_MOTOR_CMD enCmd, u16 u16Para) ;
/*! \fn bool8 DVB_MotorControl(EN_MOTOR_CMD enCmd, u16 u16para)
\brief DiSEqC motor Contorl Function
\param enCmd (Input) The DiSEqC Motor control command type,
\param u16Para (Input) the command parameter ,this maybe ignore in diferent command type.
\return TRUE - success
\return FALSE - fail
*/
EN_NIM_STATUS DVB_TunerSetParameter(u16 u16TPIdx, DB_TpDetail *pstTP, EN_TUNER_WAITING enWaitingType);
/*! \fn EN_NIM_STATUS DVB_TunerSetParameter(u16 u16TPIdx, DB_TpDetail *pstTP, EN_TUNER_WAITING enWaitingType)
\brief Setting the nim channel.
\param u16TPIdx (Input) The transponder index in database. When the value equal 0xFFFF,
this parameter will be ignore. This value can provide the driver to speed up the lock procedure.
\param pstTP (Input) the pointer of transponder information
\param enWaitingType (Input) the waiting type for lock status checking
\return EN_NIM_LOCKED - The frontend is locked.
\return EN_NIM_NO_LOCKED - The frontend is unlocked.
\return EN_NIM_ABORT - The procedure is aborted. Example: press a remote controller key.
*/
bool8 DVB_GetSatAngle(u16 u16PosX, u16 u16PosY, u16 u16SatelliteX, u16 *pu16Az, u16 *pu16El);
/*! \fn bool8 DVB_GetSatAngle(u16 u16PosX, u16 u16PosY, u16 u16SatelliteX, u16 *pu16Az, u16 *pu16El)
\brief Get the satellite azimuth and elevation angle. The actual value in all of parameters
need divede by 10. Example u16PosX=1002, the actual value is 100.2.
\param u16PosX (Input) - the local east longitude.
\param u16PosY (Input) - the local latitude.
\param u16SatelliteX (Input) - the east longitude of satellite.
\param pu16Az (Output) - the azimuth.
\param pu16El (Output) - the elevation angle.
\return TRUE - the input parameter is valid.
\return FALSE - the input parameter is invalid.
*/
bool8 DVB_TunerAutoScan(DVB_AutoScanParameter *pstAutoScanParameter);
/*! \fn bool8 DVB_TunerAutoScan (DVB_AutoScanParameter *pstScanParameter)
\brief Search a satellite service. The driver will call DVB_TunerScan_Info() to reply the status.
\param pstScanParameter (Input) the auto scan parameter
\return TRUE - success
\return FALSE - fail
*/
void DVB_TunerSetScanPolarityType(EN_SCAN_POLARITY_TYPE enScanPolarityType);
/*! \fn void DVB_TunerSetScanPolarityType(EN_SCAN_POLARITY_TYPE enScanPolarityType)
\brief This function will setup the Autoscan's Scan Polarity Type ,
It must be called before executing DVB_ScanSatellite(),
if it doesn't be called, The default Scan Polayiry Type is EN_SCAN_BOTH_POLARITY
\param enScanPolarity (Input) Scan Polrtity Typr
*/
void DVB_TunerPoll(void);
/*! \fn void DVB_TunerPoll(void)
\brief poll nim status.
*/
#endif
#if (defined (DVB_SYSTEM_T) || defined(DVB_SYSTEM_C)||defined(DVB_SYSTEM_DTMB))
/**
* Define the hierarchy mode of COFDM.
*/
typedef enum
{
EN_HIERARCHY_ERR,
EN_HIERARCHY_NON,
EN_HIERARCHY_1,
EN_HIERARCHY_2,
EN_HIERARCHY_4
}EN_HIERARCHY;
/**
* Define the FFT mode of COFDM.
*/
typedef enum
{
EN_FFT_ERR,
EN_FFT_2K,
EN_FFT_8K
}EN_FFT;
/**
* Define the guard interval of COFDM.
*/
typedef enum
{
EN_GI_ERR,
EN_GI_1_32,
EN_GI_1_16,
EN_GI_1_8,
EN_GI_1_4
} EN_GUARD;
/**
* Define the code rate of COFDM.
*/
typedef enum
{
EN_FEC_ERR,
EN_FEC_1_2,
EN_FEC_2_3,
EN_FEC_3_4,
EN_FEC_5_6,
EN_FEC_7_8
}EN_CODERATE;
/**
* Define the constellation of COFDM.
*/
typedef enum
{
EN_QPSK_ERR,
EN_QPSK,
EN_QAM16,
EN_QAM32,
EN_QAM64,
EN_QAM128,
EN_QAM256
}EN_CONSTELLATION;
//seven add for dtmb 2008/0618
typedef enum
{
EN_DTMB_TIM_240,
EN_DTMB_TIM_720,
EN_DTMB_TIM_AUTO
}EN_DTMB_TIME_DEINTERLEAVER;
typedef enum
{
EN_DTMB_GI_420,
EN_DTMB_GI_595,
EN_DTMB_GI_945,
EN_DTMB_GI_AUTO
}EN_DTMB_GUARD_INTERLEAVER;
typedef enum
{
EN_DTMB_CARRYMODE_MULTI,
EN_DTMB_CARRYMODE_SINGLE,
EN_DTMB_CARRYMODE_AUTO
}EN_DTMB_CARRYMODE;
typedef enum
{
EN_DTMB_QAM_4,
EN_DTMB_QAM_4_NR,
EN_DTMB_QAM_16,
EN_DTMB_QAM_32,
EN_DTMB_QAM_64,
EN_DTMB_QAM_AUTO
}EN_DTMB_QAM_MODE;
typedef enum
{
EN_DTMB_FEC_RATE_2_5,
EN_DTMB_FEC_RATE_3_5,
EN_DTMB_FEC_RATE_4_5,
EN_DTMB_FEC_RATE_AUTO
}EN_DTMB_FEC_RATE;
typedef enum
{
EN_DTMB_AUTO_SCAN,
EN_DTMB_MANUAL_SCAN
}EN_DTMB_SCAN_MODE;
typedef struct DTMB_Parameters
{
u16 u16Frequency;
EN_DTMB_CARRYMODE enCarryMode;
EN_DTMB_GUARD_INTERLEAVER enGI;
EN_DTMB_QAM_MODE enQAMMode;
EN_DTMB_TIME_DEINTERLEAVER enTimeDeinterleaver;
EN_DTMB_FEC_RATE enFECRate;
}DTMB_Parameters;
//end of DTMB
/**
* Define the structure of of COFDM parameter.
*/
typedef struct COFDM_Parameters
{
#ifdef DVB_SYSTEM_C
u16 u16SymbRateKB;
u8 u8QamType;
u8 u8SpectrumInv;
#else
EN_CONSTELLATION enConstellation;
EN_CODERATE enHPCodeRate;
EN_CODERATE enLPCodeRate;
EN_GUARD enGI;
EN_FFT enFFT;
EN_HIERARCHY enHierarchy;
#endif
}DVB_COFDMParameters;
bool8 DVB_TunerGetParameter(DVB_COFDMParameters *pstParameter);
/*! \fn bool8 DVB_TunerGetParameter( DVB_COFDMParameters *pstParameter)
\brief Get the COFDM parameters.
\param pstParameter (Output) The pointer of COFDM parameter structure.
\return TRUE - Success.
\return FALSE - Fail or no lock.
*/
#ifdef DVB_SYSTEM_DTMB
EN_NIM_STATUS DVB_TunerSetParameter(u16 u16TPIdx,u8 u8CarryMode, u8 u8GI, u8 u8QAMMode, u8 u8TIM, u8 u8FEC, EN_TUNER_WAITING enWaitingType);
#else
EN_NIM_STATUS DVB_TunerSetParameter(u16 u16TPIdx, EN_TUNER_WAITING enWaitingType);
/*! \fn EN_NIM_STATUS DVB_TunerSetParameter(u16 u16TPIdx, EN_TUNER_WAITING enWaitingType)
\brief Setting the nim analog channel.
\param u16TPIdx (Input) The transponder index. example: 21 to 69.
\param enWaitingType (Input) the waiting type for lock status checking
\return EN_NIM_LOCKED - The frontend is locked.
\return EN_NIM_NO_LOCKED - The frontend is unlocked.
\return EN_NIM_ABORT - The procedure is aborted. Example: press a remote controller key.
*/
#endif
#ifdef DVB_SYSTEM_DTMB
EN_NIM_STATUS DVB_TunerSetFrequency( u32 u32FreqKHz,
EN_DTMB_CARRYMODE enCarryMode,
EN_DTMB_GUARD_INTERLEAVER enGI,
EN_DTMB_QAM_MODE enQAMMode,
EN_DTMB_TIME_DEINTERLEAVER enTimeDeinterleaver,
EN_DTMB_FEC_RATE enFECRate,
EN_DTMB_SCAN_MODE u8ScanMode,
EN_TUNER_WAITING enWaitingType);
#else
#ifdef DVB_SYSTEM_C
void DVB_TunerSetQAM(u8 qam);
EN_NIM_STATUS DVB_TunerSetFrequency(u32 u32FreqKHz, u8 u8BWMHz, u16 u16Symbol, u8 u8QamType, EN_TUNER_WAITING enWaitingType);
#else
#ifdef CT216T
EN_NIM_STATUS DVB_TunerSetFrequency(u32 u32FreqKHz, u8 u8BWMHz, bool8 b8LPMode, EN_TUNER_WAITING enWaitingType);
#else
EN_NIM_STATUS DVB_TunerSetFrequency(u32 u32FreqKHz, u8 u8BWMHz, EN_TUNER_WAITING enWaitingType);
#endif
#endif
#endif
/*! \fn void DVB_TunerSetFrequency(u32 u32FreqKHz, u8 u8BWMHz)
\brief Setting nim channel parameter.
\param u32FreqKHz (Input) The center frequency.
\param u8BWMHz (Input) The bandwidth. example: 6, 7 or 8 MHz.
\param enWaitingType (Input) the waiting type for lock status checking
\return EN_NIM_LOCKED - The frontend is locked.
\return EN_NIM_NO_LOCKED - The frontend is unlocked.
\return EN_NIM_ABORT - The procedure is aborted. Example: press a remote controller key.
*/
bool8 DVB_TunerGetChInfo(u8 u8Channel, u32 *pu32FreqKHz, u8 *pu8BWMHz);
/*! \fn u32 DVB_TunerGetChInfo(u8 u8Channel, u32 *pu32FreqKHz, u8 *pu8BWMHz)
\brief Get the physical frequcney and bandwidth by channel number.
\param u8Channel (Input) The physical channel number.
\param pu32FreqKHz (Output) The physical frequency(KHz).
\param pu8BWMHz (Output) The physical bandwidth(MHz).
\return The number KHz frequcny.
*/
bool8 DVB_TunerGetChNo(u32 u32FreqKHz, u8 *pu8Channel);
/*! \fn bool8 DVB_TunerGetChNo(u32 u32FreqKHz, u8 *pu8Channel)
\brief Get the channel number by physical frequcney.
\param pu32FreqKHz (Input) The physical frequency(KHz).
\param pu8Channel (Output) The physical channel number.
\return TRUE or FALSE.
*/
void DVB_TunerGetFreqBound(u8 *pu8MinCh, u8 *pu8MaxCh);
/*! \fn void DVB_TunerGetFreqBound(u8 *pu8MinCh, u8 *pu8MaxCh)
\brief Get the min mininum and maxinum channel number.
\param pu8MinCh (Output) The mininum channel number.
\param pu8MaxCh (Output) The maxinum channel number.
*/
bool8 DVB_TunerGetHierarchy(void);
/*! \fn bool8 DVB_TunerGetHierarchy(void)
\brief Get the status of hierarchy.
\return TRUE - the hierarchy is exist in this frequency channel.
\return FALSE - the hierarchy mode is NOT exist in this frequency channel.
*/
void DVB_TunerAntLowActive(bool8 b8Enable);
/*! \fn void DVB_TunerAntLowActive(bool8 b8Enable)
\brief Using PIO low or high to active ANT power. It depends on different hardware desgin.
\param b8Enable (Input) TRUE: set PIO low to active. FALSE: set PIO high to active. Default is FALSE.
*/
void DVB_TunerPoll(void);
/*! \fn void DVB_TunerPoll(void)
\brief poll nim status.
*/
#endif//end of #if (defined (DVB_SYSTEM_T) || defined(DVB_SYSTEM_C))
void DVB_NIM_SetScanMode(bool8 b8Enable);
bool8 DVB_NIM_GetScanMode(void);
void DVB_NIM_SetScanType(EN_NIM_SCAN_TYPE enType);
EN_NIM_SCAN_TYPE DVB_NIM_GetScanType(void);
u32 DVB_TunerGetFrequency(u32 u32FreqKHz);
bool8 DVB_TunerCheckLock(void);
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -