From c691f9b601f63b6d1b2a578cd94dc3365929d053 Mon Sep 17 00:00:00 2001
From: Florian Kaltenberger <florian.kaltenberger@eurecom.fr>
Date: Mon, 17 Feb 2020 11:35:41 +0100
Subject: [PATCH] a few fixes for FR2. fixing beam to boresight for testing

---
 executables/nr-ru.c                                         | 6 ++++--
 openair2/ENB_APP/enb_paramdef.h                             | 2 +-
 openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c               | 4 ++--
 .../CONF/gnb.band78.tm1.106PRB.usrpn300.conf                | 2 +-
 4 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/executables/nr-ru.c b/executables/nr-ru.c
index 2297ccdca7e..fdf07d4f79a 100644
--- a/executables/nr-ru.c
+++ b/executables/nr-ru.c
@@ -764,11 +764,13 @@ void tx_rf(RU_t *ru,int frame,int slot, uint64_t timestamp) {
       // the beam index is written in bits 8-10 of the flags
       // bit 11 enables the gpio programming
       int beam=0;
+      if (slot==0) beam = 11; //3 for boresight & 8 to enable
+      /*
       if (slot==0 || slot==40) beam=0&8;
       if (slot==10 || slot==50) beam=1&8;
       if (slot==20 || slot==60) beam=2&8;
       if (slot==30 || slot==70) beam=3&8;
-
+      */
       flags |= beam<<8;
     }
     
@@ -2371,7 +2373,7 @@ void RCconfig_RU(void)
       RC.ru[j]->nb_rx                             = *(RUParamList.paramarray[j][RU_NB_RX_IDX].uptr);
       RC.ru[j]->att_tx                            = *(RUParamList.paramarray[j][RU_ATT_TX_IDX].uptr);
       RC.ru[j]->att_rx                            = *(RUParamList.paramarray[j][RU_ATT_RX_IDX].uptr);
-      RC.ru[j]->if_frequency                      = *(RUParamList.paramarray[j][RU_IF_FREQUENCY].uptr);
+      RC.ru[j]->if_frequency                      = *(RUParamList.paramarray[j][RU_IF_FREQUENCY].u64ptr);
 
       if (config_isparamset(RUParamList.paramarray[j], RU_BF_WEIGHTS_LIST_IDX)) {
         RC.ru[j]->nb_bfw = RUParamList.paramarray[j][RU_BF_WEIGHTS_LIST_IDX].numelt;
diff --git a/openair2/ENB_APP/enb_paramdef.h b/openair2/ENB_APP/enb_paramdef.h
index c20072c8bf6..f91c7056c59 100644
--- a/openair2/ENB_APP/enb_paramdef.h
+++ b/openair2/ENB_APP/enb_paramdef.h
@@ -153,7 +153,7 @@ typedef enum {
     {CONFIG_STRING_RU_END_OF_BURST_DELAY,          NULL,       0,       uptr:NULL,       defuintval:400,          TYPE_UINT,        0}, \
     {CONFIG_STRING_RU_OTA_SYNC_ENABLE,             NULL,       0,       strptr:NULL,     defstrval:"no",          TYPE_STRING,      0}, \
     {CONFIG_STRING_RU_BF_WEIGHTS_LIST,             NULL,       0,       iptr:NULL,       defintarrayval:DEFBFW,   TYPE_INTARRAY,    0}, \
-    {CONFIG_STRING_RU_IF_FREQUENCY,                NULL,       0,       uptr:NULL,       defuintval:0,            TYPE_UINT64,      0}, \
+    {CONFIG_STRING_RU_IF_FREQUENCY,                NULL,       0,       u64ptr:NULL,     defuintval:0,            TYPE_UINT64,      0}, \
   }
 
 /*---------------------------------------------------------------------------------------------------------------------------------------*/
diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c
index 55cb22f4ec8..8ec8484a4db 100644
--- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c
+++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c
@@ -248,7 +248,7 @@ uint32_t to_nrarfcn(int nr_bandP,
   uint32_t nrarfcn, delta_arfcn;
 
   LOG_I(MAC,"Searching for nr band %d DL Carrier frequency %llu bw %u\n",nr_bandP,(long long unsigned int)dl_CarrierFreq,bw);
-  AssertFatal(nr_bandP < 261, "nr_band %d > 260\n", nr_bandP);
+  AssertFatal(nr_bandP <= 261, "nr_band %d > 260\n", nr_bandP);
   for (i = 0; i < NR_BANDTABLE_SIZE && nr_bandtable[i].band != nr_bandP; i++);
 
   // selection of correct Deltaf raster according to SCS
@@ -296,7 +296,7 @@ uint64_t from_nrarfcn(int nr_bandP,
   if (dl_nrarfcn > 2016666 && dl_nrarfcn < 3279166)
     deltaFglobal = 60; 
   
-  AssertFatal(nr_bandP < 261, "nr_band %d > 260\n", nr_bandP);
+  AssertFatal(nr_bandP <= 261, "nr_band %d > 260\n", nr_bandP);
   for (i = 0; i < NR_BANDTABLE_SIZE && nr_bandtable[i].band != nr_bandP; i++);
   AssertFatal(dl_nrarfcn>=nr_bandtable[i].N_OFFs_DL,"dl_nrarfcn %u < N_OFFs_DL %llu\n",dl_nrarfcn, (long long unsigned int)nr_bandtable[i].N_OFFs_DL);
  
diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf
index 4564907fa87..686c942db56 100644
--- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf
+++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf
@@ -238,7 +238,7 @@ RUs = (
          max_rxgain                    = 114;
          eNB_instances  = [0];
 	 sdr_addrs = "addr=192.168.10.2,mgmt_addr=192.168.10.2";
-         clock_src = "external";
+         #clock_src = "external";
     }
 );  
 
-- 
GitLab