phy_init.h 16.5 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
Cedric Roux's avatar
Cedric Roux committed
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
21
 * 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
 */

22
23
24
#ifndef __INIT_DEFS__H__
#define __INIT_DEFS__H__

25
26
#include "PHY/defs_eNB.h"
#include "PHY/defs_UE.h"
27
28
#include "PHY/defs_gNB.h"
#include "PHY/defs_nr_UE.h"
29

30
31
32
33
#include "SystemInformationBlockType2.h"
//#include "RadioResourceConfigCommonSIB.h"
#include "RadioResourceConfigDedicated.h"
#include "TDD-Config.h"
34
#include "PHICH-Config.h"
35
#include "MBSFN-SubframeConfigList.h"
36
#include "MobilityControlInfo.h"
37
#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0))
38
#include "SCellToAddMod-r10.h"
39
#endif
40
41
42
43
/** @addtogroup _PHY_STRUCTURES_
 * @{
 */

44
45
46
47
48
49
50
/*!
\fn int l1_top_init_eNB(void)
\brief Initialize north interface for L1
@returns 0 on success
 */
int l1_north_init_eNB(void);

51
52
53
54
55
/*!
\fn int phy_init_top(LTE_DL_FRAME_PARMS *frame_parms)
\brief Allocate and Initialize the PHY variables after receiving static configuration
@param frame_parms Pointer to LTE_DL_FRAME_PARMS (common configuration)
@returns 0 on success
gauthier's avatar
gauthier committed
56
 */
57
58
int phy_init_top(LTE_DL_FRAME_PARMS *frame_parms);

hongzhi wang's avatar
hongzhi wang committed
59
60
void phy_init_nr_top(PHY_VARS_NR_UE *ue);

61
62

/*!
knopp's avatar
knopp committed
63
\brief Allocate and Initialize the PHY variables relevant to the LTE ue signal buffers.
64
65
\details Only a subset of phy_vars_ue is initialized.
@param[out] phy_vars_ue Pointer to UE Variables
66
67
68
@param nb_connected_eNB Number of eNB that UE can process in one PDSCH demodulation subframe
@param abstraction_flag 1 indicates memory should be allocated for abstracted MODEM
@returns 0 on success
69
70
@returns -1 if any memory allocation failed
@note The current implementation will never return -1, but segfault.
gauthier's avatar
gauthier committed
71
 */
Cedric Roux's avatar
Cedric Roux committed
72
int init_lte_ue_signal(PHY_VARS_UE *phy_vars_ue,
knopp's avatar
knopp committed
73
74
75
76
77
78
79
80
81
			   int          nb_connected_eNB,
			   uint8_t         abstraction_flag);

/*!
\brief Allocate and initialize the PHY variables releated to the transport channel buffers (UL/DL)
@param ue Pointer to UE L1 context
@param abstraction flag Indicates that abstraction is used in L1
*/
void init_lte_ue_transport(PHY_VARS_UE *ue,int absraction_flag);
82
83

/*!
84
85
86
\brief Allocate and initialize the PHY variables relevant to the LTE implementation (eNB).
\details Only a subset of phy_vars_eNb is initialized.
@param[out] phy_vars_eNb Pointer to eNB Variables
87
88
89
@param is_secondary_eNb Flag to indicate this eNB gets synch from another
@param abstraction_flag 1 indicates memory should be allocated for abstracted MODEM
@returns 0 on success
90
91
@returns -1 if any memory allocation failed
@note The current implementation will never return -1, but segfault.
gauthier's avatar
gauthier committed
92
 */
93
int phy_init_lte_eNB(PHY_VARS_eNB *phy_vars_eNb,
gauthier's avatar
gauthier committed
94
95
                     unsigned char is_secondary_eNb,
                     unsigned char abstraction_flag);
96

97
98
99
100
101
102
103
/*!
\brief Free the PHY variables relevant to the LTE implementation (eNB).
\details Only a subset of phy_vars_eNb is freed (those who have been allocated with phy_init_lte_eNB()).
@param[in] phy_vars_eNb Pointer to eNB Variables
 */
void phy_free_lte_eNB(PHY_VARS_eNB *phy_vars_eNb);

104
105
/** \brief Configure LTE_DL_FRAME_PARMS with components derived after initial synchronization (MIB decoding + primary/secondary synch).
\details The basically allows configuration of \f$N_{\mathrm{RB}}^{\mathrm{DL}}\f$, the cell id  \f$N_{\mathrm{ID}}^{\mathrm{cell}}\f$, the normal/extended prefix mode, the frame type (FDD/TDD), \f$N_{\mathrm{cp}}\f$, the number of TX antennas at eNB (\f$p\f$) and the number of PHICH groups, \f$N_{\mathrm{group}}^{\mathrm{PHICH}}\f$
106
107
108
109
110
111
@param lte_frame_parms pointer to LTE parameter structure
@param N_RB_DL Number of DL resource blocks
@param Nid_cell Cell ID
@param Ncp Normal/Extended Prefix flag
@param p_eNB Number of eNB TX antennas
@param phich_config Pointer to PHICH_CONFIG_COMMON
gauthier's avatar
gauthier committed
112
 */
113
114
115
116
117
118
119
120
121
122
123
void phy_config_mib_eNB(int                    Mod_id,
			int                    CC_id,
			int                    eutra_band,
			int                    N_RB_DL,
			PHICH_Config_t         *phich_config,
			int                    Nid_cell,
			int                    Ncp,
			int                    p_eNB,
			uint32_t               dl_CarrierFreq,
			uint32_t               ul_CarrierFreq);

124
125


126
127
/** \brief Configure LTE_DL_FRAME_PARMS with components derived after reception of SIB1.
\details From a PHY perspective this allows configuration of TDD framing parameters and SI reception.
128
@param Mod_id Instance ID of eNB
knopp's avatar
   
knopp committed
129
@param CC_id Component Carrier index
130
@param tdd_Config TDD UL/DL and S-subframe configurations
131
@param SIwindowsize Size of a SI window in frames where repetitions of a unique System Information message block is repeated
132
@param SIperiod Periodicity of System Information Messages (in multiples of a frame)*/
gauthier's avatar
gauthier committed
133
void phy_config_sib1_eNB(module_id_t    Mod_id,
knopp's avatar
   
knopp committed
134
                         int CC_id,
135
                         TDD_Config_t  *tdd_Config,
gauthier's avatar
gauthier committed
136
137
                         uint8_t           SIwindowsize,
                         uint16_t            SIperiod);
138

139
140
/** \brief Configure LTE_DL_FRAME_PARMS with components derived after reception of SIB1.
\details From a PHY perspective this allows configuration of TDD framing parameters and SI reception.
141
@param Mod_id Instance ID of UE
knopp's avatar
   
knopp committed
142
@param CC_id Component Carrier index
143
144
@param CH_index Index of eNB for this configuration
@param tdd_Config TDD UL/DL and S-subframe configurations
145
@param SIwindowsize Size of a SI window in frames where repetitions of a unique System Information message block is repeated
146
@param SIperiod Periodicity of System Information Messages (in multiples of a frame)*/
gauthier's avatar
gauthier committed
147
void phy_config_sib1_ue(module_id_t   Mod_id,
knopp's avatar
   
knopp committed
148
                        int CC_id,
149
                        uint8_t          CH_index,
gauthier's avatar
gauthier committed
150
151
152
                        TDD_Config_t *tdd_Config,
                        uint8_t          SIwindowsize,
                        uint16_t           SIperiod);
153
154
155


/*!
knopp's avatar
   
knopp committed
156
  \fn void phy_config_sib2_ue(module_id_t Mod_id,uint8_t CC_id,uint8_t CH_index,
157
158
159
160
161
162
      RadioResourceConfigCommonSIB_t *radioResourceConfigCommon,
      ARFCN_ValueEUTRA_t *ul_CArrierFreq,
            long *ul_Bandwidth,
      AdditionalSpectrumEmission_t additionalSpectrumEmission,
      struct MBSFN_SubframeConfigList *mbsfn_SubframeConfigList)
  \brief Configure LTE_DL_FRAME_PARMS with components derived after reception of SIB2 (at UE).
163
  @param Mod_id Instance id
knopp's avatar
   
knopp committed
164
  @param CC_id
165
  @param CH_index Index of CH to which UE is connected
knopp's avatar
   
knopp committed
166
  @param CC_id Component Carrier Index
167
168
169
170
171
  @param radioResourceConfigCommon Radio Configuration from SIB2
  @param ul_CarrierFreq UL carrier ARFCN, null if optional (i.e. implicit from DL)
  @param ul_Bandwidth UL bandwidth, null if optional (i.e. same as DL)
  @param additionalSpectrumEmission UL parameter (see 36.101)
  @param mbsfn_SubframeConfigList MBSFN subframe configuration
gauthier's avatar
gauthier committed
172
 */
knopp's avatar
   
knopp committed
173
174
void phy_config_sib2_ue(module_id_t                     Mod_id,
                        int                         CC_id,
175
                        uint8_t                         CH_index,
gauthier's avatar
gauthier committed
176
177
178
179
180
                        RadioResourceConfigCommonSIB_t  *radioResourceConfigCommon,
                        ARFCN_ValueEUTRA_t              *ul_CArrierFreq,
                        long                            *ul_Bandwidth,
                        AdditionalSpectrumEmission_t    *additionalSpectrumEmission,
                        struct MBSFN_SubframeConfigList *mbsfn_SubframeConfigList);
181

182

183
/*!
184
185
  \fn phy_config_afterHO_ue
  \brief Configure Common PHY parameters from mobilityControlInfo
186
  @param Mod_id
knopp's avatar
   
knopp committed
187
  @param CC_id
188
189
190
191
  @param eNB_index
  @param mobilityControlInfo pointer to the mobility control information for handover
  @param ho_failed flag to indicated whether the ho was successful or not
 */
gauthier's avatar
gauthier committed
192
void phy_config_afterHO_ue(module_id_t Mod_id,
193
                           uint8_t CC_id,
194
                           uint8_t eNB_index,
gauthier's avatar
gauthier committed
195
196
                           MobilityControlInfo_t *mobilityControlInfo,
                           uint8_t ho_failed);
197
/*!
gauthier's avatar
gauthier committed
198
  \fn void phy_config_sib2_eNB(module_id_t Mod_id,
199
                               RadioResourceConfigCommonSIB_t *radioResourceConfigCommon,
200
201
202
203
204
             ARFCN_ValueEUTRA_t *ul_CArrierFreq,
             long *ul_Bandwidth,
             AdditionalSpectrumEmission_t additionalSpectrumEmission,
             struct MBSFN_SubframeConfigList  *mbsfn_SubframeConfigList)
  \brief Configure LTE_DL_FRAME_PARMS with components of SIB2 (at eNB).
205
  @param Mod_id Instance id
knopp's avatar
   
knopp committed
206
  @param Mod_id Component Carrier index
207
208
209
210
211
  @param radioResourceConfigCommon Radio Configuration from SIB2
  @param ul_CarrierFreq UL carrier ARFCN, null if optional (i.e. implicit from DL)
  @param ul_Bandwidth UL bandwidth, null if optional (i.e. same as DL)
  @param additionalSpectrumEmission UL parameter (see 36.101)
  @param mbsfn_SubframeConfigList MBSFN subframe configuration
gauthier's avatar
gauthier committed
212
 */
knopp's avatar
   
knopp committed
213
214
void phy_config_sib2_eNB(module_id_t                            Mod_id,
                         int                                CC_id,
215
                         RadioResourceConfigCommonSIB_t         *radioResourceConfigCommon,
gauthier's avatar
gauthier committed
216
217
218
219
                         ARFCN_ValueEUTRA_t                     *ul_CArrierFreq,
                         long                                   *ul_Bandwidth,
                         AdditionalSpectrumEmission_t           *additionalSpectrumEmission,
                         struct MBSFN_SubframeConfigList        *mbsfn_SubframeConfigList);
220
221
222


/*!
knopp's avatar
   
knopp committed
223
\fn void phy_config_dedicated_ue(module_id_t Mod_id,uint8_t CC_id,uint8_t CH_index,
224
               struct PhysicalConfigDedicated *physicalConfigDedicated)
225
226
\brief Configure UE dedicated parameters.
\details Invoked upon reception of RRCConnectionSetup or RRCConnectionReconfiguration from eNB.
227
@param Mod_id Instance ID for eNB
knopp's avatar
   
knopp committed
228
@param CC_id Component Carrier index
229
230
231
@param CH_index Index of eNB for this configuration
@param physicalConfigDedicated PHY Configuration information

gauthier's avatar
gauthier committed
232
 */
knopp's avatar
   
knopp committed
233
234
void phy_config_dedicated_ue(module_id_t Mod_id,
                             int CC_id,
235
                             uint8_t CH_index,
knopp's avatar
   
knopp committed
236
237
                             struct PhysicalConfigDedicated *physicalConfigDedicated);

Bilel's avatar
Bilel committed
238
239
240
241
242
243
244
245
246
/*!
\fn void phy_config_harq_ue(module_id_t Mod_id,uint8_t CC_id,uint8_t CH_index,
               uint16_t max_harq_tx)
\brief Configure UE UL max harq Tx.
\details Invoked upon reception of RRCConnectionSetup or RRCConnectionReconfiguration from eNB.
@param Mod_id Instance ID for eNB
@param CC_id Component Carrier index
@param CH_index Index of eNB for this configuration
@param max_harq_tx max harq tx information
247

Bilel's avatar
Bilel committed
248
249
250
 */
void phy_config_harq_ue(module_id_t Mod_id,int CC_id,uint8_t CH_index,
                           uint16_t max_harq_tx);
251
/**
252
253
\brief Configure UE MBSFN common parameters.
\details Invoked upon reception of SIB13 from eNB.
254
@param Mod_id Instance ID for UE
knopp's avatar
   
knopp committed
255
@param CC_id Component Carrier Index
256
257
258
@param CH_index eNB id (for multiple eNB reception)
@param mbsfn_Area_idx Index of MBSFN-Area for which this command operates
@param mbsfn_AreaId_r9 MBSFN-Area Id
gauthier's avatar
gauthier committed
259
 */
260

gauthier's avatar
gauthier committed
261
void phy_config_sib13_ue(module_id_t Mod_id,
knopp's avatar
   
knopp committed
262
                         int CC_id,uint8_t CH_index,int mbsfn_Area_idx,
gauthier's avatar
gauthier committed
263
                         long mbsfn_AreaId_r9);
264
265

/**
266
267
\brief Configure eNB MBSFN common parameters.
\details Invoked upon transmission of SIB13 from eNB.
268
@param Mod_id Instance ID for eNB
knopp's avatar
   
knopp committed
269
@param CC_id Component Carrier index
270
271
@param mbsfn_Area_idx Index of MBSFN-Area for which this command operates
@param mbsfn_AreaId_r9 MBSFN-Area Id
gauthier's avatar
gauthier committed
272
273
 */
void phy_config_sib13_eNB(module_id_t Mod_id,
274
                          int CC_id,
gauthier's avatar
gauthier committed
275
276
                          int mbsfn_Area_idx,
                          long mbsfn_AreaId_r9);
277
278
279
280

/**
\brief Configure cba rnti for .
@param Mod_id Instance ID for eNB
knopp's avatar
   
knopp committed
281
@param CC_id Component Carrier Index
282
@param eNB_flag flag indicating whether the nodeis eNB (1) or UE (0)
283
@param index index of the node
284
285
@param cba_rnti rnti for the cba transmission
@param num_active_cba_groups num active cba group
gauthier's avatar
gauthier committed
286
 */
knopp's avatar
   
knopp committed
287
void  phy_config_cba_rnti (module_id_t Mod_id,int CC_id,eNB_flag_t eNB_flag, uint8_t index, rnti_t cba_rnti, uint8_t cba_group_id, uint8_t num_active_cba_groups);
288
289
290

/** \brief Configure RRC inter-cell measurements procedures
@param Mod_id Index of UE
knopp's avatar
   
knopp committed
291
@param CC_id
292
293
294
@param eNB_index Index of corresponding eNB
@param n_adj_cells Number of adjacent cells on which to perform the measuremnts
@param adj_cell_id Array of cell ids of adjacent cells
gauthier's avatar
gauthier committed
295
296
 */
void phy_config_meas_ue(module_id_t Mod_id,
297
                        uint8_t CC_id,
298
                        uint8_t eNB_index,
gauthier's avatar
gauthier committed
299
300
                        uint8_t n_adj_cells,
                        uint32_t *adj_cell_id);
301
302

/*!
gauthier's avatar
gauthier committed
303
\fn void phy_config_dedicated_eNB(module_id_t Mod_id,uint16_t rnti,
304
                                  struct PhysicalConfigDedicated *physicalConfigDedicated)
305
306
\brief Prepare for configuration of PHY with dedicated parameters.
\details Invoked just prior to transmission of RRCConnectionSetup or RRCConnectionReconfiguration at eNB.
307
@param Mod_id Instance ID for eNB
knopp's avatar
   
knopp committed
308
@param CC_id Component Carrier index
309
310
@param rnti rnti for UE context
@param physicalConfigDedicated PHY Configuration information
gauthier's avatar
gauthier committed
311
312
 */
void phy_config_dedicated_eNB(module_id_t Mod_id,
knopp's avatar
   
knopp committed
313
                              int CC_id,
314
                              rnti_t rnti,
gauthier's avatar
gauthier committed
315
                              struct PhysicalConfigDedicated *physicalConfigDedicated);
316
317
318
319
320

/*!
\fn void phy_config_dedicated_eNB_step2(PHY_VARS_eNB *phy_vars_eNB)
\brief Configure PHY with dedicated parameters between configuration of DLSCH (n) and ULSCH (n+4) in current subframe (n).
@param phy_vars_eNB Pointer to PHY_VARS_eNB structure
gauthier's avatar
gauthier committed
321
 */
322
323
324
325
void phy_config_dedicated_eNB_step2(PHY_VARS_eNB *phy_vars_eNB);

/*
  \fn int phy_init_secsys_eNB(PHY_VARS_eNB *phy_vars_eNb)
326
\brief Allocate and Initialize the PHY variables relevant to the LTE implementation.
327
@param phy_vars_eNb pointer to LTE parameter structure for the eNb
gauthier's avatar
gauthier committed
328
 */
329
330
int phy_init_secsys_eNB(PHY_VARS_eNB *phy_vars_eNb);

331
void free_lte_top(void);
332

knopp's avatar
knopp committed
333
void init_lte_top(LTE_DL_FRAME_PARMS *lte_frame_parms);
334
335
336

//void copy_lte_parms_to_phy_framing(LTE_DL_FRAME_PARMS *frame_parm, PHY_FRAMING *phy_framing);

knopp's avatar
knopp committed
337
338
339
void lte_param_init(PHY_VARS_eNB **eNBp,
		    PHY_VARS_UE **UEp,
		    RU_t **rup,
Cedric Roux's avatar
Cedric Roux committed
340
		    unsigned char N_tx_port_eNB,
knopp's avatar
knopp committed
341
                    unsigned char N_tx_phy,
342
343
		    unsigned char N_rx_ru,
		    unsigned char N_rx_ue,
344
345
		    unsigned char transmission_mode,
		    uint8_t extended_prefix_flag,
Cedric Roux's avatar
Cedric Roux committed
346
		    frame_t frame_type,
347
348
349
		    uint16_t Nid_cell,
		    uint8_t tdd_config,
		    uint8_t N_RB_DL,
knopp's avatar
knopp committed
350
		    uint8_t pa,
351
352
353
354
		    uint8_t threequarter_fs,
                    uint8_t osf,
		    uint32_t perfect_ce);

knopp's avatar
knopp committed
355

356
#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0))
357
void phy_config_dedicated_scell_ue(uint8_t Mod_id,
358
359
360
                                   uint8_t eNB_index,
                                   SCellToAddMod_r10_t *sCellToAddMod_r10,
                                   int CC_id);
361
362

void phy_config_dedicated_scell_eNB(uint8_t Mod_id,
363
364
365
                                    uint16_t rnti,
                                    SCellToAddMod_r10_t *sCellToAddMod_r10,
                                    int CC_id);
366

367
#endif
368

369
370
371


/*! !\fn void phy_cleanup(void)
372
\brief Cleanup the PHY variables*/
373
374
void phy_cleanup(void);

375
void phy_config_request(PHY_Config_t *phy_config);
376

gauthier's avatar
gauthier committed
377
int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf);
378
void dump_frame_parms(LTE_DL_FRAME_PARMS *frame_parms);
ChenWeiTai's avatar
ChenWeiTai committed
379
int nr_init_frame_parms(nfapi_nr_config_request_t* config, NR_DL_FRAME_PARMS *frame_parms);
knopp's avatar
knopp committed
380
int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *frame_parms,int mu,int Ncp,int n_ssb_crb,int ssb_subcarrier_offset);
Hongzhi Wang's avatar
Hongzhi Wang committed
381
int init_nr_ue_signal(PHY_VARS_NR_UE *ue,int nb_connected_eNB,uint8_t abstraction_flag);
Guy De Souza's avatar
Guy De Souza committed
382
383
void nr_dump_frame_parms(NR_DL_FRAME_PARMS *frame_parms);
int phy_init_nr_gNB(PHY_VARS_gNB *gNB, unsigned char is_secondary_gNB, unsigned char abstraction_flag);
384
void nr_phy_config_request(NR_PHY_Config_t *gNB);
knopp's avatar
knopp committed
385
void nr_phy_config_request_sim(PHY_VARS_gNB *gNB,int N_RB_DL,int N_RB_UL,int mu);
Guy De Souza's avatar
Guy De Souza committed
386
void phy_free_nr_gNB(PHY_VARS_gNB *gNB);
ChenWeiTai's avatar
ChenWeiTai committed
387
int l1_north_init_gNB(void);
388

Cedric Roux's avatar
Cedric Roux committed
389
390
void init_dfts(void);

391
392
393
/** @} */
#endif