impl_defs_lte.h 46.8 KB
Newer Older
1
/*******************************************************************************
2
    OpenAirInterface
ghaddab's avatar
ghaddab committed
3
    Copyright(c) 1999 - 2014 Eurecom
4

ghaddab's avatar
ghaddab committed
5 6 7 8
    OpenAirInterface is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.
9 10


ghaddab's avatar
ghaddab committed
11 12 13 14
    OpenAirInterface is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
15

ghaddab's avatar
ghaddab committed
16
    You should have received a copy of the GNU General Public License
17 18
    along with OpenAirInterface.The full GNU General Public License is
   included in this distribution in the file called "COPYING". If not,
ghaddab's avatar
ghaddab committed
19
   see <http://www.gnu.org/licenses/>.
20 21

  Contact Information
ghaddab's avatar
ghaddab committed
22 23 24
  OpenAirInterface Admin: openair_admin@eurecom.fr
  OpenAirInterface Tech : openair_tech@eurecom.fr
  OpenAirInterface Dev  : openair4g-devel@eurecom.fr
25

ghaddab's avatar
ghaddab committed
26
  Address      : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
27

ghaddab's avatar
ghaddab committed
28
 *******************************************************************************/
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52

/*! \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 "spec_defs_top.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
53
#define TX_RX_SWITCH_SYMBOL (NUMBER_OF_SYMBOLS_PER_FRAME>>1)
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
#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


typedef enum {TDD=1,FDD=0} lte_frame_type_t;

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

71 72
typedef enum {LOCALIZED=0,DISTRIBUTED=1} vrb_t;

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

79
/// Enumeration for parameter Ng \ref PHICH_CONFIG_COMMON::phich_resource.
80 81 82 83 84 85 86
typedef enum {
  oneSixth=1,
  half=3,
  one=6,
  two=12
} PHICH_RESOURCE_t;

87
/// PHICH-Config from 36.331 RRC spec
88
typedef struct {
89
  /// Parameter: PHICH-Duration, see TS 36.211 (Table 6.9.3-1).
90
  PHICH_DURATION_t phich_duration;
91
  /// Parameter: Ng, see TS 36.211 (6.9). \details Value oneSixth corresponds to 1/6, half corresponds to 1/2 and so on.
92 93 94
  PHICH_RESOURCE_t phich_resource;
} PHICH_CONFIG_COMMON;

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

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

117
/// Enumeration for parameter \f$N_\text{ANRep}\f$ \ref PUCCH_CONFIG_DEDICATED::repetitionFactor.
118 119 120 121 122 123
typedef enum {
  n2=0,
  n4,
  n6
} ACKNAKREP_t;

124
/// Enumeration for \ref PUCCH_CONFIG_DEDICATED::tdd_AckNackFeedbackMode.
125 126 127 128 129
typedef enum {
  bundling=0,
  multiplexing
} ANFBmode_t;

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

/// PUCCH-ConfigCommon from 36.331 RRC spec
typedef struct {
144
  /// 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.
145
  uint8_t deltaPUCCH_Shift;
146
  /// Parameter: \f$N^{(2)}_\text{RB}\f$, see TS 36.211 (5.4). \vr{[0..98]}
147
  uint8_t nRB_CQI;
148
  /// Parameter: \f$N^{(1)}_\text{CS}\f$, see TS 36.211 (5.4). \vr{[0..7]}
149
  uint8_t nCS_AN;
150
  /// Parameter: \f$N^{(1)}_\text{PUCCH}\f$ see TS 36.213 (10.1). \vr{[0..2047]}
151
  uint16_t n1PUCCH_AN;
152 153 154 155
} PUCCH_CONFIG_COMMON;

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

172
/// Enumeration for parameter Hopping-mode \ref PUSCH_CONFIG_COMMON::hoppingMode.
173
typedef enum {
174
  interSubFrame=0,
175 176 177
  intraAndInterSubFrame=1
} PUSCH_HOPPING_t;

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;
323 324
} SOUNDINGRS_UL_CONFIG_DEDICATED;

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

341
/// Enumeration for parameter \f$\alpha\f$ \ref UL_POWER_CONTROL_CONFIG_COMMON::alpha.
342 343 344 345 346 347 348 349 350 351 352
typedef enum {
  al0=0,
  al04=1,
  al05=2,
  al06=3,
  al07=4,
  al08=5,
  al09=6,
  al1=7
} PUSCH_alpha_t;

353
/// \note UNUSED
354 355 356 357 358 359
typedef enum {
  deltaFm2=0,
  deltaF0,
  deltaF1,
  deltaF2,
  deltaF3,
360
  deltaF5
361 362
} deltaF_PUCCH_t;

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

387
/// Union for \ref TPC_PDCCH_CONFIG::tpc_Index.
388
typedef union {
389 390 391 392
  /// 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;
393 394
} TPC_INDEX_t;

395
/// TPC-PDCCH-Config Information Element from 36.331 RRC spec
396
typedef struct {
397
  /// RNTI for power control using DCI format 3/3A, see TS 36.212. \vr{[0..65535]}
398
  uint16_t rnti;
399
  /// 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).
400 401 402
  TPC_INDEX_t tpc_Index;
} TPC_PDCCH_CONFIG;

403
/// Enumeration for parameter SR transmission \ref SCHEDULING_REQUEST_CONFIG::dsr_TransMax.
404 405 406 407 408 409 410 411
typedef enum {
  sr_n4=0,
  sr_n8=1,
  sr_n16=2,
  sr_n32=3,
  sr_n64=4
} DSR_TRANSMAX_t;

412
/// SchedulingRequestConfig Information Element from 36.331 RRC spec
413
typedef struct {
414
  /// Parameter: \f$n^{(1)}_\text{PUCCH,SRI}\f$, see TS 36.213 (10.1). \vr{[0..2047]}
415
  uint16_t sr_PUCCH_ResourceIndex;
416
  /// Parameter: \f$I_\text{SR}\f$, see TS 36.213 (10.1). \vr{[0..155]}
417
  uint8_t sr_ConfigIndex;
418
  /// 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.
419 420 421
  DSR_TRANSMAX_t dsr_TransMax;
} SCHEDULING_REQUEST_CONFIG;

422
/// CQI-ReportPeriodic
423
typedef struct {
424
  /// Parameter: \f$n^{(2)}_\text{PUCCH}\f$, see TS 36.213 (7.2). \vr{[0..1185]}
425
  uint16_t cqi_PUCCH_ResourceIndex;
426
  /// 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]}
427
  uint16_t cqi_PMI_ConfigIndex;
428
  /// Parameter: K, see 36.213 (4.2.2). \vr{[1..4]}
429
  uint8_t K;
430
  /// Parameter: RI Config Index \f$I_\text{RI}\f$, see TS 36.213 (7.2.2-1B). \vr{[0..1023]}
431
  uint16_t ri_ConfigIndex;
432
  /// 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.
433
  uint8_t simultaneousAckNackAndCQI;
434 435
} CQI_REPORTPERIODIC;

436 437 438 439 440 441 442 443 444 445
/// 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
446
typedef struct {
447
  /// 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].
448
  CQI_REPORTMODEAPERIODIC cqi_ReportModeAperiodic;
449
  /// Parameter: \f$\Delta_\text{offset}\f$, see TS 36.213 (7.2.3). \vr{[-1..6]}\n Actual value = IE value * 2 [dB].
450
  int8_t nomPDSCH_RS_EPRE_Offset;
451 452 453
  CQI_REPORTPERIODIC CQI_ReportPeriodic;
} CQI_REPORT_CONFIG;

454
/// MBSFN-SubframeConfig Information Element from 36.331 RRC spec \note deviates from specification.
455
typedef struct {
456
  /// 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}.
457
  int radioframeAllocationPeriod;
458
  /// 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.
459
  int radioframeAllocationOffset;
460
  /// oneFrame or fourFrames. \vr{[0..1]}
461
  int fourFrames_flag;
462 463 464 465 466
  /// 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.
467 468 469 470 471
  int mbsfn_SubframeConfig;
} MBSFN_config_t;

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

  struct MBSFN_SubframeConfig *mbsfn_SubframeConfig[MAX_MBSFN_AREA];

} LTE_DL_FRAME_PARMS;

typedef enum {
575
  /// TM1
576
  SISO=0,
577
  /// TM2
578
  ALAMOUTI=1,
579
  /// TM3
580
  LARGE_CDD=2,
581
  /// the next 6 entries are for TM5
582 583 584 585 586 587
  UNIFORM_PRECODING11=3,
  UNIFORM_PRECODING1m1=4,
  UNIFORM_PRECODING1j=5,
  UNIFORM_PRECODING1mj=6,
  PUSCH_PRECODING0=7,
  PUSCH_PRECODING1=8,
588
  /// the next 3 entries are for TM4
589 590
  DUALSTREAM_UNIFORM_PRECODING1=9,
  DUALSTREAM_UNIFORM_PRECODINGj=10,
Raymond Knopp's avatar
 
Raymond Knopp committed
591
  DUALSTREAM_PUSCH_PRECODING=11,
592 593 594
  TM7=12,
  TM8=13,
  TM9_10=14
595 596
} MIMO_mode_t;

597
typedef struct {
598 599 600 601 602
  /// \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:
603
  int32_t **txdata[3];
604
  /// \brief holds the transmit data in the frequency domain.
Xiwen JIANG's avatar
Xiwen JIANG committed
605
  /// For IFFT_FPGA this points to the same memory as PHY_vars->rx_vars[a].RX_DMA_BUFFER. //?
606
  /// - first index: eNB id [0..2] (hard coded)
Xiwen JIANG's avatar
Xiwen JIANG committed
607
  /// - second index: tx antenna [0..14[ where 14 is the total supported antenna ports.
608
  /// - third index: sample [0..]
609
  mod_sym_t **txdataF[3];
Xiwen JIANG's avatar
Xiwen JIANG committed
610 611 612 613 614 615
  /// \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..]
  mod_sym_t **txdataF_BF[3];
616 617 618 619 620
  /// \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: eNB id [0..2] (hard coded)
  /// - second index: rx antenna [0..nb_antennas_rx[
  /// - third index: sample [0..]
621
  int32_t **rxdata[3];
622 623 624 625
  /// \brief Holds the last subframe of received data in time domain after removal of 7.5kHz frequency offset.
  /// - first index: eNB id [0..2] (hard coded)
  /// - second index: rx antenna [0..nb_antennas_rx[
  /// - third index: sample [0..samples_per_tti[
626
  int32_t **rxdata_7_5kHz[3];
627 628 629 630
  /// \brief Holds the received data in the frequency domain.
  /// - first index: eNB id [0..2] (hard coded)
  /// - second index: rx antenna [0..nb_antennas_rx[
  /// - third index: ? [0..2*ofdm_symbol_size*frame_parms->symbols_per_tti[
631
  int32_t **rxdataF[3];
632 633 634
  /// \brief Holds output of the sync correlator.
  /// - first index: eNB id [0..2] (hard coded)
  /// - second index: sample [0..samples_per_tti*10[
635
  uint32_t *sync_corr[3];
Xiwen JIANG's avatar
Xiwen JIANG committed
636 637 638 639 640 641 642 643 644 645 646 647
  /// \brief Holds the cell specific beamforming weights
  /// - first index: eNB id [0..2] (hard coded)
  /// - second index: cell specific eNB antenna port index, up to 2 logical antenna ports are supported
  /// - third index: tx antenna [0..nb_antennas_tx[
  /// - fourth index: sample [0..]
  int32_t **cell_spec_bf_weights[3][2];
  /// \brief Holds the ue specific beamforming weights
  /// - first index: eNB id [0..2] (hard coded)
  /// - second index: ue specific eNB antenna port index, port5->index0, port7-15->index0-7
  /// - third index: tx antenna [0..nb_antennas_tx[
  /// - fourth index: sample [0..]
  int32_t **ue_spec_bf_weights[3][8];
648 649
} LTE_eNB_COMMON;

650
typedef struct {
651 652 653 654
  /// \brief Hold the channel estimates in frequency domain based on SRS.
  /// - first index: eNB id [0..2] (hard coded)
  /// - second index: rx antenna id [0..nb_antennas_rx[
  /// - third index: ? [0..ofdm_symbol_size[
655
  int32_t **srs_ch_estimates[3];
656 657 658 659
  /// \brief Hold the channel estimates in time domain based on SRS.
  /// - first index: eNB id [0..2] (hard coded)
  /// - second index: rx antenna id [0..nb_antennas_rx[
  /// - third index: ? [0..2*ofdm_symbol_size[
660
  int32_t **srs_ch_estimates_time[3];
661 662
  /// \brief Holds the SRS for channel estimation at the RX.
  /// - first index: ? [0..ofdm_symbol_size[
663
  int32_t *srs;
664 665
} LTE_eNB_SRS;

666
typedef struct {
667 668 669 670 671 672
  /// \brief Holds the received data in the frequency domain for the allocated RBs in repeated format.
  /// - first index: eNB id [0..2] (hard coded)
  /// - 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
673
  int32_t **rxdataF_ext[3];
674 675 676 677
  /// \brief Holds the received data in the frequency domain for the allocated RBs in normal format.
  /// - first index: eNB id [0..2] (hard coded)
  /// - 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[
678
  int32_t **rxdataF_ext2[3];
679 680 681 682
  /// \brief Hold the channel estimates in time domain based on DRS.
  /// - first index: eNB id [0..2] (hard coded)
  /// - second index: rx antenna id [0..nb_antennas_rx[
  /// - third index: ? [0..4*ofdm_symbol_size[
683
  int32_t **drs_ch_estimates_time[3];
684 685 686 687
  /// \brief Hold the channel estimates in frequency domain based on DRS.
  /// - 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[
688
  int32_t **drs_ch_estimates[3];
689 690 691 692
  /// \brief Hold the channel estimates 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[
693
  int32_t **drs_ch_estimates_0[3];
694 695 696 697
  /// \brief Hold the channel estimates for UE1 in case of Distributed Almouti 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[
698
  int32_t **drs_ch_estimates_1[3];
699 700 701 702
  /// \brief Holds the compensated signal.
  /// - 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[
703
  int32_t **rxdataF_comp[3];
704 705 706 707
  /// \brief Hold the compensated data (y)*(h0*) 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[
708
  int32_t **rxdataF_comp_0[3];
709 710 711 712
  /// \brief Hold the compensated data (y*)*(h1) 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[
713
  int32_t **rxdataF_comp_1[3];
714 715 716 717
  /// \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[
718
  int32_t **ul_ch_mag[3];
719 720 721 722
  /// \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[
723
  int32_t **ul_ch_magb[3];
724 725 726 727
  /// \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[
728
  int32_t **ul_ch_mag_0[3];
729 730 731 732
  /// \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[
733
  int32_t **ul_ch_magb_0[3];
734 735 736 737
  /// \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[
738
  int32_t **ul_ch_mag_1[3];
739 740 741 742
  /// \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[
743
  int32_t **ul_ch_magb_1[3];
744 745 746 747 748 749
  /// 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];
750 751
  /// \brief llr values.
  /// - first index: ? [0..1179743] (hard coded)
752
  int16_t *llr;
753 754 755 756 757 758
#ifdef LOCALIZATION
  /// number of active subcarrier for a specific UE
  int32_t active_subcarrier;
  /// subcarrier power in dBm
  int32_t *subcarrier_power;
#endif
759 760 761
} LTE_eNB_PUSCH;

typedef struct {
762 763 764 765
  /// \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[
766
  int32_t **txdata;
767 768 769 770 771 772 773 774 775
  /// \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[
  mod_sym_t **txdataF;
  /// \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[
776
  int32_t **rxdata;
777 778 779
  /// \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[
780
  int32_t **rxdataF;
781 782 783
  /// \brief ?.
  /// - first index: rx antenna [0..nb_antennas_rx[
  /// - second index: ? [0..20*ofdm_symbol_size*symbols_per_tti[
784
  int32_t **rxdataF2;
785 786 787 788
  /// \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)[
789
  int32_t **dl_ch_estimates[7];
790 791 792 793
  /// \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[
794
  int32_t **dl_ch_estimates_time[7];
795
  /// holds output of the sync correlator
796
  int32_t *sync_corr;
797
  /// estimated frequency offset (in radians) for all subcarriers
798
  int32_t freq_offset;
799
  /// eNb_id user is synched to
800
  int32_t eNb_id;
801 802 803
} LTE_UE_COMMON;

typedef struct {
804 805 806
  /// \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[
807
  int32_t **rxdataF_ext;
808 809 810 811
  /// \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;
812 813 814
  /// \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[
815
  int32_t **rxdataF_comp0;
816
  /// \brief Received frequency-domain signal after extraction and channel compensation.
817 818
  /// - first index: ? [0..7] (hard coded) accessed via \c round
  /// - second index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
819
  /// - third index: ? [0..168*N_RB_DL[
Raymond Knopp's avatar
Raymond Knopp committed
820
  int32_t **rxdataF_comp1[8];
821 822 823
  /// \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[
824
  int32_t **dl_ch_estimates_ext;
825 826 827 828 829 830 831 832
  /// \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;
833 834 835
  /// \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[
836
  int32_t **dl_ch_rho_ext;
837 838 839 840
  /// \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;
841 842
  /// \brief Downlink PMIs extracted in PRBS and grouped in subbands.
  /// - first index: ressource block [0..N_RB_DL[
843
  uint8_t *pmi_ext;
844 845 846
  /// \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[
847
  int32_t **dl_ch_mag0;
848 849 850
  /// \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[
851
  int32_t **dl_ch_mag1;
852 853 854
  /// \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[
855
  int32_t **dl_ch_magb0;
856 857 858
  /// \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[
859
  int32_t **dl_ch_magb1;
860 861 862
  /// \brief Cross-correlation of two eNB signals.
  /// - first index: rx antenna [0..nb_antennas_rx[
  /// - second index: symbol [0..]
863
  int32_t **rho;
864
  /// never used... always send dl_ch_rho_ext instead...
865
  int32_t **rho_i;
866 867 868
  /// \brief Pointers to llr vectors (2 TBs).
  /// - first index: ? [0..1] (hard coded)
  /// - second index: ? [0..1179743] (hard coded)
869
  int16_t *llr[2];
870
  /// \f$\log_2(\max|H_i|^2)\f$
871
  int16_t log2_maxh;
872 873
  /// \brief LLR shifts for subband scaling.
  /// - first index: ? [0..168*N_RB_DL[
874
  uint8_t *llr_shifts;
875 876
  /// \brief Pointer to LLR shifts.
  /// - first index: ? [0..168*N_RB_DL[
877
  uint8_t *llr_shifts_p;
878 879 880
  /// \brief Pointers to llr vectors (128-bit alignment).
  /// - first index: ? [0..0] (hard coded)
  /// - second index: ? [0..]
881
  int16_t **llr128;
882 883 884 885
  /// \brief Pointers to llr vectors (128-bit alignment).
  /// - first index: ? [0..0] (hard coded)
  /// - second index: ? [0..]
  int16_t **llr128_2ndstream;
886 887
  //uint32_t *rb_alloc;
  //uint8_t Qm[2];
888 889 890 891
  //MIMO_mode_t mimo_mode;
} LTE_UE_PDSCH;

typedef struct {
892 893 894
  /// \brief Received frequency-domain signal after extraction.
  /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
  /// - second index: ? [0..]
895
  int32_t **rxdataF_ext;
896 897 898
  /// \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..]
899
  double **rxdataF_comp;
900 901 902
  /// \brief Downlink channel estimates extracted in PRBS.
  /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
  /// - second index: ? [0..]
903
  int32_t **dl_ch_estimates_ext;
904 905 906
  ///  \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..]
907
  double **dl_ch_rho_ext;
908 909
  /// \brief Downlink PMIs extracted in PRBS and grouped in subbands.
  /// - first index: ressource block [0..N_RB_DL[
910
  uint8_t *pmi_ext;
911 912 913
  /// \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..]
914
  double **dl_ch_mag;
915 916 917
  /// \brief Magnitude of Downlink Channel (2nd 64QAM level).
  /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
  /// - second index: ? [0..]
918
  double **dl_ch_magb;
919 920 921
  /// \brief Cross-correlation of two eNB signals.
  /// - first index: rx antenna [0..nb_antennas_rx[
  /// - second index: ? [0..]
922 923
  double **rho;
  /// never used... always send dl_ch_rho_ext instead...
924
  double **rho_i;
925 926 927
  /// \brief Pointers to llr vectors (2 TBs).
  /// - first index: ? [0..1] (hard coded)
  /// - second index: ? [0..1179743] (hard coded)
928
  int16_t *llr[2];
929
  /// \f$\log_2(\max|H_i|^2)\f$
930
  uint8_t log2_maxh;
931 932 933
  /// \brief Pointers to llr vectors (128-bit alignment).
  /// - first index: ? [0..0] (hard coded)
  /// - second index: ? [0..]
934 935 936
  int16_t **llr128;
  //uint32_t *rb_alloc;
  //uint8_t Qm[2];
937 938 939 940
  //MIMO_mode_t mimo_mode;
} LTE_UE_PDSCH_FLP;

typedef struct {
941
  /// \brief Pointers to extracted PDCCH symbols in frequency-domain.
942 943
  /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
  /// - second index: ? [0..168*N_RB_DL[
944
  int32_t **rxdataF_ext;
945 946 947
  /// \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[
948
  int32_t **rxdataF_comp;
949 950 951
  /// \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[
952
  int32_t **dl_ch_estimates_ext;
953 954 955
  /// \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[
956
  int32_t **dl_ch_rho_ext;
957 958 959
  /// \brief Pointers to channel cross-correlation vectors for multi-eNB detection.
  /// - first index: rx antenna [0..nb_antennas_rx[
  /// - second index: ? [0..]
960
  int32_t **rho;
961 962
  /// \brief Pointer to llrs, 4-bit resolution.
  /// - first index: ? [0..48*N_RB_DL[
963
  uint16_t *llr;
964 965
  /// \brief Pointer to llrs, 16-bit resolution.
  /// - first index: ? [0..96*N_RB_DL[
966
  uint16_t *llr16;
967 968
  /// \brief \f$\overline{w}\f$ from 36-211.
  /// - first index: ? [0..48*N_RB_DL[
969
  uint16_t *wbar;
970 971
  /// \brief PDCCH/DCI e-sequence (input to rate matching).
  /// - first index: ? [0..96*N_RB_DL[
972
  int8_t *e_rx;
973
  /// number of PDCCH symbols in current subframe
974
  uint8_t num_pdcch_symbols;
975
  /// Allocated CRNTI for UE
976
  uint16_t crnti;
977
  /// Total number of PDU errors (diagnostic mode)
978
  uint32_t dci_errors;
979
  /// Total number of PDU received
980
  uint32_t dci_received;
981
  /// Total number of DCI False detection (diagnostic mode)
982
  uint32_t dci_false;
983
  /// Total number of DCI missed (diagnostic mode)
984
  uint32_t dci_missed;
985
  /// nCCE for PUCCH per subframe
986
  uint8_t nCCE[10];
987 988 989 990
} LTE_UE_PDCCH;

#define PBCH_A 24
typedef struct {
991 992 993
  uint8_t pbch_d[96+(3*(16+PBCH_A))];
  uint8_t pbch_w[3*3*(16+PBCH_A)];
  uint8_t pbch_e[1920];
994 995 996
} LTE_eNB_PBCH;

typedef struct {
997 998 999
  /// \brief Pointers to extracted PBCH symbols in frequency-domain.
  /// - first index: rx antenna [0..nb_antennas_rx[
  /// - second index: ? [0..287] (hard coded)
1000
  int32_t **rxdataF_ext;
1001 1002 1003
  /// \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)
1004
  int32_t **rxdataF_comp;
1005 1006 1007
  /// \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)
1008
  int32_t **dl_ch_estimates_ext;
1009 1010
  /// \brief Pointer to PBCH llrs.
  /// - first index: ? [0..1919] (hard coded)
1011
  int8_t *llr;
1012 1013
  /// \brief Pointer to PBCH decoded output.
  /// - first index: ? [0..63] (hard coded)
1014
  uint8_t *decoded_output;
1015
  /// \brief Total number of PDU errors.
1016
  uint32_t pdu_errors;
1017
  /// \brief Total number of PDU errors 128 frames ago.
1018
  uint32_t pdu_errors_last;
1019
  /// \brief Total number of consecutive PDU errors.
1020
  uint32_t pdu_errors_conseq;
1021
  /// \brief FER (in percent) .
1022
  uint32_t pdu_fer;
1023 1024 1025
} LTE_UE_PBCH;

typedef struct {
1026 1027 1028
  int16_t amp;
  int16_t *prachF;
  int16_t *prach;
1029 1030 1031
} LTE_UE_PRACH;

typedef struct {
1032 1033
  /// \brief ?.
  /// first index: ? [0..1023] (hard coded)
1034
  int16_t *prachF;
1035 1036 1037
  /// \brief ?.
  /// first index: rx antenna [0..3] (hard coded) \note Hard coded array size indexed by \c nb_antennas_rx.
  /// second index: ? [0..ofdm_symbol_size*12[
1038
  int16_t *rxsigF[4];
1039 1040 1041 1042
  /// \brief local buffer to compute prach_ifft (necessary in case of multiple CCs)
  /// first index: rx antenna [0..3] (hard coded) \note Hard coded array size indexed by \c nb_antennas_rx.
  /// second index: ? [0..2047] (hard coded)
  int16_t *prach_ifft[4];
1043 1044 1045 1046
} LTE_eNB_PRACH;

typedef struct {
  /// Preamble index for PRACH (0-63)
1047
  uint8_t ra_PreambleIndex;
1048
  /// RACH MaskIndex
1049
  uint8_t ra_RACH_MaskIndex;
1050
  /// Target received power at eNB (-120 ... -82 dBm)
1051
  int8_t ra_PREAMBLE_RECEIVED_TARGET_POWER;
1052
  /// PRACH index for TDD (0 ... 6) depending on TDD configuration and prachConfigIndex
1053
  uint8_t ra_TDD_map_index;
1054
  /// Corresponding RA-RNTI for UL-grant
1055
  uint16_t ra_RNTI;
1056
  /// Pointer to Msg3 payload for UL-grant
1057
  uint8_t *Msg3;
1058 1059 1060 1061
} PRACH_RESOURCES_t;

typedef struct {
  /// Downlink Power offset field
1062
  uint8_t dl_pow_off;
1063
  ///Subband resource allocation field
1064
  uint8_t rballoc_sub[50];
1065
  ///Total number of PRBs indicator
1066
  uint8_t pre_nb_available_rbs;
1067
} MU_MIMO_mode;
1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083

typedef enum {
  NOT_SYNCHED=0,
  PRACH=1,
  RA_RESPONSE=2,
  PUSCH=3,
  RESYNCH=4
} UE_MODE_t;



typedef enum {SF_DL, SF_UL, SF_S} lte_subframe_t;

#endif