gNB_scheduler_primitives.c 3.2 KB
Newer Older
WEI-TAI CHEN's avatar
WEI-TAI CHEN committed
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 32 33
/*
 * 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.1  (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_primitives.c
 * \brief primitives used by eNB for BCH, RACH, ULSCH, DLSCH scheduling
 * \author  Navid Nikaein and Raymond Knopp
 * \date 2010 - 2014
 * \email: navid.nikaein@eurecom.fr
 * \version 1.0
 * @ingroup _mac

 */

#include "assertions.h"

WEI-TAI CHEN's avatar
WEI-TAI CHEN committed
34
#include "LAYER2/MAC/mac.h"
WEI-TAI CHEN's avatar
WEI-TAI CHEN committed
35 36 37
#include "LAYER2/NR_MAC_gNB/mac.h"
#include "LAYER2/MAC/mac_extern.h"

WEI-TAI CHEN's avatar
WEI-TAI CHEN committed
38
#include "LAYER2/NR_MAC_gNB/mac_proto.h"
WEI-TAI CHEN's avatar
WEI-TAI CHEN committed
39 40 41 42 43
#include "UTIL/LOG/log.h"
#include "UTIL/LOG/vcd_signal_dumper.h"
#include "UTIL/OPT/opt.h"
#include "OCG.h"
#include "OCG_extern.h"
WEI-TAI CHEN's avatar
WEI-TAI CHEN committed
44 45

#include "RRC/LTE/rrc_extern.h"
WEI-TAI CHEN's avatar
WEI-TAI CHEN committed
46
#include "RRC/NR/nr_rrc_extern.h"
WEI-TAI CHEN's avatar
WEI-TAI CHEN committed
47
#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
WEI-TAI CHEN's avatar
WEI-TAI CHEN committed
48 49 50 51 52 53 54 55 56 57 58

//#include "LAYER2/MAC/pre_processor.c"
#include "pdcp.h"

#if defined(ENABLE_ITTI)
#include "intertask_interface.h"
#endif

#include "T.h"

#define ENABLE_MAC_PAYLOAD_DEBUG
WEI-TAI CHEN's avatar
WEI-TAI CHEN committed
59
#define DEBUG_gNB_SCHEDULER 1
WEI-TAI CHEN's avatar
WEI-TAI CHEN committed
60 61 62 63 64 65 66

#include "common/ran_context.h"

extern RAN_CONTEXT_t RC;

extern int n_active_slices;

WEI-TAI CHEN's avatar
WEI-TAI CHEN committed
67
int is_nr_UL_sf(NR_COMMON_channels_t * ccP, sub_frame_t subframeP){
WEI-TAI CHEN's avatar
WEI-TAI CHEN committed
68 69 70 71 72 73 74 75 76 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 114 115 116 117 118 119 120 121 122
  // if FDD return dummy value
  if (ccP->tdd_Config == NULL)
    return (0);

  switch (ccP->tdd_Config->subframeAssignment) {
  case 1:
    switch (subframeP) {
    case 0:
    case 4:
    case 5:
    case 9:
      return (0);
      break;
    case 2:
    case 3:
    case 7:
    case 8:
      return (1);
      break;
    default:
      return (0);
      break;
    }
    break;
  case 3:
    if ((subframeP <= 1) || (subframeP >= 5))
      return (0);
    else if ((subframeP > 1) && (subframeP < 5))
      return (1);
    else
      AssertFatal(1 == 0, "Unknown subframe number\n");
    break;
  case 4:
    if ((subframeP <= 1) || (subframeP >= 4))
      return (0);
    else if ((subframeP > 1) && (subframeP < 4))
      return (1);
    else
      AssertFatal(1 == 0, "Unknown subframe number\n");
    break;
  case 5:
    if ((subframeP <= 1) || (subframeP >= 3))
      return (0);
    else if ((subframeP > 1) && (subframeP < 3))
      return (1);
    else
      AssertFatal(1 == 0, "Unknown subframe number\n");
    break;
  default:
    AssertFatal(1 == 0,
    "subframe %d Unsupported TDD configuration %d\n",
    subframeP, (int) ccP->tdd_Config->subframeAssignment);
    break;
  }
}