phy_procedures_lte_eNb.c 76.8 KB
Newer Older
1
2
3
4
5
/*
 * 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
Cedric Roux's avatar
Cedric Roux committed
6
 * the OAI Public License, Version 1.1  (the "License"); you may not use this file
7
8
9
10
11
12
13
14
15
16
17
18
19
20
 * 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

/*! \file phy_procedures_lte_eNB.c
 * \brief Implementation of eNB procedures from 36.213 LTE specifications
24
 * \author R. Knopp, F. Kaltenberger, N. Nikaein, X. Foukas
25
26
27
 * \date 2011
 * \version 0.1
 * \company Eurecom
28
 * \email: knopp@eurecom.fr,florian.kaltenberger@eurecom.fr,navid.nikaein@eurecom.fr, x.foukas@sms.ed.ac.uk
29
30
31
32
33
34
35
36
 * \note
 * \warning
 */

#include "PHY/defs.h"
#include "PHY/extern.h"
#include "SCHED/defs.h"
#include "SCHED/extern.h"
37
#include "nfapi_interface.h"
38
#include "fapi_l1.h"
39
40
41
#include "UTIL/LOG/log.h"
#include "UTIL/LOG/vcd_signal_dumper.h"

42
43
#include "T.h"

44
#include "assertions.h"
gauthier's avatar
gauthier committed
45
#include "msc.h"
46

47
48
#include <time.h>

49
#if defined(ENABLE_ITTI)
gauthier's avatar
For RAL    
gauthier committed
50
#   include "intertask_interface.h"
51
52
#endif

53
54
extern uint8_t nfapi_mode;
int oai_nfapi_rach_ind(nfapi_rach_indication_t *rach_ind);
55

knopp's avatar
   
knopp committed
56

57

58
void pmch_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,PHY_VARS_RN *rn,relaying_type_t r_type) {
59
60


Cedric Roux's avatar
Cedric Roux committed
61
#if defined(Rel10) || defined(Rel14)
knopp's avatar
knopp committed
62
  MCH_PDU *mch_pduP=NULL;
63
  MCH_PDU  mch_pdu;
64
  //  uint8_t sync_area=255;
65
#endif
66

67
  int subframe = proc->subframe_tx;
68

knopp's avatar
knopp committed
69
70
  AssertFatal(1==0,"pmch not tested for the moment, exiting\n");

71
72
73
74
75
76
  // This is DL-Cell spec pilots in Control region
  generate_pilots_slot(eNB,
		       eNB->common_vars.txdataF,
		       AMP,
		       subframe<<1,1);

77
  
Cedric Roux's avatar
Cedric Roux committed
78
#if defined(Rel10) || defined(Rel14)
79
80
  // if mcch is active, send regardless of the node type: eNB or RN
  // when mcch is active, MAC sched does not allow MCCH and MTCH multiplexing
81
  /*
82
83
  mch_pduP = mac_xface->get_mch_sdu(eNB->Mod_id,
				    eNB->CC_id,
84
				    proc->frame_tx,
85
				    subframe);
86
  */
87
88
89
  switch (r_type) {
  case no_relay:
    if ((mch_pduP->Pdu_size > 0) && (mch_pduP->sync_area == 0)) // TEST: only transmit mcch for sync area 0
knopp's avatar
knopp committed
90
      LOG_D(PHY,"[eNB%"PRIu8"] Frame %d subframe %d : Got MCH pdu for MBSFN (MCS %"PRIu8", TBS %d) \n",
91
92
	    eNB->Mod_id,proc->frame_tx,subframe,mch_pduP->mcs,
	    eNB->dlsch_MCH->harq_processes[0]->TBS>>3);
93
94
    else {
      LOG_D(PHY,"[DeNB %"PRIu8"] Frame %d subframe %d : Do not transmit MCH pdu for MBSFN sync area %"PRIu8" (%s)\n",
95
	    eNB->Mod_id,proc->frame_tx,subframe,mch_pduP->sync_area,
96
97
	    (mch_pduP->Pdu_size == 0)? "Empty MCH PDU":"Let RN transmit for the moment");
      mch_pduP = NULL;
gauthier's avatar
For RAL    
gauthier committed
98
    }
99
    
knopp's avatar
   
knopp committed
100
    break;
101
102
103
    
  case multicast_relay:
    if ((mch_pduP->Pdu_size > 0) && ((mch_pduP->mcch_active == 1) || mch_pduP->msi_active==1)) {
knopp's avatar
knopp committed
104
      LOG_D(PHY,"[RN %"PRIu8"] Frame %d subframe %d: Got the MCH PDU for MBSFN  sync area %"PRIu8" (MCS %"PRIu8", TBS %"PRIu16")\n",
105
106
107
108
109
110
111
112
113
	    rn->Mod_id,rn->frame, subframe,
	    mch_pduP->sync_area,mch_pduP->mcs,mch_pduP->Pdu_size);
    } else if (rn->mch_avtive[subframe%5] == 1) { // SF2 -> SF7, SF3 -> SF8
      mch_pduP= &mch_pdu;
      memcpy(&mch_pduP->payload, // could be a simple copy
	     rn->dlsch_rn_MCH[subframe%5]->harq_processes[0]->b,
	     rn->dlsch_rn_MCH[subframe%5]->harq_processes[0]->TBS>>3);
      mch_pduP->Pdu_size = (uint16_t) (rn->dlsch_rn_MCH[subframe%5]->harq_processes[0]->TBS>>3);
      mch_pduP->mcs = rn->dlsch_rn_MCH[subframe%5]->harq_processes[0]->mcs;
knopp's avatar
knopp committed
114
      LOG_D(PHY,"[RN %"PRIu8"] Frame %d subframe %d: Forward the MCH PDU for MBSFN received on SF %d sync area %"PRIu8" (MCS %"PRIu8", TBS %"PRIu16")\n",
115
116
	    rn->Mod_id,rn->frame, subframe,subframe%5,
	    rn->sync_area[subframe%5],mch_pduP->mcs,mch_pduP->Pdu_size);
knopp's avatar
   
knopp committed
117
    } else {
118
      mch_pduP=NULL;
knopp's avatar
   
knopp committed
119
    }
120
121
    
    rn->mch_avtive[subframe]=0;
knopp's avatar
   
knopp committed
122
    break;
123
    
124
  default:
125
    LOG_W(PHY,"[eNB %"PRIu8"] Frame %d subframe %d: unknown relaying type %d \n",
126
	  eNB->Mod_id,proc->frame_tx,subframe,r_type);
127
128
129
130
131
    mch_pduP=NULL;
    break;
  }// switch
  
  if (mch_pduP) {
132
    fill_eNB_dlsch_MCH(eNB,mch_pduP->mcs,1,0);
133
    // Generate PMCH
134
    generate_mch(eNB,proc,(uint8_t*)mch_pduP->payload);
135
  } else {
136
    LOG_D(PHY,"[eNB/RN] Frame %d subframe %d: MCH not generated \n",proc->frame_tx,subframe);
knopp's avatar
   
knopp committed
137
  }
138
  
139
#endif
140
}
141

142
void common_signal_procedures (PHY_VARS_eNB *eNB,int frame, int subframe) {
143

144
  LTE_DL_FRAME_PARMS *fp=&eNB->frame_parms;
145
  int **txdataF = eNB->common_vars.txdataF;
146
  uint8_t *pbch_pdu=&eNB->pbch_pdu[0];
147

148
  //LOG_D(PHY,"common_signal_procedures: frame %d, subframe %d fdd:%s dir:%s\n",frame,subframe,fp->frame_type == FDD?"FDD":"TDD", subframe_select(fp,subframe) == SF_DL?"DL":"UL?"); 
149

150
  // generate Cell-Specific Reference Signals for both slots
151
  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_RS_TX,1);
152
153
154
155
156
157
158
159
160
161
162
163
164
165

   if(subframe_select(fp,subframe) == SF_S)
       generate_pilots_slot(eNB,
                    txdataF,
                    AMP,
                    subframe<<1,1);
   else
       generate_pilots_slot(eNB,
                    txdataF,
                    AMP,
                    subframe<<1,0);

 // check that 2nd slot is for DL

166
167
  // check that 2nd slot is for DL
  if (subframe_select(fp,subframe) == SF_DL)
168
169
170
    generate_pilots_slot(eNB,
			 txdataF,
			 AMP,
171
172
173
174
			 (subframe<<1)+1,0);
  
  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_RS_TX,0);
      
175

176
  // First half of PSS/SSS (FDD, slot 0)
knopp's avatar
   
knopp committed
177
  if (subframe == 0) {
178
    if (fp->frame_type == FDD) {
179
180
181
182
183
184
185
186
187
188
189
      generate_pss(txdataF,
		   AMP,
		   fp,
		   (fp->Ncp==NORMAL) ? 6 : 5,
		   0);
      generate_sss(txdataF,
		   AMP,
		   fp,
		   (fp->Ncp==NORMAL) ? 5 : 4,
		   0);
      
190
    }
191
    
192
193


194
195
196
      
    /// First half of SSS (TDD, slot 1)
    
197
    if (fp->frame_type == TDD) {
198
199
200
201
202
203
      generate_sss(txdataF,
		   AMP,
		   fp,
		   (fp->Ncp==NORMAL) ? 6 : 5,
		   1);
    }
204

205
206
    // generate PBCH (Physical Broadcast CHannel) info

207
    /// generate PBCH
208
    if ((frame&3)==0) {
209
210
      //AssertFatal(eNB->pbch_configured==1,"PBCH was not configured by MAC\n");
      if (eNB->pbch_configured!=1) return;
211
      eNB->pbch_configured=0;
212
    }
213
214
215
216
217
218
219
    generate_pbch(&eNB->pbch,
		  txdataF,
		  AMP,
		  fp,
		  pbch_pdu,
		  frame&3);
  
220
  }
221
  else if ((subframe == 1) &&
222
	   (fp->frame_type == TDD)){
223
224
225
226
227
    generate_pss(txdataF,
		 AMP,
		 fp,
		 2,
		 2);
228
  }
229
230
231
  
  // Second half of PSS/SSS (FDD, slot 10)
  else if ((subframe == 5) && 
232
	   (fp->frame_type == FDD)) {
233
234
235
236
237
238
239
240
241
242
    generate_pss(txdataF,
		 AMP,
		 &eNB->frame_parms,
		 (fp->Ncp==NORMAL) ? 6 : 5,
		 10);
    generate_sss(txdataF,
		 AMP,
		 &eNB->frame_parms,
		 (fp->Ncp==NORMAL) ? 5 : 4,
		 10);
243

244
  }
245

246
247
  //  Second-half of SSS (TDD, slot 11)
  else if ((subframe == 5) &&
248
	   (fp->frame_type == TDD)) {
249
250
251
252
253
    generate_sss(txdataF,
		 AMP,
		 fp,
		 (fp->Ncp==NORMAL) ? 6 : 5,
		 11);
knopp's avatar
   
knopp committed
254
  }
knopp's avatar
   
knopp committed
255

256
257
  // Second half of PSS (TDD, slot 12)
  else if ((subframe == 6) &&
258
	   (fp->frame_type == TDD)) { 
259
260
261
262
263
264
    generate_pss(txdataF,
		 AMP,
		 fp,
		 2,
		 12);
  }
knopp's avatar
   
knopp committed
265

266
}
knopp's avatar
   
knopp committed
267

268
269


270
271
272
273
274
275
void pdsch_procedures(PHY_VARS_eNB *eNB,
		      eNB_rxtx_proc_t *proc,
		      int harq_pid,
		      LTE_eNB_DLSCH_t *dlsch, 
		      LTE_eNB_DLSCH_t *dlsch1,
		      LTE_eNB_UE_stats *ue_stats,
276
		      int ra_flag) {
277

278
279
  int frame=proc->frame_tx;
  int subframe=proc->subframe_tx;
280
281
  LTE_DL_eNB_HARQ_t *dlsch_harq=dlsch->harq_processes[harq_pid];
  int input_buffer_length = dlsch_harq->TBS/8;
282
  LTE_DL_FRAME_PARMS *fp=&eNB->frame_parms;
283

284
  if (dlsch->rnti == 0x02) {//frame < 200) {
285

286
    LOG_D(PHY,
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
	  "[eNB %"PRIu8"][PDSCH %"PRIx16"/%"PRIu8"] Frame %d, subframe %d: Generating PDSCH/DLSCH with input size = %"PRIu16", pdsch_start %d, G %d, nb_rb %"PRIu16", rb0 %x, rb1 %x, TBS %"PRIu16", pmi_alloc %"PRIx64", rv %"PRIu8" (round %"PRIu8")\n",
	  eNB->Mod_id, dlsch->rnti,harq_pid,
	  frame, subframe, input_buffer_length, dlsch_harq->pdsch_start,
	  get_G(fp,
		dlsch_harq->nb_rb,
		dlsch_harq->rb_alloc,
		dlsch_harq->Qm,
		dlsch_harq->Nl,
		dlsch_harq->pdsch_start,
		frame,
		subframe,
		dlsch_harq->mimo_mode==TM7?7:0),
	  dlsch_harq->nb_rb,
	  dlsch_harq->rb_alloc[0],
	  dlsch_harq->rb_alloc[1],
	  dlsch_harq->TBS,
	  pmi2hex_2Ar1(dlsch_harq->pmi_alloc),
	  dlsch_harq->rvidx,
	  dlsch_harq->round);
  }    
307
#if defined(MESSAGE_CHART_GENERATOR_PHY)
308
309
310
  MSC_LOG_TX_MESSAGE(
		     MSC_PHY_ENB,MSC_PHY_UE,
		     NULL,0,
311
		     "%05u:%02u PDSCH/DLSCH input size = %"PRIu16", G %d, nb_rb %"PRIu16", TBS %"PRIu16", pmi_alloc %"PRIx16", rv %"PRIu8" (round %"PRIu8")",
312
313
314
315
316
		     frame, subframe,
		     input_buffer_length,
		     get_G(fp,
			   dlsch_harq->nb_rb,
			   dlsch_harq->rb_alloc,
317
			   dlsch_harq->Qm,
318
			   dlsch_harq->Nl,
319
			   dlsch_harq->pdsch_start,
320
321
322
			   frame,
			   subframe,
			   dlsch_harq->mimo_mode==TM7?7:0),
323
		     dlsch_harq->nb_rb,
324
		     dlsch_harq->TBS,
325
326
327
328
		     pmi2hex_2Ar1(dlsch_harq->pmi_alloc),
		     dlsch_harq->rvidx,
		     dlsch_harq->round);
#endif
329
330
  
  
331
  if (ue_stats) ue_stats->dlsch_sliding_cnt++;
332
  
333
334
335
  if (dlsch_harq->round == 0) {
    if (ue_stats)
      ue_stats->dlsch_trials[harq_pid][0]++;
336
337
338
339
340
341
342
343
  } else {
    ue_stats->dlsch_trials[harq_pid][dlsch_harq->round]++;
#ifdef DEBUG_PHY_PROC
#ifdef DEBUG_DLSCH
    LOG_D(PHY,"[eNB] This DLSCH is a retransmission\n");
#endif
#endif
  }
344
345


346
347
  LOG_D(PHY,"Generating DLSCH/PDSCH pdu:%p pdsch_start:%d frame:%d subframe:%d nb_rb:%d rb_alloc:%d Qm:%d Nl:%d round:%d\n",
      dlsch_harq->pdu,dlsch_harq->pdsch_start,frame,subframe,dlsch_harq->nb_rb,dlsch_harq->rb_alloc[0],dlsch_harq->Qm,dlsch_harq->Nl,dlsch_harq->round);
348
  // 36-212 
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
  if (nfapi_mode == 0 || nfapi_mode == 1) { // monolthic OR PNF - do not need turbo encoding on VNF

    if (dlsch_harq->pdu==NULL){
        LOG_E(PHY,"dlsch_harq->pdu == NULL SFN/SF:%04d%d dlsch[rnti:%x] dlsch_harq[pdu:%p pdsch_start:%d Qm:%d Nl:%d round:%d nb_rb:%d rb_alloc[0]:%d]\n", frame,subframe,dlsch->rnti, dlsch_harq->pdu,dlsch_harq->pdsch_start,dlsch_harq->Qm,dlsch_harq->Nl,dlsch_harq->round,dlsch_harq->nb_rb,dlsch_harq->rb_alloc[0]);
      return;
    }

    start_meas(&eNB->dlsch_encoding_stats);

    eNB->te(eNB,
        dlsch_harq->pdu,
        dlsch_harq->pdsch_start,
        dlsch,
        frame,subframe,
        &eNB->dlsch_rate_matching_stats,
        &eNB->dlsch_turbo_encoding_stats,
        &eNB->dlsch_interleaving_stats);
    stop_meas(&eNB->dlsch_encoding_stats);
367
  // 36-211
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
    start_meas(&eNB->dlsch_scrambling_stats);
    dlsch_scrambling(fp,
        0,
        dlsch,
        harq_pid,
        get_G(fp,
          dlsch_harq->nb_rb,
          dlsch_harq->rb_alloc,
          dlsch_harq->Qm,
          dlsch_harq->Nl,
          dlsch_harq->pdsch_start,
          frame,subframe,
          0),
        0,
        frame,
        subframe<<1);
    stop_meas(&eNB->dlsch_scrambling_stats);

    start_meas(&eNB->dlsch_modulation_stats);

388
  
389
    dlsch_modulation(eNB,
390
391
		   eNB->common_vars.txdataF,
		   AMP,
jftt_wangshanshan's avatar
jftt_wangshanshan committed
392
		   frame,
393
		   subframe,
394
		   dlsch_harq->pdsch_start,
395
396
397
398
		   dlsch,
		   dlsch1);
  
  stop_meas(&eNB->dlsch_modulation_stats);
399
  }
400
401
402
#ifdef UE_EXPANSION
  dlsch->active[subframe] = 0;
#else
403
  dlsch->active = 0;
404
#endif
405
  dlsch_harq->round++;
406
407

  LOG_D(PHY,"Generating DLSCH/PDSCH dlsch_harq[round:%d]\n",dlsch_harq->round);
408
}
409
410


411

412
void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
knopp's avatar
knopp committed
413
			   eNB_rxtx_proc_t *proc,
414
                           relaying_type_t r_type,
415
416
			   PHY_VARS_RN *rn,
			   int do_meas)
417
418
{
  UNUSED(rn);
419
420
  int frame=proc->frame_tx;
  int subframe=proc->subframe_tx;
421
  uint32_t i,aa;
422
  uint8_t harq_pid;
423
#ifndef UE_EXPANSION
424
  int8_t UE_id=0;
425
426
427
#else
  int16_t UE_id=0;
#endif
428
  uint8_t num_pdcch_symbols=0;
429
  uint8_t num_dci=0;
430
431
  uint8_t ul_subframe;
  uint32_t ul_frame;
432
  LTE_DL_FRAME_PARMS *fp=&eNB->frame_parms;
433
  LTE_UL_eNB_HARQ_t *ulsch_harq;
434

435
  int offset = eNB->CC_id;//proc == &eNB->proc.proc_rxtx[0] ? 0 : 1;
436

437
  if ((fp->frame_type == TDD) && (subframe_select(fp,subframe)==SF_UL)) return;
438

Raymond Knopp's avatar
Raymond Knopp committed
439
  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_ENB_TX+offset,1);
440
  if (do_meas==1) start_meas(&eNB->phy_proc_tx);
441

442
  // clear the transmit data array for the current subframe
443
444
445
  for (aa=0; aa<fp->nb_antenna_ports_eNB; aa++) {      
    memset(&eNB->common_vars.txdataF[aa][subframe*fp->ofdm_symbol_size*(fp->symbols_per_tti)],
	   0,fp->ofdm_symbol_size*(fp->symbols_per_tti)*sizeof(int32_t));
knopp's avatar
   
knopp committed
446
  }
447
  
448

449
450
451
452
453
454
455
456
  if (nfapi_mode == 0 || nfapi_mode == 1) {
    if (is_pmch_subframe(frame,subframe,fp)) {
      pmch_procedures(eNB,proc,rn,r_type);
    }
    else {
      // this is not a pmch subframe, so generate PSS/SSS/PBCH
      common_signal_procedures(eNB,proc->frame_tx, proc->subframe_tx);
    }
457
  }
458

knopp's avatar
   
knopp committed
459
  // clear existing ulsch dci allocations before applying info from MAC  (this is table
460
  ul_subframe = pdcch_alloc2ul_subframe(fp,subframe);
461
  ul_frame = pdcch_alloc2ul_frame(fp,frame,subframe);
462
463
464



knopp's avatar
   
knopp committed
465
  // clear previous allocation information for all UEs
466
  for (i=0; i<NUMBER_OF_UE_MAX; i++) {
467
468
    if (eNB->dlsch[i][0])
      eNB->dlsch[i][0]->subframe_tx[subframe] = 0;
knopp's avatar
   
knopp committed
469
  }
470

Cedric Roux's avatar
Cedric Roux committed
471
  /* save old HARQ information needed for PHICH generation */
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
  if (ul_subframe < 10) { // This means that there is a potential UL subframe that will be scheduled here
    for (i=0; i<NUMBER_OF_UE_MAX; i++) {
      harq_pid = subframe2harq_pid(fp,ul_frame,ul_subframe);
      if (eNB->ulsch[i]) {
	ulsch_harq = eNB->ulsch[i]->harq_processes[harq_pid];
	
	/* Store first_rb and n_DMRS for correct PHICH generation below.
	 * For PHICH generation we need "old" values of last scheduling
	 * for this HARQ process. 'generate_eNB_dlsch_params' below will
	 * overwrite first_rb and n_DMRS and 'generate_phich_top', done
	 * after 'generate_eNB_dlsch_params', would use the "new" values
	 * instead of the "old" ones.
	 *
	 * This has been tested for FDD only, may be wrong for TDD.
	 *
	 * TODO: maybe we should restructure the code to be sure it
	 *       is done correctly. The main concern is if the code
	 *       changes and first_rb and n_DMRS are modified before
	 *       we reach here, then the PHICH processing will be wrong,
	 *       using wrong first_rb and n_DMRS values to compute
	 *       ngroup_PHICH and nseq_PHICH.
	 *
	 * TODO: check if that works with TDD.
	 */
	ulsch_harq->previous_first_rb = ulsch_harq->first_rb;
	ulsch_harq->previous_n_DMRS   = ulsch_harq->n_DMRS;
	
Cedric Roux's avatar
Cedric Roux committed
499
500
501
502
      }
    }
  }

503

504

505
506
507
508
509
  //  num_pdcch_symbols = DCI_pdu->num_pdcch_symbols;
  num_pdcch_symbols = eNB->pdcch_vars[subframe&1].num_pdcch_symbols;
  num_dci           = eNB->pdcch_vars[subframe&1].num_dci;
  //  LOG_D(PHY,"num_pdcch_symbols %"PRIu8",(dci common %"PRIu8", dci uespec %"PRIu8"\n",num_pdcch_symbols,
  //        DCI_pdu->Num_common_dci,DCI_pdu->Num_ue_spec_dci);
Cedric Roux's avatar
Cedric Roux committed
510
  LOG_D(PHY,"num_pdcch_symbols %"PRIu8",number dci %"PRIu8"\n",num_pdcch_symbols, num_dci);
511
  VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_DCI_INFO,num_pdcch_symbols);
512

513

514
515
  VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_DCI_INFO,(frame*10)+subframe);

516
  if (num_dci > 0)
Cedric Roux's avatar
Cedric Roux committed
517
518
    LOG_D(PHY,"[eNB %"PRIu8"] Frame %d, subframe %d: Calling generate_dci_top (pdcch) (num_dci %"PRIu8") num_pdcch_symbols:%d\n",eNB->Mod_id,frame, subframe, num_dci, num_pdcch_symbols);

519
520
521
522
523
524
525
526
527
528
529
530
531
532
  //LOG_D(PHY,"Before generate_dci_top num_pdcch_symbols:%d num_dci:%d dci_alloc:dci_length:%d\n", num_pdcch_symbols, num_dci, eNB->pdcch_vars[subframe&1].dci_alloc[0].dci_length);

  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_PDCCH_TX,1);

  if (nfapi_mode == 0 || nfapi_mode == 1) {
    generate_dci_top(num_pdcch_symbols,
        num_dci,
        &eNB->pdcch_vars[subframe&1].dci_alloc[0],
        0,
        AMP,
        fp,
        eNB->common_vars.txdataF,
        subframe);
  }
533

534

gauthier's avatar
gauthier committed
535
  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_PDCCH_TX,0);
536

537
  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_DLSCH,1);
knopp's avatar
   
knopp committed
538
  // Now scan UE specific DLSCH
539
  LTE_eNB_DLSCH_t *dlsch0,*dlsch1;
540
  for (UE_id=0; UE_id<NUMBER_OF_UE_MAX; UE_id++)
541
    {
542
543
544
545
546
      dlsch0 = eNB->dlsch[(uint8_t)UE_id][0]; 
      dlsch1 = eNB->dlsch[(uint8_t)UE_id][1]; 

      if ((dlsch0)&&
	  (dlsch0->rnti>0)&&
547
548
549
#ifdef UE_EXPANSION
	  (dlsch0->active[subframe] == 1)) {
#else
550
	  (dlsch0->active == 1)) {
551
#endif
552

553
	// get harq_pid
jftt_wangshanshan's avatar
jftt_wangshanshan committed
554
	harq_pid = dlsch0->harq_ids[frame%2][subframe];
555
	AssertFatal(harq_pid>=0,"harq_pid is negative\n");
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571

        if (harq_pid>=8)
        {
          LOG_E(PHY,"harq_pid:%d corrupt must be 0-7 UE_id:%d frame:%d subframe:%d rnti:%x\n", harq_pid,UE_id,frame,subframe,dlsch0->rnti);
        }
        else
        {
          // generate pdsch
          pdsch_procedures(eNB,
              proc,
              harq_pid,
              dlsch0,
              dlsch1,
              &eNB->UE_stats[(uint32_t)UE_id],
              0);
        }
572
573


knopp's avatar
   
knopp committed
574
      }
575

gauthier's avatar
gauthier committed
576

577
578
      else if ((dlsch0)&&
	       (dlsch0->rnti>0)&&
579
580
581
582
583
#ifdef UE_EXPANSION
	       (dlsch0->active[subframe] == 0)) {
#else
           (dlsch0->active == 0)) {
#endif
584

585
586
        // clear subframe TX flag since UE is not scheduled for PDSCH in this subframe (so that we don't look for PUCCH later)
        dlsch0->subframe_tx[subframe]=0;
knopp's avatar
   
knopp committed
587
      }
knopp's avatar
   
knopp committed
588
    }
589
  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_DLSCH,0);
590

591
592


593
  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_PHICH,1);
594
595
596
  generate_phich_top(eNB,
		     proc,
		     AMP);
597
  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_PHICH,0);
598

Raymond Knopp's avatar
Raymond Knopp committed
599
  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_ENB_TX+offset,0);
600
  if (do_meas==1) stop_meas(&eNB->phy_proc_tx);
601
  
602
603
}

604

605
#ifdef Rel14
606
607
608
609
void prach_procedures(PHY_VARS_eNB *eNB,
		      int br_flag) {
#else
void prach_procedures(PHY_VARS_eNB *eNB) {
610
611
#endif
  uint16_t max_preamble[4],max_preamble_energy[4],max_preamble_delay[4];
gauthier's avatar
gauthier committed
612
  uint16_t i;
613
  int frame,subframe;
knopp's avatar
knopp committed
614

615
616
617
618
#ifdef Rel14
  if (br_flag==1) {
    subframe = eNB->proc.subframe_prach_br;
    frame = eNB->proc.frame_prach_br;
619
    pthread_mutex_lock(&eNB->UL_INFO_mutex);
620
    eNB->UL_INFO.rach_ind_br.rach_indication_body.number_of_preambles=0;
621
    pthread_mutex_unlock(&eNB->UL_INFO_mutex);
622
623
624
625
  }
  else
#endif
    {
626
      pthread_mutex_lock(&eNB->UL_INFO_mutex);
627
      eNB->UL_INFO.rach_ind.rach_indication_body.number_of_preambles=0;
628
      pthread_mutex_unlock(&eNB->UL_INFO_mutex);
629
630
631
      subframe = eNB->proc.subframe_prach;
      frame = eNB->proc.frame_prach;
    }
632
633
634
  RU_t *ru;
  int aa=0;
  int ru_aa;
635

636
 
637
  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_PRACH_RX,1);
638

639
640


641
642
  for (i=0;i<eNB->num_RU;i++) {
    ru=eNB->RU_list[i];
643
    for (ru_aa=0,aa=0;ru_aa<ru->nb_rx;ru_aa++,aa++) {
644
      eNB->prach_vars.rxsigF[0][aa] = eNB->RU_list[i]->prach_rxsigF[ru_aa];
645
646
647
648
#ifdef Rel14
      int ce_level;

      if (br_flag==1)
649
	for (ce_level=0;ce_level<4;ce_level++) eNB->prach_vars_br.rxsigF[ce_level][aa] = eNB->RU_list[i]->prach_rxsigF_br[ce_level][ru_aa];
650
651
#endif
    }
652
  }
653

654
655
  rx_prach(eNB,
	   eNB->RU_list[0],
656
657
658
	   &max_preamble[0],
	   &max_preamble_energy[0],
	   &max_preamble_delay[0],
659
	   frame,
660
661
662
663
664
	   0
#ifdef Rel14
	   ,br_flag
#endif
	   );
665

666
  //#ifdef DEBUG_PHY_PROC
knopp's avatar
knopp committed
667
  LOG_D(PHY,"[RAPROC] Frame %d, subframe %d : Most likely preamble %d, energy %d dB delay %d\n",
668
        frame,subframe,
669
        max_preamble[0],
670
        max_preamble_energy[0]/10,
671
        max_preamble_delay[0]);
672
  //q#endif
673

674
675
#ifdef Rel14
  if (br_flag==1) {
676

677
678
679
680
    int prach_mask;
      
    prach_mask = is_prach_subframe(&eNB->frame_parms,eNB->proc.frame_prach_br,eNB->proc.subframe_prach_br);
    
681
    eNB->UL_INFO.rach_ind_br.rach_indication_body.preamble_list                              = eNB->preamble_list_br;
682
683
684
    int ind=0;
    int ce_level=0;
    /* Save for later, it doesn't work    
685
    for (int ind=0,ce_level=0;ce_level<4;ce_level++) {
686
687
688
      
      if ((eNB->frame_parms.prach_emtc_config_common.prach_ConfigInfo.prach_CElevel_enable[ce_level]==1)&&
	  (prach_mask&(1<<(1+ce_level)) > 0) && // prach is active and CE level has finished its repetitions
689
690
	  (eNB->prach_vars_br.repetition_number[ce_level]==
	   eNB->frame_parms.prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[ce_level])) {
691
    */ 
692
    if (eNB->frame_parms.prach_emtc_config_common.prach_ConfigInfo.prach_CElevel_enable[0]==1){ 
693
694
      if ((eNB->prach_energy_counter == 100) && 
          (max_preamble_energy[0] > eNB->measurements.prach_I0 + 100)) {
695
	eNB->UL_INFO.rach_ind_br.rach_indication_body.number_of_preambles++;
696
697
698
699
700
701
702
	
	eNB->preamble_list_br[ind].preamble_rel8.timing_advance        = max_preamble_delay[ind];//
	eNB->preamble_list_br[ind].preamble_rel8.preamble              = max_preamble[ind];
	// note: fid is implicitly 0 here, this is the rule for eMTC RA-RNTI from 36.321, Section 5.1.4
	eNB->preamble_list_br[ind].preamble_rel8.rnti                  = 1+subframe+(eNB->prach_vars_br.first_frame[ce_level]%40);  
	eNB->preamble_list_br[ind].instance_length                     = 0; //don't know exactly what this is
	eNB->preamble_list_br[ind].preamble_rel13.rach_resource_type   = 1+ce_level;  // CE Level
knopp's avatar
knopp committed
703
	LOG_D(PHY,"Filling NFAPI indication for RACH %d CELevel %d (mask %x) : TA %d, Preamble %d, rnti %x, rach_resource_type %d\n",
704
705
706
707
708
709
710
711
712
	      ind,
	      ce_level,
	      prach_mask,
	      eNB->preamble_list_br[ind].preamble_rel8.timing_advance,
	      eNB->preamble_list_br[ind].preamble_rel8.preamble,
	      eNB->preamble_list_br[ind].preamble_rel8.rnti,
	      eNB->preamble_list_br[ind].preamble_rel13.rach_resource_type);
      }
      /*
713
714
	ind++;
      }
715
716
      } */// ce_level
    }
717
718
719
  }
  else
#endif
Cedric Roux's avatar
Cedric Roux committed
720

721
    {
722
      if ((eNB->prach_energy_counter == 100) && 
Cedric Roux's avatar
Cedric Roux committed
723
          (max_preamble_energy[0] > eNB->measurements.prach_I0+100)) {
724

725
	LOG_D(PHY,"[eNB %d/%d][RAPROC] Frame %d, subframe %d Initiating RA procedure with preamble %d, energy %d.%d dB, delay %d\n",
726
727
728
729
730
731
732
733
	      eNB->Mod_id,
	      eNB->CC_id,
	      frame,
	      subframe,
	      max_preamble[0],
	      max_preamble_energy[0]/10,
	      max_preamble_energy[0]%10,
	      max_preamble_delay[0]);
734
	
Cedric Roux's avatar
Cedric Roux committed
735
	    T(T_ENB_PHY_INITIATE_RA_PROCEDURE, T_INT(eNB->Mod_id), T_INT(frame), T_INT(subframe),
736
737
	      T_INT(max_preamble[0]), T_INT(max_preamble_energy[0]), T_INT(max_preamble_delay[0]));
	    
738
739
	    pthread_mutex_lock(&eNB->UL_INFO_mutex);
	    
740
741
742
743
744
	    eNB->UL_INFO.rach_ind.rach_indication_body.number_of_preambles  = 1;
	    eNB->UL_INFO.rach_ind.rach_indication_body.preamble_list        = &eNB->preamble_list[0];
	    eNB->UL_INFO.rach_ind.rach_indication_body.tl.tag               = NFAPI_RACH_INDICATION_BODY_TAG;
            eNB->UL_INFO.rach_ind.header.message_id                         = NFAPI_RACH_INDICATION;
            eNB->UL_INFO.rach_ind.sfn_sf                                    = frame<<4 | subframe;
745
	    
746
	    eNB->preamble_list[0].preamble_rel8.tl.tag                = NFAPI_PREAMBLE_REL8_TAG;
747
748
749
750
751
752
	    eNB->preamble_list[0].preamble_rel8.timing_advance        = max_preamble_delay[0];
	    eNB->preamble_list[0].preamble_rel8.preamble              = max_preamble[0];
	    eNB->preamble_list[0].preamble_rel8.rnti                  = 1+subframe;  // note: fid is implicitly 0 here
	    eNB->preamble_list[0].preamble_rel13.rach_resource_type   = 0;
	    eNB->preamble_list[0].instance_length                     = 0; //don't know exactly what this is
	    
753
754
            if (nfapi_mode == 1) {  // If NFAPI PNF then we need to send the message to the VNF

Cedric Roux's avatar
Cedric Roux committed
755
              LOG_D(PHY,"Filling NFAPI indication for RACH : SFN_SF:%d TA %d, Preamble %d, rnti %x, rach_resource_type %d\n",
756
757
758
759
760
761
762
763
764
765
766
                  NFAPI_SFNSF2DEC(eNB->UL_INFO.rach_ind.sfn_sf),
                  eNB->preamble_list[0].preamble_rel8.timing_advance,
                  eNB->preamble_list[0].preamble_rel8.preamble,
                  eNB->preamble_list[0].preamble_rel8.rnti,
                  eNB->preamble_list[0].preamble_rel13.rach_resource_type);	    

              oai_nfapi_rach_ind(&eNB->UL_INFO.rach_ind);

              eNB->UL_INFO.rach_ind.rach_indication_body.number_of_preambles = 0;
            }

767
768
	    pthread_mutex_unlock(&eNB->UL_INFO_mutex);
      
769
770
771
772
773
774
      } // max_preamble_energy > prach_I0 + 100 
      else {
         eNB->measurements.prach_I0 = ((eNB->measurements.prach_I0*900)>>10) + ((max_preamble_energy[0]*124)>>10); 
         if (frame==0) LOG_I(PHY,"prach_I0 = %d.%d dB\n",eNB->measurements.prach_I0/10,eNB->measurements.prach_I0%10);
         if (eNB->prach_energy_counter < 100) eNB->prach_energy_counter++;
      }
775
776
    } // else br_flag

777
  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_PRACH_RX,0);
778
779
}

780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
void srs_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) {

  LTE_DL_FRAME_PARMS *fp = &eNB->frame_parms;
  const int subframe = proc->subframe_rx;
  const int frame = proc->frame_rx;

  int i;

  if (is_srs_occasion_common(fp,frame,subframe)) { 
  
  // Do SRS processing 
  // check if there is SRS and we have to use shortened format
  // TODO: check for exceptions in transmission of SRS together with ACK/NACK
    for (i=0;i<NUMBER_OF_UE_MAX;i++) {

      if (eNB->soundingrs_ul_config_dedicated[i].active==1) {

      
	if (lte_srs_channel_estimation(fp,
				       &eNB->common_vars,
				       &eNB->srs_vars[i],
				       &eNB->soundingrs_ul_config_dedicated[i],
				       subframe,
				       0/*eNB_id*/)) {
	  LOG_E(PHY,"problem processing SRS\n");
	}
	eNB->soundingrs_ul_config_dedicated[i].active=0;
      }
    }
  }
}

812
813
void fill_sr_indication(PHY_VARS_eNB *eNB,uint16_t rnti,int frame,int subframe,uint32_t stat) {
  
814
  pthread_mutex_lock(&eNB->UL_INFO_mutex);
815
816
817
818
819
820
821
822
  nfapi_sr_indication_t       *sr_ind =         &eNB->UL_INFO.sr_ind;
  nfapi_sr_indication_body_t  *sr_ind_body =    &sr_ind->sr_indication_body;
  nfapi_sr_indication_pdu_t *pdu =   &sr_ind_body->sr_pdu_list[sr_ind_body->number_of_srs];

  sr_ind->sfn_sf = frame<<4|subframe;
  sr_ind->header.message_id = NFAPI_RX_SR_INDICATION;

  sr_ind_body->tl.tag = NFAPI_SR_INDICATION_BODY_TAG;
823
824
825

  pdu->instance_length                                = 0; // don't know what to do with this
  //  pdu->rx_ue_information.handle                       = handle;
826
  pdu->rx_ue_information.tl.tag                       = NFAPI_RX_UE_INFORMATION_TAG;
827
828
  pdu->rx_ue_information.rnti                         = rnti;

829
830
831
  int SNRtimes10 = dB_fixed_times10(stat) - 200;//(10*eNB->measurements.n0_power_dB[0]);


832
833
  pdu->ul_cqi_information.tl.tag = NFAPI_UL_CQI_INFORMATION_TAG;

834
835
836
837
838
  if      (SNRtimes10 < -640) pdu->ul_cqi_information.ul_cqi=0;
  else if (SNRtimes10 >  635) pdu->ul_cqi_information.ul_cqi=255;
  else                        pdu->ul_cqi_information.ul_cqi=(640+SNRtimes10)/5;
  pdu->ul_cqi_information.channel = 0;

839
  sr_ind_body->number_of_srs++;
840
841
842
843
  pthread_mutex_unlock(&eNB->UL_INFO_mutex);
}

void uci_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
Cedric Roux's avatar
Cedric Roux committed
844
{
845
  LTE_DL_FRAME_PARMS *fp=&eNB->frame_parms;
846
847
  uint8_t SR_payload = 0,pucch_b0b1[4][2]= {{0,0},{0,0},{0,0},{0,0}},harq_ack[4]={0,0,0,0};
  int32_t metric[4]={0,0,0,0},metric_SR=0,max_metric;
848
849
  const int subframe = proc->subframe_rx;
  const int frame = proc->frame_rx;
850
851
852
853
  int i;
  LTE_eNB_UCI *uci;
  uint16_t tdd_multiplexing_mask=0;
  int res;
854

855
  for (i=0;i<NUMBER_OF_UE_MAX;i++) {
Cedric Roux's avatar
Cedric Roux committed
856

857
858
859
860
    uci = &eNB->uci_vars[i];
    if ((uci->active == 1) &&
	(uci->frame == frame) &&
	(uci->subframe == subframe)) {
861

862
      LOG_D(PHY,"Frame %d, subframe %d: Running uci procedures (type %d) for %d \n",frame,subframe,uci->type,i);
863
      uci->active=0;
Cedric Roux's avatar
Cedric Roux committed
864

knopp's avatar
knopp committed
865
866
867
      // Null out PUCCH PRBs for noise measurement
      switch(fp->N_RB_UL) {
      case 6:
Cedric Roux's avatar
Cedric Roux committed
868
869
        eNB->rb_mask_ul[0] |= (0x1 | (1<<5)); //position 5
        break;
knopp's avatar
knopp committed
870
      case 15:
Cedric Roux's avatar
Cedric Roux committed
871
872
        eNB->rb_mask_ul[0] |= (0x1 | (1<<14)); // position 14
        break;
knopp's avatar
knopp committed
873
      case 25:
Cedric Roux's avatar
Cedric Roux committed
874
875
        eNB->rb_mask_ul[0] |= (0x1 | (1<<24)); // position 24
        break;
knopp's avatar
knopp committed
876
      case 50:
Cedric Roux's avatar
Cedric Roux committed
877
878
879
        eNB->rb_mask_ul[0] |= 0x1;
        eNB->rb_mask_ul[1] |= (1<<17); // position 49 (49-32)
        break;
knopp's avatar
knopp committed
880
      case 75:
Cedric Roux's avatar
Cedric Roux committed
881
882
883
        eNB->rb_mask_ul[0] |= 0x1;
        eNB->rb_mask_ul[2] |= (1<<10); // position 74 (74-64)
        break;
knopp's avatar
knopp committed
884
      case 100:
Cedric Roux's avatar
Cedric Roux committed
885
886
887
        eNB->rb_mask_ul[0] |= 0x1;
        eNB->rb_mask_ul[3] |= (1<<3); // position 99 (99-96)
        break;
knopp's avatar
knopp committed
888
      default:
Cedric Roux's avatar
Cedric Roux committed
889
890
        LOG_E(PHY,"Unknown number for N_RB_UL %d\n",fp->N_RB_UL);
        break;
knopp's avatar
knopp committed
891
      }
Wu Jing's avatar
Wu Jing committed
892
      SR_payload = 0;
893
894
895
896
897
898
899
900
      switch (uci->type) {
      case SR:
      case HARQ_SR:
		
	metric_SR = rx_pucch(eNB,
			      uci->pucch_fmt,
			      i,
			      uci->n_pucch_1_0_sr[0],
901
			      0, // n2_pucch
902
			      uci->srs_active, // shortened format
903
904
905
906
			      &SR_payload,
			      frame,
			      subframe,
			      PUCCH1_THRES);
907
	LOG_D(PHY,"[eNB %d][SR %x] Frame %d subframe %d Checking SR is %d (uci.type %d SR n1pucch is %d)\n",
908
	      eNB->Mod_id,
909
	      uci->rnti,
910
911
912
	      frame,
	      subframe,
	      SR_payload,
913
              uci->type,
914
915
916
	      uci->n_pucch_1_0_sr[0]);
	if (uci->type == SR) {
	  if (SR_payload == 1) {
917
	    fill_sr_indication(eNB,uci->rnti,frame,subframe,metric_SR);
918
	    break;
919
920
	  }
	  else {
921
	    break;
922
923
924
925
	  }
	}
      case HARQ:
	if (fp->frame_type == FDD) {
926
	  LOG_D(PHY,"Frame %d Subframe %d Demodulating PUCCH (UCI %d) for ACK/NAK (uci->pucch_fmt %d,uci->type %d.uci->frame %d, uci->subframe %d): n1_pucch0 %d SR_payload %d\n",
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
		frame,subframe,i,
		uci->pucch_fmt,uci->type,
		uci->frame,uci->subframe,uci->n_pucch_1[0][0],
		SR_payload);
	  
	  metric[0] = rx_pucch(eNB,
			       uci->pucch_fmt,
			       i,
			       uci->n_pucch_1[0][0],
			       0, //n2_pucch
			       uci->srs_active, // shortened format
			       pucch_b0b1[0],
			       frame,
			       subframe,
			       PUCCH1a_THRES);
	  
	  
	  /* cancel SR detection if reception on n1_pucch0 is better than on SR PUCCH resource index, otherwise send it up to MAC */
	  if (uci->type==HARQ_SR && metric[0] > metric_SR) SR_payload = 0;
946
	  else if (SR_payload == 1) fill_sr_indication(eNB,uci->rnti,frame,subframe,metric_SR);
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
 
	  if (uci->type==HARQ_SR && metric[0] <= metric_SR) {
	    /* when transmitting ACK/NACK on SR PUCCH resource index, SR payload is always 1 */
	    SR_payload = 1;
	    
	    metric[0]=rx_pucch(eNB,
			       uci->pucch_fmt,
			       i,
			       uci->n_pucch_1_0_sr[0],
			       0, //n2_pucch
			       uci->srs_active, // shortened format
			       pucch_b0b1[0],
			       frame,
			       subframe,
			       PUCCH1a_THRES);
	  }
	  
964