1 #ifndef _CALIBRATION_STRUCT_H__
\r
2 #define _CALIBRATION_STRUCT_H__
\r
5 /*lint -save -e768 */
\r
7 typedef unsigned char uint8;
\r
11 typedef unsigned short uint16;
\r
15 typedef unsigned int uint32;
\r
23 typedef short int16;
\r
26 //struct calibration_struct_va
\r
28 #define NUM_TEMP_BANDS 5
\r
29 //constant parameter numbers, 16 level
\r
30 #define NUM_RAMP_RANGES 16
\r
32 #define NUM_TX_LEVEL 16
\r
33 #define NUM_RAMP_POINTS 20
\r
34 #define NUM_GSM_ARFCN_BANDS 6
\r
35 #define NUM_DCS_ARFCN_BANDS 8
\r
36 #define NUM_PCS_ARFCN_BANDS 7
\r
37 #define NUM_GSM850_ARFCN_BANDS 6
\r
38 #define MAX_COMPENSATE_POINT 75
\r
42 int16 stage0[NUM_RAMP_POINTS];
\r
43 int16 stage1[NUM_RAMP_POINTS];
\r
44 int16 stage2[NUM_RAMP_POINTS];
\r
45 int16 stage3[NUM_RAMP_POINTS];
\r
46 int16 stage4[NUM_RAMP_POINTS];
\r
47 int16 stage5[NUM_RAMP_POINTS];
\r
48 int16 stage6[NUM_RAMP_POINTS];
\r
49 int16 stage7[NUM_RAMP_POINTS];
\r
50 int16 stage8[NUM_RAMP_POINTS];
\r
51 int16 stage9[NUM_RAMP_POINTS];
\r
52 int16 stage10[NUM_RAMP_POINTS];
\r
53 int16 stage11[NUM_RAMP_POINTS];
\r
54 int16 stage12[NUM_RAMP_POINTS];
\r
55 int16 stage13[NUM_RAMP_POINTS];
\r
56 int16 stage14[NUM_RAMP_POINTS];
\r
57 int16 stage15[NUM_RAMP_POINTS];
\r
64 // uint16 RF_Project_ID;
\r
65 uint16 slope_length ;
\r
68 uint16 slope_struct[3][17] ;
\r
74 /************* AFC ********************/
\r
75 uint16 is_using_si4134; // TRUE, the si4134 from Silicon lab is used. Then the way to calibrate
\r
76 // the 13Mhz is different. For si4134, Total 64 steps( 1.0 ppm per step)
\r
77 // can be set to set coarse 13Mhz.
\r
78 uint16 si4134_coarse_13m; // For si4134, it is 6bits, and for setting the CDAC register of si4134
\r
81 uint16 afc_slope_per_6bits;
\r
87 /************* AFC ********************/
\r
88 RF_aero1_AFC_T rf_aero1_afc_struct;
\r
89 // Oscillator temperature calibration table.
\r
90 int16 osci_temp_comp_in_dac[ NUM_TEMP_BANDS ]; // In Hz
\r
96 RF_aero2_AFC_T rf_aero2_afc_struct;
\r
97 } RF_param_common_DSP_use_T;
\r
101 /*int16 RF_ramp_up_table_stage0[NUM_RAMP_POINTS]; //64 words totally
\r
102 int16 RF_ramp_up_table_stage1[NUM_RAMP_POINTS];
\r
103 int16 RF_ramp_down_table_stage0[NUM_RAMP_POINTS];
\r
104 int16 RF_ramp_down_table_stage1[NUM_RAMP_POINTS];*/
\r
105 int16 rf_ramp_param_constant_up[NUM_RAMP_RANGES];//const part of the ramp tale
\r
106 int16 rf_ramp_param_constant_down[NUM_RAMP_RANGES];//const part of the ramp tale
\r
107 int16 rf_ramp_up_param_num;//the number of ramp up parameters in the ramp parameters table for one level
\r
108 int16 rf_ramp_down_param_num;//the number of ramp down
\r
110 /* int16 temperature_and_voltage_compensate_structrue[30]*/
\r
111 int16 reserved[64 - 2*NUM_RAMP_RANGES - 1 - 1];//keep 64words totally to keep consistency with dsp code
\r
113 int16 TX_compensate_boundary_arfcn_index[4];
\r
114 int16 RF_ramppwr_step_factor[5][NUM_TX_LEVEL];
\r
115 int16 RF_ramp_delta_timing[NUM_TX_LEVEL];
\r
116 int16 RF_ramp_PA_power_on_duration[NUM_TX_LEVEL];
\r
117 // int16 RX_compensate_boundary_arfcn_index[4];
\r
118 // int16 RX_compensate_value[5];
\r
119 int16 reserved1[9];
\r
120 int16 temperature_RX_compensate_boundary_ADC[4];
\r
121 int16 temperature_RX_compensate_value[5];
\r
122 int16 temperature_TX_compensate_boundary_ADC[4];
\r
123 int16 temperature_TX_rampwr_step_factor[5];
\r
124 int16 ramp_switch_level;
\r
125 uint16 afc_alg_bias;
\r
126 uint16 agc_ctrl_word[91]; // The index is the expected received signal strangth in db in 2 db steps,
\r
127 // the content is the control word set the RF receiver chain agc.
\r
129 int16 max_rf_gain_index;
\r
130 int16 reserve_for_future[20];
\r
132 int16 RX_compensate_value[MAX_COMPENSATE_POINT];
\r
133 RF_ramp_table_T RF_ramp_table;
\r
135 } RF_param_band_DSP_use_T;
\r
139 RF_param_common_DSP_use_T rf_common_param_dsp_use;
\r
140 RF_param_band_DSP_use_T rf_gsm_param_dsp_use;
\r
141 RF_param_band_DSP_use_T rf_dcs_param_dsp_use;
\r
142 RF_param_band_DSP_use_T rf_pcs_param_dsp_use;
\r
143 RF_param_band_DSP_use_T rf_gsm850_param_dsp_use;
\r
144 }RF_param_DSP_use_T;
\r
148 int8 rx_whole_band_comp_gsm[NUM_GSM_ARFCN_BANDS];
\r
149 int8 rx_whole_band_comp_dcs[NUM_DCS_ARFCN_BANDS];
\r
150 int8 rx_whole_band_comp_pcs[NUM_PCS_ARFCN_BANDS];
\r
151 int8 rx_whole_band_comp_gsm850[NUM_GSM850_ARFCN_BANDS];
\r
152 int8 pa_GSM_temp_comp[ NUM_TEMP_BANDS];
\r
154 int8 pa_DCS_temp_comp[ NUM_TEMP_BANDS];
\r
156 int8 pa_PCS_temp_comp[ NUM_TEMP_BANDS];
\r
157 int8 pa_GSM850_temp_comp[ NUM_TEMP_BANDS];
\r
159 /******************** RX level calculation *********************/
\r
160 // The received signal level(RSSI) value reported to the network may need to be adjusted based on the received signal
\r
162 int8 rxlev_GSM_temp_comp[ NUM_TEMP_BANDS];
\r
164 int8 rxlev_DCS_temp_comp[ NUM_TEMP_BANDS];
\r
166 int8 rxlev_PCS_temp_comp[ NUM_TEMP_BANDS];
\r
167 int8 rxlev_GSM850_temp_comp[ NUM_TEMP_BANDS];
\r
169 /****** PA ramp compensation for battery voltage variation. *******/
\r
170 int8 pa_GSM_vcc_comp_threshold; // If the voltage is below the threshold, pa compensation is needed. Battery measure ADC value.
\r
171 int8 pa_GSM_vcc_comp_step; // The PA ramp level need to be changed per threshold.
\r
172 int8 pa_DCS_vcc_comp_threshold; // If the voltage is below the threshold, pa compensation is needed.
\r
173 int8 pa_DCS_vcc_comp_step; // The PA ramp level need to be changed per threshold.
\r
174 int8 pa_PCS_vcc_comp_threshold; // If the voltage is below the threshold, pa compensation is needed.
\r
175 int8 pa_PCS_vcc_comp_step; // The PA ramp level need to be changed per threshold.
\r
176 int8 pa_GSM850_vcc_comp_threshold; // If the voltage is below the threshold, pa compensation is needed. Battery measure ADC value.
\r
177 int8 pa_GSM850_vcc_comp_step; // The PA ramp level need to be changed per threshold.
\r
179 } RF_param_MCU_use_T;
\r
183 /**************** Battery monitor *********************/
\r
184 // Battery measurement calibration.
\r
185 // Due to the unprecise of the divider resistor value for measure the battery voltage, the voltage
\r
186 // value measured may be not accurate enough for battery charging.
\r
187 uint32 batt_mV_per_4bits; // The actual voltage for 4bits ADC output.
\r
189 /******************* 32K/13M calibration. ***************/
\r
190 /**** the ratio of 32k and 13Mhz needs to be calibrated running ***/
\r
191 /*** for deep sleep mode ****/
\r
193 uint16 clock_32k_cal_interval; // How often the calibration shall be invoked.
\r
194 uint16 clock_32k_cal_duration; // How long the calibration shall be done.
\r
195 }Misc_cal_MCU_use_T;
\r
199 uint32 adc[2]; // calibration of ADC, two test point
\r
200 uint32 battery[2]; // calibraton of battery(include resistance), two test point
\r
201 uint32 reserved[8]; // reserved for feature use.
\r
206 uint16 calibration_param_version;
\r
207 RF_param_DSP_use_T rf_param_dsp_use;
\r
208 RF_param_MCU_use_T rf_param_mcu_use;
\r
209 Misc_cal_MCU_use_T misc_cal_mcu_use;
\r
210 int16 mic_gain; // In DB
\r
211 int16 auxi_mic_gain; // In DB
\r
212 uint16 PM_version; // the version of phone module
\r
214 // Following Added by Lin.liu. (2003-08-29), CR: MS4474
\r
215 uint16 software_version; // Software version of Tools
\r
216 uint16 station_num;
\r
217 uint8 operate_code[ 16 ];
\r
221 ADC_T adc; // Added By Lin.liu, for ADC calibration
\r
222 // End Lin.liu Added.
\r
224 }calibration_param_T;
\r
225 //}calibration_struct_va_T;
\r
227 #define OFFSET (sizeof(RF_ramp_table_T) + sizeof(RF_aero2_AFC_T) + sizeof(RF_aero1_AFC_T) + sizeof(RF_param_common_DSP_use_T) + sizeof(RF_param_band_DSP_use_T) + sizeof(RF_param_DSP_use_T) + sizeof(RF_param_MCU_use_T) + sizeof(Misc_cal_MCU_use_T))
\r
230 ////////////////////////////////////////////////////////////////////////////////
\r
231 // For TD Calibration
\r
232 //struct td_calibration_struct_v3
\r
235 #define AGC_GAIN_LEN_QS3200 1495
\r
236 #define AGC_CTL_LEN_QS3200 115
\r
237 #define APC_CTL_LEN_QS3200 1300
\r
238 #define AGC_COMP_LEN_QS3200 61
\r
239 #define APC_COMP_LEN_QS3200 613
\r
243 uint16 cali_version;
\r
244 uint16 antenna_switch_pin_control;
\r
245 uint16 Antenna_switch_truth_table[8];
\r
247 uint16 rf_afc_slope;
\r
248 uint16 agc_ctl_word[AGC_CTL_LEN_QS3200];
\r
249 uint16 agc_gain_word[AGC_GAIN_LEN_QS3200]; // 115*3+115+115*8+115
\r
250 uint16 AGC_compensation[AGC_COMP_LEN_QS3200];// 1+30*2
\r
251 uint16 tdpa_pin_control;
\r
252 uint16 TDPA_APC_control_word_index[APC_CTL_LEN_QS3200]; // 100*4+100*9
\r
253 uint16 APC_compensation[APC_COMP_LEN_QS3200]; // 30 + 30 + 60 + 60 + 30 + 1 + (4*13+20)*2 + 1 + 1 + 256
\r
254 uint16 rf_register_num;
\r
255 uint32 rf_Register_Initial[50];
\r
256 uint32 rf_action_tbl[281];
\r
257 uint8 reserved[500];
\r
259 }td_calibration_T_v3; //TD_QS3200_CALI_DATA;
\r
263 //struct td_calibration_struct_v4
\r
266 #define AGC_GAIN_LEN_QS3200 2875
\r
267 #define APC_CTL_LEN_QS3200 2500
\r
270 uint16 cali_version;
\r
272 uint16 rf_afc_slope;
\r
273 uint16 slope_length;
\r
276 uint16 agc_gain_word[AGC_GAIN_LEN_QS3200]; // 115*12 + 115*4 + 115*9
\r
277 uint16 TDPA_APC_control_word_index[APC_CTL_LEN_QS3200]; // 100*12 + 100*4 + 100*9
\r
278 }td_calibration_T_v4; //TD_QS3200_CALI_DATA; 8800G
\r
282 //////////////////////////////////////////////////////////////////////////
\r
284 //struct lte_calibration_struct_v1
\r
286 /* LTE_NV_TYPE_ANTENNA_SWITCH
\r
287 typedef struct _LTE_NV_CALI_ANTENNA_SWITCH
\r
289 uint16 band38_main_switch;
\r
290 uint16 band38_div_switch;
\r
291 uint16 band40_main_switch;
\r
292 uint16 band40_div_switch;
\r
293 uint16 switch_pin_control;
\r
294 uint16 apc_pa_pin_word;
\r
295 }LTE_NV_CALI_ANTENNA_SWITCH;*/
\r
297 /* LTE_NV_TYPE_DEFAULT_REGISTER
\r
298 typedef struct _LTE_NV_CALI_DEFAULT_REGISTER
\r
300 uint16 default_reg_number;
\r
301 uint16 default_reg_array[50];
\r
302 }LTE_NV_CALI_DEFAULT_REGISTER;*/
\r
304 /* LTE_NV_TYPE_FAST_PLLLOCK */
\r
305 typedef struct _LTE_NV_CALI_FAST_PLLLOCK
\r
307 uint16 plllock_array[64];
\r
308 }LTE_NV_CALI_FAST_PLLLOCK;
\r
310 /* LTE_NV_TYPE_AGC_CONTROL_WORD
\r
311 typedef struct _LTE_NV_CALI_AGC_CONTROL_WORD
\r
313 uint16 agc_control_array[124];
\r
314 }LTE_NV_CALI_AGC_CONTROL_WORD;*/
\r
316 /* LTE_NV_TYPE_AGC_GAIN_MAIN */
\r
317 typedef struct _LTE_NV_CALI_AGC_GAIN_MAIN
\r
319 uint16 agc_gain_main_24G_center_array[124];
\r
320 uint16 agc_gain_main_24G_channel_array[21+20];
\r
321 uint16 agc_gain_main_26G_center_array[124];
\r
322 uint16 agc_gain_main_26G_channel_array[11+20];
\r
323 }LTE_NV_CALI_AGC_GAIN_MAIN;
\r
325 /* LTE_NV_TYPE_AGC_DIV_MAIN */
\r
326 typedef struct _LTE_NV_CALI_AGC_GAIN_DIV
\r
328 uint16 agc_gain_div_24G_center_array[124];
\r
329 uint16 agc_gain_div_24G_channel_array[21+20];
\r
330 uint16 agc_gain_div_26G_center_array[124];
\r
331 uint16 agc_gain_div_26G_channel_array[11+20];
\r
332 }LTE_NV_CALI_AGC_GAIN_DIV;
\r
334 /* LTE_NV_TYPE_AFC_CONTROL */
\r
335 typedef struct _LTE_NV_CALI_AFC_CONTROL
\r
339 }LTE_NV_CALI_AFC_CONTROL;
\r
341 /* LTE_NV_TYPE_APC_TX_FIR_POWER
\r
342 typedef struct _LTE_NV_CALI_APC_TX_FIR_POWER
\r
344 uint16 apc_tx_fir_power_array[256];
\r
345 }LTE_NV_CALI_APC_TX_FIR_POWER;*/
\r
347 /* LTE_NV_TYPE_APC_CONTROL_WORD_MAIN */
\r
348 typedef struct _LTE_NV_CALI_APC_CONTROL_WORD_MAIN
\r
350 uint16 apc_control_main_24G_array[22][80]; //[channel][...]
\r
351 uint16 apc_control_main_26G_array[12][80]; //[channel][...]
\r
352 }LTE_NV_CALI_APC_CONTROL_WORD_MAIN;
\r
354 /* LTE_NV_TYPE_APC_CONTROL_WORD_DIV */
\r
355 typedef struct _LTE_NV_CALI_APC_CONTROL_WORD_DIV
\r
357 uint16 apc_control_div_24G_array[22][80]; //[channel][...]
\r
358 uint16 apc_control_div_26G_array[12][80]; //[channel][...]
\r
359 }LTE_NV_CALI_APC_CONTROL_WORD_DIV;
\r
361 typedef struct _LTE_NV_CALI_PARAM_T
\r
363 uint16 CALI_PARAM_VERSION;
\r
364 uint16 CALI_PARAM_FLAG;
\r
366 LTE_NV_CALI_FAST_PLLLOCK FAST_PLLLOCK;
\r
367 LTE_NV_CALI_AGC_GAIN_MAIN AGC_GAIN_MAIN;
\r
368 LTE_NV_CALI_AGC_GAIN_DIV AGC_GAIN_DIV;
\r
369 LTE_NV_CALI_AFC_CONTROL AFC_CONTROL;
\r
370 LTE_NV_CALI_APC_CONTROL_WORD_MAIN APC_CONTROL_WORD_MAIN;
\r
371 LTE_NV_CALI_APC_CONTROL_WORD_DIV APC_CONTROL_WORD_DIV;
\r
372 }LTE_NV_CALI_PARAM_T;
\r
375 typedef struct _LTE_NV_DOWNLOAD_PARAM_T
\r
377 uint16 DOWNLOAD_PARAM_VERSION;
\r
378 LTE_NV_CALI_ANTENNA_SWITCH ANTENNA_SWITCH;
\r
379 LTE_NV_CALI_DEFAULT_REGISTER DEFAULT_REGISTER;
\r
380 LTE_NV_CALI_AGC_CONTROL_WORD AGC_CONTROL_WORD;
\r
381 LTE_NV_CALI_APC_TX_FIR_POWER APC_TX_FIR_POWER;
\r
382 }LTE_NV_DOWNLOAD_PARAM_T;*/
\r
386 //////////////////////////////////////////////////////////////////////////
\r
389 #define NV_MAX_LANG_NUM (100)
\r
390 #define NV_LANG_SUPPORT_BIT (0x1)
\r
391 #define NV_LANG_DISABLE_BIT (0x2)
\r
392 #define NV_LANG_ENABLE_BIT (0x4)
\r
393 #define NV_LANG_DEFAULT_BIT (0x8)
\r
395 #define IS_LANG_SUPPORT(f) ((f) & (BYTE)NV_LANG_SUPPORT_BIT)
\r
396 #define IS_LANG_CAN_DISABLE(f) ((f) & (BYTE)NV_LANG_DISABLE_BIT)
\r
397 #define IS_LANG_ENABLE(f) ((f) & (BYTE)NV_LANG_ENABLE_BIT)
\r
398 #define IS_LANG_DEFAULT(f) ((f) & (BYTE)NV_LANG_DEFAULT_BIT)
\r
399 #define MAKE_LANG_ENABLE(f) ((f) | (BYTE)NV_LANG_ENABLE_BIT)
\r
400 #define MAKE_LANG_DISABLE(f) ((f) & (~((BYTE)NV_LANG_ENABLE_BIT)))
\r
401 #define MAKE_LANG_DEFAULT(f) ((f) | (BYTE)NV_LANG_DEFAULT_BIT)
\r
402 #define MAKE_LANG_NOTDEFAULT(f) ((f) & (~((BYTE)NV_LANG_DEFAULT_BIT)))
\r
404 typedef struct _NV_MULTI_LANGUE_CFG
\r
406 uint8 flag[NV_MAX_LANG_NUM];
\r
407 uint8 reserved[12];
\r
408 }NV_MULTI_LANGUE_CFG;
\r
412 #endif // _CALIBRATION_STRUCT_H__
\r