comparison 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
comparison
equal deleted inserted replaced
86:b30f037829cf 87:33c16c173666
1914 /* LOW_AGC agc setting, then store, for the considered */ 1914 /* LOW_AGC agc setting, then store, for the considered */
1915 /* carrier, the input level. */ 1915 /* carrier, the input level. */
1916 /*-------------------------------------------------------*/ 1916 /*-------------------------------------------------------*/
1917 UWORD8 l1ctl_csgc(UWORD8 pm, UWORD16 radio_freq) 1917 UWORD8 l1ctl_csgc(UWORD8 pm, UWORD16 radio_freq)
1918 { 1918 {
1919 WORD16 current_IL, current_calibrated_IL =0; //omaps00090550 1919 WORD16 current_IL, current_calibrated_IL;
1920 WORD8 delta1_freq, delta2_freq; 1920 WORD8 delta1_freq, delta2_freq;
1921 WORD16 delta_drp_gain=0; 1921 WORD16 delta_drp_gain=0;
1922 UWORD32 index; 1922 UWORD32 index;
1923 UWORD16 g_magic; 1923 UWORD16 g_magic;
1924 UWORD16 arfcn; 1924 #if (RF_FAM == 61) && (L1_FF_MULTIBAND == 0)
1925 UWORD16 arfcn;
1926 #endif
1925 UWORD16 dco_algo_ctl_pw_temp = 0; 1927 UWORD16 dco_algo_ctl_pw_temp = 0;
1926 UWORD8 if_ctl = 0; 1928 UWORD8 if_ctl = 0;
1927 #if (RF_RAM == 61) && (CODE_VERSION != SIMULATION) 1929 #if (RF_RAM == 61) && (CODE_VERSION != SIMULATION)
1928 UWORD8 if_threshold = C_IF_ZERO_LOW_THRESHOLD_GSM; 1930 UWORD8 if_threshold = C_IF_ZERO_LOW_THRESHOLD_GSM;
1929 #endif 1931 #endif
1930 1932
1931 #if (L1_FF_MULTIBAND == 0) 1933 #if (L1_FF_MULTIBAND == 0)
1932 1934
1933 // initialize index 1935 // initialize index
1942 1944
1943 delta1_freq = l1ctl_encode_delta1(radio_freq); 1945 delta1_freq = l1ctl_encode_delta1(radio_freq);
1944 delta2_freq = l1ctl_encode_delta2(radio_freq); 1946 delta2_freq = l1ctl_encode_delta2(radio_freq);
1945 1947
1946 g_magic = l1ctl_get_g_magic(radio_freq); 1948 g_magic = l1ctl_get_g_magic(radio_freq);
1947 #if (L1_FF_MULTIBAND == 0) 1949
1950 #if (RF_FAM == 61) && (L1_FF_MULTIBAND == 0)
1948 arfcn = Convert_l1_radio_freq(radio_freq); 1951 arfcn = Convert_l1_radio_freq(radio_freq);
1949 #endif 1952 #endif
1950 1953
1951 if (l1a_l1s_com.full_list.meas_1st_pass_read) 1954 if (l1a_l1s_com.full_list.meas_1st_pass_read)
1952 { 1955 {
1954 // with measurement achieved with HIGH_AGC setting. We are working 1957 // with measurement achieved with HIGH_AGC setting. We are working
1955 // with non calibrated IL to avoid saturation 1958 // with non calibrated IL to avoid saturation
1956 #if(RF_FAM == 61) 1959 #if(RF_FAM == 61)
1957 #if (CODE_VERSION != SIMULATION) 1960 #if (CODE_VERSION != SIMULATION)
1958 1961
1959 #if (PWMEAS_IF_MODE_FORCE == 0) 1962 #if (PWMEAS_IF_MODE_FORCE == 0)
1960 cust_get_if_dco_ctl_algo(&dco_algo_ctl_pw_temp, &if_ctl, (UWORD8) L1_IL_INVALID , 1963 cust_get_if_dco_ctl_algo(&dco_algo_ctl_pw_temp, &if_ctl, (UWORD8) L1_IL_INVALID ,
1961 0, 1964 0,
1962 radio_freq,if_threshold); 1965 radio_freq,if_threshold);
1963 #else 1966 #else
1964 if_ctl = IF_120KHZ_DSP; 1967 if_ctl = IF_120KHZ_DSP;
1965 dco_algo_ctl_pw_temp = DCO_IF_0KHZ; 1968 dco_algo_ctl_pw_temp = DCO_IF_0KHZ;
1966 #endif 1969 #endif
1967 1970
1968 #if (L1_FF_MULTIBAND == 0) 1971 #if (L1_FF_MULTIBAND == 0)
1969 delta_drp_gain = drp_gain_correction(arfcn, LNA_ON, (l1_config.params.high_agc << 1)); // F7.1 format 1972 delta_drp_gain = drp_gain_correction(arfcn, LNA_ON, (l1_config.params.high_agc << 1)); // F7.1 format
1970 #else 1973 #else
1971 delta_drp_gain = drp_gain_correction(radio_freq, LNA_ON, (l1_config.params.high_agc << 1)); // F7.1 format 1974 delta_drp_gain = drp_gain_correction(radio_freq, LNA_ON, (l1_config.params.high_agc << 1)); // F7.1 format
1972 #endif // MULTIBAND == 0 else 1975 #endif // MULTIBAND == 0 else
1973 1976
1974 if(if_ctl == IF_100KHZ_DSP){ 1977 if(if_ctl == IF_100KHZ_DSP){
1975 delta_drp_gain += SCF_ATTENUATION_LIF_100KHZ; 1978 delta_drp_gain += SCF_ATTENUATION_LIF_100KHZ;
1976 } 1979 }
1977 else{ /* i.e. if_ctl = IF_120KHZ_DSP*/ 1980 else{ /* i.e. if_ctl = IF_120KHZ_DSP*/
2032 // we validate the measure and save input_level and lna_off fields. 2035 // we validate the measure and save input_level and lna_off fields.
2033 l1ctl_encode_lna((UWORD8)(current_calibrated_IL>>1), 2036 l1ctl_encode_lna((UWORD8)(current_calibrated_IL>>1),
2034 &(l1a_l1s_com.last_input_level[index].lna_off), 2037 &(l1a_l1s_com.last_input_level[index].lna_off),
2035 radio_freq); 2038 radio_freq);
2036 2039
2037 l1a_l1s_com.last_input_level[index].input_level = (UWORD8)current_IL; 2040 l1a_l1s_com.last_input_level[index].input_level = (UWORD8)current_IL +
2041 l1ctl_get_lna_att(radio_freq) *
2042 l1a_l1s_com.last_input_level[index].lna_off;
2043
2038 l1a_l1s_com.full_list.sat_flag[l1a_l1s_com.full_list.next_to_read] = 0; 2044 l1a_l1s_com.full_list.sat_flag[l1a_l1s_com.full_list.next_to_read] = 0;
2039 } 2045 }
2040 } 2046 }
2041 else // 2nd pass if any. 2047 else // 2nd pass if any.
2042 { 2048 {
2044 // fields. 2050 // fields.
2045 #if(RF_FAM == 61) 2051 #if(RF_FAM == 61)
2046 #if (CODE_VERSION != SIMULATION) 2052 #if (CODE_VERSION != SIMULATION)
2047 cust_get_if_dco_ctl_algo(&dco_algo_ctl_pw_temp, &if_ctl, (UWORD8) L1_IL_INVALID, 2053 cust_get_if_dco_ctl_algo(&dco_algo_ctl_pw_temp, &if_ctl, (UWORD8) L1_IL_INVALID,
2048 0,radio_freq,if_threshold); 2054 0,radio_freq,if_threshold);
2049 #if (L1_FF_MULTIBAND == 0) 2055 #if (L1_FF_MULTIBAND == 0)
2050 delta_drp_gain = drp_gain_correction(arfcn, LNA_ON, (l1_config.params.low_agc << 1)); // F7.1 format 2056 delta_drp_gain = drp_gain_correction(arfcn, LNA_ON, (l1_config.params.low_agc << 1)); // F7.1 format
2051 #else 2057 #else
2052 delta_drp_gain = drp_gain_correction(radio_freq, LNA_ON, (l1_config.params.low_agc << 1)); // F7.1 format 2058 delta_drp_gain = drp_gain_correction(radio_freq, LNA_ON, (l1_config.params.low_agc << 1)); // F7.1 format
2053 #endif 2059 #endif
2054 if(if_ctl == IF_100KHZ_DSP){ 2060 if(if_ctl == IF_100KHZ_DSP){
2055 delta_drp_gain += SCF_ATTENUATION_LIF_100KHZ; 2061 delta_drp_gain += SCF_ATTENUATION_LIF_100KHZ;
2056 } 2062 }
2057 else{ /* i.e. if_ctl = IF_120KHZ_DSP*/ 2063 else{ /* i.e. if_ctl = IF_120KHZ_DSP*/
2058 delta_drp_gain += SCF_ATTENUATION_LIF_120KHZ; 2064 delta_drp_gain += SCF_ATTENUATION_LIF_120KHZ;
2076 2082
2077 l1ctl_encode_lna((UWORD8)(current_calibrated_IL>>1), 2083 l1ctl_encode_lna((UWORD8)(current_calibrated_IL>>1),
2078 &(l1a_l1s_com.last_input_level[index].lna_off), 2084 &(l1a_l1s_com.last_input_level[index].lna_off),
2079 radio_freq); 2085 radio_freq);
2080 2086
2081 l1a_l1s_com.last_input_level[index].input_level = (UWORD8)current_IL; 2087 l1a_l1s_com.last_input_level[index].input_level = (UWORD8)current_IL +
2088 l1ctl_get_lna_att(radio_freq) *
2089 l1a_l1s_com.last_input_level[index].lna_off;
2082 2090
2083 l1a_l1s_com.full_list.sat_flag[l1a_l1s_com.full_list.next_to_read] = 0; 2091 l1a_l1s_com.full_list.sat_flag[l1a_l1s_com.full_list.next_to_read] = 0;
2084 } 2092 }
2085 2093
2086 return((UWORD8)current_calibrated_IL); 2094 return((UWORD8)current_calibrated_IL);