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

📄 ctcaldat.c

📁 free sources for gsm
💻 C
📖 第 1 页 / 共 5 页
字号:
   {
   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++ )
      {
      for ( wGain = 0; wGain < DCROFFS_GAIN_SETTINGS; wGain++ )
         {
         ctout += GSMsprintf( ctout, "DCROffset (Dec) Band %u, Gain %u = ", wBand, wGain );
         for ( wSubband = 0; wSubband < DCROFFS_SUBBANDS; wSubband++ )
            {
            ctout += GSMsprintf( ctout, "(%u,%u) ", listingPtr->DCRRXOffset[wBand][wGain][wSubband][0], listingPtr->DCRRXOffset[wBand][wGain][wSubband][1] );
            }
         ctout += GSMsprintf( ctout, "\n" );
         theFullReply[currentReply++] = ctout;
         }
      }
#endif

#if defined( AERO_PLUS ) || defined(MARS)
   /* The CVAR_SLOPE - section */
   theFullReply[currentReply++] = ctout;
   ctout += GSMsprintf( ctout, "CVAR SLOPE, %d\n", listingPtr->CVAR_SLOPE );

   /* The CDAC - section */
   theFullReply[currentReply++] = ctout;
   ctout += GSMsprintf( ctout, "CDAC, %d\n", listingPtr->CDAC );
#endif

#if defined (RENESAS_RF_B5)

   /* The RF_CONFIG - section */
   theFullReply[currentReply++] = ctout;

   ctout += GSMsprintf( ctout, "RFConfigLength, %d\n\n", listingPtr->RFConfigLength );

   ctout += GSMsprintf( ctout, "RFConfig " );

   for ( i = 0; i < listingPtr->RFConfigLength; i++ )
      {
      ctout += GSMsprintf( ctout, ",%d", listingPtr->RFConfig[i] );
      }
   ctout += GSMsprintf( ctout, "\n" );

   /* The RxTxFreqOffset - section */
   theFullReply[currentReply++] = ctout;
   ctout += GSMsprintf( ctout, "RxTxFreqOffset " );

   for ( i = 0; i < NO_RF_BANDS; i++ )
      {
      ctout += GSMsprintf( ctout, ",%d", listingPtr->RxTxFreqOffset[i] );
      }
   ctout += GSMsprintf( ctout, "\n" );

   /* The RF_INIT - section */
   theFullReply[currentReply++] = ctout;

   ctout += GSMsprintf( ctout, "RFInitDataLength, %d\n\n", listingPtr->RFInitDataLength );

   ctout += GSMsprintf( ctout, "RFInitData " );

   for ( i = 0; i < listingPtr->RFInitDataLength; i++ )
      {
      ctout += GSMsprintf( ctout, ",%d", listingPtr->RFInitData[i] );
      }
   ctout += GSMsprintf( ctout, "\n" );
#endif

#if 0 && defined (POLARIS_II)
   /* The PLL Table - section: */
   theFullReply[currentReply++] = ctout;
   ctout += GSMsprintf( ctout, "PLL Call Table:\n" );
      {
      INT8  k;

      for ( k = 0; k < SIZE_OF_PLLTABLE; k++ )
         {
         ctout += GSMsprintf( ctout, "%d ", listingPtr->PllCallTables[k] );
         }
      ctout += GSMsprintf( ctout, "\n" );
      }
#endif

   theFullReply[currentReply] = ctout;
   *( theFullReply[currentReply] ) = '\0';
   currentReply = 0;

   /*
      Now, start off a timer for pumping this data out at the serial port, not too fast
      but also not too slow
   */
   GSMStartTimer( CT_MISC_TIMER, MSECS( 200 ), ServiceListingToPort, NULL );
   }


/*---------------------------------------------------------------------*/
/*
Name: CTForceHWNVMValid
Desc: Force a correct checksum into NVM HW area
Params:  -
Returns: -
Caveats:
*/
#if !defined(FFS)
static void CTForceHWNVMValid( void )
   {
   STRING s1 = GSM_NEW_STRING( 300 );
   STRING ctout = s1;

   GSMsprintf( ctout, "ForceNVMGood:DONE\n" );
   HWNVMForceValid(  );

   CTSendStringResponse( s1 );
   GSMFree( s1 );
   }

#endif

⌨️ 快捷键说明

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