uci_tools.c 28.9 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
/*
 * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The OpenAirInterface Software Alliance licenses this file to You under
 * the OAI Public License, Version 1.0  (the "License"); you may not use this file
 * except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.openairinterface.org/?page_id=698
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *-------------------------------------------------------------------------------
 * For more information about the OpenAirInterface (OAI) Software Alliance:
 *      contact@openairinterface.org
 */

22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
/*! \file PHY/LTE_TRANSPORT/phich.c
* \brief Routines for generation of and computations regarding the uplink control information (UCI) for PUSCH. V8.6 2009-03
* \author R. Knopp, F. Kaltenberger, A. Bhamri
* \date 2011
* \version 0.1
* \company Eurecom
* \email: knopp@eurecom.fr, florian.kaltenberger@eurecom.fr, ankit.bhamri@eurecom.fr
* \note
* \warning
*/
#include "PHY/defs.h"
#include "PHY/extern.h"
#ifdef DEBUG_UCI_TOOLS
#include "PHY/vars.h"
#endif
37 38

//#define DEBUG_UCI 1
39

40 41
uint64_t pmi2hex_2Ar1(uint32_t pmi)
{
42

knopp's avatar
knopp committed
43 44
  uint64_t pmil = (uint64_t)pmi;

45 46 47 48
  return ((pmil&3) + (((pmil>>2)&3)<<4) + (((pmil>>4)&3)<<8) + (((pmil>>6)&3)<<12) +
          (((pmil>>8)&3)<<16) + (((pmil>>10)&3)<<20) + (((pmil>>12)&3)<<24) +
          (((pmil>>14)&3)<<28) + (((pmil>>16)&3)<<32) + (((pmil>>18)&3)<<36) +
          (((pmil>>20)&3)<<40) + (((pmil>>22)&3)<<44) + (((pmil>>24)&3)<<48));
49 50
}

51 52
uint64_t pmi2hex_2Ar2(uint32_t pmi)
{
53

knopp's avatar
knopp committed
54
  uint64_t pmil = (uint64_t)pmi;
55 56 57 58
  return ((pmil&1) + (((pmil>>1)&1)<<4) + (((pmil>>2)&1)<<8) + (((pmil>>3)&1)<<12) +
          (((pmil>>4)&1)<<16) + (((pmil>>5)&1)<<20) + (((pmil>>6)&1)<<24) +
          (((pmil>>7)&1)<<28) + (((pmil>>8)&1)<<32) + (((pmil>>9)&1)<<36) +
          (((pmil>>10)&1)<<40) + (((pmil>>11)&1)<<44) + (((pmil>>12)&1)<<48));
59 60
}

61 62
uint64_t cqi2hex(uint32_t cqi)
{
63

knopp's avatar
knopp committed
64
  uint64_t cqil = (uint64_t)cqi;
65
  return ((cqil&3) + (((cqil>>2)&3)<<4) + (((cqil>>4)&3)<<8) + (((cqil>>6)&3)<<12) +
knopp's avatar
knopp committed
66
          (((cqil>>8)&3)<<16) + (((cqil>>10)&3)<<20) + (((cqil>>12)&3)<<24) +
67 68
          (((cqil>>14)&3)<<28) + (((cqil>>16)&3)<<32) + (((cqil>>18)&3)<<36) +
          (((cqil>>20)&3)<<40) + (((cqil>>22)&3)<<44) + (((cqil>>24)&3)<<48));
69 70
}

71
//void do_diff_cqi(uint8_t N_RB_DL,
72 73 74
//     uint8_t *DL_subband_cqi,
//     uint8_t DL_cqi,
//     uint32_t diffcqi1) {
75
//
76
//  uint8_t nb_sb,i,offset;
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
//
//  // This is table 7.2.1-3 from 36.213 (with k replaced by the number of subbands, nb_sb)
//  switch (N_RB_DL) {
//  case 6:
//    nb_sb=0;
//    break;
//  case 15:
//    nb_sb = 4;
//  case 25:
//    nb_sb = 7;
//    break;
//  case 50:
//    nb_sb = 9;
//    break;
//  case 75:
//    nb_sb = 10;
//    break;
//  case 100:
//    nb_sb = 13;
//    break;
//  default:
//    nb_sb=0;
//    break;
//  }
//
//  memset(DL_subband_cqi,0,13);
//
//  for (i=0;i<nb_sb;i++) {
//    offset = (DL_cqi>>(2*i))&3;
//    if (offset == 3)
//      DL_subband_cqi[i] = DL_cqi - 1;
//    else
//      DL_subband_cqi[i] = DL_cqi + offset;
//  }
//}


114
void do_diff_cqi(uint8_t N_RB_DL,
115 116 117 118
                 uint8_t *DL_subband_cqi,
                 uint8_t DL_cqi,
                 uint32_t diffcqi1)
{
119

120
  uint8_t nb_sb,i,offset;
121 122 123 124

  // This is table 7.2.1-3 from 36.213 (with k replaced by the number of subbands, nb_sb)
  switch (N_RB_DL) {
  case 6:
knopp's avatar
knopp committed
125
    nb_sb=1;
126
    break;
127

128 129
  case 15:
    nb_sb = 4;
130
    break;
131

132 133 134
  case 25:
    nb_sb = 7;
    break;
135

136 137 138
  case 50:
    nb_sb = 9;
    break;
139

140 141 142
  case 75:
    nb_sb = 10;
    break;
143

144 145 146
  case 100:
    nb_sb = 13;
    break;
147

148 149 150 151 152 153 154
  default:
    nb_sb=0;
    break;
  }

  memset(DL_subband_cqi,0,13);

155
  for (i=0; i<nb_sb; i++) {
156
    offset = (diffcqi1>>(2*i))&3;
157

158 159
    if (offset == 3)
      DL_subband_cqi[i] = DL_cqi - 1;
160
    else
161 162 163 164
      DL_subband_cqi[i] = DL_cqi + offset;
  }
}

165 166
void extract_CQI(void *o,UCI_format_t uci_format,LTE_eNB_UE_stats *stats, uint8_t N_RB_DL, uint16_t * crnti, uint8_t * access_mode)
{
167 168 169

  //unsigned char rank;
  //UCI_format fmt;
170 171 172
  //uint8_t N_RB_DL = 25;
  LOG_D(PHY,"[eNB][UCI] N_RB_DL %d uci format %d\n", N_RB_DL,uci_format);

knopp's avatar
knopp committed
173 174
  switch(N_RB_DL) {
  case 6:
175
    switch(uci_format) {
knopp's avatar
knopp committed
176 177
    case wideband_cqi_rank1_2A:
      stats->DL_cqi[0]     = (((wideband_cqi_rank1_2A_1_5MHz *)o)->cqi1);
178

knopp's avatar
knopp committed
179
      if (stats->DL_cqi[0] > 24)
180 181 182
        stats->DL_cqi[0] = 24;

      stats->DL_pmi_single = ((wideband_cqi_rank1_2A_1_5MHz *)o)->pmi;
knopp's avatar
knopp committed
183
      break;
184

knopp's avatar
knopp committed
185 186
    case wideband_cqi_rank2_2A:
      stats->DL_cqi[0]     = (((wideband_cqi_rank2_2A_1_5MHz *)o)->cqi1);
187

knopp's avatar
knopp committed
188
      if (stats->DL_cqi[0] > 24)
189 190
        stats->DL_cqi[0] = 24;

knopp's avatar
knopp committed
191
      stats->DL_cqi[1]     = (((wideband_cqi_rank2_2A_1_5MHz *)o)->cqi2);
192

knopp's avatar
knopp committed
193
      if (stats->DL_cqi[1] > 24)
194 195 196
        stats->DL_cqi[1] = 24;

      stats->DL_pmi_dual   = ((wideband_cqi_rank2_2A_1_5MHz *)o)->pmi;
knopp's avatar
knopp committed
197
      break;
198

knopp's avatar
knopp committed
199 200
    case HLC_subband_cqi_nopmi:
      stats->DL_cqi[0]     = (((HLC_subband_cqi_nopmi_1_5MHz *)o)->cqi1);
201

knopp's avatar
knopp committed
202
      if (stats->DL_cqi[0] > 24)
203 204
        stats->DL_cqi[0] = 24;

knopp's avatar
knopp committed
205 206
      do_diff_cqi(N_RB_DL,stats->DL_subband_cqi[0],stats->DL_cqi[0],((HLC_subband_cqi_nopmi_1_5MHz *)o)->diffcqi1);
      break;
207

knopp's avatar
knopp committed
208 209
    case HLC_subband_cqi_rank1_2A:
      stats->DL_cqi[0]     = (((HLC_subband_cqi_rank1_2A_1_5MHz *)o)->cqi1);
210

knopp's avatar
knopp committed
211
      if (stats->DL_cqi[0] > 24)
212 213 214 215
        stats->DL_cqi[0] = 24;

      do_diff_cqi(N_RB_DL,stats->DL_subband_cqi[0],stats->DL_cqi[0],(((HLC_subband_cqi_rank1_2A_1_5MHz *)o)->diffcqi1));
      stats->DL_pmi_single = ((HLC_subband_cqi_rank1_2A_1_5MHz *)o)->pmi;
knopp's avatar
knopp committed
216
      break;
217

knopp's avatar
knopp committed
218 219
    case HLC_subband_cqi_rank2_2A:
      stats->DL_cqi[0]     = (((HLC_subband_cqi_rank2_2A_1_5MHz *)o)->cqi1);
220

knopp's avatar
knopp committed
221
      if (stats->DL_cqi[0] > 24)
222 223
        stats->DL_cqi[0] = 24;

knopp's avatar
knopp committed
224
      stats->DL_cqi[1]     = (((HLC_subband_cqi_rank2_2A_1_5MHz *)o)->cqi2);
225

knopp's avatar
knopp committed
226
      if (stats->DL_cqi[1] > 24)
227 228 229 230 231
        stats->DL_cqi[1] = 24;

      do_diff_cqi(N_RB_DL,stats->DL_subband_cqi[0],stats->DL_cqi[0],(((HLC_subband_cqi_rank2_2A_1_5MHz *)o)->diffcqi1));
      do_diff_cqi(N_RB_DL,stats->DL_subband_cqi[1],stats->DL_cqi[1],(((HLC_subband_cqi_rank2_2A_1_5MHz *)o)->diffcqi2));
      stats->DL_pmi_dual   = ((HLC_subband_cqi_rank2_2A_1_5MHz *)o)->pmi;
knopp's avatar
knopp committed
232
      break;
233

knopp's avatar
knopp committed
234
    case HLC_subband_cqi_mcs_CBA:
235 236 237 238
      if ((*crnti == ((HLC_subband_cqi_mcs_CBA_1_5MHz *)o)->crnti) && (*crnti !=0)) {
        *access_mode=CBA_ACCESS;
        LOG_N(PHY,"[eNB] UCI for CBA : mcs %d  crnti %x\n",
              ((HLC_subband_cqi_mcs_CBA_1_5MHz *)o)->mcs, ((HLC_subband_cqi_mcs_CBA_1_5MHz *)o)->crnti);
knopp's avatar
knopp committed
239
      } else {
240 241
        LOG_D(PHY,"[eNB] UCI for CBA : rnti (enb context %x, rx uci %x) invalid, unknown access\n",
              *crnti, ((HLC_subband_cqi_mcs_CBA_1_5MHz *)o)->crnti);
knopp's avatar
knopp committed
242
      }
243

knopp's avatar
knopp committed
244
      break;
245

knopp's avatar
knopp committed
246 247
    case unknown_cqi:
    default:
248
      LOG_N(PHY,"[eNB][UCI] received unknown uci (rb %d)\n",N_RB_DL);
knopp's avatar
knopp committed
249 250
      break;
    }
251

252
    break;
253

knopp's avatar
knopp committed
254 255
  case 25:

256
    switch(uci_format) {
knopp's avatar
knopp committed
257 258
    case wideband_cqi_rank1_2A:
      stats->DL_cqi[0]     = (((wideband_cqi_rank1_2A_5MHz *)o)->cqi1);
259

knopp's avatar
knopp committed
260
      if (stats->DL_cqi[0] > 24)
261 262 263
        stats->DL_cqi[0] = 24;

      stats->DL_pmi_single = ((wideband_cqi_rank1_2A_5MHz *)o)->pmi;
knopp's avatar
knopp committed
264
      break;
265

knopp's avatar
knopp committed
266 267
    case wideband_cqi_rank2_2A:
      stats->DL_cqi[0]     = (((wideband_cqi_rank2_2A_5MHz *)o)->cqi1);
268

knopp's avatar
knopp committed
269
      if (stats->DL_cqi[0] > 24)
270 271
        stats->DL_cqi[0] = 24;

knopp's avatar
knopp committed
272
      stats->DL_cqi[1]     = (((wideband_cqi_rank2_2A_5MHz *)o)->cqi2);
273

knopp's avatar
knopp committed
274
      if (stats->DL_cqi[1] > 24)
275 276 277
        stats->DL_cqi[1] = 24;

      stats->DL_pmi_dual   = ((wideband_cqi_rank2_2A_5MHz *)o)->pmi;
knopp's avatar
knopp committed
278
      break;
279

knopp's avatar
knopp committed
280 281
    case HLC_subband_cqi_nopmi:
      stats->DL_cqi[0]     = (((HLC_subband_cqi_nopmi_5MHz *)o)->cqi1);
282

knopp's avatar
knopp committed
283
      if (stats->DL_cqi[0] > 24)
284 285
        stats->DL_cqi[0] = 24;

knopp's avatar
knopp committed
286 287
      do_diff_cqi(N_RB_DL,stats->DL_subband_cqi[0],stats->DL_cqi[0],((HLC_subband_cqi_nopmi_5MHz *)o)->diffcqi1);
      break;
288

knopp's avatar
knopp committed
289 290
    case HLC_subband_cqi_rank1_2A:
      stats->DL_cqi[0]     = (((HLC_subband_cqi_rank1_2A_5MHz *)o)->cqi1);
291

knopp's avatar
knopp committed
292
      if (stats->DL_cqi[0] > 24)
293 294 295 296
        stats->DL_cqi[0] = 24;

      do_diff_cqi(N_RB_DL,stats->DL_subband_cqi[0],stats->DL_cqi[0],(((HLC_subband_cqi_rank1_2A_5MHz *)o)->diffcqi1));
      stats->DL_pmi_single = ((HLC_subband_cqi_rank1_2A_5MHz *)o)->pmi;
knopp's avatar
knopp committed
297
      break;
298

knopp's avatar
knopp committed
299 300
    case HLC_subband_cqi_rank2_2A:
      stats->DL_cqi[0]     = (((HLC_subband_cqi_rank2_2A_5MHz *)o)->cqi1);
301

knopp's avatar
knopp committed
302
      if (stats->DL_cqi[0] > 24)
303 304
        stats->DL_cqi[0] = 24;

knopp's avatar
knopp committed
305
      stats->DL_cqi[1]     = (((HLC_subband_cqi_rank2_2A_5MHz *)o)->cqi2);
306

knopp's avatar
knopp committed
307
      if (stats->DL_cqi[1] > 24)
308 309 310 311 312
        stats->DL_cqi[1] = 24;

      do_diff_cqi(N_RB_DL,stats->DL_subband_cqi[0],stats->DL_cqi[0],(((HLC_subband_cqi_rank2_2A_5MHz *)o)->diffcqi1));
      do_diff_cqi(N_RB_DL,stats->DL_subband_cqi[1],stats->DL_cqi[1],(((HLC_subband_cqi_rank2_2A_5MHz *)o)->diffcqi2));
      stats->DL_pmi_dual   = ((HLC_subband_cqi_rank2_2A_5MHz *)o)->pmi;
knopp's avatar
knopp committed
313
      break;
314

knopp's avatar
knopp committed
315
    case HLC_subband_cqi_mcs_CBA:
316 317 318 319
      if ((*crnti == ((HLC_subband_cqi_mcs_CBA_5MHz *)o)->crnti) && (*crnti !=0)) {
        *access_mode=CBA_ACCESS;
        LOG_N(PHY,"[eNB] UCI for CBA : mcs %d  crnti %x\n",
              ((HLC_subband_cqi_mcs_CBA_5MHz *)o)->mcs, ((HLC_subband_cqi_mcs_CBA_5MHz *)o)->crnti);
knopp's avatar
knopp committed
320
      } else {
321 322
        LOG_D(PHY,"[eNB] UCI for CBA : rnti (enb context %x, rx uci %x) invalid, unknown access\n",
              *crnti, ((HLC_subband_cqi_mcs_CBA_5MHz *)o)->crnti);
knopp's avatar
knopp committed
323
      }
324

knopp's avatar
knopp committed
325
      break;
326

knopp's avatar
knopp committed
327 328
    case unknown_cqi:
    default:
329
      LOG_N(PHY,"[eNB][UCI] received unknown uci (rb %d)\n",N_RB_DL);
knopp's avatar
knopp committed
330
      break;
331
    }
332

333
    break;
334

knopp's avatar
knopp committed
335
  case 50:
336
    switch(uci_format) {
337 338
    case wideband_cqi_rank1_2A:
      stats->DL_cqi[0]     = (((wideband_cqi_rank1_2A_10MHz *)o)->cqi1);
339

340
      if (stats->DL_cqi[0] > 24)
341 342 343
        stats->DL_cqi[0] = 24;

      stats->DL_pmi_single = ((wideband_cqi_rank1_2A_10MHz *)o)->pmi;
344
      break;
345

346 347
    case wideband_cqi_rank2_2A:
      stats->DL_cqi[0]     = (((wideband_cqi_rank2_2A_10MHz *)o)->cqi1);
348

349
      if (stats->DL_cqi[0] > 24)
350 351
        stats->DL_cqi[0] = 24;

352
      stats->DL_cqi[1]     = (((wideband_cqi_rank2_2A_10MHz *)o)->cqi2);
353

354
      if (stats->DL_cqi[1] > 24)
355 356 357
        stats->DL_cqi[1] = 24;

      stats->DL_pmi_dual   = ((wideband_cqi_rank2_2A_10MHz *)o)->pmi;
358
      break;
359

360 361
    case HLC_subband_cqi_nopmi:
      stats->DL_cqi[0]     = (((HLC_subband_cqi_nopmi_10MHz *)o)->cqi1);
362

363
      if (stats->DL_cqi[0] > 24)
364 365
        stats->DL_cqi[0] = 24;

366 367
      do_diff_cqi(N_RB_DL,stats->DL_subband_cqi[0],stats->DL_cqi[0],((HLC_subband_cqi_nopmi_10MHz *)o)->diffcqi1);
      break;
368

369 370
    case HLC_subband_cqi_rank1_2A:
      stats->DL_cqi[0]     = (((HLC_subband_cqi_rank1_2A_10MHz *)o)->cqi1);
371

372
      if (stats->DL_cqi[0] > 24)
373 374 375 376
        stats->DL_cqi[0] = 24;

      do_diff_cqi(N_RB_DL,stats->DL_subband_cqi[0],stats->DL_cqi[0],(((HLC_subband_cqi_rank1_2A_10MHz *)o)->diffcqi1));
      stats->DL_pmi_single = ((HLC_subband_cqi_rank1_2A_10MHz *)o)->pmi;
377
      break;
378

379 380
    case HLC_subband_cqi_rank2_2A:
      stats->DL_cqi[0]     = (((HLC_subband_cqi_rank2_2A_10MHz *)o)->cqi1);
381

382
      if (stats->DL_cqi[0] > 24)
383 384
        stats->DL_cqi[0] = 24;

385
      stats->DL_cqi[1]     = (((HLC_subband_cqi_rank2_2A_10MHz *)o)->cqi2);
386

387
      if (stats->DL_cqi[1] > 24)
388 389 390 391 392
        stats->DL_cqi[1] = 24;

      do_diff_cqi(N_RB_DL,stats->DL_subband_cqi[0],stats->DL_cqi[0],(((HLC_subband_cqi_rank2_2A_10MHz *)o)->diffcqi1));
      do_diff_cqi(N_RB_DL,stats->DL_subband_cqi[1],stats->DL_cqi[1],(((HLC_subband_cqi_rank2_2A_10MHz *)o)->diffcqi2));
      stats->DL_pmi_dual   = ((HLC_subband_cqi_rank2_2A_10MHz *)o)->pmi;
393
      break;
394

395
    case HLC_subband_cqi_mcs_CBA:
396 397 398 399
      if ((*crnti == ((HLC_subband_cqi_mcs_CBA_10MHz *)o)->crnti) && (*crnti !=0)) {
        *access_mode=CBA_ACCESS;
        LOG_N(PHY,"[eNB] UCI for CBA : mcs %d  crnti %x\n",
              ((HLC_subband_cqi_mcs_CBA_10MHz *)o)->mcs, ((HLC_subband_cqi_mcs_CBA_10MHz *)o)->crnti);
400
      } else {
401 402
        LOG_D(PHY,"[eNB] UCI for CBA : rnti (enb context %x, rx uci %x) invalid, unknown access\n",
              *crnti, ((HLC_subband_cqi_mcs_CBA_10MHz *)o)->crnti);
403
      }
404

405
      break;
406

407 408 409 410 411
    case unknown_cqi:
    default:
      LOG_N(PHY,"[eNB][UCI] received unknown uci (RB %d)\n",N_RB_DL);
      break;
    }
412

knopp's avatar
knopp committed
413
    break;
414

knopp's avatar
knopp committed
415
  case 100:
416
    switch(uci_format) {
417 418
    case wideband_cqi_rank1_2A:
      stats->DL_cqi[0]     = (((wideband_cqi_rank1_2A_20MHz *)o)->cqi1);
419

420
      if (stats->DL_cqi[0] > 24)
421 422 423
        stats->DL_cqi[0] = 24;

      stats->DL_pmi_single = ((wideband_cqi_rank1_2A_20MHz *)o)->pmi;
424
      break;
425

426 427
    case wideband_cqi_rank2_2A:
      stats->DL_cqi[0]     = (((wideband_cqi_rank2_2A_20MHz *)o)->cqi1);
428

429
      if (stats->DL_cqi[0] > 24)
430 431
        stats->DL_cqi[0] = 24;

432
      stats->DL_cqi[1]     = (((wideband_cqi_rank2_2A_20MHz *)o)->cqi2);
433

434
      if (stats->DL_cqi[1] > 24)
435 436 437
        stats->DL_cqi[1] = 24;

      stats->DL_pmi_dual   = ((wideband_cqi_rank2_2A_20MHz *)o)->pmi;
438
      break;
439

440 441
    case HLC_subband_cqi_nopmi:
      stats->DL_cqi[0]     = (((HLC_subband_cqi_nopmi_20MHz *)o)->cqi1);
442

443
      if (stats->DL_cqi[0] > 24)
444 445
        stats->DL_cqi[0] = 24;

446 447
      do_diff_cqi(N_RB_DL,stats->DL_subband_cqi[0],stats->DL_cqi[0],((HLC_subband_cqi_nopmi_20MHz *)o)->diffcqi1);
      break;
448

449 450
    case HLC_subband_cqi_rank1_2A:
      stats->DL_cqi[0]     = (((HLC_subband_cqi_rank1_2A_20MHz *)o)->cqi1);
451

452
      if (stats->DL_cqi[0] > 24)
453 454 455 456
        stats->DL_cqi[0] = 24;

      do_diff_cqi(N_RB_DL,stats->DL_subband_cqi[0],stats->DL_cqi[0],(((HLC_subband_cqi_rank1_2A_20MHz *)o)->diffcqi1));
      stats->DL_pmi_single = ((HLC_subband_cqi_rank1_2A_20MHz *)o)->pmi;
457
      break;
458

459 460
    case HLC_subband_cqi_rank2_2A:
      stats->DL_cqi[0]     = (((HLC_subband_cqi_rank2_2A_20MHz *)o)->cqi1);
461

462
      if (stats->DL_cqi[0] > 24)
463 464
        stats->DL_cqi[0] = 24;

465
      stats->DL_cqi[1]     = (((HLC_subband_cqi_rank2_2A_20MHz *)o)->cqi2);
466

467
      if (stats->DL_cqi[1] > 24)
468 469 470 471 472
        stats->DL_cqi[1] = 24;

      do_diff_cqi(N_RB_DL,stats->DL_subband_cqi[0],stats->DL_cqi[0],(((HLC_subband_cqi_rank2_2A_20MHz *)o)->diffcqi1));
      do_diff_cqi(N_RB_DL,stats->DL_subband_cqi[1],stats->DL_cqi[1],(((HLC_subband_cqi_rank2_2A_20MHz *)o)->diffcqi2));
      stats->DL_pmi_dual   = ((HLC_subband_cqi_rank2_2A_20MHz *)o)->pmi;
473
      break;
474

475
    case HLC_subband_cqi_mcs_CBA:
476 477 478 479
      if ((*crnti == ((HLC_subband_cqi_mcs_CBA_20MHz *)o)->crnti) && (*crnti !=0)) {
        *access_mode=CBA_ACCESS;
        LOG_N(PHY,"[eNB] UCI for CBA : mcs %d  crnti %x\n",
              ((HLC_subband_cqi_mcs_CBA_20MHz *)o)->mcs, ((HLC_subband_cqi_mcs_CBA_20MHz *)o)->crnti);
480
      } else {
481 482
        LOG_D(PHY,"[eNB] UCI for CBA : rnti (enb context %x, rx uci %x) invalid, unknown access\n",
              *crnti, ((HLC_subband_cqi_mcs_CBA_20MHz *)o)->crnti);
483
      }
484

485
      break;
486

487 488 489 490 491
    case unknown_cqi:
    default:
      LOG_N(PHY,"[eNB][UCI] received unknown uci (RB %d)\n",N_RB_DL);
      break;
    }
492

493
    break;
494

495 496
  default:
    LOG_N(PHY,"[eNB][UCI] unknown RB %d\n",N_RB_DL);
497 498 499
    break;
  }

500
  /*
501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525
  switch (tmode) {

  case 1:
  case 2:
  case 3:
  case 5:
  case 6:
  case 7:
  default:
    fmt = hlc_cqi;
    break;
  case 4:
    fmt = wideband_cqi;
    break;
  }

  rank = o_RI[0];
  //printf("extract_CQI: rank = %d\n",rank);

  switch (fmt) {

  case wideband_cqi: //and subband pmi
    if (rank == 0) {
      stats->DL_cqi[0]     = (((wideband_cqi_rank1_2A_5MHz *)o)->cqi1);
      if (stats->DL_cqi[0] > 15)
526 527
  stats->DL_cqi[0] = 15;
      stats->DL_pmi_single = ((wideband_cqi_rank1_2A_5MHz *)o)->pmi;
528 529 530 531
    }
    else {
      stats->DL_cqi[0]     = (((wideband_cqi_rank2_2A_5MHz *)o)->cqi1);
      if (stats->DL_cqi[0] > 15)
532
  stats->DL_cqi[0] = 15;
533 534
      stats->DL_cqi[1]     = (((wideband_cqi_rank2_2A_5MHz *)o)->cqi2);
      if (stats->DL_cqi[1] > 15)
535 536
  stats->DL_cqi[1] = 15;
      stats->DL_pmi_dual   = ((wideband_cqi_rank2_2A_5MHz *)o)->pmi;
537 538 539 540 541
    }
    break;
  case hlc_cqi:
    if (tmode > 2) {
      if (rank == 0) {
542 543 544 545 546
  stats->DL_cqi[0]     = (((HLC_subband_cqi_rank1_2A_5MHz *)o)->cqi1);
  if (stats->DL_cqi[0] > 15)
    stats->DL_cqi[0] = 15;
  do_diff_cqi(N_RB_DL,stats->DL_subband_cqi[0],stats->DL_cqi[0],(((HLC_subband_cqi_rank1_2A_5MHz *)o)->diffcqi1));
  stats->DL_pmi_single = ((HLC_subband_cqi_rank1_2A_5MHz *)o)->pmi;
547 548
      }
      else {
549 550 551 552 553 554 555 556 557
  stats->DL_cqi[0]     = (((HLC_subband_cqi_rank2_2A_5MHz *)o)->cqi1);
  if (stats->DL_cqi[0] > 15)
    stats->DL_cqi[0] = 15;
  stats->DL_cqi[1]     = (((HLC_subband_cqi_rank2_2A_5MHz *)o)->cqi2);
  if (stats->DL_cqi[1] > 15)
    stats->DL_cqi[1] = 15;
  do_diff_cqi(N_RB_DL,stats->DL_subband_cqi[0],stats->DL_cqi[0],(((HLC_subband_cqi_rank2_2A_5MHz *)o)->diffcqi1));
  do_diff_cqi(N_RB_DL,stats->DL_subband_cqi[1],stats->DL_cqi[1],(((HLC_subband_cqi_rank2_2A_5MHz *)o)->diffcqi2));
  stats->DL_pmi_dual   = ((HLC_subband_cqi_rank2_2A_5MHz *)o)->pmi;
558 559 560 561 562
      }
    }
    else {
      stats->DL_cqi[0]     = (((HLC_subband_cqi_nopmi_5MHz *)o)->cqi1);
      if (stats->DL_cqi[0] > 15)
563
  stats->DL_cqi[0] = 15;
564 565

      do_diff_cqi(N_RB_DL,stats->DL_subband_cqi[0],stats->DL_cqi[0],((HLC_subband_cqi_nopmi_5MHz *)o)->diffcqi1);
566

567 568 569 570 571 572 573 574 575
    }
    break;
  default:
    break;
  }
  */

}

576 577 578

void print_CQI(void *o,UCI_format_t uci_format,unsigned char eNB_id,int N_RB_DL)
{
579 580


581
  switch(uci_format) {
582 583
  case wideband_cqi_rank1_2A:
#ifdef DEBUG_UCI
knopp's avatar
knopp committed
584 585 586
    switch(N_RB_DL) {
    case 6:
      LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 1: eNB %d, cqi %d\n",eNB_id,
587
            ((wideband_cqi_rank1_2A_1_5MHz *)o)->cqi1);
knopp's avatar
knopp committed
588
      LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 1: eNB %d, pmi (%x) %8x\n",eNB_id,
589 590
            ((wideband_cqi_rank1_2A_1_5MHz *)o)->pmi,
            pmi2hex_2Ar1(((wideband_cqi_rank1_2A_1_5MHz *)o)->pmi));
knopp's avatar
knopp committed
591
      break;
592

knopp's avatar
knopp committed
593 594
    case 25:
      LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 1: eNB %d, cqi %d\n",eNB_id,
595
            ((wideband_cqi_rank1_2A_5MHz *)o)->cqi1);
knopp's avatar
knopp committed
596
      LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 1: eNB %d, pmi (%x) %8x\n",eNB_id,
597 598
            ((wideband_cqi_rank1_2A_5MHz *)o)->pmi,
            pmi2hex_2Ar1(((wideband_cqi_rank1_2A_5MHz *)o)->pmi));
knopp's avatar
knopp committed
599
      break;
600

knopp's avatar
knopp committed
601 602
    case 50:
      LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 1: eNB %d, cqi %d\n",eNB_id,
603
            ((wideband_cqi_rank1_2A_10MHz *)o)->cqi1);
knopp's avatar
knopp committed
604
      LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 1: eNB %d, pmi (%x) %8x\n",eNB_id,
605 606
            ((wideband_cqi_rank1_2A_10MHz *)o)->pmi,
            pmi2hex_2Ar1(((wideband_cqi_rank1_2A_10MHz *)o)->pmi));
knopp's avatar
knopp committed
607
      break;
608

knopp's avatar
knopp committed
609 610
    case 100:
      LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 1: eNB %d, cqi %d\n",eNB_id,
611
            ((wideband_cqi_rank1_2A_20MHz *)o)->cqi1);
knopp's avatar
knopp committed
612
      LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 1: eNB %d, pmi (%x) %8x\n",eNB_id,
613 614
            ((wideband_cqi_rank1_2A_20MHz *)o)->pmi,
            pmi2hex_2Ar1(((wideband_cqi_rank1_2A_20MHz *)o)->pmi));
knopp's avatar
knopp committed
615 616 617
      break;
    }

618 619
#endif //DEBUG_UCI
    break;
620

621 622
  case wideband_cqi_rank2_2A:
#ifdef DEBUG_UCI
knopp's avatar
knopp committed
623 624 625 626 627 628
    switch(N_RB_DL) {
    case 6:
      LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 2: eNB %d, cqi1 %d\n",eNB_id,((wideband_cqi_rank2_2A_1_5MHz *)o)->cqi1);
      LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 2: eNB %d, cqi2 %d\n",eNB_id,((wideband_cqi_rank2_2A_1_5MHz *)o)->cqi2);
      LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 2: eNB %d, pmi %8x\n",eNB_id,pmi2hex_2Ar2(((wideband_cqi_rank2_2A_1_5MHz *)o)->pmi));
      break;
629

knopp's avatar
knopp committed
630 631 632 633 634
    case 25:
      LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 2: eNB %d, cqi1 %d\n",eNB_id,((wideband_cqi_rank2_2A_5MHz *)o)->cqi1);
      LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 2: eNB %d, cqi2 %d\n",eNB_id,((wideband_cqi_rank2_2A_5MHz *)o)->cqi2);
      LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 2: eNB %d, pmi %8x\n",eNB_id,pmi2hex_2Ar2(((wideband_cqi_rank2_2A_5MHz *)o)->pmi));
      break;
635

knopp's avatar
knopp committed
636 637 638 639 640
    case 50:
      LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 2: eNB %d, cqi1 %d\n",eNB_id,((wideband_cqi_rank2_2A_10MHz *)o)->cqi1);
      LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 2: eNB %d, cqi2 %d\n",eNB_id,((wideband_cqi_rank2_2A_10MHz *)o)->cqi2);
      LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 2: eNB %d, pmi %8x\n",eNB_id,pmi2hex_2Ar2(((wideband_cqi_rank2_2A_10MHz *)o)->pmi));
      break;
641

knopp's avatar
knopp committed
642 643 644 645 646 647
    case 100:
      LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 2: eNB %d, cqi1 %d\n",eNB_id,((wideband_cqi_rank2_2A_20MHz *)o)->cqi1);
      LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 2: eNB %d, cqi2 %d\n",eNB_id,((wideband_cqi_rank2_2A_20MHz *)o)->cqi2);
      LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 2: eNB %d, pmi %8x\n",eNB_id,pmi2hex_2Ar2(((wideband_cqi_rank2_2A_20MHz *)o)->pmi));
      break;
    }
648

649 650
#endif //DEBUG_UCI
    break;
651

652 653
  case HLC_subband_cqi_nopmi:
#ifdef DEBUG_UCI
knopp's avatar
knopp committed
654 655 656 657 658
    switch(N_RB_DL) {
    case 6:
      LOG_I(PHY,"[PRINT CQI] hlc_cqi (no pmi) : eNB %d, cqi1 %d\n",eNB_id,((HLC_subband_cqi_rank1_2A_1_5MHz *)o)->cqi1);
      LOG_I(PHY,"[PRINT CQI] hlc_cqi (no pmi) : eNB %d, diffcqi1 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank1_2A_1_5MHz *)o)->diffcqi1));
      break;
659

knopp's avatar
knopp committed
660 661 662 663
    case 25:
      LOG_I(PHY,"[PRINT CQI] hlc_cqi (no pmi) : eNB %d, cqi1 %d\n",eNB_id,((HLC_subband_cqi_rank1_2A_5MHz *)o)->cqi1);
      LOG_I(PHY,"[PRINT CQI] hlc_cqi (no pmi) : eNB %d, diffcqi1 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank1_2A_5MHz *)o)->diffcqi1));
      break;
664

knopp's avatar
knopp committed
665 666 667 668
    case 50:
      LOG_I(PHY,"[PRINT CQI] hlc_cqi (no pmi) : eNB %d, cqi1 %d\n",eNB_id,((HLC_subband_cqi_rank1_2A_10MHz *)o)->cqi1);
      LOG_I(PHY,"[PRINT CQI] hlc_cqi (no pmi) : eNB %d, diffcqi1 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank1_2A_10MHz *)o)->diffcqi1));
      break;
669

knopp's avatar
knopp committed
670 671 672 673 674
    case 100:
      LOG_I(PHY,"[PRINT CQI] hlc_cqi (no pmi) : eNB %d, cqi1 %d\n",eNB_id,((HLC_subband_cqi_rank1_2A_20MHz *)o)->cqi1);
      LOG_I(PHY,"[PRINT CQI] hlc_cqi (no pmi) : eNB %d, diffcqi1 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank1_2A_20MHz *)o)->diffcqi1));
      break;
    }
675

676 677
#endif //DEBUG_UCI
    break;
678

679 680
  case HLC_subband_cqi_rank1_2A:
#ifdef DEBUG_UCI
knopp's avatar
knopp committed
681 682 683 684 685 686
    switch(N_RB_DL) {
    case 6:
      LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 1: eNB %d, cqi1 %d\n",eNB_id,((HLC_subband_cqi_rank1_2A_5MHz *)o)->cqi1);
      LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 1: eNB %d, diffcqi1 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank1_2A_5MHz *)o)->diffcqi1));
      LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 1: eNB %d, pmi %d\n",eNB_id,((HLC_subband_cqi_rank1_2A_5MHz *)o)->pmi);
      break;
687

knopp's avatar
knopp committed
688 689 690 691 692
    case 25:
      LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 1: eNB %d, cqi1 %d\n",eNB_id,((HLC_subband_cqi_rank1_2A_5MHz *)o)->cqi1);
      LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 1: eNB %d, diffcqi1 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank1_2A_5MHz *)o)->diffcqi1));
      LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 1: eNB %d, pmi %d\n",eNB_id,((HLC_subband_cqi_rank1_2A_5MHz *)o)->pmi);
      break;
693

knopp's avatar
knopp committed
694 695 696 697 698
    case 50:
      LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 1: eNB %d, cqi1 %d\n",eNB_id,((HLC_subband_cqi_rank1_2A_5MHz *)o)->cqi1);
      LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 1: eNB %d, diffcqi1 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank1_2A_5MHz *)o)->diffcqi1));
      LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 1: eNB %d, pmi %d\n",eNB_id,((HLC_subband_cqi_rank1_2A_5MHz *)o)->pmi);
      break;
699

knopp's avatar
knopp committed
700 701 702 703 704 705
    case 100:
      LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 1: eNB %d, cqi1 %d\n",eNB_id,((HLC_subband_cqi_rank1_2A_5MHz *)o)->cqi1);
      LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 1: eNB %d, diffcqi1 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank1_2A_5MHz *)o)->diffcqi1));
      LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 1: eNB %d, pmi %d\n",eNB_id,((HLC_subband_cqi_rank1_2A_5MHz *)o)->pmi);
      break;
    }
706

707 708
#endif //DEBUG_UCI
    break;
709

710 711
  case HLC_subband_cqi_rank2_2A:
#ifdef DEBUG_UCI
knopp's avatar
knopp committed
712 713 714 715 716 717 718 719
    switch(N_RB_DL) {
    case 6:
      LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, cqi1 %d\n",eNB_id,((HLC_subband_cqi_rank2_2A_1_5MHz *)o)->cqi1);
      LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, cqi2 %d\n",eNB_id,((HLC_subband_cqi_rank2_2A_1_5MHz *)o)->cqi2);
      LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, diffcqi1 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank2_2A_1_5MHz *)o)->diffcqi1));
      LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, diffcqi2 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank2_2A_1_5MHz *)o)->diffcqi2));
      LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, pmi %d\n",eNB_id,((HLC_subband_cqi_rank2_2A_1_5MHz *)o)->pmi);
      break;
720

knopp's avatar
knopp committed
721 722 723 724 725 726 727
    case 25:
      LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, cqi1 %d\n",eNB_id,((HLC_subband_cqi_rank2_2A_5MHz *)o)->cqi1);
      LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, cqi2 %d\n",eNB_id,((HLC_subband_cqi_rank2_2A_5MHz *)o)->cqi2);
      LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, diffcqi1 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank2_2A_5MHz *)o)->diffcqi1));
      LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, diffcqi2 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank2_2A_5MHz *)o)->diffcqi2));
      LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, pmi %d\n",eNB_id,((HLC_subband_cqi_rank2_2A_5MHz *)o)->pmi);
      break;
728

knopp's avatar
knopp committed
729 730 731 732 733 734 735
    case 50:
      LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, cqi1 %d\n",eNB_id,((HLC_subband_cqi_rank2_2A_10MHz *)o)->cqi1);
      LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, cqi2 %d\n",eNB_id,((HLC_subband_cqi_rank2_2A_10MHz *)o)->cqi2);
      LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, diffcqi1 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank2_2A_10MHz *)o)->diffcqi1));
      LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, diffcqi2 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank2_2A_10MHz *)o)->diffcqi2));
      LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, pmi %d\n",eNB_id,((HLC_subband_cqi_rank2_2A_10MHz *)o)->pmi);
      break;
736

knopp's avatar
knopp committed
737 738 739 740 741 742 743 744
    case 100:
      LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, cqi1 %d\n",eNB_id,((HLC_subband_cqi_rank2_2A_20MHz *)o)->cqi1);
      LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, cqi2 %d\n",eNB_id,((HLC_subband_cqi_rank2_2A_20MHz *)o)->cqi2);
      LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, diffcqi1 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank2_2A_20MHz *)o)->diffcqi1));
      LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, diffcqi2 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank2_2A_20MHz *)o)->diffcqi2));
      LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, pmi %d\n",eNB_id,((HLC_subband_cqi_rank2_2A_20MHz *)o)->pmi);
      break;
    }
745

746 747
#endif //DEBUG_UCI
    break;
748

749 750
  case HLC_subband_cqi_mcs_CBA:
#ifdef DEBUG_UCI
751 752
    LOG_I(PHY,"[PRINT CQI] hlc_cqi_mcs_CBA : eNB %d, mcs %d\n",eNB_id,((HLC_subband_cqi_mcs_CBA_5MHz *)o)->mcs);
    LOG_I(PHY,"[PRINT CQI] hlc_cqi_mcs_CBA : eNB %d, rnti %x\n",eNB_id,((HLC_subband_cqi_mcs_CBA_5MHz *)o)->crnti);
753 754
#endif //DEBUG_UCI
    break;
755

756 757 758 759 760
  case ue_selected:
#ifdef DEBUG_UCI
    LOG_W(PHY,"[PRINT CQI] ue_selected CQI not supported yet!!!\n");
#endif //DEBUG_UCI
    break;
761

762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789
  default:
#ifdef DEBUG_UCI
    LOG_E(PHY,"[PRINT CQI] unsupported CQI mode (%d)!!!\n",uci_format);
#endif //DEBUG_UCI
    break;
  }

  /*
  switch (tmode) {

  case 1:
  case 2:
  case 3:
  case 5:
  case 6:
  case 7:
  default:
    fmt = hlc_cqi;
    break;
  case 4:
    fmt = wideband_cqi;
    break;
  }

  switch (fmt) {

  case wideband_cqi:
    if (rank == 0) {
790
  #ifdef DEBUG_UCI
791 792
      msg("[PRINT CQI] wideband_cqi rank 1: eNB %d, cqi %d\n",eNB_id,((wideband_cqi_rank1_2A_5MHz *)o)->cqi1);
      msg("[PRINT CQI] wideband_cqi rank 1: eNB %d, pmi (%x) %8x\n",eNB_id,((wideband_cqi_rank1_2A_5MHz *)o)->pmi,pmi2hex_2Ar1(((wideband_cqi_rank1_2A_5MHz *)o)->pmi));
793
  #endif //DEBUG_UCI
794
    }
795 796
    else {
  #ifdef DEBUG_UCI
797 798 799
      msg("[PRINT CQI] wideband_cqi rank 2: eNB %d, cqi1 %d\n",eNB_id,((wideband_cqi_rank2_2A_5MHz *)o)->cqi1);
      msg("[PRINT CQI] wideband_cqi rank 2: eNB %d, cqi2 %d\n",eNB_id,((wideband_cqi_rank2_2A_5MHz *)o)->cqi2);
      msg("[PRINT CQI] wideband_cqi rank 2: eNB %d, pmi %8x\n",eNB_id,pmi2hex_2Ar2(((wideband_cqi_rank2_2A_5MHz *)o)->pmi));
800
  #endif //DEBUG_UCI
801 802 803 804 805
    }
    break;
  case hlc_cqi:
    if (tmode > 2) {
      if (rank == 0) {
806 807 808 809 810
  #ifdef DEBUG_UCI
  msg("[PRINT CQI] hlc_cqi rank 1: eNB %d, cqi1 %d\n",eNB_id,((HLC_subband_cqi_rank1_2A_5MHz *)o)->cqi1);
  msg("[PRINT CQI] hlc_cqi rank 1: eNB %d, diffcqi1 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank1_2A_5MHz *)o)->diffcqi1));
  msg("[PRINT CQI] hlc_cqi rank 1: eNB %d, pmi %d\n",eNB_id,((HLC_subband_cqi_rank1_2A_5MHz *)o)->pmi);
  #endif //DEBUG_UCI
811 812
      }
      else {
813 814 815 816 817 818 819
  #ifdef DEBUG_UCI
  msg("[PRINT CQI] hlc_cqi rank 2: eNB %d, cqi1 %d\n",eNB_id,((HLC_subband_cqi_rank2_2A_5MHz *)o)->cqi1);
  msg("[PRINT CQI] hlc_cqi rank 2: eNB %d, cqi2 %d\n",eNB_id,((HLC_subband_cqi_rank2_2A_5MHz *)o)->cqi2);
  msg("[PRINT CQI] hlc_cqi rank 2: eNB %d, diffcqi1 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank2_2A_5MHz *)o)->diffcqi1));
  msg("[PRINT CQI] hlc_cqi rank 2: eNB %d, diffcqi2 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank2_2A_5MHz *)o)->diffcqi2));
  msg("[PRINT CQI] hlc_cqi rank 2: eNB %d, pmi %d\n",eNB_id,((HLC_subband_cqi_rank2_2A_5MHz *)o)->pmi);
  #endif //DEBUG_UCI
820 821 822
      }
    }
    else {
823
  #ifdef DEBUG_UCI
824 825
      msg("[PRINT CQI] hlc_cqi (no pmi) : eNB %d, cqi1 %d\n",eNB_id,((HLC_subband_cqi_rank1_2A_5MHz *)o)->cqi1);
      msg("[PRINT CQI] hlc_cqi (no pmi) : eNB %d, diffcqi1 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank1_2A_5MHz *)o)->diffcqi1));
826
  #endif //DEBUG_UCI
827 828 829
    }
    break;
  case ue_selected:
830
  #ifdef DEBUG_UCI
831
    msg("dci_tools.c: print_CQI ue_selected CQI not supported yet!!!\n");
832
  #endif //DEBUG_UCI
833 834 835 836 837 838
    break;
  }
  */

}

knopp's avatar
knopp committed
839 840