⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cx24143_all.h

📁 QPSK Tuner details, for conexant chipset.
💻 H
📖 第 1 页 / 共 5 页
字号:
/* cobra.h */

/****************************************************************************

* Conexant QPSK driver  (internal mode)                                                          			 *

* Copyright ? Shenzhen Coship Electronics Co.,LTD.            						 *

* All rights reserved.                                                  								 *

* Author: Sunfugong                                                   								 *

* Create Date:  2005/7/20                                                       						 *

* Update:   2005/8/01  Sunfugong												 *

*****************************************************************************/

#ifndef COBRA_H_DEFINED
#define COBRA_H_DEFINED

//#define DEBUG_SCAN_LOSE_CHANNEL

//#include "apifix.h"
#define STRIP_REGNAMES

/*******************************************************************************************************/
/* standard definitions */
/*******************************************************************************************************/
#define CAMARIC_FEATURES               /* Include Camaric feature code at compile-time if defined */

#undef  INCLUDE_VIPER                  /* Include Viper tuner code at compile-time if defined */
#undef  INCLUDE_CONSTELLATION          /* Include Constellation code at compile-time if defined */
#define OPTIMAL_FS_CODE                /* (CR 7482) Allow Optimal Fs selection for single-channel device */
#ifdef  CAMARIC_FEATURES
//#define INCLUDE_DISEQC2                /* Include Diseqc 2.x code at compile-time if defined */
#endif  /* #ifdef CAMARIC_FEATURES */

#define DCII_DEFAULT_SMOOTHCLK         /* (CR 8209) Include this define to set an explicit DCII MPGCLKSMOOTHEN setting */


/*******************************************************************************************************/
/* standard inclusions */
/*******************************************************************************************************/
#include <string.h>                    /* ANSI Standard */
#include "CS_typedef.h"
#include "cx24143_defs.h"


typedef ULONG VCO_LEN;
/*******************************************************************************************************/
/* Tuner specific */
/*******************************************************************************************************/
typedef struct VCO_EDGE
{                                      /* vco edges: */
  ULONG  lower;                /*   lower edge of VCO where lock-detect was detected */
  ULONG  upperthresh;          /*   upper edge of VCO where lock-detect was detected */
}VCO_EDGE;

/*******************************************************************************************************/
typedef struct VCO_BP
{                                      /* vco breakpoint struct */
  ULONG  percentage;           /*   break-point percentage */
  ULONG  breakpt;              /*   break point computed by: */
}VCO_BP;                               /*    (vco_edge.upper[n]+vco_edge[n+1].lower)/2 */
//===== for tuner start==============================================
#define CX24108_NOMSTEP        1000000UL         /* step size in hz to use when searching for vco edges */
#define CX24108_EDGESTEP       40UL              /* NOMSTEPS to step when looking for loss of lock */
#define CX24108_MINHILOWDIST   (2UL*MM)          /* catch binary search into same tuner pll cal'd freq */
#define CX24108_MAX_FIRSTEDGE  6                 /* max number of steps in attempt to lock into a vco to find edges */
#define CX24108_MAX_EDGEDIV    25                /* max bin search attempts to find vco edge */
#define CX24108_MAX_LOOP       20                /* max search attempts (40Mhz step size) to find edge. */

#define CX24108_VCOEDGES       11                /* vco count, breakpoint count */
#define CX24108_BPCNT          (CX24108_VCOEDGES-1)

#define CX24108_CPCS           8                 /* charge-pump current array count (array in TUNERPARMS) */
#define CX24108_SLOPES         3                 /* slope table array count (array in TUNERPARMS) */
#define CX24108_MSPS_1_TO_5    0                 /* array 0 of TUNERSLOPE (in TUNERPARMS) is for 1..5 Msps */
#define CX24108_MSPS_5_TO_15   1                 /* array 1 ... is for 5..15 Msps */
#define CX24108_MSPS_15_TO_45  2                 /* array 2 ... is for 15..45 Msps */
#define CX24108_MSTOTEMP       50                /* ms wait req'd to acheive op temp. at start/restart */
#define CX24108_VCOEDGE_LEN    (sizeof(VCO_EDGE)*(CX24108_VCOEDGES))
#define CX24108_VCOBP_LEN      (sizeof(VCO_BP)*(CX24108_BPCNT))
#define CX24108_BPDEFAULT      50                /* default breakpoint percentage */

#define CX24108_CPC_LOW        CPC_2MA           /* default tuner settings */
#define CX24108_CPC_MED        CPC_3MA           /* medium */
#define CX24108_CPC_HIGH       CPC_3MA           /* high setting */

#define CX24108_CPC_LOWPCT     50       
#define CX24108_CPC_HIPCT      50

#define CX24108_START_DIV2     0                 /* starting point of DIV/2 VCOs */
#define CX24108_START_DIV4     8                 /* starting point of DIV/4 VCOs */

#define CX24108_CPC_START      14UL              /* start point of CPC in bit-str sent to tuner via demod */

#define ANTI_ALIAS_FILTER_UNCERTANTY   1000UL    /* add 1mHz to BW filter setting */
#define SPECIAL_RANGE          1UL               /* tuner offset in mHz to induce, when NIM-A/B have equal Fdesired */

#define TUNER_BURST_SEQUENCY_WAIT_CYCLES  16UL   /* number of waiting loops for demod to become ready
                                                    to accept a new burst sequence */
#define TUNER_BURST_BYTE_WAIT_CYCLES       8UL   /* number of waiting loops for demod to become ready
                                                    to accept the next burst byte */

/*******************************************************************************************************/
/* macros */
/*******************************************************************************************************/
#define _TUNER_CX24108_lsbA(n) (n->tuner.cx24108.lsba)

/*******************************************************************************************************/
/* CX24108-specific enums */
/*******************************************************************************************************/
#ifndef cx24108prog_def                 
#define cx24108prog_def                /* allow tuner-specific enum to be include once at compile */
typedef enum cx24108prog{              /* CX24108 (Rosie) tuner control bit settings (ctl bits 20,19) */
  CX24108_BAND_PROG=0x00,              /* band select  */
  CX24108_VGA_PROG=0x01,               /* vga programming */
  CX24108_VCA_PROG=0x02,               /* vca programming */
  CX24108_PLL_PROG=0x03                /* pll programming */
} CX24108_PROG;
#endif  /* #ifndef cx24108prog_def */
// ==============tuner end======================================
/*******************************************************************************************************/
/* error codes */
/*******************************************************************************************************/
typedef enum  ApiErrno{                /* standardized method to relate error numbers to err strings */
  API_NOERR = 0,                       /*   0 = no error.  (first enum err item must be 0) */
  API_BADPTR,                          /*   bad pointer value passed by caller */
  API_INVALID_NIM,                     /*   NIM passed was invalid */
  API_NIM_OPENED,                      /*   NIM passed was already opened */
  API_SBIO_NULL,                       /*   user-supplied SBRead or SBWrite funct is NULL */
  API_TIMER_NULL,                      /*   timer function was NULL or invalid */
  API_NIM_NULL,                        /*   nim passed by caller is NULL */
  API_IO_READERR,                      /*   error encountered at read demod */
  API_IO_WRITERR,                      /*   error encountered at write demod */
  API_INVALID_TUNER,                   /*   tuner type is not valid (or not supported by driver) */
  API_TUNER_PARMS,                     /*   tuner parms passed was NULL */
  API_CONST_IQBUF,                     /*   NULL pointer passed at API_ConstGetPoints() */
  API_CONST_IQLOW,                     /*   caller asked for more constl pts than are currently recorded */
  API_RANGE,                           /*   Warning: caller wrote register with value out-of-bounds */
  API_BAD_PARM,                        /*   bad parameter passed by caller -- see file/line to determine error */
  API_PARM_RANGE,                      /*   parm value passed was out of valid range */
  API_SETILLEGAL,                      /*   caller asked to set demod into a condition that is illegal. */
  API_BAD_RTNVAL,                      /*   unexpected return value received from hardware (register) */
  API_LOCKIND,                         /*   unable to read a lockind at API_GetLockIndicators() */
  REG_MATCH_IDX,                       /*   register array is corrupt */
  REG_HDWR_REWTERR,                    /*   hardware read,mask,write error during write op */
  REG_MATCH_TRX,                       /*   raw data to external data translation error */
  REG_MATCH_DTRX,                      /*   external data to raw data translation error */
  REG_VERFY_IDX,                       /*   register map index does not match linear position */
  REG_VERFY_ADDR,                      /*   reg.map addr variable is inconsistent with expected range */
  REG_VERFY_REGRW,                     /*   reg.map regrw field contains invalid data */
  REG_VERFY_REGFLT,                    /*   reg.map regfilter field contains invalid data */
  REG_VERFY_REGDTP,                    /*   reg.map regdaattype field contains invalid data */
  REG_VERFY_DFLT,                      /*   reg.map default value is out of bounds */
  REG_VERFY_BCNT,                      /*   reg.map bit count/length values are questionable */
  REG_VERFY_DTLEN,                     /*   regdatatype field/len error (i.e. field is bit, but length > 1bit) */
  REG_HDWR_REGRDO,                     /*   reg.map:  Write attempted to read-only register */
  REG_HDWR_REGWTO,                     /*   reg.map:  read attempted to write-only register */
  API_INIT_XTAL,                       /*   initenv...() - crystal freq is out-of-bounds */
  API_INIT_VCO,                        /*   initenv...() - vcoinit is neither True not False */
  API_INIT_MPEG,                       /*   initenv...() - mpeg (default settings) struct is NULL */
  API_INIT_TUNER,                      /*   initenv...() - tuner parm passed is invalid */
  API_DEMOD_ERR,                       /*   demod register read has invalid setting */
  API_VITSETTING,                      /*   demod viterbi setting is zero */
  API_ERRBYTE,                         /*   demod is not set to return BYTE error counts */
  API_NOTSUPPORT,                      /*   feature not supported by driver */
  API_IQ_NULL,                         /*   IQPAK pointer was NULL */
  API_VCONO,                           /*   invalid vco number selected in driver */
  API_TUNERTYPE,                       /*   tuner type is invalid */
  API_BAD_BP,                          /*   attempt to set breakpoint percentage with invalid breakpoint% */
  API_BAD_CXCTL,                       /*   Invalid setting for tuner control bits (bit2 20, 19) */
  API_BAD_CXDATA,                      /*   data to be sent to tuner fails range check */
  API_BAD_CXMETH,                      /*   tuner i/o method is invalid see TUNER_io_method setting */
  API_TUNERERR,                        /*   tuner -> unable to set tuner to default i/o settings */
  API_TUNERIO,                         /*   tuner -> unable to perform i/o to tuner */
  API_TUNEREDGE,                       /*   unable to find a tuner edge */
  API_BAD_DIV,                         /*   API: Averted div by zero error -- results are undef */
  API_TUNERPARMS,                      /*   tunerparms passed by caller contains invalid settings */
  API_VITSET,                          /*   viterbi settings are incorrect */
  API_IQ_IO,                           /*   unable to read I, Q pairs from hardware (shared reg.) */
  API_CXTYPE,                          /*   unable to determine demod type (CxType) */
  API_BAD_SWA,                         /*   unable to successfully complete SW Assist Acq funct */
  API_BADCXDATABND,                    /*   band data sent to tuner fails data range test */
  API_BADCXDATAVGA,                    /*   vga data sent to tuner fails data range test */
  API_BADCXDATAVCA,                    /*   vca data sent to tuner fails data range test */
  API_BADCXDATAPLL,                    /*   pll data sent to tuner fails data range test */
  API_TUNERREF,                        /*   invalid tuner reference divider setting */
  API_TUNERVCO,                        /*   No valid VCO exists for the selected frequency */
  API_LNB_MSGLEN,                      /*   LNB message less-than 3 bytes in length */
  API_LNB_STALLED,                     /*   LNB message could not be sent in time allocated */
  API_LNB_BUSY,                        /*   LNB message busy flag is not set (should be set) */
  API_DEMOD_REVB_SINGLE,               /*   (invalid use of Rev B SW) */
  API_DISEQC_RXLEN,                    /*   Rx buffer passed-into API was too short */
  API_DISEQC_VERSION,                  /*   Wrong version to Rx Diseqc Messages */
  API_DISEQC_TIMEOUT,                  /*   demod took to long to rx diseqc message */
  API_PDMFOUT,                         /*   error setting pdmfout register */
  API_BAD_TUNER_FREQ,                  /*   the tuner frequency is outside the LNB search range limit */
  API_SCE_DEADLOCK,                    /*   symbol clock estimator deadlocks */
  API_DEMOD_UNSUPPORTED,               /*   demod is not supported by the driver */
                                       /* --> insert error codes above this point */
  API_EOERR,                           /*   this item must be last "valid" error number */
  API_NEGONE=0xffff                    /*   (Special OP used in 2115 to get last error encountered */
} APIERRNO;

/*******************************************************************************************************/
/* Register index */
/*******************************************************************************************************/
typedef enum RegIdx{                   /* register simplification ID -- this enum list MUST be in EXACT       */
                                       /* sequential order as entered in REGISTER struct.  When the driver   */
                                       /* is first started, each entry in REGISTER is tested for validity.   */
  CX24130_RSTCOBRA=0,                  /* first entry must be set to zero */
  CX24130_RSTCTL,                      
  CX24130_RSTBTL,
  CX24130_RSTDEMOD,
  CX24130_ACQREACQUIRE,
  CX24130_RSTVITERBI,
  CX24130_RSTRS,
  CX24130_SYSPRESET,
  CX24130_SYSRESET,
  CX24130_SYSVERSION ,
  CX24130_PLLMULT,//10
  CX24130_PLLGAIN,
  CX24130_MODULATIONREG,               /* added 9/11/01 */
  CX24130_SYSMODTYPE,
  CX24130_SYSTRANSTD,
  CX24130_DC2MODE,
  CX24130_ACQAUTOACQEN,
  CX24130_MPGDATAWIDTH,
  CX24130_MPGGAPCLK,
  CX24130_MPGCLKPOS,
  CX24130_IDLECLKDIS,//20
  CX24130_MPGSYNCPUNC,
  CX24130_MPGFAILMODE,                 /* added */
  CX24130_MPGFAILPOL,                  /* added */
  CX24130_MPGVALIDMODE,                /* added */
  CX24130_MPGVALIDPOL,                 /* added */
  CX24130_MPGSTARTMODE,
  CX24130_MPGSTARTPOL,
  CX24130_MPGTEIDIS,
  CX24130_MPGFAILNSVAL,
  CX24130_MPGCNTL1SEL,//30
  CX24130_MPGCNTL2SEL,
  CX24130_SYSSYMBOLRATE,
  CX24130_ACQPRFREQNOM,
  CX24130_ACQFREQRANGE,
  CX24130_ACQVITSINOM,
  CX24130_DC2MODESEL,
  CX24130_ACQVITCRNOM,
  CX24130_ACQCREN,
  CX24130_ACQSISEARCHDIS,
  CX24130_ACQREPEATCR,

⌨️ 快捷键说明

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