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

📄 ctcaldat.c

📁 free sources for gsm
💻 C
📖 第 1 页 / 共 5 页
字号:

   for ( i = 0; i < SIZE_OF_PLLTABLE; i++ )
      {
      CalDataPtr->PllCallTables[i] = CTPLLCallTable[i];
      }

   CTSendStringResponse( "SetPLLCallTable:DONE\n" );
   }

#endif

#if defined (AERO_PLUS) || defined(MARS)
/*---------------------------------------------------------------------*/
/*
Name: CTShowCDAC
Desc: Shows the currently used value for use in the CDAC
Params:
Returns:
Caveats:
*/
static void CTShowCDAC( void )
   {
   STRING s1 = GSM_NEW_STRING( 300 );
   STRING ctout = s1;

   ctout += GSMsprintf( ctout, "ShowCDAC:RET:" );
   GSMsprintf( ctout, "%d\n", CalDataPtr->CDAC );

   CTSendStringResponse( s1 );
   GSMFree( s1 );
   }

/*---------------------------------------------------------------------*/
/*
Name: CDACtoDSP
Desc: Set up a new value for rf_config CDAC  in DSP
Params:
Returns:
Caveats:
*/
void  CDACtoDSP(void)   //20050310 cmj for Lindy3 AERO_PLUS
{
 UINT16 *x;

if ( ( x = Hw_Read_TX_DXCO(  ) ) != NULL )
      {    
       CTResetDSPAction(  );
       HwSendRFConfig( 1, x );
       }
}

/*---------------------------------------------------------------------*/
/*
Name: CTSetCDAC
Desc: Set up a new value for use in the CDAC
Params:
Returns:
Caveats:
*/
static void CTSetCDAC( void )
   {
   STRING s1 = GSM_NEW_STRING( 300 );
   STRING ctout = s1;

   CalDataPtr->CDAC = CTCDACValue;
#if defined (AERO_PLUS)
   HwSendSetSerialWord( (( CalDataPtr->CDAC * 64 ) + 3) | (0x6000), 0xB0 );
#else
   HwSendSetSerialWord( ( CalDataPtr->CDAC * 64 ) + 40, 0xB0 );
#endif
   GSMsprintf( ctout, "SetCDAC:DONE\n" );
   CTSendStringResponse( s1 );
#if defined (AERO_PLUS)
/*set up new value for rf_config CDAC in DSP*/
      CTDSPControl.Action = CDACtoDSP;   //20050310 cmj for Lindy3 AERO_PLUS
      CTDSPControl.ActionSheduled = TRUE;
#endif
   GSMFree( s1 );
   }

/*---------------------------------------------------------------------*/
/*
Name: CTShowCDAC
Desc: Shows the currently used value for use in the CDAC
Params:
Returns:
Caveats:
*/
static void CTShowCVARSlope( void )
   {
   STRING s1 = GSM_NEW_STRING( 300 );
   STRING ctout = s1;

   ctout += GSMsprintf( ctout, "ShowCVARSlope:RET:" );
   GSMsprintf( ctout, "%d\n", CalDataPtr->CVAR_SLOPE );

   CTSendStringResponse( s1 );
   GSMFree( s1 );
   }

/*---------------------------------------------------------------------*/
/*
Name: CTSetCDAC
Desc: Set up a new value for use in the CDAC
Params:
Returns:
Caveats:
*/
static void CTSetCVARSlope( void )
   {
   STRING s1 = GSM_NEW_STRING( 300 );
   STRING ctout = s1;

   CalDataPtr->CVAR_SLOPE = CTCVARSlopeValue;

   GSMsprintf( ctout, "SetCVARSlope:DONE\n" );
   CTSendStringResponse( s1 );
   GSMFree( s1 );
   }

#endif



/* ----------------------------------------------------------------------- */
/*
Name: ServiceListingToPort
Desc: Callback for putting cal data details out to trace port on a timer
Params:
Returns:
Caveats:
*/
static void ServiceListingToPort( void *dummy )
   {
   STRING ctout;
   STRING s1;
   UINT32 numberBytesThisTime,
         dwTickPeriod = 200;

   UNUSED( dummy );

   numberBytesThisTime = ( UINT32 ) ( theFullReply[currentReply + 1] )
      - ( UINT32 ) ( theFullReply[currentReply] );
#if defined (IO_TRACER)
   dwTickPeriod = ( numberBytesThisTime * CTTXBITSPERCHAR / IOTRGetBaudrate(  ) * 1000 /* mSec */  );
   if ( dwTickPeriod < 50 )
      dwTickPeriod = 50;        /* Wait at least a few frames so not to overlaod the
                                   system.. */
#endif
   s1 = GSM_NEW_STRING( numberBytesThisTime + 1 );
   ctout = s1;

   GSMstrncpy( ctout, theFullReply[currentReply], numberBytesThisTime );
   ctout += numberBytesThisTime;
   *ctout = 0;
   CTSendStringResponse( s1 );

   /* Now if there's still more, arrange to send out next chunk later */
   currentReply++;
   if ( theFullReply[currentReply] && *( theFullReply[currentReply] ) )
      {
      GSMStartTimer( CT_MISC_TIMER, MSECS( ( INT32 ) dwTickPeriod ), ServiceListingToPort, NULL );
      }
   else
      {
      /* We must be at the end of the big buffer. Need to free it now. */
      GSMFree( theFullReply[0] );
      }
   GSMFree( s1 );
   }


/* ----------------------------------------------------------------------- */
/*
Name: CTSetUpAFullListing
Desc: Prepare strings describing the contents of the passed calibration data
      structure in the ptr array theFullReply and start off the pumping out of
      these strings sequentially to the serial output (using a timer)
Params:
Returns:
Caveats:
*/
static void CTSetUpAFullListing( CALIBRATION_DATA * listingPtr, STRING firstLine )
   {
   STRING ctout;
   UINT8 *Table;
   INT16 i,
         j;
   UINT16 *pRamp,
         wRXCalDataOffset;
   UINT8 tempGLIMEISV[8],
         bBand,
         bFirstPCL,
         bLastPCL;
#if defined(RENESAS_RF_B5) && defined (RF_GAIN_AREAS)
         UINT8 Area;
#endif

#if defined( BRITE4_RF )
   UINT16 wBand,
         wGain,
         wSubband;

#endif

   currentReply = 0;

   ctout = GSM_NEW_STRING( ( BufSize ) );

   theFullReply[0] = ctout;
   currentReply++;

   ctout += GSMsprintf( ctout, firstLine );
   if ( !bListDCROffsetsOnly )
      {
      /* VERSION */
      theFullReply[currentReply++] = ctout;
      ctout += GSMsprintf( ctout, "Cal Data Version" );
      for ( i = 0; i < 10; i++ )
         {
         ctout += GSMsprintf( ctout, ",%u", ( UINT8 ) listingPtr->Version[i] );
         }
      ctout += GSMsprintf( ctout, "\n" );

      /* TX RAMP DATA */
      pRamp = ( UINT16 * ) & ( listingPtr->PowerRampTablesBand0[0][0] );
      for ( bBand = 0; bBand < CalibrationBandInfo.bActiveBands; bBand++ )
         {
         bFirstPCL = CalibrationBandInfo.bFirstPCLInBand[bBand];
         bLastPCL = bFirstPCL + CalibrationBandInfo.bRampsInBand[bBand];
         for ( j = bFirstPCL; j < bLastPCL; j++ )
            {
            theFullReply[currentReply++] = ctout;
            ctout += GSMsprintf( ctout, "Band %u power level %d ramp & adjust values\n", bBand, j );
            for ( i = 0; i < SIZE_OF_GSM_RAMP; i++ )
               ctout += GSMsprintf( ctout, ",%u", *pRamp++ );
            ctout += GSMsprintf( ctout, "\n" );
            }
         }

#if defined (RENESAS_RF_B5)

      /* TX RAMP DATA */
      pRamp = ( UINT16 * ) ( &( listingPtr->PowerRampTables8PSKBand0[0][0] ) );

      for ( bBand = 0; bBand < CalibrationBandInfo.bActiveBands; bBand++ )
         {
         bFirstPCL = CalibrationBandInfo.bFirstPCLInBand[bBand];
         bLastPCL = bFirstPCL + CalibrationBandInfo.bRampsInBand[bBand];
         for ( j = bFirstPCL; j < bLastPCL; j++ )
            {
            theFullReply[currentReply++] = ctout;
            ctout += GSMsprintf( ctout, "Band %u power level %d ramp & adjust values for 8PSK\n", bBand, j );
            for ( i = 0; i < SIZE_OF_GSM_RAMP; i++ )
               ctout += GSMsprintf( ctout, ",%u", *pRamp++ );
            ctout += GSMsprintf( ctout, "\n" );
            }
         }
#endif


#if defined (RF_GAIN_AREAS)
    /* RX GAIN DATA */




      CheckGainSizes(  );

      /* Check if we have a BB table inside */
      if (( listingPtr->Gain_area_sizes[listingPtr->BBTablePosition] > 0 ) &&
          (listingPtr->BBTablePosition < MAX_GAIN_AREAS))
         {

         theFullReply[currentReply++] = ctout;
         ctout += GSMsprintf( ctout, "RX Baseband Gain Cal Table:\n" );
      
         /* Set to start of table */
         Table = listingPtr->Hw_Rf_Gain_Cal_Table;

         for ( i = 0; i < listingPtr->BBTablePosition; i++ )
            {
            /* Increase pointer until we've reached the BBtable */
            Table += listingPtr->Gain_area_sizes[i];
            }


         for ( i = 0; i < listingPtr->Gain_area_sizes[listingPtr->BBTablePosition]; i++ )
            {
            ctout += GSMsprintf( ctout, ", %u", Table[i] );
            }
         ctout += GSMsprintf( ctout, "\n" );
         }


      Table = listingPtr->Hw_Rf_Gain_Cal_Table;

      /* Display the other areas */
      for ( Area = 0; Area < MAX_GAIN_AREAS; Area++ )
         {
         UINT16 k;

         /* Check if current area isn't the BB table */
         if (( Area != listingPtr->BBTablePosition ) ||
            (listingPtr->BBTablePosition > MAX_GAIN_AREAS))
            {
            theFullReply[currentReply++] = ctout;

            ctout += GSMsprintf( ctout, "Area %u Gain Cal Table:\n", Area );

            for ( k = 0; k < listingPtr->Gain_area_sizes[Area]; k++ )
               {
               ctout += GSMsprintf( ctout, ", %u", Table[k] );
               }
            ctout += GSMsprintf( ctout, "\n" );
            }
         Table += listingPtr->Gain_area_sizes[Area];
         }

#else

      /* RX GAIN DATA */
      theFullReply[currentReply++] = ctout;
      ctout += GSMsprintf( ctout, "RX Baseband Gain Cal Table:\n" );
      Table = &( listingPtr->Hw_Rf_Gain_Cal_Table[RX_BB_TABLE_POS] );

#if (RX_BB_TABLE_SIZE != 0)
      for ( i = 0; i < RX_BB_TABLE_SIZE; i++ )
         {
         ctout += GSMsprintf( ctout, ", %u", Table[i] );
         }
      ctout += GSMsprintf( ctout, "\n" );
#endif

      for ( bBand = 0; bBand < CalibrationBandInfo.bActiveBands; bBand++ )
         {
         UINT16 k;

         wRXCalDataOffset = ( RX_BB_TABLE_SIZE + ( bBand * RX_BAND_TABLE_SIZE ) );
         theFullReply[currentReply++] = ctout;
         ctout += GSMsprintf( ctout, "Band %u Gain Cal Table:\n", bBand );
         for ( k = wRXCalDataOffset; k < wRXCalDataOffset + RX_BAND_TABLE_SIZE; k++ )
            {
            ctout += GSMsprintf( ctout, ", %u", Table[k] );
            }
         ctout += GSMsprintf( ctout, "\n" );
         }
#endif

      /* The AFCDACStartValue - section */
      theFullReply[currentReply++] = ctout;
      ctout += GSMsprintf( ctout, "AFC DAC start value, %d\n", listingPtr->AFCDACStartValue );

      /* The IMEI - section: Descramble it in a temp buffer before showing! */
      GSMmemcpy( tempGLIMEISV, listingPtr->GLIMEISV, 8 );
      UHNVMDecodeIMEI( tempGLIMEISV );
      theFullReply[currentReply++] = ctout;
      ctout += GSMsprintf( ctout, "IMEI" );
      for ( i = 0; i < 8; i++ )
         {
         ctout += GSMsprintf( ctout, ",%x", ( UINT8 ) tempGLIMEISV[i] );
         }
      ctout += GSMsprintf( ctout, "\n" );

      theFullReply[currentReply++] = ctout;
      ctout += GSMsprintf( ctout, "PTEBootSeq, %u", listingPtr->PTEBootSeq );

      /* e.g. Vbatt measurement offset... */
      theFullReply[currentReply++] = ctout;
      ctout += GSMsprintf( ctout, "ADCcal:\n" );
      for ( i = 0; i < ADC_CAL_CHANNELS; i++ )
         {
         ctout += GSMsprintf( ctout, "Chan %u, High Offset = %d", i, listingPtr->ADCcal[0][i] );
         ctout += GSMsprintf( ctout, ", Chan %u, Low Offset = %d\n", i, listingPtr->ADCcal[1][i] );
         }
      }
   /* Brite 4 RF DCR offsets */
#if defined( BRITE4_RF )
   theFullReply[currentReply++] = ctout;
   for ( wBand = 0; wBand < NO_RF_BANDS; wBand++ )
      {

⌨️ 快捷键说明

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