tcmu30311.c
上传用户:fy98168
上传日期:2015-06-26
资源大小:13771k
文件大小:126k
源码类别:

DVD

开发平台:

C/C++

  1. #include <gendef.h>    /* Generic Definitions system wide */
  2. #include <osp.h> 
  3. #include <i2c.h>     /* For I2C communication with the NIM */
  4. #include <dmd.h>        /* Macros, protos for demodulator interface */
  5. #include "tcmu30311.h"
  6. #define SUCCESS RETOK
  7. #define FAILURE RETFIAL1
  8. static UINT32 i2c_dmd_handle; /* stv0297 i2c handle */
  9. static UINT32 i2c_pll_handle; /* tuner i2c handle */
  10. static INT32   count;
  11. static  UINT32 InputQAMSize_MODE=64;
  12. static float InputFrequency ;   //Unit MHz 400.MHz
  13. static UINT32 InputSR ; //Unit KHz SR = 6.5Msps -> 6500
  14. static INT32 InputQAMSize; // 16,32,64,128,256
  15. static  KB_DMDModulation qam_mode;
  16. static INT32 _ExtClk; /* MasterClock */
  17. static FLAG_SAM RegTrigger;
  18. static INT32 RegNbI2cAccess;
  19. static FLAG_SAM RegTracking;
  20. static INT32 RegQAMSize;
  21. static INT32 RegSymbolRate;
  22. static FLAG_SAM Driv0297DataLost;
  23. static FLAG_SAM Driv0297DataLocked;
  24. static SIGNAL Driv0297Signal;
  25. static REGISTER RegMap [NBREG];
  26. static FIELD FieldMap[NBFIELD];
  27. static KB_DMDTunerParameters *TransponderCopy = NULL;
  28. #define QAM0297   0x00000297
  29. #define Tuner_Samsung 0x00030311
  30. #define Tuner_Thomson 0x00008722
  31. #define QAM0297_Revision 0x20
  32. #define Sysclk 57840000 //STV0297系统时钟频率 
  33. UINT32 SAMSignalVAGC(void);
  34. #define TUNER_PRINT_DEBUG 0
  35. UINT16  EXT_CLK=2880;
  36. static UINT32 SAMReadReg(UINT32 whichReg);
  37. int CheckInversion(void);
  38. /******************************************
  39. **函数名:SAMInit
  40. **输入:  无
  41. **输出:  无
  42. **功能:  初始化TCMU30311
  43. ********************************************/
  44. void SAMInit(KB_DMDTunerParameters *pParam)
  45. {
  46. TransponderCopy = pParam;
  47. QAM_Init();
  48. }
  49. UINT16 RegGetAGC2(void)
  50.   {
  51. UINT16 val=0;
  52. val = RegGetField(AGC2SD_LO);
  53. val += RegGetField(AGC2SD_HI)<<8;
  54. return(val);
  55.   }
  56. UINT32 SAMSignalVAGC(void)
  57. {
  58.    UINT32 value=0;
  59.    value=(unsigned short)(1000-(UINT16)RegGetAGC2()*1000/0x3ff);
  60.    if(value>300)  value-=10;
  61.      else if((value<20)&&(SAMCheckLock()))
  62.        value=(unsigned short)(RegGetAGC2()/8);
  63.    value/=4;       
  64.    return(value);
  65. }
  66. struct SigMap_t2
  67. {
  68. int agc;
  69. int dbuv;
  70. } g_sigmap[78] =
  71. {
  72. {117 , 301},
  73. {118, 308},
  74. {120, 314},
  75. {122, 322},
  76. {124, 331},
  77. {127, 341},
  78. {130, 354},
  79. {131, 358},
  80. {133, 369},
  81. {135, 377},
  82. {136, 380},
  83. {138, 391},
  84. {140, 399},
  85. {141, 408},
  86. {143, 418},
  87. {145, 429},
  88. {147, 439},
  89. {149, 454},
  90. {150, 459},
  91. {152, 468},
  92. {154, 478},
  93. {155, 491},
  94. {157, 500},
  95. {160, 502},
  96. {164, 505},
  97. {168, 507},
  98. {170, 507},
  99. {173, 509},
  100. {176, 509},
  101. {177, 511},
  102. {178, 512},
  103. {179, 513},
  104. {180, 513},
  105. {185, 522},
  106. {187, 534},
  107. {189, 544},
  108. {190, 557},
  109. {191, 563},
  110. {192, 583},
  111. {193, 593},
  112. {194, 611},
  113. {195, 628},
  114. {196, 649},
  115. {197, 663},
  116. {198, 678},
  117. {199, 687},
  118. {200, 701},
  119. {201, 711},
  120. {202, 731},
  121. {203, 740},
  122. {204, 751},
  123. {206, 764},
  124. {207, 770},
  125. {208, 780},
  126. {209, 789},
  127. {211, 802},
  128. {213, 811},
  129. {215, 820},
  130. {216, 830},
  131. {218, 839},
  132. {221, 851},
  133. {224, 865},
  134. {225, 871},
  135. {227, 880},
  136. {229, 890},
  137. {231, 902},
  138. {233, 912},
  139. {234, 920},
  140. {236, 930},
  141. {237, 942},
  142. {238, 951},
  143. {240, 966},
  144. {241, 971},
  145. {242, 980},
  146. {243, 991},
  147. {245, 1001},
  148. {246, 1011},
  149. {247, 1021},
  150. };
  151. //在要获取信号电平时先调用SAMSignalVAGC(),然后将返回直带入下面函数
  152. //信号质量直接调用SAMReadNoise()
  153. INT32 QamagcToDbuv(UINT32 nQamagc)
  154. {
  155.     int ret = 0;
  156. int i;
  157. for(i = 0;i< 78;i++)
  158. {
  159. if(g_sigmap[i].agc >= nQamagc)
  160. {
  161. ret = g_sigmap[i].dbuv;
  162. break;
  163. }
  164. }
  165. return ret;
  166. }
  167. /******************************************
  168. **函数名:SAMCalSAMlateVAFC
  169. **输入:  无
  170. **输出:  频偏KHz
  171. **功能:  在载波恢复时计算频偏
  172. ********************************************/
  173. INT32 SAMCalSAMlateVAFC(void)
  174. {
  175. INT32 temp;
  176.     SAMWriteReg(STV_CRL_11,0xff);
  177. temp   = SAMReadReg(STV_CRL_6);
  178. temp  += SAMReadReg(STV_CRL_7)<<8;
  179. temp  += SAMReadReg(STV_CRL_8)<<16;
  180. temp  += (SAMReadReg(STV_CRL_9)& 0x0f)<<24;
  181. if (temp >= 0x08000000)
  182. {
  183.    temp -= 0x10000000 ; // 0x10000000 = 2**28  
  184. }
  185. temp /= 2684354L ;  // (2**28)/100 = 268435456/100
  186. return(temp);
  187. }
  188. UINT32 SAMReadBER(void)
  189.   UINT16 _ErrMode=0,err_hi0, err_lo0 , err_hi1 , err_lo1 ;
  190.    UINT16    BER ;
  191.    INT32    int_tmp,powt;
  192.    float double_tmp ;
  193.    UINT32 NByte ;
  194.    UINT8 times=0,Trackinglock=0; 
  195.    UINT32 BlocksBertBER       ;
  196.       
  197. RegSetField(NBYTE,4);
  198.       
  199.    while((times<10)&&(Trackinglock==0))                      
  200.      {
  201.    Trackinglock += RegGetField(SYNCSTATE) ;        
  202.       times++;
  203.     }
  204.  
  205.    if(Trackinglock==0)
  206.    { 
  207.       return(99999999);
  208.    }
  209.    err_hi0 = RegGetField(ERRCOUNT_HI) ;
  210.    err_lo0 = RegGetField(ERRCOUNT_LO) ;
  211.    err_hi1 = RegGetField(ERRCOUNT_HI) ;
  212.    err_lo1 = RegGetField(ERRCOUNT_LO) ;
  213.    if(err_hi0 == err_hi1)
  214.      BER = err_lo0 + (err_hi0 <<8) ;
  215.    else
  216.      BER = err_lo1 + (err_hi1 <<8) ;
  217.   if(_ErrMode == 0)
  218.      {
  219.       if(RegGetField(BERT_ON) == 0)
  220.  {
  221.   double_tmp = (float)BER ;
  222.   int_tmp = RegGetField(NBYTE) ;
  223.   NByte=1;powt=0;
  224.   while(powt<2*int_tmp + 12)
  225.     {
  226.      NByte=NByte*2;
  227.      powt++; 
  228.     }
  229.     
  230.   if(RegGetField(ERR_SOURCE) == 0)
  231.   {
  232.    double_tmp /= (8*NByte) ;
  233.   }
  234.   else
  235.   {
  236.   double_tmp /= NByte ;
  237.   }
  238.     BlocksBertBER = double_tmp*1000000000 ;
  239.     RegSetField(BERT_ON,1) ;
  240.  } 
  241.         if(SAMSignalVAGC()<44)
  242.           BlocksBertBER=78000000;
  243.       return (BlocksBertBER);  
  244.         
  245.      } 
  246.    return (BlocksBertBER);
  247. }
  248. UINT32 SAMReadNoise(void)
  249. {UINT32 NoiseVal;/*Add ,TestNoiseVal the testing function*/
  250.  NoiseVal=SAMReadReg(STV_EQU_8);
  251.   NoiseVal=NoiseVal<<8;
  252.  //TestNoiseVal=SAMReadReg(STV_EQU_7);
  253.    NoiseVal|=(SAMReadReg(STV_EQU_7)&0xff);
  254.   //Print("The output signal quality is %ld %xn",TestNoiseVal,NoiseVal);
  255.  //Print("The output signal quality is %ldn",NoiseVal);
  256.  
  257.  if(NoiseVal>12000)
  258.   NoiseVal=12000;
  259.  if(NoiseVal<6000) 
  260.   NoiseVal=6000;
  261.  NoiseVal=12000-NoiseVal;
  262.  NoiseVal/=60;
  263.   //Print("The output signal quality is %ldn",NoiseVal);
  264.  return NoiseVal;
  265.  
  266. }
  267. int    Driv_RF_Level[101];
  268. void init_RF_Level(void)
  269. {
  270.  Driv_RF_Level[99] = 0;
  271.  Driv_RF_Level[98] = 15;   
  272.  Driv_RF_Level[97] = 30;
  273.  Driv_RF_Level[96] = 44;
  274.  Driv_RF_Level[95] = 57;
  275.  Driv_RF_Level[94] = 70;
  276.  Driv_RF_Level[93] = 83;
  277.  Driv_RF_Level[92] = 94;
  278.  Driv_RF_Level[91] = 105;
  279.  Driv_RF_Level[90] = 115;
  280.  Driv_RF_Level[89] = 125;
  281.  Driv_RF_Level[88] = 134;
  282.  Driv_RF_Level[87] = 143;
  283.  Driv_RF_Level[86] = 152;
  284.  Driv_RF_Level[85] = 160;
  285.  Driv_RF_Level[84] = 169;
  286.  Driv_RF_Level[83] = 177;
  287.  Driv_RF_Level[82] = 184;
  288.  Driv_RF_Level[81] = 191;
  289.  Driv_RF_Level[80] = 198;
  290.  Driv_RF_Level[79] = 205;
  291.  Driv_RF_Level[78] = 213;
  292.  Driv_RF_Level[77] = 221;
  293.  Driv_RF_Level[76] = 229;
  294.  Driv_RF_Level[75] = 236;
  295.  Driv_RF_Level[74] = 243;
  296.  Driv_RF_Level[73] = 250;
  297.  Driv_RF_Level[72] = 256;
  298.  Driv_RF_Level[71] = 263;
  299.  Driv_RF_Level[70] = 269;
  300.  Driv_RF_Level[69] = 275;
  301.  Driv_RF_Level[68] = 282;
  302.  Driv_RF_Level[67] = 289;
  303.  Driv_RF_Level[66] = 296;
  304.  Driv_RF_Level[65] = 302;
  305.  Driv_RF_Level[64] = 308;
  306.  Driv_RF_Level[63] = 314;
  307.  Driv_RF_Level[62] = 320;
  308.  Driv_RF_Level[61] = 325;
  309.  Driv_RF_Level[60] = 330;
  310.  Driv_RF_Level[59] = 335;
  311.  Driv_RF_Level[58] = 339;
  312.  Driv_RF_Level[57] = 344;
  313.  Driv_RF_Level[56] = 348;
  314.  Driv_RF_Level[55] = 352;
  315.  Driv_RF_Level[54] = 356;
  316.  Driv_RF_Level[53] = 360;
  317.  Driv_RF_Level[52] = 364;
  318.  Driv_RF_Level[51] = 368;
  319.  Driv_RF_Level[50] = 372;
  320.  Driv_RF_Level[49] = 375;
  321.  Driv_RF_Level[48] = 378;
  322.  Driv_RF_Level[47] = 381;
  323.  Driv_RF_Level[46] = 384;
  324.  Driv_RF_Level[45] = 387;
  325.  Driv_RF_Level[44] = 390;
  326.  Driv_RF_Level[43] = 392;
  327.  Driv_RF_Level[42] = 395;
  328.  Driv_RF_Level[41] = 397;
  329.  Driv_RF_Level[40] = 400;
  330.  Driv_RF_Level[39] = 402;
  331.  Driv_RF_Level[38] = 405;
  332.  Driv_RF_Level[37] = 408;
  333.  Driv_RF_Level[36] = 411;
  334.  Driv_RF_Level[35] = 414;
  335.  Driv_RF_Level[34] = 417;
  336.  Driv_RF_Level[33] = 420;
  337.  Driv_RF_Level[32] = 423;
  338.  Driv_RF_Level[31] = 426;
  339.  Driv_RF_Level[30] = 429;
  340.  Driv_RF_Level[29] = 432;
  341.  Driv_RF_Level[28] = 435;
  342.  Driv_RF_Level[27] = 438;
  343.  Driv_RF_Level[26] = 441;
  344.  Driv_RF_Level[25] = 444;
  345.  Driv_RF_Level[24] = 455;
  346.  Driv_RF_Level[23] = 465;
  347.  Driv_RF_Level[22] = 480;
  348.  Driv_RF_Level[21] = 500;
  349.  Driv_RF_Level[20] = 520;
  350.  Driv_RF_Level[19] = 540;
  351.  Driv_RF_Level[18] = 560;
  352.  Driv_RF_Level[17] = 580;
  353.  Driv_RF_Level[16] = 600;
  354.  Driv_RF_Level[15] = 620;
  355.  Driv_RF_Level[14] = 640;
  356.  Driv_RF_Level[13] = 660;
  357.  Driv_RF_Level[12] = 680;
  358.  Driv_RF_Level[11] = 700;
  359.  Driv_RF_Level[10] = 720;
  360.  Driv_RF_Level[9] = 740;
  361.  Driv_RF_Level[8] = 760;
  362.  Driv_RF_Level[7] = 780;
  363.  Driv_RF_Level[6] = 805;
  364.  Driv_RF_Level[5] = 830;
  365.  Driv_RF_Level[4] = 855;
  366.  Driv_RF_Level[3] = 880;
  367.  Driv_RF_Level[2] = 910;
  368.  Driv_RF_Level[1] = 950;
  369.  Driv_RF_Level[0] = 1000;
  370.   
  371. }
  372.  /*{{{ Ber_counter ()*/
  373. int Ber_counter_counter = 0;
  374. int Ber_counter(void)
  375.     {
  376.  int iBer=0,iBerLow=0,iBerHigh=0;
  377.  return -1;
  378.  if(RegGetField( BERT_ON )==0)
  379.     {  
  380.   iBerLow=RegGetField( ERRCOUNT_LO );
  381.   iBerHigh=RegGetField( ERRCOUNT_HI );
  382.   RegSetField( ERRCOUNT_LO,0x00 );
  383.   RegSetField( ERRCOUNT_HI,0x00 );
  384.   RegSetField( BERT_ON,1 );
  385.   iBer=((iBerHigh&0x00ff)<<8 | (iBerLow&0x00ff))&0x0000ffff;
  386.   Ber_counter_counter++;
  387.   if(Ber_counter_counter>300)
  388.      {
  389.    Ber_counter_counter = 0;
  390.    //RegSTV0297reset() ;
  391. //   do_report_zmy(severity_info,"bern");
  392.    //RegResetAfterDI() ;
  393.   }
  394.   return iBer;
  395.      }
  396.      else
  397.      {
  398.   return -1;
  399.      }
  400.     }
  401. /*{{{ End Ber_counter ()*/
  402. static int ber_count = 0;
  403. static char signal_count = 0;
  404. static int strengh[4];
  405. static int quality[4];
  406. void ResetSignalArray(void)
  407. {
  408. int i;
  409. for(i=0; i<4; i++)
  410. {
  411. strengh[i]=0;
  412. quality[i]=0;
  413. }
  414. signal_count = 0;
  415. }
  416. boolean Check_Signal_Strenth_Quality(int *Signal_Strengh,int *Signal_Quality)
  417.           //int *Signal_BER_FixedPoint_Multiply_10,int *Signal_BER_Exponent)
  418. {
  419.  int ber_count_temp = 0;
  420.  int v_agc1,i;
  421.  int cn_value;
  422.  int *Signal_BER_FixedPoint_Multiply_10 = 0;
  423.  int *Signal_BER_Exponent = 0;
  424.  ber_count_temp = Ber_counter();
  425.  if(ber_count_temp != -1)
  426.  {
  427.   ber_count=ber_count_temp;
  428.  }
  429.  
  430.  if (0)
  431.  {
  432.   if(ber_count<1)
  433.   {
  434.    *Signal_BER_FixedPoint_Multiply_10 = 0;
  435.    *Signal_BER_Exponent = -8;
  436.   }
  437.   else if(ber_count<10)
  438.   {
  439.    *Signal_BER_FixedPoint_Multiply_10 = ber_count*10;
  440.    *Signal_BER_Exponent = -7;
  441.   }
  442.   else if(ber_count<83)
  443.   {
  444.    *Signal_BER_FixedPoint_Multiply_10 = (ber_count*100)/83;
  445.    *Signal_BER_Exponent = -6;
  446.   }
  447.   else if(ber_count<838)
  448.   {
  449.    *Signal_BER_FixedPoint_Multiply_10 = (ber_count*100)/838;
  450.    *Signal_BER_Exponent = -5;
  451.   }
  452.   else if(ber_count<8388)
  453.   {
  454.    *Signal_BER_FixedPoint_Multiply_10 = (ber_count*100)/8388;
  455.    *Signal_BER_Exponent = -4;
  456.   }
  457.   else if(ber_count<83886)
  458.   {
  459.    *Signal_BER_FixedPoint_Multiply_10 = (ber_count*100)/83886;
  460.    *Signal_BER_Exponent = -3;
  461.          }
  462.   else if(ber_count<838860)
  463.          {
  464.    *Signal_BER_FixedPoint_Multiply_10 = (ber_count*100)/838860;
  465.    *Signal_BER_Exponent = -2;
  466.          }
  467.   else if(ber_count<8388608)
  468.   {
  469.    *Signal_BER_FixedPoint_Multiply_10 = (ber_count*100)/8388608;
  470.    *Signal_BER_Exponent = -1;
  471.   }
  472.  }
  473.  v_agc1=(RegGetField(AGC2SD_HI)<<8) + RegGetField(AGC2SD_LO);
  474.  
  475.  for(i=99;i>0;i--)
  476.  {
  477.   if(v_agc1<Driv_RF_Level[i])
  478.    break;
  479.  }
  480.  if(v_agc1==0)
  481.  {
  482.   i=99;
  483.  }
  484.   printf("v_agc1 %d %dn",v_agc1,i);
  485.  *Signal_Strengh=i;
  486.  /*strengh[signal_count % 4] = i;
  487.  if (signal_count>=4)
  488.   *Signal_Strengh = (strengh[0]+strengh[1]+strengh[2]+strengh[3])/4;
  489.  else
  490.   *Signal_Strengh=i;*/
  491.  cn_value=(RegGetField(NOISE_EST_HI)<<8) + RegGetField(NOISE_EST_LO);
  492.  printf("v_agc1 %d %dn",v_agc1,cn_value);
  493.  
  494.  i = RegGetQAMSize()   ;
  495.  
  496.  switch(i)
  497.  {
  498.  case 16:
  499.   cn_value -= 1500;
  500.   break;
  501.  case 32:
  502.   cn_value -= 2200;
  503.   break;
  504.  case 64:
  505.   cn_value -= 2700;
  506.   break;
  507.  case 128:
  508.   cn_value -= 3600;
  509.   break;
  510.  case 256:
  511.   cn_value -= 5800;
  512.   break;
  513.  }
  514.  if(cn_value<0)
  515.    cn_value =0;
  516.  else
  517.  {
  518. if(cn_value>6500)
  519.   cn_value = 6500;
  520. cn_value = 6500 - cn_value;
  521. cn_value= cn_value*100/6500;
  522.  }
  523.  
  524.  if(cn_value>99)
  525.    cn_value=99;
  526.  *Signal_Quality = cn_value;
  527.  /*quality[signal_count % 4] = cn_value;
  528.  if (signal_count>=4)
  529.   *Signal_Quality = (quality[0]+quality[1]+quality[2]+quality[3])/4;
  530.  else
  531.   *Signal_Quality = cn_value;
  532.  signal_count++;*/
  533.  //cn_value -= ((((cn_value << 7) * (rand() % 100)) / 100) >> 7 );
  534.  //*Signal_Quality = 100 - ( 200000 - ((cn_value * 200000) / 100 ));
  535.  return FALSE;
  536. }
  537. UINT32 SAMReadSCOffset(void)
  538. {
  539. return(0);
  540. }
  541. UINT8 SAMReadUncor(void)
  542. {
  543. return(0);
  544. }
  545. INT32 SAMCheckLock(void)
  546. {
  547. UINT32 status=0,temp=0;
  548. while((temp<200)&&(status<2))
  549.   {status += ((SAMReadReg(STV_RS_DESC_15)&0x80)>>7);
  550.    temp++;
  551.   }
  552.   
  553. if(status) //读取SYNC寄存器的FEL位为HIGH表明QAM锁定,为低没锁定  
  554.     {
  555.    return (TRUE);
  556. }
  557. else
  558. {
  559. return (FALSE);
  560. }
  561. }
  562. void SAMReset(void)  
  563. {
  564. SAMWriteReg(STV_CTRL_1,1);
  565. SAMWriteReg(STV_CTRL_1,0);
  566. }
  567. void SAMStopConnect(void)
  568. {
  569. SAMReset();
  570. }
  571. void SAMSetQAMMode(UINT8 qammode)
  572. {
  573. UINT8 agcref,lockthr,mseth,aref,mode,temp;
  574. mode=qammode;
  575. SAMWriteReg(STV_CTRL_9,0x7f); 
  576. switch(mode)
  577. {
  578.      case 1 :      //SAM_QAM16
  579. SAMWriteReg(STV_EQU_0,0x08);
  580. SAMWriteReg(STV_EQU_1,0x58);
  581. SAMWriteReg(STV_STLOOP_3,0x04);
  582. SAMWriteReg(STV_DELAGC_7,0x60);
  583. SAMWriteReg(STV_WBAGC_11,0xe1);
  584. SAMWriteReg(STV_CRL_0,0x37);
  585. break;
  586. case 2 : //SAM_QAM32
  587. SAMWriteReg(STV_EQU_0,0x18);
  588. SAMWriteReg(STV_EQU_1,0x58);
  589. break;
  590. case 3 : //SAM_QAM64
  591. SAMWriteReg(STV_EQU_0,0x46);
  592. SAMWriteReg(STV_EQU_1,0x5a);
  593. break;
  594. case 4 : //SAM_QAM128
  595. SAMWriteReg(STV_EQU_0,0x28);
  596. SAMWriteReg(STV_EQU_1,0x58);
  597. SAMWriteReg(STV_WBAGC_11,0xfe);
  598. SAMWriteReg(STV_CRL_0,0x0d);
  599. SAMWriteReg(STV_CRL_1,0x4a);
  600. SAMWriteReg(STV_CRL_3,0x00);
  601. SAMWriteReg(STV_CRL_4,0x00);
  602. SAMWriteReg(STV_CRL_5,0x00);
  603. SAMWriteReg(STV_CRL_6,0x00);
  604. SAMWriteReg(STV_CRL_7,0xa5);
  605. SAMWriteReg(STV_CRL_8,0xf0);
  606. SAMWriteReg(STV_CRL_9,0x0f);
  607. break;
  608. case 5 : //SAM_QAM256
  609. SAMWriteReg(STV_EQU_0,0x38);
  610. SAMWriteReg(STV_EQU_1,0x58);
  611. SAMWriteReg(STV_WBAGC_11,0xff);
  612. SAMWriteReg(STV_CRL_0,0x0d);
  613. SAMWriteReg(STV_CRL_1,0x39);
  614. SAMWriteReg(STV_CRL_3,0x00);
  615. SAMWriteReg(STV_CRL_4,0x00);
  616. SAMWriteReg(STV_CRL_5,0x00);
  617. SAMWriteReg(STV_CRL_6,0x4c);
  618. SAMWriteReg(STV_CRL_7,0x7e);
  619. SAMWriteReg(STV_CRL_8,0xf6);
  620. SAMWriteReg(STV_CRL_9,0x0f);
  621. break;
  622. default :
  623. SAMWriteReg(STV_EQU_0,0x48);
  624. SAMWriteReg(STV_EQU_1,0x58);
  625. break;
  626. }
  627. }
  628. void SAMResetAll(void)  
  629. {
  630. SAMWriteReg(STV_CTRL_0,1);
  631. SAMWriteReg(STV_CTRL_0,0);
  632. }
  633. static UINT32 SAMReadReg(UINT32 whichReg)
  634. {
  635. INT32 nret;
  636.    UINT32 databyte=0;
  637.    UINT8  sout[1];
  638. sout[0] =(UINT8)(whichReg);
  639. if(KB_I2CWriteWithStop(i2c_dmd_handle, 1, sout) == RETOK)
  640. {
  641. if(KB_I2CReadWithStop(i2c_dmd_handle, 1, sout) == RETOK)
  642. {
  643. databyte = (UINT32)sout[0];
  644. }
  645. }
  646.     return(databyte);
  647. }
  648. INT32 SAMWriteReg( UINT32 whichReg,UINT32 writeValue)
  649. {
  650.     INT32 nret;
  651. UINT8  sout[2];
  652. sout[0] = (UINT8)(whichReg);
  653. sout[1] = (UINT8)(writeValue);
  654. nret = KB_I2CWriteWithStop(i2c_dmd_handle, 2, sout);
  655. if (RETOK== nret)
  656. {
  657. return(SUCCESS);
  658. }
  659. else
  660. {
  661. Print("[tcmu30311.c] SAMWriteReg(): write demod register fail.");
  662. //printf("-=whichReg=0x%x, writeValue=0x%x=-n", whichReg, writeValue);
  663. return (FAILURE);
  664. }
  665. }
  666. INT32 SAMStartConnect(void)
  667. {
  668. UINT32 temp,i;
  669. FLAG_SAM fSam;
  670. FLAG_SAM InputSpectrumInverse = AUTO;
  671. STTBX_Print(("[tcmu30311.c] SAMStartConnect():Fre=%d, SR=%d, QAM=%d.n",
  672.   TransponderCopy->frequency,
  673.   TransponderCopy->details.qam.symbolRatekSs,
  674.   TransponderCopy->details.qam.modulation));
  675. if((InputFrequency==(float)(TransponderCopy->frequency/1000)))
  676.   if(InputSR==(UINT32)(TransponderCopy->details.qam.symbolRatekSs))
  677.    if(qam_mode ==TransponderCopy->details.qam.modulation)
  678.    if(SAMReadReg(STV_RS_DESC_15)&0x80)
  679.    {
  680.       STTBX_Print(("[tcmu30311.c] SAMStartConnect(): Locked 1  :)n"));
  681.       return(TRUE);   
  682.    }
  683. InputFrequency=(float)(TransponderCopy->frequency/1000);
  684. InputSR=(UINT32)(TransponderCopy->details.qam.symbolRatekSs);
  685. if((InputFrequency == 0) || (InputSR == 0))
  686. {
  687. InputFrequency = 355;
  688.     InputSR = 6875;    
  689. }
  690. qam_mode = (TransponderCopy->details.qam.modulation);  
  691. switch(qam_mode)
  692. {
  693.     case QAM_16 :      //SAM_QAM16
  694. InputQAMSize = 16;
  695. break;
  696. case QAM_32 : //SAM_QAM32
  697. InputQAMSize = 32;
  698. break;
  699. case QAM_64 : //SAM_QAM64
  700. InputQAMSize = 64;
  701. break;
  702. case QAM_128 : //SAM_QAM128
  703. InputQAMSize = 128;
  704. break;
  705. case QAM_256 : //SAM_QAM256
  706. InputQAMSize = 256;
  707. break;
  708. default :
  709. InputQAMSize = 64;
  710. break;
  711. }
  712. InputQAMSize_MODE=InputQAMSize;
  713. fSam = Acquisition(InputFrequency,InputSR,InputQAMSize,InputSpectrumInverse);
  714. if (fSam == YES) 
  715.  {
  716.    CarrierStatusSetAcquisitionStatus();
  717. STTBX_Print(("[tcmu30311.c] SAMStartConnect(): Locked 2.n"));
  718.         return(TRUE);
  719.  }
  720. STTBX_Print(("[tcmu30311.c] SAMStartConnect(): unLocked.n"));
  721. return(FALSE);
  722. }
  723. UINT8 SAMRevision(void)
  724. {
  725. UINT8 Revision;
  726. Revision=SAMReadReg(STV_CTRL_0);
  727. return(Revision);
  728. }
  729. INT32 SAMSetTunerFrequency(UINT32 freq1)
  730. {
  731.     UINT8  value_data,temp;
  732.     UINT32 divide_rate,i,frequency;
  733.     UINT8 byte[4];
  734.   
  735.     UINT16  m_cnt;
  736.     float tuner_offset;
  737.     UINT8    TunerS[6]  ;
  738.     frequency=(UINT32)(freq1*1000); 
  739.    
  740.    
  741.    if(frequency>860000  || frequency<50000 )
  742.     { Print("nTuner frequency is %ldn",frequency);
  743.       Print("Tuner frequency is ERROR!n");
  744. return(FALSE);
  745.     }
  746.      
  747.   if((UINT16)EXT_CLK ==2880) /*Select thomson tuner*/
  748.    {
  749.     divide_rate=((frequency+36125)*10)/625;/*First_IF 36125 */
  750.     byte[0] = (UINT8) ((divide_rate & 0x00007f00) >> 8);
  751.     byte[1] = (UINT8) (divide_rate & 0x000000ff);
  752.     byte[2] = 0x8e;
  753.     if(frequency>=50000&&frequency<170000)
  754.     {
  755. byte[3]=0x01;  /* Tuner frequency is low band!*/
  756.     }
  757.     if(frequency>=170000&&frequency<468000)
  758.     {
  759. byte[3]=0x02; /* Tuner frequency is mid band!*/
  760.     }
  761.     if(frequency>=468000&&frequency<=860000)
  762.     {
  763. byte[3]=0x08; /* Tuner frequency is high band!*/
  764.     }
  765.     SAMWriteTunerReg(byte, IIC_TUNER_ADDRESS_TH);
  766.    }
  767.   else  /*Select thomson tuner*/
  768.    {
  769.     tuner_offset =(float) 36.125; /*PAL MHz */
  770.     if      (freq1 < 171.) TunerS[5] = 0x01;/*P0 = 1until   48.25 and 168.25*/
  771.       else if (freq1 < 468.) TunerS[5] = 0x02;/*P1 = 1 between 175.25 and 463.25*/
  772.       else if (freq1 < 960.) TunerS[5] = 0x08;/*P3 = 1 between 471.25 and 855.25*/
  773.     /*  else QAMPrint("Out of frequency range for tunern");*/
  774.     freq1 += tuner_offset;
  775.     m_cnt = (UINT16)(16.0 * freq1);
  776.     /* Compute tuner settings */
  777.     TunerS[1] = IIC_TUNER_ADDRESS_SAM;
  778.     TunerS[2] = (UINT8) 0x007f & (m_cnt >> 8);
  779.     TunerS[3] = (UINT8) 0x00ff & m_cnt;
  780.     TunerS[4] = (UINT8) 0x8E;    /*TCMU30311PTB new version*/
  781.     /* send this data */
  782.     /*I2cReadWrite(WRITE,TunerS[1],&TunerS[2],4); */
  783.     SAMWriteTunerReg(&TunerS[2], IIC_TUNER_ADDRESS_SAM);
  784.    
  785.    } 
  786. }
  787. INT32 SAMWriteTunerReg(UINT8 *cont,UINT8 DEMOD_ADD)
  788. {
  789.     //INT32 nret,temp;
  790. UINT8 sout[4];
  791. int i = 0;
  792. INT32 ret = RETFIAL1;
  793. //UINT8 i;
  794. sout[0] = cont[0];
  795. sout[1] = cont[1];
  796. sout[2] = cont[2];
  797. sout[3] = cont[3];
  798. while(i <= 3)
  799. {
  800. if(RETOK == KB_I2COpen(IIC_TUNER_ADDRESS_TH, &i2c_pll_handle))
  801. {
  802. SAMEnableIICTuner(); //打开TUNER的IIC
  803. ret = KB_I2CWriteWithStop(i2c_pll_handle, 4, sout);
  804. SAMDisableIICTuner(); //关闭TUNER的IIC
  805. if(ret == RETFIAL1)
  806. {
  807. i++;
  808. Print("[tcmu30311.c] SAMWriteTunerReg() :write to PLL. [%x] ================= n",i);
  809. }
  810. else
  811. {
  812. i = 10;
  813. }
  814. KB_I2CClose(i2c_pll_handle);
  815. }
  816. else
  817. {
  818. i ++;
  819. Print("+++++++++++++++++++++++++++++++++++++ error open iic pll n");
  820. }
  821. }
  822.    return(SUCCESS);
  823. }
  824. void SAMEnableIICTuner(void)
  825. {
  826. SAMWriteReg(STV_CTRL_7, 0x78);
  827. SAMWriteReg(STV_CTRL_6, 0xc8);
  828. }
  829. void SAMDisableIICTuner(void)
  830. {
  831. UINT32 temp;
  832. temp = SAMReadReg(STV_CTRL_6);
  833. temp = (temp & 0x7f);
  834. SAMWriteReg(STV_CTRL_6,temp);
  835. }
  836. UINT8 FieldCreateMask(INT32 field)
  837. {
  838. INT32 i;
  839. UINT8 mask=0;
  840. for (i = 0; i < FieldMap[field].Bits; i++)
  841. {
  842. mask <<= 1 ;
  843. mask +=  1 ;
  844. }
  845. mask = mask << FieldMap[field].Pos;
  846. return mask;
  847. }
  848. void RegSetOneRegister(INT32 reg_id, UINT8 Data)
  849. {
  850. SAMWriteReg(RegMap[reg_id].Addr,Data); //hcao
  851. RegMap[reg_id].Value=Data;
  852. return ;
  853. }
  854. INT32 RegGetOneRegister(INT32 reg_id)
  855. {
  856. RegMap[reg_id].Value=SAMReadReg(RegMap[reg_id].Addr);
  857.     return(RegMap[reg_id].Value) ;
  858. }
  859. void FieldSetVal(INT32 field, INT32 fieldval)
  860. {
  861. INT32 value;
  862. FIELD *pfield;
  863. pfield=&(FieldMap[field]);
  864. if(pfield->Type == SIGNED)
  865. fieldval = (fieldval > 0 ) ? fieldval : fieldval + (1<<pfield->Bits);
  866. fieldval = pfield->Mask & (fieldval << pfield->Pos);
  867. RegMap[pfield->Reg].Value = (RegMap[pfield->Reg].Value & (~pfield->Mask)) + fieldval;
  868. }
  869. void RegSetField(INT32 field,INT32 value)
  870. {
  871. INT32 valread;
  872. FIELD *pfield;
  873. pfield=&(FieldMap[field]);
  874. RegGetOneRegister(pfield->Reg);
  875. FieldSetVal(field,value);
  876. RegSetOneRegister(pfield->Reg,RegMap[pfield->Reg].Value);
  877. }
  878. INT32 FieldGetVal(INT32 field)
  879. {
  880. INT32 value;
  881. FIELD *pfield;
  882. pfield=&(FieldMap[field]);
  883. value= RegMap[pfield->Reg].Value;
  884. value=(RegMap[pfield->Reg].Value & pfield->Mask) >> pfield->Pos;
  885. if((pfield->Type == SIGNED)&&(value>=(1<<(pfield->Bits-1))))
  886. value = value - (1<<pfield->Bits);
  887. return value;
  888. }
  889. INT32 RegGetField(INT32 field)
  890. {
  891. INT32 mask = 0,
  892. val=0;
  893. FIELD *pfield;
  894. pfield=&(FieldMap[field]);
  895. RegGetOneRegister(pfield->Reg);
  896. return FieldGetVal(field);
  897. }
  898. void  QAM64_RegInit(void)
  899. {
  900. INT16 i;
  901. INT32 S32val;
  902. S32val = Driv0297Signal.QAMSize;
  903. /* EQU_0*/
  904. RegMap[EQU_0].Addr   = 0x00 ;
  905. RegMap[EQU_0].Reset  = 0x48 ;
  906. if(S32val == 16)
  907. RegMap[EQU_0].Reset  = 0x08 ;
  908. if(S32val == 32)
  909. RegMap[EQU_0].Reset  = 0x18 ;
  910. if(S32val == 64)
  911. RegMap[EQU_0].Value  = 0x48 ;  
  912. if(S32val == 128)
  913. RegMap[EQU_0].Value  = 0x28 ;  
  914. if(S32val == 256)
  915. RegMap[EQU_0].Value  = 0x38 ;  
  916. strcpy(RegMap[EQU_0].Name,"EQU_0") ;
  917. /* FIELDS*/
  918. strcpy(FieldMap[U_THRESHOLD].Name,"U_THRESHOLD") ;
  919. FieldMap[U_THRESHOLD].Reg  = EQU_0 ;
  920. FieldMap[U_THRESHOLD].Pos  = 0     ;
  921. FieldMap[U_THRESHOLD].Bits = 4     ;
  922. FieldMap[U_THRESHOLD].Type = UNSIGNED ;
  923. FieldMap[U_THRESHOLD].Mask = FieldCreateMask(U_THRESHOLD) ;
  924. strcpy(FieldMap[MODE_SELECT].Name,"MODE_SELECT") ;
  925. FieldMap[MODE_SELECT].Reg  = EQU_0 ;
  926. FieldMap[MODE_SELECT].Pos  = 4     ;
  927. FieldMap[MODE_SELECT].Bits = 3     ;
  928. FieldMap[MODE_SELECT].Type = UNSIGNED ;
  929. FieldMap[MODE_SELECT].Mask = FieldCreateMask(MODE_SELECT) ;
  930. /* EQU_1*/
  931. RegMap[EQU_1].Addr   = 0x01 ;
  932. RegMap[EQU_1].Reset  = 0x58 ;
  933. RegMap[EQU_1].Value  = 0x69 ;
  934. strcpy(RegMap[EQU_1].Name,"EQU_1") ;
  935. /* FIELDS*/
  936. strcpy(FieldMap[BLIND_U].Name,"BLIND_U") ;
  937. FieldMap[BLIND_U].Reg  = EQU_1 ;
  938. FieldMap[BLIND_U].Pos  = 0     ;
  939. FieldMap[BLIND_U].Bits = 4     ;
  940. FieldMap[BLIND_U].Type = UNSIGNED ;
  941. FieldMap[BLIND_U].Mask = FieldCreateMask(BLIND_U) ;
  942. strcpy(FieldMap[INITIAL_U].Name,"INITIAL_U") ;
  943. FieldMap[INITIAL_U].Reg  = EQU_1 ;
  944. FieldMap[INITIAL_U].Pos  = 4     ;
  945. FieldMap[INITIAL_U].Bits = 4     ;
  946. FieldMap[INITIAL_U].Type = UNSIGNED ;
  947. FieldMap[INITIAL_U].Mask = FieldCreateMask(INITIAL_U) ;
  948. /* EQU_2*/
  949. RegMap[TST_EQU_2].Addr   = 0x02 ;
  950. RegMap[TST_EQU_2].Reset  = 0x00 ;
  951. RegMap[TST_EQU_2].Value  = 0x00 ;
  952. strcpy(RegMap[TST_EQU_2].Name,"TEST:EQU_2") ;
  953. /* EQU_3*/
  954. RegMap[EQU_3].Addr   = 0x03 ;
  955. RegMap[EQU_3].Reset  = 0x00 ;
  956. RegMap[EQU_3].Value  = 0x00 ;
  957. strcpy(RegMap[EQU_3].Name,"EQU_3") ;
  958. /* FIELDS*/
  959. strcpy(FieldMap[EQ_FSM_CTL].Name,"EQ_FSM_CTL") ;
  960. FieldMap[EQ_FSM_CTL].Reg  = EQU_3 ;
  961. FieldMap[EQ_FSM_CTL].Pos  = 0     ;
  962. FieldMap[EQ_FSM_CTL].Bits = 2     ;
  963. FieldMap[EQ_FSM_CTL].Type = UNSIGNED ;
  964. FieldMap[EQ_FSM_CTL].Mask = FieldCreateMask(EQ_FSM_CTL) ;
  965. /* FIELDS*/
  966. strcpy(FieldMap[EQ_COEFF_CTL].Name,"EQ_COEFF_CTL") ;
  967. FieldMap[EQ_COEFF_CTL].Reg  = EQU_3 ;
  968. FieldMap[EQ_COEFF_CTL].Pos  = 2     ;
  969. FieldMap[EQ_COEFF_CTL].Bits = 2     ;
  970. FieldMap[EQ_COEFF_CTL].Type = UNSIGNED ;
  971. FieldMap[EQ_COEFF_CTL].Mask = FieldCreateMask(EQ_COEFF_CTL) ;
  972. /* EQU_4*/
  973. RegMap[EQU_4].Addr   = 0x04 ;
  974. RegMap[EQU_4].Reset  = 0x00 ;
  975. RegMap[EQU_4].Value  = 0x00 ;
  976. strcpy(RegMap[EQU_4].Name,"EQU_4") ;
  977. /* FIELDS*/
  978. strcpy(FieldMap[NBLIND].Name,"NBLIND") ;
  979. FieldMap[NBLIND].Reg  = EQU_4 ;
  980. FieldMap[NBLIND].Pos  = 0     ;
  981. FieldMap[NBLIND].Bits = 1     ;
  982. FieldMap[NBLIND].Type = UNSIGNED ;
  983. FieldMap[NBLIND].Mask = FieldCreateMask(NBLIND) ;
  984. /* EQU_7*/
  985. RegMap[EQU_7].Addr   = 0x07 ;
  986. RegMap[EQU_7].Reset  = 0x00 ;
  987. RegMap[EQU_7].Value  = 0x00 ;
  988. strcpy(RegMap[EQU_7].Name,"EQU_7") ;
  989. /* FIELDS*/
  990. strcpy(FieldMap[NOISE_EST_LO].Name,"NOISE_EST_LO") ;
  991. FieldMap[NOISE_EST_LO].Reg  = EQU_7 ;
  992. FieldMap[NOISE_EST_LO].Pos  = 0     ;
  993. FieldMap[NOISE_EST_LO].Bits = 8     ;
  994. FieldMap[NOISE_EST_LO].Type = UNSIGNED ;
  995. FieldMap[NOISE_EST_LO].Mask = FieldCreateMask(NOISE_EST_LO) ;
  996. /* EQU_8*/
  997. RegMap[EQU_8].Addr   = 0x08 ;
  998. RegMap[EQU_8].Reset  = 0x00 ;
  999. RegMap[EQU_8].Value  = 0x00 ;
  1000. strcpy(RegMap[EQU_8].Name,"EQU_8") ;
  1001. /* FIELDS*/
  1002. strcpy(FieldMap[NOISE_EST_HI].Name,"NOISE_EST_HI") ;
  1003. FieldMap[NOISE_EST_HI].Reg  = EQU_8 ;
  1004. FieldMap[NOISE_EST_HI].Pos  = 0     ;
  1005. FieldMap[NOISE_EST_HI].Bits = 8     ;
  1006. FieldMap[NOISE_EST_HI].Type = UNSIGNED ;
  1007. FieldMap[NOISE_EST_HI].Mask = FieldCreateMask(NOISE_EST_HI) ;
  1008. /* INITDEM_0*/
  1009. RegMap[INITDEM_0].Addr   = 0x20 ;
  1010. RegMap[INITDEM_0].Reset  = 0x00 ;
  1011. RegMap[INITDEM_0].Value  = 0x00 ;
  1012. strcpy(RegMap[INITDEM_0].Name,"INITDEM_0") ;
  1013. /* FIELDS*/
  1014. strcpy(FieldMap[DEM_FQCY_LO].Name,"DEM_FQCY_LO") ;
  1015. FieldMap[DEM_FQCY_LO].Reg  = INITDEM_0 ;
  1016. FieldMap[DEM_FQCY_LO].Pos  = 0     ;
  1017. FieldMap[DEM_FQCY_LO].Bits = 8     ;
  1018. FieldMap[DEM_FQCY_LO].Type = UNSIGNED ;
  1019. FieldMap[DEM_FQCY_LO].Mask = FieldCreateMask(DEM_FQCY_LO) ;
  1020. /* INITDEM_1*/
  1021. RegMap[INITDEM_1].Addr   = 0x21 ;
  1022. RegMap[INITDEM_1].Reset  = 0x40 ;
  1023. RegMap[INITDEM_1].Value  = 0x00 ;
  1024. strcpy(RegMap[INITDEM_1].Name,"INITDEM_1") ;
  1025. /* FIELDS*/
  1026. strcpy(FieldMap[DEM_FQCY_HI].Name,"DEM_FQCY_HI") ;
  1027. FieldMap[DEM_FQCY_HI].Reg  = INITDEM_1 ;
  1028. FieldMap[DEM_FQCY_HI].Pos  = 0     ;
  1029. FieldMap[DEM_FQCY_HI].Bits = 8     ;
  1030. FieldMap[DEM_FQCY_HI].Type = UNSIGNED ;
  1031. FieldMap[DEM_FQCY_HI].Mask = FieldCreateMask(DEM_FQCY_HI) ;
  1032. FieldMap[DEM_FQCY_LO].Mask = FieldCreateMask(DEM_FQCY_LO) ;
  1033. /* INITDEM_2*/
  1034. RegMap[INITDEM_2].Addr   = 0x22 ;
  1035. RegMap[INITDEM_2].Reset  = 0x00 ;
  1036. RegMap[INITDEM_2].Value  = 0x00 ;
  1037. strcpy(RegMap[INITDEM_2].Name,"INITDEM_2") ;
  1038. /* FIELDS*/
  1039. strcpy(FieldMap[LATENCY].Name,"LATENCY") ;
  1040. FieldMap[LATENCY].Reg  = INITDEM_2 ;
  1041. FieldMap[LATENCY].Pos  = 0     ;
  1042. FieldMap[LATENCY].Bits = 8     ;
  1043. FieldMap[LATENCY].Type = UNSIGNED ;
  1044. FieldMap[LATENCY].Mask = FieldCreateMask(LATENCY) ;
  1045. /* INITDEM_3*/
  1046. RegMap[INITDEM_3].Addr   = 0x23 ;
  1047. RegMap[INITDEM_3].Reset  = 0x00 ;
  1048. RegMap[INITDEM_3].Value  = 0x00 ;
  1049. strcpy(RegMap[INITDEM_3].Name,"INITDEM_3") ;
  1050. /* FIELDS*/
  1051. strcpy(FieldMap[SCAN_STEP_LO].Name,"SCAN_STEP_LO") ;
  1052. FieldMap[SCAN_STEP_LO].Reg  = INITDEM_3 ;
  1053. FieldMap[SCAN_STEP_LO].Pos  = 0     ;
  1054. FieldMap[SCAN_STEP_LO].Bits = 8     ;
  1055. FieldMap[SCAN_STEP_LO].Type = UNSIGNED ;
  1056. FieldMap[SCAN_STEP_LO].Mask = FieldCreateMask(SCAN_STEP_LO) ;
  1057. /* INITDEM_4*/
  1058. RegMap[INITDEM_4].Addr   = 0x24 ;
  1059. RegMap[INITDEM_4].Reset  = 0x40 ;
  1060. RegMap[INITDEM_4].Value  = 0x40 ;
  1061. strcpy(RegMap[INITDEM_4].Name,"INITDEM_4") ;
  1062. /* FIELDS*/
  1063. strcpy(FieldMap[CHSCANITEN].Name,"CHSCANITEN") ;
  1064. FieldMap[CHSCANITEN].Reg  = INITDEM_4 ;
  1065. FieldMap[CHSCANITEN].Pos  = 7     ;
  1066. FieldMap[CHSCANITEN].Bits = 1     ;
  1067. FieldMap[CHSCANITEN].Type = UNSIGNED ;
  1068. FieldMap[CHSCANITEN].Mask = FieldCreateMask(CHSCANITEN) ;
  1069. /* FIELDS*/
  1070. strcpy(FieldMap[CHSCANITSOFT].Name,"CHSCANITSOFT") ;
  1071. FieldMap[CHSCANITSOFT].Reg  = INITDEM_4 ;
  1072. FieldMap[CHSCANITSOFT].Pos  = 6     ;
  1073. FieldMap[CHSCANITSOFT].Bits = 1     ;
  1074. FieldMap[CHSCANITSOFT].Type = UNSIGNED ;
  1075. FieldMap[CHSCANITSOFT].Mask = FieldCreateMask(CHSCANITSOFT) ;
  1076. /* FIELDS*/
  1077. strcpy(FieldMap[SCAN_STEP_HI].Name,"SCAN_STEP_HI") ;
  1078. FieldMap[SCAN_STEP_HI].Reg  = INITDEM_4 ;
  1079. FieldMap[SCAN_STEP_HI].Pos  = 0     ;
  1080. FieldMap[SCAN_STEP_HI].Bits = 6     ;
  1081. FieldMap[SCAN_STEP_HI].Type = UNSIGNED ;
  1082. FieldMap[SCAN_STEP_HI].Mask = FieldCreateMask(SCAN_STEP_HI) ;
  1083. /* INITDEM_5*/
  1084. RegMap[INITDEM_5].Addr   = 0x25 ;
  1085. RegMap[INITDEM_5].Reset  = 0x88 ;
  1086. RegMap[INITDEM_5].Value  = 0x08 ;
  1087. strcpy(RegMap[INITDEM_5].Name,"INITDEM_5") ;
  1088. /* FIELDS*/
  1089. strcpy(FieldMap[IN_DEMOD_EN].Name,"IN_DEMOD_EN") ;
  1090. FieldMap[IN_DEMOD_EN].Reg  = INITDEM_5 ;
  1091. FieldMap[IN_DEMOD_EN].Pos  = 7     ;
  1092. FieldMap[IN_DEMOD_EN].Bits = 1     ;
  1093. FieldMap[IN_DEMOD_EN].Type = UNSIGNED ;
  1094. FieldMap[IN_DEMOD_EN].Mask = FieldCreateMask(IN_DEMOD_EN) ;
  1095. /* FIELDS*/
  1096. strcpy(FieldMap[SCAN_ON].Name,"SCAN_ON") ;
  1097. FieldMap[SCAN_ON].Reg  = INITDEM_5 ;
  1098. FieldMap[SCAN_ON].Pos  = 6     ;
  1099. FieldMap[SCAN_ON].Bits = 1     ;
  1100. FieldMap[SCAN_ON].Type = UNSIGNED ;
  1101. FieldMap[SCAN_ON].Mask = FieldCreateMask(SCAN_ON) ;
  1102. /* FIELDS*/
  1103. strcpy(FieldMap[AUTOSTOP].Name,"AUTOSTOP") ;
  1104. FieldMap[AUTOSTOP].Reg  = INITDEM_5 ;
  1105. FieldMap[AUTOSTOP].Pos  = 5     ;
  1106. FieldMap[AUTOSTOP].Bits = 1     ;
  1107. FieldMap[AUTOSTOP].Type = UNSIGNED ;
  1108. FieldMap[AUTOSTOP].Mask = FieldCreateMask(AUTOSTOP) ;
  1109. /* FIELDS*/
  1110. strcpy(FieldMap[SCALE_A].Name,"SCALE_A") ;
  1111. FieldMap[SCALE_A].Reg  = INITDEM_5 ;
  1112. FieldMap[SCALE_A].Pos  = 4     ;
  1113. FieldMap[SCALE_A].Bits = 1     ;
  1114. FieldMap[SCALE_A].Type = UNSIGNED ;
  1115. FieldMap[SCALE_A].Mask = FieldCreateMask(SCALE_A) ;
  1116. /* FIELDS*/
  1117. strcpy(FieldMap[SCALE_B].Name,"SCALE_B") ;
  1118. FieldMap[SCALE_B].Reg  = INITDEM_5 ;
  1119. FieldMap[SCALE_B].Pos  = 2     ;
  1120. FieldMap[SCALE_B].Bits = 2     ;
  1121. FieldMap[SCALE_B].Type = UNSIGNED ;
  1122. FieldMap[SCALE_B].Mask = FieldCreateMask(SCALE_B) ;
  1123. /* DELAGC_0*/
  1124. RegMap[DELAGC_0].Addr   = 0x30 ;
  1125. RegMap[DELAGC_0].Reset  = 0xE6 ;
  1126. RegMap[DELAGC_0].Value  = 0x00 ;
  1127. strcpy(RegMap[DELAGC_0].Name,"DELAGC_0") ;
  1128. /* FIELDS*/
  1129. strcpy(FieldMap[AGC2MAX].Name,"AGC2MAX") ;
  1130. FieldMap[AGC2MAX].Reg  = DELAGC_0 ;
  1131. FieldMap[AGC2MAX].Pos  = 0     ;
  1132. FieldMap[AGC2MAX].Bits = 8     ;
  1133. FieldMap[AGC2MAX].Type = UNSIGNED ;
  1134. FieldMap[AGC2MAX].Mask = FieldCreateMask(AGC2MAX) ;
  1135. /* DELAGC_1*/
  1136. RegMap[DELAGC_1].Addr   = 0x31 ;
  1137. RegMap[DELAGC_1].Reset  = 0x91 ;
  1138. RegMap[DELAGC_1].Value  = 0x00 ;
  1139. strcpy(RegMap[DELAGC_1].Name,"DELAGC_1") ;
  1140. /* FIELDS*/
  1141. strcpy(FieldMap[AGC2MIN].Name,"AGC2MIN") ;
  1142. FieldMap[AGC2MIN].Reg  = DELAGC_1 ;
  1143. FieldMap[AGC2MIN].Pos  = 0     ;
  1144. FieldMap[AGC2MIN].Bits = 8     ;
  1145. FieldMap[AGC2MIN].Type = UNSIGNED ;
  1146. FieldMap[AGC2MIN].Mask = FieldCreateMask(AGC2MIN) ;
  1147. /* DELAGC_2*/
  1148. RegMap[DELAGC_2].Addr   = 0x32 ;
  1149. RegMap[DELAGC_2].Reset  = 0xFD ;
  1150. RegMap[DELAGC_2].Value  = 0x00 ;
  1151. strcpy(RegMap[DELAGC_2].Name,"DELAGC_2") ;
  1152. /* FIELDS*/
  1153. strcpy(FieldMap[AGC1MAX].Name,"AGC1MAX") ;
  1154. FieldMap[AGC1MAX].Reg  = DELAGC_2 ;
  1155. FieldMap[AGC1MAX].Pos  = 0     ;
  1156. FieldMap[AGC1MAX].Bits = 8     ;
  1157. FieldMap[AGC1MAX].Type = UNSIGNED ;
  1158. FieldMap[AGC1MAX].Mask = FieldCreateMask(AGC1MAX) ;
  1159. /* DELAGC_3*/
  1160. RegMap[DELAGC_3].Addr   = 0x33 ;
  1161. RegMap[DELAGC_3].Reset  = 0x44 ;
  1162. RegMap[DELAGC_3].Value  = 0x00 ;
  1163. strcpy(RegMap[DELAGC_3].Name,"DELAGC_3") ;
  1164. /* FIELDS*/
  1165. strcpy(FieldMap[AGC1MIN].Name,"AGC1MIN") ;
  1166. FieldMap[AGC1MIN].Reg  = DELAGC_3 ;
  1167. FieldMap[AGC1MIN].Pos  = 0     ;
  1168. FieldMap[AGC1MIN].Bits = 8     ;
  1169. FieldMap[AGC1MIN].Type = UNSIGNED ;
  1170. FieldMap[AGC1MIN].Mask = FieldCreateMask(AGC1MIN) ;
  1171. /* DELAGC_4*/
  1172. RegMap[DELAGC_4].Addr   = 0x34 ;
  1173. RegMap[DELAGC_4].Reset  = 0x29 ;
  1174. RegMap[DELAGC_4].Value  = 0x00 ;
  1175. strcpy(RegMap[DELAGC_4].Name,"DELAGC_4") ;
  1176. /* FIELDS*/
  1177. strcpy(FieldMap[RATIO_A].Name,"RATIO_A") ;
  1178. FieldMap[RATIO_A].Reg  = DELAGC_4 ;
  1179. FieldMap[RATIO_A].Pos  = 5     ;
  1180. FieldMap[RATIO_A].Bits = 3     ;
  1181. FieldMap[RATIO_A].Type = UNSIGNED ;
  1182. FieldMap[RATIO_A].Mask = FieldCreateMask(RATIO_A) ;
  1183. /* FIELDS*/
  1184. strcpy(FieldMap[RATIO_B].Name,"RATIO_B") ;
  1185. FieldMap[RATIO_B].Reg  = DELAGC_4 ;
  1186. FieldMap[RATIO_B].Pos  = 3     ;
  1187. FieldMap[RATIO_B].Bits = 2     ;
  1188. FieldMap[RATIO_B].Type = UNSIGNED ;
  1189. FieldMap[RATIO_B].Mask = FieldCreateMask(RATIO_B) ;
  1190. /* FIELDS*/
  1191. strcpy(FieldMap[RATIO_C].Name,"RATIO_C") ;
  1192. FieldMap[RATIO_C].Reg  = DELAGC_4 ;
  1193. FieldMap[RATIO_C].Pos  = 0     ;
  1194. FieldMap[RATIO_C].Bits = 3     ;
  1195. FieldMap[RATIO_C].Type = UNSIGNED ;
  1196. FieldMap[RATIO_C].Mask = FieldCreateMask(RATIO_C) ;
  1197. /* DELAGC_5*/
  1198. RegMap[DELAGC_5].Addr   = 0x35 ;
  1199. RegMap[DELAGC_5].Reset  = 0x8F ;
  1200. RegMap[DELAGC_5].Value  = 0x00 ;
  1201. strcpy(RegMap[DELAGC_5].Name,"DELAGC_5") ;
  1202. /* FIELDS*/
  1203. strcpy(FieldMap[AGC2_THRES].Name,"AGC2_THRES") ;
  1204. FieldMap[AGC2_THRES].Reg  = DELAGC_5 ;
  1205. FieldMap[AGC2_THRES].Pos  = 0     ;
  1206. FieldMap[AGC2_THRES].Bits = 8     ;
  1207. FieldMap[AGC2_THRES].Type = UNSIGNED ;
  1208. FieldMap[AGC2_THRES].Mask = FieldCreateMask(AGC2_THRES) ;
  1209. /* DELAGC_6*/
  1210. RegMap[DELAGC_6].Addr   = 0x36 ;
  1211. RegMap[DELAGC_6].Reset  = 0x80 ;
  1212. RegMap[DELAGC_6].Value  = 0x00 ;
  1213. strcpy(RegMap[DELAGC_6].Name,"DELAGC_6") ;
  1214. /* FIELDS*/
  1215. strcpy(FieldMap[DAGC_ON].Name,"DAGC_ON") ;
  1216. FieldMap[DAGC_ON].Reg  = DELAGC_6 ;
  1217. FieldMap[DAGC_ON].Pos  = 7     ;
  1218. FieldMap[DAGC_ON].Bits = 1     ;
  1219. FieldMap[DAGC_ON].Type = UNSIGNED ;
  1220. FieldMap[DAGC_ON].Mask = FieldCreateMask(DAGC_ON) ;
  1221. /* FIELDS*/
  1222. strcpy(FieldMap[FRZ2_CTRL].Name,"FRZ2_CTRL") ;
  1223. FieldMap[FRZ2_CTRL].Reg  = DELAGC_6 ;
  1224. FieldMap[FRZ2_CTRL].Pos  = 5     ;
  1225. FieldMap[FRZ2_CTRL].Bits = 2     ;
  1226. FieldMap[FRZ2_CTRL].Type = UNSIGNED ;
  1227. FieldMap[FRZ2_CTRL].Mask = FieldCreateMask(FRZ2_CTRL) ;
  1228. /* FIELDS*/
  1229. strcpy(FieldMap[FRZ1_CTRL].Name,"FRZ1_CTRL") ;
  1230. FieldMap[FRZ1_CTRL].Reg  = DELAGC_6 ;
  1231. FieldMap[FRZ1_CTRL].Pos  = 3     ;
  1232. FieldMap[FRZ1_CTRL].Bits = 2     ;
  1233. FieldMap[FRZ1_CTRL].Type = UNSIGNED ;
  1234. FieldMap[FRZ1_CTRL].Mask = FieldCreateMask(FRZ1_CTRL) ;
  1235. /* DELAGC_7*/
  1236. RegMap[DELAGC_7].Addr   = 0x37 ;
  1237. RegMap[DELAGC_7].Reset  = 0x70 ; 
  1238. RegMap[DELAGC_7].Value  = 0x00 ;
  1239. strcpy(RegMap[DELAGC_7].Name,"DELAGC_7") ;
  1240. /* FIELDS*/
  1241. strcpy(FieldMap[TIME_CST].Name,"TIME_CST") ;
  1242. FieldMap[TIME_CST].Reg  = DELAGC_7 ;
  1243. FieldMap[TIME_CST].Pos  = 4     ;
  1244. FieldMap[TIME_CST].Bits = 3     ;
  1245. FieldMap[TIME_CST].Type = UNSIGNED ;
  1246. FieldMap[TIME_CST].Mask = FieldCreateMask(TIME_CST) ;
  1247. /* FIELDS*/
  1248. strcpy(FieldMap[OVF_RATE_LO].Name,"OVF_RATE_LO") ;
  1249. FieldMap[OVF_RATE_LO].Reg  = DELAGC_7 ;
  1250. FieldMap[OVF_RATE_LO].Pos  = 0     ;
  1251. FieldMap[OVF_RATE_LO].Bits = 4     ;
  1252. FieldMap[OVF_RATE_LO].Type = UNSIGNED ;
  1253. FieldMap[OVF_RATE_LO].Mask = FieldCreateMask(OVF_RATE_LO) ;
  1254. /* FIELDS*/
  1255. strcpy(FieldMap[CORNER_RATE_LO].Name,"CORNER_RATE_LO") ;
  1256. FieldMap[CORNER_RATE_LO].Reg  = DELAGC_7 ;
  1257. FieldMap[CORNER_RATE_LO].Pos  = 0     ;
  1258. FieldMap[CORNER_RATE_LO].Bits = 4     ;
  1259. FieldMap[CORNER_RATE_LO].Type = UNSIGNED ;
  1260. FieldMap[CORNER_RATE_LO].Mask = FieldCreateMask(CORNER_RATE_LO) ;
  1261. /* DELAGC_8*/
  1262. RegMap[DELAGC_8].Addr   = 0x38 ;
  1263. RegMap[DELAGC_8].Reset  = 0x00 ;
  1264. RegMap[DELAGC_8].Value  = 0x00 ;
  1265. strcpy(RegMap[DELAGC_8].Name,"DELAGC_8") ;
  1266. /* FIELDS*/
  1267. strcpy(FieldMap[OVF_RATE_HI].Name,"OVF_RATE_HI") ;
  1268. FieldMap[OVF_RATE_HI].Reg  = DELAGC_8 ;
  1269. FieldMap[OVF_RATE_HI].Pos  = 0     ;
  1270. FieldMap[OVF_RATE_HI].Bits = 8     ;
  1271. FieldMap[OVF_RATE_HI].Type = UNSIGNED ;
  1272. FieldMap[OVF_RATE_HI].Mask = FieldCreateMask(OVF_RATE_HI) ;
  1273. /* FIELDS*/
  1274. strcpy(FieldMap[CORNER_RATE_HI].Name,"CORNER_RATE_HI") ;
  1275. FieldMap[CORNER_RATE_HI].Reg  = DELAGC_8 ;
  1276. FieldMap[CORNER_RATE_HI].Pos  = 0     ;
  1277. FieldMap[CORNER_RATE_HI].Bits = 8     ;
  1278. FieldMap[CORNER_RATE_HI].Type = UNSIGNED ;
  1279. FieldMap[CORNER_RATE_HI].Mask = FieldCreateMask(CORNER_RATE_HI) ;
  1280. /* WBAGC_0*/
  1281. RegMap[WBAGC_0].Addr   = 0x40 ;
  1282. RegMap[WBAGC_0].Reset  = 0x1A ;
  1283. RegMap[WBAGC_0].Value  = 0x1C ;
  1284. strcpy(RegMap[WBAGC_0].Name,"WBAGC_0") ;
  1285. /* FIELDS*/
  1286. strcpy(FieldMap[I_REF].Name,"I_REF") ;
  1287. FieldMap[I_REF].Reg  = WBAGC_0 ;
  1288. FieldMap[I_REF].Pos  = 0     ;
  1289. FieldMap[I_REF].Bits = 8     ;
  1290. FieldMap[I_REF].Type = UNSIGNED ;
  1291. FieldMap[I_REF].Mask = FieldCreateMask(I_REF) ;
  1292. /* WBAGC_1*/
  1293. RegMap[WBAGC_1].Addr   = 0x41 ;
  1294. RegMap[WBAGC_1].Reset  = 0x64 ;
  1295. RegMap[WBAGC_1].Value  = 0x00 ;
  1296. strcpy(RegMap[WBAGC_1].Name,"WBAGC_1") ;
  1297. /* FIELDS*/
  1298. strcpy(FieldMap[AGC2SD_LO].Name,"AGC2SD_LO") ;
  1299. FieldMap[AGC2SD_LO].Reg  = WBAGC_1 ;
  1300. FieldMap[AGC2SD_LO].Pos  = 0     ;
  1301. FieldMap[AGC2SD_LO].Bits = 8     ;
  1302. FieldMap[AGC2SD_LO].Type = UNSIGNED ;
  1303. FieldMap[AGC2SD_LO].Mask = FieldCreateMask(AGC2SD_LO) ;
  1304. /* WBAGC_2*/
  1305. RegMap[WBAGC_2].Addr   = 0x42 ;
  1306. RegMap[WBAGC_2].Reset  = 0x31 ;
  1307. RegMap[WBAGC_2].Value  = 0x02 ;
  1308. strcpy(RegMap[WBAGC_2].Name,"WBAGC_2") ;
  1309. /* FIELDS*/
  1310. strcpy(FieldMap[AGC2SD_HI].Name,"AGC2SD_HI") ;
  1311. FieldMap[AGC2SD_HI].Reg  = WBAGC_2 ;
  1312. FieldMap[AGC2SD_HI].Pos  = 0     ;
  1313. FieldMap[AGC2SD_HI].Bits = 2     ;
  1314. FieldMap[AGC2SD_HI].Type = UNSIGNED ;
  1315. FieldMap[AGC2SD_HI].Mask = FieldCreateMask(AGC2SD_HI) ;
  1316. strcpy(FieldMap[ACQ_THRESH].Name,"ACQ_THRESH") ;
  1317. FieldMap[ACQ_THRESH].Reg  = WBAGC_2 ;
  1318. FieldMap[ACQ_THRESH].Pos  = 2     ;
  1319. FieldMap[ACQ_THRESH].Bits = 4     ;
  1320. FieldMap[ACQ_THRESH].Type = UNSIGNED ;
  1321. FieldMap[ACQ_THRESH].Mask = FieldCreateMask(ACQ_THRESH) ;
  1322. /* WBAGC_3*/
  1323. RegMap[WBAGC_3].Addr   = 0x43 ;
  1324. RegMap[WBAGC_3].Reset  = 0x18 ;
  1325. RegMap[WBAGC_3].Value  = 0x20 ;
  1326. strcpy(RegMap[WBAGC_3].Name,"WBAGC_3") ;
  1327. /* FIELDS*/
  1328. strcpy(FieldMap[WAGC_CLR].Name,"WAGC_CLR") ;
  1329. FieldMap[WAGC_CLR].Reg  = WBAGC_3 ;
  1330. FieldMap[WAGC_CLR].Pos  = 6     ;
  1331. FieldMap[WAGC_CLR].Bits = 1     ;
  1332. FieldMap[WAGC_CLR].Type = UNSIGNED ;
  1333. FieldMap[WAGC_CLR].Mask = FieldCreateMask(WAGC_CLR) ;
  1334. /* FIELDS*/
  1335. strcpy(FieldMap[WAGC_INV].Name,"WAGC_INV") ;
  1336. FieldMap[WAGC_INV].Reg  = WBAGC_3 ;
  1337. FieldMap[WAGC_INV].Pos  = 5     ;
  1338. FieldMap[WAGC_INV].Bits = 1     ;
  1339. FieldMap[WAGC_INV].Type = UNSIGNED ;
  1340. FieldMap[WAGC_INV].Mask = FieldCreateMask(WAGC_INV) ;
  1341. /* FIELDS*/
  1342. strcpy(FieldMap[WAGC_EN].Name,"WAGC_EN") ;
  1343. FieldMap[WAGC_EN].Reg  = WBAGC_3 ;
  1344. FieldMap[WAGC_EN].Pos  = 4     ;
  1345. FieldMap[WAGC_EN].Bits = 1     ;
  1346. FieldMap[WAGC_EN].Type = UNSIGNED ;
  1347. FieldMap[WAGC_EN].Mask = FieldCreateMask(WAGC_EN) ;
  1348. /* FIELDS*/
  1349. strcpy(FieldMap[WAGC_ACQ].Name,"WAGC_ACQ") ;
  1350. FieldMap[WAGC_ACQ].Reg  = WBAGC_3 ;
  1351. FieldMap[WAGC_ACQ].Pos  = 3     ;
  1352. FieldMap[WAGC_ACQ].Bits = 1     ;
  1353. FieldMap[WAGC_ACQ].Type = UNSIGNED ;
  1354. FieldMap[WAGC_ACQ].Mask = FieldCreateMask(WAGC_ACQ) ;
  1355. /* FIELDS*/
  1356. strcpy(FieldMap[SWAP].Name,"SWAP") ;
  1357. FieldMap[SWAP].Reg  = WBAGC_3 ;
  1358. FieldMap[SWAP].Pos  = 2     ;
  1359. FieldMap[SWAP].Bits = 1     ;
  1360. FieldMap[SWAP].Type = UNSIGNED ;
  1361. FieldMap[SWAP].Mask = FieldCreateMask(SWAP) ;
  1362. /* WBAGC_4*/
  1363. RegMap[WBAGC_4].Addr   = 0x44 ;
  1364. RegMap[WBAGC_4].Reset  = 0xFF ;
  1365. RegMap[WBAGC_4].Value  = 0x00 ;
  1366. strcpy(RegMap[WBAGC_4].Name,"WBAGC_4") ;
  1367. /* FIELDS*/
  1368. strcpy(FieldMap[ROLL_LO].Name,"ROLL_LO") ;
  1369. FieldMap[ROLL_LO].Reg  = WBAGC_4 ;
  1370. FieldMap[ROLL_LO].Pos  = 0     ;
  1371. FieldMap[ROLL_LO].Bits = 8     ;
  1372. FieldMap[ROLL_LO].Type = UNSIGNED ;
  1373. FieldMap[ROLL_LO].Mask = FieldCreateMask(ROLL_LO) ;
  1374. /* WBAGC_5*/
  1375. RegMap[WBAGC_5].Addr   = 0x45 ;
  1376. RegMap[WBAGC_5].Reset  = 0x00 ;
  1377. RegMap[WBAGC_5].Value  = 0x00 ;
  1378. strcpy(RegMap[WBAGC_5].Name,"WBAGC_5") ;
  1379. /* FIELDS*/
  1380. strcpy(FieldMap[ACQ_COUNT_LO].Name,"ACQ_COUNT_LO") ;
  1381. FieldMap[ACQ_COUNT_LO].Reg  = WBAGC_5 ;
  1382. FieldMap[ACQ_COUNT_LO].Pos  = 0     ;
  1383. FieldMap[ACQ_COUNT_LO].Bits = 8     ;
  1384. FieldMap[ACQ_COUNT_LO].Type = UNSIGNED ;
  1385. FieldMap[ACQ_COUNT_LO].Mask = FieldCreateMask(ACQ_COUNT_LO) ;
  1386. /* WBAGC_6*/
  1387. RegMap[WBAGC_6].Addr   = 0x46 ;
  1388. RegMap[WBAGC_6].Reset  = 0x00 ;
  1389. RegMap[WBAGC_6].Value  = 0x00 ;
  1390. strcpy(RegMap[WBAGC_6].Name,"WBAGC_6") ;
  1391. /* FIELDS*/
  1392. strcpy(FieldMap[ACQ_COUNT_HI].Name,"ACQ_COUNT_HI") ;
  1393. FieldMap[ACQ_COUNT_HI].Reg  = WBAGC_6 ;
  1394. FieldMap[ACQ_COUNT_HI].Pos  = 0     ;
  1395. FieldMap[ACQ_COUNT_HI].Bits = 8     ;
  1396. FieldMap[ACQ_COUNT_HI].Type = UNSIGNED ;
  1397. FieldMap[ACQ_COUNT_HI].Mask = FieldCreateMask(ACQ_COUNT_HI) ;
  1398. /* WBAGC_9*/
  1399. RegMap[WBAGC_9].Addr   = 0x49 ;
  1400. RegMap[WBAGC_9].Reset  = 0x04 ;
  1401. RegMap[WBAGC_9].Value  = 0x04 ;
  1402. strcpy(RegMap[WBAGC_9].Name,"WBAGC_9") ;
  1403. /* FIELDS*/
  1404. strcpy(FieldMap[ROLL_HI].Name,"ROLL_HI") ;
  1405. FieldMap[ROLL_HI].Reg  = WBAGC_9 ;
  1406. FieldMap[ROLL_HI].Pos  = 0     ;
  1407. FieldMap[ROLL_HI].Bits = 8     ;
  1408. FieldMap[ROLL_HI].Type = UNSIGNED ;
  1409. FieldMap[ROLL_HI].Mask = FieldCreateMask(ROLL_HI) ;
  1410. /* WBAGC_10*/
  1411. RegMap[WBAGC_10].Addr   = 0x4A ;
  1412. RegMap[WBAGC_10].Reset  = 0x51 ;
  1413. RegMap[WBAGC_10].Value  = 0x00 ;
  1414. strcpy(RegMap[WBAGC_10].Name,"WBAGC_10") ;
  1415. /* FIELDS*/
  1416. strcpy(FieldMap[IF_PWM_LO].Name,"IF_PWM_LO") ;
  1417. FieldMap[IF_PWM_LO].Reg  = WBAGC_10 ;
  1418. FieldMap[IF_PWM_LO].Pos  = 0     ;
  1419. FieldMap[IF_PWM_LO].Bits = 8     ;
  1420. FieldMap[IF_PWM_LO].Type = UNSIGNED ;
  1421. FieldMap[IF_PWM_LO].Mask = FieldCreateMask(IF_PWM_LO) ;
  1422. /* FIELDS*/
  1423. strcpy(FieldMap[TARGET_RATE_LO].Name,"TARGET_RATE_LO") ;
  1424. FieldMap[TARGET_RATE_LO].Reg  = WBAGC_10 ;
  1425. FieldMap[TARGET_RATE_LO].Pos  = 0     ;
  1426. FieldMap[TARGET_RATE_LO].Bits = 8     ;
  1427. FieldMap[TARGET_RATE_LO].Type = UNSIGNED ;
  1428. FieldMap[TARGET_RATE_LO].Mask = FieldCreateMask(TARGET_RATE_LO) ;
  1429. /* WBAGC_11*/
  1430. RegMap[WBAGC_11].Addr   = 0x4B ;
  1431. RegMap[WBAGC_11].Reset  = 0xF8 ; /* orginal f8 */
  1432. RegMap[WBAGC_11].Value  = 0x00 ;
  1433. strcpy(RegMap[WBAGC_11].Name,"WBAGC_11") ;
  1434. /* FIELDS*/
  1435. strcpy(FieldMap[IF_PWM_HI].Name,"IF_PWM_HI") ;
  1436. FieldMap[IF_PWM_HI].Reg  = WBAGC_11 ;
  1437. FieldMap[IF_PWM_HI].Pos  = 0     ;
  1438. FieldMap[IF_PWM_HI].Bits = 8     ;
  1439. FieldMap[IF_PWM_HI].Type = UNSIGNED ;
  1440. FieldMap[IF_PWM_HI].Mask = FieldCreateMask(IF_PWM_HI) ;
  1441. /* FIELDS*/
  1442. strcpy(FieldMap[TARGET_RATE_HI].Name,"TARGET_RATE_HI") ;
  1443. FieldMap[TARGET_RATE_HI].Reg  = WBAGC_11 ;
  1444. FieldMap[TARGET_RATE_HI].Pos  = 0     ;
  1445. FieldMap[TARGET_RATE_HI].Bits = 8     ;
  1446. FieldMap[TARGET_RATE_HI].Type = UNSIGNED ;
  1447. FieldMap[TARGET_RATE_HI].Mask = FieldCreateMask(TARGET_RATE_HI) ;
  1448. /* STLOOP_2*/
  1449. RegMap[STLOOP_2].Addr   = 0x52 ;
  1450. RegMap[STLOOP_2].Reset  = 0x30 ;
  1451. RegMap[STLOOP_2].Value  = 0x00 ;
  1452. strcpy(RegMap[STLOOP_2].Name,"STLOOP_2") ;
  1453. /* FIELDS*/
  1454. strcpy(FieldMap[GAIN_SCALE_PATH0].Name,"GAIN_SCALE_PATH0") ;
  1455. FieldMap[GAIN_SCALE_PATH0].Reg  = STLOOP_2 ;
  1456. FieldMap[GAIN_SCALE_PATH0].Pos  = 5     ;
  1457. FieldMap[GAIN_SCALE_PATH0].Bits = 3     ;
  1458. FieldMap[GAIN_SCALE_PATH0].Type = UNSIGNED ;
  1459. FieldMap[GAIN_SCALE_PATH0].Mask = FieldCreateMask(GAIN_SCALE_PATH0) ;
  1460. /* FIELDS*/
  1461. strcpy(FieldMap[GAIN_SCALE_PATH1].Name,"GAIN_SCALE_PATH1") ;
  1462. FieldMap[GAIN_SCALE_PATH1].Reg  = STLOOP_2 ;
  1463. FieldMap[GAIN_SCALE_PATH1].Pos  = 2     ;
  1464. FieldMap[GAIN_SCALE_PATH1].Bits = 3     ;
  1465. FieldMap[GAIN_SCALE_PATH1].Type = UNSIGNED ;
  1466. FieldMap[GAIN_SCALE_PATH1].Mask = FieldCreateMask(GAIN_SCALE_PATH1) ;
  1467. /* FIELDS*/
  1468. strcpy(FieldMap[INTEGRAL_GAIN_HI].Name,"INTEGRAL_GAIN_HI") ;
  1469. FieldMap[INTEGRAL_GAIN_HI].Reg  = STLOOP_2 ;
  1470. FieldMap[INTEGRAL_GAIN_HI].Pos  = 0     ;
  1471. FieldMap[INTEGRAL_GAIN_HI].Bits = 2     ;
  1472. FieldMap[INTEGRAL_GAIN_HI].Type = UNSIGNED ;
  1473. FieldMap[INTEGRAL_GAIN_HI].Mask = FieldCreateMask(INTEGRAL_GAIN_HI) ;
  1474. /* STLOOP_3*/
  1475. RegMap[STLOOP_3].Addr   = 0x53 ;
  1476. RegMap[STLOOP_3].Reset  = 0x06 ; 
  1477. RegMap[STLOOP_3].Value  = 0x00 ;
  1478. strcpy(RegMap[STLOOP_3].Name,"STLOOP_3") ;
  1479. /* FIELDS*/
  1480. strcpy(FieldMap[DIRECT_GAIN_LO].Name,"DIRECT_GAIN_LO") ;
  1481. FieldMap[DIRECT_GAIN_LO].Reg  = STLOOP_3 ;
  1482. FieldMap[DIRECT_GAIN_LO].Pos  = 0     ;
  1483. FieldMap[DIRECT_GAIN_LO].Bits = 8     ;
  1484. FieldMap[DIRECT_GAIN_LO].Type = UNSIGNED ;
  1485. FieldMap[DIRECT_GAIN_LO].Mask = FieldCreateMask(DIRECT_GAIN_LO) ;
  1486. /* STLOOP_5*/
  1487. RegMap[STLOOP_5].Addr   = 0x55 ;
  1488. RegMap[STLOOP_5].Reset  = 0x6a ;
  1489. RegMap[STLOOP_5].Value  = 0x00 ;
  1490. strcpy(RegMap[STLOOP_5].Name,"STLOOP_5") ;
  1491. /* FIELDS*/
  1492. strcpy(FieldMap[SYMB_RATE_0].Name,"SYMB_RATE_0") ;
  1493. FieldMap[SYMB_RATE_0].Reg  = STLOOP_5 ;
  1494. FieldMap[SYMB_RATE_0].Pos  = 0     ;
  1495. FieldMap[SYMB_RATE_0].Bits = 8     ;
  1496. FieldMap[SYMB_RATE_0].Type = UNSIGNED ;
  1497. FieldMap[SYMB_RATE_0].Mask = FieldCreateMask(SYMB_RATE_0) ;
  1498. /* STLOOP_6*/
  1499. RegMap[STLOOP_6].Addr   = 0x56 ;
  1500. RegMap[STLOOP_6].Reset  = 0xA3 ;
  1501. RegMap[STLOOP_6].Value  = 0x00 ;
  1502. strcpy(RegMap[STLOOP_6].Name,"STLOOP_6") ;
  1503. /* FIELDS*/
  1504. strcpy(FieldMap[SYMB_RATE_1].Name,"SYMB_RATE_1") ;
  1505. FieldMap[SYMB_RATE_1].Reg  = STLOOP_6 ;
  1506. FieldMap[SYMB_RATE_1].Pos  = 0     ;
  1507. FieldMap[SYMB_RATE_1].Bits = 8     ;
  1508. FieldMap[SYMB_RATE_1].Type = UNSIGNED ;
  1509. FieldMap[SYMB_RATE_1].Mask = FieldCreateMask(SYMB_RATE_1) ;
  1510. /* STLOOP_7*/
  1511. RegMap[STLOOP_7].Addr   = 0x57 ;
  1512. RegMap[STLOOP_7].Reset  = 0x8B ;
  1513. RegMap[STLOOP_7].Value  = 0x00 ;
  1514. strcpy(RegMap[STLOOP_7].Name,"STLOOP_7") ;
  1515. /* FIELDS*/
  1516. strcpy(FieldMap[SYMB_RATE_2].Name,"SYMB_RATE_2") ;
  1517. FieldMap[SYMB_RATE_2].Reg  = STLOOP_7 ;
  1518. FieldMap[SYMB_RATE_2].Pos  = 0     ;
  1519. FieldMap[SYMB_RATE_2].Bits = 8     ;
  1520. FieldMap[SYMB_RATE_2].Type = UNSIGNED ;
  1521. FieldMap[SYMB_RATE_2].Mask = FieldCreateMask(SYMB_RATE_2) ;
  1522. /* STLOOP_8*/
  1523. RegMap[STLOOP_8].Addr   = 0x58 ;
  1524. RegMap[STLOOP_8].Reset  = 0x39 ;
  1525. RegMap[STLOOP_8].Value  = 0x00 ;
  1526. strcpy(RegMap[STLOOP_8].Name,"STLOOP_8") ;
  1527. /* FIELDS*/
  1528. strcpy(FieldMap[SYMB_RATE_3].Name,"SYMB_RATE_3") ;
  1529. FieldMap[SYMB_RATE_3].Reg  = STLOOP_8 ;
  1530. FieldMap[SYMB_RATE_3].Pos  = 0     ;
  1531. FieldMap[SYMB_RATE_3].Bits = 8     ;
  1532. FieldMap[SYMB_RATE_3].Type = UNSIGNED ;
  1533. FieldMap[SYMB_RATE_3].Mask = FieldCreateMask(SYMB_RATE_3) ;
  1534. /* STLOOP_9*/
  1535. RegMap[STLOOP_9].Addr   = 0x59 ;
  1536. RegMap[STLOOP_9].Reset  = 0x06 ;
  1537. RegMap[STLOOP_9].Value  = 0x00 ;
  1538. strcpy(RegMap[STLOOP_9].Name,"STLOOP_9") ;
  1539. /* FIELDS*/
  1540. strcpy(FieldMap[INTEGRAL_GAIN_LO].Name,"INTEGRAL_GAIN_LO") ;
  1541. FieldMap[INTEGRAL_GAIN_LO].Reg  = STLOOP_9 ;
  1542. FieldMap[INTEGRAL_GAIN_LO].Pos  = 0     ;
  1543. FieldMap[INTEGRAL_GAIN_LO].Bits = 5     ;
  1544. FieldMap[INTEGRAL_GAIN_LO].Type = UNSIGNED ;
  1545. FieldMap[INTEGRAL_GAIN_LO].Mask = FieldCreateMask(INTEGRAL_GAIN_LO) ;
  1546. /* FIELDS*/
  1547. strcpy(FieldMap[DIRECT_GAIN_HI].Name,"DIRECT_GAIN_HI") ;
  1548. FieldMap[DIRECT_GAIN_HI].Reg  = STLOOP_9 ;
  1549. FieldMap[DIRECT_GAIN_HI].Pos  = 5     ;
  1550. FieldMap[DIRECT_GAIN_HI].Bits = 3     ;
  1551. FieldMap[DIRECT_GAIN_HI].Type = UNSIGNED ;
  1552. FieldMap[DIRECT_GAIN_HI].Mask = FieldCreateMask(DIRECT_GAIN_HI) ;
  1553. /* STLOOP_10*/
  1554. RegMap[STLOOP_10].Addr   = 0x5A ;
  1555. RegMap[STLOOP_10].Reset  = 0x5E ;
  1556. RegMap[STLOOP_10].Value  = 0x5E ;
  1557. strcpy(RegMap[STLOOP_10].Name,"STLOOP_10") ;
  1558. /* FIELDS*/
  1559. strcpy(FieldMap[PHASE_EN].Name,"PHASE_EN") ;
  1560. FieldMap[PHASE_EN].Reg  = STLOOP_10 ;
  1561. FieldMap[PHASE_EN].Pos  = 6     ;
  1562. FieldMap[PHASE_EN].Bits = 1     ;
  1563. FieldMap[PHASE_EN].Type = UNSIGNED ;
  1564. FieldMap[PHASE_EN].Mask = FieldCreateMask(PHASE_EN) ;
  1565. /* FIELDS*/
  1566. strcpy(FieldMap[PHASE_CLR].Name,"PHASE_CLR") ;
  1567. FieldMap[PHASE_CLR].Reg  = STLOOP_10 ;
  1568. FieldMap[PHASE_CLR].Pos  = 5     ;
  1569. FieldMap[PHASE_CLR].Bits = 1     ;
  1570. FieldMap[PHASE_CLR].Type = UNSIGNED ;
  1571. FieldMap[PHASE_CLR].Mask = FieldCreateMask(PHASE_CLR) ;
  1572. /* FIELDS*/
  1573. strcpy(FieldMap[ERR_RANGE].Name,"ERR_RANGE") ;
  1574. FieldMap[ERR_RANGE].Reg  = STLOOP_10 ;
  1575. FieldMap[ERR_RANGE].Pos  = 0     ;
  1576. FieldMap[ERR_RANGE].Bits = 5     ;
  1577. FieldMap[ERR_RANGE].Type = UNSIGNED ;
  1578. FieldMap[ERR_RANGE].Mask = FieldCreateMask(ERR_RANGE) ;
  1579. /* STLOOP_11*/
  1580. RegMap[STLOOP_11].Addr   = 0x5B ;
  1581. RegMap[STLOOP_11].Reset  = 0x04 ;
  1582. RegMap[STLOOP_11].Value  = 0x05 ;
  1583. strcpy(RegMap[STLOOP_11].Name,"STLOOP_11") ;
  1584. /* FIELDS*/
  1585. strcpy(FieldMap[ALGOSEL].Name,"ALGOSEL") ;
  1586. FieldMap[ALGOSEL].Reg  = STLOOP_11 ;
  1587. FieldMap[ALGOSEL].Pos  = 4     ;
  1588. FieldMap[ALGOSEL].Bits = 2     ;
  1589. FieldMap[ALGOSEL].Type = UNSIGNED ;
  1590. FieldMap[ALGOSEL].Mask = FieldCreateMask(ALGOSEL) ;
  1591. /* FIELDS*/
  1592. strcpy(FieldMap[ERR_CLR].Name,"ERR_CLR") ;
  1593. FieldMap[ERR_CLR].Reg  = STLOOP_11 ;
  1594. FieldMap[ERR_CLR].Pos  = 1     ;
  1595. FieldMap[ERR_CLR].Bits = 1     ;
  1596. FieldMap[ERR_CLR].Type = UNSIGNED ;
  1597. FieldMap[ERR_CLR].Mask = FieldCreateMask(ERR_CLR) ;
  1598. /* FIELDS*/
  1599. strcpy(FieldMap[ERR_EN].Name,"ERR_EN") ;
  1600. FieldMap[ERR_EN].Reg  = STLOOP_11 ;
  1601. FieldMap[ERR_EN].Pos  = 0     ;
  1602. FieldMap[ERR_EN].Bits = 1     ;
  1603. FieldMap[ERR_EN].Type = UNSIGNED ;
  1604. FieldMap[ERR_EN].Mask = FieldCreateMask(ERR_EN) ;
  1605. /* CRL_0*/
  1606. RegMap[CRL_0].Addr   = 0x60 ;
  1607. RegMap[CRL_0].Reset  = 0x16 ;
  1608. RegMap[CRL_0].Value  = 0x00 ;
  1609. strcpy(RegMap[CRL_0].Name,"CRL_0") ;
  1610. /* FIELDS*/
  1611. strcpy(FieldMap[SWEEP_LO].Name,"SWEEP_LO") ;
  1612. FieldMap[SWEEP_LO].Reg  = CRL_0 ;
  1613. FieldMap[SWEEP_LO].Pos  = 0     ;
  1614. FieldMap[SWEEP_LO].Bits = 8     ;
  1615. FieldMap[SWEEP_LO].Type = UNSIGNED ;
  1616. FieldMap[SWEEP_LO].Mask = FieldCreateMask(SWEEP_LO) ;
  1617. /* CRL_1*/
  1618. RegMap[CRL_1].Addr   = 0x61 ;
  1619. RegMap[CRL_1].Reset  = 0x49 ; /*org 49*/
  1620. RegMap[CRL_1].Value  = 0x38 ; /*org 38*/
  1621. strcpy(RegMap[CRL_1].Name,"CRL_1") ;
  1622. /* FIELDS*/
  1623. strcpy(FieldMap[GAIN_INT].Name,"GAIN_INT") ;
  1624. FieldMap[GAIN_INT].Reg  = CRL_1 ;
  1625. FieldMap[GAIN_INT].Pos  = 0     ;
  1626. FieldMap[GAIN_INT].Bits = 4     ;
  1627. FieldMap[GAIN_INT].Type = UNSIGNED ;
  1628. FieldMap[GAIN_INT].Mask = FieldCreateMask(GAIN_INT) ;
  1629. /* FIELDS*/
  1630. strcpy(FieldMap[GAIN_DIR].Name,"GAIN_DIR") ;
  1631. FieldMap[GAIN_DIR].Reg  = CRL_1 ;
  1632. FieldMap[GAIN_DIR].Pos  = 4     ;
  1633. FieldMap[GAIN_DIR].Bits = 3     ;
  1634. FieldMap[GAIN_DIR].Type = UNSIGNED ;
  1635. FieldMap[GAIN_DIR].Mask = FieldCreateMask(GAIN_DIR) ;
  1636. /* CRL_2*/
  1637. RegMap[CRL_2].Addr   = 0x62 ;
  1638. RegMap[CRL_2].Reset  = 0x05 ;
  1639. RegMap[CRL_2].Value  = 0x06 ;
  1640. strcpy(RegMap[CRL_2].Name,"CRL_2") ;
  1641. /* FIELDS*/
  1642. strcpy(FieldMap[GAIN_INT_ADJ].Name,"GAIN_INT_ADJ") ;
  1643. FieldMap[GAIN_INT_ADJ].Reg  = CRL_2 ;
  1644. FieldMap[GAIN_INT_ADJ].Pos  = 0     ;
  1645. FieldMap[GAIN_INT_ADJ].Bits = 2     ;
  1646. FieldMap[GAIN_INT_ADJ].Type = UNSIGNED ;
  1647. FieldMap[GAIN_INT_ADJ].Mask = FieldCreateMask(GAIN_INT_ADJ) ;
  1648. /* FIELDS*/
  1649. strcpy(FieldMap[GAIN_DIR_ADJ].Name,"GAIN_DIR_ADJ") ;
  1650. FieldMap[GAIN_DIR_ADJ].Reg  = CRL_2 ;
  1651. FieldMap[GAIN_DIR_ADJ].Pos  = 2     ;
  1652. FieldMap[GAIN_DIR_ADJ].Bits = 2     ;
  1653. FieldMap[GAIN_DIR_ADJ].Type = UNSIGNED ;
  1654. FieldMap[GAIN_DIR_ADJ].Mask = FieldCreateMask(GAIN_DIR_ADJ) ;
  1655. /* CRL_3*/
  1656. RegMap[CRL_3].Addr   = 0x63 ;
  1657. RegMap[CRL_3].Reset  = 0x00 ;
  1658. RegMap[CRL_3].Value  = 0x00 ;
  1659. strcpy(RegMap[CRL_3].Name,"CRL_3") ;
  1660. /* FIELDS*/
  1661. strcpy(FieldMap[APHASE_0].Name,"APHASE_0") ;
  1662. FieldMap[APHASE_0].Reg  = CRL_3 ;
  1663. FieldMap[APHASE_0].Pos  = 0     ;
  1664. FieldMap[APHASE_0].Bits = 8     ;
  1665. FieldMap[APHASE_0].Type = UNSIGNED ;
  1666. FieldMap[APHASE_0].Mask = FieldCreateMask(APHASE_0) ;
  1667. /* CRL_4*/
  1668. RegMap[CRL_4].Addr   = 0x64 ;
  1669. RegMap[CRL_4].Reset  = 0x00 ;
  1670. RegMap[CRL_4].Value  = 0x00 ;
  1671. strcpy(RegMap[CRL_4].Name,"CRL_4") ;
  1672. /* FIELDS*/
  1673. strcpy(FieldMap[APHASE_1].Name,"APHASE_1") ;
  1674. FieldMap[APHASE_1].Reg  = CRL_4 ;
  1675. FieldMap[APHASE_1].Pos  = 0     ;
  1676. FieldMap[APHASE_1].Bits = 8     ;
  1677. FieldMap[APHASE_1].Type = UNSIGNED ;
  1678. FieldMap[APHASE_1].Mask = FieldCreateMask(APHASE_1) ;
  1679. /* CRL_5*/
  1680. RegMap[CRL_5].Addr   = 0x65 ;
  1681. RegMap[CRL_5].Reset  = 0x00 ;
  1682. RegMap[CRL_5].Value  = 0x00 ;
  1683. strcpy(RegMap[CRL_5].Name,"CRL_5") ;
  1684. /* FIELDS*/
  1685. strcpy(FieldMap[APHASE_2].Name,"APHASE_2") ;
  1686. FieldMap[APHASE_2].Reg  = CRL_5 ;
  1687. FieldMap[APHASE_2].Pos  = 0     ;
  1688. FieldMap[APHASE_2].Bits = 8     ;
  1689. FieldMap[APHASE_2].Type = UNSIGNED ;
  1690. FieldMap[APHASE_2].Mask = FieldCreateMask(APHASE_2) ;
  1691. /* CRL_6*/
  1692. RegMap[CRL_6].Addr   = 0x66 ;
  1693. RegMap[CRL_6].Reset  = 0xbf ;
  1694. RegMap[CRL_6].Value  = 0x00 ;
  1695. strcpy(RegMap[CRL_6].Name,"CRL_6") ;
  1696. /* FIELDS*/
  1697. strcpy(FieldMap[IPHASE_0].Name,"IPHASE_0") ;
  1698. FieldMap[IPHASE_0].Reg  = CRL_6 ;
  1699. FieldMap[IPHASE_0].Pos  = 0     ;
  1700. FieldMap[IPHASE_0].Bits = 8     ;
  1701. FieldMap[IPHASE_0].Type = UNSIGNED ;
  1702. FieldMap[IPHASE_0].Mask = FieldCreateMask(IPHASE_0) ;
  1703. /* CRL_7*/
  1704. RegMap[CRL_7].Addr   = 0x67 ;
  1705. RegMap[CRL_7].Reset  = 0x0D ;
  1706. RegMap[CRL_7].Value  = 0x00 ;
  1707. strcpy(RegMap[CRL_7].Name,"CRL_7") ;
  1708. /* FIELDS*/
  1709. strcpy(FieldMap[IPHASE_1].Name,"IPHASE_1") ;
  1710. FieldMap[IPHASE_1].Reg  = CRL_7 ;
  1711. FieldMap[IPHASE_1].Pos  = 0     ;
  1712. FieldMap[IPHASE_1].Bits = 8     ;
  1713. FieldMap[IPHASE_1].Type = UNSIGNED ;
  1714. FieldMap[IPHASE_1].Mask = FieldCreateMask(IPHASE_1) ;
  1715. /* CRL_8*/
  1716. RegMap[CRL_8].Addr   = 0x68 ;
  1717. RegMap[CRL_8].Reset  = 0xf8 ;
  1718. RegMap[CRL_8].Value  = 0x00 ;
  1719. strcpy(RegMap[CRL_8].Name,"CRL_8") ;
  1720. /* FIELDS*/
  1721. strcpy(FieldMap[IPHASE_2].Name,"IPHASE_2") ;
  1722. FieldMap[IPHASE_2].Reg  = CRL_8 ;
  1723. FieldMap[IPHASE_2].Pos  = 0      ;
  1724. FieldMap[IPHASE_2].Bits = 8     ;
  1725. FieldMap[IPHASE_2].Type = UNSIGNED ;
  1726. FieldMap[IPHASE_2].Mask = FieldCreateMask(IPHASE_2) ;
  1727. /* CRL_9*/
  1728. RegMap[CRL_9].Addr   = 0x69 ;
  1729. RegMap[CRL_9].Reset  = 0x0D ;
  1730. RegMap[CRL_9].Value  = 0x00 ;
  1731. strcpy(RegMap[CRL_9].Name,"CRL_9") ;
  1732. /* FIELDS*/
  1733. strcpy(FieldMap[IPHASE_3].Name,"IPHASE_3") ;
  1734. FieldMap[IPHASE_3].Reg  = CRL_9 ;
  1735. FieldMap[IPHASE_3].Pos  = 0     ;
  1736. FieldMap[IPHASE_3].Bits = 4     ;
  1737. FieldMap[IPHASE_3].Type = UNSIGNED ;
  1738. FieldMap[IPHASE_3].Mask = FieldCreateMask(IPHASE_3) ;
  1739. /* FIELDS*/
  1740. strcpy(FieldMap[SWEEP_HI].Name,"SWEEP_HI") ;
  1741. FieldMap[SWEEP_HI].Reg  = CRL_9 ;
  1742. FieldMap[SWEEP_HI].Pos  = 4     ;
  1743. FieldMap[SWEEP_HI].Bits = 4     ;
  1744. FieldMap[SWEEP_HI].Type = UNSIGNED ;
  1745. FieldMap[SWEEP_HI].Mask = FieldCreateMask(SWEEP_HI) ;
  1746. /* CRL_10*/
  1747. RegMap[CRL_10].Addr   = 0x6A ;
  1748. RegMap[CRL_10].Reset  = 0x03 ;
  1749. RegMap[CRL_10].Value  = 0x03 ;
  1750. strcpy(RegMap[CRL_10].Name,"CRL_10") ;
  1751. /* FIELDS*/
  1752. strcpy(FieldMap[SWEEP_EN].Name,"SWEEP_EN") ;
  1753. FieldMap[SWEEP_EN].Reg  = CRL_10 ;
  1754. FieldMap[SWEEP_EN].Pos  = 0     ;
  1755. FieldMap[SWEEP_EN].Bits = 1     ;
  1756. FieldMap[SWEEP_EN].Type = UNSIGNED ;
  1757. FieldMap[SWEEP_EN].Mask = FieldCreateMask(SWEEP_EN) ;
  1758. /* FIELDS*/
  1759. strcpy(FieldMap[PH_EN].Name,"PH_EN") ;
  1760. FieldMap[PH_EN].Reg  = CRL_10 ;
  1761. FieldMap[PH_EN].Pos  = 1     ;
  1762. FieldMap[PH_EN].Bits = 1     ;
  1763. FieldMap[PH_EN].Type = UNSIGNED ;
  1764. FieldMap[PH_EN].Mask = FieldCreateMask(PH_EN) ;
  1765. /* FIELDS*/
  1766. strcpy(FieldMap[DIR_EN].Name,"DIR_EN") ;
  1767. FieldMap[DIR_EN].Reg  = CRL_10 ;
  1768. FieldMap[DIR_EN].Pos  = 2     ;
  1769. FieldMap[DIR_EN].Bits = 1     ;
  1770. FieldMap[DIR_EN].Type = UNSIGNED ;
  1771. FieldMap[DIR_EN].Mask = FieldCreateMask(DIR_EN) ;
  1772. /* FIELDS*/
  1773. strcpy(FieldMap[INT_EN].Name,"INT_EN") ;
  1774. FieldMap[INT_EN].Reg  = CRL_10 ;
  1775. FieldMap[INT_EN].Pos  = 3      ;
  1776. FieldMap[INT_EN].Bits = 1      ;
  1777. FieldMap[INT_EN].Type = UNSIGNED ;
  1778. FieldMap[INT_EN].Mask = FieldCreateMask(INT_EN) ;
  1779. /* FIELDS*/
  1780. strcpy(FieldMap[DIR_DIS].Name,"DIR_DIS") ;
  1781. FieldMap[DIR_DIS].Reg  = CRL_10 ;
  1782. FieldMap[DIR_DIS].Pos  = 4      ;
  1783. FieldMap[DIR_DIS].Bits = 1      ;
  1784. FieldMap[DIR_DIS].Type = UNSIGNED ;
  1785. FieldMap[DIR_DIS].Mask = FieldCreateMask(DIR_DIS) ;
  1786. /* FIELDS*/
  1787. strcpy(FieldMap[INT_DIS].Name,"INT_DIS") ;
  1788. FieldMap[INT_DIS].Reg  = CRL_10 ;
  1789. FieldMap[INT_DIS].Pos  = 5      ;
  1790. FieldMap[INT_DIS].Bits = 1      ;
  1791. FieldMap[INT_DIS].Type = UNSIGNED ;
  1792. FieldMap[INT_DIS].Mask = FieldCreateMask(INT_DIS) ;
  1793. /* CRL_11*/
  1794. RegMap[CRL_11].Addr   = 0x6B ;
  1795. RegMap[CRL_11].Reset  = 0x92 ;
  1796. RegMap[CRL_11].Value  = 0x00 ;
  1797. strcpy(RegMap[CRL_11].Name,"CRL_11") ;
  1798. /* FIELDS*/
  1799. strcpy(FieldMap[CRL_SNAPSHOT].Name,"CRL_SNAPSHOT") ;
  1800. FieldMap[CRL_SNAPSHOT].Reg  = CRL_11 ;
  1801. FieldMap[CRL_SNAPSHOT].Pos  = 0     ;
  1802. FieldMap[CRL_SNAPSHOT].Bits = 8     ;
  1803. FieldMap[CRL_SNAPSHOT].Type = UNSIGNED ;
  1804. FieldMap[CRL_SNAPSHOT].Mask = FieldCreateMask(CRL_SNAPSHOT) ;
  1805. /* PMF_AGC_0*/
  1806. RegMap[PMFAGC_0].Addr   = 0x70 ;
  1807. RegMap[PMFAGC_0].Reset  = 0xFF ;
  1808. RegMap[PMFAGC_0].Value  = 0xFF ;
  1809. strcpy(RegMap[PMFAGC_0].Name,"PMFAGC_0") ;
  1810. /* FIELDS*/
  1811. strcpy(FieldMap[LOCK_THRES_LO].Name,"LOCK_THRES_LO") ;
  1812. FieldMap[LOCK_THRES_LO].Reg  = PMFAGC_0 ;
  1813. FieldMap[LOCK_THRES_LO].Pos  = 0     ;
  1814. FieldMap[LOCK_THRES_LO].Bits = 8     ;
  1815. FieldMap[LOCK_THRES_LO].Type = UNSIGNED ;
  1816. FieldMap[LOCK_THRES_LO].Mask = FieldCreateMask(LOCK_THRES_LO) ;
  1817. /* PMF_AGC_1*/
  1818. RegMap[PMFAGC_1].Addr   = 0x71 ;
  1819. RegMap[PMFAGC_1].Reset  = 0x04 ;
  1820. RegMap[PMFAGC_1].Value  = 0x00 ;
  1821. strcpy(RegMap[PMFAGC_1].Name,"PMFAGC_1") ;
  1822. /* FIELDS*/
  1823. strcpy(FieldMap[PMFA_F_UNLOCK].Name,"PMFA_F_UNLOCK") ;
  1824. FieldMap[PMFA_F_UNLOCK].Reg  = PMFAGC_1 ;
  1825. FieldMap[PMFA_F_UNLOCK].Pos  = 7     ;
  1826. FieldMap[PMFA_F_UNLOCK].Bits = 1     ;
  1827. FieldMap[PMFA_F_UNLOCK].Type = UNSIGNED ;
  1828. FieldMap[PMFA_F_UNLOCK].Mask = FieldCreateMask(PMFA_F_UNLOCK) ;
  1829. /* FIELDS*/
  1830. strcpy(FieldMap[PMFA_F_LOCK].Name,"PMFA_F_LOCK") ;
  1831. FieldMap[PMFA_F_LOCK].Reg  = PMFAGC_1 ;
  1832. FieldMap[PMFA_F_LOCK].Pos  = 6     ;
  1833. FieldMap[PMFA_F_LOCK].Bits = 1     ;
  1834. FieldMap[PMFA_F_LOCK].Type = UNSIGNED ;
  1835. FieldMap[PMFA_F_LOCK].Mask = FieldCreateMask(PMFA_F_LOCK) ;
  1836. /* FIELDS*/
  1837. strcpy(FieldMap[WBAGC_F_LOCK].Name,"WBAGC_F_LOCK") ;
  1838. FieldMap[WBAGC_F_LOCK].Reg  = PMFAGC_1 ;
  1839. FieldMap[WBAGC_F_LOCK].Pos  = 5     ;
  1840. FieldMap[WBAGC_F_LOCK].Bits = 1     ;
  1841. FieldMap[WBAGC_F_LOCK].Type = UNSIGNED ;
  1842. FieldMap[WBAGC_F_LOCK].Mask = FieldCreateMask(WBAGC_F_LOCK) ;
  1843. /* FIELDS*/
  1844. strcpy(FieldMap[UP_STOP].Name,"UP_STOP") ;
  1845. FieldMap[UP_STOP].Reg  = PMFAGC_1 ;
  1846. FieldMap[UP_STOP].Pos  = 4     ;
  1847. FieldMap[UP_STOP].Bits = 1     ;
  1848. FieldMap[UP_STOP].Type = UNSIGNED ;
  1849. FieldMap[UP_STOP].Mask = FieldCreateMask(UP_STOP) ;
  1850. /* FIELDS*/
  1851. strcpy(FieldMap[LOCK_THRES_HI].Name,"LOCK_THRES_HI") ;
  1852. FieldMap[LOCK_THRES_HI].Reg  = PMFAGC_1 ;
  1853. FieldMap[LOCK_THRES_HI].Pos  = 0     ;
  1854. FieldMap[LOCK_THRES_HI].Bits = 4     ;
  1855. FieldMap[LOCK_THRES_HI].Type = UNSIGNED ;
  1856. FieldMap[LOCK_THRES_HI].Mask = FieldCreateMask(LOCK_THRES_HI) ;
  1857. /* PMF_AGC_2*/
  1858. RegMap[PMFAGC_2].Addr   = 0x72 ;
  1859. RegMap[PMFAGC_2].Reset  = 0x00 ;
  1860. RegMap[PMFAGC_2].Value  = 0x00 ;
  1861. strcpy(RegMap[PMFAGC_2].Name,"PMFAGC_2") ;
  1862. /* FIELDS*/
  1863. strcpy(FieldMap[PMFA_ACC0].Name,"PMFA_ACC0") ;
  1864. FieldMap[PMFA_ACC0].Reg  = PMFAGC_2 ;
  1865. FieldMap[PMFA_ACC0].Pos  = 0     ;
  1866. FieldMap[PMFA_ACC0].Bits = 8     ;
  1867. FieldMap[PMFA_ACC0].Type = UNSIGNED ;
  1868. FieldMap[PMFA_ACC0].Mask = FieldCreateMask(PMFA_ACC0) ;
  1869. /* PMF_AGC_3*/
  1870. RegMap[PMFAGC_3].Addr   = 0x73 ;
  1871. RegMap[PMFAGC_3].Reset  = 0x00 ;
  1872. RegMap[PMFAGC_3].Value  = 0x00 ;
  1873. strcpy(RegMap[PMFAGC_3].Name,"PMFAGC_3") ;
  1874. /* FIELDS*/
  1875. strcpy(FieldMap[PMFA_ACC1].Name,"PMFA_ACC1") ;
  1876. FieldMap[PMFA_ACC1].Reg  = PMFAGC_3 ;
  1877. FieldMap[PMFA_ACC1].Pos  = 0     ;
  1878. FieldMap[PMFA_ACC1].Bits = 8     ;
  1879. FieldMap[PMFA_ACC1].Type = UNSIGNED ;
  1880. FieldMap[PMFA_ACC1].Mask = FieldCreateMask(PMFA_ACC1) ;
  1881. /* PMF_AGC_4*/
  1882. RegMap[PMFAGC_4].Addr   = 0x74 ;
  1883. RegMap[PMFAGC_4].Reset  = 0x00 ;
  1884. RegMap[PMFAGC_4].Value  = 0x00 ;
  1885. strcpy(RegMap[PMFAGC_4].Name,"PMFAGC_4") ;
  1886. /* FIELDS*/
  1887. strcpy(FieldMap[PMFA_LOCK_STATE].Name,"PMFA_LOCK_STATE") ;
  1888. FieldMap[PMFA_LOCK_STATE].Reg  = PMFAGC_4 ;
  1889. FieldMap[PMFA_LOCK_STATE].Pos  = 7     ;
  1890. FieldMap[PMFA_LOCK_STATE].Bits = 1     ;
  1891. FieldMap[PMFA_LOCK_STATE].Type = UNSIGNED ;
  1892. FieldMap[PMFA_LOCK_STATE].Mask = FieldCreateMask(PMFA_LOCK_STATE) ;
  1893. /* FIELDS*/
  1894. strcpy(FieldMap[PMFA_ACC2].Name,"PMFA_ACC2") ;
  1895. FieldMap[PMFA_ACC2].Reg  = PMFAGC_4 ;
  1896. FieldMap[PMFA_ACC2].Pos  = 0     ;
  1897. FieldMap[PMFA_ACC2].Bits = 4     ;
  1898. FieldMap[PMFA_ACC2].Type = UNSIGNED ;
  1899. FieldMap[PMFA_ACC2].Mask = FieldCreateMask(PMFA_ACC2) ;
  1900. /* CTRL_0*/
  1901. RegMap[CTRL_0].Addr   = 0x80 ;
  1902. RegMap[CTRL_0].Reset  = 0x20 ;
  1903. RegMap[CTRL_0].Value  = 0x00 ;
  1904. strcpy(RegMap[CTRL_0].Name,"CTRL_0") ;
  1905. /* FIELDS*/
  1906. strcpy(FieldMap[SOFT_RESET].Name,"SOFT_RESET") ;
  1907. FieldMap[SOFT_RESET].Reg  = CTRL_0 ;
  1908. FieldMap[SOFT_RESET].Pos  = 0     ;
  1909. FieldMap[SOFT_RESET].Bits = 1     ;
  1910. FieldMap[SOFT_RESET].Type = UNSIGNED ;
  1911. FieldMap[SOFT_RESET].Mask = FieldCreateMask(SOFT_RESET) ;
  1912. /* FIELDS*/
  1913. strcpy(FieldMap[VERSION].Name,"VERSION") ;
  1914. FieldMap[VERSION].Reg  = CTRL_0 ;
  1915. FieldMap[VERSION].Pos  = 4     ;
  1916. FieldMap[VERSION].Bits = 3     ;
  1917. FieldMap[VERSION].Type = UNSIGNED ;
  1918. FieldMap[VERSION].Mask = FieldCreateMask(VERSION) ;
  1919. /* CTRL_1*/
  1920. RegMap[CTRL_1].Addr   = 0x81 ;
  1921. RegMap[CTRL_1].Reset  = 0x00 ;
  1922. RegMap[CTRL_1].Value  = 0x00 ;
  1923. strcpy(RegMap[CTRL_1].Name,"CTRL_1") ;
  1924. /* FIELDS*/
  1925. strcpy(FieldMap[RESET_DI].Name,"RESET_DI") ;
  1926. FieldMap[RESET_DI].Reg  = CTRL_1 ;
  1927. FieldMap[RESET_DI].Pos  = 0     ;
  1928. FieldMap[RESET_DI].Bits = 1     ;
  1929. FieldMap[RESET_DI].Type = UNSIGNED ;
  1930. FieldMap[RESET_DI].Mask = FieldCreateMask(RESET_DI) ;
  1931. /* CTRL_2*/
  1932. RegMap[CTRL_2].Addr   = 0x82 ;
  1933. RegMap[CTRL_2].Reset  = 0x27 ;
  1934. RegMap[CTRL_2].Value  = 0x00 ;
  1935. strcpy(RegMap[CTRL_2].Name,"CTRL_2") ;
  1936. /* FIELDS*/
  1937. strcpy(FieldMap[RS_UNCORR].Name,"RS_UNCORR") ;
  1938. FieldMap[RS_UNCORR].Reg  = CTRL_2 ;
  1939. FieldMap[RS_UNCORR].Pos  = 5     ;
  1940. FieldMap[RS_UNCORR].Bits = 1     ;
  1941. FieldMap[RS_UNCORR].Type = UNSIGNED ;
  1942. FieldMap[RS_UNCORR].Mask = FieldCreateMask(RS_UNCORR) ;
  1943. /* FIELDS*/
  1944. strcpy(FieldMap[CORNER_LOCK].Name,"CORNER_LOCK") ;
  1945. FieldMap[CORNER_LOCK].Reg  = CTRL_2 ;
  1946. FieldMap[CORNER_LOCK].Pos  = 4     ;
  1947. FieldMap[CORNER_LOCK].Bits = 1     ;
  1948. FieldMap[CORNER_LOCK].Type = UNSIGNED ;
  1949. FieldMap[CORNER_LOCK].Mask = FieldCreateMask(CORNER_LOCK) ;
  1950. /* FIELDS*/
  1951. strcpy(FieldMap[EQU_LMS2].Name,"EQU_LMS2") ;
  1952. FieldMap[EQU_LMS2].Reg  = CTRL_2 ;
  1953. FieldMap[EQU_LMS2].Pos  = 3     ;
  1954. FieldMap[EQU_LMS2].Bits = 1     ;
  1955. FieldMap[EQU_LMS2].Type = UNSIGNED ;
  1956. FieldMap[EQU_LMS2].Mask = FieldCreateMask(EQU_LMS2) ;
  1957. /* FIELDS*/
  1958. strcpy(FieldMap[EQU_LMS1].Name,"EQU_LMS1") ;
  1959. FieldMap[EQU_LMS1].Reg  = CTRL_2 ;
  1960. FieldMap[EQU_LMS1].Pos  = 2     ;
  1961. FieldMap[EQU_LMS1].Bits = 1     ;
  1962. FieldMap[EQU_LMS1].Type = UNSIGNED ;
  1963. FieldMap[EQU_LMS1].Mask = FieldCreateMask(EQU_LMS1) ;
  1964. /* FIELDS*/
  1965. strcpy(FieldMap[PMFAGC_IT].Name,"PMFAGC_IT") ;
  1966. FieldMap[PMFAGC_IT].Reg  = CTRL_2 ;
  1967. FieldMap[PMFAGC_IT].Pos  = 1     ;
  1968. FieldMap[PMFAGC_IT].Bits = 1     ;
  1969. FieldMap[PMFAGC_IT].Type = UNSIGNED ;
  1970. FieldMap[PMFAGC_IT].Mask = FieldCreateMask(PMFAGC_IT) ;
  1971. /* FIELDS*/
  1972. strcpy(FieldMap[WBAGC_IT].Name,"WBAGC_IT") ;
  1973. FieldMap[WBAGC_IT].Reg  = CTRL_2 ;
  1974. FieldMap[WBAGC_IT].Pos  = 0     ;
  1975. FieldMap[WBAGC_IT].Bits = 1     ;
  1976. FieldMap[WBAGC_IT].Type = UNSIGNED ;
  1977. FieldMap[WBAGC_IT].Mask = FieldCreateMask(WBAGC_IT) ;
  1978. /* CTRL_3*/
  1979. RegMap[CTRL_3].Addr   = 0x83 ;
  1980. RegMap[CTRL_3].Reset  = 0x08 ;
  1981. RegMap[CTRL_3].Value  = 0x02 ;
  1982. strcpy(RegMap[CTRL_3].Name,"CTRL_3") ;
  1983. /* FIELDS*/
  1984. strcpy(FieldMap[J83C].Name,"J83C") ;
  1985. FieldMap[J83C].Reg  = CTRL_3;
  1986. FieldMap[J83C].Pos  = 0     ;
  1987. FieldMap[J83C].Bits = 1     ;
  1988. FieldMap[J83C].Type = UNSIGNED ;
  1989. FieldMap[J83C].Mask = FieldCreateMask(J83C) ;
  1990. /* FIELDS*/
  1991. strcpy(FieldMap[DFS].Name,"DFS") ;
  1992. FieldMap[DFS].Reg  = CTRL_3;
  1993. FieldMap[DFS].Pos  = 1     ;
  1994. FieldMap[DFS].Bits = 1     ;
  1995. FieldMap[DFS].Type = UNSIGNED ;
  1996. FieldMap[DFS].Mask = FieldCreateMask(DFS) ;
  1997. /* FIELDS*/
  1998. strcpy(FieldMap[SPEC_INV].Name,"SPEC_INV") ;
  1999. FieldMap[SPEC_INV].Reg  = CTRL_3;
  2000. FieldMap[SPEC_INV].Pos  = 3     ;
  2001. FieldMap[SPEC_INV].Bits = 1     ;
  2002. FieldMap[SPEC_INV].Type = UNSIGNED ;
  2003. FieldMap[SPEC_INV].Mask = FieldCreateMask(SPEC_INV) ;
  2004. /* FIELDS*/
  2005. strcpy(FieldMap[RESET_RS].Name,"RESET_RS") ;
  2006. FieldMap[RESET_RS].Reg  = CTRL_3;
  2007. FieldMap[RESET_RS].Pos  = 4     ;
  2008. FieldMap[RESET_RS].Bits = 1     ;
  2009. FieldMap[RESET_RS].Type = UNSIGNED ;
  2010. FieldMap[RESET_RS].Mask = FieldCreateMask(RESET_RS) ;
  2011. /* FIELDS*/
  2012. strcpy(FieldMap[TEST_SEL].Name,"TEST_SEL") ;
  2013. FieldMap[TEST_SEL].Reg  = CTRL_3;
  2014. FieldMap[TEST_SEL].Pos  = 5     ;
  2015. FieldMap[TEST_SEL].Bits = 3     ;
  2016. FieldMap[TEST_SEL].Type = UNSIGNED ;
  2017. FieldMap[TEST_SEL].Mask = FieldCreateMask(TEST_SEL) ;
  2018. /* CTRL_4*/
  2019. RegMap[CTRL_4].Addr   = 0x84 ;
  2020. RegMap[CTRL_4].Reset  = 0x02 ; 
  2021. RegMap[CTRL_4].Value  = 0x0A ;
  2022. strcpy(RegMap[CTRL_4].Name,"CTRL_4") ;
  2023. /* FIELDS*/
  2024. strcpy(FieldMap[RESET_EQL].Name,"RESET_EQL") ;
  2025. FieldMap[RESET_EQL].Reg  = CTRL_4 ;
  2026. FieldMap[RESET_EQL].Pos  = 0     ;
  2027. FieldMap[RESET_EQL].Bits = 1     ;
  2028. FieldMap[RESET_EQL].Type = UNSIGNED ;
  2029. FieldMap[RESET_EQL].Mask = FieldCreateMask(RESET_EQL) ;
  2030. /* FIELDS*/
  2031. strcpy(FieldMap[CKX2SEL].Name,"CKX2SEL") ;
  2032. FieldMap[CKX2SEL].Reg  = CTRL_4 ;
  2033. FieldMap[CKX2SEL].Pos  = 1     ;
  2034. FieldMap[CKX2SEL].Bits = 1     ;
  2035. FieldMap[CKX2SEL].Type = UNSIGNED ;
  2036. FieldMap[CKX2SEL].Mask = FieldCreateMask(CKX2SEL) ;
  2037. /* FIELDS*/
  2038. strcpy(FieldMap[CKX2DIS].Name,"CKX2DIS") ;
  2039. FieldMap[CKX2DIS].Reg  = CTRL_4 ;
  2040. FieldMap[CKX2DIS].Pos  = 2     ;
  2041. FieldMap[CKX2DIS].Bits = 1     ;
  2042. FieldMap[CKX2DIS].Type = UNSIGNED ;
  2043. FieldMap[CKX2DIS].Mask = FieldCreateMask(CKX2DIS) ;
  2044. /* FIELDS*/
  2045. strcpy(FieldMap[INVADCLK].Name,"INVADCLK") ;
  2046. FieldMap[INVADCLK].Reg  = CTRL_4 ;
  2047. FieldMap[INVADCLK].Pos  = 3     ;
  2048. FieldMap[INVADCLK].Bits = 1     ;
  2049. FieldMap[INVADCLK].Type = UNSIGNED ;
  2050. FieldMap[INVADCLK].Mask = FieldCreateMask(INVADCLK) ;
  2051. /* FIELDS*/
  2052. strcpy(FieldMap[M_OEN].Name,"M_OEN") ;
  2053. FieldMap[M_OEN].Reg  = CTRL_4 ;
  2054. FieldMap[M_OEN].Pos  = 4     ;
  2055. FieldMap[M_OEN].Bits = 1     ;
  2056. FieldMap[M_OEN].Type = UNSIGNED ;
  2057. FieldMap[M_OEN].Mask = FieldCreateMask(M_OEN) ;
  2058. /* FIELDS*/
  2059. strcpy(FieldMap[AGC_OD].Name,"AGC_OD") ;
  2060. FieldMap[AGC_OD].Reg  = CTRL_4 ;
  2061. FieldMap[AGC_OD].Pos  = 5     ;
  2062. FieldMap[AGC_OD].Bits = 1     ;
  2063. FieldMap[AGC_OD].Type = UNSIGNED ;
  2064. FieldMap[AGC_OD].Mask = FieldCreateMask(AGC_OD) ;
  2065. /* CTRL_5*/
  2066. RegMap[CTRL_5].Addr   = 0x85 ;
  2067. RegMap[CTRL_5].Reset  = 0xA2 ;
  2068. RegMap[CTRL_5].Value  = 0x00 ;
  2069. strcpy(RegMap[CTRL_5].Name,"CTRL_5") ;
  2070. /* FIELDS*/
  2071. strcpy(FieldMap[LOCKPOL].Name,"LOCKPOL") ;
  2072. FieldMap[LOCKPOL].Reg  = CTRL_5 ;
  2073. FieldMap[LOCKPOL].Pos  = 7     ;
  2074. FieldMap[LOCKPOL].Bits = 1     ;
  2075. FieldMap[LOCKPOL].Type = UNSIGNED ;
  2076. FieldMap[LOCKPOL].Mask = FieldCreateMask(LOCKPOL) ;
  2077. /* FIELDS*/
  2078. strcpy(FieldMap[DY_SY_MASK].Name,"DY_SY_MASK") ;
  2079. FieldMap[DY_SY_MASK].Reg  = CTRL_5 ;
  2080. FieldMap[DY_SY_MASK].Pos  = 6     ;
  2081. FieldMap[DY_SY_MASK].Bits = 1     ;
  2082. FieldMap[DY_SY_MASK].Type = UNSIGNED ;
  2083. FieldMap[DY_SY_MASK].Mask = FieldCreateMask(DY_SY_MASK) ;
  2084. /* FIELDS*/
  2085. strcpy(FieldMap[DY_SY_EV].Name,"DY_SY_EV") ;
  2086. FieldMap[DY_SY_EV].Reg  = CTRL_5 ;
  2087. FieldMap[DY_SY_EV].Pos  = 5     ;
  2088. FieldMap[DY_SY_EV].Bits = 1     ;
  2089. FieldMap[DY_SY_EV].Type = UNSIGNED ;
  2090. FieldMap[DY_SY_EV].Mask = FieldCreateMask(DY_SY_EV) ;
  2091. /* FIELDS*/
  2092. strcpy(FieldMap[DY_SY_DIR].Name,"DY_SY_DIR") ;
  2093. FieldMap[DY_SY_DIR].Reg  = CTRL_5 ;
  2094. FieldMap[DY_SY_DIR].Pos  = 4     ;
  2095. FieldMap[DY_SY_DIR].Bits = 1     ;
  2096. FieldMap[DY_SY_DIR].Type = UNSIGNED ;
  2097. FieldMap[DY_SY_DIR].Mask = FieldCreateMask(DY_SY_DIR) ;
  2098. /* FIELDS*/
  2099. strcpy(FieldMap[SYNC_MSK].Name,"SYNC_MSK") ;
  2100. FieldMap[SYNC_MSK].Reg  = CTRL_5 ;
  2101. FieldMap[SYNC_MSK].Pos  = 2     ;
  2102. FieldMap[SYNC_MSK].Bits = 1     ;
  2103. FieldMap[SYNC_MSK].Type = UNSIGNED ;
  2104. FieldMap[SYNC_MSK].Mask = FieldCreateMask(SYNC_MSK) ;
  2105. /* FIELDS*/
  2106. strcpy(FieldMap[SYNC_EV].Name,"SYNC_EV") ;
  2107. FieldMap[SYNC_EV].Reg  = CTRL_5 ;
  2108. FieldMap[SYNC_EV].Pos  = 1     ;
  2109. FieldMap[SYNC_EV].Bits = 1     ;
  2110. FieldMap[SYNC_EV].Type = UNSIGNED ;
  2111. FieldMap[SYNC_EV].Mask = FieldCreateMask(SYNC_EV) ;
  2112. /* FIELDS*/
  2113. strcpy(FieldMap[SYNC_DIR].Name,"SYNC_DIR") ;
  2114. FieldMap[SYNC_DIR].Reg  = CTRL_5 ;
  2115. FieldMap[SYNC_DIR].Pos  = 0     ;
  2116. FieldMap[SYNC_DIR].Bits = 1     ;
  2117. FieldMap[SYNC_DIR].Type = UNSIGNED ;
  2118. FieldMap[SYNC_DIR].Mask = FieldCreateMask(SYNC_DIR) ;
  2119. /* CTRL_6*/
  2120. RegMap[CTRL_6].Addr   = 0x86 ;
  2121. RegMap[CTRL_6].Reset  = 0x08 ;
  2122. RegMap[CTRL_6].Value  = 0x40 ;
  2123. strcpy(RegMap[CTRL_6].Name,"CTRL_6") ;
  2124. /* FIELDS*/
  2125. strcpy(FieldMap[I2CT_EN].Name,"I2CT_EN") ;
  2126. FieldMap[I2CT_EN].Reg  = CTRL_6 ;
  2127. FieldMap[I2CT_EN].Pos  = 7     ;
  2128. FieldMap[I2CT_EN].Bits = 1     ;
  2129. FieldMap[I2CT_EN].Type = UNSIGNED ;
  2130. FieldMap[I2CT_EN].Mask = FieldCreateMask(I2CT_EN) ;
  2131. /* FIELDS*/
  2132. strcpy(FieldMap[SCLT_OD].Name,"SCLT_OD") ;
  2133. FieldMap[SCLT_OD].Reg  = CTRL_6 ;
  2134. FieldMap[SCLT_OD].Pos  = 6     ;
  2135. FieldMap[SCLT_OD].Bits = 1     ;
  2136. FieldMap[SCLT_OD].Type = UNSIGNED ;
  2137. FieldMap[SCLT_OD].Mask = FieldCreateMask(SCLT_OD) ;
  2138. /* FIELDS*/
  2139. strcpy(FieldMap[EXTADCLK_EN].Name,"EXTADCLK_EN") ;
  2140. FieldMap[EXTADCLK_EN].Reg  = CTRL_6 ;
  2141. FieldMap[EXTADCLK_EN].Pos  = 5     ;
  2142. FieldMap[EXTADCLK_EN].Bits = 1     ;
  2143. FieldMap[EXTADCLK_EN].Type = UNSIGNED ;
  2144. FieldMap[EXTADCLK_EN].Mask = FieldCreateMask(EXTADCLK_EN) ;
  2145. /* FIELDS*/
  2146. strcpy(FieldMap[ITLOCKSEL].Name,"ITLOCKSEL") ;
  2147. FieldMap[ITLOCKSEL].Reg  = CTRL_6 ;
  2148. FieldMap[ITLOCKSEL].Pos  = 4     ;
  2149. FieldMap[ITLOCKSEL].Bits = 1     ;
  2150. FieldMap[ITLOCKSEL].Type = UNSIGNED ;
  2151. FieldMap[ITLOCKSEL].Mask = FieldCreateMask(ITLOCKSEL) ;
  2152. /* FIELDS*/
  2153. strcpy(FieldMap[ITPWMSEL].Name,"ITPWMSEL") ;
  2154. FieldMap[ITPWMSEL].Reg  = CTRL_6 ;
  2155. FieldMap[ITPWMSEL].Pos  = 3     ;
  2156. FieldMap[ITPWMSEL].Bits = 1     ;
  2157. FieldMap[ITPWMSEL].Type = UNSIGNED ;
  2158. FieldMap[ITPWMSEL].Mask = FieldCreateMask(ITPWMSEL) ;
  2159. /* FIELDS*/
  2160. strcpy(FieldMap[LOCKSCE].Name,"LOCKSCE") ;
  2161. FieldMap[LOCKSCE].Reg  = CTRL_6 ;
  2162. FieldMap[LOCKSCE].Pos  = 1     ;
  2163. FieldMap[LOCKSCE].Bits = 2     ;
  2164. FieldMap[LOCKSCE].Type = UNSIGNED ;
  2165. FieldMap[LOCKSCE].Mask = FieldCreateMask(LOCKSCE) ;
  2166. /* FIELDS*/
  2167. strcpy(FieldMap[TWB_ACT].Name,"TWB_ACT") ;
  2168. FieldMap[TWB_ACT].Reg  = CTRL_6 ;
  2169. FieldMap[TWB_ACT].Pos  = 0     ;
  2170. FieldMap[TWB_ACT].Bits = 1     ;
  2171. FieldMap[TWB_ACT].Type = UNSIGNED ;
  2172. FieldMap[TWB_ACT].Mask = FieldCreateMask(TWB_ACT) ;
  2173. /* CTRL_7*/
  2174. RegMap[CTRL_7].Addr   = 0x87 ;
  2175. RegMap[CTRL_7].Reset  = 0x63 ; 
  2176. RegMap[CTRL_7].Value  = 0x03 ;
  2177. strcpy(RegMap[CTRL_7].Name,"CTRL_7") ;
  2178. /* FIELDS*/
  2179. strcpy(FieldMap[SOURCESEL].Name,"SOURCESEL") ;
  2180. FieldMap[SOURCESEL].Reg  = CTRL_7 ;
  2181. FieldMap[SOURCESEL].Pos  = 7     ;
  2182. FieldMap[SOURCESEL].Bits = 1     ;
  2183. FieldMap[SOURCESEL].Type = UNSIGNED ;
  2184. FieldMap[SOURCESEL].Mask = FieldCreateMask(SOURCESEL) ;
  2185. /* FIELDS*/
  2186. strcpy(FieldMap[PRGCLKDIV].Name,"PRGCLKDIV") ;
  2187. FieldMap[PRGCLKDIV].Reg  = CTRL_7 ;
  2188. FieldMap[PRGCLKDIV].Pos  = 4     ;
  2189. FieldMap[PRGCLKDIV].Bits = 3     ;
  2190. FieldMap[PRGCLKDIV].Type = UNSIGNED ;
  2191. FieldMap[PRGCLKDIV].Mask = FieldCreateMask(PRGCLKDIV) ;
  2192. /* FIELDS*/
  2193. strcpy(FieldMap[AUXCLKSEL].Name,"AUXCLKSEL") ;
  2194. FieldMap[AUXCLKSEL].Reg  = CTRL_7 ;
  2195. FieldMap[AUXCLKSEL].Pos  = 3      ;
  2196. FieldMap[AUXCLKSEL].Bits = 1      ;
  2197. FieldMap[AUXCLKSEL].Type = UNSIGNED ;
  2198. FieldMap[AUXCLKSEL].Mask = FieldCreateMask(AUXCLKSEL) ;
  2199. /* FIELDS*/
  2200. strcpy(FieldMap[ITLOCK_OD].Name,"ITLOCK_OD") ;
  2201. FieldMap[ITLOCK_OD].Reg  = CTRL_7 ;
  2202. FieldMap[ITLOCK_OD].Pos  = 1      ;
  2203. FieldMap[ITLOCK_OD].Bits = 1      ;
  2204. FieldMap[ITLOCK_OD].Type = UNSIGNED ;
  2205. FieldMap[ITLOCK_OD].Mask = FieldCreateMask(ITLOCK_OD) ;
  2206. /* FIELDS*/
  2207. strcpy(FieldMap[ITPWM_OD].Name,"ITPWM_OD") ;
  2208. FieldMap[ITPWM_OD].Reg  = CTRL_7 ;
  2209. FieldMap[ITPWM_OD].Pos  = 0      ;
  2210. FieldMap[ITPWM_OD].Bits = 1      ;
  2211. FieldMap[ITPWM_OD].Type = UNSIGNED ;
  2212. FieldMap[ITPWM_OD].Mask = FieldCreateMask(ITPWM_OD) ;
  2213. /* CTRL_8*/
  2214. RegMap[CTRL_8].Addr   = 0x88 ;
  2215. RegMap[CTRL_8].Reset  = 0x00 ;
  2216. RegMap[CTRL_8].Value  = 0x00 ;
  2217. strcpy(RegMap[CTRL_8].Name,"CTRL_8") ;
  2218. /* FIELDS*/
  2219. strcpy(FieldMap[AGC12SEL].Name,"AGC12SEL") ;
  2220. FieldMap[AGC12SEL].Reg  = CTRL_8 ;
  2221. FieldMap[AGC12SEL].Pos  = 7      ;
  2222. FieldMap[AGC12SEL].Bits = 1      ;
  2223. FieldMap[AGC12SEL].Type = UNSIGNED ;
  2224. FieldMap[AGC12SEL].Mask = FieldCreateMask(AGC12SEL) ;
  2225. /* FIELDS*/
  2226. strcpy(FieldMap[AGC12B_EN].Name,"AGC12B_EN") ;
  2227. FieldMap[AGC12B_EN].Reg  = CTRL_8 ;
  2228. FieldMap[AGC12B_EN].Pos  = 6      ;
  2229. FieldMap[AGC12B_EN].Bits = 1      ;
  2230. FieldMap[AGC12B_EN].Type = UNSIGNED ;
  2231. FieldMap[AGC12B_EN].Mask = FieldCreateMask(AGC12B_EN) ;
  2232. /* FIELDS*/
  2233. strcpy(FieldMap[SIGMA_INV_1].Name,"SIGMA_INV_1") ;
  2234. FieldMap[SIGMA_INV_1].Reg  = CTRL_8 ;
  2235. FieldMap[SIGMA_INV_1].Pos  = 5      ;
  2236. FieldMap[SIGMA_INV_1].Bits = 1      ;
  2237. FieldMap[SIGMA_INV_1].Type = UNSIGNED ;
  2238. FieldMap[SIGMA_INV_1].Mask = FieldCreateMask(SIGMA_INV_1) ;
  2239. /* FIELDS*/
  2240. strcpy(FieldMap[SIGMA_INV_2].Name,"SIGMA_INV_2") ;
  2241. FieldMap[SIGMA_INV_2].Reg  = CTRL_8 ;
  2242. FieldMap[SIGMA_INV_2].Pos  = 4      ;
  2243. FieldMap[SIGMA_INV_2].Bits = 1      ;
  2244. FieldMap[SIGMA_INV_2].Type = UNSIGNED ;
  2245. FieldMap[SIGMA_INV_2].Mask = FieldCreateMask(SIGMA_INV_2) ;
  2246. /* FIELDS*/
  2247. strcpy(FieldMap[EN_CORNER_DET].Name,"EN_CORNER_DET") ;
  2248. FieldMap[EN_CORNER_DET].Reg  = CTRL_8 ;
  2249. FieldMap[EN_CORNER_DET].Pos  = 3      ;
  2250. FieldMap[EN_CORNER_DET].Bits = 1      ;
  2251. FieldMap[EN_CORNER_DET].Type = UNSIGNED ;
  2252. FieldMap[EN_CORNER_DET].Mask = FieldCreateMask(EN_CORNER_DET) ;
  2253. /* CTRL_9*/
  2254. RegMap[CTRL_9].Addr   = 0x89 ;
  2255. RegMap[CTRL_9].Reset  = 0x00 ;
  2256. RegMap[CTRL_9].Value  = 0x00 ;
  2257. strcpy(RegMap[CTRL_9].Name,"CTRL_9") ;
  2258. /* FIELDS*/
  2259. strcpy(FieldMap[AUTOQAMMODE_SEL].Name,"AUTOQAMMODE_SEL") ;
  2260. FieldMap[AUTOQAMMODE_SEL].Reg  = CTRL_9 ;
  2261. FieldMap[AUTOQAMMODE_SEL].Pos  = 7      ;
  2262. FieldMap[AUTOQAMMODE_SEL].Bits = 1      ;
  2263. FieldMap[AUTOQAMMODE_SEL].Type = UNSIGNED ;
  2264. FieldMap[AUTOQAMMODE_SEL].Mask = FieldCreateMask(AUTOQAMMODE_SEL) ;
  2265. /* FIELDS*/
  2266. strcpy(FieldMap[AUTOCONSTEL_TIMER].Name,"AUTOCONSTEL_TIMER") ;
  2267. FieldMap[AUTOCONSTEL_TIMER].Reg  = CTRL_9 ;
  2268. FieldMap[AUTOCONSTEL_TIMER].Pos  = 3      ;
  2269. FieldMap[AUTOCONSTEL_TIMER].Bits = 4      ;
  2270. FieldMap[AUTOCONSTEL_TIMER].Type = UNSIGNED ;
  2271. FieldMap[AUTOCONSTEL_TIMER].Mask = FieldCreateMask(AUTOCONSTEL_TIMER) ;
  2272. /* FIELDS*/
  2273. strcpy(FieldMap[AUTOSTOP_CONSTEL].Name,"AUTOSTOP_CONSTEL") ;
  2274. FieldMap[AUTOSTOP_CONSTEL].Reg  = CTRL_9 ;
  2275. FieldMap[AUTOSTOP_CONSTEL].Pos  = 2      ;
  2276. FieldMap[AUTOSTOP_CONSTEL].Bits = 1      ;
  2277. FieldMap[AUTOSTOP_CONSTEL].Type = UNSIGNED ;
  2278. FieldMap[AUTOSTOP_CONSTEL].Mask = FieldCreateMask(AUTOSTOP_CONSTEL) ;
  2279. /* FIELDS*/
  2280. strcpy(FieldMap[AUTOCONSTEL_ON].Name,"AUTOCONSTEL_ON") ;
  2281. FieldMap[AUTOCONSTEL_ON].Reg  = CTRL_9 ;
  2282. FieldMap[AUTOCONSTEL_ON].Pos  = 1      ;
  2283. FieldMap[AUTOCONSTEL_ON].Bits = 1      ;
  2284. FieldMap[AUTOCONSTEL_ON].Type = UNSIGNED ;
  2285. FieldMap[AUTOCONSTEL_ON].Mask = FieldCreateMask(AUTOCONSTEL_ON) ;
  2286. /* DEINT_SYNC_0*/
  2287. RegMap[DEINT_SYNC_0].Addr   = 0x90 ;
  2288. RegMap[DEINT_SYNC_0].Reset  = 0x00 ;
  2289. RegMap[DEINT_SYNC_0].Value  = 0x01 ;
  2290. strcpy(RegMap[DEINT_SYNC_0].Name,"DEINT_SYNC_0") ;
  2291. /* FIELDS*/
  2292. strcpy(FieldMap[DI_UNLOCK].Name,"DI_UNLOCK") ;
  2293. FieldMap[DI_UNLOCK].Reg  = DEINT_SYNC_0 ;
  2294. FieldMap[DI_UNLOCK].Pos  = 7     ;
  2295. FieldMap[DI_UNLOCK].Bits = 1     ;
  2296. FieldMap[DI_UNLOCK].Type = UNSIGNED ;
  2297. FieldMap[DI_UNLOCK].Mask = FieldCreateMask(DI_UNLOCK) ;
  2298. /* FIELDS*/
  2299. strcpy(FieldMap[DI_FREEZE].Name,"DI_FREEZE") ;
  2300. FieldMap[DI_FREEZE].Reg  = DEINT_SYNC_0 ;
  2301. FieldMap[DI_FREEZE].Pos  = 6     ;
  2302. FieldMap[DI_FREEZE].Bits = 1     ;
  2303. FieldMap[DI_FREEZE].Type = UNSIGNED ;
  2304. FieldMap[DI_FREEZE].Mask = FieldCreateMask(DI_FREEZE) ;
  2305. /* FIELDS*/
  2306. strcpy(FieldMap[MISMATCH].Name,"MISMATCH") ;
  2307. FieldMap[MISMATCH].Reg  = DEINT_SYNC_0 ;
  2308. FieldMap[MISMATCH].Pos  = 4     ;
  2309. FieldMap[MISMATCH].Bits = 2     ;
  2310. FieldMap[MISMATCH].Type = UNSIGNED ;
  2311. FieldMap[MISMATCH].Mask = FieldCreateMask(MISMATCH) ;
  2312. /* FIELDS*/
  2313. strcpy(FieldMap[ACQ_MODE].Name,"ACQ_MODE") ;
  2314. FieldMap[ACQ_MODE].Reg  = DEINT_SYNC_0 ;
  2315. FieldMap[ACQ_MODE].Pos  = 2     ;
  2316. FieldMap[ACQ_MODE].Bits = 2     ;
  2317. FieldMap[ACQ_MODE].Type = UNSIGNED ;
  2318. FieldMap[ACQ_MODE].Mask = FieldCreateMask(ACQ_MODE) ;
  2319. /* FIELDS*/
  2320. strcpy(FieldMap[TRKMODE].Name,"TRKMODE") ;
  2321. FieldMap[TRKMODE].Reg  = DEINT_SYNC_0 ;
  2322. FieldMap[TRKMODE].Pos  = 0     ;
  2323. FieldMap[TRKMODE].Bits = 2     ;
  2324. FieldMap[TRKMODE].Type = UNSIGNED ;
  2325. FieldMap[TRKMODE].Mask = FieldCreateMask(TRKMODE) ;
  2326. /* DEINT_SYNC_1*/
  2327. RegMap[DEINT_SYNC_1].Addr   = 0x91 ;
  2328. RegMap[DEINT_SYNC_1].Reset  = 0x04 ;
  2329. RegMap[DEINT_SYNC_1].Value  = 0x01 ;
  2330. strcpy(RegMap[DEINT_SYNC_1].Name,"DEINT_SYNC_1") ;
  2331. /* FIELDS*/
  2332. strcpy(FieldMap[SYNLOST].Name,"SYNLOST") ;
  2333. FieldMap[SYNLOST].Reg  = DEINT_SYNC_1 ;
  2334. FieldMap[SYNLOST].Pos  = 5     ;
  2335. FieldMap[SYNLOST].Bits = 1     ;
  2336. FieldMap[SYNLOST].Type = UNSIGNED ;
  2337. FieldMap[SYNLOST].Mask = FieldCreateMask(SYNLOST) ;
  2338. /* BERT_0*/
  2339. RegMap[BERT_0].Addr   = 0xA0 ;
  2340. RegMap[BERT_0].Reset  = 0x85 ; /*TIME 0.9SEC*/
  2341. RegMap[BERT_0].Value  = 0x00 ;
  2342. strcpy(RegMap[BERT_0].Name,"BERT_0") ;
  2343. /* FIELDS*/
  2344. strcpy(FieldMap[BERT_ON].Name,"BERT_ON") ;
  2345. FieldMap[BERT_ON].Reg  = BERT_0 ;
  2346. FieldMap[BERT_ON].Pos  = 7     ;
  2347. FieldMap[BERT_ON].Bits = 1     ;
  2348. FieldMap[BERT_ON].Type = UNSIGNED ;
  2349. FieldMap[BERT_ON].Mask = FieldCreateMask(BERT_ON) ;
  2350. /* FIELDS*/
  2351. strcpy(FieldMap[ERR_SOURCE].Name,"ERR_SOURCE") ;
  2352. FieldMap[ERR_SOURCE].Reg  = BERT_0 ;
  2353. FieldMap[ERR_SOURCE].Pos  = 4     ;
  2354. FieldMap[ERR_SOURCE].Bits = 1     ;
  2355. FieldMap[ERR_SOURCE].Type = UNSIGNED ;
  2356. FieldMap[ERR_SOURCE].Mask = FieldCreateMask(ERR_SOURCE) ;
  2357. /* FIELDS*/
  2358. strcpy(FieldMap[ERR_MODE].Name,"ERR_MODE") ;
  2359. FieldMap[ERR_MODE].Reg  = BERT_0 ;
  2360. FieldMap[ERR_MODE].Pos  = 3     ;
  2361. FieldMap[ERR_MODE].Bits = 1     ;
  2362. FieldMap[ERR_MODE].Type = UNSIGNED ;
  2363. FieldMap[ERR_MODE].Mask = FieldCreateMask(ERR_MODE) ;
  2364. /* FIELDS*/
  2365. strcpy(FieldMap[NBYTE].Name,"NBYTE") ;
  2366. FieldMap[NBYTE].Reg  = BERT_0 ;
  2367. FieldMap[NBYTE].Pos  = 0     ;
  2368. FieldMap[NBYTE].Bits = 3     ;
  2369. FieldMap[NBYTE].Type = UNSIGNED ;
  2370. FieldMap[NBYTE].Mask = FieldCreateMask(NBYTE) ;
  2371. /* BERT_1*/
  2372. RegMap[BERT_1].Addr   = 0xA1 ;
  2373. RegMap[BERT_1].Reset  = 0x22 ;
  2374. RegMap[BERT_1].Value  = 0x00 ;
  2375. strcpy(RegMap[BERT_1].Name,"BERT_1") ;
  2376. /* FIELDS*/
  2377. strcpy(FieldMap[ERRCOUNT_LO].Name,"ERRCOUNT_LO") ;
  2378. FieldMap[ERRCOUNT_LO].Reg  = BERT_1 ;
  2379. FieldMap[ERRCOUNT_LO].Pos  = 0     ;
  2380. FieldMap[ERRCOUNT_LO].Bits = 8     ;
  2381. FieldMap[ERRCOUNT_LO].Type = UNSIGNED ;
  2382. FieldMap[ERRCOUNT_LO].Mask = FieldCreateMask(ERRCOUNT_LO) ;
  2383. /* BERT_2*/
  2384. RegMap[BERT_2].Addr   = 0xA2 ;
  2385. RegMap[BERT_2].Reset  = 0x4C ;
  2386. RegMap[BERT_2].Value  = 0x00 ;
  2387. strcpy(RegMap[BERT_2].Name,"BERT_2") ;
  2388. /* FIELDS*/
  2389. strcpy(FieldMap[ERRCOUNT_HI].Name,"ERRCOUNT_HI") ;
  2390. FieldMap[ERRCOUNT_HI].Reg  = BERT_2 ;
  2391. FieldMap[ERRCOUNT_HI].Pos  = 0     ;
  2392. FieldMap[ERRCOUNT_HI].Bits = 8     ;
  2393. FieldMap[ERRCOUNT_HI].Type = UNSIGNED ;
  2394. FieldMap[ERRCOUNT_HI].Mask = FieldCreateMask(ERRCOUNT_HI) ;
  2395. /* DEINT_0*/
  2396. RegMap[DEINT_0].Addr   = 0xB0 ;
  2397. RegMap[DEINT_0].Reset  = 0x91 ;
  2398. RegMap[DEINT_0].Value  = 0x91 ;
  2399. strcpy(RegMap[DEINT_0].Name,"DEINT_0") ;
  2400. /* FIELDS*/
  2401. strcpy(FieldMap[USEINT].Name,"USEINT") ;
  2402. FieldMap[USEINT].Reg  = DEINT_0 ;
  2403. FieldMap[USEINT].Pos  = 7     ;
  2404. FieldMap[USEINT].Bits = 1     ;
  2405. FieldMap[USEINT].Type = UNSIGNED ;
  2406. FieldMap[USEINT].Mask = FieldCreateMask(USEINT) ;
  2407. /* FIELDS*/
  2408. strcpy(FieldMap[DAVIC].Name,"DAVIC") ;
  2409. FieldMap[DAVIC].Reg  = DEINT_0 ;
  2410. FieldMap[DAVIC].Pos  = 6     ;
  2411. FieldMap[DAVIC].Bits = 1     ;
  2412. FieldMap[DAVIC].Type = UNSIGNED ;
  2413. FieldMap[DAVIC].Mask = FieldCreateMask(DAVIC) ;
  2414. /* FIELDS*/
  2415. strcpy(FieldMap[M].Name,"M") ;
  2416. FieldMap[M].Reg  = DEINT_0 ;
  2417. FieldMap[M].Pos  = 0     ;
  2418. FieldMap[M].Bits = 5     ;
  2419. FieldMap[M].Type = UNSIGNED ;
  2420. FieldMap[M].Mask = FieldCreateMask(M) ;
  2421. /* DEINT_1*/
  2422. RegMap[DEINT_1].Addr   = 0xB1 ;
  2423. RegMap[DEINT_1].Reset  = 0x0B ;
  2424. RegMap[DEINT_1].Value  = 0x0B ;
  2425. strcpy(RegMap[DEINT_1].Name,"DEINT_1") ;
  2426. /* FIELDS*/
  2427. strcpy(FieldMap[DEPTH].Name,"DEPTH") ;
  2428. FieldMap[DEPTH].Reg  = DEINT_1 ;
  2429. FieldMap[DEPTH].Pos  = 0     ;
  2430. FieldMap[DEPTH].Bits = 8     ;
  2431. FieldMap[DEPTH].Type = UNSIGNED ;
  2432. FieldMap[DEPTH].Mask = FieldCreateMask(DEPTH) ;
  2433. /* OUTFORMAT_0*/
  2434. RegMap[OUTFORMAT_0].Addr   = 0xC0 ;
  2435. RegMap[OUTFORMAT_0].Reset  = 0x4b ; /*2001.03.02 papi*/
  2436. RegMap[OUTFORMAT_0].Value  = 0x4b ; /*2001.03.02*/
  2437. strcpy(RegMap[OUTFORMAT_0].Name,"OUTFORMAT_0") ;
  2438. /* FIELDS*/
  2439. strcpy(FieldMap[REFRESH47].Name,"REFRESH47") ;
  2440. FieldMap[REFRESH47].Reg  = OUTFORMAT_0 ;
  2441. FieldMap[REFRESH47].Pos  = 6     ;
  2442. FieldMap[REFRESH47].Bits = 1     ;
  2443. FieldMap[REFRESH47].Type = UNSIGNED ;
  2444. FieldMap[REFRESH47].Mask = FieldCreateMask(REFRESH47) ;
  2445. /* FIELDS*/
  2446. strcpy(FieldMap[BE_BYPASS].Name,"BE_BYPASS") ;
  2447. FieldMap[BE_BYPASS].Reg  = OUTFORMAT_0 ;
  2448. FieldMap[BE_BYPASS].Pos  = 5     ;
  2449. FieldMap[BE_BYPASS].Bits = 1     ;
  2450. FieldMap[BE_BYPASS].Type = UNSIGNED ;
  2451. FieldMap[BE_BYPASS].Mask = FieldCreateMask(BE_BYPASS) ;
  2452. /* FIELDS*/
  2453. strcpy(FieldMap[CKOUTPAR].Name,"CKOUTPAR") ;
  2454. FieldMap[CKOUTPAR].Reg  = OUTFORMAT_0 ;
  2455. FieldMap[CKOUTPAR].Pos  = 4     ;
  2456. FieldMap[CKOUTPAR].Bits = 1     ;
  2457. FieldMap[CKOUTPAR].Type = UNSIGNED ;
  2458. FieldMap[CKOUTPAR].Mask = FieldCreateMask(CKOUTPAR) ;
  2459. /* FIELDS*/
  2460. strcpy(FieldMap[CT_NBST].Name,"CT_NBST") ;
  2461. FieldMap[CT_NBST].Reg  = OUTFORMAT_0 ;
  2462. FieldMap[CT_NBST].Pos  = 3     ;
  2463. FieldMap[CT_NBST].Bits = 1     ;
  2464. FieldMap[CT_NBST].Type = UNSIGNED ;
  2465. FieldMap[CT_NBST].Mask = FieldCreateMask(CT_NBST) ;
  2466. /* FIELDS*/
  2467. strcpy(FieldMap[S_NP].Name,"S_NP") ;
  2468. FieldMap[S_NP].Reg  = OUTFORMAT_0 ;
  2469. FieldMap[S_NP].Pos  = 2     ;
  2470. FieldMap[S_NP].Bits = 1     ;
  2471. FieldMap[S_NP].Type = UNSIGNED ;
  2472. FieldMap[S_NP].Mask = FieldCreateMask(S_NP) ;
  2473. /* FIELDS*/
  2474. strcpy(FieldMap[TEI_ENA].Name,"TEI_ENA") ;
  2475. FieldMap[TEI_ENA].Reg  = OUTFORMAT_0 ;
  2476. FieldMap[TEI_ENA].Pos  = 1     ;
  2477. FieldMap[TEI_ENA].Bits = 1     ;
  2478. FieldMap[TEI_ENA].Type = UNSIGNED ;
  2479. FieldMap[TEI_ENA].Mask = FieldCreateMask(TEI_ENA) ;
  2480. /* FIELDS*/
  2481. strcpy(FieldMap[DS_ENA].Name,"DS_ENA") ;
  2482. FieldMap[DS_ENA].Reg  = OUTFORMAT_0 ;
  2483. FieldMap[DS_ENA].Pos  = 0     ;
  2484. FieldMap[DS_ENA].Bits = 1     ;
  2485. FieldMap[DS_ENA].Type = UNSIGNED ;
  2486. FieldMap[DS_ENA].Mask = FieldCreateMask(DS_ENA) ;
  2487. /* OUTFORMAT_1*/
  2488. RegMap[OUTFORMAT_1].Addr   = 0xC1 ;
  2489. RegMap[OUTFORMAT_1].Reset  = 0x00 ; /*2001.03.02 papi*/
  2490. RegMap[OUTFORMAT_1].Value  = 0x00 ;
  2491. strcpy(RegMap[OUTFORMAT_1].Name,"OUTFORMAT_1") ;
  2492. /* FIELDS*/
  2493. strcpy(FieldMap[SYNC_STRIP].Name,"SYNC_STRIP") ;
  2494. FieldMap[SYNC_STRIP].Reg  = OUTFORMAT_1 ;
  2495. FieldMap[SYNC_STRIP].Pos  = 7     ;
  2496. FieldMap[SYNC_STRIP].Bits = 1     ;
  2497. FieldMap[SYNC_STRIP].Type = UNSIGNED ;
  2498. FieldMap[SYNC_STRIP].Mask = FieldCreateMask(SYNC_STRIP) ;
  2499. /* FIELDS*/
  2500. strcpy(FieldMap[CI_EN].Name,"CI_EN") ;
  2501. FieldMap[CI_EN].Reg  = OUTFORMAT_1 ;
  2502. FieldMap[CI_EN].Pos  = 6     ;
  2503. FieldMap[CI_EN].Bits = 1     ;
  2504. FieldMap[CI_EN].Type = UNSIGNED ;
  2505. FieldMap[CI_EN].Mask = FieldCreateMask(CI_EN) ;
  2506. /* FIELDS*/
  2507. strcpy(FieldMap[CICLK_POL].Name,"CICLK_POL") ;
  2508. FieldMap[CICLK_POL].Reg  = OUTFORMAT_1 ;
  2509. FieldMap[CICLK_POL].Pos  = 5     ;
  2510. FieldMap[CICLK_POL].Bits = 1     ;
  2511. FieldMap[CICLK_POL].Type = UNSIGNED ;
  2512. FieldMap[CICLK_POL].Mask = FieldCreateMask(CICLK_POL) ;
  2513. /* FIELDS*/
  2514. strcpy(FieldMap[CICLK_BASE].Name,"CICLK_BASE") ;
  2515. FieldMap[CICLK_BASE].Reg  = OUTFORMAT_1 ;
  2516. FieldMap[CICLK_BASE].Pos  = 4     ;
  2517. FieldMap[CICLK_BASE].Bits = 1     ;
  2518. FieldMap[CICLK_BASE].Type = UNSIGNED ;
  2519. FieldMap[CICLK_BASE].Mask = FieldCreateMask(CICLK_BASE) ;
  2520. /* OUTFORMAT_2*/
  2521. RegMap[OUTFORMAT_2].Addr   = 0xC2 ;
  2522. RegMap[OUTFORMAT_2].Reset  = 0x00 ;
  2523. RegMap[OUTFORMAT_2].Value  = 0x24 ;
  2524. strcpy(RegMap[OUTFORMAT_2].Name,"OUTFORMAT_2") ;
  2525. /* FIELDS*/
  2526. strcpy(FieldMap[CI_DIVRANGE].Name,"CI_DIVRANGE") ;
  2527. FieldMap[CI_DIVRANGE].Reg  = OUTFORMAT_2 ;
  2528. FieldMap[CI_DIVRANGE].Pos  = 0     ;
  2529. FieldMap[CI_DIVRANGE].Bits = 6     ;
  2530. FieldMap[CI_DIVRANGE].Type = UNSIGNED ;
  2531. FieldMap[CI_DIVRANGE].Mask = FieldCreateMask(CI_DIVRANGE) ;
  2532. /* RS_DESC_0*/
  2533. RegMap[RS_DESC_0].Addr   = 0xD0 ;
  2534. RegMap[RS_DESC_0].Reset  = 0x6E ;
  2535. RegMap[RS_DESC_0].Value  = 0x00 ;
  2536. strcpy(RegMap[RS_DESC_0].Name,"RS_DESC_0") ;
  2537. /* FIELDS*/
  2538. strcpy(FieldMap[BK_CT_LO].Name,"BK_CT_LO") ;
  2539. FieldMap[BK_CT_LO].Reg  = RS_DESC_0 ;
  2540. FieldMap[BK_CT_LO].Pos  = 0     ;
  2541. FieldMap[BK_CT_LO].Bits = 8     ;
  2542. FieldMap[BK_CT_LO].Type = UNSIGNED ;
  2543. FieldMap[BK_CT_LO].Mask = FieldCreateMask(BK_CT_LO) ;
  2544. /* RS_DESC_1*/
  2545. RegMap[RS_DESC_1].Addr   = 0xD1 ;
  2546. RegMap[RS_DESC_1].Reset  = 0x01 ;
  2547. RegMap[RS_DESC_1].Value  = 0x00 ;
  2548. strcpy(RegMap[RS_DESC_1].Name,"RS_DESC_1") ;
  2549. /* FIELDS*/
  2550. strcpy(FieldMap[BK_CT_HI].Name,"BK_CT_HI") ;
  2551. FieldMap[BK_CT_HI].Reg  = RS_DESC_1 ;
  2552. FieldMap[BK_CT_HI].Pos  = 0     ;
  2553. FieldMap[BK_CT_HI].Bits = 8     ;
  2554. FieldMap[BK_CT_HI].Type = UNSIGNED ;
  2555. FieldMap[BK_CT_HI].Mask = FieldCreateMask(BK_CT_HI) ;
  2556. /* RS_DESC_2*/
  2557. RegMap[RS_DESC_2].Addr   = 0xD2 ;
  2558. RegMap[RS_DESC_2].Reset  = 0x00 ;
  2559. RegMap[RS_DESC_2].Value  = 0x00 ;
  2560. strcpy(RegMap[RS_DESC_2].Name,"RS_DESC_2") ;
  2561. /* FIELDS*/
  2562. strcpy(FieldMap[CORR_CT_LO].Name,"CORR_CT_LO") ;
  2563. FieldMap[CORR_CT_LO].Reg  = RS_DESC_2 ;
  2564. FieldMap[CORR_CT_LO].Pos  = 0     ;
  2565. FieldMap[CORR_CT_LO].Bits = 8     ;
  2566. FieldMap[CORR_CT_LO].Type = UNSIGNED ;
  2567. FieldMap[CORR_CT_LO].Mask = FieldCreateMask(CORR_CT_LO) ;
  2568. /* RS_DESC_3*/
  2569. RegMap[RS_DESC_3].Addr   = 0xD3 ;
  2570. RegMap[RS_DESC_3].Reset  = 0x00 ;
  2571. RegMap[RS_DESC_3].Value  = 0x00 ;
  2572. strcpy(RegMap[RS_DESC_3].Name,"RS_DESC_3") ;
  2573. /* FIELDS*/
  2574. strcpy(FieldMap[CORR_CT_HI].Name,"CORR_CT_HI") ;
  2575. FieldMap[CORR_CT_HI].Reg  = RS_DESC_3 ;
  2576. FieldMap[CORR_CT_HI].Pos  = 0     ;
  2577. FieldMap[CORR_CT_HI].Bits = 8     ;
  2578. FieldMap[CORR_CT_HI].Type = UNSIGNED ;
  2579. FieldMap[CORR_CT_HI].Mask = FieldCreateMask(CORR_CT_HI) ;
  2580. /* RS_DESC_4*/
  2581. RegMap[RS_DESC_4].Addr   = 0xD4 ;
  2582. RegMap[RS_DESC_4].Reset  = 0x6D ;
  2583. RegMap[RS_DESC_4].Value  = 0x00 ;
  2584. strcpy(RegMap[RS_DESC_4].Name,"RS_DESC_4") ;
  2585. /* FIELDS*/
  2586. strcpy(FieldMap[UNCORR_CT_LO].Name,"UNCORR_CT_LO") ;
  2587. FieldMap[UNCORR_CT_LO].Reg  = RS_DESC_4 ;
  2588. FieldMap[UNCORR_CT_LO].Pos  = 0     ;
  2589. FieldMap[UNCORR_CT_LO].Bits = 8     ;
  2590. FieldMap[UNCORR_CT_LO].Type = UNSIGNED ;
  2591. FieldMap[UNCORR_CT_LO].Mask = FieldCreateMask(UNCORR_CT_LO) ;
  2592. /* RS_DESC_5*/
  2593. RegMap[RS_DESC_5].Addr   = 0xD5 ;
  2594. RegMap[RS_DESC_5].Reset  = 0x01 ;
  2595. RegMap[RS_DESC_5].Value  = 0x00 ;
  2596. strcpy(RegMap[RS_DESC_5].Name,"RS_DESC_5") ;
  2597. /* FIELDS*/
  2598. strcpy(FieldMap[UNCORR_CT_HI].Name,"UNCORR_CT_HI") ;
  2599. FieldMap[UNCORR_CT_HI].Reg  = RS_DESC_5 ;
  2600. FieldMap[UNCORR_CT_HI].Pos  = 0     ;
  2601. FieldMap[UNCORR_CT_HI].Bits = 8     ;
  2602. FieldMap[UNCORR_CT_HI].Type = UNSIGNED ;
  2603. FieldMap[UNCORR_CT_HI].Mask = FieldCreateMask(UNCORR_CT_HI) ;
  2604. /* RS_DESC_14*/
  2605. RegMap[RS_DESC_14].Addr   = 0xDE ;
  2606. RegMap[RS_DESC_14].Reset  = 0x00 ;
  2607. RegMap[RS_DESC_14].Value  = 0x00 ;
  2608. strcpy(RegMap[RS_DESC_14].Name,"RS_DESC_14") ;
  2609. /* FIELDS*/
  2610. strcpy(FieldMap[DIS_UNLOCK].Name,"DIS_UNLOCK") ;
  2611. FieldMap[DIS_UNLOCK].Reg  = RS_DESC_14 ;
  2612. FieldMap[DIS_UNLOCK].Pos  = 2     ;
  2613. FieldMap[DIS_UNLOCK].Bits = 1     ;
  2614. FieldMap[DIS_UNLOCK].Type = UNSIGNED ;
  2615. FieldMap[DIS_UNLOCK].Mask = FieldCreateMask(DIS_UNLOCK) ;
  2616. /* FIELDS*/
  2617. strcpy(FieldMap[MODE].Name,"MODE") ;
  2618. FieldMap[MODE].Reg  = RS_DESC_14 ;
  2619. FieldMap[MODE].Pos  = 0     ;
  2620. FieldMap[MODE].Bits = 2     ;
  2621. FieldMap[MODE].Type = UNSIGNED ;
  2622. FieldMap[MODE].Mask = FieldCreateMask(MODE) ;
  2623. /* RS_DESC_15*/
  2624. RegMap[RS_DESC_15].Addr   = 0xDF ;
  2625. RegMap[RS_DESC_15].Reset  = 0x01 ;
  2626. RegMap[RS_DESC_15].Value  = 0x00 ;
  2627. strcpy(RegMap[RS_DESC_15].Name,"RS_DESC_15") ;
  2628. /* FIELDS*/
  2629. strcpy(FieldMap[CT_CLEAR].Name,"CT_CLEAR") ;
  2630. FieldMap[CT_CLEAR].Reg  = RS_DESC_15 ;
  2631. FieldMap[CT_CLEAR].Pos  = 0     ;
  2632. FieldMap[CT_CLEAR].Bits = 1     ;
  2633. FieldMap[CT_CLEAR].Type = UNSIGNED ;
  2634. FieldMap[CT_CLEAR].Mask = FieldCreateMask(CT_CLEAR) ;
  2635. /* FIELDS*/
  2636. strcpy(FieldMap[CT_HOLD].Name,"CT_HOLD") ;
  2637. FieldMap[CT_HOLD].Reg  = RS_DESC_15 ;
  2638. FieldMap[CT_HOLD].Pos  = 1     ;
  2639. FieldMap[CT_HOLD].Bits = 1     ;
  2640. FieldMap[CT_HOLD].Type = UNSIGNED ;
  2641. FieldMap[CT_HOLD].Mask = FieldCreateMask(CT_HOLD) ;
  2642. /* FIELDS*/
  2643. strcpy(FieldMap[RS_NOCORR].Name,"RS_NOCORR") ;
  2644. FieldMap[RS_NOCORR].Reg  = RS_DESC_15 ;
  2645. FieldMap[RS_NOCORR].Pos  = 2     ;
  2646. FieldMap[RS_NOCORR].Bits = 1     ;
  2647. FieldMap[RS_NOCORR].Type = UNSIGNED ;
  2648. FieldMap[RS_NOCORR].Mask = FieldCreateMask(RS_NOCORR) ;
  2649. /* FIELDS*/
  2650. strcpy(FieldMap[SYNCSTATE].Name,"SYNCSTATE") ;
  2651. FieldMap[SYNCSTATE].Reg  = RS_DESC_15 ;
  2652. FieldMap[SYNCSTATE].Pos  = 7     ;
  2653. FieldMap[SYNCSTATE].Bits = 1     ;
  2654. FieldMap[SYNCSTATE].Type = UNSIGNED ;
  2655. FieldMap[SYNCSTATE].Mask = FieldCreateMask(SYNCSTATE) ;
  2656. //RegTrigger      = NO ;
  2657. //RegNbI2cAccess  =  0 ;
  2658. //count           =  0 ;
  2659. //RegTracking     = NO ;
  2660.    
  2661.     RegSTV0297reset() ;
  2662.     RegResetAfterDI() ;
  2663.     RegReset()        ;
  2664.     
  2665.     _ExtClk = (INT32)(10*EXT_CLK) ;    
  2666. RegGetQAMSize()   ;
  2667. RegSetSymbolRate(Driv0297Signal.SymbolRate) ; 
  2668. return;
  2669. }
  2670. void QAM64_Regreset(void)
  2671. {
  2672. INT16 i;
  2673. INT32 S32val;
  2674.     RegSTV0297reset() ;
  2675.     RegResetAfterDI() ;
  2676. RegSetOneRegister(EQU_0,0x48);
  2677. RegSetOneRegister(EQU_1,0x58);    
  2678. RegSetOneRegister(EQU_3,0x00);
  2679. RegSetOneRegister(EQU_4,0x00);
  2680. RegSetOneRegister(EQU_7,0x00);
  2681. RegSetOneRegister(EQU_8,0x00);
  2682. RegSetOneRegister(INITDEM_0,0x00);
  2683. RegSetOneRegister(INITDEM_1,0x40);
  2684. RegSetOneRegister(INITDEM_2,0x00);
  2685. RegSetOneRegister(INITDEM_3,0x00);
  2686. RegSetOneRegister(INITDEM_4,0x40);
  2687. RegSetOneRegister(INITDEM_5,0x08);
  2688. RegSetOneRegister(DELAGC_0,0xE6);
  2689. RegSetOneRegister(DELAGC_1,0x91);
  2690. RegSetOneRegister(DELAGC_2,0xFD);
  2691. RegSetOneRegister(DELAGC_3,0x44);
  2692. RegSetOneRegister(DELAGC_4,0x29);
  2693. RegSetOneRegister(DELAGC_5,0x8F);
  2694. RegSetOneRegister(DELAGC_6,0x80);
  2695. RegSetOneRegister(DELAGC_7,0x70);
  2696. RegSetOneRegister(DELAGC_8,0x00);
  2697. RegSetOneRegister(WBAGC_0,0x1A);
  2698. RegSetOneRegister(WBAGC_1,0x64);
  2699. RegSetOneRegister(WBAGC_2,0x31);
  2700. RegSetOneRegister(WBAGC_3,0x18);
  2701. RegSetOneRegister(WBAGC_4,0xFF);
  2702. RegSetOneRegister(WBAGC_5,0x00);
  2703. RegSetOneRegister(WBAGC_6,0x00);
  2704. RegSetOneRegister(WBAGC_9,0x04);
  2705. RegSetOneRegister(WBAGC_10,0x51);
  2706. RegSetOneRegister(WBAGC_11,0xF8);
  2707. RegSetOneRegister(STLOOP_2,0x30);
  2708. RegSetOneRegister(STLOOP_3,0x06);
  2709. RegSetOneRegister(STLOOP_5,0x6A);
  2710. RegSetOneRegister(STLOOP_6,0xA3);
  2711. RegSetOneRegister(STLOOP_7,0x8B);
  2712. RegSetOneRegister(STLOOP_8,0x39);
  2713. RegSetOneRegister(STLOOP_9,0x06);
  2714. RegSetOneRegister(STLOOP_10,0x5E);
  2715. RegSetOneRegister(STLOOP_11,0x04);
  2716. RegSetOneRegister(CRL_0,0x16);
  2717. RegSetOneRegister(CRL_1,0x49);
  2718. RegSetOneRegister(CRL_2,0x05);
  2719. RegSetOneRegister(CRL_3,0x00);
  2720. RegSetOneRegister(CRL_4,0x00);
  2721. RegSetOneRegister(CRL_5,0x00);
  2722. RegSetOneRegister(CRL_6,0xBF);
  2723. RegSetOneRegister(CRL_7,0x0D);
  2724. RegSetOneRegister(CRL_8,0xF8);
  2725. RegSetOneRegister(CRL_9,0x0D);
  2726. RegSetOneRegister(CRL_10,0x03);
  2727. RegSetOneRegister(CRL_11,0x92);
  2728. RegSetOneRegister(PMFAGC_0,0xFF);
  2729. RegSetOneRegister(PMFAGC_1,0x04);
  2730. RegSetOneRegister(PMFAGC_2,0x00);
  2731. RegSetOneRegister(PMFAGC_3,0x00);
  2732. RegSetOneRegister(PMFAGC_4,0x00);
  2733. RegSetOneRegister(CTRL_0,0x20);
  2734. RegSetOneRegister(CTRL_1,0x00);
  2735. RegSetOneRegister(CTRL_2,0x27);
  2736. RegSetOneRegister(CTRL_3,0x08);
  2737. RegSetOneRegister(CTRL_4,0x02);
  2738. RegSetOneRegister(CTRL_5,0xA2);
  2739. RegSetOneRegister(CTRL_6,0x08);
  2740. RegSetOneRegister(CTRL_7,0x63);
  2741. RegSetOneRegister(CTRL_8,0x00);
  2742. RegSetOneRegister(CTRL_9,0x00);
  2743. RegSetOneRegister(DEINT_SYNC_0,0x00);
  2744. RegSetOneRegister(DEINT_SYNC_1,0x04);
  2745. RegSetOneRegister(BERT_0,0x85);
  2746. RegSetOneRegister(BERT_1,0x22);
  2747. RegSetOneRegister(BERT_2,0x4C);
  2748. RegSetOneRegister(DEINT_0,0x91);
  2749. RegSetOneRegister(DEINT_1,0x0B);
  2750. RegSetOneRegister(OUTFORMAT_0,0x4B);
  2751. RegSetOneRegister(OUTFORMAT_1,0x00);
  2752. RegSetOneRegister(OUTFORMAT_2,0x00);
  2753. RegSetOneRegister(RS_DESC_0,0x6E);
  2754. RegSetOneRegister(RS_DESC_1,0x01);
  2755. RegSetOneRegister(RS_DESC_2,0x00);
  2756. RegSetOneRegister(RS_DESC_3,0x00);
  2757. RegSetOneRegister(RS_DESC_4,0x6D);
  2758. RegSetOneRegister(RS_DESC_5,0x01);
  2759. RegSetOneRegister(RS_DESC_14,0x00);
  2760. RegSetOneRegister(RS_DESC_15,0x01);
  2761. //RegTrigger      = NO ;
  2762. //RegNbI2cAccess  =  0 ;
  2763. //count           =  0 ;
  2764. //RegTracking     = NO ;
  2765.     
  2766.     _ExtClk = (INT32)(10*EXT_CLK) ;   
  2767. RegGetQAMSize()   ;
  2768. RegSetSymbolRate(Driv0297Signal.SymbolRate) ; 
  2769. return;
  2770. }
  2771. void QAM256_Regreset(void)
  2772. {
  2773. INT16 i;
  2774. INT32 S32val;
  2775.     RegSTV0297reset() ;
  2776.     RegResetAfterDI() ;
  2777. RegSetOneRegister(EQU_0,0x38);
  2778. RegSetOneRegister(EQU_1,0x58); 
  2779. RegSetOneRegister(EQU_3,0x00);
  2780. RegSetOneRegister(EQU_4,0x01);
  2781. RegSetOneRegister(EQU_7,0xe8);
  2782. RegSetOneRegister(EQU_8,0x0b);
  2783. RegSetOneRegister(INITDEM_0,0x00);
  2784. RegSetOneRegister(INITDEM_1,0x40);
  2785. RegSetOneRegister(INITDEM_2,0x00);
  2786. RegSetOneRegister(INITDEM_3,0x00);
  2787. RegSetOneRegister(INITDEM_4,0x40);
  2788. RegSetOneRegister(INITDEM_5,0x08);
  2789. RegSetOneRegister(DELAGC_0,0xE6);
  2790. RegSetOneRegister(DELAGC_1,0x91);
  2791. RegSetOneRegister(DELAGC_2,0xFD);
  2792. RegSetOneRegister(DELAGC_3,0x44);
  2793. RegSetOneRegister(DELAGC_4,0x29);
  2794. RegSetOneRegister(DELAGC_5,0x8F);
  2795. RegSetOneRegister(DELAGC_6,0x80);
  2796. RegSetOneRegister(DELAGC_7,0x70);
  2797. RegSetOneRegister(DELAGC_8,0x00);
  2798. RegSetOneRegister(WBAGC_0,0x1A);
  2799. RegSetOneRegister(WBAGC_1,0x64);
  2800. RegSetOneRegister(WBAGC_2,0x31);
  2801. RegSetOneRegister(WBAGC_3,0x18);
  2802. RegSetOneRegister(WBAGC_4,0xFF);
  2803. RegSetOneRegister(WBAGC_5,0x00);
  2804. RegSetOneRegister(WBAGC_6,0x00);
  2805. RegSetOneRegister(WBAGC_9,0x04);
  2806. RegSetOneRegister(WBAGC_10,0x51);
  2807. RegSetOneRegister(WBAGC_11,0xFF);
  2808. RegSetOneRegister(STLOOP_2,0x30);
  2809. RegSetOneRegister(STLOOP_3,0x02);
  2810. RegSetOneRegister(STLOOP_5,0x6A);
  2811. RegSetOneRegister(STLOOP_6,0xA3);
  2812. RegSetOneRegister(STLOOP_7,0x8B);
  2813. RegSetOneRegister(STLOOP_8,0x39);
  2814. RegSetOneRegister(STLOOP_9,0x06);
  2815. RegSetOneRegister(STLOOP_10,0x5E);
  2816. RegSetOneRegister(STLOOP_11,0x04);
  2817. RegSetOneRegister(CRL_0,0x16);
  2818. RegSetOneRegister(CRL_1,0x29);
  2819. RegSetOneRegister(CRL_2,0x05);
  2820. RegSetOneRegister(CRL_3,0x00);
  2821. RegSetOneRegister(CRL_4,0x00);
  2822. RegSetOneRegister(CRL_5,0x00);
  2823. RegSetOneRegister(CRL_6,0xBF);
  2824. RegSetOneRegister(CRL_7,0x0D);
  2825. RegSetOneRegister(CRL_8,0xF8);
  2826. RegSetOneRegister(CRL_9,0x0D);
  2827. RegSetOneRegister(CRL_10,0x03);
  2828. RegSetOneRegister(CRL_11,0x92);
  2829. RegSetOneRegister(PMFAGC_0,0xFF);
  2830. RegSetOneRegister(PMFAGC_1,0x04);
  2831. RegSetOneRegister(PMFAGC_2,0x00);
  2832. RegSetOneRegister(PMFAGC_3,0x00);
  2833. RegSetOneRegister(PMFAGC_4,0x00);
  2834. RegSetOneRegister(CTRL_0,0x20);
  2835. RegSetOneRegister(CTRL_1,0x00);
  2836. RegSetOneRegister(CTRL_2,0x27);
  2837. RegSetOneRegister(CTRL_3,0x08);
  2838. RegSetOneRegister(CTRL_4,0x02);
  2839. RegSetOneRegister(CTRL_5,0xA2);
  2840. RegSetOneRegister(CTRL_6,0x08);
  2841. RegSetOneRegister(CTRL_7,0x63);
  2842. RegSetOneRegister(CTRL_8,0x00);
  2843. RegSetOneRegister(CTRL_9,0x00);
  2844. RegSetOneRegister(DEINT_SYNC_0,0x00);
  2845. RegSetOneRegister(DEINT_SYNC_1,0x04);
  2846. RegSetOneRegister(BERT_0,0x85);
  2847. RegSetOneRegister(BERT_1,0x22);
  2848. RegSetOneRegister(BERT_2,0x4C);
  2849. RegSetOneRegister(DEINT_0,0x91);
  2850. RegSetOneRegister(DEINT_1,0x0B);
  2851. RegSetOneRegister(OUTFORMAT_0,0x4B);
  2852. RegSetOneRegister(OUTFORMAT_1,0x00);
  2853. RegSetOneRegister(OUTFORMAT_2,0x00);
  2854. RegSetOneRegister(RS_DESC_0,0x6E);
  2855. RegSetOneRegister(RS_DESC_1,0x01);
  2856. RegSetOneRegister(RS_DESC_2,0x00);
  2857. RegSetOneRegister(RS_DESC_3,0x00);
  2858. RegSetOneRegister(RS_DESC_4,0x6D);
  2859. RegSetOneRegister(RS_DESC_5,0x01);
  2860. RegSetOneRegister(RS_DESC_14,0x00);
  2861. RegSetOneRegister(RS_DESC_15,0x01);
  2862. //RegTrigger      = NO ;
  2863. //RegNbI2cAccess  =  0 ;
  2864. //count           =  0 ;
  2865. //RegTracking     = NO ;
  2866.     
  2867.     _ExtClk = (INT32)(10*EXT_CLK) ;    
  2868. RegGetQAMSize()   ;
  2869. RegSetSymbolRate(Driv0297Signal.SymbolRate) ; 
  2870. return;
  2871. }
  2872. void QAM64_Regreset_TH(void)
  2873. {
  2874. INT16 i;
  2875. INT32 S32val;
  2876.     RegSTV0297reset() ;
  2877.     RegResetAfterDI() ;
  2878. RegSetOneRegister(EQU_0,0x4b);
  2879. RegSetOneRegister(EQU_1,0x58);
  2880.        /*    testmode RegSetOneRegister(EQU_2,0x00);*/
  2881. RegSetOneRegister(EQU_3,0x00);
  2882. RegSetOneRegister(EQU_4,0x01);
  2883. RegSetOneRegister(EQU_7,0x07);
  2884. RegSetOneRegister(EQU_8,0x1c);
  2885. RegSetOneRegister(INITDEM_0,0x00);
  2886. RegSetOneRegister(INITDEM_1,0x40);
  2887. RegSetOneRegister(INITDEM_2,0x0a);
  2888. RegSetOneRegister(INITDEM_3,0x00);
  2889. RegSetOneRegister(INITDEM_4,0x40);
  2890. RegSetOneRegister(INITDEM_5,0x08);
  2891. RegSetOneRegister(DELAGC_0,0xFF);
  2892. RegSetOneRegister(DELAGC_1,0x5C);
  2893. RegSetOneRegister(DELAGC_2,0xFF);
  2894. RegSetOneRegister(DELAGC_3,0x00);
  2895. RegSetOneRegister(DELAGC_4,0x32);
  2896. RegSetOneRegister(DELAGC_5,0x5C);
  2897. RegSetOneRegister(DELAGC_6,0x80);
  2898. RegSetOneRegister(DELAGC_7,0x30);
  2899. RegSetOneRegister(DELAGC_8,0x00);
  2900. RegSetOneRegister(WBAGC_0,0x1B);
  2901. RegSetOneRegister(WBAGC_1,0x9D);
  2902. RegSetOneRegister(WBAGC_2,0x30);
  2903. RegSetOneRegister(WBAGC_3,0x18);
  2904. RegSetOneRegister(WBAGC_4,0x58);
  2905. RegSetOneRegister(WBAGC_5,0x00);
  2906. RegSetOneRegister(WBAGC_6,0x00);
  2907. RegSetOneRegister(WBAGC_9,0x02);
  2908. RegSetOneRegister(WBAGC_10,0x33);
  2909. RegSetOneRegister(WBAGC_11,0xFF);
  2910. RegSetOneRegister(STLOOP_2,0x30);
  2911. RegSetOneRegister(STLOOP_3,0x08);
  2912. RegSetOneRegister(STLOOP_5,0x50);
  2913. RegSetOneRegister(STLOOP_6,0xBB);
  2914. RegSetOneRegister(STLOOP_7,0x18);
  2915. RegSetOneRegister(STLOOP_8,0x3D);
  2916. RegSetOneRegister(STLOOP_9,0x08);
  2917. RegSetOneRegister(STLOOP_10,0x1E);
  2918. RegSetOneRegister(STLOOP_11,0x04);
  2919. RegSetOneRegister(CRL_0,0x13);
  2920. RegSetOneRegister(CRL_1,0x39);
  2921. RegSetOneRegister(CRL_2,0x06);
  2922. RegSetOneRegister(CRL_3,0x00);
  2923. RegSetOneRegister(CRL_4,0x00);
  2924. RegSetOneRegister(CRL_5,0x00);
  2925. RegSetOneRegister(CRL_6,0x9E);
  2926. RegSetOneRegister(CRL_7,0xC4);
  2927. RegSetOneRegister(CRL_8,0x01);
  2928. RegSetOneRegister(CRL_9,0x00);
  2929. RegSetOneRegister(CRL_10,0x02);
  2930. RegSetOneRegister(CRL_11,0x0F);
  2931. RegSetOneRegister(PMFAGC_0,0xFF);
  2932. RegSetOneRegister(PMFAGC_1,0x04);
  2933. RegSetOneRegister(PMFAGC_2,0x00);
  2934. RegSetOneRegister(PMFAGC_3,0x00);
  2935. RegSetOneRegister(PMFAGC_4,0x00);
  2936. RegSetOneRegister(CTRL_0,0x20);
  2937. RegSetOneRegister(CTRL_1,0x00);
  2938. RegSetOneRegister(CTRL_2,0x0F);
  2939. RegSetOneRegister(CTRL_3,0x00);
  2940. RegSetOneRegister(CTRL_4,0x2A);
  2941. RegSetOneRegister(CTRL_5,0x00);
  2942. RegSetOneRegister(CTRL_6,0xC0);
  2943. RegSetOneRegister(CTRL_7,0x6B);
  2944. RegSetOneRegister(CTRL_8,0x00);
  2945. RegSetOneRegister(CTRL_9,0x00);
  2946. RegSetOneRegister(DEINT_SYNC_0,0x02);
  2947. RegSetOneRegister(DEINT_SYNC_1,0x04);
  2948. RegSetOneRegister(BERT_0,0x85);
  2949. RegSetOneRegister(BERT_1,0x49);
  2950. RegSetOneRegister(BERT_2,0x1A);
  2951. RegSetOneRegister(DEINT_0,0x91);
  2952. RegSetOneRegister(DEINT_1,0x0B);
  2953. RegSetOneRegister(OUTFORMAT_0,0x4b);
  2954. RegSetOneRegister(OUTFORMAT_1,0x00);
  2955. RegSetOneRegister(OUTFORMAT_2,0x00);/*0x24*/
  2956. RegSetOneRegister(RS_DESC_0,0x6e);/*f4*/
  2957. RegSetOneRegister(RS_DESC_1,0x01);/*0e*/
  2958. RegSetOneRegister(RS_DESC_2,0x00);/*25*/
  2959. RegSetOneRegister(RS_DESC_3,0x00);/*3a*/
  2960. RegSetOneRegister(RS_DESC_4,0x6d);/*00*/
  2961. RegSetOneRegister(RS_DESC_5,0x01);/*00*/
  2962. RegSetOneRegister(RS_DESC_14,0x00);
  2963. RegSetOneRegister(RS_DESC_15,0x81);
  2964. RegTrigger      = NO ;
  2965. RegNbI2cAccess  =  0 ;
  2966. count           =  0 ;
  2967. RegTracking     = NO ;
  2968.     /**/
  2969.     /**/
  2970.     _ExtClk = (INT32)(10*EXT_CLK) ;  /*unit Khz */
  2971.     /**/
  2972. RegGetQAMSize()   ;
  2973. /* RegSetSymbolRate(6500) ;  6.89 MBd */
  2974. RegSetSymbolRate(Driv0297Signal.SymbolRate) ; /* 6.89 MBd */
  2975. /**/
  2976. return;
  2977. }
  2978. void QAM256_Regreset_TH(void)
  2979. {
  2980. INT16 i;
  2981. INT32 S32val;
  2982.     RegSTV0297reset() ;
  2983.     RegResetAfterDI() ;
  2984. RegSetOneRegister(EQU_0,0x39);
  2985. RegSetOneRegister(EQU_1,0x69);
  2986.        /*    testmode RegSetOneRegister(EQU_2,0x00);*/
  2987. RegSetOneRegister(EQU_3,0x00);
  2988. RegSetOneRegister(EQU_4,0x01);
  2989. RegSetOneRegister(EQU_7,0x32);
  2990. RegSetOneRegister(EQU_8,0x1A);
  2991. RegSetOneRegister(INITDEM_0,0x00);
  2992. RegSetOneRegister(INITDEM_1,0x40);
  2993. RegSetOneRegister(INITDEM_2,0x0A);
  2994. RegSetOneRegister(INITDEM_3,0x00);
  2995. RegSetOneRegister(INITDEM_4,0x40);
  2996. RegSetOneRegister(INITDEM_5,0x08);
  2997. RegSetOneRegister(DELAGC_0,0xFF);
  2998. RegSetOneRegister(DELAGC_1,0x5C);
  2999. RegSetOneRegister(DELAGC_2,0xFF);
  3000. RegSetOneRegister(DELAGC_3,0x00);
  3001. RegSetOneRegister(DELAGC_4,0x32);
  3002. RegSetOneRegister(DELAGC_5,0x5C);
  3003. RegSetOneRegister(DELAGC_6,0x80);
  3004. RegSetOneRegister(DELAGC_7,0x00);
  3005. RegSetOneRegister(DELAGC_8,0x00);
  3006. RegSetOneRegister(WBAGC_0,0x1B);
  3007. RegSetOneRegister(WBAGC_1,0xBA);
  3008. RegSetOneRegister(WBAGC_2,0x30);
  3009. RegSetOneRegister(WBAGC_3,0x18);
  3010. RegSetOneRegister(WBAGC_4,0x58);
  3011. RegSetOneRegister(WBAGC_5,0x00);
  3012. RegSetOneRegister(WBAGC_6,0x00);
  3013. RegSetOneRegister(WBAGC_9,0x02);
  3014. RegSetOneRegister(WBAGC_10,0xFF);
  3015. RegSetOneRegister(WBAGC_11,0xFF);
  3016. RegSetOneRegister(STLOOP_2,0x30);
  3017. RegSetOneRegister(STLOOP_3,0x08);
  3018. RegSetOneRegister(STLOOP_5,0xC0);
  3019. RegSetOneRegister(STLOOP_6,0x92);
  3020. RegSetOneRegister(STLOOP_7,0x18);
  3021. RegSetOneRegister(STLOOP_8,0x3D);
  3022. RegSetOneRegister(STLOOP_9,0x08);
  3023. RegSetOneRegister(STLOOP_10,0x1E);
  3024. RegSetOneRegister(STLOOP_11,0x04);
  3025. RegSetOneRegister(CRL_0,0x13);
  3026. RegSetOneRegister(CRL_1,0x39);
  3027. RegSetOneRegister(CRL_2,0x06);
  3028. RegSetOneRegister(CRL_3,0x00);
  3029. RegSetOneRegister(CRL_4,0x00);
  3030. RegSetOneRegister(CRL_5,0x00);
  3031. RegSetOneRegister(CRL_6,0xA0);
  3032. RegSetOneRegister(CRL_7,0x7A);
  3033. RegSetOneRegister(CRL_8,0x4C);
  3034. RegSetOneRegister(CRL_9,0x00);
  3035. RegSetOneRegister(CRL_10,0x02);
  3036. RegSetOneRegister(CRL_11,0xC1);
  3037. RegSetOneRegister(PMFAGC_0,0xFF);
  3038. RegSetOneRegister(PMFAGC_1,0x04);
  3039. RegSetOneRegister(PMFAGC_2,0x00);
  3040. RegSetOneRegister(PMFAGC_3,0x00);
  3041. RegSetOneRegister(PMFAGC_4,0x00);
  3042. RegSetOneRegister(CTRL_0,0x20);
  3043. RegSetOneRegister(CTRL_1,0x00);
  3044. RegSetOneRegister(CTRL_2,0x1F);
  3045. RegSetOneRegister(CTRL_3,0x00);
  3046. RegSetOneRegister(CTRL_4,0x2A);
  3047. RegSetOneRegister(CTRL_5,0x00);
  3048. RegSetOneRegister(CTRL_6,0xC0);
  3049. RegSetOneRegister(CTRL_7,0x6B);
  3050. RegSetOneRegister(CTRL_8,0x00);
  3051. RegSetOneRegister(CTRL_9,0x00);
  3052. RegSetOneRegister(DEINT_SYNC_0,0x02);
  3053. RegSetOneRegister(DEINT_SYNC_1,0x04);
  3054. RegSetOneRegister(BERT_0,0x85);
  3055. RegSetOneRegister(BERT_1,0x75);
  3056. RegSetOneRegister(BERT_2,0x16);
  3057. RegSetOneRegister(DEINT_0,0x91);
  3058. RegSetOneRegister(DEINT_1,0x0B);
  3059. RegSetOneRegister(OUTFORMAT_0,0x4B);
  3060. RegSetOneRegister(OUTFORMAT_1,0x00);
  3061. RegSetOneRegister(OUTFORMAT_2,0x00);/*24*/
  3062. RegSetOneRegister(RS_DESC_0,0x6e);/*00*/
  3063. RegSetOneRegister(RS_DESC_1,0x01);/*00*/
  3064. RegSetOneRegister(RS_DESC_2,0x00);
  3065. RegSetOneRegister(RS_DESC_3,0x00);
  3066. RegSetOneRegister(RS_DESC_4,0x6D);
  3067. RegSetOneRegister(RS_DESC_5,0x01);/**/
  3068. RegSetOneRegister(RS_DESC_14,0x00);
  3069. RegSetOneRegister(RS_DESC_15,0x81);
  3070. RegTrigger      = NO ;
  3071. RegNbI2cAccess  =  0 ;
  3072. count           =  0 ;
  3073. RegTracking     = NO ;
  3074.     /**/
  3075.     /**/
  3076.     _ExtClk = (INT32)(10*EXT_CLK) ;  /*unit Khz */
  3077.     /**/
  3078. RegGetQAMSize()   ;
  3079. /* RegSetSymbolRate(6500) ;  6.89 MBd */
  3080. RegSetSymbolRate(Driv0297Signal.SymbolRate) ; /* 6.89 MBd */
  3081. /**/
  3082. return;
  3083. }
  3084. void RegSTV0297reset(void)
  3085.   {
  3086. RegSetField(SOFT_RESET,1);
  3087. RegSetField(SOFT_RESET,0);
  3088.   }
  3089. void RegResetAfterDI(void)
  3090.   {
  3091. RegSetField(RESET_DI,1);
  3092. RegSetField(RESET_DI,0);
  3093.    return ;
  3094.   }
  3095. void RegSetQAMSize(INT32 _QAMSize)
  3096.   {
  3097. INT32 QAMSize ;
  3098.     RegQAMSize = _QAMSize ;
  3099. switch (_QAMSize)
  3100.   {
  3101.    case 16:
  3102. QAMSize = 0; //QAM16 ;
  3103.    break;
  3104.    case 32:
  3105. QAMSize = 1; //QAM32 ;
  3106.    break;
  3107.    case 64:
  3108. QAMSize = 4; //QAM64 ;
  3109.    break;
  3110.    case 128:
  3111. QAMSize = 2; //QAM128 ;
  3112.    break;
  3113.    case 256:
  3114. QAMSize = 3; //QAM256 ;
  3115.    break;
  3116.    default:
  3117.        break;
  3118. }
  3119. RegSetField(MODE_SELECT, QAMSize);
  3120. return;
  3121.   }
  3122. INT32 RegGetQAMSize(void)
  3123.   {
  3124.     INT32 Value ;
  3125. Value = RegGetField(MODE_SELECT);
  3126. switch (Value)
  3127.   {
  3128.    case 0:
  3129. RegQAMSize = 16 ;
  3130.    break;
  3131.    case 1:
  3132. RegQAMSize = 32 ;
  3133.    break;
  3134.    case 4:
  3135. RegQAMSize = 64 ;
  3136.    break;
  3137.    case 2:
  3138. RegQAMSize = 128 ;
  3139.    break;
  3140.    case 3:
  3141. RegQAMSize = 256 ;
  3142.    break;
  3143.    default:
  3144.    break;
  3145. }
  3146. return(RegQAMSize);
  3147.   }
  3148. INT32 RegGetSymbolRate(void)
  3149.   {
  3150. INT32 regsym = 0L;
  3151. _ExtClk = (INT32)(10*EXT_CLK) ;  
  3152. regsym  = RegGetField(SYMB_RATE_0);
  3153. regsym += RegGetField(SYMB_RATE_1)<<8;
  3154. regsym += RegGetField(SYMB_RATE_2)<<16;
  3155. regsym += RegGetField(SYMB_RATE_3)<<24;   
  3156. regsym = regsym/4096L; // 4096 = 2**12 
  3157. regsym = (_ExtClk/ 8) * regsym; 
  3158. RegSymbolRate = regsym/131072L; // 131072 = 2**17 
  3159. if(RegSymbolRate == 0)
  3160. {
  3161. RegSymbolRate = 6875;
  3162. }
  3163. //Print("RegSymbolRate is %ldn",RegSymbolRate);
  3164. return(RegSymbolRate);
  3165.   }
  3166. void RegSetSymbolRate(INT32 _SymbolRate)
  3167.   {
  3168. INT32 tmp, ExtClk;
  3169. RegSymbolRate = _SymbolRate ;
  3170.     _ExtClk = (INT32)(10*EXT_CLK) ;  
  3171. ExtClk = _ExtClk/4;
  3172. tmp = 131072L * _SymbolRate;  // 131072 = 2**17  
  3173. tmp = tmp /ExtClk;
  3174. tmp = tmp * 8192L; // 8192L = 2**13 
  3175. //Print("tmp : %lx",tmp);
  3176. RegSetField(SYMB_RATE_0,tmp);
  3177. RegSetField(SYMB_RATE_1,(tmp>>8));
  3178. RegSetField(SYMB_RATE_2,(tmp>>16));
  3179. RegSetField(SYMB_RATE_3,(tmp>>24));    
  3180. return;
  3181.   }
  3182. INT32 RegGetSweepRate(void)
  3183.   {
  3184. INT16 swrate=0;
  3185. INT32 _SymbolRate;
  3186. INT32 tmp;
  3187. tmp  = RegGetField(SWEEP_LO);
  3188. tmp += RegGetField(SWEEP_HI)<<8;
  3189. _SymbolRate = RegSymbolRate / 0x10;
  3190. if (tmp & 0x00000800) {    
  3191. tmp = (~tmp + 1) & 0x00000FFF;
  3192. tmp = (tmp * _SymbolRate * 1000)/ 0x1000; /* 0x1000 = 2**12 */
  3193. tmp = (-tmp * 1000) / 0x1000;
  3194. }                  
  3195. else {
  3196. tmp = tmp & 0x00000FFF;
  3197. tmp = (tmp * _SymbolRate * 1000)/ 0x1000;
  3198. tmp = (tmp * 1000) / 0x1000;    
  3199. }
  3200. return(tmp);
  3201.   }
  3202. void RegSetSweepRate(INT16 _FShift)
  3203.   {
  3204. INT32 S32_tmp;
  3205. INT16 FShift ;
  3206. FShift = _FShift ;  /* in mS sweep = Fshift * 2^28/SR*/
  3207. RegSymbolRate = RegGetSymbolRate() ;   /* in KHz */
  3208. S32_tmp = FShift * 262144L ;   /* 262144 = 2*18 */
  3209. S32_tmp /= RegSymbolRate ;
  3210. S32_tmp *= 1024 ;
  3211. if(S32_tmp >= 0)
  3212.   S32_tmp += 500000 ;
  3213. else
  3214.   S32_tmp -= 500000 ;
  3215. S32_tmp /= 1000000 ;
  3216. RegSetField(SWEEP_LO,S32_tmp & 0xFF);
  3217. RegSetField(SWEEP_HI,(S32_tmp>>8) & 0x0F);
  3218. return;
  3219.   }
  3220. INT32 RegGetCarrierOffset(void)
  3221.   {
  3222.    INT32 S32_tmp;
  3223.    INT32 OldCarrierOffset ;
  3224. RegSetField(CRL_SNAPSHOT,0xFF) ;
  3225. S32_tmp  = RegGetField(IPHASE_0);
  3226. S32_tmp += RegGetField(IPHASE_1)<<8;
  3227. S32_tmp += RegGetField(IPHASE_2)<<16;
  3228. S32_tmp += RegGetField(IPHASE_3)<<24;
  3229. return(S32_tmp);
  3230.   }
  3231.  
  3232. void RegSetFrequencyOffset(INT32 _CarrierOffset)
  3233.  {
  3234. INT32 S32_tmp;
  3235. INT32 CarrierOffset ;
  3236. CarrierOffset = _CarrierOffset     ; 
  3237. S32_tmp = CarrierOffset * 26844L ;
  3238. if(S32_tmp < 0) S32_tmp += 0x10000000 ;
  3239. S32_tmp &= 0x0FFFFFFF ;
  3240. RegSetField(IPHASE_0,S32_tmp);
  3241. RegSetField(IPHASE_1,(S32_tmp>>8));
  3242. RegSetField(IPHASE_2,(S32_tmp>>16));
  3243. RegSetField(IPHASE_3,(S32_tmp>>24));
  3244. return;
  3245.   }
  3246. void Driv0297Init(void)
  3247.   {   
  3248.    RegSTV0297reset() ;
  3249.    RegReset() ;
  3250.    
  3251.    Driv0297DataLost   = NO ;
  3252.    Driv0297DataLocked = NO ;   
  3253.    Driv0297Signal.QAMSize    = 64     ;
  3254.    Driv0297Signal.SymbolRate = 6500   ;
  3255.    Driv0297Signal.Frequency  = 400000 ;   
  3256.    return ;
  3257.   }
  3258. void Driv0297DemodSetting(INT32 _Offset)
  3259.   {
  3260.    INT32 S32_tmp ;
  3261.    INT32 ExtClk ;
  3262.    INT32 S16_tmp ;
  3263.    RegSetField(IN_DEMOD_EN, 1);
  3264.    ExtClk = (INT32)(10*EXT_CLK) ;  
  3265.    S32_tmp  = 36125 + _Offset; 
  3266.    S32_tmp -= ExtClk;
  3267.    S32_tmp *= 65536 ;
  3268.    S32_tmp /= ExtClk;   
  3269.    if(S32_tmp > 65535) S32_tmp = 65535 ;
  3270.    S16_tmp = S32_tmp ;   
  3271.    RegSetField(DEM_FQCY_HI, S16_tmp>>8);
  3272.    RegSetField(DEM_FQCY_LO, S16_tmp);
  3273.    return;
  3274.   }
  3275. FLAG_SAM  Driv0297DataSearch(SIGNAL *_pSignal, INT32 _SweepRate, INT32 _CarrierOffset,
  3276. FLAG_SAM _SpectrumInversion, INT32 _InitDemodOffset)
  3277.   {
  3278.    INT32  TimeOut           ;
  3279.    INT32  LMS1TimeOut       ;
  3280.    INT32  LMS2TimeOut       ;
  3281.    INT32  FECTimeOut        ;
  3282.    INT32  NbSymbols         ;
  3283.    INT32  Log2QAMSize       ;
  3284.    INT32  AcqLoopsTime      ;
  3285.    INT32  AcqAGCTime        ;
  3286.    INT32  QAMSize           ;
  3287.    INT32  SweepRate         ;
  3288.    INT32  CarrierOffset     ;
  3289.    INT32  LMS1TrackingLock  ;
  3290.    INT32  LMS2TrackingLock  ;
  3291.    INT32  FECTrackingLock   ;
  3292.    UINT32 SymbolRate        ;
  3293.    INT32 Frequency         ;
  3294.    FLAG_SAM SpectrumInversion ;
  3295.    INT32  DataSearchTime    ;
  3296.    INT32  WBAGCLock         ;
  3297.    INT32  S16_tmp           ;
  3298.    INT32  initial_u         ;
  3299.    INT32  blind_u           ;
  3300.    INT32  u_threshold       ;
  3301.    INT32  AGC1Max, AGC1Min, AGC2Max, AGC2Min, AGC2Threshold  ;
  3302.    FLAG_SAM EndOfSearch       ;
  3303.    FLAG_SAM DataFound         ;
  3304.    
  3305.    DataFound         = NO                   ;
  3306.    EndOfSearch       = NO                   ;
  3307.    DataSearchTime    = 0                    ; 
  3308.    Frequency         = _pSignal->Frequency  ;
  3309.    QAMSize           = _pSignal->QAMSize    ;
  3310.    SymbolRate        = _pSignal->SymbolRate ; 
  3311.    SweepRate         = _SweepRate           ; 
  3312.    CarrierOffset     = _CarrierOffset       ;
  3313.    SpectrumInversion = _SpectrumInversion   ;
  3314.   
  3315.    AcqAGCTime = 20 ;
  3316.    switch (QAMSize)
  3317.    {
  3318.       case 16 :
  3319. NbSymbols = 45000 ;
  3320. Log2QAMSize = 4   ;
  3321. break;
  3322.       case 32 :
  3323. NbSymbols = 45000 ;
  3324. Log2QAMSize = 5   ;
  3325. break ;
  3326.       case 64 :
  3327. NbSymbols = 45000 ;
  3328. Log2QAMSize = 6   ;
  3329. break;
  3330.       case 128 :
  3331. NbSymbols = 45000 ;
  3332. Log2QAMSize = 7   ;
  3333. break ;
  3334.       case 256 :
  3335. NbSymbols = 45000 ;
  3336. Log2QAMSize = 8   ;
  3337. break;
  3338.    }
  3339.    if(SymbolRate == 0)
  3340.    {
  3341.     SymbolRate = 6875;
  3342.    }   
  3343.    AcqLoopsTime = (INT32)(NbSymbols/SymbolRate) ;  
  3344.  //  samDelay((unsigned )(AcqLoopsTime));
  3345.    /*
  3346.    if(SymbolRate <1500)
  3347.    LMS1TimeOut = 400 ;    
  3348.    else
  3349.    LMS1TimeOut = 200 ;   
  3350.    if(SymbolRate <1500)
  3351.    LMS2TimeOut = 300 ; 
  3352.    else
  3353.    LMS2TimeOut = 200 ;
  3354.    
  3355.    if(SymbolRate <1500) 
  3356.    FECTimeOut = 100;
  3357.    else
  3358.    FECTimeOut = 20;
  3359. */
  3360. if(SymbolRate <1500)
  3361. {
  3362. LMS1TimeOut = 400;
  3363. LMS2TimeOut = 300;
  3364. FECTimeOut = 100;
  3365. }
  3366. else
  3367. {
  3368. LMS1TimeOut = 200;
  3369. LMS2TimeOut = 200;
  3370. FECTimeOut = 20;
  3371. }
  3372. LMS1TimeOut /= 2;
  3373. LMS2TimeOut /= 2;
  3374. FECTimeOut /= 2;
  3375.    LoadRegisters() ;
  3376.    Driv0297DemodSetting(_InitDemodOffset) ;
  3377.    RegSetField(WAGC_EN,0x01) ;
  3378.   
  3379.    AGC2Max = RegGetField(AGC2MAX) ;
  3380.    AGC2Min = RegGetField(AGC2MIN) ;
  3381.    AGC1Max = RegGetField(AGC1MAX) ;
  3382.    AGC1Min = RegGetField(AGC1MIN) ;
  3383.    AGC2Threshold = RegGetField(AGC2_THRES) ;
  3384.   
  3385.    RegSetField(WAGC_EN,0x00) ;   
  3386.    RegSetField(AGC2SD_LO,0x00) ;
  3387.    RegSetField(AGC2SD_HI,0x01) ;   
  3388.    RegSetField(FRZ2_CTRL,0x00) ;  
  3389.    RegSetField(FRZ1_CTRL,0x00) ;             
  3390.    RegSetField(PMFA_F_UNLOCK,0x01) ;   
  3391.    RegSetField(PMFA_ACC0,0x00) ;
  3392.    RegSetField(PMFA_ACC1,0x00) ;
  3393.    RegSetField(PMFA_ACC2,0x00) ;   
  3394.    RegSetField(WAGC_ACQ,0x00) ;   
  3395.    RegSetField(PMFA_F_UNLOCK,0x00) ;   
  3396.    RegSetField(PHASE_CLR,0x01) ;   
  3397.    RegSetField(ERR_CLR,0x01) ;   
  3398.    RegSetField(ERR_CLR,0x00) ;   
  3399.    RegSetField(ERR_EN,0x00) ;   
  3400.    RegSetField(PHASE_EN,0x01) ;   
  3401.    RegSetField(SWEEP_EN,0) ;   
  3402.    RegSetField(RESET_DI,1) ;
  3403.    RegSetField(RESET_DI,0) ;   
  3404.    RegSetField(RESET_RS,1) ;
  3405.    RegSetField(RESET_RS,0) ;
  3406.    
  3407.    u_threshold = RegGetField(U_THRESHOLD) ;
  3408.    initial_u   = RegGetField(INITIAL_U) ;
  3409.    blind_u     = RegGetField(BLIND_U) ;
  3410.    RegSetField(RESET_EQL,1) ;
  3411.    RegSetField(RESET_EQL,0) ;   
  3412.    RegSetField(U_THRESHOLD,u_threshold) ;
  3413.    RegSetField(INITIAL_U,initial_u) ;
  3414.    RegSetField(BLIND_U,blind_u) ;   
  3415.    RegSetField(SOURCESEL,0) ;   
  3416.    RegSetField(APHASE_0,0x00) ;
  3417.    RegSetField(APHASE_1,0x00) ;
  3418.    RegSetField(APHASE_2,0x00) ;
  3419.    RegSetField(IPHASE_0,0x00) ;
  3420.    RegSetField(IPHASE_1,0x00) ;
  3421.    RegSetField(IPHASE_2,0x00) ;
  3422.    RegSetField(IPHASE_3,0x00) ;
  3423.    
  3424.    RegSetQAMSize(QAMSize) ;
  3425.    RegSetSymbolRate(SymbolRate) ; 
  3426.    /*Print("RegGetSymbolRate=%dn",RegGetSymbolRate());*/
  3427.    RegSetSweepRate(SweepRate)   ; 
  3428.    RegSetFrequencyOffset(CarrierOffset) ;
  3429.    RegSetField(SPEC_INV,SpectrumInversion) ;   
  3430.    samDelay(1);
  3431.    
  3432.    RegSetField(EN_CORNER_DET,0x01) ;   
  3433.    samDelay(1);   
  3434.    RegSetField(PHASE_CLR,0x00) ;  
  3435.    samDelay(1);
  3436.    RegSetField(SWEEP_EN,1) ;  
  3437.    RegSetField(WAGC_CLR,0x01) ;   
  3438.    RegSetField(WAGC_EN,0x01) ;
  3439.    WBAGCLock = 0 ;
  3440.    TimeOut = DataSearchTime + 50  ; 
  3441.    while((WBAGCLock == 0)&&(EndOfSearch == NO))
  3442.    {
  3443.      // samDelay(500);      
  3444.       DataSearchTime += 1 ;
  3445.       WBAGCLock = RegGetField(WAGC_ACQ) ;
  3446.       if((WBAGCLock == 1)||(DataSearchTime > TimeOut))
  3447.   EndOfSearch = YES ; 
  3448.    }    
  3449.    
  3450.    if(WBAGCLock == 0)
  3451.    {      
  3452.       return (DataFound);
  3453.    }
  3454. /*   samDelay(AcqAGCTime);    */
  3455.    DataSearchTime += AcqAGCTime ;
  3456.    EndOfSearch    = NO ;
  3457.    TimeOut = DataSearchTime + LMS1TimeOut ;
  3458.    S16_tmp = 0 ;
  3459.    while (EndOfSearch == NO)
  3460.    {
  3461.       samDelay(0);      
  3462.       DataSearchTime += 1 ;
  3463.       LMS1TrackingLock = RegGetField(EQU_LMS1) ;
  3464.       if(LMS1TrackingLock == 1)
  3465.    S16_tmp += 1 ;
  3466.       else
  3467.    S16_tmp = 0 ;
  3468.       if((S16_tmp >= 20)||(DataSearchTime > TimeOut))
  3469. EndOfSearch = YES ;
  3470.    }
  3471.    if(LMS1TrackingLock == 0)
  3472.      {     
  3473.        return (DataFound);
  3474.      }
  3475.      //Print("EQU_LMS1=%dn",LMS1TrackingLock);
  3476.     EndOfSearch    = NO ;
  3477.     TimeOut = DataSearchTime + LMS2TimeOut ; 
  3478.     S16_tmp = 0 ;
  3479.    while (EndOfSearch == NO)
  3480.      {
  3481.       samDelay(0);   
  3482.       DataSearchTime += 1 ;
  3483.       LMS2TrackingLock = RegGetField(EQU_LMS2) ;
  3484.       if(LMS2TrackingLock == 1)
  3485. S16_tmp += 1 ;
  3486.       else
  3487. S16_tmp = 0 ;
  3488.       if((S16_tmp >= 2)||(DataSearchTime > TimeOut))
  3489. EndOfSearch = YES ;
  3490.      }
  3491.    if(LMS2TrackingLock == 0)
  3492.    {     
  3493.        return (DataFound);
  3494.    }
  3495.    
  3496.    //Print("EQU_LMS2=%dn",LMS2TrackingLock);
  3497.    EndOfSearch    = NO ;
  3498.    TimeOut = DataSearchTime + FECTimeOut ;
  3499.    TimeOut += 100/2 ;
  3500.    FECTrackingLock=0;
  3501.    while (EndOfSearch == NO)
  3502.      {
  3503.       samDelay(1);
  3504.       DataSearchTime +=1 ;
  3505.       FECTrackingLock = RegGetField(SYNCSTATE) ; 
  3506.       if((FECTrackingLock == 1)||(DataSearchTime > TimeOut))
  3507. EndOfSearch = YES ;
  3508.      }   
  3509.      
  3510.     //Print("SYNCSTATE=%dn",FECTrackingLock);
  3511.    if(FECTrackingLock)
  3512.      {
  3513.       RegSetField(EN_CORNER_DET,0x00) ;
  3514.       DataFound = YES;
  3515.      }   
  3516.    if(DataFound == NO) return(DataFound) ;
  3517.    _pSignal->SymbolRate = RegGetSymbolRate() ;
  3518.    Driv0297Signal.QAMSize    = _pSignal->QAMSize    ;
  3519.    Driv0297Signal.SymbolRate = _pSignal->SymbolRate ;
  3520.    Driv0297Signal.Frequency  = _pSignal->Frequency  ;
  3521.    return (DataFound);
  3522.   }
  3523.   
  3524. FLAG_SAM Driv0297CarrierSearch(SIGNAL  *_pSignal, FLAG_SAM _SpectrumInversion,
  3525. INT32 _SweepRate, INT32 _CarrierOffset)
  3526.   {
  3527.    FLAG_SAM   DataFound ;
  3528.    INT32    CarrierOffset ;
  3529.    INT32   InitDemodOffset ;
  3530.    INT32    SweepRate ;
  3531.    DataFound = NO ;
  3532.    if(((_SweepRate > 0)&&(_CarrierOffset > 0))  ||
  3533.       ((_SweepRate < 0)&&(_CarrierOffset < 0))  ||
  3534.       (_SweepRate == 0))   return(DataFound) ;
  3535.    if(_SweepRate < 0)
  3536.      {
  3537.       SweepRate = -_SweepRate ;
  3538.       CarrierOffset = -_CarrierOffset ;
  3539.      }
  3540.    else
  3541.      {
  3542.       SweepRate = _SweepRate ;
  3543.       CarrierOffset = _CarrierOffset ; 
  3544.      }
  3545.    
  3546.     InitDemodOffset = 0 ;
  3547.     CarrierOffset = -500 ;   
  3548. if( _pSignal->QAMSize == 128)
  3549.     CarrierOffset = -11000 ;   
  3550.    
  3551. if(_SpectrumInversion ==AUTO)
  3552.     {
  3553. DataFound = Driv0297DataSearch(_pSignal, SweepRate, CarrierOffset, NO,
  3554.                            InitDemodOffset) ;
  3555. if(DataFound==NO)
  3556. {
  3557. //Print("error return 1 n");
  3558. if( CheckInversion()==NO)
  3559. {
  3560. DataFound = Driv0297DataSearch(_pSignal, SweepRate, CarrierOffset,
  3561. YES, InitDemodOffset) ;
  3562. }
  3563. }
  3564. if(DataFound==NO)
  3565. {
  3566. RegSetField(SPEC_INV,NO) ; 
  3567. //Print("error return 2 n");
  3568. }
  3569.     }
  3570.     else
  3571.     {  
  3572.    DataFound = Driv0297DataSearch(_pSignal, SweepRate, CarrierOffset, 
  3573.                                   _SpectrumInversion, InitDemodOffset) ;
  3574.     }  
  3575. //Print("come to here n");
  3576.     return (DataFound) ;
  3577. }
  3578. void CarrierStatusSetAcquisitionStatus(void)
  3579.   {
  3580.    INT16 Cornerlock;
  3581.    INT16 WBAGCLock ;
  3582.    INT16 PMFAGCLock ;
  3583.    INT16 LMS1lock     ;
  3584.    INT16 LMS2lock     ;
  3585.    INT16 Trackinglock ;
  3586.    INT16 status       ;
  3587.    
  3588.    WBAGCLock = RegGetField(WBAGC_IT) ;
  3589.    PMFAGCLock = RegGetField(PMFAGC_IT) ;
  3590.    LMS1lock = RegGetField(EQU_LMS1) ;
  3591.    LMS2lock = RegGetField(EQU_LMS2) ;
  3592.    Cornerlock = RegGetField(CORNER_LOCK);
  3593.    if(LMS1lock == 0)
  3594.      LMS2lock = 0 ;
  3595.    Trackinglock = RegGetField(SYNCSTATE) ;
  3596.    if(LMS2lock == 0)
  3597.      Trackinglock = 0 ;/* find faults lock*/
  3598.   /* Print("nAGC is     : WBAGC: %s  PMFAGC: %s", WBAGCLock?"Lock       ":"Out of Lock",PMFAGCLock?"Lock       ":"Out of Lock");
  3599.    Print("nEQU is     : EQU1 : %s  EQU2  : %s", LMS1lock?"Lock       ":"Out of Lock",LMS2lock?"Lock       ":"Out of Lock");
  3600.    Print("nFEC is     : %s",Trackinglock?"Lock       ":"Out of Lock");
  3601.    */
  3602.    return ;
  3603.   }
  3604. FLAG_SAM Acquisition(float _Freq1, UINT32 _SymbolRate,
  3605.  INT32 _QAMSize, FLAG_SAM _SpectrumInversion)
  3606. {
  3607. UINT8 u8val;
  3608. FLAG_SAM DataFound=NO;
  3609. SIGNAL  MySignal;
  3610. Driv0297Signal.QAMSize = _QAMSize;
  3611. Driv0297Signal.SymbolRate = _SymbolRate;
  3612. Driv0297Signal.Frequency = (INT32)(_Freq1*1000);
  3613. RegSetField(PRGCLKDIV,1);
  3614. samDelay(1);
  3615. RegSetField(I2CT_EN,0x01);
  3616. samDelay(1);
  3617. SAMSetTunerFrequency(_Freq1);
  3618. samDelay(1);
  3619. RegSetField(I2CT_EN,0x00);
  3620. samDelay(1);  
  3621. RegSetField(PRGCLKDIV,0);
  3622. samDelay(0);
  3623. if(Driv0297Signal.QAMSize == 64 )
  3624. {
  3625. RegSetField(DIRECT_GAIN_LO,6);
  3626. RegSetField(INTEGRAL_GAIN_LO,6);
  3627. }
  3628. else if(Driv0297Signal.QAMSize == 128 )
  3629. {
  3630. RegSetField(DIRECT_GAIN_LO,6);
  3631. RegSetField(INTEGRAL_GAIN_LO,6);
  3632. }
  3633. else if(Driv0297Signal.QAMSize == 256 )
  3634. {
  3635. RegSetField(DIRECT_GAIN_LO,6);
  3636. RegSetField(INTEGRAL_GAIN_LO,6);
  3637. if(Driv0297Signal.SymbolRate < 1500) 
  3638. {
  3639. RegSetField(DIRECT_GAIN_LO,4);
  3640. RegSetField(INTEGRAL_GAIN_LO,6);
  3641. }
  3642. }
  3643. else if(Driv0297Signal.QAMSize == 32 )
  3644. {
  3645. RegSetField(DIRECT_GAIN_LO,6);
  3646. RegSetField(INTEGRAL_GAIN_LO,6);
  3647. }
  3648. else  /* QAM 16 */
  3649. {
  3650. RegSetField(DIRECT_GAIN_LO,4);
  3651. RegSetField(INTEGRAL_GAIN_LO,6);
  3652. RegSetOneRegister(DELAGC_7,0x60) ;
  3653. }
  3654. RegSetField(ALGOSEL,0);
  3655. if(Driv0297Signal.QAMSize == 64 )
  3656. {
  3657. RegSetOneRegister(WBAGC_11,0xF8) ;
  3658. if(RegGetField(ALGOSEL) == 0) 
  3659. {
  3660. RegSetField(U_THRESHOLD,0x06);
  3661. RegSetField(INITIAL_U,0x05);
  3662. RegSetField(BLIND_U,0x0a);
  3663. }
  3664. else 
  3665. {
  3666. RegSetField(U_THRESHOLD,0x09);
  3667. RegSetField(INITIAL_U,0x06);
  3668. RegSetField(BLIND_U,0x09);
  3669. }
  3670. }
  3671. else if(Driv0297Signal.QAMSize == 32)
  3672. {
  3673. RegSetOneRegister(WBAGC_11,0xF0) ;
  3674. if(RegGetField(ALGOSEL) == 0) 
  3675. {
  3676. RegSetField(U_THRESHOLD,0x08);
  3677. RegSetField(INITIAL_U,0x05);
  3678. RegSetField(BLIND_U,0x08);
  3679. }
  3680. else 
  3681. {
  3682. RegSetField(U_THRESHOLD,0x09);
  3683. RegSetField(INITIAL_U,0x06);
  3684. RegSetField(BLIND_U,0x09);
  3685. }
  3686. }
  3687. else if(Driv0297Signal.QAMSize == 16)
  3688. {
  3689. RegSetOneRegister(WBAGC_11,0xE1) ;
  3690. if(RegGetField(ALGOSEL) == 0) 
  3691. {
  3692. RegSetField(U_THRESHOLD,0x08);
  3693. RegSetField(INITIAL_U,0x05);
  3694. RegSetField(BLIND_U,0x08);
  3695. }
  3696. else 
  3697. {
  3698. RegSetField(U_THRESHOLD,0x09);
  3699. RegSetField(INITIAL_U,0x06);
  3700. RegSetField(BLIND_U,0x09);
  3701. }
  3702. }
  3703. else if(Driv0297Signal.QAMSize == 128)
  3704. {
  3705. RegSetOneRegister(WBAGC_11,0xFE) ;
  3706. if(RegGetField(ALGOSEL) == 0) 
  3707. {
  3708. RegSetField(U_THRESHOLD,0x08);
  3709. RegSetField(INITIAL_U,0x05);
  3710. RegSetField(BLIND_U,0x08);
  3711. }
  3712. else 
  3713. {
  3714. RegSetField(U_THRESHOLD,0x09);
  3715. RegSetField(INITIAL_U,0x06);
  3716. RegSetField(BLIND_U,0x09);
  3717. }
  3718. }
  3719. else if(Driv0297Signal.QAMSize == 256)
  3720. {
  3721. RegSetOneRegister(WBAGC_11,0xFF) ;
  3722. if(RegGetField(ALGOSEL) == 0)
  3723. {
  3724. RegSetField(U_THRESHOLD,0x08);
  3725. RegSetField(INITIAL_U,0x05);
  3726. RegSetField(BLIND_U,0x08);
  3727. if(Driv0297Signal.SymbolRate <=1500)
  3728.        {
  3729. RegSetField(U_THRESHOLD,0x0A);
  3730. RegSetField(INITIAL_U,0x08);
  3731. RegSetField(BLIND_U,0x0A);
  3732.        } 
  3733. }
  3734. else 
  3735. {
  3736. RegSetField(U_THRESHOLD,0x0A);
  3737. RegSetField(INITIAL_U,0x07);
  3738. RegSetField(BLIND_U,0x0A);
  3739. }
  3740. }
  3741. else 
  3742. {
  3743. RegSetOneRegister(WBAGC_11,0xF8) ;
  3744. if(RegGetField(ALGOSEL) == 0) 
  3745. {
  3746. RegSetField(U_THRESHOLD,0x08);
  3747. RegSetField(INITIAL_U,0x05);
  3748. RegSetField(BLIND_U,0x08);
  3749. }
  3750. else 
  3751. {
  3752. RegSetField(U_THRESHOLD,0x09);
  3753. RegSetField(INITIAL_U,0x06);
  3754. RegSetField(BLIND_U,0x09);
  3755. }
  3756. }
  3757. MySignal.QAMSize    = Driv0297Signal.QAMSize    ;
  3758. MySignal.SymbolRate = Driv0297Signal.SymbolRate ;
  3759. MySignal.Frequency  = Driv0297Signal.Frequency  ;
  3760. if(Driv0297Signal.SymbolRate >=4500)
  3761. {
  3762. if(_QAMSize == 16)
  3763. {
  3764. RegSetField(GAIN_DIR,4);
  3765. RegSetField(GAIN_INT,8);
  3766. }
  3767. else if(_QAMSize == 32)
  3768. {
  3769. RegSetField(GAIN_DIR,4);
  3770. RegSetField(GAIN_INT,8);
  3771. }
  3772. else if(_QAMSize == 64)
  3773. {
  3774. RegSetField(GAIN_DIR,2);
  3775. RegSetField(GAIN_INT,9);
  3776. }
  3777. else if(_QAMSize == 128)
  3778. {
  3779. RegSetField(GAIN_DIR,3);
  3780. RegSetField(GAIN_INT,10);
  3781. }
  3782. else if(_QAMSize == 256)
  3783. {
  3784. RegSetField(GAIN_DIR,3);
  3785. RegSetField(GAIN_INT,9);
  3786. }
  3787. }
  3788. else if(3500 < Driv0297Signal.SymbolRate && Driv0297Signal.SymbolRate < 4500)
  3789. {
  3790. if(_QAMSize == 16)
  3791. {
  3792. RegSetField(GAIN_DIR,4);
  3793. RegSetField(GAIN_INT,9);
  3794. }
  3795. else if(_QAMSize == 32)
  3796. {
  3797. RegSetField(GAIN_DIR,4);
  3798. RegSetField(GAIN_INT,9);
  3799. }
  3800. else if(_QAMSize == 64)
  3801. {
  3802. RegSetField(GAIN_DIR,4);
  3803. RegSetField(GAIN_INT,10);
  3804. }
  3805. else if(_QAMSize == 128)
  3806. {
  3807. RegSetField(GAIN_DIR,4);
  3808. RegSetField(GAIN_INT,10);
  3809. }
  3810. else if(_QAMSize == 256)
  3811. {
  3812. RegSetField(GAIN_DIR,3);
  3813. RegSetField(GAIN_INT,9);
  3814. }
  3815. }
  3816. else if(1500 < Driv0297Signal.SymbolRate && Driv0297Signal.SymbolRate < 3500)
  3817. {
  3818. if(_QAMSize == 16)
  3819. {
  3820. RegSetField(GAIN_DIR,4);
  3821. RegSetField(GAIN_INT,9);
  3822. }
  3823. else if(_QAMSize == 32)
  3824. {
  3825. RegSetField(GAIN_DIR,4);
  3826. RegSetField(GAIN_INT,9);
  3827. }
  3828. else if(_QAMSize == 64)
  3829. {
  3830. RegSetField(GAIN_DIR,4);
  3831. RegSetField(GAIN_INT,10);
  3832. }
  3833. else if(_QAMSize == 128)
  3834. {
  3835. RegSetField(GAIN_DIR,4);
  3836. RegSetField(GAIN_INT,10);
  3837. }
  3838. else if(_QAMSize == 256)
  3839. {
  3840. RegSetField(GAIN_DIR,3);
  3841. RegSetField(GAIN_INT,9);
  3842. }
  3843. }
  3844. else /* SR <1500 */
  3845. {
  3846. if(_QAMSize == 16)
  3847. {
  3848. RegSetField(GAIN_DIR,4);
  3849. RegSetField(GAIN_INT,9);
  3850. }
  3851. else if(_QAMSize == 32)
  3852. {
  3853. RegSetField(GAIN_DIR,4);
  3854. RegSetField(GAIN_INT,9);
  3855. }
  3856. else if(_QAMSize == 64)
  3857. {
  3858. RegSetField(GAIN_DIR,4);
  3859. RegSetField(GAIN_INT,10);
  3860. }
  3861. else if(_QAMSize == 128)
  3862. {
  3863. RegSetField(GAIN_DIR,4);
  3864. RegSetField(GAIN_INT,10);
  3865. }
  3866. else if(_QAMSize == 256)
  3867. {
  3868. RegSetField(GAIN_DIR,3);   
  3869. RegSetField(GAIN_INT,9);  
  3870. }
  3871. }
  3872. //Print(" Driv0297Signal.SymbolRate is [%d] [%d]n",Driv0297Signal.SymbolRate,_QAMSize);
  3873. if(Driv0297Signal.SymbolRate >=6500)
  3874. {
  3875. if(_QAMSize == 16)
  3876. DataFound=Driv0297CarrierSearch(&MySignal,_SpectrumInversion,1400,-100); 
  3877. else if(_QAMSize == 32)
  3878. DataFound=Driv0297CarrierSearch(&MySignal,_SpectrumInversion,700,-100); 
  3879. else if(_QAMSize == 64)
  3880. DataFound=Driv0297CarrierSearch(&MySignal,_SpectrumInversion,600,-100); 
  3881. else if(_QAMSize == 128)
  3882. DataFound=Driv0297CarrierSearch(&MySignal,_SpectrumInversion,550,-700); 
  3883. else if(_QAMSize == 256)
  3884. DataFound=Driv0297CarrierSearch(&MySignal,_SpectrumInversion,Driv0297Signal.SymbolRate/20,-100); 
  3885. }
  3886. else if(3500 <= Driv0297Signal.SymbolRate && Driv0297Signal.SymbolRate< 6500)
  3887. {
  3888. if(_QAMSize == 16)
  3889. DataFound=Driv0297CarrierSearch(&MySignal,_SpectrumInversion,1200,-100); 
  3890. else if(_QAMSize == 32)
  3891. DataFound=Driv0297CarrierSearch(&MySignal,_SpectrumInversion,550,-100); 
  3892. else if(_QAMSize == 64)
  3893. DataFound=Driv0297CarrierSearch(&MySignal,_SpectrumInversion,600,-100); 
  3894. else if(_QAMSize == 128)
  3895. DataFound=Driv0297CarrierSearch(&MySignal,_SpectrumInversion,550,-700); 
  3896. else if(_QAMSize == 256)
  3897. DataFound=Driv0297CarrierSearch(&MySignal,_SpectrumInversion,Driv0297Signal.SymbolRate/20,-100); 
  3898. }
  3899. else if(1500 < Driv0297Signal.SymbolRate && Driv0297Signal.SymbolRate< 3500)
  3900. {
  3901. if(_QAMSize == 16)
  3902. DataFound=Driv0297CarrierSearch(&MySignal,_SpectrumInversion,600,-100); 
  3903. else if(_QAMSize == 32)
  3904. DataFound=Driv0297CarrierSearch(&MySignal,_SpectrumInversion,200,-100); 
  3905. else if(_QAMSize == 64)
  3906. DataFound=Driv0297CarrierSearch(&MySignal,_SpectrumInversion,500,-100);
  3907. else if(_QAMSize == 128)
  3908. DataFound=Driv0297CarrierSearch(&MySignal,_SpectrumInversion,500,-700); 
  3909. else if(_QAMSize == 256)
  3910. DataFound=Driv0297CarrierSearch(&MySignal,_SpectrumInversion,230,-100); 
  3911. }
  3912. else   /* SR <=1500 */
  3913. {
  3914. if(_QAMSize == 16)
  3915. DataFound=Driv0297CarrierSearch(&MySignal,_SpectrumInversion,500,-100); 
  3916. else if(_QAMSize == 32)
  3917. DataFound=Driv0297CarrierSearch(&MySignal,_SpectrumInversion,200,-100); 
  3918. else if(_QAMSize == 64)
  3919. DataFound=Driv0297CarrierSearch(&MySignal,_SpectrumInversion,230,-100); 
  3920. else if(_QAMSize == 128)
  3921. DataFound=Driv0297CarrierSearch(&MySignal,_SpectrumInversion,270,-100); 
  3922. else if(_QAMSize == 256)
  3923. DataFound=Driv0297CarrierSearch(&MySignal,_SpectrumInversion,290,-110); 
  3924.     }  
  3925.   return (DataFound);
  3926. }
  3927. void QAM_Init(void)
  3928. {
  3929. RegReset();
  3930. Driv0297Init();
  3931. QAM64_RegInit();
  3932. }
  3933. INT16 Check_Lock(void)
  3934. {
  3935.    INT16 LMS1lock     ;
  3936.    INT16 LMS2lock     ;
  3937.    INT16 Trackinglock ;
  3938.    INT16 status       ;
  3939.    RegSetOneRegister(CTRL_2,0x00) ; 
  3940.    LMS1lock = RegGetField(EQU_LMS1) ;             
  3941.    LMS2lock = RegGetField(EQU_LMS2) ;             
  3942.    if(LMS1lock == 0)                              
  3943.      LMS2lock = 0 ;                               
  3944.    Trackinglock = RegGetField(SYNCSTATE) ;        
  3945.    if(LMS2lock == 0)                              
  3946.      Trackinglock = 0 ;
  3947.    return Trackinglock;
  3948. }
  3949. void RegReset(void)
  3950. {
  3951. INT32 reg ;
  3952. for ( reg = 0 ; reg < NBREG ; reg++ )
  3953. {
  3954. RegSetOneRegister(reg,RegMap[reg].Reset);
  3955. }
  3956. }
  3957. int CheckInversion(void)
  3958. {
  3959.    if(( RegGetField(WBAGC_IT) &&RegGetField(PMFAGC_IT) && RegGetField(EQU_LMS1)&& RegGetField(EQU_LMS2) ))
  3960.    {
  3961. if(RegGetField(SYNCSTATE))
  3962. {
  3963. //Print("Spectral Right!!");
  3964. return YES;
  3965. }
  3966. else
  3967. {
  3968. //Print("Spectral Changed !!");
  3969. return NO;
  3970. }
  3971.    }
  3972.    return NO;
  3973. }
  3974. void LoadRegisters(void)
  3975.   { 
  3976.   /* RegStoreValue() ;
  3977.     RegSetOneRegister(RegSearchAddress(0x80 ),0x01 ) ; 
  3978.    RegSetOneRegister(RegSearchAddress(0x80 ),0x00 ) ; 
  3979.     RegReloadValue() ;
  3980.     */
  3981.     
  3982.        
  3983.     
  3984.    RegSetField(SOFT_RESET,1);
  3985.    RegSetField(SOFT_RESET,0);
  3986.   if((UINT16)EXT_CLK ==2880)  
  3987.     {if((InputQAMSize_MODE==128)||(InputQAMSize_MODE==256))
  3988.        QAM256_Regreset_TH();
  3989.      else QAM64_Regreset_TH();
  3990.      /*printf("THOMSON InputQAMSize =%dn",InputQAMSize);*/
  3991.     }
  3992.   else
  3993.    {
  3994.      if((InputQAMSize_MODE==128)||(InputQAMSize_MODE==256))
  3995.        QAM256_Regreset();
  3996.      else QAM64_Regreset(); 
  3997.  }   
  3998.       
  3999.     
  4000.     
  4001.     return ;
  4002.  }
  4003.  
  4004.  void RegStoreValue(void)
  4005.    {
  4006. INT32 reg ;
  4007. for ( reg = 0 ; reg < NBREG ; reg++ )
  4008. RegMap[reg].Store = RegMap[reg].Value ;
  4009. return;    
  4010.    }
  4011. INT32  RegSearchAddress(INT32 _Address)
  4012. {
  4013. INT32 Index=-1;
  4014. for(Index = 0; ((Index < NBREG)&&(RegMap[Index].Addr !=_Address)); Index++) ;
  4015. if(Index>= NBREG)
  4016. Index = -1 ;
  4017. return (Index);
  4018. }
  4019. void RegReloadValue(void)
  4020.    {
  4021. INT32 reg ;
  4022. for ( reg = 0 ; reg < NBREG ; reg++ )
  4023. {
  4024.    RegMap[reg].Value = RegMap[reg].Store ;
  4025.    RegSetOneRegister(reg,RegMap[reg].Value);
  4026.  }
  4027. return;   
  4028.    }
  4029.  
  4030.    
  4031. void samDelay(int n)
  4032. {      
  4033.     
  4034.     KB_OSPTaskDelay(n);
  4035.     
  4036. }
  4037. INT32 SAMDetect(UINT16 addr)
  4038. {
  4039. INT32 rc = DMD_TYPE_NONE;
  4040. UINT8 pllFound = 0;
  4041. if(RETOK == KB_I2COpen(IIC_ADDR_NIM_30311, &i2c_dmd_handle))
  4042. {
  4043. Print("[tcmu30311.c] SAMDetect(): i2c_dmd_handle = 0x%X.n",i2c_dmd_handle);
  4044. if(QAM0297_Revision == SAMRevision())
  4045. {
  4046. UINT8 sout[4];
  4047. sout[0] = 0x1B; /* TUNER DIVIDER BYTE1 */
  4048. sout[1] = 0x15; /* TUNER DIVIDER BYTE2 */
  4049. sout[2] = 0x02; /* TUNER CONTROL BYTE1 */
  4050. sout[3] = 0x02; /* TUNER CONTROL BYTE2 */
  4051. /*
  4052. ** has detect stv0297 exist. Now detect the pll type.
  4053. ** Write 4 bytes to the pll and confirm the operartion
  4054. ** result(success or failure). So can confirm which 
  4055. ** tuner is in use.
  4056. */
  4057. if(!pllFound)
  4058. {
  4059. if(RETOK == KB_I2COpen(IIC_TUNER_ADDRESS_TH, &i2c_pll_handle))
  4060. {
  4061.     Print("[tcmu30311.c] SAMDetect(): i2c_pll_handle = 0x%X.n",
  4062.   i2c_pll_handle);
  4063. SAMEnableIICTuner();
  4064. if(RETOK == KB_I2CWriteWithStop(i2c_pll_handle, 4, sout))
  4065. {
  4066. pllFound = 1;
  4067. EXT_CLK = 2880;
  4068. rc = DMD_TYPE_QAM;
  4069. }
  4070. else
  4071. {
  4072. KB_I2CClose(i2c_pll_handle);
  4073. }
  4074. SAMDisableIICTuner();
  4075. KB_I2CClose(i2c_pll_handle);
  4076. }
  4077. else
  4078. {
  4079. Print("[tcmu30311.c] SAMDetect(): open i2c_pll_handle failed.n");
  4080. }
  4081. }
  4082. if(!pllFound)
  4083. {
  4084. if(RETOK == KB_I2COpen(IIC_TUNER_ADDRESS_SAM, &i2c_pll_handle))
  4085. {
  4086. SAMEnableIICTuner();
  4087. if(RETOK == KB_I2CWriteWithStop(i2c_pll_handle, 4, sout))
  4088. {
  4089. pllFound = 1;
  4090. EXT_CLK = 2892;
  4091. rc = DMD_TYPE_QAM;
  4092. }
  4093. else
  4094. {
  4095. KB_I2CClose(i2c_pll_handle);
  4096. }
  4097. SAMDisableIICTuner();
  4098. }
  4099. }
  4100. }
  4101. else
  4102. {
  4103. KB_I2CClose(i2c_dmd_handle);
  4104. }
  4105. }
  4106. STTBX_Print(("demod type = %d, clock = %d.n", rc, EXT_CLK));
  4107. return rc;
  4108. }