uci_tools.c 29.2 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

/*! \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
  //uint8_t N_RB_DL = 25;
171
  uint8_t i;
172 173
  LOG_D(PHY,"[eNB][UCI] N_RB_DL %d uci format %d\n", N_RB_DL,uci_format);

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

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

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

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

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

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

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

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

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

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

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

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

knopp's avatar
knopp committed
212
      if (stats->DL_cqi[0] > 24)
213 214 215 216
        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
217
      break;
218

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

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

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

knopp's avatar
knopp committed
227
      if (stats->DL_cqi[1] > 24)
228 229 230 231 232
        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
233
      break;
234

knopp's avatar
knopp committed
235
    case HLC_subband_cqi_mcs_CBA:
236 237 238 239
      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
240
      } else {
241 242
        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
243
      }
244

knopp's avatar
knopp committed
245
      break;
246

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

253
    break;
254

knopp's avatar
knopp committed
255 256
  case 25:

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

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

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

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

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

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

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

      stats->DL_pmi_dual   = ((wideband_cqi_rank2_2A_5MHz *)o)->pmi;
279 280
      //this translates the 2-layer PMI into a single layer PMI for the first codeword
      //the PMI for the second codeword will be stats->DL_pmi_single^0x1555
281
      stats->DL_pmi_single = 0;
282
      for (i=0;i<7;i++)
283
	stats->DL_pmi_single = stats->DL_pmi_single | (((stats->DL_pmi_dual&(1<i))>>i)*2)<<2*i;  
knopp's avatar
knopp committed
284
      break;
285

knopp's avatar
knopp committed
286 287
    case HLC_subband_cqi_nopmi:
      stats->DL_cqi[0]     = (((HLC_subband_cqi_nopmi_5MHz *)o)->cqi1);
288

knopp's avatar
knopp committed
289
      if (stats->DL_cqi[0] > 24)
290 291
        stats->DL_cqi[0] = 24;

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

knopp's avatar
knopp committed
295 296
    case HLC_subband_cqi_rank1_2A:
      stats->DL_cqi[0]     = (((HLC_subband_cqi_rank1_2A_5MHz *)o)->cqi1);
297

knopp's avatar
knopp committed
298
      if (stats->DL_cqi[0] > 24)
299 300 301 302
        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
303
      break;
304

knopp's avatar
knopp committed
305 306
    case HLC_subband_cqi_rank2_2A:
      stats->DL_cqi[0]     = (((HLC_subband_cqi_rank2_2A_5MHz *)o)->cqi1);
307

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

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

knopp's avatar
knopp committed
313
      if (stats->DL_cqi[1] > 24)
314 315 316 317 318
        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
319
      break;
320

knopp's avatar
knopp committed
321
    case HLC_subband_cqi_mcs_CBA:
322 323 324 325
      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
326
      } else {
327 328
        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
329
      }
330

knopp's avatar
knopp committed
331
      break;
332

knopp's avatar
knopp committed
333 334
    case unknown_cqi:
    default:
335
      LOG_N(PHY,"[eNB][UCI] received unknown uci (rb %d)\n",N_RB_DL);
knopp's avatar
knopp committed
336
      break;
337
    }
338

339
    break;
340

knopp's avatar
knopp committed
341
  case 50:
342
    switch(uci_format) {
343 344
    case wideband_cqi_rank1_2A:
      stats->DL_cqi[0]     = (((wideband_cqi_rank1_2A_10MHz *)o)->cqi1);
345

346
      if (stats->DL_cqi[0] > 24)
347 348 349
        stats->DL_cqi[0] = 24;

      stats->DL_pmi_single = ((wideband_cqi_rank1_2A_10MHz *)o)->pmi;
350
      break;
351

352 353
    case wideband_cqi_rank2_2A:
      stats->DL_cqi[0]     = (((wideband_cqi_rank2_2A_10MHz *)o)->cqi1);
354

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

358
      stats->DL_cqi[1]     = (((wideband_cqi_rank2_2A_10MHz *)o)->cqi2);
359

360
      if (stats->DL_cqi[1] > 24)
361 362 363
        stats->DL_cqi[1] = 24;

      stats->DL_pmi_dual   = ((wideband_cqi_rank2_2A_10MHz *)o)->pmi;
364
      break;
365

366 367
    case HLC_subband_cqi_nopmi:
      stats->DL_cqi[0]     = (((HLC_subband_cqi_nopmi_10MHz *)o)->cqi1);
368

369
      if (stats->DL_cqi[0] > 24)
370 371
        stats->DL_cqi[0] = 24;

372 373
      do_diff_cqi(N_RB_DL,stats->DL_subband_cqi[0],stats->DL_cqi[0],((HLC_subband_cqi_nopmi_10MHz *)o)->diffcqi1);
      break;
374

375 376
    case HLC_subband_cqi_rank1_2A:
      stats->DL_cqi[0]     = (((HLC_subband_cqi_rank1_2A_10MHz *)o)->cqi1);
377

378
      if (stats->DL_cqi[0] > 24)
379 380 381 382
        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;
383
      break;
384

385 386
    case HLC_subband_cqi_rank2_2A:
      stats->DL_cqi[0]     = (((HLC_subband_cqi_rank2_2A_10MHz *)o)->cqi1);
387

388
      if (stats->DL_cqi[0] > 24)
389 390
        stats->DL_cqi[0] = 24;

391
      stats->DL_cqi[1]     = (((HLC_subband_cqi_rank2_2A_10MHz *)o)->cqi2);
392

393
      if (stats->DL_cqi[1] > 24)
394 395 396 397 398
        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;
399
      break;
400

401
    case HLC_subband_cqi_mcs_CBA:
402 403 404 405
      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);
406
      } else {
407 408
        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);
409
      }
410

411
      break;
412

413 414 415 416 417
    case unknown_cqi:
    default:
      LOG_N(PHY,"[eNB][UCI] received unknown uci (RB %d)\n",N_RB_DL);
      break;
    }
418

knopp's avatar
knopp committed
419
    break;
420

knopp's avatar
knopp committed
421
  case 100:
422
    switch(uci_format) {
423 424
    case wideband_cqi_rank1_2A:
      stats->DL_cqi[0]     = (((wideband_cqi_rank1_2A_20MHz *)o)->cqi1);
425

426
      if (stats->DL_cqi[0] > 24)
427 428 429
        stats->DL_cqi[0] = 24;

      stats->DL_pmi_single = ((wideband_cqi_rank1_2A_20MHz *)o)->pmi;
430
      break;
431

432 433
    case wideband_cqi_rank2_2A:
      stats->DL_cqi[0]     = (((wideband_cqi_rank2_2A_20MHz *)o)->cqi1);
434

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

438
      stats->DL_cqi[1]     = (((wideband_cqi_rank2_2A_20MHz *)o)->cqi2);
439

440
      if (stats->DL_cqi[1] > 24)
441 442 443
        stats->DL_cqi[1] = 24;

      stats->DL_pmi_dual   = ((wideband_cqi_rank2_2A_20MHz *)o)->pmi;
444
      break;
445

446 447
    case HLC_subband_cqi_nopmi:
      stats->DL_cqi[0]     = (((HLC_subband_cqi_nopmi_20MHz *)o)->cqi1);
448

449
      if (stats->DL_cqi[0] > 24)
450 451
        stats->DL_cqi[0] = 24;

452 453
      do_diff_cqi(N_RB_DL,stats->DL_subband_cqi[0],stats->DL_cqi[0],((HLC_subband_cqi_nopmi_20MHz *)o)->diffcqi1);
      break;
454

455 456
    case HLC_subband_cqi_rank1_2A:
      stats->DL_cqi[0]     = (((HLC_subband_cqi_rank1_2A_20MHz *)o)->cqi1);
457

458
      if (stats->DL_cqi[0] > 24)
459 460 461 462
        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;
463
      break;
464

465 466
    case HLC_subband_cqi_rank2_2A:
      stats->DL_cqi[0]     = (((HLC_subband_cqi_rank2_2A_20MHz *)o)->cqi1);
467

468
      if (stats->DL_cqi[0] > 24)
469 470
        stats->DL_cqi[0] = 24;

471
      stats->DL_cqi[1]     = (((HLC_subband_cqi_rank2_2A_20MHz *)o)->cqi2);
472

473
      if (stats->DL_cqi[1] > 24)
474 475 476 477 478
        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;
479
      break;
480

481
    case HLC_subband_cqi_mcs_CBA:
482 483 484 485
      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);
486
      } else {
487 488
        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);
489
      }
490

491
      break;
492

493 494 495 496 497
    case unknown_cqi:
    default:
      LOG_N(PHY,"[eNB][UCI] received unknown uci (RB %d)\n",N_RB_DL);
      break;
    }
498

499
    break;
500

501 502
  default:
    LOG_N(PHY,"[eNB][UCI] unknown RB %d\n",N_RB_DL);
503 504 505
    break;
  }

506
  /*
507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531
  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)
532 533
  stats->DL_cqi[0] = 15;
      stats->DL_pmi_single = ((wideband_cqi_rank1_2A_5MHz *)o)->pmi;
534 535 536 537
    }
    else {
      stats->DL_cqi[0]     = (((wideband_cqi_rank2_2A_5MHz *)o)->cqi1);
      if (stats->DL_cqi[0] > 15)
538
  stats->DL_cqi[0] = 15;
539 540
      stats->DL_cqi[1]     = (((wideband_cqi_rank2_2A_5MHz *)o)->cqi2);
      if (stats->DL_cqi[1] > 15)
541 542
  stats->DL_cqi[1] = 15;
      stats->DL_pmi_dual   = ((wideband_cqi_rank2_2A_5MHz *)o)->pmi;
543 544 545 546 547
    }
    break;
  case hlc_cqi:
    if (tmode > 2) {
      if (rank == 0) {
548 549 550 551 552
  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;
553 554
      }
      else {
555 556 557 558 559 560 561 562 563
  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;
564 565 566 567 568
      }
    }
    else {
      stats->DL_cqi[0]     = (((HLC_subband_cqi_nopmi_5MHz *)o)->cqi1);
      if (stats->DL_cqi[0] > 15)
569
  stats->DL_cqi[0] = 15;
570 571

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

573 574 575 576 577 578 579 580 581
    }
    break;
  default:
    break;
  }
  */

}

582 583 584

void print_CQI(void *o,UCI_format_t uci_format,unsigned char eNB_id,int N_RB_DL)
{
585 586


587
  switch(uci_format) {
588 589
  case wideband_cqi_rank1_2A:
#ifdef DEBUG_UCI
590
    LOG_D(PHY,"[PRINT CQI] flat_LA %d\n", flag_LA);
knopp's avatar
knopp committed
591 592 593
    switch(N_RB_DL) {
    case 6:
      LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 1: eNB %d, cqi %d\n",eNB_id,
594
            ((wideband_cqi_rank1_2A_1_5MHz *)o)->cqi1);
knopp's avatar
knopp committed
595
      LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 1: eNB %d, pmi (%x) %8x\n",eNB_id,
596 597
            ((wideband_cqi_rank1_2A_1_5MHz *)o)->pmi,
            pmi2hex_2Ar1(((wideband_cqi_rank1_2A_1_5MHz *)o)->pmi));
knopp's avatar
knopp committed
598
      break;
599

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

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

knopp's avatar
knopp committed
616 617
    case 100:
      LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 1: eNB %d, cqi %d\n",eNB_id,
618
            ((wideband_cqi_rank1_2A_20MHz *)o)->cqi1);
knopp's avatar
knopp committed
619
      LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 1: eNB %d, pmi (%x) %8x\n",eNB_id,
620 621
            ((wideband_cqi_rank1_2A_20MHz *)o)->pmi,
            pmi2hex_2Ar1(((wideband_cqi_rank1_2A_20MHz *)o)->pmi));
knopp's avatar
knopp committed
622 623 624
      break;
    }

625 626
#endif //DEBUG_UCI
    break;
627

628 629
  case wideband_cqi_rank2_2A:
#ifdef DEBUG_UCI
knopp's avatar
knopp committed
630 631 632 633 634 635
    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;
636

knopp's avatar
knopp committed
637 638 639 640 641
    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;
642

knopp's avatar
knopp committed
643 644 645 646 647
    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;
648

knopp's avatar
knopp committed
649 650 651 652 653 654
    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;
    }
655

656 657
#endif //DEBUG_UCI
    break;
658

659 660
  case HLC_subband_cqi_nopmi:
#ifdef DEBUG_UCI
knopp's avatar
knopp committed
661 662 663 664 665
    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;
666

knopp's avatar
knopp committed
667 668 669 670
    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;
671

knopp's avatar
knopp committed
672 673 674 675
    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;
676

knopp's avatar
knopp committed
677 678 679 680 681
    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;
    }
682

683 684
#endif //DEBUG_UCI
    break;
685

686 687
  case HLC_subband_cqi_rank1_2A:
#ifdef DEBUG_UCI
knopp's avatar
knopp committed
688 689 690 691 692 693
    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;
694

knopp's avatar
knopp committed
695 696 697 698 699
    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;
700

knopp's avatar
knopp committed
701 702 703 704 705
    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;
706

knopp's avatar
knopp committed
707 708 709 710 711 712
    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;
    }
713

714 715
#endif //DEBUG_UCI
    break;
716

717 718
  case HLC_subband_cqi_rank2_2A:
#ifdef DEBUG_UCI
knopp's avatar
knopp committed
719 720 721 722 723 724 725 726
    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;
727

knopp's avatar
knopp committed
728 729 730 731 732 733 734
    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;
735

knopp's avatar
knopp committed
736 737 738 739 740 741 742
    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;
743

knopp's avatar
knopp committed
744 745 746 747 748 749 750 751
    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;
    }
752

753 754
#endif //DEBUG_UCI
    break;
755

756 757
  case HLC_subband_cqi_mcs_CBA:
#ifdef DEBUG_UCI
758 759
    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);
760 761
#endif //DEBUG_UCI
    break;
762

763 764 765 766 767
  case ue_selected:
#ifdef DEBUG_UCI
    LOG_W(PHY,"[PRINT CQI] ue_selected CQI not supported yet!!!\n");
#endif //DEBUG_UCI
    break;
768

769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796
  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) {
797
  #ifdef DEBUG_UCI
798 799
      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));
800
  #endif //DEBUG_UCI
801
    }
802 803
    else {
  #ifdef DEBUG_UCI
804 805 806
      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));
807
  #endif //DEBUG_UCI
808 809 810 811 812
    }
    break;
  case hlc_cqi:
    if (tmode > 2) {
      if (rank == 0) {
813 814 815 816 817
  #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
818 819
      }
      else {
820 821 822 823 824 825 826
  #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
827 828 829
      }
    }
    else {
830
  #ifdef DEBUG_UCI
831 832
      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));
833
  #endif //DEBUG_UCI
834 835 836
    }
    break;
  case ue_selected:
837
  #ifdef DEBUG_UCI
838
    msg("dci_tools.c: print_CQI ue_selected CQI not supported yet!!!\n");
839
  #endif //DEBUG_UCI
840 841 842 843 844 845
    break;
  }
  */

}

knopp's avatar
knopp committed
846 847