From 618d56bd852ea899f3cb32ce6c372f9b4007f52b Mon Sep 17 00:00:00 2001
From: Lionel Gauthier <lionel.gauthier@eurecom.fr>
Date: Thu, 30 Apr 2015 09:18:06 +0000
Subject: [PATCH] Sebastian Held patches15/0012-reformatted.patch

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@7314 818b1a75-f10b-46b9-bf7c-635c3b92a50f
---
 openair2/RRC/LITE/MESSAGES/asn1_msg.c | 50 +++++++++++++--------------
 targets/RT/USER/lte-softmodem.c       |  8 ++---
 targets/RT/USER/lte-ue.c              | 39 ++++++++++++---------
 3 files changed, 51 insertions(+), 46 deletions(-)

diff --git a/openair2/RRC/LITE/MESSAGES/asn1_msg.c b/openair2/RRC/LITE/MESSAGES/asn1_msg.c
index 28c80941b1f..e28da04559f 100644
--- a/openair2/RRC/LITE/MESSAGES/asn1_msg.c
+++ b/openair2/RRC/LITE/MESSAGES/asn1_msg.c
@@ -1385,8 +1385,8 @@ do_RRCConnectionSetup(
   const uint8_t                    transmission_mode,
   const uint8_t                    Transaction_id,
   const LTE_DL_FRAME_PARMS* const frame_parms,
-                              SRB_ToAddModList_t  **SRB_configList,
-                              struct PhysicalConfigDedicated  **physicalConfigDedicated)
+  SRB_ToAddModList_t  **SRB_configList,
+  struct PhysicalConfigDedicated  **physicalConfigDedicated)
 {
 
   asn_enc_rval_t enc_rval;
@@ -1421,6 +1421,7 @@ do_RRCConnectionSetup(
   if (*SRB_configList) {
     free(*SRB_configList);
   }
+
   *SRB_configList = CALLOC(1,sizeof(SRB_ToAddModList_t));
 
   /// SRB1
@@ -1626,8 +1627,7 @@ do_RRCConnectionSetup(
 
   if (frame_parms->frame_type == 0) { // FDD
     physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 5+(ue_context_pP->local_uid%10);  // Isr = 5 (every 10 subframes, offset=2+UE_id mod3)
-  }
-  else {
+  } else {
     switch (frame_parms->tdd_config) {
     case 1:
       physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 7+(ue_context_pP->local_uid&1)+((
@@ -1877,30 +1877,30 @@ do_UECapabilityEnquiry(
 uint16_t
 do_RRCConnectionReconfiguration(
   const protocol_ctxt_t*        const ctxt_pP,
-    uint8_t                            *buffer,
-    uint8_t                             Transaction_id,
-    SRB_ToAddModList_t                 *SRB_list,
-    DRB_ToAddModList_t                 *DRB_list,
-    DRB_ToReleaseList_t                *DRB_list2,
-    struct SPS_Config                  *sps_Config,
-    struct PhysicalConfigDedicated     *physicalConfigDedicated,
-    MeasObjectToAddModList_t           *MeasObj_list,
-    ReportConfigToAddModList_t         *ReportConfig_list,
-    QuantityConfig_t                   *quantityConfig,
-    MeasIdToAddModList_t               *MeasId_list,
-    MAC_MainConfig_t                   *mac_MainConfig,
-    MeasGapConfig_t                    *measGapConfig,
-    MobilityControlInfo_t              *mobilityInfo,
-    struct MeasConfig__speedStatePars  *speedStatePars,
-    RSRP_Range_t                       *rsrp,
-    C_RNTI_t                           *cba_rnti,
-    struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList
-    *dedicatedInfoNASList
+  uint8_t                            *buffer,
+  uint8_t                             Transaction_id,
+  SRB_ToAddModList_t                 *SRB_list,
+  DRB_ToAddModList_t                 *DRB_list,
+  DRB_ToReleaseList_t                *DRB_list2,
+  struct SPS_Config                  *sps_Config,
+  struct PhysicalConfigDedicated     *physicalConfigDedicated,
+  MeasObjectToAddModList_t           *MeasObj_list,
+  ReportConfigToAddModList_t         *ReportConfig_list,
+  QuantityConfig_t                   *quantityConfig,
+  MeasIdToAddModList_t               *MeasId_list,
+  MAC_MainConfig_t                   *mac_MainConfig,
+  MeasGapConfig_t                    *measGapConfig,
+  MobilityControlInfo_t              *mobilityInfo,
+  struct MeasConfig__speedStatePars  *speedStatePars,
+  RSRP_Range_t                       *rsrp,
+  C_RNTI_t                           *cba_rnti,
+  struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList
+  *dedicatedInfoNASList
 
 #ifdef Rel10
-    , SCellToAddMod_r10_t  *SCell_config
+  , SCellToAddMod_r10_t  *SCell_config
 #endif
-                                        )
+)
 //------------------------------------------------------------------------------
 {
 
diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c
index 6298775e497..e5b09d5ecbe 100644
--- a/targets/RT/USER/lte-softmodem.c
+++ b/targets/RT/USER/lte-softmodem.c
@@ -140,10 +140,10 @@ unsigned short config_frames[4] = {2,9,11,13};
 //#define USRP_DEBUG 1
 
 struct timing_info_t {
-    //unsigned int frame, hw_slot, last_slot, next_slot;
-    RTIME time_min, time_max, time_avg, time_last, time_now;
-    //unsigned int mbox0, mbox1, mbox2, mbox_target;
-    unsigned int n_samples;
+  //unsigned int frame, hw_slot, last_slot, next_slot;
+  RTIME time_min, time_max, time_avg, time_last, time_now;
+  //unsigned int mbox0, mbox1, mbox2, mbox_target;
+  unsigned int n_samples;
 } timing_info;
 
 
diff --git a/targets/RT/USER/lte-ue.c b/targets/RT/USER/lte-ue.c
index f60bf288c35..a09fae17c5a 100644
--- a/targets/RT/USER/lte-ue.c
+++ b/targets/RT/USER/lte-ue.c
@@ -423,9 +423,9 @@ static void *UE_thread_synch(void *arg)
         }
 
         LOG_I( PHY, "[initial_sync] trying carrier off %d Hz, rxgain %d (DL %u, UL %u)\n", openair_daq_vars.freq_offset,
-              UE->rx_total_gain_dB,
-              downlink_frequency[0][0]+openair_daq_vars.freq_offset,
-              downlink_frequency[0][0]+uplink_frequency_offset[0][0]+openair_daq_vars.freq_offset );
+               UE->rx_total_gain_dB,
+               downlink_frequency[0][0]+openair_daq_vars.freq_offset,
+               downlink_frequency[0][0]+uplink_frequency_offset[0][0]+openair_daq_vars.freq_offset );
 
         for (card=0; card<MAX_CARDS; card++) {
           for (i=0; i<openair0_cfg[card].rx_num_channels; i++) {
@@ -451,6 +451,7 @@ static void *UE_thread_synch(void *arg)
               printf("Unknown number of RBs %d\n",UE->lte_frame_parms.N_RB_DL);
               break;
             }
+
 #endif
           }
         }
@@ -535,6 +536,7 @@ static void *UE_thread_tx(void *arg)
     perror("[SCHED] eNB tx thread: sched_setattr failed\n");
     return &UE_thread_tx_retval;
   }
+
 #endif
 #endif
 
@@ -596,15 +598,15 @@ static void *UE_thread_tx(void *arg)
 
       if (ret == CONNECTION_LOST) {
         LOG_E( PHY, "[UE %"PRIu8"] Frame %"PRIu32", subframe %u RRC Connection lost, returning to PRACH\n",
-              UE->Mod_id, UE->frame_rx /*FIXME really _rx?*/, UE->slot_tx>>1 );
+               UE->Mod_id, UE->frame_rx /*FIXME really _rx?*/, UE->slot_tx>>1 );
         UE->UE_mode[0] = PRACH;
       } else if (ret == PHY_RESYNCH) {
         LOG_E( PHY, "[UE %"PRIu8"] Frame %"PRIu32", subframe %u RRC Connection lost, trying to resynch\n",
-              UE->Mod_id, UE->frame_rx /*FIXME really _rx?*/, UE->slot_tx>>1 );
+               UE->Mod_id, UE->frame_rx /*FIXME really _rx?*/, UE->slot_tx>>1 );
         UE->UE_mode[0] = RESYNCH;
       } else if (ret == PHY_HO_PRACH) {
         LOG_I( PHY, "[UE %"PRIu8"] Frame %"PRIu32", subframe %u, return to PRACH and perform a contention-free access\n",
-              UE->Mod_id, UE->frame_rx /*FIXME really _rx?*/, UE->slot_tx>>1 );
+               UE->Mod_id, UE->frame_rx /*FIXME really _rx?*/, UE->slot_tx>>1 );
         UE->UE_mode[0] = PRACH;
       }
     }
@@ -745,15 +747,15 @@ static void *UE_thread_rx(void *arg)
 
         if (ret == CONNECTION_LOST) {
           LOG_E( PHY, "[UE %"PRIu8"] Frame %"PRIu32", subframe %u RRC Connection lost, returning to PRACH\n",
-                UE->Mod_id, UE->frame_rx, UE->slot_tx>>1 );
+                 UE->Mod_id, UE->frame_rx, UE->slot_tx>>1 );
           UE->UE_mode[0] = PRACH;
         } else if (ret == PHY_RESYNCH) {
           LOG_E( PHY, "[UE %"PRIu8"] Frame %"PRIu32", subframe %u RRC Connection lost, trying to resynch\n",
-                UE->Mod_id, UE->frame_rx, UE->slot_tx>>1 );
+                 UE->Mod_id, UE->frame_rx, UE->slot_tx>>1 );
           UE->UE_mode[0] = RESYNCH;
         } else if (ret == PHY_HO_PRACH) {
           LOG_I( PHY, "[UE %"PRIu8"] Frame %"PRIu32", subframe %u, return to PRACH and perform a contention-free access\n",
-                UE->Mod_id, UE->frame_rx, UE->slot_tx>>1 );
+                 UE->Mod_id, UE->frame_rx, UE->slot_tx>>1 );
           UE->UE_mode[0] = PRACH;
         }
       }
@@ -891,14 +893,15 @@ void *UE_thread(void *arg)
 
       DevAssert( UE->lte_frame_parms.nb_antennas_rx <= 2 );
       void* rxp[2];
+
       for (int i=0; i<UE->lte_frame_parms.nb_antennas_rx; i++)
         rxp[i] = (dummy_dump==0) ? (void*)&rxdata[i][rxpos] : (void*)dummy[i];
 
       unsigned int rxs = openair0.trx_read_func(&openair0,
-                                                &timestamp,
-                                                rxp,
-                                                spp - ((first_rx==1) ? rx_off_diff : 0),
-                                                UE->lte_frame_parms.nb_antennas_rx);
+                         &timestamp,
+                         rxp,
+                         spp - ((first_rx==1) ? rx_off_diff : 0),
+                         UE->lte_frame_parms.nb_antennas_rx);
 
       if (rxs != (spp- ((first_rx==1) ? rx_off_diff : 0))) {
         exit_fun("problem in rx");
@@ -914,6 +917,7 @@ void *UE_thread(void *arg)
 
         DevAssert( UE->lte_frame_parms.nb_antennas_tx <= 2 );
         void* txp[2];
+
         for (int i=0; i<UE->lte_frame_parms.nb_antennas_tx; i++)
           txp[i] = (void*)&txdata[i][txpos];
 
@@ -1068,6 +1072,7 @@ void *UE_thread(void *arg)
       int fail = pthread_mutex_lock(&UE->mutex_synch);
       int instance_cnt_synch = UE->instance_cnt_synch;
       fail = fail || pthread_mutex_unlock(&UE->mutex_synch);
+
       if (fail) {
         LOG_E( PHY, "[SCHED][UE] error (un-)locking mutex for UE synch\n" );
         exit_fun("noting to add");
@@ -1087,10 +1092,10 @@ void *UE_thread(void *arg)
 
 #ifndef USRP_DEBUG
             unsigned int rxs = openair0.trx_read_func(&openair0,
-                                                      &timestamp,
-                                                      (void**)rxdata,
-                                                      UE->rx_offset,
-                                                      UE->lte_frame_parms.nb_antennas_rx);
+                               &timestamp,
+                               (void**)rxdata,
+                               UE->rx_offset,
+                               UE->lte_frame_parms.nb_antennas_rx);
 #else
             rt_sleep_ns(10000000);
 #endif
-- 
GitLab