eNB_scheduler_dlsch_NB_IoT.c 3.14 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
/*
 * 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
 */

/*! \file eNB_scheduler_dlsch.c
 * \brief procedures related to eNB for the DLSCH transport channel
 * \author  Navid Nikaein and Raymond Knopp
 * \date 2010 - 2014
 * \email: navid.nikaein@eurecom.fr
 * \version 1.0
 * @ingroup _mac

 */

32
//#include "assertions.h"
33
//#include "PHY/defs.h"
34
//#include "PHY/extern_NB_IoT.h"
35

36 37
//#include "SCHED/defs.h"
//#include "SCHED/extern.h"
38

39 40 41 42 43 44
//#include "SCHED/defs_NB_IoT.h"
//#include "SCHED/extern_NB_IoT.h"

//#include "LAYER2/MAC/defs.h"
//#include "LAYER2/MAC/proto.h"
//#include "LAYER2/MAC/extern.h"
45
#include "UTIL/LOG/log.h"
46 47 48 49
//#include "UTIL/LOG/vcd_signal_dumper.h"
//#include "UTIL/OPT/opt.h"
//#include "OCG.h"
//#include "OCG_extern.h"
50
//NB-IoT
51 52 53 54 55 56
//#include "PHY/defs_NB_IoT.h"
//#include "LAYER2/MAC/defs_NB_IoT.h"
#include "LAYER2/MAC/proto_NB_IoT.h"
#include "LAYER2/MAC/extern_NB_IoT.h"
//#include "RRC/LITE/extern_NB_IoT.h"
//#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
57 58

//#include "LAYER2/MAC/pre_processor.c"
59 60 61
//#include "pdcp.h"
//#include "COMMON/platform_types.h"
//#include "SIMULATION/TOOLS/defs.h" // for taus
62

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

#include "T.h"
69
*/
70 71 72 73
#define ENABLE_MAC_PAYLOAD_DEBUG
//#define DEBUG_eNB_SCHEDULER 1


74
uint8_t *get_dlsch_sdu_NB_IoT(
75 76 77 78 79 80 81 82 83 84
  module_id_t module_idP,
  int CC_id,
  frame_t frameP,
  rnti_t rntiP,
  uint8_t TBindex
)
//------------------------------------------------------------------------------
{

  int UE_id;
85
  eNB_MAC_INST_NB_IoT *eNB=&eNB_mac_inst_NB_IoT[module_idP];
86 87 88 89 90 91 92 93

  /*for SIBs*/
  if (rntiP==SI_RNTI) {
    LOG_D(MAC,"[eNB %d] CC_id %d Frame %d Get DLSCH sdu for BCCH \n", module_idP, CC_id, frameP);

    return((unsigned char *)&eNB->common_channels[CC_id].BCCH_pdu.payload[0]);
  }

94
  UE_id = find_UE_id_NB_IoT(module_idP,rntiP);
95 96 97 98 99 100 101 102 103 104 105 106

  if (UE_id != -1) {
    LOG_D(MAC,"[eNB %d] Frame %d:  CC_id %d Get DLSCH sdu for rnti %x => UE_id %d\n",module_idP,frameP,CC_id,rntiP,UE_id);
    return((unsigned char *)&eNB->UE_list.DLSCH_pdu[CC_id][TBindex][UE_id].payload[0]);
  } else {
    LOG_E(MAC,"[eNB %d] Frame %d: CC_id %d UE with RNTI %x does not exist\n", module_idP,frameP,CC_id,rntiP);
    return NULL;
  }

}