ct202.h

来自「QPSK Tuner details, for conexant chipset」· C头文件 代码 · 共 497 行 · 第 1/2 页

H
497
字号
#define TUNER_STAND_SCAN_FREQ_STEP_KHZ      2000    /* 2M ,original 2000*//* 20000 kHz scan frequency step */
#define TUNER_STAND_SCAN_FREQ_LOW_LIM_KHZ	940000L	/* Low frequency limit in kHz */
#define TUNER_STAND_SCAN_FREQ_HIGH_LIM_KHZ	2160000L/* High frequency limit in kHz */
//********************************************************************************
//FAILURE CODES
//********************************************************************************
//TODO: decide a values
#define FAIL	FALSE
#define PASS	TRUE

//acquisition
#define AGC_FAILED			-17
#define CAR_EST_FAILED		-16
#define SYM_EST_FAILED		-15
#define SYM_TIMING_FAILED	-14
#define CAR_SEARCH_FAILED	-13
#define VIT_SEARCH_FAILED	-12
#define FSYNC_FAILED		-11

//monitor function status
#define MONITOR_NOT_READY	2
#define MONITOR_SATURATED	3
#define MONITOR_UNLOCK		4
#define PRBS_UNLOCK			5

//LNB
#define TXMSG_DEVICE_NOT_READY	-20
#define RXMSG_DEVICE_NOT_READY	-30
#define RXMSG_TIMEOUT			-31
#define RXMSG_NOT_RECIEVED		-32
#define RXMSG_PARITY_ERROR		-33

//********************************************************************************
//DATA TYPES
//********************************************************************************
#define UCHAR unsigned char
#define UINT8 unsigned char
#define UINT16 unsigned short
#define ULONG unsigned long

#define MERC_API	//enable I2C_HANDLE declaration

typedef unsigned char	u8;		/*!< 1 byte, range: 0 to 255 */
typedef unsigned short	u16;	/*!< 2 bytes, range: 0 to 65536 */
typedef unsigned long	u32;	/*!< 4 bytes, range: 0 to 4G */
typedef char			s8;		/*!< 1 byte, range: -128 to 127 */
typedef short			s16;	/*!< 2 bytes, range: -32768 to 32767 */
typedef long			s32;	/*!< 4 bytes, range: -2G to 2G */
typedef unsigned char	bool8;	/*!< 1 byte, range: TRUE or FALSE */
//typedef unsigned int    UINT;	/*!< 2 bytes, range: 0 to 65535 */
typedef unsigned short 	c16;	/**< 1 character 2 bytes, range: 0 to 65536 */


//transport stream config
typedef struct 
{
	int ts_mode;
	int ts_sdata_form;
	int ts_clk_edge;	
	int ts_clk_mode; 		
	int ts_strt_len; 	
	int ts_sync_pol;
	int ts_val_pol;
	int ts_err_pol;
	int ts_sclk_rate;
	int ts_parity;
	int ts_data_delay;
	int ts_clk_delay;
	int ts_pclk_smooth;
} ts_ctrl_S;

typedef enum coderate
{
	FEC_1_2 = 0x1,
	FEC_2_3 = 0x2,
	FEC_3_4 = 0x4,
	FEC_5_6 = 0x8,
	FEC_6_7 = 0x10,
	FEC_7_8 = 0x20
} coderate_t;

typedef enum cfo_range
{
	CFO_12_5= 0x1,
	CFO_6_3	= 0x2,
	CFO_3_1	= 0x4,
	CFO_1_6	= 0x8,
	CFO_0_8	= 0x10,
	CFO_0_4	= 0x20,
	CFO_0_2	= 0x40,
	CFO_0_1	= 0x80
} cfo_range_t;

// 11/24 reversed the bit order to match register
typedef enum
{
	AGC_DONE 			= 0x1,
	CAR_EST_DONE 		= 0x2,
	SYM_RATE_EST_DONE	= 0x4,
	SYM_TIM_LOCK		= 0x8,
	CAR_LOCK			= 0x10,
	VIT_LOCK 			= 0x20,
	FRM_LOCK			= 0x40,
	RX_LOCK				= 0x80
} lockstat_t;


//LNB signaling control parameters and DiSEqC messages to be sent
typedef struct 
{
	UINT8 lnb_msg [6];
	UINT8 lnb_msg_len;
	UINT8 lnb_mmsg;			//more messages indicator.
	UINT8 lnb_tburst;		//tone burst selection
	UINT8 lnb_cont;			//continuous selection
	UINT8 lnb_Vsel;			//voltage select
} lnb_cmd_S;

//the received DiSEqC message
typedef struct 
{
	UINT8 lnb_msg [6];
	UINT8 lnb_msg_len;
} lnb_reply_S;


typedef enum
{
	LNB_SUPPLY_OK		= 0x1,
	LNB_OVERCURRENT 	= 0x2,
	LNB_SHORT_CIRCUIT	= 0x4
} lnb_supply_stat_t;


typedef struct _CT_DiSEqC_PARAMETER
{
	u16		u16MsgLen;	 /*!< DiSEqC control message length */
	u8		au8Msg[8];	 /*!< DiSEqC control message */
	u8		u8Satellite; /*!< TRUE: Satellite A, FALSE Satellite B */
} CT_DiSEqC_PARAMETER;

typedef struct _CT_NIM_Channel
{ 
    u32		u32Freq;		/* Scan frquency (KHz)*/
    s32		s32FreqOffset;	/* Scan offset frquency (KHz)*/
    u8		u8Bandwidth;
    u8		u8SpectrumInv;
    u16		u16SymbRate;	/* Scan symbol rate */
    u16		u16Modulation;	/* Scan QAM size for DVB-C */
    u16		u16ClkInv;		/* TS clock invert or not */

    u16		u16Mode;		/* Scan Mode : normal / LP(HP)mode / auto scan */
    u32		u32Timeout;     /* Lock Max. time, Reserved for future used */
} CT_NIM_Channel;

typedef enum _EN_CT_NIM_NUM
{
	NIM_0,	/*!<NIM 0*/
	NIM_1	/*!<NIM 1*/
}EN_CT_NIM_NUM;

typedef enum _EN_DRV_RESULT 
{
	DRV_OK,						/*!< Return type is OK. */
	DRVERR_NOTOK,				/*!< Return type is not OK. */
	DRVERR_NOTSUPPORTED,		/*!< Return type is not supported. */
	DRVERR_NOTINITIALISED,		/*!< Return type is not initial. */
	DRVERR_HARDWAREFAIL,		/*!< Return type is hardware fail. */
	DRVERR_OUTOFRANGE,			/*!< Return type is parameter out of range. */
	DRVERR_UNCOMPLETE,			/*!< Return type is not complete. */
	DRVERR_TIMEOUT=0x100,		/*!< Return type is time out. */
	DRVERR_NOT_ENOUGH_MEMORY,	/*!< Return type is memory error. */
	DRVERR_OS_TASK=0x110,		/*!< Return type is task error. */
	DRVERR_OS_QUEUE,			/*!< Return type is queue error. */
	DRVERR_OS_EVENT,			/*!< Return type is event error. */
	DRVERR_OS_SEMAPHORE,		/*!< Return type is semaphore error. */
	DRVERR_OS_TIMER,			/*!< Return type is timer error. */
	DRVERR_UNKNOWN=0xFFFF		/*!< Return type is error. */
} EN_DRV_RESULT;
typedef struct 
{
	u32 SymRatemin;			//samples per second
	u32 SymRatemax;			//samples per second
	u32 Freqmin;			//Hz
	u32 Freqmax;			//Hz
}ScanRangeStruct;

typedef struct 
{
	u32 RF_freq;			//in HZ
	u32 symb_rate;			//in Sps
	u8 fs;					//in MHz
	
}ScanResultStruct;
typedef struct _CT_NIM_Scan
{
    u32		u32StartFreq;   /* Scan range Max Freq (KHz). */
    u32		u32EndFreq;     /* Scan range Min Freq (KHz). */
    u32		u32Step;		/* Scan range step Freq (KHz) */
    u32		u32Freq;		/* The first scan frquency (KHz)*/
} CT_NIM_Scan;
bool8 Initial();
bool8 GetReg(HCSHANDLE handle, u8 addr, u8 *u8data, u16 byteCount);
bool8 SetReg(HCSHANDLE handle, u8 addr, u8 *u8data, u16 byteCount);

bool8 SetTS(ts_ctrl_S ts_info);
bool8 SetTune(u32 freq, u32 datarate,CSHDITunerIndex bTunerIndex);
bool8 SetAcquire(u32 symbrate, coderate_t coderate,CSHDITunerIndex bTunerIndex);
bool8 SetCFOSearchRange(cfo_range_t cfo_range,CSHDITunerIndex bTunerIndex);
bool8 SetTone(CSHDISwitch nF22KCtrl,CSHDITunerIndex bTunerIndex);
bool8 SetLNB(bool8 lnb,CSHDITunerIndex bTunerIndex);
bool8 SetPolar(u16 polar,CSHDITunerIndex bTunerIndex);
bool8 SetTStype(bool8 b8Ts_type, u16 KBd_rate,CSHDITunerIndex bTunerIndex);
bool8 SetLNBmsg(lnb_cmd_S lnb_cmd,CSHDITunerIndex bTunerIndex);
void ReSync(CSHDITunerIndex bTunerIndex);
void SetTSOutput(bool8 b8Open);

bool8 GetCoderate(coderate_t *coderate,CSHDITunerIndex bTunerIndex);
bool8 GetCFO(s16 *cfoerror,CSHDITunerIndex bTunerIndex);
bool8 GetLockStat(lockstat_t *lockstat,CSHDITunerIndex bTunerIndex);
bool8 GetPartnum (u8 *partnum,CSHDITunerIndex bTunerIndex);
bool8 GetRevision (u8 *revcode);
bool8 GetAGClevel(u8 *agclevel);
bool8 GetCNR(u16 *u16CNR,CSHDITunerIndex bTunerIndex);
bool8 SetCNRmon(int CNRwin,CSHDITunerIndex bTunerIndex);
bool8 GetStrength(u16 *u16Strength,CSHDITunerIndex bTunerIndex);
bool8 GetCNE(u8 *u8CNR);
bool8 GetAQCFail(CSHDITunerIndex bTunerIndex);

CSQPSK_Error_t CT202ASendOptionCommand(CSHDITunerIndex bTunerIndex, BYTE ucOptionSwitch);
CSQPSK_Error_t CT202ASendDiSEqC10Command (CSHDITunerIndex bTunerIndex, BYTE bSwitchType, BYTE bCommittedByte, BYTE bToneBurstSel, BYTE bRepeat);
CSQPSK_Error_t CT202ASendDiSEqC11Command (CSHDITunerIndex bTunerIndex, BYTE bCommittedByte, BYTE bUnCommittedByte, BYTE bRepeat);
CSQPSK_Error_t CT202AToneBurstCommandOnly (CSHDITunerIndex bTunerIndex, BYTE bToneBurstSel);
CSQPSK_Error_t CT202ASendDiSEqC12Command (CSHDITunerIndex bTunerIndex, PBYTE pbValue, int nCommandNum);
CSQPSK_Error_t CT202AF22KSwitch ( CSHDITunerIndex bTunerIndex, CSHDISwitch nF22KCtrl );

CSQPSK_Error_t CT202ACheckLockStatus ( CSHDITunerIndex bTunerIndex, int *pnLockStatus );
CSQPSK_Error_t CT202AGetSignalBer ( CSHDITunerIndex bTunerIndex, DWORD *pdwBer );
CSQPSK_Error_t CT202AGetQuality(CSHDITunerIndex bTunerIndex,  int *pnSignalQuality);
CSQPSK_Error_t CT202AGetStrength(CSHDITunerIndex bTunerIndex, int *pnSignalStrength);
CSQPSK_Error_t CT202AF22KSwitch ( CSHDITunerIndex bTunerIndex, CSHDISwitch nF22KCtrl );
CSQPSK_Error_t CT202ALockChannel(CSHDITunerIndex bTunerIndex, CSQPSKCHANNEL *pCHPara);
CSQPSK_Error_t CT202ASetStandby ( CSHDITunerIndex bTunerIndex, int nStandby );
CSQPSK_Error_t CT202ASetClockPolarity ( CSHDITunerIndex bTunerIndex, T_ClockPolarity clockPol);
int CT202GetSTSPercent(void);
int CT202STS(int  bTunerIndex, CSQPSKSignalParameter *pTranspondList, int nMaxLength, T_QPSKSateInfo stSateInfo, int *pnActLength, int nBenZhen);
#endif

⌨️ 快捷键说明

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