defs.h 15.6 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
/*
 * 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
 * the OAI Public License, Version 1.0  (the "License"); you may not use this file
 * 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 25 26
#ifndef __INIT_DEFS__H__
#define __INIT_DEFS__H__

#include "PHY/defs.h"

27

28 29 30 31
#include "SystemInformationBlockType2.h"
//#include "RadioResourceConfigCommonSIB.h"
#include "RadioResourceConfigDedicated.h"
#include "TDD-Config.h"
32
#include "PHICH-Config.h"
33
#include "MBSFN-SubframeConfigList.h"
34
#include "MobilityControlInfo.h"
Cedric Roux's avatar
Cedric Roux committed
35
#if defined(Rel10) || defined(Rel14)
36
#include "SCellToAddMod-r10.h"
37
#endif
38 39 40 41
/** @addtogroup _PHY_STRUCTURES_
 * @{
 */

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

49 50 51 52 53
/*!
\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
54
 */
55 56 57 58
int phy_init_top(LTE_DL_FRAME_PARMS *frame_parms);


/*!
knopp's avatar
knopp committed
59
\brief Allocate and Initialize the PHY variables relevant to the LTE ue signal buffers.
60 61
\details Only a subset of phy_vars_ue is initialized.
@param[out] phy_vars_ue Pointer to UE Variables
62 63 64
@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
65 66
@returns -1 if any memory allocation failed
@note The current implementation will never return -1, but segfault.
gauthier's avatar
gauthier committed
67
 */
knopp's avatar
knopp committed
68 69 70 71 72 73 74 75 76 77
int phy_init_lte_ue_signal(PHY_VARS_UE *phy_vars_ue,
			   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);
78 79

/*!
80 81 82
\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
83 84 85
@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
86 87
@returns -1 if any memory allocation failed
@note The current implementation will never return -1, but segfault.
gauthier's avatar
gauthier committed
88
 */
89
int phy_init_lte_eNB(PHY_VARS_eNB *phy_vars_eNb,
gauthier's avatar
gauthier committed
90 91
                     unsigned char is_secondary_eNb,
                     unsigned char abstraction_flag);
92

93 94
/** \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$
95 96 97 98 99 100
@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
101
 */
102 103 104 105 106 107 108 109 110 111 112
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);

113 114


115 116
/** \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.
117
@param Mod_id Instance ID of eNB
knopp's avatar
 
knopp committed
118
@param CC_id Component Carrier index
119
@param tdd_Config TDD UL/DL and S-subframe configurations
120
@param SIwindowsize Size of a SI window in frames where repetitions of a unique System Information message block is repeated
121
@param SIperiod Periodicity of System Information Messages (in multiples of a frame)*/
gauthier's avatar
gauthier committed
122
void phy_config_sib1_eNB(module_id_t    Mod_id,
knopp's avatar
 
knopp committed
123
                         int CC_id,
124
                         TDD_Config_t  *tdd_Config,
gauthier's avatar
gauthier committed
125 126
                         uint8_t           SIwindowsize,
                         uint16_t            SIperiod);
127

128 129
/** \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.
130
@param Mod_id Instance ID of UE
knopp's avatar
 
knopp committed
131
@param CC_id Component Carrier index
132 133
@param CH_index Index of eNB for this configuration
@param tdd_Config TDD UL/DL and S-subframe configurations
134
@param SIwindowsize Size of a SI window in frames where repetitions of a unique System Information message block is repeated
135
@param SIperiod Periodicity of System Information Messages (in multiples of a frame)*/
gauthier's avatar
gauthier committed
136
void phy_config_sib1_ue(module_id_t   Mod_id,
knopp's avatar
 
knopp committed
137
                        int CC_id,
138
                        uint8_t          CH_index,
gauthier's avatar
gauthier committed
139 140 141
                        TDD_Config_t *tdd_Config,
                        uint8_t          SIwindowsize,
                        uint16_t           SIperiod);
142 143 144


/*!
knopp's avatar
 
knopp committed
145
  \fn void phy_config_sib2_ue(module_id_t Mod_id,uint8_t CC_id,uint8_t CH_index,
146 147 148 149 150 151
      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).
152
  @param Mod_id Instance id
knopp's avatar
 
knopp committed
153
  @param CC_id
154
  @param CH_index Index of CH to which UE is connected
knopp's avatar
 
knopp committed
155
  @param CC_id Component Carrier Index
156 157 158 159 160
  @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
161
 */
knopp's avatar
 
knopp committed
162 163
void phy_config_sib2_ue(module_id_t                     Mod_id,
                        int                         CC_id,
164
                        uint8_t                         CH_index,
gauthier's avatar
gauthier committed
165 166 167 168 169
                        RadioResourceConfigCommonSIB_t  *radioResourceConfigCommon,
                        ARFCN_ValueEUTRA_t              *ul_CArrierFreq,
                        long                            *ul_Bandwidth,
                        AdditionalSpectrumEmission_t    *additionalSpectrumEmission,
                        struct MBSFN_SubframeConfigList *mbsfn_SubframeConfigList);
170

171

172
/*!
173 174
  \fn phy_config_afterHO_ue
  \brief Configure Common PHY parameters from mobilityControlInfo
175
  @param Mod_id
knopp's avatar
 
knopp committed
176
  @param CC_id
177 178 179 180
  @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
181
void phy_config_afterHO_ue(module_id_t Mod_id,
182
                           uint8_t CC_id,
183
                           uint8_t eNB_index,
gauthier's avatar
gauthier committed
184 185
                           MobilityControlInfo_t *mobilityControlInfo,
                           uint8_t ho_failed);
186
/*!
gauthier's avatar
gauthier committed
187
  \fn void phy_config_sib2_eNB(module_id_t Mod_id,
188
                               RadioResourceConfigCommonSIB_t *radioResourceConfigCommon,
189 190 191 192 193
             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).
194
  @param Mod_id Instance id
knopp's avatar
 
knopp committed
195
  @param Mod_id Component Carrier index
196 197 198 199 200
  @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
201
 */
knopp's avatar
 
knopp committed
202 203
void phy_config_sib2_eNB(module_id_t                            Mod_id,
                         int                                CC_id,
204
                         RadioResourceConfigCommonSIB_t         *radioResourceConfigCommon,
gauthier's avatar
gauthier committed
205 206 207 208
                         ARFCN_ValueEUTRA_t                     *ul_CArrierFreq,
                         long                                   *ul_Bandwidth,
                         AdditionalSpectrumEmission_t           *additionalSpectrumEmission,
                         struct MBSFN_SubframeConfigList        *mbsfn_SubframeConfigList);
209 210 211


/*!
knopp's avatar
 
knopp committed
212
\fn void phy_config_dedicated_ue(module_id_t Mod_id,uint8_t CC_id,uint8_t CH_index,
213
               struct PhysicalConfigDedicated *physicalConfigDedicated)
214 215
\brief Configure UE dedicated parameters.
\details Invoked upon reception of RRCConnectionSetup or RRCConnectionReconfiguration from eNB.
216
@param Mod_id Instance ID for eNB
knopp's avatar
 
knopp committed
217
@param CC_id Component Carrier index
218 219 220
@param CH_index Index of eNB for this configuration
@param physicalConfigDedicated PHY Configuration information

gauthier's avatar
gauthier committed
221
 */
knopp's avatar
 
knopp committed
222 223
void phy_config_dedicated_ue(module_id_t Mod_id,
                             int CC_id,
224
                             uint8_t CH_index,
knopp's avatar
 
knopp committed
225 226
                             struct PhysicalConfigDedicated *physicalConfigDedicated);

Bilel's avatar
Bilel committed
227 228 229 230 231 232 233 234 235
/*!
\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
236

Bilel's avatar
Bilel committed
237 238 239
 */
void phy_config_harq_ue(module_id_t Mod_id,int CC_id,uint8_t CH_index,
                           uint16_t max_harq_tx);
240
/**
241 242
\brief Configure UE MBSFN common parameters.
\details Invoked upon reception of SIB13 from eNB.
243
@param Mod_id Instance ID for UE
knopp's avatar
 
knopp committed
244
@param CC_id Component Carrier Index
245 246 247
@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
248
 */
249

gauthier's avatar
gauthier committed
250
void phy_config_sib13_ue(module_id_t Mod_id,
knopp's avatar
 
knopp committed
251
                         int CC_id,uint8_t CH_index,int mbsfn_Area_idx,
gauthier's avatar
gauthier committed
252
                         long mbsfn_AreaId_r9);
253 254

/**
255 256
\brief Configure eNB MBSFN common parameters.
\details Invoked upon transmission of SIB13 from eNB.
257
@param Mod_id Instance ID for eNB
knopp's avatar
 
knopp committed
258
@param CC_id Component Carrier index
259 260
@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
261 262
 */
void phy_config_sib13_eNB(module_id_t Mod_id,
263
                          int CC_id,
gauthier's avatar
gauthier committed
264 265
                          int mbsfn_Area_idx,
                          long mbsfn_AreaId_r9);
266 267 268 269

/**
\brief Configure cba rnti for .
@param Mod_id Instance ID for eNB
knopp's avatar
 
knopp committed
270
@param CC_id Component Carrier Index
271
@param eNB_flag flag indicating whether the nodeis eNB (1) or UE (0)
272
@param index index of the node
273 274
@param cba_rnti rnti for the cba transmission
@param num_active_cba_groups num active cba group
gauthier's avatar
gauthier committed
275
 */
knopp's avatar
 
knopp committed
276
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);
277 278 279

/** \brief Configure RRC inter-cell measurements procedures
@param Mod_id Index of UE
knopp's avatar
 
knopp committed
280
@param CC_id
281 282 283
@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
284 285
 */
void phy_config_meas_ue(module_id_t Mod_id,
286
                        uint8_t CC_id,
287
                        uint8_t eNB_index,
gauthier's avatar
gauthier committed
288 289
                        uint8_t n_adj_cells,
                        uint32_t *adj_cell_id);
290 291

/*!
gauthier's avatar
gauthier committed
292
\fn void phy_config_dedicated_eNB(module_id_t Mod_id,uint16_t rnti,
293
                                  struct PhysicalConfigDedicated *physicalConfigDedicated)
294 295
\brief Prepare for configuration of PHY with dedicated parameters.
\details Invoked just prior to transmission of RRCConnectionSetup or RRCConnectionReconfiguration at eNB.
296
@param Mod_id Instance ID for eNB
knopp's avatar
 
knopp committed
297
@param CC_id Component Carrier index
298 299
@param rnti rnti for UE context
@param physicalConfigDedicated PHY Configuration information
gauthier's avatar
gauthier committed
300 301
 */
void phy_config_dedicated_eNB(module_id_t Mod_id,
knopp's avatar
 
knopp committed
302
                              int CC_id,
303
                              rnti_t rnti,
gauthier's avatar
gauthier committed
304
                              struct PhysicalConfigDedicated *physicalConfigDedicated);
305 306 307 308 309

/*!
\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
310
 */
311 312 313 314
void phy_config_dedicated_eNB_step2(PHY_VARS_eNB *phy_vars_eNB);

/*
  \fn int phy_init_secsys_eNB(PHY_VARS_eNB *phy_vars_eNb)
315
\brief Allocate and Initialize the PHY variables relevant to the LTE implementation.
316
@param phy_vars_eNb pointer to LTE parameter structure for the eNb
gauthier's avatar
gauthier committed
317
 */
318 319 320
int phy_init_secsys_eNB(PHY_VARS_eNB *phy_vars_eNb);


knopp's avatar
knopp committed
321
void init_lte_top(LTE_DL_FRAME_PARMS *lte_frame_parms);
322 323 324

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

325 326
void lte_param_init(unsigned char N_tx_port_eNB,
		    unsigned char N_tx, 
327 328 329 330 331 332 333 334 335 336 337
		    unsigned char N_rx,
		    unsigned char transmission_mode,
		    uint8_t extended_prefix_flag,
		    frame_t frame_type, 
		    uint16_t Nid_cell,
		    uint8_t tdd_config,
		    uint8_t N_RB_DL,
		    uint8_t threequarter_fs,
                    uint8_t osf,
		    uint32_t perfect_ce);

Cedric Roux's avatar
Cedric Roux committed
338
#if defined(Rel10) || defined(Rel14)
339
void phy_config_dedicated_scell_ue(uint8_t Mod_id,
340 341 342
                                   uint8_t eNB_index,
                                   SCellToAddMod_r10_t *sCellToAddMod_r10,
                                   int CC_id);
343 344

void phy_config_dedicated_scell_eNB(uint8_t Mod_id,
345 346 347
                                    uint16_t rnti,
                                    SCellToAddMod_r10_t *sCellToAddMod_r10,
                                    int CC_id);
348

349
#endif
350

351 352 353


/*! !\fn void phy_cleanup(void)
354
\brief Cleanup the PHY variables*/
355 356
void phy_cleanup(void);

357
void phy_config_request(PHY_Config_t *phy_config);
358

gauthier's avatar
gauthier committed
359
int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf);
360
void dump_frame_parms(LTE_DL_FRAME_PARMS *frame_parms);
361

Florian Kaltenberger's avatar
Florian Kaltenberger committed
362 363
void lte_param_init(unsigned char N_tx_port_eNB, 
                    unsigned char N_tx_phy,
364 365 366 367 368 369 370 371 372 373
		    unsigned char N_rx,
		    unsigned char transmission_mode,
		    uint8_t extended_prefix_flag,
		    frame_t frame_type, 
		    uint16_t Nid_cell,
		    uint8_t tdd_config,
		    uint8_t N_RB_DL,
		    uint8_t threequarter_fs,
                    uint8_t osf,
		    uint32_t perfect_ce);
374 375 376
/** @} */
#endif