From aad9dcc6ae43490909b491d556a50f637b6333a8 Mon Sep 17 00:00:00 2001
From: knopp <knopp@mycompany.com>
Date: Fri, 19 Jun 2015 15:14:36 +0000
Subject: [PATCH] adding max UE TX power as command line argument changing
 scheduling parameters

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@7606 818b1a75-f10b-46b9-bf7c-635c3b92a50f
---
 targets/RT/USER/lte-softmodem.c | 17 ++++++++++-------
 targets/RT/USER/lte-ue.c        | 18 +++++++++---------
 2 files changed, 19 insertions(+), 16 deletions(-)

diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c
index 2c7a480fe8..25e84ecfd9 100644
--- a/targets/RT/USER/lte-softmodem.c
+++ b/targets/RT/USER/lte-softmodem.c
@@ -2001,7 +2001,8 @@ static void get_options (int argc, char **argv)
     LONG_OPTION_CALIB_PRACH_TX,
     LONG_OPTION_RXGAIN,
     LONG_OPTION_TXGAIN,
-    LONG_OPTION_SCANCARRIER
+    LONG_OPTION_SCANCARRIER,
+    LONG_OPTION_MAXPOWER
   };
 
   static const struct option long_options[] = {
@@ -2015,11 +2016,17 @@ static void get_options (int argc, char **argv)
     {"ue-rxgain",   required_argument,  NULL, LONG_OPTION_RXGAIN},
     {"ue-txgain",   required_argument,  NULL, LONG_OPTION_TXGAIN},
     {"ue-scan-carrier",   no_argument,  NULL, LONG_OPTION_SCANCARRIER},
+    {"ue-max-power",   required_argument,  NULL, LONG_OPTION_MAXPOWER},
     {NULL, 0, NULL, 0}
   };
 
   while ((c = getopt_long (argc, argv, "C:dK:g:F:G:hqO:m:SUVRM:r:P:Ws:t:x:",long_options,NULL)) != -1) {
     switch (c) {
+    case LONG_OPTION_MAXPOWER:
+      tx_max_power[0]=atoi(optarg);
+      for (CC_id=1;CC_id<MAX_NUM_CCs;CC_id++)
+	tx_max_power[CC_id]=tx_max_power[0];
+
     case LONG_OPTION_ULSCH_MAX_CONSECUTIVE_ERRORS:
       ULSCH_max_consecutive_errors = atoi(optarg);
       printf("Set ULSCH_max_consecutive_errors = %d\n",ULSCH_max_consecutive_errors);
@@ -2469,12 +2476,8 @@ int main( int argc, char **argv )
   if (UE_flag==1) {
     printf("configuring for UE\n");
 
-    set_comp_log(HW,      LOG_DEBUG,  LOG_HIGH, 1);
-#ifdef OPENAIR2
-    set_comp_log(PHY,     LOG_DEBUG,   LOG_HIGH, 1);
-#else
+    set_comp_log(HW,      LOG_INFO,  LOG_HIGH, 1);
     set_comp_log(PHY,     LOG_INFO,   LOG_HIGH, 1);
-#endif
     set_comp_log(MAC,     LOG_INFO,   LOG_HIGH, 1);
     set_comp_log(RLC,     LOG_INFO,   LOG_HIGH, 1);
     set_comp_log(PDCP,    LOG_INFO,   LOG_HIGH, 1);
@@ -2994,7 +2997,7 @@ int main( int argc, char **argv )
 #ifdef OAI_USRP
     openair_daq_vars.timing_advance = 160;
 #else
-    openair_daq_vars.timing_advance = 170;
+    openair_daq_vars.timing_advance = 160;
 #endif
     if (setup_ue_buffers(UE,&openair0_cfg[0],rf_map)!=0) {
       printf("Error setting up eNB buffer\n");
diff --git a/targets/RT/USER/lte-ue.c b/targets/RT/USER/lte-ue.c
index 6ea807ac6b..ec6caaa945 100644
--- a/targets/RT/USER/lte-ue.c
+++ b/targets/RT/USER/lte-ue.c
@@ -572,11 +572,11 @@ static void *UE_thread_tx(void *arg)
   attr.size = sizeof(attr);
   attr.sched_flags = 0;
   attr.sched_nice = 0;
-  attr.sched_priority = 0;
+  attr.sched_priority = sched_get_priority_max(SCHED_DEADLINE)-1;
 
   /* This creates a 1ms reservation every 10ms period*/
   attr.sched_policy = SCHED_DEADLINE;
-  attr.sched_runtime = 1 * 500000;  // each tx thread requires .5ms to finish its job
+  attr.sched_runtime = 1 * 900000;  // each tx thread requires .5ms to finish its job
   attr.sched_deadline =1 * 1000000; // each tx thread will finish within 1ms
   attr.sched_period = 1 * 1000000; // each tx thread has a period of 1ms from the starting point
 
@@ -744,11 +744,11 @@ static void *UE_thread_rx(void *arg)
   attr.size = sizeof(attr);
   attr.sched_flags = 0;
   attr.sched_nice = 0;
-  attr.sched_priority = 0;
+  attr.sched_priority = sched_get_priority_max(SCHED_DEADLINE)-1;
 
-  // This creates a 1ms reservation every 10ms period
+  // This creates a .5ms reservation every 1ms period
   attr.sched_policy = SCHED_DEADLINE;
-  attr.sched_runtime = 1 * 500000;  // each rx thread requires 1ms to finish its job
+  attr.sched_runtime = 1 * 900000;  // each rx thread requires 1ms to finish its job
   attr.sched_deadline =1 * 1000000; // each rx thread will finish within 1ms
   attr.sched_period = 1 * 1000000; // each rx thread has a period of 1ms from the starting point
 
@@ -981,7 +981,7 @@ void *UE_thread(void *arg)
   attr.size = sizeof(attr);
   attr.sched_flags = 0;
   attr.sched_nice = 0;
-  attr.sched_priority = 0;
+  attr.sched_priority = sched_get_priority_max(SCHED_DEADLINE);
 
   // This creates a .5 ms  reservation
   attr.sched_policy = SCHED_DEADLINE;
@@ -1050,7 +1050,7 @@ void *UE_thread(void *arg)
       }
 
       if (rx_off_diff !=0)
-	LOG_I(PHY,"frame %d, rx_offset %d, rx_off_diff %d\n",UE->frame_rx,UE->rx_offset,rx_off_diff);
+	LOG_D(PHY,"frame %d, rx_offset %d, rx_off_diff %d\n",UE->frame_rx,UE->rx_offset,rx_off_diff);
 
       VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ, 0 );
 
@@ -1311,7 +1311,7 @@ void *UE_thread(void *arg)
 #ifdef LOWLATENCY
   struct sched_attr attr;
   unsigned int flags = 0;
-  unsigned long mask = 1; // processor 0
+  //  unsigned long mask = 1; // processor 0
 #endif
   int freq_offset;
 
@@ -1336,7 +1336,7 @@ void *UE_thread(void *arg)
   attr.size = sizeof(attr);
   attr.sched_flags = 0;
   attr.sched_nice = 0;
-  attr.sched_priority = 0;
+  attr.sched_priority = sched_get_priority_max(SCHED_DEADLINE);
 
   // This creates a .25 ms  reservation
   attr.sched_policy = SCHED_DEADLINE;
-- 
GitLab