From 7e25d85f5cea59dd8f8d992a4d421e49e8a54b75 Mon Sep 17 00:00:00 2001
From: cig <guido.casati@iis.fraunhofer.de>
Date: Mon, 10 Feb 2020 17:30:14 +0100
Subject: [PATCH] Cleanup code, comments

---
 openair1/PHY/INIT/nr_parms.c                  |   2 +-
 openair1/SCHED_NR_UE/phy_procedures_nr_ue.c   |  46 ++++---
 openair2/LAYER2/NR_MAC_COMMON/nr_mac.h        |  10 --
 openair2/LAYER2/NR_MAC_COMMON/nr_mac_extern.h |   1 -
 openair2/LAYER2/NR_MAC_UE/mac_defs.h          |  10 +-
 openair2/LAYER2/NR_MAC_UE/nr_l1_helpers.c     |   8 +-
 openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c  |   2 +-
 .../NR_MAC_UE/nr_ue_dci_configuration.c       |   2 +-
 openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c  |   3 -
 openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c    |   4 +-
 openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c |   6 +-
 .../NR_MAC_gNB/gNB_scheduler_primitives.c     | 121 +-----------------
 openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h       |   5 -
 openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c   |  10 +-
 openair2/RRC/NR/rrc_gNB.c                     |   2 +-
 15 files changed, 45 insertions(+), 187 deletions(-)

diff --git a/openair1/PHY/INIT/nr_parms.c b/openair1/PHY/INIT/nr_parms.c
index edeb630dee..70fa9e824f 100644
--- a/openair1/PHY/INIT/nr_parms.c
+++ b/openair1/PHY/INIT/nr_parms.c
@@ -344,7 +344,7 @@ int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *fp,
 
   fp->ssb_start_subcarrier = (12 * config->ssb_table.ssb_offset_point_a + sco);
 
-  // TBR temporary hardcoded
+  // WIP temporary hardcoded
   fp->prach_config_common.rootSequenceIndex = 22; // 0
   fp->prach_config_common.prach_Config_enabled = 1;
   fp->prach_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig = 1; // 13
diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c
index 54b9096874..6191676d88 100644
--- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c
+++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c
@@ -1313,6 +1313,8 @@ void nr_process_timing_advance(module_id_t Mod_id, uint8_t CC_id, uint8_t ta_com
   LOG_D(PHY, "[UE %d] Got timing advance command %u from MAC, new value is %u\n", Mod_id, ta_command, PHY_vars_UE_g[Mod_id][CC_id]->timing_advance);
 }
 
+// WIP
+// - todo: handle TA application as per ch 4.2 TS 38.213
 void nr_process_timing_advance_rar(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint16_t ta_command) {
 
   int factor_mu = 1 << ue->frame_parms.numerology_index;
@@ -1322,8 +1324,6 @@ void nr_process_timing_advance_rar(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc,
   // Transmission timing adjustment (TS 38.213 p4.2)
   ue->timing_advance = bw_scaling / factor_mu;
 
-  // TBR todo handle TA application as per ch 4.2 TS 38.213
-
   LOG_D(PHY, "[UE %d] Frame %d Slot %d, Received (RAR) timing advance command %d new value is %u \n", ue->Mod_id, proc->frame_rx, proc->nr_tti_rx, ta_command, ue->timing_advance);
 }
 
@@ -3115,7 +3115,7 @@ void nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int eNB
   }
 }
 
-// WIP TBR fix:
+// WIP fix:
 // - time domain indication hardcoded to 0 for k2 offset
 // - extend TS 38.213 ch 8.3 Msg3 PUSCH
 // - b buffer
@@ -4481,30 +4481,32 @@ uint8_t nr_is_ri_TXOp(PHY_VARS_NR_UE *ue,
     return(0);
 }
 
+// WIP
+// todo:
+// - set tx_total_RE
+// - power control as per 38.213 ch 7.4
 void nr_ue_prach_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t gNB_id, runmode_t runmode) {
-  /* TBR
-  // here params are hardcoded */
+
   int frame_tx = proc->frame_tx, nr_tti_tx = proc->nr_tti_tx, prach_power;
   uint16_t preamble_tx = 50, pathloss;
-  NR_PRACH_RESOURCES_t prach_resources;
   uint8_t mod_id = ue->Mod_id;
   UE_MODE_t UE_mode = get_nrUE_mode(mod_id, ue->CC_id, gNB_id);
+  NR_PRACH_RESOURCES_t * prach_resources = ue->prach_resources[gNB_id];
 
   VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_PRACH, VCD_FUNCTION_IN);
 
   ue->generate_nr_prach = 0;
   if (ue->mac_enabled == 0){
-    ue->prach_resources[gNB_id] = &prach_resources;  // TBR double check pointer
-    ue->prach_resources[gNB_id]->ra_PreambleIndex = preamble_tx;
-    ue->prach_resources[gNB_id]->ra_TDD_map_index = 0;
-    ue->prach_resources[gNB_id]->ra_PREAMBLE_RECEIVED_TARGET_POWER = 10; // TBR
-    ue->prach_resources[gNB_id]->ra_RNTI = 93; // TBR NR_UE_MAC_INST_t
+    prach_resources->ra_PreambleIndex = preamble_tx;
+    prach_resources->ra_TDD_map_index = 0;
+    prach_resources->ra_PREAMBLE_RECEIVED_TARGET_POWER = 10;
+    prach_resources->ra_RNTI = 0x1234;
   } else {
     // ask L2 for RACH transport
     if ((runmode != rx_calib_ue) && (runmode != rx_calib_ue_med) && (runmode != rx_calib_ue_byp) && (runmode != no_L2_connect) ) {
       LOG_D(PHY, "Getting PRACH resources. Frame %d Slot %d \n", frame_tx, nr_tti_tx);
       // flush Msg3 Buffer
-      if (ue->prach_resources[gNB_id]->Msg3 == NULL){
+      if (prach_resources->Msg3 == NULL){
         for(int i = 0; i<NUMBER_OF_CONNECTED_gNB_MAX; i++) {
           ue->ulsch_Msg3_active[i] = 0;
         }
@@ -4518,26 +4520,23 @@ void nr_ue_prach_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t
     ue->generate_nr_prach = 1;
     ue->prach_cnt = 0;
     pathloss = get_nr_PL(mod_id, ue->CC_id, gNB_id);
-    LOG_I(PHY,"runmode %d\n",runmode);
+    LOG_D(PHY,"runmode %d\n",runmode);
 
     if ((ue->mac_enabled == 1) && (runmode != calib_prach_tx)) {
-      // todo power control as per 38.213 ch 7.4
-      ue->tx_power_dBm[nr_tti_tx] = ue->prach_resources[gNB_id]->ra_PREAMBLE_RECEIVED_TARGET_POWER + pathloss;
-      ue->tx_power_dBm[nr_tti_tx] = ue->tx_power_max_dBm;
-      ue->prach_resources[gNB_id]->ra_PreambleIndex = preamble_tx;
+      ue->tx_power_dBm[nr_tti_tx] = prach_resources->ra_PREAMBLE_RECEIVED_TARGET_POWER + pathloss;
     }
 
-    LOG_D(PHY,"[UE %d][RAPROC] Frame %d, nr_tti_rx %d : Generating PRACH, preamble %d, PL %d, P0_PRACH %d, TARGET_RECEIVED_POWER %d dBm, RA-RNTI %d\n",
+    LOG_I(PHY,"[UE %d][RAPROC] Frame %d, nr_tti_rx %d : Generating PRACH, preamble %d, PL %d, P0_PRACH %d, TARGET_RECEIVED_POWER %d dBm, RA-RNTI %d\n",
       ue->Mod_id,
       frame_tx,
       nr_tti_tx,
-      ue->prach_resources[gNB_id]->ra_PreambleIndex,
+      prach_resources->ra_PreambleIndex,
       pathloss,
       ue->tx_power_dBm[nr_tti_tx],
-      ue->prach_resources[gNB_id]->ra_PREAMBLE_RECEIVED_TARGET_POWER,
-      ue->prach_resources[gNB_id]->ra_RNTI);
+      prach_resources->ra_PREAMBLE_RECEIVED_TARGET_POWER,
+      prach_resources->ra_RNTI);
 
-    ue->tx_total_RE[nr_tti_tx] = 96; /* todo TBR double check */
+    //ue->tx_total_RE[nr_tti_tx] = 96; // todo
 
     #if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR) || defined(OAI_ADRV9371_ZC706)
       ue->prach_vars[gNB_id]->amp = get_tx_amp_prach(ue->tx_power_dBm[nr_tti_tx],
@@ -4554,7 +4553,6 @@ void nr_ue_prach_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t
         ue->tx_power_dBm[nr_tti_tx],
         ue->prach_vars[gNB_id]->amp);
 
-    // start_meas(&ue->tx_prach);
     VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GENERATE_PRACH, VCD_FUNCTION_IN);
 
     prach_power = generate_nr_prach(ue, gNB_id, nr_tti_tx);
@@ -4576,7 +4574,7 @@ void nr_ue_prach_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t
       frame_tx,
       nr_tti_tx,
       gNB_id,
-      ue->prach_resources[gNB_id]->ra_PreambleIndex,
+      prach_resources->ra_PreambleIndex,
       ue->tx_power_dBm[nr_tti_tx],
       pathloss);
   }
diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac.h b/openair2/LAYER2/NR_MAC_COMMON/nr_mac.h
index 82418f360e..4c3db7cfe9 100644
--- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac.h
+++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac.h
@@ -137,16 +137,6 @@ typedef struct {
   uint8_t R2:6;
 } __attribute__ ((__packed__)) NR_SINGLE_ENTRY_PHR_MAC_CE;
 
-// /*! \brief CCCH payload */ // TBR
-// typedef struct {
-//     uint8_t payload[CCCH_PAYLOAD_SIZE_MAX];
-// } __attribute__ ((__packed__)) CCCH_PDU;
-// 
-// /*! \brief RAR payload */ // TBR
-// typedef struct {
-//     uint8_t payload[RAR_PAYLOAD_SIZE_MAX];
-// } __attribute__ ((__packed__)) RAR_PDU;
-
 //* RAR MAC subheader // TS 38.321 ch. 6.1.5, 6.2.2 *//
 // - E: The Extension field is a flag indicating if the MAC subPDU including this MAC subheader is the last MAC subPDU or not in the MAC PDU
 // - T: The Type field is a flag indicating whether the MAC subheader contains a Random Access Preamble ID or a Backoff Indicator (0, BI) (1, RAPID)
diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_extern.h b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_extern.h
index 4bc462f759..7892dff6f0 100644
--- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_extern.h
+++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_extern.h
@@ -32,7 +32,6 @@
 #ifndef __NR_MAC_EXTERN_H__
 #define __NR_MAC_EXTERN_H__
 
-#include "RRC/LTE/rrc_defs.h" // TBR
 #include "common/ran_context.h"
 #include "nr_mac.h"
 
diff --git a/openair2/LAYER2/NR_MAC_UE/mac_defs.h b/openair2/LAYER2/NR_MAC_UE/mac_defs.h
index ac87110527..9b53e0de3f 100755
--- a/openair2/LAYER2/NR_MAC_UE/mac_defs.h
+++ b/openair2/LAYER2/NR_MAC_UE/mac_defs.h
@@ -48,7 +48,7 @@
 /* MAC */
 #include "LAYER2/NR_MAC_COMMON/nr_mac.h"
 #include "LAYER2/NR_MAC_COMMON/nr_mac_common.h"
-#include "LAYER2/MAC/mac.h" // TBR
+#include "LAYER2/MAC/mac.h"
 
 /* RRC */
 #include "NR_DRX-Config.h"
@@ -116,15 +116,15 @@ typedef struct {
 
   /* Random Access parameters */
   /// state of RA procedure
-  RA_state_t ra_state; // TBR
+  RA_state_t ra_state;
   /// RACH ConfigCommon
   NR_RACH_ConfigCommon_t *nr_rach_ConfigCommon;
   /// RA-rnti
-  uint16_t ra_rnti; // TBR
+  uint16_t ra_rnti;
   /// Temporary CRNTI
-  uint16_t t_crnti; // TBR
+  uint16_t t_crnti;
   /// CRNTI
-  uint16_t crnti; // TBR
+  uint16_t crnti;
   /// number of attempt for rach
   uint8_t RA_attempt_number;
   /// Random-access procedure flag
diff --git a/openair2/LAYER2/NR_MAC_UE/nr_l1_helpers.c b/openair2/LAYER2/NR_MAC_UE/nr_l1_helpers.c
index b11fc2cca2..20113f494c 100644
--- a/openair2/LAYER2/NR_MAC_UE/nr_l1_helpers.c
+++ b/openair2/LAYER2/NR_MAC_UE/nr_l1_helpers.c
@@ -29,12 +29,14 @@
 
 */
 
-#include "PHY/defs_common.h" // TBR
 #include "PHY/defs_nr_common.h"
 
 #include "mac_defs.h"
 #include "LAYER2/NR_MAC_COMMON/nr_mac_extern.h"
 
+// WIP todo:
+//- frame_type and fr are hardcoded. Retireve from fp
+
 /* TS 38.321 subclause 7.3 - return DELTA_PREAMBLE values in dB */
 int8_t nr_get_DELTA_PREAMBLE(module_id_t mod_id, int CC_id){
 
@@ -44,8 +46,8 @@ int8_t nr_get_DELTA_PREAMBLE(module_id_t mod_id, int CC_id){
     AssertFatal(CC_id == 0, "Transmission on secondary CCs is not supported yet\n");
 
     uint8_t preambleFormat, prachConfigIndex;
-    lte_frame_type_t frame_type = TDD; // TODO TBR retrieve frame type. Currently hardcoded to TDD.
-    nr_frequency_range_e fr = nr_FR1;  // TODO TBR retrieve frame type. Currently hardcoded to FR1.
+    lte_frame_type_t frame_type = TDD;
+    nr_frequency_range_e fr = nr_FR1;
     int mu; 
 
     // SCS configuration from msg1_SubcarrierSpacing and table 4.2-1 in TS 38.211
diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c
index 812ef8fd26..142ef097d0 100644
--- a/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c
+++ b/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c
@@ -295,7 +295,7 @@ void nr_get_prach_resources(module_id_t mod_id,
    LOG_D(MAC, "Computed ra_RNTI is %d", prach_resources->ra_RNTI);
 }
 
-// todo: RA_attempt_number not used TBR
+// TbD: RA_attempt_number not used
 void nr_Msg1_transmitted(module_id_t mod_id, uint8_t CC_id, frame_t frameP, uint8_t gNB_id){
   AssertFatal(CC_id == 0, "Transmission on secondary CCs is not supported yet\n");
   NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id);
diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c
index d595116979..421c8eb75b 100644
--- a/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c
+++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c
@@ -114,7 +114,7 @@ void ue_dci_configuration(NR_UE_MAC_INST_t *mac,fapi_nr_dl_config_request_t *dl_
     if (mac->ra_state == WAIT_RAR) {
       // check for RAR
       rel15 = &dl_config->dl_config_list[dl_config->number_pdus].dci_config_pdu.dci_config_rel15; 
-      rel15->rnti = 2;//get_RA_RNTI(mac,frame,slot); // TBR
+      rel15->rnti = 2;//get_RA_RNTI(mac,frame,slot); // WIP
       dl_config->number_pdus = dl_config->number_pdus + 1;
     }
     else if (mac->ra_state == WAIT_CONTENTION_RESOLUTION) {
diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c
index 4c05ea3c70..8219a96ea2 100644
--- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c
+++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c
@@ -44,9 +44,6 @@
 #include "NR_MAC_UE/mac_extern.h"
 #include "common/utils/nr/nr_common.h"
 
-//#include "LAYER2/MAC/mac_vars.h" // TBR Note that mac_vars.h is not NR specific and this should be updated
-                                 // also, the use of the same should be updated in nr-softmodem and nr-uesoftmodem
-
 /* PHY UE */
 #include "SCHED_NR_UE/defs.h"
 #include "PHY/defs_nr_UE.h"
diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c
index 3258628b7f..a1119e6c10 100644
--- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c
+++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c
@@ -365,10 +365,10 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
     schedule_nr_mib(module_idP, frame_txP, slot_txP);
   }
 
-  // TBR once RACH is available, start ta_timer when UE is connected
+  // TbD once RACH is available, start ta_timer when UE is connected
   if (ue_sched_ctl->ta_timer) ue_sched_ctl->ta_timer--;
 
-  if (ue_sched_ctl->ta_timer == 0) { // TBR check phy_test (see below)
+  if (ue_sched_ctl->ta_timer == 0) {
     gNB->ta_command = ue_sched_ctl->ta_update;
     /* if time is up, then set the timer to not send it for 5 frames
     // regardless of the TA value */
diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c
index 208d45762f..dd268d5dd6 100644
--- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c
+++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c
@@ -164,7 +164,9 @@ void nr_schedule_RA(module_id_t module_idP, frame_t frameP, sub_frame_t slotP){
 }
 
 // WIP
-// todo: fix
+// todo:
+// - fix me
+// - get msg3 alloc (see nr_process_rar)
 void nr_generate_Msg2(module_id_t module_idP,
                       int CC_id,
                       frame_t frameP,
@@ -333,7 +335,7 @@ void nr_generate_Msg2(module_id_t module_idP,
     dl_req->nPDUs++;
 
     // Program UL processing for Msg3
-    // nr_get_Msg3alloc(&cc[CC_id], slotP, frameP,&ra->Msg3_frame, &ra->Msg3_slot);
+    // nr_get_Msg3alloc(&cc[CC_id], slotP, frameP,&ra->Msg3_frame, &ra->Msg3_slot); // todo
     LOG_D(MAC, "Frame %d, Subframe %d: Setting Msg3 reception for Frame %d Subframe %d\n", frameP, slotP, ra->Msg3_frame, ra->Msg3_slot);
     nr_fill_rar(ra, cc[CC_id].RAR_pdu.payload, N_RB_UL);
     nr_add_msg3(module_idP, CC_id, frameP, slotP);
diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c
index 55ef77dc29..36430bd30e 100644
--- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c
+++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c
@@ -1363,123 +1363,4 @@ int add_new_nr_ue(module_id_t mod_idP, rnti_t rntiP){
     }
   }
 }
-*/
-
-
-/* // TBR fix this
-void nr_get_Msg3alloc(NR_COMMON_channels_t *cc,
-                      sub_frame_t current_subframe, // TBR sub_frame_t
-                      frame_t current_frame, 
-                      frame_t *frame,
-                      sub_frame_t *subframe){
-  // Fill in other TDD Configuration!!!!
-
-  // TBR missing 鈥榯dd_Config鈥� in NR_COMMON_channels_t
-  if (cc->tdd_Config == NULL) { // FDD
-    *subframe = current_subframe + 6;
-    if (*subframe > 9) {
-      *subframe = *subframe - 10;
-      *frame = (current_frame + 1) & 1023;
-    } else {
-      *frame = current_frame;
-    }
-  } else { // TDD
-    if (cc->tdd_Config->subframeAssignment == 1) {
-    switch (current_subframe) {  
-    
-      case 0:
-      *subframe = 7;
-      *frame = current_frame;
-      break;
-
-      case 4:
-      *subframe = 2;
-      *frame = (current_frame + 1) & 1023;
-      break;
-
-      case 5:
-      *subframe = 2;
-      *frame = (current_frame + 1) & 1023;
-      break;
-
-      case 9:
-      *subframe = 7;
-      *frame = (current_frame + 1) & 1023;
-      break;
-      }
-  } else if (cc->tdd_Config->subframeAssignment == 3) {
-    switch (current_subframe) {
-
-      case 0:
-      case 5:
-      case 6:
-        *subframe = 2;
-        *frame = (current_frame + 1) & 1023;
-        break;
-
-      case 7:
-        *subframe = 3;
-        *frame = (current_frame + 1) & 1023;
-        break;
-
-      case 8:
-        *subframe = 4;
-        *frame = (current_frame + 1) & 1023;
-        break;
-
-      case 9:
-        *subframe = 2;
-        *frame = (current_frame + 2) & 1023;
-        break;
-      }
-  } else if (cc->tdd_Config->subframeAssignment == 4) {
-    switch (current_subframe) {
-
-      case 0:
-      case 4:
-      case 5:
-      case 6:
-        *subframe = 2;
-        *frame = (current_frame + 1) & 1023;
-        break;
-
-      case 7:
-        *subframe = 3;
-        *frame = (current_frame + 1) & 1023;
-        break;
-
-      case 8:
-      case 9:
-        *subframe = 2;
-        *frame = (current_frame + 2) & 1023;
-        break;
-      }
-  } else if (cc->tdd_Config->subframeAssignment == 5) {
-    switch (current_subframe){
-      case 0:
-      case 4:
-      case 5:
-      case 6:
-        *subframe = 2;
-        *frame = (current_frame + 1) & 1023;
-        break;
-    
-      case 7:
-      case 8:
-      case 9:
-        *subframe = 2;
-        *frame = (current_frame + 2) & 1023;
-        break;
-      }
-    } 
-  } // else TDD
-}*/
-
-// uint16_t nr_mac_compute_RIV(uint16_t N_RB_DL, uint16_t RBstart, uint16_t Lcrbs){ // TBR
-//   uint16_t RIV;
-//
-//   if (Lcrbs <= (1 + (N_RB_DL >> 1))) RIV = (N_RB_DL * (Lcrbs - 1)) + RBstart;
-//   else RIV = (N_RB_DL * (N_RB_DL + 1 - Lcrbs)) + (N_RB_DL - 1 - RBstart);
-//
-//   return RIV;
-// }
\ No newline at end of file
+*/
\ No newline at end of file
diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h
index 03aa639bae..524b4d67c5 100644
--- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h
+++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h
@@ -133,11 +133,6 @@ typedef struct {
     int msg4_TBsize;
     /// MCS used for Msg4
     int msg4_mcs;
-    ///
-    int32_t  crnti_rrc_mui; // TBR
-    ///
-    int8_t   crnti_harq_pid; // TBR
-
 } NR_RA_t;
 
 /*! \brief gNB common channels */
diff --git a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c
index d1ca2b02bd..f9967dba2e 100644
--- a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c
+++ b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c
@@ -93,10 +93,7 @@ int8_t handle_dlsch (module_id_t module_id, int cc_id, uint8_t gNB_index, fapi_n
   */
 }
 
-int8_t handle_rar (nr_downlink_indication_t *dl_info,
-                   uint8_t *pduP,
-                   uint32_t pdu_len,
-                   NR_UL_TIME_ALIGNMENT_t *ul_time_alignment){ // TBR not used params
+int8_t handle_rar (nr_downlink_indication_t *dl_info){
 
   LOG_D(MAC, "handling RAR at MAC layer \n");
   nr_process_rar (dl_info);
@@ -263,10 +260,7 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_
       break;
 
       case FAPI_NR_RX_PDU_TYPE_RAR:
-        ret_mask |= (handle_rar(dl_info,
-                    (dl_info->rx_ind->rx_indication_body+i)->pdsch_pdu.pdu,
-                    (dl_info->rx_ind->rx_indication_body+i)->pdsch_pdu.pdu_length,
-                    ul_time_alignment)) << FAPI_NR_RX_PDU_TYPE_RAR;
+        ret_mask |= (handle_rar(dl_info)) << FAPI_NR_RX_PDU_TYPE_RAR;
       break;
 
       default:
diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c
index 189bf73aba..b0989d843b 100644
--- a/openair2/RRC/NR/rrc_gNB.c
+++ b/openair2/RRC/NR/rrc_gNB.c
@@ -199,7 +199,7 @@ static void init_NR_SI(gNB_RRC_INST *rrc) {
                          rrc->carrier.pdsch_AntennaPorts,
                          (NR_ServingCellConfigCommon_t *)rrc->carrier.servingcellconfigcommon,
 			 0,
-			 0, // TBR hardcoded rnti
+			 0, // WIP hardcoded rnti
 			 (NR_CellGroupConfig_t *)NULL
                          );
 
-- 
2.26.2