diff chipsetsw/layer1/cfile/l1_ctl.c @ 87:33c16c173666

l1_ctl.c: l1ctl_csgc() reconstructed
author Mychaela Falconia <falcon@ivan.Harhan.ORG>
date Thu, 07 Apr 2016 02:25:26 +0000
parents b30f037829cf
children 4a2ba7076906
line wrap: on
line diff
--- a/chipsetsw/layer1/cfile/l1_ctl.c	Thu Apr 07 01:03:38 2016 +0000
+++ b/chipsetsw/layer1/cfile/l1_ctl.c	Thu Apr 07 02:25:26 2016 +0000
@@ -1916,16 +1916,18 @@
 /*-------------------------------------------------------*/
 UWORD8 l1ctl_csgc(UWORD8 pm, UWORD16 radio_freq)
 {
-   WORD16   current_IL, current_calibrated_IL =0;  //omaps00090550
+   WORD16   current_IL, current_calibrated_IL;
    WORD8    delta1_freq, delta2_freq;
    WORD16   delta_drp_gain=0;
    UWORD32  index;
    UWORD16  g_magic;
-   UWORD16  arfcn;
+   #if (RF_FAM == 61) && (L1_FF_MULTIBAND == 0)
+     UWORD16  arfcn;
+   #endif 
    UWORD16 dco_algo_ctl_pw_temp = 0;
    UWORD8 if_ctl = 0;
    #if (RF_RAM == 61) && (CODE_VERSION != SIMULATION)
-   UWORD8 if_threshold = C_IF_ZERO_LOW_THRESHOLD_GSM;
+     UWORD8 if_threshold = C_IF_ZERO_LOW_THRESHOLD_GSM;
    #endif
 
 #if (L1_FF_MULTIBAND == 0)
@@ -1944,7 +1946,8 @@
    delta2_freq = l1ctl_encode_delta2(radio_freq);
 
    g_magic = l1ctl_get_g_magic(radio_freq);
-#if (L1_FF_MULTIBAND == 0)
+
+#if (RF_FAM == 61) && (L1_FF_MULTIBAND == 0)
    arfcn = Convert_l1_radio_freq(radio_freq);
 #endif 
 
@@ -1956,7 +1959,7 @@
 #if(RF_FAM == 61)
    #if (CODE_VERSION != SIMULATION)
 
-#if (PWMEAS_IF_MODE_FORCE == 0)
+     #if (PWMEAS_IF_MODE_FORCE == 0)
        cust_get_if_dco_ctl_algo(&dco_algo_ctl_pw_temp, &if_ctl, (UWORD8) L1_IL_INVALID ,
            0,
            radio_freq,if_threshold);
@@ -1965,11 +1968,11 @@
        dco_algo_ctl_pw_temp = DCO_IF_0KHZ;
      #endif
 
-#if (L1_FF_MULTIBAND == 0)
-	 delta_drp_gain = drp_gain_correction(arfcn, LNA_ON, (l1_config.params.high_agc << 1));    // F7.1 format
-#else
-     delta_drp_gain = drp_gain_correction(radio_freq, LNA_ON, (l1_config.params.high_agc << 1));    // F7.1 format
-#endif // MULTIBAND == 0 else
+     #if (L1_FF_MULTIBAND == 0)
+       delta_drp_gain = drp_gain_correction(arfcn, LNA_ON, (l1_config.params.high_agc << 1));    // F7.1 format
+     #else
+       delta_drp_gain = drp_gain_correction(radio_freq, LNA_ON, (l1_config.params.high_agc << 1));    // F7.1 format
+     #endif // MULTIBAND == 0 else
 
      if(if_ctl == IF_100KHZ_DSP){
        delta_drp_gain += SCF_ATTENUATION_LIF_100KHZ;
@@ -2034,7 +2037,10 @@
                         &(l1a_l1s_com.last_input_level[index].lna_off),
                         radio_freq);
 
-       l1a_l1s_com.last_input_level[index].input_level = (UWORD8)current_IL;
+       l1a_l1s_com.last_input_level[index].input_level = (UWORD8)current_IL +
+	 l1ctl_get_lna_att(radio_freq) *
+	   l1a_l1s_com.last_input_level[index].lna_off;
+
        l1a_l1s_com.full_list.sat_flag[l1a_l1s_com.full_list.next_to_read] = 0;
      }
    }
@@ -2046,11 +2052,11 @@
        #if (CODE_VERSION != SIMULATION)
         cust_get_if_dco_ctl_algo(&dco_algo_ctl_pw_temp, &if_ctl, (UWORD8) L1_IL_INVALID,
             0,radio_freq,if_threshold);
-#if (L1_FF_MULTIBAND == 0)       
-         delta_drp_gain = drp_gain_correction(arfcn, LNA_ON, (l1_config.params.low_agc << 1));    // F7.1 format
-#else
-        delta_drp_gain = drp_gain_correction(radio_freq, LNA_ON, (l1_config.params.low_agc << 1));    // F7.1 format
-#endif 
+        #if (L1_FF_MULTIBAND == 0)       
+          delta_drp_gain = drp_gain_correction(arfcn, LNA_ON, (l1_config.params.low_agc << 1));    // F7.1 format
+        #else
+          delta_drp_gain = drp_gain_correction(radio_freq, LNA_ON, (l1_config.params.low_agc << 1));    // F7.1 format
+        #endif 
         if(if_ctl == IF_100KHZ_DSP){
           delta_drp_gain += SCF_ATTENUATION_LIF_100KHZ;
         }
@@ -2078,7 +2084,9 @@
                       &(l1a_l1s_com.last_input_level[index].lna_off),
                       radio_freq);
 
-     l1a_l1s_com.last_input_level[index].input_level = (UWORD8)current_IL;
+     l1a_l1s_com.last_input_level[index].input_level = (UWORD8)current_IL +
+	l1ctl_get_lna_att(radio_freq) *
+	  l1a_l1s_com.last_input_level[index].lna_off;
 
      l1a_l1s_com.full_list.sat_flag[l1a_l1s_com.full_list.next_to_read] = 0;
    }