changeset 313:0388ecc384d6

l1p_ctl.c: l1pctl_npc_agc_read() reconstructed
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 03 Oct 2017 08:11:02 +0000
parents 701fb3242432
children e520acd157e2
files chipsetsw/layer1/p_cfile/l1p_ctl.c
diffstat 1 files changed, 22 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/chipsetsw/layer1/p_cfile/l1p_ctl.c	Tue Oct 03 06:38:07 2017 +0000
+++ b/chipsetsw/layer1/p_cfile/l1p_ctl.c	Tue Oct 03 08:11:02 2017 +0000
@@ -689,9 +689,11 @@
       if (0==pm)  // Check and filter illegal pm value by using last valid IL
       {
         if (radio_freq == l1a_l1s_com.Scell_info.radio_freq)
-          current_IL = l1a_l1s_com.last_input_level[serving_index].input_level;
+          current_IL = l1a_l1s_com.last_input_level[serving_index].input_level
+                       - lna_value;
         else
-          current_IL = l1a_l1s_com.Scell_info.transfer_meas.input_level;
+          current_IL = l1a_l1s_com.Scell_info.transfer_meas.input_level
+                       - lna_value;
       }
       else
       {
@@ -810,7 +812,9 @@
                        &(l1a_l1s_com.last_input_level[serving_index].lna_off),
                        l1a_l1s_com.Scell_info.radio_freq);
 
-      l1a_l1s_com.last_input_level[serving_index].input_level = new_IL ;
+      l1a_l1s_com.last_input_level[serving_index].input_level = new_IL +
+        l1a_l1s_com.last_input_level[serving_index].lna_off *
+          l1ctl_get_lna_att(l1a_l1s_com.Scell_info.radio_freq);
 
     } // End of "beacon frequency input level updating"
 
@@ -832,7 +836,9 @@
     // No block was correctly received
     else
     {
-      UWORD8 input_level_ref = l1a_l1s_com.Scell_info.transfer_meas.input_level;
+      UWORD8 input_level_ref = l1a_l1s_com.Scell_info.transfer_meas.input_level
+        - l1a_l1s_com.Scell_info.transfer_meas.lna_off *
+          l1ctl_get_lna_att(radio_freq);
       // SEARCH phase
       if (l1ps.phase == SEARCH)
       {
@@ -881,8 +887,11 @@
             WORD16 input_level;
 
             // IL initialized to "beacon level - Pb"
-            input_level = (WORD16) (l1a_l1s_com.last_input_level[serving_index].input_level + l1a_l1s_com.Scell_info.pb);
-                                   
+            input_level = (WORD16)
+              ((l1a_l1s_com.last_input_level[serving_index].input_level +
+                l1a_l1s_com.Scell_info.pb) -
+               (l1a_l1s_com.last_input_level[serving_index].lna_off *
+                l1ctl_get_lna_att(l1a_l1s_com.Scell_info.radio_freq)));
 
             if (input_level>INDEX_MAX) input_level = INDEX_MAX;    
             l1a_l1s_com.Scell_info.transfer_meas.input_level = (UWORD8)input_level;
@@ -895,7 +904,9 @@
           {
             WORD16 input_level;
 
-            input_level = l1a_l1s_com.Scell_info.transfer_meas.input_level;
+            input_level = l1a_l1s_com.Scell_info.transfer_meas.input_level -
+              l1a_l1s_com.Scell_info.transfer_meas.lna_off *
+                l1ctl_get_lna_att(l1ps.read_param.radio_freq_for_lna);
 
             if (input_level>INDEX_MAX) input_level = INDEX_MAX;
 
@@ -910,6 +921,10 @@
     if (new_calibrated_IL>INDEX_MAX) new_calibrated_IL = INDEX_MAX;
 
     l1ctl_encode_lna((UWORD8)(new_calibrated_IL>>1), &(l1a_l1s_com.Scell_info.transfer_meas.lna_off), l1ps.read_param.radio_freq_for_lna);
+
+    l1a_l1s_com.Scell_info.transfer_meas.input_level +=
+      l1a_l1s_com.Scell_info.transfer_meas.lna_off *
+        l1ctl_get_lna_att(l1ps.read_param.radio_freq_for_lna);
   } // End if "burst = 3"
 
 } // End of "l1pctl_npc_agc_read"