cal_class.h

来自「这是一个手机校准程序」· C头文件 代码 · 共 141 行

H
141
字号
// cal_class.h
//
// June 27, 2000
// Replaced chipset_type with PACCalType
//

#include "user_params.h"

#define		RAMP_TABLE_SIZE		19
#define		GSYS_SIZE	64
#define		MIN_GSYS_34	-2000
#define		MAX_GSYS_34	 2000
#define   NUMBER_OF_RAMP_POINTS       16
#define		RAMP_LENGTH		32		// entries in 1 ramp
#define   GSM_PEDESTAL_DELTA  0x10  // amount to decrease pedestal from last measured value
#define   DCS_PEDESTAL_DELTA  0x10  // amount to decrease pedestal from last measured value
#define   PCS_PEDESTAL_DELTA  0x10  // amount to decrease pedestal from last measured value
#define   GSM850_PEDESTAL_DELTA  0x10  // amount to decrease pedestal from last measured value
#define   DEFAULT_SYSGAIN_FILE "sysgain.txt"

typedef struct
  {
	UInt16 TxRampCalStepsGsm;
	UInt16 TxRampCalStepsDcs;
	UInt16 TxRampCalStepsPcs;
	UInt16 TxRampCalStepsGsm850;
	UInt16 CurAPCDacGsm[RAMP_TABLE_SIZE];
	UInt16 CurAPCDacDcs[RAMP_TABLE_SIZE];
	UInt16 CurAPCDacPcs[RAMP_TABLE_SIZE];
	UInt16 CurAPCDacGsm850[RAMP_TABLE_SIZE];

	float CoarseTxDeltaGsm;
	float CoarseTxDeltaDcs;
	float CoarseTxDeltaPcs;
	float CoarseTxDeltaGsm850;
	UInt16 FreqDacZero;
	UInt16 FreqDacLsb;
	UInt16 FreqDacMulti;
	UInt16 FreqDacShift;
	Int16 GsysDeltaGsm;
	Int16 GsysDeltaDcs;
	Int16 GsysDeltaPcs;
	Int16 GsysDeltaGsm850;
	UInt16 ComputedAPCDacGsm[RAMP_TABLE_SIZE];
	UInt16 ComputedAPCDacDcs[RAMP_TABLE_SIZE];
	UInt16 ComputedAPCDacPcs[RAMP_TABLE_SIZE];
	UInt16 ComputedAPCDacGsm850[RAMP_TABLE_SIZE];
	float  ApcSlope0Gsm;		// changed name 9/16/99 - this is the slope of the 1st seg: pwr levels 0-3
	float  ApcSlope1Gsm;		// changed name 9/16/99 - this is the slope of the 2nd seg: pwr levels 4-10
	float  ApcSlope2Gsm;		// added 9/16/99 nrs - this is the slope of the 3rd seg: pwr levels 11-14								
	float  ApcSlope0Dcs;		// changed name 9/16/99 - this is the slope of the 1st seg: pwr levels 0-3
	float  ApcSlope1Dcs;		// changed name 9/16/99 - this is the slope of the 2nd seg: pwr levels 4-10
	float  ApcSlope2Dcs;		// added 9/16/99 nrs - this is the slope of the 3rd seg: pwr levels 11-15								
	float  ApcSlope0Pcs;		// added 11/20 for PCS
	float  ApcSlope1Pcs;		// ditto
	float  ApcSlope2Pcs;		// ditto	
	float  ApcSlope0Gsm850;
	float  ApcSlope1Gsm850;
	float  ApcSlope2Gsm850;
	Int16  GSMRxPwrDelta[GSYS_SIZE];	// added 10/1
	Int16  DCSRxPwrDelta[GSYS_SIZE];	// added 10/1
	Int16  PCSRxPwrDelta[GSYS_SIZE];
	Int16  GSM850RxPwrDelta[GSYS_SIZE];
	Int16  GSMRxPwr[GSYS_SIZE];	        // added 10/4
	Int16  DCSRxPwr[GSYS_SIZE];	        // added 10/4
	Int16  PCSRxPwr[GSYS_SIZE];	        // added 11/20
	Int16  GSM850RxPwr[GSYS_SIZE];
	Int16  GSMPedestal;					// added 10/19
	Int16  DCSPedestal;					// added 10/19
	Int16  PCSPedestal;					// added 11/20
	Int16  GSM850Pedestal;	
  UInt16 GSMRampTable[NUMBER_OF_RAMP_POINTS][2*RAMP_TABLE_SIZE];
  UInt16 DCSRampTable[NUMBER_OF_RAMP_POINTS][2*RAMP_TABLE_SIZE];
  UInt16 PCSRampTable[NUMBER_OF_RAMP_POINTS][2*RAMP_TABLE_SIZE];
  UInt16 GSM850RampTable[NUMBER_OF_RAMP_POINTS][2*RAMP_TABLE_SIZE];
  } Cal_t; 


class cal
  {
  BandIndex_t   band;
  UInt16        ch;
  BOOL          logging;
  char          log_filename[1024];

  public:
    PACCalType_t  pac_cal_type;
    Cal_t         cal_data;
    hs            cal_hs;
    measure       cal_measure;
    
    cal();
    void LogTxPowerTable(float *table, unsigned length, float unused);
    void WriteLog(char *buf);
    void InitializeLogFile();
    void InitializeLogFile(char *filename);
    void EnableLogging(BOOL enable);
    Error_t TestFreqPhase();
    Error_t CalFreqDac();
    Error_t CalTxGsm(UserDefParm_t parms);
    Error_t CalRxGsm();
    Error_t CalTxDcs(UserDefParm_t parms);
    Error_t CalRxDcs();
    Error_t CalTxPcs(UserDefParm_t parms);
    Error_t CalRxPcs();
	Error_t CalTxGsm850(UserDefParm_t parms);
    Error_t CalRxGsm850();
    Error_t GenReport(char OutputFilename[256], char ParamTemplateFilename[256], UserDefParm_t parms);
    BOOL SetPACCalType(PACCalType_t type);
    BOOL SetBand(BandIndex_t b);

  private:
    Error_t FindSatPower(float *sat_pwr,unsigned *sat_dac,
                         float *highest_unsat_pwr,unsigned *highest_unsat_dac,
                         unsigned start_dac,
                         float limit,
                         UserDefParm_t parms);
    Error_t ramp_sanity_check(unsigned peak_dac[]);
    Error_t CalInfineonAPC(float coarse_tx_delta,
                            unsigned *current_peak_dac,
                            unsigned ramp_table[NUMBER_OF_RAMP_POINTS][2*RAMP_TABLE_SIZE],
                            float highest_power,
                            int *ramp_up_length,
                            int *ramp_down_length,
                            int *ramp_up_delta,
                            int *ramp_down_delta,
                            float *ramp_pedestal_slope,
                            float *ramp_pedestal_power,
                            float lowest_power,float next_lowest_power,
                            float lowest_dac,float next_lowest_dac);
    UInt16 GetTxPwrIndex(UInt16 TotalSteps, UInt16	CurStep);
    float CalTxRampSlope(UInt16 TotalSteps,float	*RxlevDb,UInt16	*ApcDac,UInt16  *TxRampIndex);
    float GetNormTxPwr(UInt16 TxPwrIndex);
    void build_pedestal_ramp(UInt16 min_up_dac, UInt16 min_down_dac, UInt16 peak_dac, UInt16 ramp[RAMP_LENGTH], 
				                     float slope, UserDefParm_t parms);
    void search_for_apc_dac(float target,unsigned *peak,float *msrd,
                            unsigned *upper_limit,unsigned *lower_limit,unsigned *hard_lower_limit,
                            UserDefParm_t parms,
                            Error_t *stat);
  };

⌨️ 快捷键说明

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