From 023b6ebc293aae9228100ad8684fa68ebfa15dfb Mon Sep 17 00:00:00 2001
From: haswell <haswell@haswell.openair4G.eur>
Date: Sat, 19 Jan 2019 16:02:59 +0100
Subject: [PATCH] testing LTE-M configuration

---
 openair1/SCHED/fapi_l1.c                | 30 ++++++++++++-------------
 openair2/LAYER2/MAC/eNB_scheduler.c     |  1 +
 openair2/LAYER2/MAC/eNB_scheduler_bch.c |  6 ++---
 3 files changed, 19 insertions(+), 18 deletions(-)

diff --git a/openair1/SCHED/fapi_l1.c b/openair1/SCHED/fapi_l1.c
index f47e9621b93..e04f8fa4803 100644
--- a/openair1/SCHED/fapi_l1.c
+++ b/openair1/SCHED/fapi_l1.c
@@ -180,24 +180,24 @@ void handle_nfapi_dlsch_pdu(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_pro
   dlsch1 = eNB->dlsch[UE_id][1];
 
 #if (LTE_RRC_VERSION >= MAKE_VERSION(13, 0, 0))
-  if ((rel13->pdsch_payload_type < 2) && (rel13->ue_type>0)) dlsch0->harq_ids[frame%2][subframe] = 0;
+  if ((rel13->pdsch_payload_type < 2) && (rel13->ue_type>0)) dlsch0->harq_ids[proc->frame_tx%2][proc->subframe_tx] = 0;
 #endif
 
-  harq_pid        = dlsch0->harq_ids[frame%2][subframe];
+  harq_pid        = dlsch0->harq_ids[proc->frame_tx%2][proc->subframe_tx];
   AssertFatal((harq_pid>=0) && (harq_pid<8),"harq_pid %d not in 0...7 frame:%d subframe:%d subframe(TX):%d rnti:%x UE_id:%d dlsch0[harq_ids:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d]\n",
       harq_pid,
       frame,subframe,
       proc->subframe_tx,rel8->rnti,UE_id,
-      dlsch0->harq_ids[frame%2][0],
-      dlsch0->harq_ids[frame%2][1],
-      dlsch0->harq_ids[frame%2][2],
-      dlsch0->harq_ids[frame%2][3],
-      dlsch0->harq_ids[frame%2][4],
-      dlsch0->harq_ids[frame%2][5],
-      dlsch0->harq_ids[frame%2][6],
-      dlsch0->harq_ids[frame%2][7],
-      dlsch0->harq_ids[frame%2][8],
-      dlsch0->harq_ids[frame%2][9]
+      dlsch0->harq_ids[proc->frame_tx%2][0],
+      dlsch0->harq_ids[proc->frame_tx%2][1],
+      dlsch0->harq_ids[proc->frame_tx%2][2],
+      dlsch0->harq_ids[proc->frame_tx%2][3],
+      dlsch0->harq_ids[proc->frame_tx%2][4],
+      dlsch0->harq_ids[proc->frame_tx%2][5],
+      dlsch0->harq_ids[proc->frame_tx%2][6],
+      dlsch0->harq_ids[proc->frame_tx%2][7],
+      dlsch0->harq_ids[proc->frame_tx%2][8],
+      dlsch0->harq_ids[proc->frame_tx%2][9]
       );
   dlsch0_harq     = dlsch0->harq_processes[harq_pid];
   dlsch1_harq     = dlsch1->harq_processes[harq_pid];
@@ -223,7 +223,7 @@ void handle_nfapi_dlsch_pdu(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_pro
     computeRhoB_eNB(rel8->pa,eNB->frame_parms.pdsch_config_common.p_b,eNB->frame_parms.nb_antenna_ports_eNB,dlsch1,dlsch1_harq->dl_power_off);
   }
 
-  dlsch0_harq->pdsch_start = eNB->pdcch_vars[subframe & 1].num_pdcch_symbols;
+  dlsch0_harq->pdsch_start = eNB->pdcch_vars[proc->subframe_tx & 1].num_pdcch_symbols;
 
   if (dlsch0_harq->round==0) {  //get pointer to SDU if this a new SDU
     if(sdu == NULL) {
@@ -265,7 +265,7 @@ void handle_nfapi_dlsch_pdu(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_pro
     dlsch0_harq     = dlsch0->harq_processes[0];
     dlsch0_harq->pdu                    = sdu;
 
-    if (proc->frame_tx < 200) LOG_D(PHY,"NFAPI: frame %d, subframe %d: Programming SI-BR (%d) => %d\n",proc->frame_tx,proc->subframe_tx,rel13->pdsch_payload_type,UE_id);
+    if (proc->frame_tx < 200) LOG_I(PHY,"NFAPI: frame %d, subframe %d (TX %d.%d): Programming SI-BR (%d) => %d\n",frame,subframe,proc->frame_tx,proc->subframe_tx,rel13->pdsch_payload_type,UE_id);
  
     dlsch0->rnti             = 0xFFFF;
     dlsch0->Kmimo            = 1;
@@ -274,7 +274,7 @@ void handle_nfapi_dlsch_pdu(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_pro
 
     dlsch0->i0               = rel13->initial_transmission_sf_io;
     dlsch0_harq->pdsch_start = rel10->pdsch_start;
-    dlsch0->harq_ids[frame%2][proc->subframe_tx] = 0;
+    dlsch0->harq_ids[proc->frame_tx%2][proc->subframe_rx] = 0;
     dlsch0_harq->frame       = proc->frame_tx;
     dlsch0_harq->subframe    = proc->subframe_tx;
 
diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c
index bd8e835174d..4ebe7313e87 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler.c
@@ -443,6 +443,7 @@ clear_nfapi_information(eNB_MAC_INST * eNB, int CC_idP,
     DL_req[CC_idP].dl_config_request_body.number_pdu                          = 0;
     DL_req[CC_idP].dl_config_request_body.number_pdsch_rnti                   = 0;
     DL_req[CC_idP].dl_config_request_body.transmission_power_pcfich           = 6000;
+    DL_req[CC_idP].sfn_sf                                                     = subframeP + (frameP<<4);
 
     HI_DCI0_req->hi_dci0_request_body.sfnsf                                   = subframeP + (frameP<<4);
     HI_DCI0_req->hi_dci0_request_body.number_of_dci                           = 0;
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_bch.c b/openair2/LAYER2/MAC/eNB_scheduler_bch.c
index 96ca1c29271..c5bea89c117 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_bch.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_bch.c
@@ -211,7 +211,7 @@ schedule_SIB1_BR(module_id_t module_idP,
 		    bcch_sdu_length, TBS);
 
 	if ((frameP & 1023) < 200)
-	    LOG_D(MAC,
+	    LOG_I(MAC,
 		  "[eNB %d] Frame %d Subframe %d: SIB1_BR->DLSCH CC_id %d, Received %d bytes, scheduling on NB %d (i %d,m %d,N_S_NB %d)  rvidx %d\n",
 		  module_idP, frameP, subframeP, CC_id, bcch_sdu_length,
 		  n_NB, i, m, N_S_NB, rvidx);
@@ -408,8 +408,8 @@ schedule_SI_BR(module_id_t module_idP, frame_t frameP,
 	    vrb_map[first_rb+4] = 1;
 	    vrb_map[first_rb+5] = 1;
 
-	    //if ((frameP&1023) < 200) 
-	      LOG_D(MAC,"[eNB %d] Frame %d Subframe %d: SI_BR->DLSCH CC_id %d, Narrowband %d rvidx %d (sf_mod_period %d : si_WindowLength_BR_r13 %d : si_RepetitionPattern_r13 %d) bcch_sdu_length %d\n",
+	    if ((frameP&1023) < 200) 
+	      LOG_I(MAC,"[eNB %d] Frame %d Subframe %d: SI_BR->DLSCH CC_id %d, Narrowband %d rvidx %d (sf_mod_period %d : si_WindowLength_BR_r13 %d : si_RepetitionPattern_r13 %d) bcch_sdu_length %d\n",
 					   module_idP,frameP,subframeP,CC_id,(int)si_Narrowband_r13-1,rvidx,
 					   sf_mod_period,(int)si_WindowLength_BR_r13,(int)si_RepetitionPattern_r13,
 					   bcch_sdu_length);	    
-- 
GitLab