impl_defs_lte.h 48.6 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 38 39 40 41 42 43

/*! \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"
//#include "defs.h"

#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
44
#define TX_RX_SWITCH_SYMBOL (NUMBER_OF_SYMBOLS_PER_FRAME>>1)
45 46 47 48 49 50 51 52 53 54 55 56
#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

laurent's avatar
laurent committed
57 58 59
#ifdef OCP_FRAMEWORK
#include "enums.h"
#else
60 61 62 63
typedef enum {TDD=1,FDD=0} lte_frame_type_t;

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

64 65
typedef enum {LOCALIZED=0,DISTRIBUTED=1} vrb_t;

66
/// Enumeration for parameter PHICH-Duration \ref PHICH_CONFIG_COMMON::phich_duration.
67 68 69 70 71
typedef enum {
  normal=0,
  extended=1
} PHICH_DURATION_t;

72
/// Enumeration for parameter Ng \ref PHICH_CONFIG_COMMON::phich_resource.
73 74 75 76 77 78
typedef enum {
  oneSixth=1,
  half=3,
  one=6,
  two=12
} PHICH_RESOURCE_t;
laurent's avatar
laurent committed
79
#endif
80
/// PHICH-Config from 36.331 RRC spec
81
typedef struct {
82
  /// Parameter: PHICH-Duration, see TS 36.211 (Table 6.9.3-1).
83
  PHICH_DURATION_t phich_duration;
84
  /// Parameter: Ng, see TS 36.211 (6.9). \details Value oneSixth corresponds to 1/6, half corresponds to 1/2 and so on.
85 86 87
  PHICH_RESOURCE_t phich_resource;
} PHICH_CONFIG_COMMON;

88
/// PRACH-ConfigInfo from 36.331 RRC spec
89
typedef struct {
90
  /// Parameter: prach-ConfigurationIndex, see TS 36.211 (5.7.1). \vr{[0..63]}
91
  uint8_t prach_ConfigIndex;
92
  /// Parameter: High-speed-flag, see TS 36.211 (5.7.2). \vr{[0..1]} 1 corresponds to Restricted set and 0 to Unrestricted set.
93
  uint8_t highSpeedFlag;
94
  /// 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.
95
  uint8_t zeroCorrelationZoneConfig;
96
  /// 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.
97
  uint8_t prach_FreqOffset;
98 99
} PRACH_CONFIG_INFO;

100
/// PRACH-ConfigSIB or PRACH-Config from 36.331 RRC spec
101
typedef struct {
102
  /// Parameter: RACH_ROOT_SEQUENCE, see TS 36.211 (5.7.1). \vr{[0..837]}
103
  uint16_t rootSequenceIndex;
104
  /// prach_Config_enabled=1 means enabled. \vr{[0..1]}
105
  uint8_t prach_Config_enabled;
106
  /// PRACH Configuration Information
107 108 109
  PRACH_CONFIG_INFO prach_ConfigInfo;
} PRACH_CONFIG_COMMON;

110
/// Enumeration for parameter \f$N_\text{ANRep}\f$ \ref PUCCH_CONFIG_DEDICATED::repetitionFactor.
111 112 113 114 115 116
typedef enum {
  n2=0,
  n4,
  n6
} ACKNAKREP_t;

117
/// Enumeration for \ref PUCCH_CONFIG_DEDICATED::tdd_AckNackFeedbackMode.
118 119 120 121 122
typedef enum {
  bundling=0,
  multiplexing
} ANFBmode_t;

123
/// PUCCH-ConfigDedicated from 36.331 RRC spec
124
typedef struct {
125
  /// Flag to indicate ACK NAK repetition activation, see TS 36.213 (10.1). \vr{[0..1]}
126
  uint8_t ackNackRepetition;
127
  /// Parameter: \f$N_\text{ANRep}\f$, see TS 36.213 (10.1).
128
  ACKNAKREP_t repetitionFactor;
129
  /// Parameter: \f$n^{(1)}_\text{PUCCH,ANRep}\f$, see TS 36.213 (10.1). \vr{[0..2047]}
130
  uint16_t n1PUCCH_AN_Rep;
131
  /// Feedback mode, see TS 36.213 (7.3). \details Applied to both PUCCH and PUSCH feedback. For TDD, should always be set to bundling.
132 133 134 135 136
  ANFBmode_t tdd_AckNackFeedbackMode;
} PUCCH_CONFIG_DEDICATED;

/// PUCCH-ConfigCommon from 36.331 RRC spec
typedef struct {
137
  /// 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.
138
  uint8_t deltaPUCCH_Shift;
139
  /// Parameter: \f$N^{(2)}_\text{RB}\f$, see TS 36.211 (5.4). \vr{[0..98]}
140
  uint8_t nRB_CQI;
141
  /// Parameter: \f$N^{(1)}_\text{CS}\f$, see TS 36.211 (5.4). \vr{[0..7]}
142
  uint8_t nCS_AN;
143
  /// Parameter: \f$N^{(1)}_\text{PUCCH}\f$ see TS 36.213 (10.1). \vr{[0..2047]}
144
  uint16_t n1PUCCH_AN;
fnabet's avatar
fnabet committed
145 146 147 148 149

  /// 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];
150 151 152 153
} PUCCH_CONFIG_COMMON;

/// UL-ReferenceSignalsPUSCH from 36.331 RRC spec
typedef struct {
154
  /// Parameter: Group-hopping-enabled, see TS 36.211 (5.5.1.3). \vr{[0..1]}
155
  uint8_t groupHoppingEnabled;
156
  /// Parameter: \f$\Delta SS\f$, see TS 36.211 (5.5.1.3). \vr{[0..29]}
157
  uint8_t groupAssignmentPUSCH;
158
  /// Parameter: Sequence-hopping-enabled, see TS 36.211 (5.5.1.4). \vr{[0..1]}
159
  uint8_t sequenceHoppingEnabled;
160
  /// Parameter: cyclicShift, see TS 36.211 (Table 5.5.2.1.1-2). \vr{[0..7]}
161
  uint8_t cyclicShift;
162
  /// nPRS for cyclic shift of DRS \note not part of offical UL-ReferenceSignalsPUSCH ASN1 specification.
163
  uint8_t nPRS[20];
164
  /// group hopping sequence for DRS \note not part of offical UL-ReferenceSignalsPUSCH ASN1 specification.
165
  uint8_t grouphop[20];
166
  /// sequence hopping sequence for DRS \note not part of offical UL-ReferenceSignalsPUSCH ASN1 specification.
167
  uint8_t seqhop[20];
168
} UL_REFERENCE_SIGNALS_PUSCH_t;
169

170
/// Enumeration for parameter Hopping-mode \ref PUSCH_CONFIG_COMMON::hoppingMode.
laurent's avatar
laurent committed
171
#ifndef OCP_FRAMEWORK
172
typedef enum {
173
  interSubFrame=0,
174 175
  intraAndInterSubFrame=1
} PUSCH_HOPPING_t;
laurent's avatar
laurent committed
176
#endif
177

178
/// PUSCH-ConfigCommon from 36.331 RRC spec.
179
typedef struct {
180
  /// Parameter: \f$N_{sb}\f$, see TS 36.211 (5.3.4). \vr{[1..4]}
181
  uint8_t n_SB;
182
  /// Parameter: Hopping-mode, see TS 36.211 (5.3.4).
183
  PUSCH_HOPPING_t hoppingMode;
184
  /// Parameter: \f$N^{HO}_{RB}\f$, see TS 36.211 (5.3.4). \vr{[0..98]}
185
  uint8_t pusch_HoppingOffset;
186
  /// See TS 36.213 (8.6.1). \vr{[0..1]} 1 indicates 64QAM is allowed, 0 not allowed.
187
  uint8_t enable64QAM;
188 189 190 191
  /// Ref signals configuration
  UL_REFERENCE_SIGNALS_PUSCH_t ul_ReferenceSignalsPUSCH;
} PUSCH_CONFIG_COMMON;

192
/// UE specific PUSCH configuration.
193
typedef struct {
194
  /// Parameter: \f$I^\text{HARQ-ACK}_\text{offset}\f$, see TS 36.213 (Table 8.6.3-1). \vr{[0..15]}
195
  uint16_t betaOffset_ACK_Index;
196
  /// Parameter: \f$I^{RI}_\text{offset}\f$, see TS 36.213 (Table 8.6.3-2). \vr{[0..15]}
197
  uint16_t betaOffset_RI_Index;
198
  /// Parameter: \f$I^{CQI}_\text{offset}\f$, see TS 36.213 (Table 8.6.3-3). \vr{[0..15]}
199
  uint16_t betaOffset_CQI_Index;
200 201
} PUSCH_CONFIG_DEDICATED;

202
/// lola CBA information
203
typedef struct {
204
  ///
205
  uint16_t betaOffset_CA_Index;
206
  ///
207
  uint16_t cShift;
208 209 210 211
} PUSCH_CA_CONFIG_DEDICATED;

/// PDSCH-ConfigCommon from 36.331 RRC spec
typedef struct {
212
  /// 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.
213
  int8_t referenceSignalPower;
214
  /// Parameter: \f$P_B\f$, see TS 36.213 (Table 5.2-1). \vr{[0..3]}
215
  uint8_t p_b;
216 217
} PDSCH_CONFIG_COMMON;

218
/// Enumeration for Parameter \f$P_A\f$ \ref PDSCH_CONFIG_DEDICATED::p_a.
219
typedef enum {
220 221 222 223 224 225 226 227
  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
228 229
} PA_t;

230
/// PDSCH-ConfigDedicated from 36.331 RRC spec
231
typedef struct {
232 233
  /// Parameter: \f$P_A\f$, see TS 36.213 (5.2).
  PA_t p_a;
234 235 236 237
} PDSCH_CONFIG_DEDICATED;

/// SoundingRS-UL-ConfigCommon Information Element from 36.331 RRC spec
typedef struct {
238
  /// enabled flag=1 means SRS is enabled. \vr{[0..1]}
239
  uint8_t enabled_flag;
240
  /// 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.
241
  uint8_t srs_BandwidthConfig;
242
  /// 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.
243
  uint8_t srs_SubframeConfig;
244
  /// Parameter: Simultaneous-AN-and-SRS, see TS 36.213 (8.2). \vr{[0..1]}
245
  uint8_t ackNackSRS_SimultaneousTransmission;
246
  /// 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.
247
  uint8_t srs_MaxUpPts;
248 249
} SOUNDINGRS_UL_CONFIG_COMMON;

250
/// \note UNUSED
251 252 253 254 255 256 257 258 259 260 261
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;

262
/// Enumeration for \ref deltaFList_PUCCH_t::deltaF_PUCCH_Format1.
263
typedef enum {
264 265 266
  deltaF_PUCCH_Format1_deltaF_2  = 0,
  deltaF_PUCCH_Format1_deltaF0   = 1,
  deltaF_PUCCH_Format1_deltaF2   = 2
267
} deltaF_PUCCH_Format1_t;
268 269

/// Enumeration for \ref deltaFList_PUCCH_t::deltaF_PUCCH_Format1b.
270
typedef enum {
271 272 273
  deltaF_PUCCH_Format1b_deltaF1  = 0,
  deltaF_PUCCH_Format1b_deltaF3  = 1,
  deltaF_PUCCH_Format1b_deltaF5  = 2
274
} deltaF_PUCCH_Format1b_t;
275 276

/// Enumeration for \ref deltaFList_PUCCH_t::deltaF_PUCCH_Format2.
277
typedef enum {
278 279 280 281
  deltaF_PUCCH_Format2_deltaF_2  = 0,
  deltaF_PUCCH_Format2_deltaF0   = 1,
  deltaF_PUCCH_Format2_deltaF1   = 2,
  deltaF_PUCCH_Format2_deltaF2   = 3
282
} deltaF_PUCCH_Format2_t;
283 284

/// Enumeration for \ref deltaFList_PUCCH_t::deltaF_PUCCH_Format2a.
285
typedef enum {
286 287 288
  deltaF_PUCCH_Format2a_deltaF_2 = 0,
  deltaF_PUCCH_Format2a_deltaF0  = 1,
  deltaF_PUCCH_Format2a_deltaF2  = 2
289
} deltaF_PUCCH_Format2a_t;
290 291

/// Enumeration for \ref deltaFList_PUCCH_t::deltaF_PUCCH_Format2b.
292
typedef enum {
293 294 295
  deltaF_PUCCH_Format2b_deltaF_2 = 0,
  deltaF_PUCCH_Format2b_deltaF0  = 1,
  deltaF_PUCCH_Format2b_deltaF2  = 2
296 297
} deltaF_PUCCH_Format2b_t;

298
/// DeltaFList-PUCCH from 36.331 RRC spec
299
typedef struct {
300 301 302 303 304
  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;
305 306 307 308
} deltaFList_PUCCH_t;

/// SoundingRS-UL-ConfigDedicated Information Element from 36.331 RRC spec
typedef struct {
309
  /// 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.
310
  uint8_t srs_Bandwidth;
311
  /// 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.
312
  uint8_t srs_HoppingBandwidth;
313
  /// Parameter: \f$n_\text{RRC}\f$, see TS 36.211 (5.5.3.2). \vr{[0..23]}
314
  uint8_t freqDomainPosition;
315
  /// Parameter: Duration, see TS 36.213 (8.2). \vr{[0..1]} 0 corresponds to "single" and 1 to "indefinite".
316
  uint8_t duration;
317
  /// Parameter: \f$k_\text{TC}\in\{0,1\}\f$, see TS 36.211 (5.5.3.2). \vr{[0..1]}
318
  uint8_t transmissionComb;
319
  /// Parameter: \f$I_\text{SRS}\f$, see TS 36.213 (table 8.2-1). \vr{[0..1023]}
320
  uint16_t srs_ConfigIndex;
321
  /// 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.
322
  uint8_t cyclicShift;
fnabet's avatar
fnabet committed
323 324
  // Parameter: ue srs subframe for internal implementation
  uint8_t srsConfigDedicatedSetup;
Bilel's avatar
Bilel committed
325 326 327 328
  // Parameter: cell srs subframe for internal implementation
  uint8_t srsCellSubframe;
  // Parameter: ue srs subframe for internal implementation
  uint8_t srsUeSubframe;
329 330
} SOUNDINGRS_UL_CONFIG_DEDICATED;

331
/// UplinkPowerControlDedicated Information Element from 36.331 RRC spec
332
typedef struct {
333
  /// 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.
334
  int8_t p0_UE_PUSCH;
335
  /// 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).
336
  uint8_t deltaMCS_Enabled;
337
  /// Parameter: Accumulation-enabled, see TS 36.213 (5.1.1.1). \vr{[0..1]} 1 corresponds to "enabled" whereas 0 corresponds to "disabled".
338
  uint8_t accumulationEnabled;
339
  /// Parameter: \f$P_\text{0\_UE\_PUCCH}(1)\f$, see TS 36.213 (5.1.2.1), unit dB. \vr{[-8..7]}
340
  int8_t p0_UE_PUCCH;
341
  /// 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.
342
  int8_t pSRS_Offset;
343
  /// 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.
344
  uint8_t filterCoefficient;
345 346
} UL_POWER_CONTROL_DEDICATED;

laurent's avatar
laurent committed
347
#ifndef OCP_FRAMEWORK
348
/// Enumeration for parameter \f$\alpha\f$ \ref UL_POWER_CONTROL_CONFIG_COMMON::alpha.
349 350 351 352 353 354 355 356 357 358
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
359
#endif
360

361
/// \note UNUSED
362 363 364 365 366 367
typedef enum {
  deltaFm2=0,
  deltaF0,
  deltaF1,
  deltaF2,
  deltaF3,
368
  deltaF5
369 370
} deltaF_PUCCH_t;

371
/// UplinkPowerControlCommon Information Element from 36.331 RRC spec \note this structure does not currently make use of \ref deltaFList_PUCCH_t.
372
typedef struct {
373
  /// 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.
374
  int8_t p0_NominalPUSCH;
375
  /// 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, ...)!
376
  PUSCH_alpha_t alpha;
377
  /// Parameter: \f$P_\text{0\_NOMINAL\_PUCCH}\f$ See TS 36.213 (5.1.2.1), unit dBm. \vr{[-127..-96]}
378
  int8_t p0_NominalPUCCH;
379
  /// 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].
380
  int8_t deltaPreambleMsg3;
381
  /// 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.
382
  long deltaF_PUCCH_Format1;
383
  /// 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.
384
  long deltaF_PUCCH_Format1a;
385
  /// 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.
386
  long deltaF_PUCCH_Format1b;
387
  /// 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.
388
  long deltaF_PUCCH_Format2;
389
  /// 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.
390
  long deltaF_PUCCH_Format2a;
391
  /// 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.
392 393 394
  long deltaF_PUCCH_Format2b;
} UL_POWER_CONTROL_CONFIG_COMMON;

395
/// Union for \ref TPC_PDCCH_CONFIG::tpc_Index.
396
typedef union {
397 398 399 400
  /// 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;
401 402
} TPC_INDEX_t;

403
/// TPC-PDCCH-Config Information Element from 36.331 RRC spec
404
typedef struct {
405
  /// RNTI for power control using DCI format 3/3A, see TS 36.212. \vr{[0..65535]}
406
  uint16_t rnti;
407
  /// 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).
408 409 410
  TPC_INDEX_t tpc_Index;
} TPC_PDCCH_CONFIG;

411
/// Enumeration for parameter SR transmission \ref SCHEDULING_REQUEST_CONFIG::dsr_TransMax.
412 413 414 415 416 417 418 419
typedef enum {
  sr_n4=0,
  sr_n8=1,
  sr_n16=2,
  sr_n32=3,
  sr_n64=4
} DSR_TRANSMAX_t;

420
/// SchedulingRequestConfig Information Element from 36.331 RRC spec
421
typedef struct {
422
  /// Parameter: \f$n^{(1)}_\text{PUCCH,SRI}\f$, see TS 36.213 (10.1). \vr{[0..2047]}
423
  uint16_t sr_PUCCH_ResourceIndex;
424
  /// Parameter: \f$I_\text{SR}\f$, see TS 36.213 (10.1). \vr{[0..155]}
425
  uint8_t sr_ConfigIndex;
426
  /// 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.
427 428 429
  DSR_TRANSMAX_t dsr_TransMax;
} SCHEDULING_REQUEST_CONFIG;

430
/// CQI-ReportPeriodic
431
typedef struct {
knopp's avatar
knopp committed
432 433
  /// Parameter: \f$n^{(2)}_\text{PUCCH}\f$, see TS 36.213 (7.2). \vr{[0..1185]}, -1 indicates inactivity
  int16_t cqi_PUCCH_ResourceIndex;
434
  /// 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
435
  int16_t cqi_PMI_ConfigIndex;
436
  /// Parameter: K, see 36.213 (4.2.2). \vr{[1..4]}
437
  uint8_t K;
knopp's avatar
knopp committed
438 439
  /// 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;
440
  /// 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.
441
  uint8_t simultaneousAckNackAndCQI;
knopp's avatar
knopp committed
442 443 444 445
  /// 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;
446 447
} CQI_REPORTPERIODIC;

448 449 450 451 452 453 454 455 456 457
/// 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
458
typedef struct {
459
  /// 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].
460
  CQI_REPORTMODEAPERIODIC cqi_ReportModeAperiodic;
461
  /// Parameter: \f$\Delta_\text{offset}\f$, see TS 36.213 (7.2.3). \vr{[-1..6]}\n Actual value = IE value * 2 [dB].
462
  int8_t nomPDSCH_RS_EPRE_Offset;
463 464 465
  CQI_REPORTPERIODIC CQI_ReportPeriodic;
} CQI_REPORT_CONFIG;

466
/// MBSFN-SubframeConfig Information Element from 36.331 RRC spec \note deviates from specification.
467
typedef struct {
468
  /// 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}.
469
  int radioframeAllocationPeriod;
470
  /// 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.
471
  int radioframeAllocationOffset;
472
  /// oneFrame or fourFrames. \vr{[0..1]}
473
  int fourFrames_flag;
474 475 476 477 478
  /// 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.
479 480 481 482 483
  int mbsfn_SubframeConfig;
} MBSFN_config_t;

typedef struct {
  /// Number of resource blocks (RB) in DL
484
  uint8_t N_RB_DL;
485
  /// Number of resource blocks (RB) in UL
486
  uint8_t N_RB_UL;
487 488 489
  ///  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
490
  uint8_t N_RBGS;
491
  /// Cell ID
492
  uint16_t Nid_cell;
493
  /// MBSFN Area ID
494
  uint16_t Nid_cell_mbsfn;
495 496 497
  /// 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)
498
  lte_prefix_type_t Ncp_UL;
499
  /// shift of pilot position in one RB
500
  uint8_t nushift;
501 502 503
  /// 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)
504
  uint8_t tdd_config;
505
  /// TDD S-subframe configuration (0-9)
506
  uint8_t tdd_config_S;
507 508
  /// srs extra symbol flag for TDD
  uint8_t srsX;
509
  /// indicates if node is a UE (NODE=2) or eNB (PRIMARY_CH=0).
510
  uint8_t node_id;
511
  /// Frequency index of CBMIMO1 card
512
  uint8_t freq_idx;
513
  /// RX Frequency for ExpressMIMO/LIME
514
  uint32_t carrier_freq[4];
515
  /// TX Frequency for ExpressMIMO/LIME
516
  uint32_t carrier_freqtx[4];
517
  /// RX gain for ExpressMIMO/LIME
518
  uint32_t rxgain[4];
519
  /// TX gain for ExpressMIMO/LIME
520
  uint32_t txgain[4];
521
  /// RF mode for ExpressMIMO/LIME
522
  uint32_t rfmode[4];
523
  /// RF RX DC Calibration for ExpressMIMO/LIME
524
  uint32_t rxdc[4];
525
  /// RF TX DC Calibration for ExpressMIMO/LIME
526
  uint32_t rflocal[4];
527
  /// RF VCO calibration for ExpressMIMO/LIME
528
  uint32_t rfvcolocal[4];
529
  /// Turns on second TX of CBMIMO1 card
530
  uint8_t dual_tx;
531
  /// flag to indicate SISO transmission
532
  uint8_t mode1_flag;
533 534
  /// Indicator that 20 MHz channel uses 3/4 sampling frequency
  uint8_t threequarter_fs;
535
  /// Size of FFT
536
  uint16_t ofdm_symbol_size;
537
  /// Number of prefix samples in all but first symbol of slot
538
  uint16_t nb_prefix_samples;
539
  /// Number of prefix samples in first symbol of slot
540
  uint16_t nb_prefix_samples0;
541
  /// Carrier offset in FFT buffer for first RE in PRB0
542
  uint16_t first_carrier_offset;
543
  /// Number of samples in a subframe
544
  uint32_t samples_per_tti;
545
  /// Number of OFDM/SC-FDMA symbols in one subframe (to be modified to account for potential different in UL/DL)
546
  uint16_t symbols_per_tti;
547 548 549 550
  /// 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
551
  /// Number of Physical transmit antennas in node
552
  uint8_t nb_antennas_tx;
553
  /// Number of Receive antennas in node
554
  uint8_t nb_antennas_rx;
555
  /// Number of common transmit antenna ports in eNodeB (1 or 2)
Xiwen JIANG's avatar
Xiwen JIANG committed
556
  uint8_t nb_antenna_ports_eNB;
557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572
  /// PRACH_CONFIG
  PRACH_CONFIG_COMMON prach_config_common;
  /// 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;
573
  /// Array of MBSFN Configurations (max 8 (maxMBSFN-Allocations) elements as per 36.331)
574 575
  MBSFN_config_t MBSFN_config[8];
  /// Maximum Number of Retransmissions of RRCConnectionRequest (from 36-331 RRC Spec)
576
  uint8_t maxHARQ_Msg3Tx;
577
  /// Size of SI windows used for repetition of one SI message (in frames)
578
  uint8_t SIwindowsize;
579
  /// Period of SI windows used for repetition of one SI message (in frames)
580
  uint16_t SIPeriod;
581
  /// REGs assigned to PCFICH
582
  uint16_t pcfich_reg[4];
583
  /// Index of first REG assigned to PCFICH
584
  uint8_t pcfich_first_reg_idx;
585
  /// REGs assigned to PHICH
586
  uint16_t phich_reg[MAX_NUM_PHICH_GROUPS][3];
587 588 589 590 591 592

  struct MBSFN_SubframeConfig *mbsfn_SubframeConfig[MAX_MBSFN_AREA];

} LTE_DL_FRAME_PARMS;

typedef enum {
593
  /// TM1
594
  SISO=0,
595
  /// TM2
596
  ALAMOUTI=1,
597
  /// TM3
598
  LARGE_CDD=2,
599
  /// the next 6 entries are for TM5
600 601 602 603 604 605
  UNIFORM_PRECODING11=3,
  UNIFORM_PRECODING1m1=4,
  UNIFORM_PRECODING1j=5,
  UNIFORM_PRECODING1mj=6,
  PUSCH_PRECODING0=7,
  PUSCH_PRECODING1=8,
606
  /// the next 3 entries are for TM4
607 608
  DUALSTREAM_UNIFORM_PRECODING1=9,
  DUALSTREAM_UNIFORM_PRECODINGj=10,
knopp's avatar
knopp committed
609
  DUALSTREAM_PUSCH_PRECODING=11,
610 611 612
  TM7=12,
  TM8=13,
  TM9_10=14
613 614
} MIMO_mode_t;

615 616 617 618 619 620 621 622 623
typedef enum {
  /// MRT
  MRT=0,
  /// ZF
  ZF=1,
  /// MMSE
  MMSE=2
} PRECODE_TYPE_t;

624
typedef struct {
625 626 627 628 629
  /// \brief Holds the transmit data in time domain.
  /// For IFFT_FPGA this points to the same memory as PHY_vars->rx_vars[a].RX_DMA_BUFFER.
  /// - first index: eNB id [0..2] (hard coded)
  /// - second index: tx antenna [0..nb_antennas_tx[
  /// - third index:
630
  int32_t **txdata[3];
631
  /// \brief holds the transmit data in the frequency domain.
Xiwen JIANG's avatar
Xiwen JIANG committed
632
  /// For IFFT_FPGA this points to the same memory as PHY_vars->rx_vars[a].RX_DMA_BUFFER. //?
633
  /// - first index: eNB id [0..2] (hard coded)
Xiwen JIANG's avatar
Xiwen JIANG committed
634
  /// - second index: tx antenna [0..14[ where 14 is the total supported antenna ports.
635
  /// - third index: sample [0..]
636
  int32_t **txdataF[3];
Xiwen JIANG's avatar
Xiwen JIANG committed
637 638 639 640 641
  /// \brief holds the transmit data after beamforming in the frequency domain.
  /// For IFFT_FPGA this points to the same memory as PHY_vars->rx_vars[a].RX_DMA_BUFFER. //?
  /// - first index: eNB id [0..2] (hard coded)
  /// - second index: tx antenna [0..nb_antennas_tx[
  /// - third index: sample [0..]
642
  int32_t **txdataF_BF[3];
643 644
  /// \brief Holds the received data in time domain.
  /// Should point to the same memory as PHY_vars->rx_vars[a].RX_DMA_BUFFER.
645
  /// - first index: sector id [0..2] (hard coded)
646 647
  /// - second index: rx antenna [0..nb_antennas_rx[
  /// - third index: sample [0..]
648
  int32_t **rxdata[3];
649
  /// \brief Holds the last subframe of received data in time domain after removal of 7.5kHz frequency offset.
650
  /// - first index: secotr id [0..2] (hard coded)
651 652
  /// - second index: rx antenna [0..nb_antennas_rx[
  /// - third index: sample [0..samples_per_tti[
653
  int32_t **rxdata_7_5kHz[3];
654
  /// \brief Holds the received data in the frequency domain.
655
  /// - first index: sector id [0..2] (hard coded)
656 657
  /// - second index: rx antenna [0..nb_antennas_rx[
  /// - third index: ? [0..2*ofdm_symbol_size*frame_parms->symbols_per_tti[
658
  int32_t **rxdataF[3];
659
  /// \brief Holds output of the sync correlator.
660
  /// - first index: sector id [0..2] (hard coded)
661
  /// - second index: sample [0..samples_per_tti*10[
662
  uint32_t *sync_corr[3];
Xiwen JIANG's avatar
Xiwen JIANG committed
663
  /// \brief Holds the beamforming weights
664
  /// - first index: eNB id [0..2] (hard coded)
665
  /// - second index: eNB antenna port index (hard coded)
666 667 668
  /// - third index: tx antenna [0..nb_antennas_tx[
  /// - fourth index: sample [0..]
  int32_t **beam_weights[3][15];
669 670
  /// \brief Holds the tdd reciprocity calibration coefficients
  /// - first index: eNB id [0..2] (hard coded)
671 672
  /// - second index: tx antenna [0..nb_antennas_tx[
  /// - third index: frequency [0..]
673
  int32_t **tdd_calib_coeffs[3];
674 675
} LTE_eNB_COMMON;

676
typedef struct {
677
  /// \brief Hold the channel estimates in frequency domain based on SRS.
678
  /// - first index: sector id [0..2] (hard coded)
679 680
  /// - second index: rx antenna id [0..nb_antennas_rx[
  /// - third index: ? [0..ofdm_symbol_size[
681
  int32_t **srs_ch_estimates[3];
682
  /// \brief Hold the channel estimates in time domain based on SRS.
683
  /// - first index: sector id [0..2] (hard coded)
684 685
  /// - second index: rx antenna id [0..nb_antennas_rx[
  /// - third index: ? [0..2*ofdm_symbol_size[
686
  int32_t **srs_ch_estimates_time[3];
687 688
  /// \brief Holds the SRS for channel estimation at the RX.
  /// - first index: ? [0..ofdm_symbol_size[
689
  int32_t *srs;
690 691
} LTE_eNB_SRS;

692
typedef struct {
693
  /// \brief Holds the received data in the frequency domain for the allocated RBs in repeated format.
694
  /// - first index: sector id [0..2] (hard coded)
695 696 697 698
  /// - second index: rx antenna id [0..nb_antennas_rx[
  /// - third index: ? [0..2*ofdm_symbol_size[
  /// - third index (definition from phy_init_lte_eNB()): ? [0..24*N_RB_UL*frame_parms->symbols_per_tti[
  /// \warning inconsistent third index definition
699
  int32_t **rxdataF_ext[3];
700
  /// \brief Holds the received data in the frequency domain for the allocated RBs in normal format.
701
  /// - first index: sector id [0..2] (hard coded)
702 703
  /// - second index: rx antenna id [0..nb_antennas_rx[
  /// - third index (definition from phy_init_lte_eNB()): ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[
704
  int32_t **rxdataF_ext2[3];
705
  /// \brief Hold the channel estimates in time domain based on DRS.
706
  /// - first index: sector id [0..2] (hard coded)
707 708
  /// - second index: rx antenna id [0..nb_antennas_rx[
  /// - third index: ? [0..4*ofdm_symbol_size[
709
  int32_t **drs_ch_estimates_time[3];
710
  /// \brief Hold the channel estimates in frequency domain based on DRS.
711
  /// - first index: sector id [0..2] (hard coded)
712 713
  /// - second index: rx antenna id [0..nb_antennas_rx[
  /// - third index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[
714
  int32_t **drs_ch_estimates[3];
715
  /// \brief Hold the channel estimates for UE0 in case of Distributed Alamouti Scheme.
716
  /// - first index: sector id [0..2] (hard coded)
717 718
  /// - second index: rx antenna id [0..nb_antennas_rx[
  /// - third index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[
719
  int32_t **drs_ch_estimates_0[3];
720
  /// \brief Hold the channel estimates for UE1 in case of Distributed Almouti Scheme.
721
  /// - first index: sector id [0..2] (hard coded)
722 723
  /// - second index: rx antenna id [0..nb_antennas_rx[
  /// - third index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[
724
  int32_t **drs_ch_estimates_1[3];
725
  /// \brief Holds the compensated signal.
726
  /// - first index: sector id [0..2] (hard coded)
727 728
  /// - second index: rx antenna id [0..nb_antennas_rx[
  /// - third index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[
729
  int32_t **rxdataF_comp[3];
730
  /// \brief Hold the compensated data (y)*(h0*) in case of Distributed Alamouti Scheme.
731
  /// - first index: sector id [0..2] (hard coded)
732 733
  /// - second index: rx antenna id [0..nb_antennas_rx[
  /// - third index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[
734
  int32_t **rxdataF_comp_0[3];
735
  /// \brief Hold the compensated data (y*)*(h1) in case of Distributed Alamouti Scheme.
736
  /// - first index: sector id [0..2] (hard coded)
737 738
  /// - second index: rx antenna id [0..nb_antennas_rx[
  /// - third index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[
739
  int32_t **rxdataF_comp_1[3];
740
  /// \brief ?.
741
  /// - first index: sector id [0..2] (hard coded)
742 743
  /// - second index: rx antenna id [0..nb_antennas_rx[
  /// - third index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[
744
  int32_t **ul_ch_mag[3];
745 746 747 748
  /// \brief ?.
  /// - first index: eNB id [0..2] (hard coded)
  /// - second index: rx antenna id [0..nb_antennas_rx[
  /// - third index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[
749
  int32_t **ul_ch_magb[3];
750 751 752 753
  /// \brief Hold the channel mag for UE0 in case of Distributed Alamouti Scheme.
  /// - first index: eNB id [0..2] (hard coded)
  /// - second index: rx antenna id [0..nb_antennas_rx[
  /// - third index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[
754
  int32_t **ul_ch_mag_0[3];
755 756 757 758
  /// \brief Hold the channel magb for UE0 in case of Distributed Alamouti Scheme.
  /// - first index: eNB id [0..2] (hard coded)
  /// - second index: rx antenna id [0..nb_antennas_rx[
  /// - third index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[
759
  int32_t **ul_ch_magb_0[3];
760 761 762 763
  /// \brief Hold the channel mag for UE1 in case of Distributed Alamouti Scheme.
  /// - first index: eNB id [0..2] (hard coded)
  /// - second index: rx antenna id [0..nb_antennas_rx[
  /// - third index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[
764
  int32_t **ul_ch_mag_1[3];
765 766 767 768
  /// \brief Hold the channel magb for UE1 in case of Distributed Alamouti Scheme.
  /// - first index: eNB id [0..2] (hard coded)
  /// - second index: rx antenna id [0..nb_antennas_rx[
  /// - third index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[
769
  int32_t **ul_ch_magb_1[3];
770 771 772 773 774 775
  /// measured RX power based on DRS
  int ulsch_power[2];
  /// measured RX power based on DRS for UE0 in case of Distributed Alamouti Scheme
  int ulsch_power_0[2];
  /// measured RX power based on DRS for UE0 in case of Distributed Alamouti Scheme
  int ulsch_power_1[2];
776 777
  /// \brief llr values.
  /// - first index: ? [0..1179743] (hard coded)
778
  int16_t *llr;
779 780 781 782 783 784
#ifdef LOCALIZATION
  /// number of active subcarrier for a specific UE
  int32_t active_subcarrier;
  /// subcarrier power in dBm
  int32_t *subcarrier_power;
#endif
785 786
} LTE_eNB_PUSCH;

787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806
typedef struct {

	  /// \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];
}LTE_UE_COMMON_PER_THREAD;

807
typedef struct {
808 809 810 811
  /// \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[
812
  int32_t **txdata;
813 814 815 816
  /// \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[
817
  int32_t **txdataF;
818

819 820 821 822
  /// \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[
823
  int32_t **rxdata;
824 825 826

  LTE_UE_COMMON_PER_THREAD common_vars_rx_data_per_thread[2];

827
  /// holds output of the sync correlator
828
  int32_t *sync_corr;
829
  /// estimated frequency offset (in radians) for all subcarriers
830
  int32_t freq_offset;
831
  /// eNb_id user is synched to
832
  int32_t eNb_id;
833 834 835
} LTE_UE_COMMON;

typedef struct {
836 837 838
  /// \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[
839
  int32_t **rxdataF_ext;
840 841 842 843
  /// \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;
844 845 846
  /// \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[
847
  int32_t **rxdataF_comp0;
848 849 850 851
  /// \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
852
  /// - fourth index: ? [0..168*N_RB_DL[
853
  int32_t **rxdataF_comp1[8][8];
854 855 856
  /// \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[
857
  int32_t **dl_ch_estimates_ext;
858 859 860 861 862 863
  /// \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];
864 865 866 867 868 869 870 871
  /// \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;
872 873 874 875
  /// \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[
  int32_t **dl_ch_rho2_ext;
876 877
  /// \brief Downlink PMIs extracted in PRBS and grouped in subbands.
  /// - first index: ressource block [0..N_RB_DL[
878
  uint8_t *pmi_ext;
879 880 881
  /// \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[
882
  int32_t **dl_ch_mag0;
883 884 885
  /// \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[
886
  int32_t **dl_ch_mag1[8][8];
887 888 889
  /// \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[
890
  int32_t **dl_ch_magb0;
891 892 893
  /// \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[
894
  int32_t **dl_ch_magb1[8][8];
895 896 897
  /// \brief Cross-correlation of two eNB signals.
  /// - first index: rx antenna [0..nb_antennas_rx[
  /// - second index: symbol [0..]
898
  int32_t **rho;
899
  /// never used... always send dl_ch_rho_ext instead...
900
  int32_t **rho_i;
901 902 903
  /// \brief Pointers to llr vectors (2 TBs).
  /// - first index: ? [0..1] (hard coded)
  /// - second index: ? [0..1179743] (hard coded)
904
  int16_t *llr[2];
905
  /// \f$\log_2(\max|H_i|^2)\f$
906
  int16_t log2_maxh;
907 908 909 910
    /// \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;
911 912
  /// \brief LLR shifts for subband scaling.
  /// - first index: ? [0..168*N_RB_DL[
913
  uint8_t *llr_shifts;
914 915
  /// \brief Pointer to LLR shifts.
  /// - first index: ? [0..168*N_RB_DL[
916
  uint8_t *llr_shifts_p;
917 918 919
  /// \brief Pointers to llr vectors (128-bit alignment).
  /// - first index: ? [0..0] (hard coded)
  /// - second index: ? [0..]
920
  int16_t **llr128;
921 922 923 924
  /// \brief Pointers to llr vectors (128-bit alignment).
  /// - first index: ? [0..0] (hard coded)
  /// - second index: ? [0..]
  int16_t **llr128_2ndstream;
925 926
  //uint32_t *rb_alloc;
  //uint8_t Qm[2];
927 928 929 930
  //MIMO_mode_t mimo_mode;
} LTE_UE_PDSCH;

typedef struct {
931 932 933
  /// \brief Received frequency-domain signal after extraction.
  /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
  /// - second index: ? [0..]
934
  int32_t **rxdataF_ext;
935 936 937
  /// \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..]
938
  double **rxdataF_comp;
939 940 941
  /// \brief Downlink channel estimates extracted in PRBS.
  /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
  /// - second index: ? [0..]
942
  int32_t **dl_ch_estimates_ext;
943 944 945
  ///  \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..]
946
  double **dl_ch_rho_ext;
947 948
  /// \brief Downlink PMIs extracted in PRBS and grouped in subbands.
  /// - first index: ressource block [0..N_RB_DL[
949
  uint8_t *pmi_ext;
950 951 952
  /// \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..]
953
  double **dl_ch_mag;
954 955 956
  /// \brief Magnitude of Downlink Channel (2nd 64QAM level).
  /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
  /// - second index: ? [0..]
957
  double **dl_ch_magb;
958 959 960
  /// \brief Cross-correlation of two eNB signals.
  /// - first index: rx antenna [0..nb_antennas_rx[
  /// - second index: ? [0..]
961 962
  double **rho;
  /// never used... always send dl_ch_rho_ext instead...
963
  double **rho_i;
964 965 966
  /// \brief Pointers to llr vectors (2 TBs).
  /// - first index: ? [0..1] (hard coded)
  /// - second index: ? [0..1179743] (hard coded)
967
  int16_t *llr[2];
968
  /// \f$\log_2(\max|H_i|^2)\f$
969
  uint8_t log2_maxh;
970 971 972
  /// \brief Pointers to llr vectors (128-bit alignment).
  /// - first index: ? [0..0] (hard coded)
  /// - second index: ? [0..]
973 974 975
  int16_t **llr128;
  //uint32_t *rb_alloc;
  //uint8_t Qm[2];
976 977 978 979
  //MIMO_mode_t mimo_mode;
} LTE_UE_PDSCH_FLP;

typedef struct {
980
  /// \brief Pointers to extracted PDCCH symbols in frequency-domain.
981 982
  /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
  /// - second index: ? [0..168*N_RB_DL[
983
  int32_t **rxdataF_ext;
984 985 986
  /// \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[
987
  int32_t **rxdataF_comp;
988 989 990
  /// \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[
991
  int32_t **dl_ch_estimates_ext;
992 993 994
  /// \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[
995
  int32_t **dl_ch_rho_ext;
996 997 998
  /// \brief Pointers to channel cross-correlation vectors for multi-eNB detection.
  /// - first index: rx antenna [0..nb_antennas_rx[
  /// - second index: ? [0..]
999
  int32_t **rho;
1000 1001
  /// \brief Pointer to llrs, 4-bit resolution.
  /// - first index: ? [0..48*N_RB_DL[
1002
  uint16_t *llr;
1003 1004
  /// \brief Pointer to llrs, 16-bit resolution.
  /// - first index: ? [0..96*N_RB_DL[
1005
  uint16_t *llr16;
1006 1007
  /// \brief \f$\overline{w}\f$ from 36-211.
  /// - first index: ? [0..48*N_RB_DL[
1008
  uint16_t *wbar;
1009 1010
  /// \brief PDCCH/DCI e-sequence (input to rate matching).
  /// - first index: ? [0..96*N_RB_DL[
1011
  int8_t *e_rx;
1012
  /// number of PDCCH symbols in current subframe
1013
  uint8_t num_pdcch_symbols;
1014
  /// Allocated CRNTI for UE
1015
  uint16_t crnti;
1016 1017
  /// 1: the allocated crnti is Temporary C-RNTI / 0: otherwise
  uint8_t crnti_is_temporary;
1018
  /// Total number of PDU errors (diagnostic mode)
1019
  uint32_t dci_errors;
1020
  /// Total number of PDU received
1021
  uint32_t dci_received;
1022
  /// Total number of DCI False detection (diagnostic mode)
1023
  uint32_t dci_false;
1024
  /// Total number of DCI missed (diagnostic mode)
1025
  uint32_t dci_missed;
1026
  /// nCCE for PUCCH per subframe
1027
  uint8_t nCCE[10];
1028 1029 1030 1031
} LTE_UE_PDCCH;

#define PBCH_A 24
typedef struct {
1032 1033 1034
  uint8_t pbch_d[96+(3*(16+PBCH_A))];
  uint8_t pbch_w[3*3*(16+PBCH_A)];
  uint8_t pbch_e[1920];
1035 1036 1037
} LTE_eNB_PBCH;

typedef struct {
1038 1039 1040
  /// \brief Pointers to extracted PBCH symbols in frequency-domain.
  /// - first index: rx antenna [0..nb_antennas_rx[
  /// - second index: ? [0..287] (hard coded)
1041
  int32_t **rxdataF_ext;
1042 1043 1044
  /// \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)
1045
  int32_t **rxdataF_comp;
1046 1047 1048
  /// \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)
1049
  int32_t **dl_ch_estimates_ext;
1050 1051
  /// \brief Pointer to PBCH llrs.
  /// - first index: ? [0..1919] (hard coded)
1052
  int8_t *llr;
1053 1054
  /// \brief Pointer to PBCH decoded output.
  /// - first index: ? [0..63] (hard coded)
1055
  uint8_t *decoded_output;
1056
  /// \brief Total number of PDU errors.
1057
  uint32_t pdu_errors;
1058
  /// \brief Total number of PDU errors 128 frames ago.
1059
  uint32_t pdu_errors_last;
1060
  /// \brief Total number of consecutive PDU errors.
1061
  uint32_t pdu_errors_conseq;
1062
  /// \brief FER (in percent) .
1063
  uint32_t pdu_fer;
1064 1065 1066
} LTE_UE_PBCH;

typedef struct {
1067 1068 1069
  int16_t amp;
  int16_t *prachF;
  int16_t *prach;