lte_estimation.h 10.9 KB
Newer Older
1 2 3 4 5
/*
 * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The OpenAirInterface Software Alliance licenses this file to You under
6
 * the OAI Public License, Version 1.1  (the "License"); you may not use this file
7 8 9 10 11 12 13 14 15 16 17 18 19 20
 * except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.openairinterface.org/?page_id=698
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *-------------------------------------------------------------------------------
 * For more information about the OpenAirInterface (OAI) Software Alliance:
 *      contact@openairinterface.org
 */
ghaddab's avatar
ghaddab committed
21

22 23 24
#ifndef __LTE_ESTIMATION_DEFS__H__
#define __LTE_ESTIMATION_DEFS__H__

25 26 27

#include "PHY/defs_UE.h"
#include "PHY/defs_eNB.h"
28
/** @addtogroup _PHY_PARAMETER_ESTIMATION_BLOCKS_
29 30
 * @{
 */
31 32

/*!\brief Timing drift hysterisis in samples*/
33
#define SYNCH_HYST 2
34

35 36 37 38 39
/*!
\brief This function is used for time-frequency scanning prior to complete cell search.  It scans
over the entire LTE band for maximum correlation and keeps the 10 best scores and the correspoding frequency offset (5 kHz granularity) for each of the 3 PSS sequences.
\param ue Pointer to UE variables
\param band index of lte band
40
\param DL_freq Central RF Frequency in Hz
41
*/
42 43 44
/*!
\brief This function allocates memory needed for the synchronization.
\param frame_parms LTE DL frame parameter structure
45

46
 */
47 48 49 50 51

int lte_sync_time_init(LTE_DL_FRAME_PARMS *frame_parms); //LTE_UE_COMMON *common_vars

/*! \fn void lte_sync_time_free()
\brief This function frees the memory allocated by lte_sync_time_init.
52
 */
53 54
void lte_sync_time_free(void);

55
/*!
56
\brief This function performs the coarse timing synchronization.
57
The algorithm uses a time domain correlation with a downsampled version of the received signal.
58 59 60 61
\param rxdata Received time domain data for all rx antennas
\param frame_parms LTE DL frame parameter structure
\param eNB_id return value with the eNb_id
\return sync_pos Position of the sync within the frame (downsampled) if successfull and -1 if there was an error or no peak was detected.
62
 */
63 64 65
int lte_sync_time(int **rxdata,
                  LTE_DL_FRAME_PARMS *frame_parms,
                  int *eNB_id);
66

67
/*!
68 69 70 71 72 73 74 75 76
\brief This function performs the coarse frequency and PSS synchronization.
The algorithm uses a frequency-domain correlation.  It scans over 20 MHz/10ms signal chunks using each of the 3 PSS finding the most likely (strongest) carriers and their frequency offset (+-2.5 kHz).
\param ue Pointer to UE data structure
\param band index of band in scan_info structure, used to store statistics
\param DL_freq center frequency of band being scanned, used when storing statistics
*/
void lte_sync_timefreq(PHY_VARS_UE *ue,int band,unsigned int DL_freq);


77
/*!
78
\brief This function performs detection of the PRACH (=SRS) at the eNb to estimate the timing advance
79
The algorithm uses a time domain correlation with a downsampled version of the received signal.
80 81 82
\param rxdata Received time domain data for all rx antennas
\param frame_parms LTE DL frame parameter structure
\param length Length for correlation
83
\param peak_val pointer to value of returned peak
84 85
\param sync_corr_eNb pointer to correlation buffer
\return sync_pos Position of the sync within the frame (downsampled) if successfull and -1 if there was an error or no peak was detected.
86 87
 */
int lte_sync_time_eNB(int32_t **rxdata,
88 89 90 91
                      LTE_DL_FRAME_PARMS *frame_parms,
                      uint32_t length,
                      uint32_t *peak_val,
                      uint32_t *sync_corr_eNb);
92 93

int lte_sync_time_eNB_emul(PHY_VARS_eNB *phy_vars_eNb,
94 95
                           uint8_t sect_id,
                           int32_t *sync_val);
96 97 98 99 100 101 102

/*!
\brief This function performs channel estimation including frequency and temporal interpolation
\param phy_vars_ue Pointer to UE PHY variables
\param eNB_id Index of target eNB
\param eNB_offset Offset for interfering eNB (in terms cell ID mod 3)
\param Ns slot number (0..19)
103
\param p antenna port
104 105 106 107
\param l symbol within slot
\param symbol symbol within frame
*/
int lte_dl_channel_estimation(PHY_VARS_UE *phy_vars_ue,
108 109 110 111 112 113
                              module_id_t eNB_id,
                              uint8_t eNB_offset,
                              uint8_t Ns,
                              uint8_t p,
                              uint8_t l,
                              uint8_t symbol);
114

115 116 117 118 119 120 121
int lte_dl_bf_channel_estimation(PHY_VARS_UE *phy_vars_ue,
                                 module_id_t eNB_id,
                                 uint8_t eNB_offset,
                                 uint8_t Ns,
                                 uint8_t p,
                                 uint8_t symbol);

122
int lte_dl_msbfn_channel_estimation(PHY_VARS_UE *phy_vars_ue,
123 124 125 126 127
                                    module_id_t eNB_id,
                                    uint8_t eNB_offset,
                                    int subframe,
                                    unsigned char l,
                                    unsigned char symbol);
128

129
int lte_dl_mbsfn_channel_estimation(PHY_VARS_UE *phy_vars_ue,
130 131 132 133
                                    module_id_t eNB_id,
                                    uint8_t eNB_offset,
                                    int subframe,
                                    unsigned char l);
134 135 136 137 138 139 140 141

/*!
\brief Frequency offset estimation for LTE
We estimate the frequency offset by calculating the phase difference between channel estimates for symbols carrying pilots (l==0 or l==3/4). We take a moving average of the phase difference.
\param dl_ch_estimates pointer to structure that holds channel estimates (one slot)
\param frame_parms pointer to LTE frame parameters
\param l symbol within slot
\param freq_offset pointer to the returned frequency offset
142
\param reset When non-zer it resets the filter to the initial value (set whenever tuning has been changed or for a one-shot estimate)
143
 */
144
int lte_est_freq_offset(int **dl_ch_estimates,
145 146
                        LTE_DL_FRAME_PARMS *frame_parms,
                        int l,
147
                        int* freq_offset,
148
            int reset);
149 150

int lte_mbsfn_est_freq_offset(int **dl_ch_estimates,
151 152 153
                              LTE_DL_FRAME_PARMS *frame_parms,
                              int l,
                              int* freq_offset);
154 155 156 157 158

/*! \brief Tracking of timing for LTE
This function computes the time domain channel response, finds the peak and adjusts the timing in pci_interface.offset accordingly.
\param frame_parms LTE DL frame parameter structure
\param phy_vars_ue Pointer to UE PHY data structure
159
\param eNb_id
160 161
\param clear If clear==1 moving average filter is reset
\param coef Coefficient of the moving average filter (Q1.15)
162
 */
163 164

void lte_adjust_synch(LTE_DL_FRAME_PARMS *frame_parms,
165 166
                      PHY_VARS_UE *phy_vars_ue,
                      module_id_t eNb_id,
167
                      uint8_t subframe,
168 169
                      unsigned char clear,
                      short coef);
170 171 172

//! \brief this function fills the PHY_VARS_UE->PHY_measurement structure
void lte_ue_measurements(PHY_VARS_UE *phy_vars_ue,
173 174
                         unsigned int subframe_offset,
                         unsigned char N0_symbol,
175
                         unsigned char abstraction_flag,
176 177
                         unsigned char rank_adaptation,
                         uint8_t subframe);
178 179 180

//! \brief This function performance RSRP/RSCP measurements
void ue_rrc_measurements(PHY_VARS_UE *phy_vars_ue,
181 182
                         uint8_t slot,
                         uint8_t abstraction_flag);
183 184

void lte_ue_measurements_emul(PHY_VARS_UE *phy_vars_ue,uint8_t last_slot,uint8_t eNB_id);
185 186 187 188 189

/*! \brief Function to return the path-loss based on the UE cell-specific reference signal strength and transmission power of eNB
@param Mod_id Module ID for UE
@param eNB_index Index of eNB on which to act
@returns Path loss in dB
190
 */
Raymond Knopp's avatar
 
Raymond Knopp committed
191
int16_t get_PL(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index);
192
double get_RSRP(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index);
193
uint32_t get_RSRQ(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index);
Raymond Knopp's avatar
 
Raymond Knopp committed
194
uint8_t get_n_adj_cells(module_id_t Mod_id,uint8_t CC_id);
195 196
uint32_t get_rx_total_gain_dB(module_id_t Mod_id,uint8_t CC_id);
uint32_t get_RSSI(module_id_t Mod_id,uint8_t CC_id);
Raymond Knopp's avatar
 
Raymond Knopp committed
197 198
int8_t set_RSRP_filtered(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index,float rsrp);
int8_t set_RSRQ_filtered(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index,float rstq);
199 200 201

//! Automatic gain control
void phy_adjust_gain (PHY_VARS_UE *phy_vars_ue,
202
              uint32_t rx_power_fil_dB,
203
                      unsigned char eNB_id);
204 205

int lte_ul_channel_estimation(PHY_VARS_eNB *phy_vars_eNB,
206
			      L1_rxtx_proc_t *proc,
207 208
                              module_id_t UE_id,
                              uint8_t l,
209 210
                              uint8_t Ns);

211

212
int16_t lte_ul_freq_offset_estimation(LTE_DL_FRAME_PARMS *frame_parms,
213 214
                                      int32_t *ul_ch_estimates,
                                      uint16_t nb_rb);
215 216

int lte_srs_channel_estimation(LTE_DL_FRAME_PARMS *frame_parms,
217 218
                               LTE_eNB_COMMON *eNB_common_vars,
                               LTE_eNB_SRS *eNB_srs_vars,
219 220
                               SOUNDINGRS_UL_CONFIG_DEDICATED *soundingrs_ul_config_dedicated,
                               unsigned char sub_frame_number,
221
			       unsigned char eNB_id);
222 223

int lte_est_timing_advance(LTE_DL_FRAME_PARMS *frame_parms,
224 225 226 227 228
                           LTE_eNB_SRS *lte_eNb_srs,
                           unsigned int *eNb_id,
                           unsigned char clear,
                           unsigned char number_of_cards,
                           short coef);
229

230
int lte_est_timing_advance_pusch(PHY_VARS_eNB* phy_vars_eNB,module_id_t UE_id);
231

232
void lte_eNB_I0_measurements(PHY_VARS_eNB *phy_vars_eNB,
233
                 int subframe,
234 235
                             module_id_t eNB_id,
                             unsigned char clear);
236

237
void lte_eNB_I0_measurements_emul(PHY_VARS_eNB *phy_vars_eNB,
238
                                  uint8_t sect_id);
239 240


241
void lte_eNB_srs_measurements(PHY_VARS_eNB *phy_vars_eNBy,
242 243 244
                              module_id_t eNB_id,
                              module_id_t UE_id,
                              unsigned char init_averaging);
245 246 247


void freq_equalization(LTE_DL_FRAME_PARMS *frame_parms,
248 249 250 251 252 253
                       int **rxdataF_comp,
                       int **ul_ch_mag,
                       int **ul_ch_mag_b,
                       unsigned char symbol,
                       unsigned short Msc_RS,
                       unsigned char Qm);
254 255


256
/** @} */
257
#endif