comparison chipsetsw/layer1/cfile/l1_ctl.c @ 90:1bcd93a7c518

l1_ctl.c: l1ctl_pagc() reconstructed
author Mychaela Falconia <falcon@ivan.Harhan.ORG>
date Thu, 07 Apr 2016 03:16:52 +0000
parents 2a56451df569
children 51f3b9364365
comparison
equal deleted inserted replaced
89:2a56451df569 90:1bcd93a7c518
2403 WORD32 last_known_agc; 2403 WORD32 last_known_agc;
2404 UWORD8 IL_max; 2404 UWORD8 IL_max;
2405 WORD32 current_IL, current_calibrated_IL; 2405 WORD32 current_IL, current_calibrated_IL;
2406 UWORD8 i; 2406 UWORD8 i;
2407 WORD32 lna_value; 2407 WORD32 lna_value;
2408 UWORD16 arfcn; 2408 #if (RF_RAM == 61) && (CODE_VERSION != SIMULATION)
2409 UWORD16 arfcn;
2410 #endif
2409 UWORD8 lna_off; 2411 UWORD8 lna_off;
2410 UWORD16 dco_algo_ctl_pw_temp = 0; 2412 UWORD16 dco_algo_ctl_pw_temp = 0;
2411 UWORD8 if_ctl = 0; 2413 UWORD8 if_ctl = 0;
2412 #if (RF_RAM == 61) && (CODE_VERSION != SIMULATION) 2414 #if (RF_RAM == 61) && (CODE_VERSION != SIMULATION)
2413 UWORD8 if_threshold = C_IF_ZERO_LOW_THRESHOLD_GSM; 2415 UWORD8 if_threshold = C_IF_ZERO_LOW_THRESHOLD_GSM;
2414 #endif 2416 #endif
2415 2417
2416 delta1_freq = l1ctl_encode_delta1(radio_freq); 2418 delta1_freq = l1ctl_encode_delta1(radio_freq);
2417 delta2_freq = l1ctl_encode_delta2(radio_freq); 2419 delta2_freq = l1ctl_encode_delta2(radio_freq);
2418 2420
2431 // with pm and IL formats 2433 // with pm and IL formats
2432 // contain the input_level value we use 2434 // contain the input_level value we use
2433 // in the associated CTL task to build 2435 // in the associated CTL task to build
2434 // the agc used in this CTL. 2436 // the agc used in this CTL.
2435 2437
2436 #if (L1_FF_MULTIBAND == 0) 2438 #if (RF_RAM == 61) && (CODE_VERSION != SIMULATION)
2439 #if (L1_FF_MULTIBAND == 0)
2437 arfcn = Convert_l1_radio_freq(radio_freq); 2440 arfcn = Convert_l1_radio_freq(radio_freq);
2438 #else 2441 #else
2439 arfcn=radio_freq; 2442 arfcn = radio_freq;
2440 #endif 2443 #endif
2444 #endif
2441 2445
2442 #if(RF_FAM == 61) 2446 #if(RF_FAM == 61)
2443 #if (CODE_VERSION != SIMULATION) 2447 #if (CODE_VERSION != SIMULATION)
2444 2448
2445 cust_get_if_dco_ctl_algo(&dco_algo_ctl_pw_temp, &if_ctl, (UWORD8) L1_IL_VALID , 2449 cust_get_if_dco_ctl_algo(&dco_algo_ctl_pw_temp, &if_ctl, (UWORD8) L1_IL_VALID ,
2456 2460
2457 #endif 2461 #endif
2458 #endif 2462 #endif
2459 2463
2460 if (0==pm) // Check and filter illegal pm value by using last valid IL 2464 if (0==pm) // Check and filter illegal pm value by using last valid IL
2461 current_IL = IL_info_ptr->input_level; 2465 current_IL = IL_info_ptr->input_level - lna_value;
2462 else 2466 else
2463 current_IL = -(pm - (last_known_agc - delta_drp_gain) + lna_value - l1ctl_get_g_magic(radio_freq)); 2467 current_IL = -(pm - (last_known_agc - delta_drp_gain) + lna_value - l1ctl_get_g_magic(radio_freq));
2464 2468
2465 current_calibrated_IL = current_IL - delta1_freq - delta2_freq; 2469 current_calibrated_IL = current_IL - delta1_freq - delta2_freq;
2466 2470
2477 //input levels are always stored with lna_on 2481 //input levels are always stored with lna_on
2478 l1ctl_encode_lna( (UWORD8)(current_calibrated_IL>>1), 2482 l1ctl_encode_lna( (UWORD8)(current_calibrated_IL>>1),
2479 &(IL_info_ptr->lna_off), 2483 &(IL_info_ptr->lna_off),
2480 radio_freq ); 2484 radio_freq );
2481 2485
2482 IL_info_ptr->input_level = IL_max; 2486 IL_info_ptr->input_level = IL_max + l1ctl_get_lna_att(radio_freq) *
2487 IL_info_ptr->lna_off;
2483 2488
2484 #if L2_L3_SIMUL 2489 #if L2_L3_SIMUL
2485 #if (DEBUG_TRACE==BUFFER_TRACE_PAGC) 2490 #if (DEBUG_TRACE==BUFFER_TRACE_PAGC)
2486 buffer_trace(4,IL_info_ptr->input_level,last_known_agc, 2491 buffer_trace(4,IL_info_ptr->input_level,last_known_agc,
2487 l1a_l1s_com.Scell_used_IL_dd.input_level,Cust_get_agc_from_IL(radio_freq, IL_max >> 1, MAX_ID)); 2492 l1a_l1s_com.Scell_used_IL_dd.input_level,Cust_get_agc_from_IL(radio_freq, IL_max >> 1, MAX_ID));