[GITLAB] - UPGRADE TO v12 on Wednesday the 18th of December at 11.30AM

defs_nr_common.h 8.48 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
/*
 * 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.1  (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
 */

/*! \file PHY/defs_nr_common.h
 \brief Top-level defines and structure definitions
 \author Guy De Souza
 \date 2018
 \version 0.1
 \company Eurecom
 \email: desouza@eurecom.fr
 \note
 \warning
*/

#ifndef __PHY_DEFS_NR_COMMON__H__
#define __PHY_DEFS_NR_COMMON__H__

Jacques's avatar
Jacques committed
36
#include "PHY/impl_defs_top.h"
37
#include "defs_common.h"
Guy De Souza's avatar
Guy De Souza committed
38
#include "nfapi_nr_interface.h"
39
#include "impl_defs_nr.h"
Guy De Souza's avatar
Guy De Souza committed
40
#include "PHY/CODING/nrPolar_tools/nr_polar_defs.h"
41 42

#define nr_subframe_t lte_subframe_t
43
#define nr_slot_t lte_subframe_t
44 45 46

#define MAX_NUM_SUBCARRIER_SPACING 5

47 48
#define NR_MAX_NB_RB 275

49
#define NR_NB_SC_PER_RB 12
50
#define NR_NB_REG_PER_CCE 6
51

52 53 54 55 56
#define NR_SYMBOLS_PER_SLOT 14

#define ONE_OVER_SQRT2_Q15 23170
#define ONE_OVER_TWO_Q15 16384

Guy De Souza's avatar
Guy De Souza committed
57 58 59
#define NR_MOD_TABLE_SIZE_SHORT 14
#define NR_MOD_TABLE_BPSK_OFFSET 1
#define NR_MOD_TABLE_QPSK_OFFSET 3
60

Guy De Souza's avatar
Guy De Souza committed
61 62 63
#define NR_PSS_LENGTH 127
#define NR_SSS_LENGTH 127

Guy De Souza's avatar
Guy De Souza committed
64
#define NR_PBCH_DMRS_LENGTH 144 // in mod symbols
65
#define NR_PBCH_DMRS_LENGTH_DWORD 10 // ceil(2(QPSK)*NR_PBCH_DMRS_LENGTH/32)
Guy De Souza's avatar
Guy De Souza committed
66

Guy De Souza's avatar
Guy De Souza committed
67 68 69 70 71 72
/*These max values are for the gold sequences which are generated at init for the
 * full carrier bandwidth*/
#define NR_MAX_PDCCH_DMRS_INIT_LENGTH ((NR_MAX_NB_RB<<1)*3) // 3 symbols *2(QPSK)
#define NR_MAX_PDCCH_DMRS_INIT_LENGTH_DWORD 52 // ceil(NR_MAX_PDCCH_DMRS_LENGTH/32)
/*used for the resource mapping*/
#define NR_MAX_PDCCH_DMRS_LENGTH 576 // 16(L)*2(QPSK)*3(3 DMRS symbs per REG)*6(REG per CCE)
73

74
#define NR_MAX_DCI_PAYLOAD_SIZE 64
Guy De Souza's avatar
Guy De Souza committed
75
#define NR_MAX_DCI_SIZE 1728 //16(L)*2(QPSK)*9(12 RE per REG - 3(DMRS))*6(REG per CCE)
Guy De Souza's avatar
Guy De Souza committed
76
#define NR_MAX_DCI_SIZE_DWORD 54 // ceil(NR_MAX_DCI_SIZE/32)
Guy De Souza's avatar
Guy De Souza committed
77

78 79
#define NR_MAX_NUM_BWP 4

80
#define NR_MAX_PDCCH_AGG_LEVEL 16
81
#define NR_MAX_CSET_DURATION 3
82

83 84 85 86 87 88 89 90
typedef enum {
  NR_MU_0=0,
  NR_MU_1,
  NR_MU_2,
  NR_MU_3,
  NR_MU_4,
} nr_numerology_index_e;

91 92 93 94 95 96 97
typedef enum {
  kHz15=0,
  kHz30,
  kHz60,
  kHz120,
  kHz240
} nr_scs_e;
98 99 100 101 102 103 104 105 106

typedef enum{
  nr_ssb_type_A = 0,
  nr_ssb_type_B,
  nr_ssb_type_C,
  nr_ssb_type_D,
  nr_ssb_type_E
} nr_ssb_type_e;

Guy De Souza's avatar
Guy De Souza committed
107 108 109 110 111
typedef enum {
  nr_FR1 = 0,
  nr_FR2
} nr_frequency_range_e;

112
typedef struct NR_BWP_PARMS {
Guy De Souza's avatar
Guy De Souza committed
113 114 115 116 117
  /// BWP ID
  uint8_t bwp_id;
  /// Subcarrier spacing
  nr_scs_e scs;
  /// Freq domain location -- 1st CRB index
118 119 120 121 122
  uint8_t location;
  /// Bandwidth in PRB
  uint16_t N_RB;
  /// Size of FFT/IFFT
  uint16_t ofdm_symbol_size;
Guy De Souza's avatar
Guy De Souza committed
123 124
  /// Cyclic prefix
  uint8_t cyclic_prefix;
125 126
} NR_BWP_PARMS;

127 128
typedef struct {
  uint8_t reg_idx;
Guy De Souza's avatar
Guy De Souza committed
129
  uint16_t start_sc_idx;
130 131 132 133 134 135 136 137
  uint8_t symb_idx;
} nr_reg_t;

typedef struct {
  uint8_t cce_idx;
  nr_reg_t reg_list[NR_NB_REG_PER_CCE];
} nr_cce_t;

138

139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160
/// PRACH-ConfigInfo from 36.331 RRC spec
typedef struct {
  /// Parameter: prach-ConfigurationIndex, see TS 36.211 (5.7.1). \vr{[0..63]}
  uint8_t prach_ConfigIndex;
  /// Parameter: High-speed-flag, see TS 36.211 (5.7.2). \vr{[0..1]} 1 corresponds to Restricted set and 0 to Unrestricted set.
  uint8_t highSpeedFlag;
  /// Parameter: \f$N_\text{CS}\f$, see TS 36.211 (5.7.2). \vr{[0..15]}\n Refer to table 5.7.2-2 for preamble format 0..3 and to table 5.7.2-3 for preamble format 4.
  uint8_t zeroCorrelationZoneConfig;
  /// Parameter: prach-FrequencyOffset, see TS 36.211 (5.7.1). \vr{[0..94]}\n For TDD the value range is dependent on the value of \ref prach_ConfigIndex.
  uint8_t prach_FreqOffset;
} NR_PRACH_CONFIG_INFO;

/// PRACH-ConfigSIB or PRACH-Config
typedef struct {
  /// Parameter: RACH_ROOT_SEQUENCE, see TS 36.211 (5.7.1). \vr{[0..837]}
  uint16_t rootSequenceIndex;
  /// prach_Config_enabled=1 means enabled. \vr{[0..1]}
  uint8_t prach_Config_enabled;
  /// PRACH Configuration Information
  NR_PRACH_CONFIG_INFO prach_ConfigInfo;
} NR_PRACH_CONFIG_COMMON;

161
typedef struct NR_DL_FRAME_PARMS {
Guy De Souza's avatar
Guy De Souza committed
162 163
  /// frequency range
  nr_frequency_range_e freq_range;
knopp's avatar
knopp committed
164 165 166 167
  /// Placeholder to replace overlapping fields below
  nfapi_nr_rf_config_t rf_config;
  /// Placeholder to replace SSB overlapping fields below
  nfapi_nr_sch_config_t sch_config;
168
  /// Number of resource blocks (RB) in DL
knopp's avatar
knopp committed
169
  int N_RB_DL;
170
  /// Number of resource blocks (RB) in UL
knopp's avatar
knopp committed
171
  int N_RB_UL;
172 173 174 175
  ///  total Number of Resource Block Groups: this is ceil(N_PRB/P)
  uint8_t N_RBG;
  /// Total Number of Resource Block Groups SubSets: this is P
  uint8_t N_RBGS;
176 177 178 179 180 181 182 183 184 185 186
  /// EUTRA Band
  uint8_t eutra_band;
  /// DL carrier frequency
  uint32_t dl_CarrierFreq;
  /// UL carrier frequency
  uint32_t ul_CarrierFreq;
  /// TX attenuation
  uint32_t att_tx;
  /// RX attenuation
  uint32_t att_rx;
  ///  total Number of Resource Block Groups: this is ceil(N_PRB/P)
187 188 189 190 191 192 193
  /// Frame type (0 FDD, 1 TDD)
  lte_frame_type_t frame_type;
  /// TDD subframe assignment (0-7) (default = 3) (254=RX only, 255=TX only)
  uint8_t tdd_config;
  /// TDD S-subframe configuration (0-9)
  /// Cell ID
  uint16_t Nid_cell;
194 195 196 197 198 199 200 201 202 203 204 205 206 207 208
  uint32_t subcarrier_spacing;
  /// 3/4 sampling
  uint8_t threequarter_fs;
  /// Size of FFT
  uint16_t ofdm_symbol_size;
  /// Number of prefix samples in all but first symbol of slot
  uint16_t nb_prefix_samples;
  /// Number of prefix samples in first symbol of slot
  uint16_t nb_prefix_samples0;
  /// Carrier offset in FFT buffer for first RE in PRB0
  uint16_t first_carrier_offset;
  /// Number of OFDM/SC-FDMA symbols in one slot
  uint16_t symbols_per_slot;
  /// Number of slots per subframe
  uint16_t slots_per_subframe;
209 210
    /// Number of slots per frame
  uint16_t slots_per_frame;
211 212
  /// Number of samples in a subframe
  uint32_t samples_per_subframe;
213 214
  /// Number of samples in a slot
  uint32_t samples_per_slot;
215 216
  /// Number of OFDM/SC-FDMA symbols in one subframe (to be modified to account for potential different in UL/DL)
  uint16_t symbols_per_tti;
217 218 219 220
  /// Number of samples in a radio frame
  uint32_t samples_per_frame;
  /// Number of samples in a subframe without CP
  uint32_t samples_per_subframe_wCP;
221 222
  /// Number of samples in a slot without CP
  uint32_t samples_per_slot_wCP;
223 224
  /// Number of samples in a radio frame without CP
  uint32_t samples_per_frame_wCP;
225
  /// Number of samples in a tti (same as subrame in LTE, slot in NR)
226 227 228 229 230 231 232 233 234 235 236 237 238 239
  uint32_t samples_per_tti;
  /// NR numerology index [0..5] as specified in 38.211 Section 4 (mu). 0=15khZ SCS, 1=30khZ, 2=60kHz, etc
  uint8_t numerology_index;
  /// NR number of ttis per subframe deduced from numerology (cf 38.211): 1, 2, 4, 8(not supported),16(not supported),32(not supported)
  uint8_t ttis_per_subframe;
  /// NR number of slots per tti . Assumption only 2 Slot per TTI is supported (Slot Config 1 in 38.211)
  uint8_t slots_per_tti;
//#endif
  /// Number of Physical transmit antennas in node
  uint8_t nb_antennas_tx;
  /// Number of Receive antennas in node
  uint8_t nb_antennas_rx;
  /// Number of common transmit antenna ports in eNodeB (1 or 2)
  uint8_t nb_antenna_ports_eNB;
240 241
  /// PRACH_CONFIG
  NR_PRACH_CONFIG_COMMON prach_config_common;
242 243
  /// Cyclic Prefix for DL (0=Normal CP, 1=Extended CP)
  lte_prefix_type_t Ncp;
Wang's avatar
Wang committed
244 245
  /// shift of pilot position in one RB
  uint8_t nushift;
246 247 248 249 250 251 252 253 254 255 256
  /// SRS configuration from TS 38.331 RRC
  SRS_NR srs_nr;

  /// for NR TDD management
  TDD_UL_DL_configCommon_t  *p_tdd_UL_DL_Configuration;

  TDD_UL_DL_configCommon_t  *p_tdd_UL_DL_ConfigurationCommon2;

  TDD_UL_DL_SlotConfig_t    *p_TDD_UL_DL_ConfigDedicated;

  /// TDD configuration
Jacques's avatar
Jacques committed
257
  uint16_t tdd_uplink_nr[2*NR_MAX_SLOTS_PER_FRAME]; /* this is a bitmap of symbol of each slot given for 2 frames */
258 259

   //SSB related params
260 261
  /// Start in Subcarrier index of the SSB block
  uint16_t ssb_start_subcarrier;
Guy De Souza's avatar
Guy De Souza committed
262
  /// SSB type
263
  nr_ssb_type_e ssb_type;
Guy De Souza's avatar
Guy De Souza committed
264 265
  /// PBCH polar encoder params
  t_nrPolar_params pbch_polar_params;
266

267
   //BWP params
Guy De Souza's avatar
Guy De Souza committed
268 269
  NR_BWP_PARMS initial_bwp_dl;
  NR_BWP_PARMS initial_bwp_ul;
270

271 272
} NR_DL_FRAME_PARMS;

273

274
#endif