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

/*! \file PHY/impl_defs_lte.h
* \brief LTE Physical channel configuration and variable structure definitions
* \author R. Knopp, F. Kaltenberger
* \date 2011
* \version 0.1
* \company Eurecom
* \email: knopp@eurecom.fr,florian.kaltenberger@eurecom.fr
* \note
* \warning
*/

#ifndef __PHY_IMPLEMENTATION_DEFS_LTE_H__
#define __PHY_IMPLEMENTATION_DEFS_LTE_H__


#include "types.h"
38
#include "nfapi_interface.h"
39
//#include "defs.h"
40
#include "openair2/COMMON/platform_types.h"
41

42 43 44
#define RX_NB_TH_MAX 2
#define RX_NB_TH 2

45 46
#define LTE_SLOTS_PER_SUBFRAME 2

47 48 49 50
#define LTE_NUMBER_OF_SUBFRAMES_PER_FRAME 10
#define LTE_SLOTS_PER_FRAME  20
#define LTE_CE_FILTER_LENGTH 5
#define LTE_CE_OFFSET LTE_CE_FILTER_LENGTH
51
#define TX_RX_SWITCH_SYMBOL (NUMBER_OF_SYMBOLS_PER_FRAME>>1)
52 53 54 55 56 57 58 59 60 61 62 63
#define PBCH_PDU_SIZE 3 //bytes

#define PRACH_SYMBOL 3 //position of the UL PSS wrt 2nd slot of special subframe

#define NUMBER_OF_FREQUENCY_GROUPS (lte_frame_parms->N_RB_DL)

#define SSS_AMP 1148

#define MAX_NUM_PHICH_GROUPS 56  //110 RBs Ng=2, p.60 36-212, Sec. 6.9

#define MAX_MBSFN_AREA 8

64 65
#define NB_RX_ANTENNAS_MAX 64

laurent's avatar
laurent committed
66 67 68
#ifdef OCP_FRAMEWORK
#include "enums.h"
#else
69 70 71 72
typedef enum {TDD=1,FDD=0} lte_frame_type_t;

typedef enum {EXTENDED=1,NORMAL=0} lte_prefix_type_t;

73 74
typedef enum {LOCALIZED=0,DISTRIBUTED=1} vrb_t;

75
/// Enumeration for parameter PHICH-Duration \ref PHICH_CONFIG_COMMON::phich_duration.
76 77 78 79 80
typedef enum {
  normal=0,
  extended=1
} PHICH_DURATION_t;

81
/// Enumeration for parameter Ng \ref PHICH_CONFIG_COMMON::phich_resource.
82 83 84 85 86 87
typedef enum {
  oneSixth=1,
  half=3,
  one=6,
  two=12
} PHICH_RESOURCE_t;
laurent's avatar
laurent committed
88
#endif
89
/// PHICH-Config from 36.331 RRC spec
90
typedef struct {
91
  /// Parameter: PHICH-Duration, see TS 36.211 (Table 6.9.3-1).
92
  PHICH_DURATION_t phich_duration;
93
  /// Parameter: Ng, see TS 36.211 (6.9). \details Value oneSixth corresponds to 1/6, half corresponds to 1/2 and so on.
94 95 96
  PHICH_RESOURCE_t phich_resource;
} PHICH_CONFIG_COMMON;

97
/// PRACH-ConfigInfo from 36.331 RRC spec
98
typedef struct {
99
  /// Parameter: prach-ConfigurationIndex, see TS 36.211 (5.7.1). \vr{[0..63]}
100
  uint8_t prach_ConfigIndex;
101
  /// Parameter: High-speed-flag, see TS 36.211 (5.7.2). \vr{[0..1]} 1 corresponds to Restricted set and 0 to Unrestricted set.
102
  uint8_t highSpeedFlag;
103
  /// 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.
104
  uint8_t zeroCorrelationZoneConfig;
105
  /// 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.
106
  uint8_t prach_FreqOffset;
107 108
} PRACH_CONFIG_INFO;

109 110


111
/// PRACH-ConfigSIB or PRACH-Config from 36.331 RRC spec
112
typedef struct {
113
  /// Parameter: RACH_ROOT_SEQUENCE, see TS 36.211 (5.7.1). \vr{[0..837]}
114
  uint16_t rootSequenceIndex;
115
  /// prach_Config_enabled=1 means enabled. \vr{[0..1]}
116
  uint8_t prach_Config_enabled;
117
  /// PRACH Configuration Information
118 119 120
  PRACH_CONFIG_INFO prach_ConfigInfo;
} PRACH_CONFIG_COMMON;

121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158
#ifdef Rel14

/// PRACH-eMTC-Config from 36.331 RRC spec
typedef struct {
  /// 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.

  /// PRACH starting subframe periodicity, expressed in number of subframes available for preamble transmission (PRACH opportunities), see TS 36.211. Value 2 corresponds to 2 subframes, 4 corresponds to 4 subframes and so on. EUTRAN configures the PRACH starting subframe periodicity larger than or equal to the Number of PRACH repetitions per attempt for each CE level (numRepetitionPerPreambleAttempt).
  uint8_t prach_starting_subframe_periodicity[4];
  /// number of repetitions per preamble attempt per CE level
  uint8_t prach_numRepetitionPerPreambleAttempt[4];
  /// prach configuration index for each CE level
  uint8_t prach_ConfigIndex[4];
  /// indicator for CE level activation
  uint8_t prach_CElevel_enable[4];
  /// prach frequency offset for each CE level 
  uint8_t prach_FreqOffset[4];
  /// indicator for CE level hopping activation
  uint8_t prach_hopping_enable[4];
  /// indicator for CE level hopping activation
  uint8_t prach_hopping_offset[4];
} PRACH_eMTC_CONFIG_INFO;

#endif

/// PRACH-ConfigSIB or PRACH-Config from 36.331 RRC spec
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
  PRACH_eMTC_CONFIG_INFO prach_ConfigInfo;
} PRACH_eMTC_CONFIG_COMMON;

159
/// Enumeration for parameter \f$N_\text{ANRep}\f$ \ref PUCCH_CONFIG_DEDICATED::repetitionFactor.
160 161 162 163 164 165
typedef enum {
  n2=0,
  n4,
  n6
} ACKNAKREP_t;

166
/// Enumeration for \ref PUCCH_CONFIG_DEDICATED::tdd_AckNackFeedbackMode.
167 168 169 170 171
typedef enum {
  bundling=0,
  multiplexing
} ANFBmode_t;

172
/// PUCCH-ConfigDedicated from 36.331 RRC spec
173
typedef struct {
174
  /// Flag to indicate ACK NAK repetition activation, see TS 36.213 (10.1). \vr{[0..1]}
175
  uint8_t ackNackRepetition;
176
  /// Parameter: \f$N_\text{ANRep}\f$, see TS 36.213 (10.1).
177
  ACKNAKREP_t repetitionFactor;
178
  /// Parameter: \f$n^{(1)}_\text{PUCCH,ANRep}\f$, see TS 36.213 (10.1). \vr{[0..2047]}
179
  uint16_t n1PUCCH_AN_Rep;
180
  /// Feedback mode, see TS 36.213 (7.3). \details Applied to both PUCCH and PUSCH feedback. For TDD, should always be set to bundling.
181 182 183 184 185
  ANFBmode_t tdd_AckNackFeedbackMode;
} PUCCH_CONFIG_DEDICATED;

/// PUCCH-ConfigCommon from 36.331 RRC spec
typedef struct {
186
  /// Parameter: \f$\Delta^\text{PUCCH}_\text{shift}\f$, see TS 36.211 (5.4.1). \vr{[1..3]} \note the specification sais it is an enumerated value.
187
  uint8_t deltaPUCCH_Shift;
188
  /// Parameter: \f$N^{(2)}_\text{RB}\f$, see TS 36.211 (5.4). \vr{[0..98]}
189
  uint8_t nRB_CQI;
190
  /// Parameter: \f$N^{(1)}_\text{CS}\f$, see TS 36.211 (5.4). \vr{[0..7]}
191
  uint8_t nCS_AN;
192
  /// Parameter: \f$N^{(1)}_\text{PUCCH}\f$ see TS 36.213 (10.1). \vr{[0..2047]}
193
  uint16_t n1PUCCH_AN;
fnabet's avatar
fnabet committed
194 195 196 197 198

  /// group hopping sequence for DRS \note not part of offical UL-PUCCH_CONFIG_COMMON ASN1 specification.
  uint8_t grouphop[20];
  /// sequence hopping sequence for DRS \note not part of offical UL-PUCCH_CONFIG_COMMON ASN1 specification.
  uint8_t seqhop[20];
199 200 201 202
} PUCCH_CONFIG_COMMON;

/// UL-ReferenceSignalsPUSCH from 36.331 RRC spec
typedef struct {
203
  /// Parameter: Group-hopping-enabled, see TS 36.211 (5.5.1.3). \vr{[0..1]}
204
  uint8_t groupHoppingEnabled;
205
  /// Parameter: \f$\Delta SS\f$, see TS 36.211 (5.5.1.3). \vr{[0..29]}
206
  uint8_t groupAssignmentPUSCH;
207
  /// Parameter: Sequence-hopping-enabled, see TS 36.211 (5.5.1.4). \vr{[0..1]}
208
  uint8_t sequenceHoppingEnabled;
209
  /// Parameter: cyclicShift, see TS 36.211 (Table 5.5.2.1.1-2). \vr{[0..7]}
210
  uint8_t cyclicShift;
211
  /// nPRS for cyclic shift of DRS \note not part of offical UL-ReferenceSignalsPUSCH ASN1 specification.
212
  uint8_t nPRS[20];
213
  /// group hopping sequence for DRS \note not part of offical UL-ReferenceSignalsPUSCH ASN1 specification.
214
  uint8_t grouphop[20];
215
  /// sequence hopping sequence for DRS \note not part of offical UL-ReferenceSignalsPUSCH ASN1 specification.
216
  uint8_t seqhop[20];
217
} UL_REFERENCE_SIGNALS_PUSCH_t;
218

219
/// Enumeration for parameter Hopping-mode \ref PUSCH_CONFIG_COMMON::hoppingMode.
laurent's avatar
laurent committed
220
#ifndef OCP_FRAMEWORK
221
typedef enum {
222
  interSubFrame=0,
223 224
  intraAndInterSubFrame=1
} PUSCH_HOPPING_t;
laurent's avatar
laurent committed
225
#endif
226

227
/// PUSCH-ConfigCommon from 36.331 RRC spec.
228
typedef struct {
229
  /// Parameter: \f$N_{sb}\f$, see TS 36.211 (5.3.4). \vr{[1..4]}
230
  uint8_t n_SB;
231
  /// Parameter: Hopping-mode, see TS 36.211 (5.3.4).
232
  PUSCH_HOPPING_t hoppingMode;
233
  /// Parameter: \f$N^{HO}_{RB}\f$, see TS 36.211 (5.3.4). \vr{[0..98]}
234
  uint8_t pusch_HoppingOffset;
235
  /// See TS 36.213 (8.6.1). \vr{[0..1]} 1 indicates 64QAM is allowed, 0 not allowed.
236
  uint8_t enable64QAM;
237 238 239 240
  /// Ref signals configuration
  UL_REFERENCE_SIGNALS_PUSCH_t ul_ReferenceSignalsPUSCH;
} PUSCH_CONFIG_COMMON;

241
/// UE specific PUSCH configuration.
242
typedef struct {
243
  /// Parameter: \f$I^\text{HARQ-ACK}_\text{offset}\f$, see TS 36.213 (Table 8.6.3-1). \vr{[0..15]}
244
  uint16_t betaOffset_ACK_Index;
245
  /// Parameter: \f$I^{RI}_\text{offset}\f$, see TS 36.213 (Table 8.6.3-2). \vr{[0..15]}
246
  uint16_t betaOffset_RI_Index;
247
  /// Parameter: \f$I^{CQI}_\text{offset}\f$, see TS 36.213 (Table 8.6.3-3). \vr{[0..15]}
248
  uint16_t betaOffset_CQI_Index;
249 250
} PUSCH_CONFIG_DEDICATED;

251
/// lola CBA information
252
typedef struct {
253
  ///
254
  uint16_t betaOffset_CA_Index;
255
  ///
256
  uint16_t cShift;
257 258 259 260
} PUSCH_CA_CONFIG_DEDICATED;

/// PDSCH-ConfigCommon from 36.331 RRC spec
typedef struct {
261
  /// Parameter: Reference-signal power, see TS 36.213 (5.2). \vr{[-60..50]}\n Provides the downlink reference-signal EPRE. The actual value in dBm.
262
  int8_t referenceSignalPower;
263
  /// Parameter: \f$P_B\f$, see TS 36.213 (Table 5.2-1). \vr{[0..3]}
264
  uint8_t p_b;
265 266
} PDSCH_CONFIG_COMMON;

267
/// Enumeration for Parameter \f$P_A\f$ \ref PDSCH_CONFIG_DEDICATED::p_a.
268
typedef enum {
269 270 271 272 273 274 275 276
  dBm6=0, ///< (dB-6) corresponds to -6 dB
  dBm477, ///< (dB-4dot77) corresponds to -4.77 dB
  dBm3,   ///< (dB-3) corresponds to -3 dB
  dBm177, ///< (dB-1dot77) corresponds to -1.77 dB
  dB0,    ///< corresponds to 0 dB
  dB1,    ///< corresponds to 1 dB
  dB2,    ///< corresponds to 2 dB
  dB3     ///< corresponds to 3 dB
277 278
} PA_t;

279
/// PDSCH-ConfigDedicated from 36.331 RRC spec
280
typedef struct {
281 282
  /// Parameter: \f$P_A\f$, see TS 36.213 (5.2).
  PA_t p_a;
283 284 285 286
} PDSCH_CONFIG_DEDICATED;

/// SoundingRS-UL-ConfigCommon Information Element from 36.331 RRC spec
typedef struct {
287
  /// enabled flag=1 means SRS is enabled. \vr{[0..1]}
288
  uint8_t enabled_flag;
289
  /// Parameter: SRS Bandwidth Configuration, see TS 36.211 (table 5.5.3.2-1, 5.5.3.2-2, 5.5.3.2-3 and 5.5.3.2-4). \vr{[0..7]}\n Actual configuration depends on UL bandwidth. \note the specification sais it is an enumerated value.
290
  uint8_t srs_BandwidthConfig;
291
  /// Parameter: SRS SubframeConfiguration, see TS 36.211 (table 5.5.3.3-1 for FDD, table 5.5.3.3-2 for TDD). \vr{[0..15]} \note the specification sais it is an enumerated value.
292
  uint8_t srs_SubframeConfig;
293
  /// Parameter: Simultaneous-AN-and-SRS, see TS 36.213 (8.2). \vr{[0..1]}
294
  uint8_t ackNackSRS_SimultaneousTransmission;
295
  /// Parameter: srsMaxUpPts, see TS 36.211 (5.5.3.2). \details If this field is present, reconfiguration of \f$m^\text{max}_\text{SRS,0}\f$ applies for UpPts, otherwise reconfiguration does not apply.
296
  uint8_t srs_MaxUpPts;
297 298
} SOUNDINGRS_UL_CONFIG_COMMON;

299
/// \note UNUSED
300 301 302 303 304 305 306 307 308 309 310
typedef enum {
  ulpc_al0=0,
  ulpc_al04=1,
  ulpc_al05=2,
  ulpc_al06=3,
  ulpc_al07=4,
  ulpc_al08=5,
  ulpc_al09=6,
  ulpc_al11=7
} UL_POWER_CONTROL_COMMON_alpha_t;

311
/// Enumeration for \ref deltaFList_PUCCH_t::deltaF_PUCCH_Format1.
312
typedef enum {
313 314 315
  deltaF_PUCCH_Format1_deltaF_2  = 0,
  deltaF_PUCCH_Format1_deltaF0   = 1,
  deltaF_PUCCH_Format1_deltaF2   = 2
316
} deltaF_PUCCH_Format1_t;
317 318

/// Enumeration for \ref deltaFList_PUCCH_t::deltaF_PUCCH_Format1b.
319
typedef enum {
320 321 322
  deltaF_PUCCH_Format1b_deltaF1  = 0,
  deltaF_PUCCH_Format1b_deltaF3  = 1,
  deltaF_PUCCH_Format1b_deltaF5  = 2
323
} deltaF_PUCCH_Format1b_t;
324 325

/// Enumeration for \ref deltaFList_PUCCH_t::deltaF_PUCCH_Format2.
326
typedef enum {
327 328 329 330
  deltaF_PUCCH_Format2_deltaF_2  = 0,
  deltaF_PUCCH_Format2_deltaF0   = 1,
  deltaF_PUCCH_Format2_deltaF1   = 2,
  deltaF_PUCCH_Format2_deltaF2   = 3
331
} deltaF_PUCCH_Format2_t;
332 333

/// Enumeration for \ref deltaFList_PUCCH_t::deltaF_PUCCH_Format2a.
334
typedef enum {
335 336 337
  deltaF_PUCCH_Format2a_deltaF_2 = 0,
  deltaF_PUCCH_Format2a_deltaF0  = 1,
  deltaF_PUCCH_Format2a_deltaF2  = 2
338
} deltaF_PUCCH_Format2a_t;
339 340

/// Enumeration for \ref deltaFList_PUCCH_t::deltaF_PUCCH_Format2b.
341
typedef enum {
342 343 344
  deltaF_PUCCH_Format2b_deltaF_2 = 0,
  deltaF_PUCCH_Format2b_deltaF0  = 1,
  deltaF_PUCCH_Format2b_deltaF2  = 2
345 346
} deltaF_PUCCH_Format2b_t;

347
/// DeltaFList-PUCCH from 36.331 RRC spec
348
typedef struct {
349 350 351 352 353
  deltaF_PUCCH_Format1_t   deltaF_PUCCH_Format1;
  deltaF_PUCCH_Format1b_t  deltaF_PUCCH_Format1b;
  deltaF_PUCCH_Format2_t   deltaF_PUCCH_Format2;
  deltaF_PUCCH_Format2a_t  deltaF_PUCCH_Format2a;
  deltaF_PUCCH_Format2b_t  deltaF_PUCCH_Format2b;
354 355 356 357
} deltaFList_PUCCH_t;

/// SoundingRS-UL-ConfigDedicated Information Element from 36.331 RRC spec
typedef struct {
358 359 360 361 362 363 364 365
  /// This descriptor is active
  uint8_t active;
  /// This descriptor's frame
  uint16_t frame;
  /// This descriptor's subframe
  uint8_t  subframe;
  /// rnti
  uint16_t rnti;
366
  /// Parameter: \f$B_\text{SRS}\f$, see TS 36.211 (table 5.5.3.2-1, 5.5.3.2-2, 5.5.3.2-3 and 5.5.3.2-4). \vr{[0..3]} \note the specification sais it is an enumerated value.
367
  uint8_t srs_Bandwidth;
368
  /// Parameter: SRS hopping bandwidth \f$b_\text{hop}\in\{0,1,2,3\}\f$, see TS 36.211 (5.5.3.2) \vr{[0..3]} \note the specification sais it is an enumerated value.
369
  uint8_t srs_HoppingBandwidth;
370
  /// Parameter: \f$n_\text{RRC}\f$, see TS 36.211 (5.5.3.2). \vr{[0..23]}
371
  uint8_t freqDomainPosition;
372
  /// Parameter: Duration, see TS 36.213 (8.2). \vr{[0..1]} 0 corresponds to "single" and 1 to "indefinite".
373
  uint8_t duration;
374
  /// Parameter: \f$k_\text{TC}\in\{0,1\}\f$, see TS 36.211 (5.5.3.2). \vr{[0..1]}
375
  uint8_t transmissionComb;
376
  /// Parameter: \f$I_\text{SRS}\f$, see TS 36.213 (table 8.2-1). \vr{[0..1023]}
377
  uint16_t srs_ConfigIndex;
378
  /// Parameter: \f$n^\text{CS}_\text{SRS}\f$. See TS 36.211 (5.5.3.1). \vr{[0..7]} \note the specification sais it is an enumerated value.
379
  uint8_t cyclicShift;
380
  // Parameter: internal implementation: UE SRS configured
fnabet's avatar
fnabet committed
381
  uint8_t srsConfigDedicatedSetup;
Bilel's avatar
Bilel committed
382 383 384 385
  // Parameter: cell srs subframe for internal implementation
  uint8_t srsCellSubframe;
  // Parameter: ue srs subframe for internal implementation
  uint8_t srsUeSubframe;
386 387
} SOUNDINGRS_UL_CONFIG_DEDICATED;

388
/// UplinkPowerControlDedicated Information Element from 36.331 RRC spec
389
typedef struct {
390
  /// Parameter: \f$P_\text{0\_UE\_PUSCH}(1)\f$, see TS 36.213 (5.1.1.1), unit dB. \vr{[-8..7]}\n This field is applicable for non-persistent scheduling, only.
391
  int8_t p0_UE_PUSCH;
392
  /// Parameter: Ks, see TS 36.213 (5.1.1.1). \vr{[0..1]}\n en0 corresponds to value 0 corresponding to state “disabled”. en1 corresponds to value 1.25 corresponding to “enabled”. \note the specification sais it is an enumerated value. \warning the enumeration values do not correspond to the given values in the specification (en1 should be 1.25).
393
  uint8_t deltaMCS_Enabled;
394
  /// Parameter: Accumulation-enabled, see TS 36.213 (5.1.1.1). \vr{[0..1]} 1 corresponds to "enabled" whereas 0 corresponds to "disabled".
395
  uint8_t accumulationEnabled;
396
  /// Parameter: \f$P_\text{0\_UE\_PUCCH}(1)\f$, see TS 36.213 (5.1.2.1), unit dB. \vr{[-8..7]}
397
  int8_t p0_UE_PUCCH;
398
  /// Parameter: \f$P_\text{SRS\_OFFSET}\f$, see TS 36.213 (5.1.3.1). \vr{[0..15]}\n For Ks=1.25 (\ref deltaMCS_Enabled), the actual parameter value is pSRS_Offset value - 3. For Ks=0, the actual parameter value is -10.5 + 1.5*pSRS_Offset value.
399
  int8_t pSRS_Offset;
400
  /// Specifies the filtering coefficient for RSRP measurements used to calculate path loss, as specified in TS 36.213 (5.1.1.1).\details The same filtering mechanism applies as for quantityConfig described in 5.5.3.2. \note the specification sais it is an enumerated value.
401
  uint8_t filterCoefficient;
402 403
} UL_POWER_CONTROL_DEDICATED;

laurent's avatar
laurent committed
404
#ifndef OCP_FRAMEWORK
405
/// Enumeration for parameter \f$\alpha\f$ \ref UL_POWER_CONTROL_CONFIG_COMMON::alpha.
406 407 408 409 410 411 412 413 414 415
typedef enum {
  al0=0,
  al04=1,
  al05=2,
  al06=3,
  al07=4,
  al08=5,
  al09=6,
  al1=7
} PUSCH_alpha_t;
laurent's avatar
laurent committed
416
#endif
417

418
/// \note UNUSED
419 420 421 422 423 424
typedef enum {
  deltaFm2=0,
  deltaF0,
  deltaF1,
  deltaF2,
  deltaF3,
425
  deltaF5
426 427
} deltaF_PUCCH_t;

428
/// UplinkPowerControlCommon Information Element from 36.331 RRC spec \note this structure does not currently make use of \ref deltaFList_PUCCH_t.
429
typedef struct {
430
  /// Parameter: \f$P_\text{0\_NOMINAL\_PUSCH}(1)\f$, see TS 36.213 (5.1.1.1), unit dBm. \vr{[-126..24]}\n This field is applicable for non-persistent scheduling, only.
431
  int8_t p0_NominalPUSCH;
432
  /// Parameter: \f$\alpha\f$, see TS 36.213 (5.1.1.1) \warning the enumeration values do not correspond to the given values in the specification (al04 should be 0.4, ...)!
433
  PUSCH_alpha_t alpha;
434
  /// Parameter: \f$P_\text{0\_NOMINAL\_PUCCH}\f$ See TS 36.213 (5.1.2.1), unit dBm. \vr{[-127..-96]}
435
  int8_t p0_NominalPUCCH;
436
  /// Parameter: \f$\Delta_\text{PREAMBLE\_Msg3}\f$ see TS 36.213 (5.1.1.1). \vr{[-1..6]}\n Actual value = IE value * 2 [dB].
437
  int8_t deltaPreambleMsg3;
438
  /// Parameter: \f$\Delta_\text{F\_PUCCH}(F)\f$ for the PUCCH format 1, see TS 36.213 (5.1.2). \vr{[0..2]} \warning check value range, why is this a long? \note the specification sais it is an enumerated value.
439
  long deltaF_PUCCH_Format1;
440
  /// Parameter: \f$\Delta_\text{F\_PUCCH}(F)\f$ for the PUCCH format 1a, see TS 36.213 (5.1.2). \vr{[0..2]} \warning check value range, why is this a long? \note the specification sais it is an enumerated value.
441
  long deltaF_PUCCH_Format1a;
442
  /// Parameter: \f$\Delta_\text{F\_PUCCH}(F)\f$ for the PUCCH format 1b, see TS 36.213 (5.1.2). \vr{[0..2]} \warning check value range, why is this a long? \note the specification sais it is an enumerated value.
443
  long deltaF_PUCCH_Format1b;
444
  /// Parameter: \f$\Delta_\text{F\_PUCCH}(F)\f$ for the PUCCH format 2, see TS 36.213 (5.1.2). \vr{[0..3]} \warning check value range, why is this a long? \note the specification sais it is an enumerated value.
445
  long deltaF_PUCCH_Format2;
446
  /// Parameter: \f$\Delta_\text{F\_PUCCH}(F)\f$ for the PUCCH format 2a, see TS 36.213 (5.1.2). \vr{[0..2]} \warning check value range, why is this a long? \note the specification sais it is an enumerated value.
447
  long deltaF_PUCCH_Format2a;
448
  /// Parameter: \f$\Delta_\text{F\_PUCCH}(F)\f$ for the PUCCH format 2b, see TS 36.213 (5.1.2). \vr{[0..2]} \warning check value range, why is this a long? \note the specification sais it is an enumerated value.
449 450 451
  long deltaF_PUCCH_Format2b;
} UL_POWER_CONTROL_CONFIG_COMMON;

452
/// Union for \ref TPC_PDCCH_CONFIG::tpc_Index.
453
typedef union {
454 455 456 457
  /// Index of N when DCI format 3 is used. See TS 36.212 (5.3.3.1.6). \vr{[1..15]}
  uint8_t indexOfFormat3;
  /// Index of M when DCI format 3A is used. See TS 36.212 (5.3.3.1.7). \vr{[1..31]}
  uint8_t indexOfFormat3A;
458 459
} TPC_INDEX_t;

460
/// TPC-PDCCH-Config Information Element from 36.331 RRC spec
461
typedef struct {
462
  /// RNTI for power control using DCI format 3/3A, see TS 36.212. \vr{[0..65535]}
463
  uint16_t rnti;
464
  /// Index of N or M, see TS 36.212 (5.3.3.1.6 and 5.3.3.1.7), where N or M is dependent on the used DCI format (i.e. format 3 or 3a).
465 466 467
  TPC_INDEX_t tpc_Index;
} TPC_PDCCH_CONFIG;

468
/// Enumeration for parameter SR transmission \ref SCHEDULING_REQUEST_CONFIG::dsr_TransMax.
469 470 471 472 473 474 475 476
typedef enum {
  sr_n4=0,
  sr_n8=1,
  sr_n16=2,
  sr_n32=3,
  sr_n64=4
} DSR_TRANSMAX_t;

477
/// SchedulingRequestConfig Information Element from 36.331 RRC spec
478
typedef struct {
479
  /// Parameter: \f$n^{(1)}_\text{PUCCH,SRI}\f$, see TS 36.213 (10.1). \vr{[0..2047]}
480
  uint16_t sr_PUCCH_ResourceIndex;
481
  /// Parameter: \f$I_\text{SR}\f$, see TS 36.213 (10.1). \vr{[0..155]}
482
  uint8_t sr_ConfigIndex;
483
  /// Parameter for SR transmission in TS 36.321 (5.4.4). \details The value n4 corresponds to 4 transmissions, n8 corresponds to 8 transmissions and so on.
484 485 486
  DSR_TRANSMAX_t dsr_TransMax;
} SCHEDULING_REQUEST_CONFIG;

487
/// CQI-ReportPeriodic
488
typedef struct {
knopp's avatar
knopp committed
489 490
  /// Parameter: \f$n^{(2)}_\text{PUCCH}\f$, see TS 36.213 (7.2). \vr{[0..1185]}, -1 indicates inactivity
  int16_t cqi_PUCCH_ResourceIndex;
491
  /// Parameter: CQI/PMI Periodicity and Offset Configuration Index \f$I_\text{CQI/PMI}\f$, see TS 36.213 (tables 7.2.2-1A and 7.2.2-1C). \vr{[0..1023]}
knopp's avatar
knopp committed
492
  int16_t cqi_PMI_ConfigIndex;
493
  /// Parameter: K, see 36.213 (4.2.2). \vr{[1..4]}
494
  uint8_t K;
knopp's avatar
knopp committed
495 496
  /// Parameter: RI Config Index \f$I_\text{RI}\f$, see TS 36.213 (7.2.2-1B). \vr{[0..1023]}, -1 indicates inactivity
  int16_t ri_ConfigIndex;
497
  /// Parameter: Simultaneous-AN-and-CQI, see TS 36.213 (10.1). \vr{[0..1]} 1 indicates that simultaneous transmission of ACK/NACK and CQI is allowed.
498
  uint8_t simultaneousAckNackAndCQI;
knopp's avatar
knopp committed
499 500 501 502
  /// parameter computed from Tables 7.2.2-1A and 7.2.2-1C
  uint16_t Npd;
  /// parameter computed from Tables 7.2.2-1A and 7.2.2-1C
  uint16_t N_OFFSET_CQI;
503 504
} CQI_REPORTPERIODIC;

505 506 507 508 509 510 511 512 513 514
/// Enumeration for parameter reporting mode \ref CQI_REPORT_CONFIG::cqi_ReportModeAperiodic.
typedef enum {
  rm12=0,
  rm20=1,
  rm22=2,
  rm30=3,
  rm31=4
} CQI_REPORTMODEAPERIODIC;

/// CQI-ReportConfig Information Element from 36.331 RRC spec
515
typedef struct {
516
  /// Parameter: reporting mode. Value rm12 corresponds to Mode 1-2, rm20 corresponds to Mode 2-0, rm22 corresponds to Mode 2-2 etc. PUSCH reporting modes are described in TS 36.213 [23, 7.2.1].
517
  CQI_REPORTMODEAPERIODIC cqi_ReportModeAperiodic;
518
  /// Parameter: \f$\Delta_\text{offset}\f$, see TS 36.213 (7.2.3). \vr{[-1..6]}\n Actual value = IE value * 2 [dB].
519
  int8_t nomPDSCH_RS_EPRE_Offset;
520 521 522
  CQI_REPORTPERIODIC CQI_ReportPeriodic;
} CQI_REPORT_CONFIG;

523
/// MBSFN-SubframeConfig Information Element from 36.331 RRC spec \note deviates from specification.
524
typedef struct {
525
  /// MBSFN subframe occurance. \details Radio-frames that contain MBSFN subframes occur when equation SFN mod radioFrameAllocationPeriod = radioFrameAllocationOffset is satisfied. When fourFrames is used for subframeAllocation, the equation defines the first radio frame referred to in the description below. Values n1 and n2 are not applicable when fourFrames is used. \note the specification sais it is an enumerated value {n1, n2, n4, n8, n16, n32}.
526
  int radioframeAllocationPeriod;
527
  /// MBSFN subframe occurance. \vr{[0..7]}\n Radio-frames that contain MBSFN subframes occur when equation SFN mod radioFrameAllocationPeriod = radioFrameAllocationOffset is satisfied. When fourFrames is used for subframeAllocation, the equation defines the first radio frame referred to in the description below. Values n1 and n2 are not applicable when fourFrames is used.
528
  int radioframeAllocationOffset;
529
  /// oneFrame or fourFrames. \vr{[0..1]}
530
  int fourFrames_flag;
531 532 533 534 535
  /// Subframe configuration. \vr{[0..63]} (\ref fourFrames_flag == 0) or \vr{[0..16777215]} (\ref fourFrames_flag == 1)
  /// \par fourFrames_flag == 0
  /// "1" denotes that the corresponding subframe is allocated for MBSFN. The following mapping applies:\n FDD: The first/leftmost bit defines the MBSFN allocation for subframe #1, the second bit for #2, third bit for #3 , fourth bit for #6, fifth bit for #7, sixth bit for #8.\n TDD: The first/leftmost bit defines the allocation for subframe #3, the second bit for #4, third bit for #7, fourth bit for #8, fifth bit for #9. Uplink subframes are not allocated. The last bit is not used.
  /// \par fourFrames_flag == 1
  /// A bit-map indicating MBSFN subframe allocation in four consecutive radio frames, "1" denotes that the corresponding subframe is allocated for MBSFN. The bitmap is interpreted as follows:\n FDD: Starting from the first radioframe and from the first/leftmost bit in the bitmap, the allocation applies to subframes #1, #2, #3 , #6, #7, and #8 in the sequence of the four radio-frames.\n TDD: Starting from the first radioframe and from the first/leftmost bit in the bitmap, the allocation applies to subframes #3, #4, #7, #8, and #9 in the sequence of the four radio-frames. The last four bits are not used. Uplink subframes are not allocated.
536 537 538 539 540
  int mbsfn_SubframeConfig;
} MBSFN_config_t;

typedef struct {
  /// Number of resource blocks (RB) in DL
541
  uint8_t N_RB_DL;
542
  /// Number of resource blocks (RB) in UL
543
  uint8_t N_RB_UL;
544 545 546 547 548 549 550 551 552 553
  /// 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;
554 555 556
  ///  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
557
  uint8_t N_RBGS;
558
  /// Cell ID
559
  uint16_t Nid_cell;
560
  /// MBSFN Area ID
561
  uint16_t Nid_cell_mbsfn;
562 563 564
  /// Cyclic Prefix for DL (0=Normal CP, 1=Extended CP)
  lte_prefix_type_t Ncp;
  /// Cyclic Prefix for UL (0=Normal CP, 1=Extended CP)
565
  lte_prefix_type_t Ncp_UL;
566
  /// shift of pilot position in one RB
567
  uint8_t nushift;
568 569 570
  /// 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)
571
  uint8_t tdd_config;
572
  /// TDD S-subframe configuration (0-9)
573
  uint8_t tdd_config_S;
574 575
  /// srs extra symbol flag for TDD
  uint8_t srsX;
576
  /// indicates if node is a UE (NODE=2) or eNB (PRIMARY_CH=0).
577
  uint8_t node_id;
578 579
  /// Indicator that 20 MHz channel uses 3/4 sampling frequency
  uint8_t threequarter_fs;
580
  /// Size of FFT
581
  uint16_t ofdm_symbol_size;
582
  /// Number of prefix samples in all but first symbol of slot
583
  uint16_t nb_prefix_samples;
584
  /// Number of prefix samples in first symbol of slot
585
  uint16_t nb_prefix_samples0;
586
  /// Carrier offset in FFT buffer for first RE in PRB0
587
  uint16_t first_carrier_offset;
588
  /// Number of samples in a subframe
589
  uint32_t samples_per_tti;
590
  /// Number of OFDM/SC-FDMA symbols in one subframe (to be modified to account for potential different in UL/DL)
591
  uint16_t symbols_per_tti;
592 593 594 595
  /// Number of OFDM symbols in DL portion of S-subframe
  uint16_t dl_symbols_in_S_subframe;
  /// Number of SC-FDMA symbols in UL portion of S-subframe
  uint16_t ul_symbols_in_S_subframe;
Xiwen JIANG's avatar
Xiwen JIANG committed
596
  /// Number of Physical transmit antennas in node
597
  uint8_t nb_antennas_tx;
598
  /// Number of Receive antennas in node
599
  uint8_t nb_antennas_rx;
600
  /// Number of common transmit antenna ports in eNodeB (1 or 2)
Xiwen JIANG's avatar
Xiwen JIANG committed
601
  uint8_t nb_antenna_ports_eNB;
602 603
  /// PRACH_CONFIG
  PRACH_CONFIG_COMMON prach_config_common;
604 605 606 607
#ifdef Rel14
  /// PRACH_eMTC_CONFIG
  PRACH_eMTC_CONFIG_COMMON prach_emtc_config_common;
#endif
608 609 610 611 612 613 614 615 616 617 618 619 620 621
  /// PUCCH Config Common (from 36-331 RRC spec)
  PUCCH_CONFIG_COMMON pucch_config_common;
  /// PDSCH Config Common (from 36-331 RRC spec)
  PDSCH_CONFIG_COMMON pdsch_config_common;
  /// PUSCH Config Common (from 36-331 RRC spec)
  PUSCH_CONFIG_COMMON pusch_config_common;
  /// PHICH Config (from 36-331 RRC spec)
  PHICH_CONFIG_COMMON phich_config_common;
  /// SRS Config (from 36-331 RRC spec)
  SOUNDINGRS_UL_CONFIG_COMMON soundingrs_ul_config_common;
  /// UL Power Control (from 36-331 RRC spec)
  UL_POWER_CONTROL_CONFIG_COMMON ul_power_control_config_common;
  /// Number of MBSFN Configurations
  int num_MBSFN_config;
622
  /// Array of MBSFN Configurations (max 8 (maxMBSFN-Allocations) elements as per 36.331)
623 624
  MBSFN_config_t MBSFN_config[8];
  /// Maximum Number of Retransmissions of RRCConnectionRequest (from 36-331 RRC Spec)
625
  uint8_t maxHARQ_Msg3Tx;
626
  /// Size of SI windows used for repetition of one SI message (in frames)
627
  uint8_t SIwindowsize;
628
  /// Period of SI windows used for repetition of one SI message (in frames)
629
  uint16_t SIPeriod;
630
  /// REGs assigned to PCFICH
631
  uint16_t pcfich_reg[4];
632
  /// Index of first REG assigned to PCFICH
633
  uint8_t pcfich_first_reg_idx;
634
  /// REGs assigned to PHICH
635
  uint16_t phich_reg[MAX_NUM_PHICH_GROUPS][3];
636 637 638 639 640 641

  struct MBSFN_SubframeConfig *mbsfn_SubframeConfig[MAX_MBSFN_AREA];

} LTE_DL_FRAME_PARMS;

typedef enum {
642
  /// TM1
643
  SISO=0,
644
  /// TM2
645
  ALAMOUTI=1,
646
  /// TM3
647
  LARGE_CDD=2,
648
  /// the next 6 entries are for TM5
649 650 651 652 653 654
  UNIFORM_PRECODING11=3,
  UNIFORM_PRECODING1m1=4,
  UNIFORM_PRECODING1j=5,
  UNIFORM_PRECODING1mj=6,
  PUSCH_PRECODING0=7,
  PUSCH_PRECODING1=8,
655
  /// the next 3 entries are for TM4
656 657
  DUALSTREAM_UNIFORM_PRECODING1=9,
  DUALSTREAM_UNIFORM_PRECODINGj=10,
knopp's avatar
knopp committed
658
  DUALSTREAM_PUSCH_PRECODING=11,
659 660 661
  TM7=12,
  TM8=13,
  TM9_10=14
662 663
} MIMO_mode_t;

knopp's avatar
knopp committed
664

665 666 667 668 669 670 671 672
typedef enum {
  /// MRT
  MRT=0,
  /// ZF
  ZF=1,
  /// MMSE
  MMSE=2
} PRECODE_TYPE_t;
knopp's avatar
knopp committed
673

674
typedef struct {
675 676 677 678 679 680 681 682
  /// \brief Pointers (dynamic) to the received data in the time domain.
  /// - first index: rx antenna [0..nb_antennas_rx[
  /// - second index: ? [0..2*ofdm_symbol_size*frame_parms->symbols_per_tti[
  int32_t **rxdata;
  /// \brief Pointers (dynamic) to the received data in the frequency domain.
  /// - first index: rx antenna [0..nb_antennas_rx[
  /// - second index: ? [0..2*ofdm_symbol_size*frame_parms->symbols_per_tti[
  int32_t **rxdataF;
683
  /// \brief holds the transmit data in the frequency domain.
Xiwen JIANG's avatar
Xiwen JIANG committed
684
  /// For IFFT_FPGA this points to the same memory as PHY_vars->rx_vars[a].RX_DMA_BUFFER. //?
685
  /// - first index: eNB id [0..2] (hard coded)
Xiwen JIANG's avatar
Xiwen JIANG committed
686
  /// - second index: tx antenna [0..14[ where 14 is the total supported antenna ports.
687
  /// - third index: sample [0..]
knopp's avatar
knopp committed
688
  int32_t **txdataF;
689 690
} LTE_eNB_COMMON;

knopp's avatar
knopp committed
691 692 693 694 695
typedef struct {
  /// \brief Holds the transmit data in the frequency domain.
  /// - first index: rx antenna [0..nb_antennas_rx[
  /// - second index: ? [0..2*ofdm_symbol_size*frame_parms->symbols_per_tti[
  int32_t **txdata;
Xiwen JIANG's avatar
Xiwen JIANG committed
696
  /// \brief holds the transmit data after beamforming in the frequency domain.
697 698
  /// - first index: tx antenna [0..nb_antennas_tx[
  /// - second index: sample [0..]
699
  int32_t **txdataF_BF;
700 701 702 703
  /// \brief holds the transmit data before beamforming for epdcch/mpdcch
  /// - first index : tx antenna [0..nb_epdcch_antenna_ports[
  /// - second index: sampl [0..]
  int32_t **txdataF_epdcch;
knopp's avatar
knopp committed
704 705 706 707
  /// \brief Holds the receive data in the frequency domain.
  /// - first index: rx antenna [0..nb_antennas_rx[
  /// - second index: ? [0..2*ofdm_symbol_size*frame_parms->symbols_per_tti[
  int32_t **rxdata;
708
  /// \brief Holds the last subframe of received data in time domain after removal of 7.5kHz frequency offset.
709 710 711
  /// - first index: rx antenna [0..nb_antennas_rx[
  /// - second index: sample [0..samples_per_tti[
  int32_t **rxdata_7_5kHz;
712
  /// \brief Holds the received data in the frequency domain.
713 714 715
  /// - first index: rx antenna [0..nb_antennas_rx[
  /// - second index: ? [0..2*ofdm_symbol_size*frame_parms->symbols_per_tti[
  int32_t **rxdataF;
716
  /// \brief Holds output of the sync correlator.
717
  /// - first index: sample [0..samples_per_tti*10[
718
  uint32_t *sync_corr;
719 720
  /// \brief Holds the tdd reciprocity calibration coefficients 
  /// - first index: eNB id [0..2] (hard coded) 
721 722
  /// - second index: tx antenna [0..nb_antennas_tx[
  /// - third index: frequency [0..]
723 724
  int32_t **tdd_calib_coeffs;
} RU_COMMON;
knopp's avatar
knopp committed
725

726 727 728 729 730 731 732 733 734 735 736 737 738 739
typedef enum {format0,
              format1,
              format1A,
              format1B,
              format1C,
              format1D,
              format1E_2A_M10PRB,
              format2,
              format2A,
              format2B,
              format2C,
              format2D,
              format3,
	      format3A,
740 741 742 743 744 745 746
	      format4,
              format5,
              format6_0A,
              format6_0B,
              format6_1A,
              format6_1B,
              format6_2
747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767
             } DCI_format_t;

typedef struct {
  /// Length of DCI in bits
  uint8_t dci_length;
  /// Aggregation level
  uint8_t L;
  /// Position of first CCE of the dci
  int firstCCE;
  /// flag to indicate that this is a RA response
  boolean_t ra_flag;
  /// rnti
  rnti_t rnti;
  /// harq_pid
  rnti_t harq_pid;
  /// Format
  DCI_format_t format;
  /// DCI pdu
  uint8_t dci_pdu[8];
} DCI_ALLOC_t;

768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819
#define MAX_EPDCCH_PRB 8

typedef struct {
  /// Length of DCI in bits
  uint8_t dci_length;
  /// Aggregation level
  uint8_t L;
  /// Position of first CCE of the dci
  int firstCCE;
  /// flag to indicate that this is a RA response
  boolean_t ra_flag;
  /// rnti
  rnti_t rnti;
  /// Format
  DCI_format_t format;
  /// epdcch resource assignment (0=localized,1=distributed) 
  uint8_t epdcch_resource_assignment_flag;
  /// epdcch index
  uint16_t epdcch_id;
  /// epdcch start symbol
  uint8_t epdcch_start_symbol;
  /// epdcch number of PRBs in set
  uint8_t epdcch_num_prb;
  /// vector of prb ids for set
  uint8_t epdcch_prb_index[MAX_EPDCCH_PRB];  
  /// LBT parameter for frame configuration
  uint8_t dwpts_symbols;
  /// LBT parameter for frame configuration
  uint8_t initial_lbt_sf;
  /// DCI pdu
  uint8_t dci_pdu[8];
} eDCI_ALLOC_t;
 
typedef struct {
  /// Length of DCI in bits
  uint8_t dci_length;
  /// Aggregation level
  uint8_t L;
  /// Position of first CCE of the dci
  int firstCCE;
  /// flag to indicate that this is a RA response
  boolean_t ra_flag;
  /// rnti
  rnti_t rnti;
  /// Format
  DCI_format_t format;
  /// harq process index
  uint8_t harq_pid;
  /// Narrowband index
  uint8_t narrowband;
  /// number of PRB pairs for MPDCCH
  uint8_t number_of_prb_pairs;
820
  /// mpdcch resource assignement (combinatorial index r)
821
  uint8_t resource_block_assignment;
822
  /// transmission type (0=localized,1=distributed) 
823 824 825 826 827 828 829 830
  uint8_t transmission_type;
  /// mpdcch start symbol
  uint8_t start_symbol;
  /// CE mode (1=ModeA,2=ModeB)
  uint8_t ce_mode;
  /// 0-503 n_EPDCCHid_i
  uint16_t dmrs_scrambling_init;
  /// Absolute subframe of the initial transmission (0-10239)
831 832 833 834 835
  uint16_t i0;
  /// number of mdpcch repetitions
  uint16_t reps;
  /// current absolute subframe number
  uint16_t absSF;
836 837 838 839
  /// DCI pdu
  uint8_t dci_pdu[8];
} mDCI_ALLOC_t;

840 841 842 843 844 845 846

typedef struct {
  uint8_t     num_dci;
  uint8_t     num_pdcch_symbols; 
  DCI_ALLOC_t dci_alloc[32];
} LTE_eNB_PDCCH;

847 848 849 850 851 852 853 854 855 856
typedef struct {
  uint8_t hi;
  uint8_t first_rb;
  uint8_t n_DMRS;
} phich_config_t;

typedef struct {
  uint8_t num_hi;
  phich_config_t config[32];
} LTE_eNB_PHICH;
857 858

typedef struct {
859 860 861
  uint8_t     num_dci;
  eDCI_ALLOC_t edci_alloc[32];
} LTE_eNB_EPDCCH;
862

863
typedef struct {
864
  /// number of active MPDCCH allocations
865
  uint8_t     num_dci;
866
  /// MPDCCH DCI allocations from MAC
867
  mDCI_ALLOC_t mdci_alloc[32];
868 869
  // MAX SIZE of an EPDCCH set is 16EREGs * 9REs/EREG * 8 PRB pairs = 2304 bits 
  uint8_t e[2304];
870
} LTE_eNB_MPDCCH;
871

872

873
typedef struct {
874
  /// \brief Hold the channel estimates in frequency domain based on SRS.
knopp's avatar
knopp committed
875 876 877
  /// - first index: rx antenna id [0..nb_antennas_rx[
  /// - second index: ? [0..ofdm_symbol_size[
  int32_t **srs_ch_estimates;
878
  /// \brief Hold the channel estimates in time domain based on SRS.
knopp's avatar
knopp committed
879 880 881
  /// - first index: rx antenna id [0..nb_antennas_rx[
  /// - second index: ? [0..2*ofdm_symbol_size[
  int32_t **srs_ch_estimates_time;
882
  /// \brief Holds the SRS for channel estimation at the RX.
knopp's avatar
knopp committed
883 884
  /// - first index: rx antenna id [0..nb_antennas_rx[
  /// - second index: ? [0..ofdm_symbol_size[
885
  int32_t *srs;
886 887
} LTE_eNB_SRS;

888
typedef struct {
889
  /// \brief Holds the received data in the frequency domain for the allocated RBs in repeated format.
knopp's avatar
knopp committed
890 891 892
  /// - first index: rx antenna id [0..nb_antennas_rx[
  /// - second index: ? [0..2*ofdm_symbol_size[
  int32_t **rxdataF_ext;
893
  /// \brief Holds the received data in the frequency domain for the allocated RBs in normal format.
knopp's avatar
knopp committed
894 895 896
  /// - first index: rx antenna id [0..nb_antennas_rx[
  /// - second index (definition from phy_init_lte_eNB()): ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[
  int32_t **rxdataF_ext2;
897
  /// \brief Hold the channel estimates in time domain based on DRS.
knopp's avatar
knopp committed
898 899 900
  /// - first index: rx antenna id [0..nb_antennas_rx[
  /// - second index: ? [0..4*ofdm_symbol_size[
  int32_t **drs_ch_estimates_time;
901
  /// \brief Hold the channel estimates in frequency domain based on DRS.
knopp's avatar
knopp committed
902 903 904
  /// - first index: rx antenna id [0..nb_antennas_rx[
  /// - second index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[
  int32_t **drs_ch_estimates;
905
  /// \brief Holds the compensated signal.
knopp's avatar
knopp committed
906 907 908 909 910 911 912 913 914 915 916
  /// - first index: rx antenna id [0..nb_antennas_rx[
  /// - second index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[
  int32_t **rxdataF_comp;
  /// \brief Magnitude of the UL channel estimates. Used for 2nd-bit level thresholds in LLR computation
  /// - first index: rx antenna id [0..nb_antennas_rx[
  /// - second index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[
  int32_t **ul_ch_mag;
  /// \brief Magnitude of the UL channel estimates scaled for 3rd bit level thresholds in LLR computation
  /// - first index: rx antenna id [0..nb_antennas_rx[
  /// - second index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[
  int32_t **ul_ch_magb;
917 918
  /// measured RX power based on DRS
  int ulsch_power[2];
919 920
  /// \brief llr values.
  /// - first index: ? [0..1179743] (hard coded)
921
  int16_t *llr;
922 923
} LTE_eNB_PUSCH;

924 925
typedef struct {

926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941
  /// \brief Holds the received data in the frequency domain.
  /// - first index: rx antenna [0..nb_antennas_rx[
  /// - second index: symbol [0..28*ofdm_symbol_size[
  int32_t **rxdataF;
  
  /// \brief Hold the channel estimates in frequency domain.
  /// - first index: eNB id [0..6] (hard coded)
  /// - second index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
  /// - third index: samples? [0..symbols_per_tti*(ofdm_symbol_size+LTE_CE_FILTER_LENGTH)[
  int32_t **dl_ch_estimates[7];
  
  /// \brief Hold the channel estimates in time domain (used for tracking).
  /// - first index: eNB id [0..6] (hard coded)
  /// - second index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
  /// - third index: samples? [0..2*ofdm_symbol_size[
  int32_t **dl_ch_estimates_time[7];
942 943
}LTE_UE_COMMON_PER_THREAD;

944
typedef struct {
945 946 947 948
  /// \brief Holds the transmit data in time domain.
  /// For IFFT_FPGA this points to the same memory as PHY_vars->tx_vars[a].TX_DMA_BUFFER.
  /// - first index: tx antenna [0..nb_antennas_tx[
  /// - second index: sample [0..FRAME_LENGTH_COMPLEX_SAMPLES[
949
  int32_t **txdata;
950 951 952 953
  /// \brief Holds the transmit data in the frequency domain.
  /// For IFFT_FPGA this points to the same memory as PHY_vars->rx_vars[a].RX_DMA_BUFFER.
  /// - first index: tx antenna [0..nb_antennas_tx[
  /// - second index: sample [0..FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX[
954
  int32_t **txdataF;
955

956 957 958 959
  /// \brief Holds the received data in time domain.
  /// Should point to the same memory as PHY_vars->rx_vars[a].RX_DMA_BUFFER.
  /// - first index: rx antenna [0..nb_antennas_rx[
  /// - second index: sample [0..FRAME_LENGTH_COMPLEX_SAMPLES+2048[
960
  int32_t **rxdata;
961

962
  LTE_UE_COMMON_PER_THREAD common_vars_rx_data_per_thread[RX_NB_TH_MAX];
963

964
  /// holds output of the sync correlator
965
  int32_t *sync_corr;
966
  /// estimated frequency offset (in radians) for all subcarriers
967
  int32_t freq_offset;
968
  /// eNb_id user is synched to
969
  int32_t eNb_id;
970 971 972
} LTE_UE_COMMON;

typedef struct {
973 974 975
  /// \brief Received frequency-domain signal after extraction.
  /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
  /// - second index: ? [0..168*N_RB_DL[
976
  int32_t **rxdataF_ext;
977 978 979 980
  /// \brief Received frequency-domain ue specific pilots.
  /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
  /// - second index: ? [0..12*N_RB_DL[
  int32_t **rxdataF_uespec_pilots;
981 982 983
  /// \brief Received frequency-domain signal after extraction and channel compensation.
  /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
  /// - second index: ? [0..168*N_RB_DL[
984
  int32_t **rxdataF_comp0;
985 986 987 988
  /// \brief Received frequency-domain signal after extraction and channel compensation for the second stream. For the SIC receiver we need to store the history of this for each harq process and round
  /// - first index: ? [0..7] (hard coded) accessed via \c harq_pid
  /// - second index: ? [0..7] (hard coded) accessed via \c round
  /// - third index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
989
  /// - fourth index: ? [0..168*N_RB_DL[
990
  int32_t **rxdataF_comp1[8][8];
991 992 993
  /// \brief Downlink channel estimates extracted in PRBS.
  /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
  /// - second index: ? [0..168*N_RB_DL[
994
  int32_t **dl_ch_estimates_ext;
995 996 997 998 999 1000
  /// \brief Downlink cross-correlation of MIMO channel estimates (unquantized PMI) extracted in PRBS. For the SIC receiver we need to store the history of this for each harq process and round
  /// - first index: ? [0..7] (hard coded) accessed via \c harq_pid
  /// - second index: ? [0..7] (hard coded) accessed via \c round
  /// - third index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
  /// - fourth index: ? [0..168*N_RB_DL[
  int32_t **dl_ch_rho_ext[8][8];
1001 1002 1003 1004 1005 1006 1007 1008
  /// \brief Downlink beamforming channel estimates in frequency domain.
  /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
  /// - second index: samples? [0..symbols_per_tti*(ofdm_symbol_size+LTE_CE_FILTER_LENGTH)[
  int32_t **dl_bf_ch_estimates;
  /// \brief Downlink beamforming channel estimates.
  /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
  /// - second index: ? [0..168*N_RB_DL[
  int32_t **dl_bf_ch_estimates_ext;
1009 1010 1011
  /// \brief Downlink cross-correlation of MIMO channel estimates (unquantized PMI) extracted in PRBS.
  /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
  /// - second index: ? [0..168*N_RB_DL[
1012
  int32_t **dl_ch_rho2_ext;
1013 1014
  /// \brief Downlink PMIs extracted in PRBS and grouped in subbands.
  /// - first index: ressource block [0..N_RB_DL[
1015
  uint8_t *pmi_ext;
1016 1017 1018
  /// \brief Magnitude of Downlink Channel first layer (16QAM level/First 64QAM level).
  /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
  /// - second index: ? [0..168*N_RB_DL[
1019
  int32_t **dl_ch_mag0;
1020 1021 1022
  /// \brief Magnitude of Downlink Channel second layer (16QAM level/First 64QAM level).
  /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
  /// - second index: ? [0..168*N_RB_DL[
1023
  int32_t **dl_ch_mag1[8][8];
1024 1025 1026
  /// \brief Magnitude of Downlink Channel, first layer (2nd 64QAM level).
  /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
  /// - second index: ? [0..168*N_RB_DL[
1027
  int32_t **dl_ch_magb0;
1028 1029 1030
  /// \brief Magnitude of Downlink Channel second layer (2nd 64QAM level).
  /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
  /// - second index: ? [0..168*N_RB_DL[
1031
  int32_t **dl_ch_magb1[8][8];
1032 1033 1034
  /// \brief Cross-correlation of two eNB signals.
  /// - first index: rx antenna [0..nb_antennas_rx[
  /// - second index: symbol [0..]
1035
  int32_t **rho;
1036
  /// never used... always send dl_ch_rho_ext instead...
1037
  int32_t **rho_i;
1038 1039 1040
  /// \brief Pointers to llr vectors (2 TBs).
  /// - first index: ? [0..1] (hard coded)
  /// - second index: ? [0..1179743] (hard coded)
1041
  int16_t *llr[2];
1042
  /// \f$\log_2(\max|H_i|^2)\f$
1043
  int16_t log2_maxh;
1044 1045 1046 1047
    /// \f$\log_2(\max|H_i|^2)\f$ //this is for TM3-4 layer1 channel compensation
  int16_t log2_maxh0;
    /// \f$\log_2(\max|H_i|^2)\f$ //this is for TM3-4 layer2 channel commpensation
  int16_t log2_maxh1;
1048 1049
  /// \brief LLR shifts for subband scaling.
  /// - first index: ? [0..168*N_RB_DL[
1050
  uint8_t *llr_shifts;
1051 1052
  /// \brief Pointer to LLR shifts.
  /// - first index: ? [0..168*N_RB_DL[
1053
  uint8_t *llr_shifts_p;
1054 1055 1056
  /// \brief Pointers to llr vectors (128-bit alignment).
  /// - first index: ? [0..0] (hard coded)
  /// - second index: ? [0..]
1057
  int16_t **llr128;
1058 1059 1060 1061
  /// \brief Pointers to llr vectors (128-bit alignment).
  /// - first index: ? [0..0] (hard coded)
  /// - second index: ? [0..]
  int16_t **llr128_2ndstream;
1062 1063
  //uint32_t *rb_alloc;
  //uint8_t Qm[2];
1064
  //MIMO_mode_t mimo_mode;
1065 1066 1067 1068
  // llr offset per ofdm symbol
  uint32_t llr_offset[14];
  // llr length per ofdm symbol
  uint32_t llr_length[14];
1069 1070 1071
} LTE_UE_PDSCH;

typedef struct {
1072 1073 1074
  /// \brief Received frequency-domain signal after extraction.
  /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
  /// - second index: ? [0..]
1075
  int32_t **rxdataF_ext;
1076 1077 1078
  /// \brief Received frequency-domain signal after extraction and channel compensation.
  /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
  /// - second index: ? [0..]
1079
  double **rxdataF_comp;
1080 1081 1082
  /// \brief Downlink channel estimates extracted in PRBS.
  /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
  /// - second index: ? [0..]
1083
  int32_t **dl_ch_estimates_ext;
1084 1085 1086
  ///  \brief Downlink cross-correlation of MIMO channel estimates (unquantized PMI) extracted in PRBS.
  /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
  /// - second index: ? [0..]
1087
  double **dl_ch_rho_ext;
1088 1089
  /// \brief Downlink PMIs extracted in PRBS and grouped in subbands.
  /// - first index: ressource block [0..N_RB_DL[
1090
  uint8_t *pmi_ext;
1091 1092 1093
  /// \brief Magnitude of Downlink Channel (16QAM level/First 64QAM level).
  /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
  /// - second index: ? [0..]
1094
  double **dl_ch_mag;
1095 1096 1097
  /// \brief Magnitude of Downlink Channel (2nd 64QAM level).
  /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
  /// - second index: ? [0..]
1098
  double **dl_ch_magb;
1099 1100 1101
  /// \brief Cross-correlation of two eNB signals.
  /// - first index: rx antenna [0..nb_antennas_rx[
  /// - second index: ? [0..]
1102 1103
  double **rho;
  /// never used... always send dl_ch_rho_ext instead...
1104
  double **rho_i;
1105 1106 1107
  /// \brief Pointers to llr vectors (2 TBs).
  /// - first index: ? [0..1] (hard coded)
  /// - second index: ? [0..1179743] (hard coded)
1108
  int16_t *llr[2];
1109
  /// \f$\log_2(\max|H_i|^2)\f$
1110
  uint8_t log2_maxh;
1111 1112 1113
  /// \brief Pointers to llr vectors (128-bit alignment).
  /// - first index: ? [0..0] (hard coded)
  /// - second index: ? [0..]
1114 1115 1116
  int16_t **llr128;
  //uint32_t *rb_alloc;
  //uint8_t Qm[2];
1117 1118 1119 1120
  //MIMO_mode_t mimo_mode;
} LTE_UE_PDSCH_FLP;

typedef struct {
1121
  /// \brief Pointers to extracted PDCCH symbols in frequency-domain.
1122 1123
  /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
  /// - second index: ? [0..168*N_RB_DL[
1124
  int32_t **rxdataF_ext;
1125 1126 1127
  /// \brief Pointers to extracted and compensated PDCCH symbols in frequency-domain.
  /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
  /// - second index: ? [0..168*N_RB_DL[
1128
  int32_t **rxdataF_comp;
1129 1130 1131
  /// \brief Pointers to extracted channel estimates of PDCCH symbols.
  /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
  /// - second index: ? [0..168*N_RB_DL[
1132
  int32_t **dl_ch_estimates_ext;
1133 1134 1135
  /// \brief Pointers to channel cross-correlation vectors for multi-eNB detection.
  /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
  /// - second index: ? [0..168*N_RB_DL[
1136
  int32_t **dl_ch_rho_ext;
1137 1138 1139
  /// \brief Pointers to channel cross-correlation vectors for multi-eNB detection.
  /// - first index: rx antenna [0..nb_antennas_rx[
  /// - second index: ? [0..]
1140
  int32_t **rho;
1141 1142
  /// \brief Pointer to llrs, 4-bit resolution.
  /// - first index: ? [0..48*N_RB_DL[
1143
  uint16_t *llr;
1144 1145
  /// \brief Pointer to llrs, 16-bit resolution.
  /// - first index: ? [0..96*N_RB_DL[
1146
  uint16_t *llr16;
1147 1148
  /// \brief \f$\overline{w}\f$ from 36-211.
  /// - first index: ? [0..48*N_RB_DL[
1149
  uint16_t *wbar;
1150 1151
  /// \brief PDCCH/DCI e-sequence (input to rate matching).
  /// - first index: ? [0..96*N_RB_DL[
1152
  int8_t *e_rx;
1153
  /// number of PDCCH symbols in current subframe
1154
  uint8_t num_pdcch_symbols;
1155
  /// Allocated CRNTI for UE
1156
  uint16_t crnti;
1157 1158
  /// 1: the allocated crnti is Temporary C-RNTI / 0: otherwise
  uint8_t crnti_is_temporary;
1159
  /// Total number of PDU errors (diagnostic mode)
1160
  uint32_t dci_errors;
1161
  /// Total number of PDU received
1162
  uint32_t dci_received;
1163
  /// Total number of DCI False detection (diagnostic mode)
1164
  uint32_t dci_false;
1165
  /// Total number of DCI missed (diagnostic mode)
1166
  uint32_t dci_missed;
1167
  /// nCCE for PUCCH per subframe
1168
  uint8_t nCCE[10];
1169 1170 1171
  //Check for specific DCIFormat and AgregationLevel
  uint8_t dciFormat;
  uint8_t agregationLevel;
1172 1173 1174 1175
} LTE_UE_PDCCH;

#define PBCH_A 24
typedef struct {
1176 1177 1178
  uint8_t pbch_d[96+(3*(16+PBCH_A))];
  uint8_t pbch_w[3*3*(16+PBCH_A)];
  uint8_t pbch_e[1920];
1179 1180 1181
} LTE_eNB_PBCH;

typedef struct {
1182 1183 1184
  /// \brief Pointers to extracted PBCH symbols in frequency-domain.
  /// - first index: rx antenna [0..nb_antennas_rx[
  /// - second index: ? [0..287] (hard coded)
1185
  int32_t **rxdataF_ext;
1186 1187 1188
  /// \brief Pointers to extracted and compensated PBCH symbols in frequency-domain.
  /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
  /// - second index: ? [0..287] (hard coded)
1189
  int32_t **rxdataF_comp;
1190 1191 1192
  /// \brief Pointers to downlink channel estimates in frequency-domain extracted in PRBS.
  /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
  /// - second index: ? [0..287] (hard coded)
1193
  int32_t **dl_ch_estimates_ext;
1194 1195
  /// \brief Pointer to PBCH llrs.
  /// - first index: ? [0..1919] (hard coded)
1196
  int8_t *llr;
1197 1198
  /// \brief Pointer to PBCH decoded output.
  /// - first index: ? [0..63] (hard coded)
1199
  uint8_t *decoded_output;
1200
  /// \brief Total number of PDU errors.
1201
  uint32_t pdu_errors;
1202
  /// \brief Total number of PDU errors 128 frames ago.
1203
  uint32_t pdu_errors_last;
1204
  /// \brief Total number of consecutive PDU errors.
1205
  uint32_t pdu_errors_conseq;
1206
  /// \brief FER (in percent) .
gauthier's avatar