eNB_scheduler.c 16.6 KB
Newer Older
1
/*******************************************************************************
nikaeinn's avatar
nikaeinn committed
2 3
    OpenAirInterface
    Copyright(c) 1999 - 2014 Eurecom
4

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


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

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

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

  Address      : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France.
27

nikaeinn's avatar
nikaeinn committed
28
*******************************************************************************/
29
/*! \file eNB_scheduler.c
nikaeinn's avatar
nikaeinn committed
30
 * \brief eNB scheduler top level function operates on per subframe basis
31 32
 * \author  Navid Nikaein and Raymond Knopp
 * \date 2010 - 2014
33
 * \email: navid.nikaein@eurecom.fr
34 35
 * \version 0.5
 * @ingroup _mac
36

37
 */
38

39
#include "assertions.h"
40 41 42 43 44 45 46 47
#include "PHY/defs.h"
#include "PHY/extern.h"

#include "SCHED/defs.h"
#include "SCHED/extern.h"

#include "LAYER2/MAC/defs.h"
#include "LAYER2/MAC/extern.h"
gauthier's avatar
gauthier committed
48

49 50 51 52 53 54 55 56 57
#include "LAYER2/MAC/proto.h"
#include "UTIL/LOG/log.h"
#include "UTIL/LOG/vcd_signal_dumper.h"
#include "UTIL/OPT/opt.h"
#include "OCG.h"
#include "OCG_extern.h"
#include "ARCH/CBMIMO1/DEVICE_DRIVER/extern.h"
#include "ARCH/CBMIMO1/DEVICE_DRIVER/defs.h"
#include "ARCH/CBMIMO1/DEVICE_DRIVER/from_grlib_softregs.h"
gauthier's avatar
gauthier committed
58

59 60
#include "RRC/LITE/extern.h"
#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
gauthier's avatar
gauthier committed
61

62 63
//#include "LAYER2/MAC/pre_processor.c"
#include "pdcp.h"
64

65 66
#if defined(ENABLE_ITTI)
# include "intertask_interface.h"
67 68
#endif

69 70 71 72
#define ENABLE_MAC_PAYLOAD_DEBUG
#define DEBUG_eNB_SCHEDULER 1
//#define DEBUG_HEADER_PARSING 1
//#define DEBUG_PACKET_TRACE 1
gauthier's avatar
gauthier committed
73

74 75 76 77 78
/*
  #ifndef USER_MODE
  #define msg debug_msg
  #endif
 */
gauthier's avatar
gauthier committed
79 80 81



82

gauthier's avatar
gauthier committed
83
void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, frame_t frameP, sub_frame_t subframeP) {//, int calibration_flag) {
84

85
  start_meas(&eNB_mac_inst[module_idP].eNB_scheduler);
knopp's avatar
 
knopp committed
86 87 88 89
  unsigned int nprb[MAX_NUM_CCs];
  unsigned int nCCE[MAX_NUM_CCs];
  int mbsfn_status[MAX_NUM_CCs];
  uint32_t RBalloc[MAX_NUM_CCs];
90
#ifdef EXMIMO
91
  int ret;
92
#endif
93
#if defined(ENABLE_ITTI)
94 95 96 97
  MessageDef   *msg_p;
  const char   *msg_name;
  instance_t    instance;
  int           result;
98
#endif
knopp's avatar
 
knopp committed
99 100
  DCI_PDU *DCI_pdu[MAX_NUM_CCs];
  int CC_id;
101

nikaeinn's avatar
nikaeinn committed
102
  LOG_D(MAC,"[eNB %d] Frame %d, Subframe %d, entering MAC scheduler\n",module_idP, frameP, subframeP);
103

knopp's avatar
 
knopp committed
104 105


106 107
  vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ULSCH_SCHEDULER,1);

knopp's avatar
 
knopp committed
108 109 110 111 112 113 114
  for (CC_id=0;CC_id<MAX_NUM_CCs;CC_id++) {
    DCI_pdu[CC_id] = &eNB_mac_inst[module_idP].common_channels[CC_id].DCI_pdu;
    nCCE[CC_id]=0;
    nprb[CC_id]=0;
    RBalloc[CC_id]=0;
    mbsfn_status[CC_id]=0;
  }
115 116
#if defined(ENABLE_ITTI)
  do {
gauthier's avatar
gauthier committed
117 118
      // Checks if a message has been sent to MAC sub-task
      itti_poll_msg (TASK_MAC_ENB, &msg_p);
119

gauthier's avatar
gauthier committed
120 121 122
      if (msg_p != NULL) {
          msg_name = ITTI_MSG_NAME (msg_p);
          instance = ITTI_MSG_INSTANCE (msg_p);
123

gauthier's avatar
gauthier committed
124 125 126 127
          switch (ITTI_MSG_ID(msg_p)) {
          case MESSAGE_TEST:
            LOG_D(MAC, "Received %s\n", ITTI_MSG_NAME(msg_p));
            break;
128

gauthier's avatar
gauthier committed
129 130
          case RRC_MAC_BCCH_DATA_REQ:
            LOG_D(MAC, "Received %s from %s: instance %d, frameP %d, eNB_index %d\n",
131
                msg_name, ITTI_MSG_ORIGIN_NAME(msg_p), instance,
132
                RRC_MAC_BCCH_DATA_REQ (msg_p).frame, RRC_MAC_BCCH_DATA_REQ (msg_p).enb_index);
133

gauthier's avatar
gauthier committed
134 135
            // TODO process BCCH data req.
            break;
136

gauthier's avatar
gauthier committed
137 138
          case RRC_MAC_CCCH_DATA_REQ:
            LOG_D(MAC, "Received %s from %s: instance %d, frameP %d, eNB_index %d\n",
139
                msg_name, ITTI_MSG_ORIGIN_NAME(msg_p), instance,
140
                RRC_MAC_CCCH_DATA_REQ (msg_p).frame, RRC_MAC_CCCH_DATA_REQ (msg_p).enb_index);
141

gauthier's avatar
gauthier committed
142 143
            // TODO process CCCH data req.
            break;
144 145

#ifdef Rel10
gauthier's avatar
gauthier committed
146 147
          case RRC_MAC_MCCH_DATA_REQ:
            LOG_D(MAC, "Received %s from %s: instance %d, frameP %d, eNB_index %d, mbsfn_sync_area %d\n",
148
                msg_name, ITTI_MSG_ORIGIN_NAME(msg_p), instance,
149
                RRC_MAC_MCCH_DATA_REQ (msg_p).frame, RRC_MAC_MCCH_DATA_REQ (msg_p).enb_index, RRC_MAC_MCCH_DATA_REQ (msg_p).mbsfn_sync_area);
150

gauthier's avatar
gauthier committed
151 152
            // TODO process MCCH data req.
            break;
153 154
#endif

gauthier's avatar
gauthier committed
155 156 157 158
          default:
            LOG_E(MAC, "Received unexpected message %s\n", msg_name);
            break;
          }
159

gauthier's avatar
gauthier committed
160 161 162
          result = itti_free (ITTI_MSG_ORIGIN_ID(msg_p), msg_p);
          AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
      }
163 164 165
  } while(msg_p != NULL);
#endif

gauthier's avatar
gauthier committed
166
  // clear DCI and BCCH contents before scheduling
knopp's avatar
 
knopp committed
167 168 169 170 171
  for (CC_id=0;CC_id<MAX_NUM_CCs;CC_id++) {
    DCI_pdu[CC_id]->Num_common_dci  = 0;
    DCI_pdu[CC_id]->Num_ue_spec_dci = 0;
    eNB_mac_inst[module_idP].common_channels[CC_id].bcch_active = 0;
    
172
#ifdef Rel10
knopp's avatar
 
knopp committed
173
    eNB_mac_inst[module_idP].common_channels.mcch_active =0;
174
#endif
knopp's avatar
 
knopp committed
175 176 177 178
    
    eNB_mac_inst[module_idP].frame    = frameP;
    eNB_mac_inst[module_idP].subframe = subframeP;
  }
179

gauthier's avatar
gauthier committed
180
  //if (subframeP%5 == 0)
181
#ifdef EXMIMO
gauthier's avatar
gauthier committed
182
  pdcp_run(frameP, 1, 0, module_idP);
183 184
#endif
#ifdef CELLULAR
gauthier's avatar
gauthier committed
185
  rrc_rx_tx(module_idP, frameP, 0, 0);
186 187
#else
  // check HO
gauthier's avatar
gauthier committed
188 189 190 191
  rrc_rx_tx(module_idP,
      frameP,
      1,
      module_idP);
192 193 194
#endif

#ifdef Rel10
knopp's avatar
 
knopp committed
195 196 197 198 199 200
  for (CC_id=0;CC_id<MAX_NUM_CCs;CC_id++) {
    if (eNB_mac_inst[module_idP].common_channels.MBMS_flag >0) {
      start_meas(&eNB_mac_inst[module_idP].common_channels.schedule_mch);
      mbsfn_status = schedule_MBMS(module_idP,CC_id,frameP,subframeP);
      stop_meas(&eNB_mac_inst[module_idP][CC-id].schedule_mch);
    }
201 202 203
  }
#endif

gauthier's avatar
gauthier committed
204
  switch (subframeP) {
205 206
  case 0:
    // FDD/TDD Schedule Downlink RA transmissions (RA response, Msg4 Contention resolution)
gauthier's avatar
gauthier committed
207
    // Schedule ULSCH for FDD or subframeP 4 (TDD config 0,3,6)
208
    // Schedule Normal DLSCH
gauthier's avatar
gauthier committed
209

knopp's avatar
 
knopp committed
210
    schedule_RA(module_idP,frameP,subframeP,2,nprb,nCCE);
211 212

    if (mac_xface->lte_frame_parms->frame_type == FDD) {  //FDD
knopp's avatar
 
knopp committed
213
      schedule_ulsch(module_idP,frameP,cooperation_flag,0,4,nCCE);//,calibration_flag);
214 215
    }
    else if  ((mac_xface->lte_frame_parms->tdd_config == TDD) || //TDD
gauthier's avatar
gauthier committed
216 217
        (mac_xface->lte_frame_parms->tdd_config == 3) ||
        (mac_xface->lte_frame_parms->tdd_config == 6))
knopp's avatar
 
knopp committed
218
      //schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,4,nCCE);//,calibration_flag);
gauthier's avatar
gauthier committed
219

220

knopp's avatar
 
knopp committed
221
      // schedule_ue_spec(module_idP,subframeP,nprb,nCCE,mbsfn_status);
222

gauthier's avatar
gauthier committed
223
      fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,1,mbsfn_status);
224 225 226
    break;

  case 1:
gauthier's avatar
gauthier committed
227
    // TDD, schedule UL for subframeP 7 (TDD config 0,1) / subframeP 8 (TDD Config 6)
228 229
    // FDD, schedule normal UL/DLSCH
    if (mac_xface->lte_frame_parms->frame_type == TDD) { // TDD
gauthier's avatar
gauthier committed
230 231 232
        switch (mac_xface->lte_frame_parms->tdd_config) {
        case 0:
        case 1:
knopp's avatar
 
knopp committed
233
          schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,7,nCCE);
gauthier's avatar
gauthier committed
234 235 236
          fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,0,mbsfn_status);
          break;
        case 6:
knopp's avatar
 
knopp committed
237
          schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,8,nCCE);
gauthier's avatar
gauthier committed
238 239 240 241 242
          fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,0,mbsfn_status);
          break;
        default:
          break;
        }
243 244
    }
    else {  //FDD
knopp's avatar
 
knopp committed
245 246
      schedule_ulsch(module_idP,frameP,cooperation_flag,1,5,nCCE);
        // schedule_ue_spec(module_idP,subframeP,nprb,nCCE,mbsfn_status);
gauthier's avatar
gauthier committed
247
        // fill_DLSCH_dci(module_idP,subframeP,RBalloc,0,mbsfn_status);
248 249
    }
    break;
250 251

  case 2:
gauthier's avatar
gauthier committed
252
    // TDD, nothing
253 254
    // FDD, normal UL/DLSCH
    if (mac_xface->lte_frame_parms->frame_type == FDD) {  //FDD
knopp's avatar
 
knopp committed
255 256
      schedule_ulsch(module_idP,frameP,cooperation_flag,2,6,nCCE);
        // schedule_ue_spec(module_idP,subframeP,nprb,nCCE,mbsfn_status);
gauthier's avatar
gauthier committed
257
        // fill_DLSCH_dci(module_idP,subframeP,RBalloc,0,mbsfn_status);
258 259 260 261
    }
    break;

  case 3:
gauthier's avatar
gauthier committed
262
    // TDD Config 2, ULSCH for subframeP 7
263 264 265
    // TDD Config 2/5 normal DLSCH
    // FDD, normal UL/DLSCH
    if (mac_xface->lte_frame_parms->frame_type == TDD) {
gauthier's avatar
gauthier committed
266 267
        switch (mac_xface->lte_frame_parms->tdd_config) {
        case 2:
knopp's avatar
 
knopp committed
268
          schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,7,nCCE);
gauthier's avatar
gauthier committed
269
        case 5:
knopp's avatar
 
knopp committed
270
          schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status);
gauthier's avatar
gauthier committed
271 272 273 274 275
          fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,0,mbsfn_status);
          break;
        default:
          break;
        }
276 277
    }
    else { //FDD
knopp's avatar
 
knopp committed
278
        //      schedule_ulsch(module_idP,frameP,cooperation_flag,3,7,nCCE);
gauthier's avatar
gauthier committed
279 280
        // schedule_ue_spec(module_idP,subframeP,0,0,mbsfn_status);
        // fill_DLSCH_dci(module_idP,subframeP,RBalloc,0,mbsfn_status);
281 282
    }
    break;
283 284

  case 4:
gauthier's avatar
gauthier committed
285
    // TDD Config 1, ULSCH for subframeP 8
286 287 288
    // TDD Config 1/2/4/5 DLSCH
    // FDD UL/DLSCH
    if (mac_xface->lte_frame_parms->frame_type == 1) { // TDD
gauthier's avatar
gauthier committed
289 290
        switch (mac_xface->lte_frame_parms->tdd_config) {
        case 1:
knopp's avatar
 
knopp committed
291 292
          //        schedule_RA(module_idP,frameP,subframeP,nprb,nCCE);
          schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,8,nCCE);
gauthier's avatar
gauthier committed
293 294 295
        case 2:
        case 4:
        case 5:
knopp's avatar
 
knopp committed
296
          schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status);
gauthier's avatar
gauthier committed
297 298 299 300 301
          fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,1,mbsfn_status);
          break;
        default:
          break;
        }
302 303
    }
    else {
gauthier's avatar
gauthier committed
304
        if (mac_xface->lte_frame_parms->frame_type == FDD) {  //FDD
knopp's avatar
 
knopp committed
305 306 307 308
	  schedule_RA(module_idP,frameP, subframeP, 0, nprb, nCCE);
            //	schedule_ulsch(module_idP, frameP, cooperation_flag, 4, 8, nCCE);
            //schedule_ue_spec(module_idP, frameP, subframeP, nprb, nCCE, mbsfn_status);
	  fill_DLSCH_dci(module_idP, frameP, subframeP, RBalloc, 1, mbsfn_status);
knopp's avatar
knopp committed
309

gauthier's avatar
gauthier committed
310
        }
311 312 313 314 315 316 317 318
    }
    break;

  case 5:
    // TDD/FDD Schedule SI
    // TDD Config 0,6 ULSCH for subframes 9,3 resp.
    // TDD normal DLSCH
    // FDD normal UL/DLSCH
knopp's avatar
 
knopp committed
319 320
    schedule_SI(module_idP,frameP,nprb,nCCE);
    //schedule_RA(module_idP,frameP,subframeP,5,nprb,nCCE);
321
    if ((mac_xface->lte_frame_parms->frame_type == FDD) ) {
knopp's avatar
 
knopp committed
322 323
        //      schedule_RA(module_idP,frameP,subframeP,1,nprb,nCCE);
        //      schedule_ulsch(module_idP,frameP,cooperation_flag,5,9,nCCE);
gauthier's avatar
gauthier committed
324
        fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,0,mbsfn_status);
325 326 327

    }
    else if ((mac_xface->lte_frame_parms->tdd_config == 0) || // TDD Config 0
gauthier's avatar
gauthier committed
328
        (mac_xface->lte_frame_parms->tdd_config == 6)) { // TDD Config 6
knopp's avatar
 
knopp committed
329
        //schedule_ulsch(module_idP,cooperation_flag,subframeP,nCCE);
gauthier's avatar
gauthier committed
330
        fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,0,mbsfn_status);
331 332
    }
    else {
knopp's avatar
 
knopp committed
333
        //schedule_ue_spec(module_idP,subframeP,nprb,nCCE,mbsfn_status);
gauthier's avatar
gauthier committed
334
        fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,0,mbsfn_status);
335 336 337 338 339 340 341 342
    }
    break;

  case 6:
    // TDD Config 0,1,6 ULSCH for subframes 2,3
    // TDD Config 3,4,5 Normal DLSCH
    // FDD normal ULSCH/DLSCH
    if (mac_xface->lte_frame_parms->frame_type == TDD) { // TDD
gauthier's avatar
gauthier committed
343 344 345 346
        switch (mac_xface->lte_frame_parms->tdd_config) {
        case 0:
          break;
        case 1:
knopp's avatar
 
knopp committed
347 348
          schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,2,nCCE);
          //	schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status);
gauthier's avatar
gauthier committed
349 350 351
          fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,0,mbsfn_status);
          break;
        case 6:
knopp's avatar
 
knopp committed
352 353
          schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,3,nCCE);
          //	schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status);
gauthier's avatar
gauthier committed
354 355 356
          fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,0,mbsfn_status);
          break;
        case 5:
knopp's avatar
 
knopp committed
357 358
          schedule_RA(module_idP,frameP,subframeP,2,nprb,nCCE);
          schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status);
gauthier's avatar
gauthier committed
359 360 361 362
          fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,1,mbsfn_status);
          break;
        case 3:
        case 4:
knopp's avatar
 
knopp committed
363
          schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status);
gauthier's avatar
gauthier committed
364 365 366 367 368 369
          fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,0,mbsfn_status);
          break;

        default:
          break;
        }
370 371
    }
    else {  //FDD
knopp's avatar
 
knopp committed
372 373
        //      schedule_ulsch(module_idP,frameP,cooperation_flag,6,0,nCCE);
        schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status);
gauthier's avatar
gauthier committed
374
        fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,0,mbsfn_status);
375 376
    }
    break;
gauthier's avatar
gauthier committed
377

378 379 380 381
  case 7:
    // TDD Config 3,4,5 Normal DLSCH
    // FDD Normal UL/DLSCH
    if (mac_xface->lte_frame_parms->frame_type == TDD) { // TDD
gauthier's avatar
gauthier committed
382 383 384
        switch (mac_xface->lte_frame_parms->tdd_config) {
        case 3:
        case 4:
knopp's avatar
 
knopp committed
385 386
          //	  schedule_RA(module_idP,frameP,subframeP,3,nprb,nCCE);  // 3 = Msg3 subframeP, not
          schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status);
gauthier's avatar
gauthier committed
387 388 389
          fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,0,mbsfn_status); //1,mbsfn_status);
          break;
        case 5:
knopp's avatar
 
knopp committed
390
          schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status);
gauthier's avatar
gauthier committed
391 392 393 394 395
          fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,0,mbsfn_status);
          break;
        default:
          break;
        }
396
    }
397
    else {  //FDD
knopp's avatar
 
knopp committed
398 399
        //      schedule_ulsch(module_idP,frameP,cooperation_flag,7,1,nCCE);
        schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status);
gauthier's avatar
gauthier committed
400
        fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,0,mbsfn_status);
401 402 403 404
    }
    break;

  case 8:
gauthier's avatar
gauthier committed
405
    // TDD Config 2,3,4,5 ULSCH for subframeP 2
406 407 408
    //
    // FDD Normal UL/DLSCH
    if (mac_xface->lte_frame_parms->frame_type == TDD) { // TDD
gauthier's avatar
gauthier committed
409 410 411 412 413 414
        switch (mac_xface->lte_frame_parms->tdd_config) {
        case 2:
        case 3:
        case 4:
        case 5:

knopp's avatar
 
knopp committed
415 416 417
          //	schedule_RA(module_idP,subframeP,nprb,nCCE);
          schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,2,nCCE);
          schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status);
gauthier's avatar
gauthier committed
418 419 420 421 422
          fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,0,mbsfn_status);
          break;
        default:
          break;
        }
423 424
    }
    else {  //FDD
knopp's avatar
 
knopp committed
425 426
        //      schedule_ulsch(module_idP,frameP,cooperation_flag,8,2,nCCE);
        schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status);
gauthier's avatar
gauthier committed
427
        fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,0,mbsfn_status);
428 429 430 431 432 433
    }
    break;

  case 9:
    // TDD Config 1,3,4,6 ULSCH for subframes 3,3,3,4
    if (mac_xface->lte_frame_parms->frame_type == TDD) {
gauthier's avatar
gauthier committed
434 435
        switch (mac_xface->lte_frame_parms->tdd_config) {
        case 1:
knopp's avatar
 
knopp committed
436 437 438
          schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,3,nCCE);
          schedule_RA(module_idP,frameP,subframeP,7,nprb,nCCE);  // 7 = Msg3 subframeP, not
          schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status);
gauthier's avatar
gauthier committed
439 440 441 442
          fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,1,mbsfn_status);
          break;
        case 3:
        case 4:
knopp's avatar
 
knopp committed
443 444
          schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,3,nCCE);
          schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status);
gauthier's avatar
gauthier committed
445 446 447
          fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,0,mbsfn_status);
          break;
        case 6:
knopp's avatar
 
knopp committed
448 449 450
          schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,4,nCCE);
          //schedule_RA(module_idP,frameP,subframeP,nprb,nCCE);
          schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status);
gauthier's avatar
gauthier committed
451 452 453 454
          fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,0,mbsfn_status);
          break;
        case 2:
        case 5:
knopp's avatar
 
knopp committed
455 456
          //schedule_RA(module_idP,frameP,subframeP,nprb,nCCE);
          schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status);
gauthier's avatar
gauthier committed
457 458 459 460 461
          fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,0,mbsfn_status);
          break;
        default:
          break;
        }
462 463
    }
    else {  //FDD
knopp's avatar
 
knopp committed
464 465
        //      schedule_ulsch(module_idP,frameP,cooperation_flag,9,3,nCCE);
        schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status);
gauthier's avatar
gauthier committed
466
        fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,0,mbsfn_status);
467 468
    }
    break;
gauthier's avatar
gauthier committed
469

470
  }
471

knopp's avatar
 
knopp committed
472 473 474
  for (CC_id=0;CC_id<MAX_NUM_CCs;CC_id++)
    DCI_pdu[CC_id]->nCCE = nCCE[CC_id];
  LOG_D(MAC,"frameP %d, subframeP %d nCCE %d\n",frameP,subframeP,nCCE[0]);
475 476

  vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ULSCH_SCHEDULER,0);
477
  stop_meas(&eNB_mac_inst[module_idP].eNB_scheduler);
478

479
}
480 481 482