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

📄 ctcaldat.c

📁 free sources for gsm
💻 C
📖 第 1 页 / 共 5 页
字号:
   peekptr = HWNVMGetDataPtr(  ) + Offset;

#ifdef DEBUG
   GSMprintf( "Offset%u,Length:%u,Peek - ptr:%u\n", Offset, Length, peekptr );
#endif

   for ( i = 0; i < Length; i++ )
      {
      if ( doBlackOut )
         {
         if ( blackOutStart <= i && i <= blackOutEnd )
            ctout += GSMsprintf( ctout, "0," );
         else
            ctout += GSMsprintf( ctout, "%u,", ( UINT8 ) ( *peekptr ) );
         }
      else
         {
         ctout += GSMsprintf( ctout, "%u,", ( UINT8 ) ( *peekptr ) );
         }
      peekptr++;
      }

   ctout--;

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


/*---------------------------------------------------------------------*/
/*
Name: CTSetVersion
Desc: Sets the version array in the hw calibration data. The version array
      is a general purpose one and can be used by customers as they wish.
Params:
Returns:
Caveats:
*/

static void CTSetVersion( void )
   {
   UINT8 i;

   for ( i = 0; i < 10; i++ )
      {
      CalDataPtr->Version[i] = GeneralPurposeArray[i];
      }

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

/*---------------------------------------------------------------------*/
/*
Name: CTSetVersionString
Desc: Sets the cal version array in the calibration data as a string.
Params: CMD_LINE parameter treated as a string
Returns: Done or error message
Caveats: String to be set must be 1 cahr shorter than the structure to allow addition of end of string '\0'
*/

static void CTSetVersionString( CTTokenList * tokenList )

   {
   if ( GSMstrlen( tokenList->Token[1] ) >= sizeof( CalDataPtr->Version ) )
      CTSendStringResponse( "SetCalDataVerText:FAIL:String too long.\n" );
   else
      {
      GSMstrncpy( ( char * ) CalDataPtr->Version, tokenList->Token[1], sizeof( CalDataPtr->Version ) );
      CTSendStringResponse( "SetCalDataVerText:DONE\n" );
      }
   }

/*---------------------------------------------------------------------*/
/*
Name: CTShowVersionText
Desc: Sends the content of the version array in the calibration data structure in text format.
Params:
Returns:
Caveats:
*/

static void CTShowVersionText( void )
   {
   STRING s1 = GSM_NEW_STRING( 20 + sizeof( CalDataPtr->Version ) ); /* collect string for
                                                                        output to CT window */

   GSMsprintf( s1, "ShowCalDataVerText:RET:%s\n", CalDataPtr->Version );
   CTSendStringResponse( s1 );

   GSMFree( s1 );
   }

/*---------------------------------------------------------------------*/
/*
Name: CTShowVersion
Desc: Sends the content of the version array in the hw calibration data.
      The version array is a general purpose one and can be used by
      customers as they wish.
Params:
Returns:
Caveats:
*/

static void CTShowVersion( void )
   {
   UINT16 i;
   STRING s1 = GSM_NEW_STRING( 55 );   /* collect string for output to CT window */
   STRING ctout = s1;

   ctout += GSMsprintf( s1, "ShowCalDataVer:RET:" );
   ctout += GSMsprintf( ctout, "%u", ( UINT8 ) CalDataPtr->Version[0] );
   for ( i = 1; i < 10; i++ )
      {
      ctout += GSMsprintf( ctout, ",%u", ( UINT8 ) CalDataPtr->Version[i] );
      }

   GSMsprintf( ctout, "\n" );

   CTSendStringResponse( s1 );

   GSMFree( s1 );
   }

/*---------------------------------------------------------------------*/
/*
Name: CTShowCalStruct
Desc: A debug function, useful for checking the range for the peek and
      poke commands.
Params:
Returns:
Caveats:
*/

static void CTShowCalStruct( void )
   {
   STRING s1 = GSM_NEW_STRING( 300 );  /* collect string for output to CT window */
   STRING ctout = s1;

   ctout += GSMsprintf( ctout, "Element starting positions:\n" );
   ctout += GSMsprintf( ctout, "CheckSum:%u\n", HWNVMGetCheckSumOffset(  ) );
   ctout += GSMsprintf( ctout, "Cal data Version :%u\n", HWNVMGetCheckSumCalcOffset(  ) );
   ctout += GSMsprintf( ctout, "Powerramps start at:%u\n", HWNVMGetRampsOffset(  ) );
   ctout += GSMsprintf( ctout, "RX cal table starts at:%u\n", HWNVMGetGainCalTableOffset(  ) );
   ctout += GSMsprintf( ctout, "AFCDAC starts at:%u\n", HWNVMGetAFCDACStartValOffset(  ) );
#if 0 && defined (POLARIS_II)
   ctout += GSMsprintf( ctout, "PLL Call Table starts at:%u\n", HWNVMGetPLLTableStartValOffset(  ) );
#endif
   ctout += GSMsprintf( ctout, "IMEI at:%u\n", HWNVMGetIMEIOffset(  ) );
   ctout += GSMsprintf( ctout, "PTE Boot flag is at:%u\n", HWNVMGetPTEBootOffset(  ) );
   ctout += GSMsprintf( ctout, "ADC cal tables at:%u", HWNVMGetADCcalOffset(  ) );
#if defined (BRITE4_RF)
   ctout += GSMsprintf( ctout, "\nDCR offset table at:%u", HWNVMGetDCROffsetOffset(  ) );
#endif
   GSMsprintf( ctout, "\nLast byte of HW at:%u\n", sizeof( CALIBRATION_DATA ) );
   CTSendStringResponse( s1 );
   GSMFree( s1 );
   }

/*---------------------------------------------------------------------*/
/*
Name: CTUseDefCalData
Desc: Enforces the use of default calibration data even if the checksum
      in NVM was correct. This data can then be stored to NVM by using
      "StoreHW".
Params:
Returns:
Caveats:
*/

static void CTUseDefCalData( void )
   {
/*   HWNVMVarsSetDefault(  );*/
   GSMmemcpy( CalDataPtr, &DefaultCalibrationData, sizeof( CALIBRATION_DATA ) );
   CTSendStringResponse( "UseDefCalData:DONE\n" );
   }



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

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

   CTSendStringResponse( s1 );
   GSMFree( s1 );
   }

/*---------------------------------------------------------------------*/
/*
Name: CTDSPSetAFCDACVal
Desc: Set up a new value for use in the AFC DAC
Params:
Returns:
Caveats:
*/
static void CTDSPSetAFCDACVal( void )
   {
   if ( CalDataPtr->AFCDACStartValue )
      {
      HwCTSendSetAFCDAC( DC_SET_AFC_DAC_MODE_ON, CalDataPtr->AFCDACStartValue );
      CTDSPControl.ActionSheduled = FALSE;
      CTSendStringResponse( "SetAFCDAC:DONE\n" );
      }
   else
      {
      CTDSPControl.ActionSheduled = FALSE;
      CTSendStringResponse( "CTAFCDACValue = zero ! ... DONE\n" );
      }
   }

/*---------------------------------------------------------------------*/
/*
Name: CTSetAFCDACVal
Desc: Set up a new value for use in the AFC DAC
Params:
Returns:
Caveats:
*/
static void CTSetAFCDACVal( void )
   {
   CalDataPtr->AFCDACStartValue = CTAFCDACValue;
   CTDSPControl.ActionSheduled = TRUE;
   CTDSPControl.Action = CTDSPSetAFCDACVal;
   }

#if 0 && defined (POLARIS_II)

/*---------------------------------------------------------------------*/
/*
Name: CTShowPLLCallTable
Desc: Shows the currently used value for use in the PLL Call Table
Params:
Returns:
Caveats:
*/
static void CTShowPLLCallTable( void )
   {
   STRING s1 = GSM_NEW_STRING( 300 );
   STRING ctout = s1;
   INT8  i;

   ctout += GSMsprintf( ctout, "ShowPLLCallTable:RET:" );

   for ( i = 0; i < SIZE_OF_PLLTABLE; i++ )
      {
      ctout += GSMsprintf( ctout, "%d ", CalDataPtr->PllCallTables[i] );
      }

   ctout += GSMsprintf( ctout, "\n" );

   CTSendStringResponse( s1 );
   GSMFree( s1 );
   }

/*---------------------------------------------------------------------*/
/*
Name: CTSetPLLCallTable
Desc: Set up new value for use in the PLL Call Table
Params:
Returns:
Caveats:
*/
static void CTSetPLLCallTable( void )
   {
   INT8  i;

   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 )

⌨️ 快捷键说明

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