From ee3d40640ce8ca11057d100f5267aa4672e7f2b5 Mon Sep 17 00:00:00 2001
From: Navid Nikaein <navid.nikaein@eurecom.fr>
Date: Thu, 11 Dec 2014 17:39:37 +0000
Subject: [PATCH] * add some functions for terminal localizations * fix few
issues with the pre-ci tests
git-svn-id: http://svn.eurecom.fr/openair4G/trunk@6253 818b1a75-f10b-46b9-bf7c-635c3b92a50f
---
openair1/PHY/LTE_TRANSPORT/defs.h | 21 +-
.../PHY/LTE_TRANSPORT/ulsch_demodulation.c | 10 +-
openair1/PHY/TOOLS/defs.h | 7 +
openair1/PHY/TOOLS/signal_energy.c | 30 ++
openair1/PHY/defs.h | 5 +
openair1/PHY/impl_defs_lte.h | 6 +
openair1/SCHED/defs.h | 13 +-
openair1/SCHED/phy_procedures_lte_common.c | 145 ++++++++++
openair1/SCHED/phy_procedures_lte_eNb.c | 14 +-
openair1/SCHED/pusch_pc.c | 13 +-
openair2/COMMON/mac_rrc_primitives.h | 1 +
openair2/LAYER2/MAC/config.c | 33 +++
openair2/LAYER2/MAC/defs.h | 92 +-----
openair2/LAYER2/MAC/eNB_scheduler.c | 3 +-
openair2/LAYER2/MAC/eNB_scheduler_dlsch.c | 23 +-
openair2/LAYER2/MAC/pre_processor.c | 3 +
openair2/LAYER2/MAC/proto.h | 98 ++++++-
openair2/LAYER2/MAC/ue_procedures.c | 5 +-
openair2/RRC/LITE/defs.h | 242 +---------------
openair2/RRC/LITE/proto.h | 271 ++++++++++++++++++
openair2/RRC/LITE/rrc_common.c | 45 ++-
openair2/UTIL/LOG/log.c | 19 +-
openair2/UTIL/LOG/log.h | 1 +
.../CONF/enb.band7.generic.conf | 163 +++++++++++
.../SIMU/EXAMPLES/OSD/WEBXML/template_26.xml | 11 +-
targets/SIMU/USER/Makefile | 8 +
targets/SIMU/USER/init_lte.c | 14 +-
targets/SIMU/USER/oaisim.c | 126 ++++----
targets/SIMU/USER/oaisim_functions.c | 26 +-
targets/TEST/OAI/case02.py | 4 +-
targets/TEST/OAI/case03.py | 4 +-
targets/TEST/OAI/openair.py | 32 +++
targets/TEST/OAI/test01.py | 4 +-
33 files changed, 1067 insertions(+), 425 deletions(-)
create mode 100644 openair2/RRC/LITE/proto.h
create mode 100644 targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.conf
diff --git a/openair1/PHY/LTE_TRANSPORT/defs.h b/openair1/PHY/LTE_TRANSPORT/defs.h
index ff137b7f16..f22f127b86 100644
--- a/openair1/PHY/LTE_TRANSPORT/defs.h
+++ b/openair1/PHY/LTE_TRANSPORT/defs.h
@@ -42,6 +42,7 @@
#include "PHY/defs.h"
#include "dci.h"
#include "uci.h"
+#include "UTIL/LISTS/list.h"
#define MOD_TABLE_QPSK_OFFSET 1
#define MOD_TABLE_16QAM_OFFSET 5
@@ -470,6 +471,14 @@ typedef struct {
uint8_t num_active_cba_groups;
/// allocated CBA RNTI for this ulsch
uint16_t cba_rnti[4];//NUM_MAX_CBA_GROUP];
+#ifdef LOCALIZATION
+ /// epoch timestamp in millisecond
+ int32_t reference_timestamp_ms;
+ /// aggregate physical states every n millisecond
+ int32_t aggregation_period_ms;
+ /// a set of lists used for localization
+ struct list loc_rss_list, loc_rssi_list, loc_subcarrier_rss_list, loc_timing_advance_list, loc_timing_update_list;
+#endif
} LTE_eNB_ULSCH_t;
typedef struct {
@@ -531,6 +540,12 @@ typedef struct {
uint8_t dl_power_off;
} LTE_DL_UE_HARQ_t;
+typedef struct {
+ /// time-based localization, relying on TA and TOA
+ double time_based;
+ /// power-based localization, relying on RSS and RSSI
+ double power_based;
+} eNB_UE_estimated_distances;
typedef struct {
/// UL RSSI per receive antenna
@@ -555,7 +570,7 @@ typedef struct {
UE_MODE_t mode;
/// Current sector where UE is attached
uint8_t sector;
-
+
/// dlsch l2 errors
uint32_t dlsch_l2_errors[8];
/// dlsch trials per harq and round
@@ -595,6 +610,10 @@ typedef struct {
/// Bitrate on the PDSCH [bps]
unsigned int dlsch_bitrate;
// unsigned int total_transmitted_bits;
+#ifdef LOCALIZATION
+ eNB_UE_estimated_distances distance;
+ int32_t *subcarrier_rssi;
+#endif
} LTE_eNB_UE_stats;
typedef struct {
diff --git a/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c b/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c
index ff4bf70d8b..112b1ee494 100644
--- a/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c
+++ b/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c
@@ -1326,14 +1326,20 @@ void rx_ulsch(PHY_VARS_eNB *phy_vars_eNB,
eNB_pusch_vars->ulsch_power_0[i] = signal_energy(eNB_pusch_vars->drs_ch_estimates_0[eNB_id][i],
ulsch[UE_id]->harq_processes[harq_pid]->nb_rb*12)*rx_power_correction;
eNB_pusch_vars->ulsch_power_1[i] = signal_energy(eNB_pusch_vars->drs_ch_estimates_1[eNB_id][i],
- ulsch[UE_id]->harq_processes[harq_pid]->nb_rb*12)*rx_power_correction;
+ ulsch[UE_id]->harq_processes[harq_pid]->nb_rb*12)*rx_power_correction;
}
}
else
{
- for (i=0;i<frame_parms->nb_antennas_rx;i++)
+ for (i=0;i<frame_parms->nb_antennas_rx;i++) {
eNB_pusch_vars->ulsch_power[i] = signal_energy_nodc(eNB_pusch_vars->drs_ch_estimates[eNB_id][i],
ulsch[UE_id]->harq_processes[harq_pid]->nb_rb*12)*rx_power_correction;
+#ifdef LOCALIZATION
+ eNB_pusch_vars->subcarrier_power = (int32_t *)malloc(ulsch[UE_id]->harq_processes[harq_pid]->nb_rb*12*sizeof(int32_t));
+ eNB_pusch_vars->active_subcarrier = subcarrier_energy(eNB_pusch_vars->drs_ch_estimates[eNB_id][i],
+ ulsch[UE_id]->harq_processes[harq_pid]->nb_rb*12, eNB_pusch_vars->subcarrier_power, rx_power_correction);
+#endif
+ }
}
//write_output("rxdataF_ext.m","rxF_ext",eNB_pusch_vars->rxdataF_ext[eNB_id][0],300*(frame_parms->symbols_per_tti-ulsch[UE_id]->srs_active),1,1);
diff --git a/openair1/PHY/TOOLS/defs.h b/openair1/PHY/TOOLS/defs.h
index 5f0f4e14ae..3e0bf404a0 100644
--- a/openair1/PHY/TOOLS/defs.h
+++ b/openair1/PHY/TOOLS/defs.h
@@ -486,6 +486,13 @@ void mmxcopy(void *dest,void *src,int size);
*/
int32_t signal_energy(int32_t *,uint32_t);
+#ifdef LOCALIZATION
+/*!\fn int32_t signal_energy(int *,uint32_t);
+\brief Computes the signal energy per subcarrier
+*/
+int32_t subcarrier_energy(int32_t *,uint32_t, int32_t* subcarrier_energy, uint16_t rx_power_correction);
+#endif
+
/*!\fn int32_t signal_energy_nodc(int32_t *,uint32_t);
\brief Computes the signal energy per subcarrier, without DC removal
*/
diff --git a/openair1/PHY/TOOLS/signal_energy.c b/openair1/PHY/TOOLS/signal_energy.c
index 774e69d508..79dd0ee1f9 100755
--- a/openair1/PHY/TOOLS/signal_energy.c
+++ b/openair1/PHY/TOOLS/signal_energy.c
@@ -41,6 +41,36 @@
#ifndef EXPRESSMIMO_TARGET
+#ifdef LOCALIZATION
+int32_t subcarrier_energy(int32_t *input,uint32_t length, int32_t *subcarrier_energy, uint16_t rx_power_correction) {
+
+ int32_t i, subcarrier_pwr;
+ register __m64 mm0,mm1, subcarrier;
+ subcarrier = _m_pxor(subcarrier,subcarrier);
+ __m64 *in = (__m64 *)input;
+
+#ifdef MAIN
+ int16_t *printb;
+#endif
+
+ mm0 = _m_pxor(mm0,mm0);
+
+ for (i=0;i<length>>1;i++) {
+
+ mm1 = in[i];
+ mm1 = _m_pmaddwd(mm1,mm1);
+ mm1 = _m_psradi(mm1,shift);// shift any 32 bits blocs of the word by the value shift
+ subcarrier = mm1;
+ subcarrier = _m_psrlqi(subcarrier,32);
+ subcarrier = _m_paddd(subcarrier,mm1);
+ subcarrier_pwr = _m_to_int(subcarrier);
+ subcarrier_pwr<<=shift;
+ subcarrier_pwr = (unsigned short) dB_fixed(subcarrier_pwr);
+ subcarrier_energy[i] = subcarrier_pwr*rx_power_correction;
+ }
+ return i;
+}
+#endif
int32_t signal_energy(int32_t *input,uint32_t length) {
int32_t i;
diff --git a/openair1/PHY/defs.h b/openair1/PHY/defs.h
index dc98c0ff72..685739a4b2 100755
--- a/openair1/PHY/defs.h
+++ b/openair1/PHY/defs.h
@@ -336,6 +336,11 @@ typedef struct PHY_VARS_eNB_s{
time_stats_t ulsch_tc_intl1_stats;
time_stats_t ulsch_tc_intl2_stats;
+#ifdef LOCALIZATION
+ /// time state for localization
+ time_stats_t localization_stats;
+#endif
+
#if defined(ENABLE_RAL)
hash_table_t *ral_thresholds_timed;
SLIST_HEAD(ral_thresholds_gen_poll_enb_s, ral_threshold_phy_t) ral_thresholds_gen_polled[RAL_LINK_PARAM_GEN_MAX];
diff --git a/openair1/PHY/impl_defs_lte.h b/openair1/PHY/impl_defs_lte.h
index a9ebbe0518..25c8159bfb 100644
--- a/openair1/PHY/impl_defs_lte.h
+++ b/openair1/PHY/impl_defs_lte.h
@@ -602,6 +602,12 @@ typedef struct{
int ulsch_power_1[2];
/// llr values
int16_t *llr;
+#ifdef LOCALIZATION
+ /// number of active subcarrier for a specific UE
+ int32_t active_subcarrier;
+ /// subcarrier power in dBm
+ int32_t *subcarrier_power;
+#endif
} LTE_eNB_PUSCH;
typedef struct {
diff --git a/openair1/SCHED/defs.h b/openair1/SCHED/defs.h
index 41507a5151..3fded06fce 100644
--- a/openair1/SCHED/defs.h
+++ b/openair1/SCHED/defs.h
@@ -519,6 +519,17 @@ void pusch_power_cntl(PHY_VARS_UE *phy_vars_ue,uint8_t subframe,uint8_t eNB_id,u
int8_t get_PHR(uint8_t Mod_id, uint8_t CC_id, uint8_t eNB_index);
+#ifdef LOCALIZATION
+/** \brief This function collects eNB_UE stats and aggregate them in lists for localization
+ @param phy_vars_ue PHY variables
+ @param UE_id Index of UE
+ @param frame Index of frame
+ @param subframe Index of subframe
+ @param UE_tx_power_dB estimated UE Tx power
+ @returns -1 if updated list, 0 if calculated median
+ */
+double aggregate_eNB_UE_localization_stats(PHY_VARS_eNB *phy_vars_eNB, int8_t UE_id, frame_t frameP, sub_frame_t subframeP, int32_t UE_tx_power_dB);
+#endif
LTE_eNB_UE_stats* get_eNB_UE_stats(uint8_t Mod_id, uint8_t CC_id,uint16_t rnti);
LTE_DL_FRAME_PARMS *get_lte_frame_parms(module_id_t Mod_id, uint8_t CC_id);
@@ -527,7 +538,7 @@ MU_MIMO_mode* get_mu_mimo_mode (module_id_t Mod_id, uint8_t CC_id, rnti_t rnti);
int16_t get_hundred_times_delta_IF(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t harq_pid);
-int16_t get_hundred_times_delta_IF_eNB(PHY_VARS_eNB *phy_vars_eNB,uint8_t UE_id,uint8_t harq_pid);
+int16_t get_hundred_times_delta_IF_eNB(PHY_VARS_eNB *phy_vars_eNB,uint8_t UE_id,uint8_t harq_pid, uint8_t bw_factor);
int16_t get_hundred_times_delta_IF_mac(module_id_t module_idP, uint8_t CC_id, rnti_t rnti, uint8_t harq_pid);
diff --git a/openair1/SCHED/phy_procedures_lte_common.c b/openair1/SCHED/phy_procedures_lte_common.c
index 6c6b328ae5..b40926dc99 100755
--- a/openair1/SCHED/phy_procedures_lte_common.c
+++ b/openair1/SCHED/phy_procedures_lte_common.c
@@ -44,6 +44,9 @@
#include "SCHED/defs.h"
#include "SCHED/extern.h"
+#ifdef LOCALIZATION
+#include <sys/time.h>
+#endif
void get_Msg3_alloc(LTE_DL_FRAME_PARMS *frame_parms,
unsigned char current_subframe,
@@ -548,6 +551,148 @@ unsigned int is_phich_subframe(LTE_DL_FRAME_PARMS *frame_parms,unsigned char sub
}
+#ifdef LOCALIZATION
+double aggregate_eNB_UE_localization_stats(PHY_VARS_eNB *phy_vars_eNB, int8_t UE_id, frame_t frame, sub_frame_t subframe, int32_t UE_tx_power_dB){
+ // parameters declaration
+ int8_t Mod_id, CC_id;
+ int32_t harq_pid, avg_power, avg_rssi, median_power, median_rssi, median_subcarrier_rss, median_TA, median_TA_update, ref_timestamp_ms, current_timestamp_ms;
+ char cqis[100], sub_powers[2048];
+ int len = 0, i;
+ struct timeval ts;
+ double sys_bw = 0;
+ uint8_t N_RB_DL;
+ LTE_DL_FRAME_PARMS *frame_parms = &phy_vars_eNB->lte_frame_parms;
+
+ Mod_id = phy_vars_eNB->Mod_id;
+ CC_id = phy_vars_eNB->CC_id;
+ ref_timestamp_ms = phy_vars_eNB->ulsch_eNB[UE_id+1]->reference_timestamp_ms;
+
+ for (i=0;i<13;i++) {
+ len += sprintf(&cqis[len]," %d ", phy_vars_eNB->eNB_UE_stats[(uint32_t)UE_id].DL_subband_cqi[0][i]);
+ }
+ len = 0;
+ for (i=0;i<phy_vars_eNB->lte_eNB_pusch_vars[(uint32_t)UE_id]->active_subcarrier;i++) {
+ len += sprintf(&sub_powers[len]," %d ", phy_vars_eNB->lte_eNB_pusch_vars[(uint32_t)UE_id]->subcarrier_power[i]);
+ }
+
+ gettimeofday(&ts, NULL);
+ current_timestamp_ms = ts.tv_sec * 1000 + ts.tv_usec / 1000;
+
+
+ LOG_F(LOCALIZE, "PHY: [UE %x/%d -> eNB %d], timestamp %d, "
+ "frame %d, subframe %d"
+ "UE Tx power %d dBm, "
+ "RSSI ant1 %d dBm, "
+ "RSSI ant2 %d dBm, "
+ "pwr ant1 %d dBm, "
+ "pwr ant2 %d dBm, "
+ "Rx gain %d dBm, "
+ "TA %d, "
+ "TA update %d, "
+ "DL_CQI (%d,%d), "
+ "Wideband CQI (%d,%d), "
+ "DL Subband CQI[13] %s \n"
+ "timestamp %d, (%d active subcarrier) %s \n"
+ ,phy_vars_eNB->dlsch_eNB[(uint32_t)UE_id][0]->rnti, UE_id, Mod_id, current_timestamp_ms,
+ frame,subframe,
+ UE_tx_power_dB,
+ phy_vars_eNB->eNB_UE_stats[(uint32_t)UE_id].UL_rssi[0],
+ phy_vars_eNB->eNB_UE_stats[(uint32_t)UE_id].UL_rssi[1],
+ dB_fixed(phy_vars_eNB->lte_eNB_pusch_vars[(uint32_t)UE_id]->ulsch_power[0]),
+ dB_fixed(phy_vars_eNB->lte_eNB_pusch_vars[(uint32_t)UE_id]->ulsch_power[1]),
+ phy_vars_eNB->rx_total_gain_eNB_dB,
+ phy_vars_eNB->eNB_UE_stats[(uint32_t)UE_id].UE_timing_offset, // raw timing advance 1/sampling rate
+ phy_vars_eNB->eNB_UE_stats[(uint32_t)UE_id].timing_advance_update,
+ phy_vars_eNB->eNB_UE_stats[(uint32_t)UE_id].DL_cqi[0],phy_vars_eNB->eNB_UE_stats[(uint32_t)UE_id].DL_cqi[1],
+ phy_vars_eNB->PHY_measurements_eNB[Mod_id].wideband_cqi_dB[(uint32_t)UE_id][0],
+ phy_vars_eNB->PHY_measurements_eNB[Mod_id].wideband_cqi_dB[(uint32_t)UE_id][1],
+ cqis,
+ current_timestamp_ms,
+ phy_vars_eNB->lte_eNB_pusch_vars[(uint32_t)UE_id]->active_subcarrier,
+ sub_powers);
+
+ N_RB_DL = frame_parms->N_RB_DL;
+ switch (N_RB_DL)
+ {
+ case 6:
+ sys_bw = 1.92;
+ break;
+ case 25:
+ sys_bw = 7.68;
+ break;
+ case 50:
+ sys_bw = 15.36;
+ break;
+ case 100:
+ sys_bw = 30.72;
+ break;
+ }
+
+ if ((current_timestamp_ms - ref_timestamp_ms > phy_vars_eNB->ulsch_eNB[UE_id+1]->aggregation_period_ms) &&
+ (phy_vars_eNB->ulsch_eNB[UE_id+1]->loc_rss_list.size != 0)) {
+ // check the size of one list to be sure there was a message transmitted during the defined aggregation period
+ median_power = calculate_median(&phy_vars_eNB->ulsch_eNB[UE_id+1]->loc_rss_list);
+ del(&phy_vars_eNB->ulsch_eNB[UE_id+1]->loc_rss_list);
+ median_rssi = calculate_median(&phy_vars_eNB->ulsch_eNB[UE_id+1]->loc_rssi_list);
+ del(&phy_vars_eNB->ulsch_eNB[UE_id+1]->loc_rssi_list);
+ median_subcarrier_rss = calculate_median(&phy_vars_eNB->ulsch_eNB[UE_id+1]->loc_subcarrier_rss_list);
+ del(&phy_vars_eNB->ulsch_eNB[UE_id+1]->loc_subcarrier_rss_list);
+ median_TA = calculate_median(&phy_vars_eNB->ulsch_eNB[UE_id+1]->loc_timing_advance_list);
+ del(&phy_vars_eNB->ulsch_eNB[UE_id+1]->loc_timing_advance_list);
+ median_TA_update = calculate_median(&phy_vars_eNB->ulsch_eNB[UE_id+1]->loc_timing_update_list);
+ del(&phy_vars_eNB->ulsch_eNB[UE_id+1]->loc_timing_update_list);
+
+ double alpha = 2, power_distance, time_distance;
+ power_distance = pow(10, ((UE_tx_power_dB - (median_subcarrier_rss - phy_vars_eNB->rx_total_gain_eNB_dB))/(20.0*alpha)));
+ time_distance = (double) 299792458*(phy_vars_eNB->eNB_UE_stats[(uint32_t)UE_id].UE_timing_offset)/(sys_bw*1000000);
+
+ phy_vars_eNB->eNB_UE_stats[(uint32_t)UE_id].distance.time_based = time_distance;
+ phy_vars_eNB->eNB_UE_stats[(uint32_t)UE_id].distance.power_based = power_distance;
+
+ LOG_D(LOCALIZE, " PHY [UE %x/%d -> eNB %d], timestamp %d, "
+ "frame %d, subframe %d "
+ "UE Tx power %d dBm, "
+ "median RSSI %d dBm, "
+ "median Power %d dBm, "
+ "Rx gain %d dBm, "
+ "power estimated r = %0.3f, "
+ " TA %d, update %d "
+ "TA estimated r = %0.3f\n"
+ ,phy_vars_eNB->dlsch_eNB[(uint32_t)UE_id][0]->rnti, UE_id, Mod_id, current_timestamp_ms,
+ frame, subframe,
+ UE_tx_power_dB,
+ median_rssi,
+ median_power,
+ phy_vars_eNB->rx_total_gain_eNB_dB,
+ power_distance,
+ phy_vars_eNB->eNB_UE_stats[(uint32_t)UE_id].UE_timing_offset, median_TA_update,
+ time_distance);
+
+ initialize(&phy_vars_eNB->ulsch_eNB[UE_id+1]->loc_rss_list);
+ initialize(&phy_vars_eNB->ulsch_eNB[UE_id+1]->loc_subcarrier_rss_list);
+ initialize(&phy_vars_eNB->ulsch_eNB[UE_id+1]->loc_rssi_list);
+ initialize(&phy_vars_eNB->ulsch_eNB[UE_id+1]->loc_timing_advance_list);
+ initialize(&phy_vars_eNB->ulsch_eNB[UE_id+1]->loc_timing_update_list);
+
+ // make the reference timestamp == current timestamp
+ phy_vars_eNB->ulsch_eNB[UE_id+1]->reference_timestamp_ms = current_timestamp_ms;
+ return 0;
+ }
+ else {
+ avg_power = (dB_fixed(phy_vars_eNB->lte_eNB_pusch_vars[(uint32_t)UE_id]->ulsch_power[0]) + dB_fixed(phy_vars_eNB->lte_eNB_pusch_vars[(uint32_t)UE_id]->ulsch_power[1]))/2;
+ avg_rssi = (phy_vars_eNB->eNB_UE_stats[(uint32_t)UE_id].UL_rssi[0] + phy_vars_eNB->eNB_UE_stats[(uint32_t)UE_id].UL_rssi[1])/2;
+
+ push_front(&phy_vars_eNB->ulsch_eNB[UE_id+1]->loc_rss_list,avg_power);
+ push_front(&phy_vars_eNB->ulsch_eNB[UE_id+1]->loc_rssi_list,avg_rssi);
+ for (i=0;i<phy_vars_eNB->lte_eNB_pusch_vars[(uint32_t)UE_id]->active_subcarrier;i++) {
+ push_front(&phy_vars_eNB->ulsch_eNB[UE_id+1]->loc_subcarrier_rss_list, phy_vars_eNB->lte_eNB_pusch_vars[(uint32_t)UE_id]->subcarrier_power[i]);
+ }
+ push_front(&phy_vars_eNB->ulsch_eNB[UE_id+1]->loc_timing_advance_list, phy_vars_eNB->eNB_UE_stats[(uint32_t)UE_id].UE_timing_offset);
+ push_front(&phy_vars_eNB->ulsch_eNB[UE_id+1]->loc_timing_update_list, phy_vars_eNB->eNB_UE_stats[(uint32_t)UE_id].timing_advance_update);
+ return -1;
+ }
+}
+#endif
LTE_eNB_UE_stats* get_eNB_UE_stats(uint8_t Mod_id, uint8_t CC_id,uint16_t rnti) {
int8_t UE_id;
if ((PHY_vars_eNB_g == NULL) || (PHY_vars_eNB_g[Mod_id] == NULL) || (PHY_vars_eNB_g[Mod_id][CC_id]==NULL)) {
diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c
index 7f60037882..a9ea37c7f9 100755
--- a/openair1/SCHED/phy_procedures_lte_eNb.c
+++ b/openair1/SCHED/phy_procedures_lte_eNb.c
@@ -2974,7 +2974,7 @@ void phy_procedures_eNB_RX(unsigned char sched_subframe,PHY_VARS_eNB *phy_vars_e
//compute the expected ULSCH RX power (for the stats)
phy_vars_eNB->ulsch_eNB[(uint32_t)i]->harq_processes[harq_pid]->delta_TF =
- get_hundred_times_delta_IF_eNB(phy_vars_eNB,i,harq_pid);
+ get_hundred_times_delta_IF_eNB(phy_vars_eNB,i,harq_pid, 0); // 0 means bw_factor is not considered
//dump_ulsch(phy_vars_eNB, sched_subframe, i);
@@ -3125,7 +3125,7 @@ void phy_procedures_eNB_RX(unsigned char sched_subframe,PHY_VARS_eNB *phy_vars_e
phy_vars_eNB->lte_frame_parms.ofdm_symbol_size) -
phy_vars_eNB->rx_total_gain_eNB_dB -
hundred_times_log10_NPRB[phy_vars_eNB->ulsch_eNB[i]->harq_processes[harq_pid]->nb_rb-1]/100 -
- get_hundred_times_delta_IF_eNB(phy_vars_eNB,i,harq_pid)/100;
+ get_hundred_times_delta_IF_eNB(phy_vars_eNB,i,harq_pid, 0)/100;
phy_vars_eNB->ulsch_eNB[i]->harq_processes[harq_pid]->phich_active = 1;
phy_vars_eNB->ulsch_eNB[i]->harq_processes[harq_pid]->phich_ACK = 1;
@@ -3226,6 +3226,16 @@ void phy_procedures_eNB_RX(unsigned char sched_subframe,PHY_VARS_eNB *phy_vars_e
LOG_D(PHY,"[eNB][Auto-Calibration] Frame %d, Subframe %d : ULSCH PDU (RX) %d bytes\n",phy_vars_eNB->proc[sched_subframe].frame_tx,subframe,phy_vars_eNB->ulsch_eNB[i]->harq_processes[harq_pid]->TBS>>3);
}
*/
+#ifdef LOCALIZATION
+ start_meas(&phy_vars_eNB->localization_stats);
+ aggregate_eNB_UE_localization_stats(phy_vars_eNB,
+ i,
+ frame,
+ subframe,
+ get_hundred_times_delta_IF_eNB(phy_vars_eNB,i,harq_pid, 1)/100);
+ stop_meas(&phy_vars_eNB->localization_stats);
+#endif
+
#endif
}
diff --git a/openair1/SCHED/pusch_pc.c b/openair1/SCHED/pusch_pc.c
index 46b53ee807..50d9f3957c 100644
--- a/openair1/SCHED/pusch_pc.c
+++ b/openair1/SCHED/pusch_pc.c
@@ -45,8 +45,9 @@
// This is the formula from Section 5.1.1.1 in 36.213 100*10*log10((2^(MPR*Ks)-1)), where MPR is in the range [0,6] and Ks=1.25
int16_t hundred_times_delta_TF[100] = {-32768,-1268,-956,-768,-631,-523,-431,-352,-282,-219,-161,-107,-57,-9,36,79,120,159,197,234,269,304,337,370,402,434,465,495,525,555,583,612,640,668,696,723,750,777,803,829,856,881,907,933,958,983,1008,1033,1058,1083,1108,1132,1157,1181,1205,1229,1254,1278,1302,1325,1349,1373,1397,1421,1444,1468,1491,1515,1538,1562,1585,1609,1632,1655,1679,1702,1725,1748,1772,1795,1818,1841,1864,1887,1910,1933,1956,1980,2003,2026,2049,2072,2095,2118,2141,2164,2186,2209,2232,2255};
+uint16_t hundred_times_log10_NPRB[100] = {0,301,477,602,698,778,845,903,954,1000,1041,1079,1113,1146,1176,1204,1230,1255,1278,1301,1322,1342,1361,1380,1397,1414,1431,1447,1462,1477,1491,1505,1518,1531,1544,1556,1568,1579,1591,1602,1612,1623,1633,1643,1653,1662,1672,1681,1690,1698,1707,1716,1724,1732,1740,1748,1755,1763,1770,1778,1785,1792,1799,1806,1812,1819,1826,1832,1838,1845,1851,1857,1863,1869,1875,1880,1886,1892,1897,1903,1908,1913,1919,1924,1929,1934,1939,1944,1949,1954,1959,1963,1968,1973,1977,1982,1986,1991,1995,2000};
-int16_t get_hundred_times_delta_IF_eNB(PHY_VARS_eNB *phy_vars_eNB,uint8_t UE_id,uint8_t harq_pid) {
+int16_t get_hundred_times_delta_IF_eNB(PHY_VARS_eNB *phy_vars_eNB,uint8_t UE_id,uint8_t harq_pid, uint8_t bw_factor) {
uint32_t Nre,sumKr,MPR_x100,Kr,r;
uint16_t beta_offset_pusch;
@@ -75,7 +76,12 @@ int16_t get_hundred_times_delta_IF_eNB(PHY_VARS_eNB *phy_vars_eNB,uint8_t UE_id,
if (phy_vars_eNB->ul_power_control_dedicated[UE_id].deltaMCS_Enabled == 1) {
// This is the formula from Section 5.1.1.1 in 36.213 10*log10(deltaIF_PUSCH = (2^(MPR*Ks)-1)*beta_offset_pusch)
- return(hundred_times_delta_TF[MPR_x100/6]+10*dB_fixed_times10((beta_offset_pusch)>>3));
+ if (bw_factor == 1) {
+ uint8_t nb_rb = phy_vars_eNB->ulsch_eNB[UE_id]->harq_processes[harq_pid]->nb_rb;
+ return(hundred_times_delta_TF[MPR_x100/6]+10*dB_fixed_times10((beta_offset_pusch)>>3)) + hundred_times_log10_NPRB[nb_rb-1];
+ }
+ else
+ return(hundred_times_delta_TF[MPR_x100/6]+10*dB_fixed_times10((beta_offset_pusch)>>3));
}
else {
return(0);
@@ -83,7 +89,7 @@ int16_t get_hundred_times_delta_IF_eNB(PHY_VARS_eNB *phy_vars_eNB,uint8_t UE_id,
}
int16_t get_hundred_times_delta_IF_mac(module_id_t module_idP, uint8_t CC_id, rnti_t rnti, uint8_t harq_pid) {
- return get_hundred_times_delta_IF_eNB(PHY_vars_eNB_g[module_idP][CC_id],find_ue(rnti,PHY_vars_eNB_g[module_idP][CC_id]),harq_pid);
+ return get_hundred_times_delta_IF_eNB(PHY_vars_eNB_g[module_idP][CC_id],find_ue(rnti,PHY_vars_eNB_g[module_idP][CC_id]),harq_pid, 0);
}
int16_t get_hundred_times_delta_IF(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t harq_pid) {
@@ -110,7 +116,6 @@ int16_t get_hundred_times_delta_IF(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8
}
}
-uint16_t hundred_times_log10_NPRB[100] = {0,301,477,602,698,778,845,903,954,1000,1041,1079,1113,1146,1176,1204,1230,1255,1278,1301,1322,1342,1361,1380,1397,1414,1431,1447,1462,1477,1491,1505,1518,1531,1544,1556,1568,1579,1591,1602,1612,1623,1633,1643,1653,1662,1672,1681,1690,1698,1707,1716,1724,1732,1740,1748,1755,1763,1770,1778,1785,1792,1799,1806,1812,1819,1826,1832,1838,1845,1851,1857,1863,1869,1875,1880,1886,1892,1897,1903,1908,1913,1919,1924,1929,1934,1939,1944,1949,1954,1959,1963,1968,1973,1977,1982,1986,1991,1995,2000};
uint8_t alpha_lut[8] = {0,40,50,60,70,80,90,100};
diff --git a/openair2/COMMON/mac_rrc_primitives.h b/openair2/COMMON/mac_rrc_primitives.h
index 3375533380..60c6ce1f3b 100644
--- a/openair2/COMMON/mac_rrc_primitives.h
+++ b/openair2/COMMON/mac_rrc_primitives.h
@@ -362,6 +362,7 @@ typedef struct{ //RRC_INTERFACE_FUNCTIONS
void (*rrc_data_indP) (module_id_t , rb_id_t , sdu_size_t , char*);
void (*fn_rrc) (void);
uint8_t (*get_rrc_status)(uint8_t Mod_id,uint8_t eNB_flag,uint8_t eNB_index);
+ double (*rrc_get_estimated_ue_distance) (module_id_t Mod_id, uint8_t UE_id, uint8_t CC_id, uint8_t loc_type);
}RRC_XFACE;
diff --git a/openair2/LAYER2/MAC/config.c b/openair2/LAYER2/MAC/config.c
index f3ff6c28a7..0c02aa49ad 100644
--- a/openair2/LAYER2/MAC/config.c
+++ b/openair2/LAYER2/MAC/config.c
@@ -468,3 +468,36 @@ int rrc_mac_config_req(module_id_t Mod_id, eNB_flag_t eNB_flagP,uint8_t UE_id,ui
return(0);
}
+#ifdef LOCALIZATION
+double
+rrc_get_estimated_ue_distance(module_id_t Mod_id, const frame_t frameP, uint8_t UE_id, int CC_id, uint8_t loc_type){
+ // localization types:
+ // 0: power based
+ // 1: time based
+ LTE_eNB_UE_stats *eNB_UE_stats = NULL;
+ UE_list_t *UE_list = &eNB_mac_inst[Mod_id].UE_list;
+ int pCCid;
+
+ uint16_t rnti;
+
+ //for (UE_id=UE_list->head;UE_id>=0;UE_id=UE_list->next[UE_id]) {
+ pCCid = UE_PCCID(Mod_id,UE_id);
+ rnti = UE_list->UE_template[pCCid][UE_id].rnti;
+ if(rnti == 0)
+ return -1;
+ eNB_UE_stats = mac_xface->get_eNB_UE_stats(Mod_id,pCCid,rnti);
+ switch (loc_type) {
+ case 0:
+ return eNB_UE_stats->distance.power_based;
+ break;
+ case 1:
+ return eNB_UE_stats->distance.time_based;
+ break;
+ default:
+ return eNB_UE_stats->distance.power_based;
+ }
+// LOG_D(LOCALIZE, "DEBUG ME, dist = %d\n", &eNB_mac_inst[Mod_id].UE_list.UE_template[CC_id][UE_id].distance.power_based);
+
+}
+
+#endif
diff --git a/openair2/LAYER2/MAC/defs.h b/openair2/LAYER2/MAC/defs.h
index 2cd256185d..56e932e224 100644
--- a/openair2/LAYER2/MAC/defs.h
+++ b/openair2/LAYER2/MAC/defs.h
@@ -567,6 +567,12 @@ typedef struct{
uint32_t ul_buffer_info[MAX_NUM_LCGID];
+ /// UE tx power
+ int32_t ue_tx_power;
+
+#ifdef LOCALIZATION
+ eNB_UE_estimated_distances distance;
+#endif
} UE_TEMPLATE;
typedef struct{
@@ -919,91 +925,7 @@ typedef struct {
uint8_t n_adj_cells;
} neigh_cell_id_t;
-
-/* \brief Generate header for DL-SCH. This function parses the desired control elements and sdus and generates the header as described
-in 36-321 MAC layer specifications. It returns the number of bytes used for the header to be used as an offset for the payload
-in the DLSCH buffer.
-@param mac_header Pointer to the first byte of the MAC header (DL-SCH buffer)
-@param num_sdus Number of SDUs in the payload
-@param sdu_lengths Pointer to array of SDU lengths
-@param sdu_lcids Pointer to array of LCIDs (the order must be the same as the SDU length array)
-@param drx_cmd dicontinous reception command
-@param timing_advancd_cmd timing advanced command
-@param ue_cont_res_id Pointer to contention resolution identifier (NULL means not present in payload)
-@param short_padding Number of bytes for short padding (0,1,2)
-@param post_padding number of bytes for padding at the end of MAC PDU
-@returns Number of bytes used for header
-*/
-unsigned char generate_dlsch_header(unsigned char *mac_header,
- unsigned char num_sdus,
- unsigned short *sdu_lengths,
- unsigned char *sdu_lcids,
- unsigned char drx_cmd,
- short timing_advance_cmd,
- unsigned char *ue_cont_res_id,
- unsigned char short_padding,
- unsigned short post_padding);
-
-/** \brief RRC Configuration primitive for PHY/MAC. Allows configuration of PHY/MAC resources based on System Information (SI), RRCConnectionSetup and RRCConnectionReconfiguration messages.
-@param Mod_id Instance ID of eNB
-@param eNB_flag Indicates if this is a eNB or UE configuration
-@param UE_id Index of UE if this is an eNB configuration
-@param eNB_id Index of eNB if this is a UE configuration
-@param radioResourceConfigCommon Structure from SIB2 for common radio parameters (if NULL keep existing configuration)
-@param physcialConfigDedicated Structure from RRCConnectionSetup or RRCConnectionReconfiguration for dedicated PHY parameters (if NULL keep existing configuration)
-@param measObj Structure from RRCConnectionReconfiguration for UE measurement procedures
-@param mac_MainConfig Structure from RRCConnectionSetup or RRCConnectionReconfiguration for dedicated MAC parameters (if NULL keep existing configuration)
-@param logicalChannelIdentity Logical channel identity index of corresponding logical channel config
-@param logicalChannelConfig Pointer to logical channel configuration
-@param measGapConfig Measurement Gap configuration for MAC (if NULL keep existing configuration)
-@param tdd_Config TDD Configuration from SIB1 (if NULL keep existing configuration)
-@param mobilityControlInfo mobility control info received for Handover
-@param SIwindowsize SI Windowsize from SIB1 (if NULL keep existing configuration)
-@param SIperiod SI Period from SIB1 (if NULL keep existing configuration)
-@param MBMS_Flag indicates MBMS transmission
-@param mbsfn_SubframeConfigList pointer to mbsfn subframe configuration list from SIB2
-@param mbsfn_AreaInfoList pointer to MBSFN Area Info list from SIB13
-@param pmch_InfoList pointer to PMCH_InfoList from MBSFNAreaConfiguration Message (MCCH Message)
-*/
-int rrc_mac_config_req(module_id_t module_idP,
- eNB_flag_t eNB_flag,
- uint8_t UE_id,
- uint8_t eNB_index,
- RadioResourceConfigCommonSIB_t *radioResourceConfigCommon,
- struct PhysicalConfigDedicated *physicalConfigDedicated,
-#ifdef Rel10
- SCellToAddMod_r10_t *sCellToAddMod_r10,
- //struct PhysicalConfigDedicatedSCell_r10 *physicalConfigDedicatedSCell_r10,
-#endif
- MeasObjectToAddMod_t **measObj,
- MAC_MainConfig_t *mac_MainConfig,
- long logicalChannelIdentity,
- LogicalChannelConfig_t *logicalChannelConfig,
- MeasGapConfig_t *measGapConfig,
- TDD_Config_t *tdd_Config,
- MobilityControlInfo_t *mobilityControlInfo,
- uint8_t *SIwindowsize,
- uint16_t *SIperiod,
- ARFCN_ValueEUTRA_t *ul_CarrierFreq,
- long *ul_Bandwidth,
- AdditionalSpectrumEmission_t *additionalSpectrumEmission,
- struct MBSFN_SubframeConfigList *mbsfn_SubframeConfigList
-#ifdef Rel10
- ,
- uint8_t MBMS_Flag,
- MBSFN_AreaInfoList_r9_t *mbsfn_AreaInfoList,
- PMCH_InfoList_r9_t *pmch_InfoList
-
-#endif
-#ifdef CBA
- ,
- uint8_t num_active_cba_groups,
- uint16_t cba_rnti
-#endif
- );
-
-
-
+#include "proto.h"
/*@}*/
#endif /*__LAYER2_MAC_DEFS_H__ */
diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c
index f2467f7eb9..057f33501a 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler.c
@@ -188,7 +188,8 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag,
rrc_rx_tx(module_idP,
frameP,
1,
- module_idP);
+ module_idP,
+ CC_id);
#ifdef Rel10
for (CC_id=0;CC_id<MAX_NUM_CCs;CC_id++) {
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c b/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c
index 8ae6b957dc..42ab173c93 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c
@@ -392,7 +392,7 @@ void schedule_ue_spec(module_id_t module_idP,
uint8_t dl_pow_off[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
unsigned char rballoc_sub_UE[MAX_NUM_CCs][NUMBER_OF_UE_MAX][N_RBG_MAX];
uint16_t pre_nb_available_rbs[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
- int mcs,mcs2;
+ int mcs;
uint16_t min_rb_unit[MAX_NUM_CCs];
short ta_update = 0;
eNB_MAC_INST *eNB = &eNB_mac_inst[module_idP];
@@ -708,7 +708,24 @@ void schedule_ue_spec(module_id_t module_idP,
// check first for RLC data on DCCH
// add the length for all the control elements (timing adv, drx, etc) : header + payload
#ifndef EXMIMO_IOT
- ta_len = ((eNB_UE_stats->timing_advance_update/4)!=0) ? 2 : 0;
+ // to be checked by RK, NN, FK
+ uint8_t update_TA;
+ switch (frame_parms[CC_id]->N_RB_DL)
+ {
+ case 6:
+ update_TA = 1;
+ break;
+ case 25:
+ update_TA = 4;
+ break;
+ case 50:
+ update_TA = 8;
+ break;
+ case 100:
+ update_TA = 16;
+ break;
+ }
+ ta_len = ((eNB_UE_stats->timing_advance_update/update_TA)!=0) ? 2 : 0;
#else
ta_len = 0;
#endif
@@ -936,7 +953,7 @@ void schedule_ue_spec(module_id_t module_idP,
post_padding = TBS - sdu_length_total - header_len_dcch - header_len_dtch - ta_len ; // 1 is for the postpadding header
}
#ifndef EXMIMO_IOT
- ta_update = eNB_UE_stats->timing_advance_update/4;
+ ta_update = eNB_UE_stats->timing_advance_update/update_TA;
#else
ta_update = 0;
#endif
diff --git a/openair2/LAYER2/MAC/pre_processor.c b/openair2/LAYER2/MAC/pre_processor.c
index 7cb62e4c57..c652128da7 100644
--- a/openair2/LAYER2/MAC/pre_processor.c
+++ b/openair2/LAYER2/MAC/pre_processor.c
@@ -961,6 +961,9 @@ void assign_max_mcs_min_rb(module_id_t module_idP,int frameP, sub_frame_t subfra
tbs = mac_xface->get_TBS_UL(mcs,rb_table[rb_table_index]);
tx_power = mac_xface->estimate_ue_tx_power(tbs,rb_table[rb_table_index],0,frame_parms->Ncp,0);
}
+
+ UE_template->ue_tx_power = tx_power;
+
if (rb_table[rb_table_index]>(frame_parms->N_RB_UL-first_rb[CC_id]-1)) {
rb_table_index--;
}
diff --git a/openair2/LAYER2/MAC/proto.h b/openair2/LAYER2/MAC/proto.h
index 362bb543c4..916c938958 100644
--- a/openair2/LAYER2/MAC/proto.h
+++ b/openair2/LAYER2/MAC/proto.h
@@ -498,7 +498,7 @@ void adjust_bsr_info(int buffer_occupancy, uint16_t TBS, UE_TEMPLATE *UE_templat
\param[in] eNB_index instance of eNB
@returns L2 state (CONNETION_OK or CONNECTION_LOST or PHY_RESYNCH)
*/
-UE_L2_STATE_t ue_scheduler(module_id_t module_idP,frame_t frameP, sub_frame_t subframe, lte_subframe_t direction,uint8_t eNB_index);
+UE_L2_STATE_t ue_scheduler(module_id_t module_idP,frame_t frameP, sub_frame_t subframe, lte_subframe_t direction,uint8_t eNB_index,int CC_id);
/*! \fn int use_cba_access(module_id_t module_idP,frame_t frameP,sub_frame_t subframe, uint8_t eNB_index);
\brief determine whether to use cba resource to transmit or not
@@ -656,5 +656,101 @@ void update_ul_dci(module_id_t module_idP,uint8_t CC_id,rnti_t rnti,uint8_t dai)
int get_min_rb_unit(module_id_t module_idP, uint8_t CC_id);
+/* \brief Generate header for DL-SCH. This function parses the desired control elements and sdus and generates the header as described
+in 36-321 MAC layer specifications. It returns the number of bytes used for the header to be used as an offset for the payload
+in the DLSCH buffer.
+@param mac_header Pointer to the first byte of the MAC header (DL-SCH buffer)
+@param num_sdus Number of SDUs in the payload
+@param sdu_lengths Pointer to array of SDU lengths
+@param sdu_lcids Pointer to array of LCIDs (the order must be the same as the SDU length array)
+@param drx_cmd dicontinous reception command
+@param timing_advancd_cmd timing advanced command
+@param ue_cont_res_id Pointer to contention resolution identifier (NULL means not present in payload)
+@param short_padding Number of bytes for short padding (0,1,2)
+@param post_padding number of bytes for padding at the end of MAC PDU
+@returns Number of bytes used for header
+*/
+unsigned char generate_dlsch_header(unsigned char *mac_header,
+ unsigned char num_sdus,
+ unsigned short *sdu_lengths,
+ unsigned char *sdu_lcids,
+ unsigned char drx_cmd,
+ short timing_advance_cmd,
+ unsigned char *ue_cont_res_id,
+ unsigned char short_padding,
+ unsigned short post_padding);
+
+/** \brief RRC Configuration primitive for PHY/MAC. Allows configuration of PHY/MAC resources based on System Information (SI), RRCConnectionSetup and RRCConnectionReconfiguration messages.
+@param Mod_id Instance ID of eNB
+@param eNB_flag Indicates if this is a eNB or UE configuration
+@param UE_id Index of UE if this is an eNB configuration
+@param eNB_id Index of eNB if this is a UE configuration
+@param radioResourceConfigCommon Structure from SIB2 for common radio parameters (if NULL keep existing configuration)
+@param physcialConfigDedicated Structure from RRCConnectionSetup or RRCConnectionReconfiguration for dedicated PHY parameters (if NULL keep existing configuration)
+@param measObj Structure from RRCConnectionReconfiguration for UE measurement procedures
+@param mac_MainConfig Structure from RRCConnectionSetup or RRCConnectionReconfiguration for dedicated MAC parameters (if NULL keep existing configuration)
+@param logicalChannelIdentity Logical channel identity index of corresponding logical channel config
+@param logicalChannelConfig Pointer to logical channel configuration
+@param measGapConfig Measurement Gap configuration for MAC (if NULL keep existing configuration)
+@param tdd_Config TDD Configuration from SIB1 (if NULL keep existing configuration)
+@param mobilityControlInfo mobility control info received for Handover
+@param SIwindowsize SI Windowsize from SIB1 (if NULL keep existing configuration)
+@param SIperiod SI Period from SIB1 (if NULL keep existing configuration)
+@param MBMS_Flag indicates MBMS transmission
+@param mbsfn_SubframeConfigList pointer to mbsfn subframe configuration list from SIB2
+@param mbsfn_AreaInfoList pointer to MBSFN Area Info list from SIB13
+@param pmch_InfoList pointer to PMCH_InfoList from MBSFNAreaConfiguration Message (MCCH Message)
+*/
+int rrc_mac_config_req(module_id_t module_idP,
+ eNB_flag_t eNB_flag,
+ uint8_t UE_id,
+ uint8_t eNB_index,
+ RadioResourceConfigCommonSIB_t *radioResourceConfigCommon,
+ struct PhysicalConfigDedicated *physicalConfigDedicated,
+#ifdef Rel10
+ SCellToAddMod_r10_t *sCellToAddMod_r10,
+ //struct PhysicalConfigDedicatedSCell_r10 *physicalConfigDedicatedSCell_r10,
+#endif
+ MeasObjectToAddMod_t **measObj,
+ MAC_MainConfig_t *mac_MainConfig,
+ long logicalChannelIdentity,
+ LogicalChannelConfig_t *logicalChannelConfig,
+ MeasGapConfig_t *measGapConfig,
+ TDD_Config_t *tdd_Config,
+ MobilityControlInfo_t *mobilityControlInfo,
+ uint8_t *SIwindowsize,
+ uint16_t *SIperiod,
+ ARFCN_ValueEUTRA_t *ul_CarrierFreq,
+ long *ul_Bandwidth,
+ AdditionalSpectrumEmission_t *additionalSpectrumEmission,
+ struct MBSFN_SubframeConfigList *mbsfn_SubframeConfigList
+#ifdef Rel10
+ ,
+ uint8_t MBMS_Flag,
+ MBSFN_AreaInfoList_r9_t *mbsfn_AreaInfoList,
+ PMCH_InfoList_r9_t *pmch_InfoList
+
+#endif
+#ifdef CBA
+ ,
+ uint8_t num_active_cba_groups,
+ uint16_t cba_rnti
+#endif
+ );
+
+/** \brief get the estimated UE distance from the PHY->MAC layer.
+@param Mod_id Instance ID of eNB
+@param UE_id Index of UE if this is an eNB configuration
+@param CC_id Component Carrier Index
+@param loc_type localization type: time-based or power-based
+@return the estimated distance in meters
+ */
+double
+rrc_get_estimated_ue_distance(module_id_t Mod_id,
+ const frame_t frameP,
+ uint8_t UE_id,
+ int CC_id,
+ uint8_t loc_type);
+
#endif
diff --git a/openair2/LAYER2/MAC/ue_procedures.c b/openair2/LAYER2/MAC/ue_procedures.c
index a75512cebb..8d1bf3b254 100644
--- a/openair2/LAYER2/MAC/ue_procedures.c
+++ b/openair2/LAYER2/MAC/ue_procedures.c
@@ -1311,7 +1311,7 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf
// 3. Perform SR/BSR procedures for scheduling feedback
// 4. Perform PHR procedures
-UE_L2_STATE_t ue_scheduler(module_id_t module_idP,frame_t frameP, sub_frame_t subframeP, lte_subframe_t directionP,uint8_t eNB_indexP) {
+UE_L2_STATE_t ue_scheduler(module_id_t module_idP,frame_t frameP, sub_frame_t subframeP, lte_subframe_t directionP,uint8_t eNB_indexP,int CC_id) {
int lcid; // lcid index
int TTI= 1;
@@ -1377,7 +1377,8 @@ UE_L2_STATE_t ue_scheduler(module_id_t module_idP,frame_t frameP, sub_frame_t su
switch (rrc_rx_tx(module_idP,
frameP,
0,
- eNB_indexP)) {
+ eNB_indexP,
+ CC_id)) {
case RRC_OK:
break;
case RRC_ConnSetup_failed:
diff --git a/openair2/RRC/LITE/defs.h b/openair2/RRC/LITE/defs.h
index b79431d7a0..dedf3d9b1d 100644
--- a/openair2/RRC/LITE/defs.h
+++ b/openair2/RRC/LITE/defs.h
@@ -366,6 +366,16 @@ typedef struct eNB_RRC_INST_s {
/* Used integrity/ciphering algorithms */
e_SecurityAlgorithmConfig__cipheringAlgorithm ciphering_algorithm[NUMBER_OF_UE_MAX];
e_SecurityAlgorithmConfig__integrityProtAlgorithm integrity_algorithm[NUMBER_OF_UE_MAX];
+#ifdef LOCALIZATION
+ /// localization type, 0: power based, 1: time based
+ uint8_t loc_type;
+ /// epoch timestamp in millisecond, RRC
+ int32_t reference_timestamp_ms;
+ /// aggregate physical states every n millisecond
+ int32_t aggregation_period_ms;
+ /// localization list for aggregated measurements from PHY
+ struct list loc_list;
+#endif
} eNB_RRC_INST;
#define MAX_UE_CAPABILITY_SIZE 255
@@ -458,237 +468,7 @@ typedef struct UE_RRC_INST_s {
e_SecurityAlgorithmConfig__integrityProtAlgorithm integrity_algorithm;
} UE_RRC_INST;
-//main.c
-int rrc_init_global_param(void);
-int L3_xface_init(void);
-void openair_rrc_top_init(int eMBMS_active, uint8_t cba_group_active,uint8_t HO_enabled);
-char openair_rrc_lite_eNB_init(module_id_t module_idP);
-char openair_rrc_lite_ue_init(module_id_t module_idP,uint8_t CH_IDX);
-void rrc_config_buffer(SRB_INFO *srb_info, uint8_t Lchan_type, uint8_t Role);
-void openair_rrc_on(module_id_t module_idP, eNB_flag_t eNB_flagP);
-void rrc_top_cleanup(void);
-
-/** \brief Function to update timers every subframe. For UE it updates T300,T304 and T310.
-@param module_idP Instance of UE/eNB
-@param frame Frame index
-@param eNB_flag Flag to indicate if this instance is and eNB or UE
-@param index Index of corresponding eNB (for UE)
-*/
-RRC_status_t rrc_rx_tx(module_id_t module_idP,frame_t frameP, eNB_flag_t eNB_flagP,uint8_t index);
-
-// UE RRC Procedures
-
-/** \brief Decodes DL-CCCH message and invokes appropriate routine to handle the message
- \param module_idP Instance ID of UE
- \param Srb_info Pointer to SRB_INFO structure (SRB0)
- \param eNB_index Index of corresponding eNB/CH*/
-int rrc_ue_decode_ccch(module_id_t module_idP, frame_t frameP, SRB_INFO *Srb_info,uint8_t eNB_index);
-
-/** \brief Decodes a DL-DCCH message and invokes appropriate routine to handle the message
- \param module_idP Instance ID of UE
- \param frame Frame index
- \param Srb_id Index of Srb (1,2)
- \param buffer_pP Pointer to received SDU
- \param eNB_index Index of corresponding CH/eNB*/
-void rrc_ue_decode_dcch(module_id_t module_idP, frame_t frameP, uint8_t Srb_id, uint8_t* buffer_pP,uint8_t eNB_index);
-
-/** \brief Generate/Encodes RRCConnnectionRequest message at UE
- \param module_idP Instance ID of UE
- \param frame Frame index
- \param Srb_id Index of Srb (1,2)
- \param eNB_index Index of corresponding eNB/CH*/
-void rrc_ue_generate_RRCConnectionRequest(module_id_t module_idP, frame_t frameP, uint8_t eNB_index);
-
-/** \brief Generates/Encodes RRCConnnectionSetupComplete message at UE
- \param module_idP Instance ID of UE
- \param frame Frame index
- \param eNB_index Index of corresponding eNB/CH*/
-void rrc_ue_generate_RRCConnectionSetupComplete(module_id_t module_idP,frame_t frameP,uint8_t eNB_index, uint8_t Transaction_id);
-
-/** \brief process the received rrcConnectionReconfiguration message at UE
- \param module_idP Instance ID of UE
- \param frame Frame index
- \param *rrcConnectionReconfiguration pointer to the sturcture
- \param eNB_index Index of corresponding eNB/CH*/
-void rrc_ue_process_rrcConnectionReconfiguration(module_id_t module_idP, frame_t frameP,RRCConnectionReconfiguration_t *rrcConnectionReconfiguration,uint8_t eNB_index);
-
-/** \brief Generates/Encodes RRCConnectionReconfigurationComplete message at UE
- \param module_idP Instance ID of UE
- \param frame Frame index
- \param eNB_index Index of corresponding eNB/CH*/
-void rrc_ue_generate_RRCConnectionReconfigurationComplete(module_id_t module_idP, frame_t frameP, uint8_t eNB_index, uint8_t Transaction_id);
-
-/** \brief Establish SRB1 based on configuration in SRB_ToAddMod structure. Configures RLC/PDCP accordingly
- \param module_idP Instance ID of UE
- \param frame Frame index
- \param eNB_index Index of corresponding eNB/CH
- \param SRB_config Pointer to SRB_ToAddMod IE from configuration
- @returns 0 on success*/
-int32_t rrc_ue_establish_srb1(module_id_t module_idP,frame_t frameP,uint8_t eNB_index,struct SRB_ToAddMod *SRB_config);
-
-/** \brief Establish SRB2 based on configuration in SRB_ToAddMod structure. Configures RLC/PDCP accordingly
- \param module_idP Instance ID of UE
- \param frame Frame index
- \param eNB_index Index of corresponding eNB/CH
- \param SRB_config Pointer to SRB_ToAddMod IE from configuration
- @returns 0 on success*/
-int32_t rrc_ue_establish_srb2(module_id_t module_idP,frame_t frameP, uint8_t eNB_index,struct SRB_ToAddMod *SRB_config);
-
-/** \brief Establish a DRB according to DRB_ToAddMod structure
- \param module_idP Instance ID of UE
- \param eNB_index Index of corresponding CH/eNB
- \param DRB_config Pointer to DRB_ToAddMod IE from configuration
- @returns 0 on success */
-int32_t rrc_ue_establish_drb(module_id_t module_idP,frame_t frameP,uint8_t eNB_index,struct DRB_ToAddMod *DRB_config);
-
-/** \brief Process MobilityControlInfo Message to proceed with handover and configure PHY/MAC
- \param module_idP Instance of UE on which to act
- \param frame frame time interval
- \param eNB_index Index of corresponding CH/eNB
- \param mobilityControlInfo Pointer to mobilityControlInfo
-*/
-void rrc_ue_process_mobilityControlInfo(module_id_t enb_module_idP, module_id_t ue_module_idP, frame_t frameP, struct MobilityControlInfo *mobilityControlInfo);
-
-/** \brief Process a measConfig Message and configure PHY/MAC
- \param module_idP Instance of UE on which to act
- \param frame frame time interval
- \param eNB_index Index of corresponding CH/eNB
- \param measConfig Pointer to MeasConfig IE from configuration*/
-void rrc_ue_process_measConfig(module_id_t module_idP,frame_t frameP, uint8_t eNB_index,MeasConfig_t *measConfig);
-
-/** \brief Process a RadioResourceConfigDedicated Message and configure PHY/MAC
- \param module_idP Instance of UE on which to act
- \param eNB_index Index of corresponding CH/eNB
- \param radioResourceConfigDedicated Pointer to RadioResourceConfigDedicated IE from configuration*/
-void rrc_ue_process_radioResourceConfigDedicated(module_id_t module_idP,frame_t frameP, uint8_t eNB_index,
- RadioResourceConfigDedicated_t *radioResourceConfigDedicated);
-
-// eNB/CH RRC Procedures
-
-/**\brief Function to get the next transaction identifier.
- \param module_idP Instance ID for CH/eNB
- \return a transaction identifier*/
-uint8_t rrc_eNB_get_next_transaction_identifier(module_id_t module_idP);
-
-/**\brief Entry routine to decode a UL-CCCH-Message. Invokes PER decoder and parses message.
- \param module_idP Instance ID for CH/eNB
- \param frame Frame index
- \param Srb_info Pointer to SRB0 information structure (buffer, etc.)*/
-int rrc_eNB_decode_ccch(module_id_t module_idP, frame_t frameP, SRB_INFO *Srb_info);
-
-/**\brief Entry routine to decode a UL-DCCH-Message. Invokes PER decoder and parses message.
- \param module_idP Instance ID for CH/eNB
- \param frame Frame index
- \param ue_module_idP Index of UE sending the message
- \param Rx_sdu Pointer Received Message
- \param sdu_size Size of incoming SDU*/
-int rrc_eNB_decode_dcch(module_id_t module_idP, frame_t frameP, uint8_t Srb_id, module_id_t ue_module_idP, uint8_t *Rx_sdu, sdu_size_t sdu_size);
-
-/**\brief Generate the RRCConnectionSetup based on information coming from RRM
- \param module_idP Instance ID for eNB/CH
- \param frame Frame index
- \param ue_module_idP Index of UE receiving the message*/
-void rrc_eNB_generate_RRCConnectionSetup(module_id_t module_idP,frame_t frameP, module_id_t ue_module_idP);
-
-/**\brief Process the RRCConnectionSetupComplete based on information coming from UE
- \param module_idP Instance ID for eNB/CH
- \param frame Frame index
- \param ue_module_idP Index of UE transmitting the message
- \param rrcConnectionSetupComplete Pointer to RRCConnectionSetupComplete message*/
-void rrc_eNB_process_RRCConnectionSetupComplete(module_id_t module_idP, frame_t frameP, module_id_t ue_module_idP,
- RRCConnectionSetupComplete_r8_IEs_t *rrcConnectionSetupComplete);
-
-/**\brief Process the RRCConnectionReconfigurationComplete based on information coming from UE
- \param module_idP Instance ID for eNB/CH
- \param ue_module_idP Index of UE transmitting the messages
- \param rrcConnectionReconfigurationComplete Pointer to RRCConnectionReconfigurationComplete message*/
-void rrc_eNB_process_RRCConnectionReconfigurationComplete(module_id_t module_idP,frame_t frameP,module_id_t ue_module_idP,RRCConnectionReconfigurationComplete_r8_IEs_t *rrcConnectionReconfigurationComplete);
-
-/**\brief Generate the RRCConnectionRelease
- \param module_idP Instance ID for eNB
- \param frame Frame index
- \param ue_module_idP Index of UE receiving the message*/
-void rrc_eNB_generate_RRCConnectionRelease(module_id_t module_idP,frame_t frameP, ue_id_t ue_idP);
-
-#if defined(ENABLE_ITTI)
-/**\brief RRC eNB task.
- \param void *args_p Pointer on arguments to start the task. */
-void *rrc_enb_task(void *args_p);
-
-/**\brief RRC UE task.
- \param void *args_p Pointer on arguments to start the task. */
-void *rrc_ue_task(void *args_p);
-#endif
-
-/**\brief Generate/decode the handover RRCConnectionReconfiguration at eNB
- \param module_idP Instance ID for eNB/CH
- \param frame Frame index
- \param ue_module_idP Index of UE transmitting the messages*/
-void rrc_eNB_generate_RRCConnectionReconfiguration_handover(module_id_t module_idP, frame_t frameP, module_id_t ue_module_idP, uint8_t *nas_pdu, uint32_t nas_length);
-
-//L2_interface.c
-int8_t mac_rrc_lite_data_req( module_id_t module_idP, frame_t frameP, rb_id_t Srb_id, uint8_t Nb_tb, uint8_t *buffer_pP,eNB_flag_t eNB_flagP, uint8_t eNB_index, uint8_t mbsfn_sync_area);
-
-int8_t mac_rrc_lite_data_ind( module_id_t module_idP, frame_t frameP, rb_id_t Srb_id, uint8_t *Sdu, sdu_size_t Sdu_len,eNB_flag_t eNB_flagP,uint8_t eNB_index, uint8_t mbsfn_sync_area);
-
-void mac_sync_ind( module_id_t Mod_instP, uint8_t status);
-
-uint8_t rrc_lite_data_req(module_id_t enb_mod_idP,
- module_id_t ue_mod_idP,
- frame_t frameP,
- eNB_flag_t eNB_flagP,
- rb_id_t rb_idP,
- mui_t muiP,
- confirm_t confirmP,
- sdu_size_t sdu_sizeP,
- uint8_t *Buffer_pP,
- pdcp_transmission_mode_t modeP);
-
-void rrc_lite_data_ind(module_id_t eNB_id, module_id_t UE_id, frame_t frameP, eNB_flag_t eNB_flagP, rb_id_t Rb_id, sdu_size_t sdu_size,uint8_t *buffer_pP);
-
-void rrc_lite_in_sync_ind(module_id_t module_idP, frame_t frameP, uint16_t eNB_index);
-
-void rrc_lite_out_of_sync_ind(module_id_t module_idP, frame_t frameP, unsigned short eNB_index);
-
-int decode_MCCH_Message(module_id_t module_idP, frame_t frameP, uint8_t eNB_index, uint8_t *Sdu, uint8_t Sdu_len,uint8_t mbsfn_sync_area);
-
-void decode_MBSFNAreaConfiguration(module_id_t module_idP, uint8_t eNB_index, frame_t frameP,uint8_t mbsfn_sync_area);
-
-int decode_BCCH_DLSCH_Message(module_id_t module_idP,frame_t frameP,uint8_t eNB_index,uint8_t *Sdu,uint8_t Sdu_len, uint8_t rsrq, uint8_t rsrp);
-
-int decode_SIB1(module_id_t module_idP,uint8_t eNB_index, uint8_t rsrq, uint8_t rsrp);
-
-int decode_SI(module_id_t module_idP,frame_t frameP,uint8_t eNB_index,uint8_t si_window);
-
-void ue_meas_filtering(module_id_t module_idP,frame_t frameP,uint8_t eNB_index);
-
-void ue_measurement_report_triggering(module_id_t module_idP, frame_t frameP,uint8_t eNB_index);
-
-int mac_get_rrc_lite_status(module_id_t module_idP,eNB_flag_t eNB_flagP,uint8_t index);
-
-void rrc_eNB_generate_UECapabilityEnquiry(module_id_t module_idP, frame_t frameP, module_id_t ue_module_idP);
-
-void rrc_eNB_generate_SecurityModeCommand(module_id_t module_idP, frame_t frameP, module_id_t ue_module_idP);
-
-void rrc_eNB_process_MeasurementReport(uint8_t module_idP,frame_t frameP, module_id_t ue_module_idP,MeasResults_t *measResults2) ;
-
-void rrc_ue_generate_MeasurementReport(module_id_t eNB_id, module_id_t UE_id, frame_t frameP);
-
-void rrc_eNB_generate_HandoverPreparationInformation (uint8_t module_idP, frame_t frameP, module_id_t ue_module_idP, PhysCellId_t targetPhyId) ;
-
-void check_handovers(uint8_t module_idP, frame_t frameP);
-
-uint8_t check_trigger_meas_event(uint8_t module_idP,frame_t frameP, uint8_t eNB_index, uint8_t ue_cnx_index, uint8_t meas_index,
- Q_OffsetRange_t ofn, Q_OffsetRange_t ocn, Hysteresis_t hys,
- Q_OffsetRange_t ofs, Q_OffsetRange_t ocs, long a3_offset, TimeToTrigger_t ttt);
-
-//void rrc_ue_process_ueCapabilityEnquiry(uint8_t module_idP,uint32_t frame,UECapabilityEnquiry_t *UECapabilityEnquiry,uint8_t eNB_index);
-//void rrc_ue_process_securityModeCommand(uint8_t module_idP,uint32_t frame,SecurityModeCommand_t *securityModeCommand,uint8_t eNB_index);
-
-void rrc_eNB_free_UE_index (module_id_t enb_mod_idP, module_id_t ue_mod_idP);
-
-long binary_search_int(int elements[], long numElem, int value);
+#include "proto.h"
-long binary_search_float(float elements[], long numElem, float value);
#endif
/** @ */
diff --git a/openair2/RRC/LITE/proto.h b/openair2/RRC/LITE/proto.h
new file mode 100644
index 0000000000..8bf332eeb8
--- /dev/null
+++ b/openair2/RRC/LITE/proto.h
@@ -0,0 +1,271 @@
+/*******************************************************************************
+ OpenAirInterface
+ Copyright(c) 1999 - 2014 Eurecom
+
+ OpenAirInterface is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+
+ OpenAirInterface is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenAirInterface.The full GNU General Public License is
+ included in this distribution in the file called "COPYING". If not,
+ see <http://www.gnu.org/licenses/>.
+
+ Contact Information
+ OpenAirInterface Admin: openair_admin@eurecom.fr
+ OpenAirInterface Tech : openair_tech@eurecom.fr
+ OpenAirInterface Dev : openair4g-devel@eurecom.fr
+
+ Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
+
+*******************************************************************************/
+/*! \file proto.h
+ * \brief RRC functions prototypes for eNB and UE
+ * \author Navid Nikaein and Raymond Knopp
+ * \date 2010 - 2014
+ * \email navid.nikaein@eurecom.fr
+ * \version 1.0
+ * @ingroup _rrc
+
+ */
+
+//main.c
+int rrc_init_global_param(void);
+int L3_xface_init(void);
+void openair_rrc_top_init(int eMBMS_active, uint8_t cba_group_active,uint8_t HO_enabled);
+char openair_rrc_lite_eNB_init(module_id_t module_idP);
+char openair_rrc_lite_ue_init(module_id_t module_idP,uint8_t CH_IDX);
+void rrc_config_buffer(SRB_INFO *srb_info, uint8_t Lchan_type, uint8_t Role);
+void openair_rrc_on(module_id_t module_idP, eNB_flag_t eNB_flagP);
+void rrc_top_cleanup(void);
+
+/** \brief Function to update timers every subframe. For UE it updates T300,T304 and T310.
+@param module_idP Instance of UE/eNB
+@param frame Frame index
+@param eNB_flag Flag to indicate if this instance is and eNB or UE
+@param index Index of corresponding eNB (for UE)
+*/
+RRC_status_t rrc_rx_tx(module_id_t module_idP,frame_t frameP, eNB_flag_t eNB_flagP,uint8_t index,int CC_id);
+
+// UE RRC Procedures
+
+/** \brief Decodes DL-CCCH message and invokes appropriate routine to handle the message
+ \param module_idP Instance ID of UE
+ \param Srb_info Pointer to SRB_INFO structure (SRB0)
+ \param eNB_index Index of corresponding eNB/CH*/
+int rrc_ue_decode_ccch(module_id_t module_idP, frame_t frameP, SRB_INFO *Srb_info,uint8_t eNB_index);
+
+/** \brief Decodes a DL-DCCH message and invokes appropriate routine to handle the message
+ \param module_idP Instance ID of UE
+ \param frame Frame index
+ \param Srb_id Index of Srb (1,2)
+ \param buffer_pP Pointer to received SDU
+ \param eNB_index Index of corresponding CH/eNB*/
+void rrc_ue_decode_dcch(module_id_t module_idP, frame_t frameP, uint8_t Srb_id, uint8_t* buffer_pP,uint8_t eNB_index);
+
+/** \brief Generate/Encodes RRCConnnectionRequest message at UE
+ \param module_idP Instance ID of UE
+ \param frame Frame index
+ \param Srb_id Index of Srb (1,2)
+ \param eNB_index Index of corresponding eNB/CH*/
+void rrc_ue_generate_RRCConnectionRequest(module_id_t module_idP, frame_t frameP, uint8_t eNB_index);
+
+/** \brief Generates/Encodes RRCConnnectionSetupComplete message at UE
+ \param module_idP Instance ID of UE
+ \param frame Frame index
+ \param eNB_index Index of corresponding eNB/CH*/
+void rrc_ue_generate_RRCConnectionSetupComplete(module_id_t module_idP,frame_t frameP,uint8_t eNB_index, uint8_t Transaction_id);
+
+/** \brief process the received rrcConnectionReconfiguration message at UE
+ \param module_idP Instance ID of UE
+ \param frame Frame index
+ \param *rrcConnectionReconfiguration pointer to the sturcture
+ \param eNB_index Index of corresponding eNB/CH*/
+void rrc_ue_process_rrcConnectionReconfiguration(module_id_t module_idP, frame_t frameP,RRCConnectionReconfiguration_t *rrcConnectionReconfiguration,uint8_t eNB_index);
+
+/** \brief Generates/Encodes RRCConnectionReconfigurationComplete message at UE
+ \param module_idP Instance ID of UE
+ \param frame Frame index
+ \param eNB_index Index of corresponding eNB/CH*/
+void rrc_ue_generate_RRCConnectionReconfigurationComplete(module_id_t module_idP, frame_t frameP, uint8_t eNB_index, uint8_t Transaction_id);
+
+/** \brief Establish SRB1 based on configuration in SRB_ToAddMod structure. Configures RLC/PDCP accordingly
+ \param module_idP Instance ID of UE
+ \param frame Frame index
+ \param eNB_index Index of corresponding eNB/CH
+ \param SRB_config Pointer to SRB_ToAddMod IE from configuration
+ @returns 0 on success*/
+int32_t rrc_ue_establish_srb1(module_id_t module_idP,frame_t frameP,uint8_t eNB_index,struct SRB_ToAddMod *SRB_config);
+
+/** \brief Establish SRB2 based on configuration in SRB_ToAddMod structure. Configures RLC/PDCP accordingly
+ \param module_idP Instance ID of UE
+ \param frame Frame index
+ \param eNB_index Index of corresponding eNB/CH
+ \param SRB_config Pointer to SRB_ToAddMod IE from configuration
+ @returns 0 on success*/
+int32_t rrc_ue_establish_srb2(module_id_t module_idP,frame_t frameP, uint8_t eNB_index,struct SRB_ToAddMod *SRB_config);
+
+/** \brief Establish a DRB according to DRB_ToAddMod structure
+ \param module_idP Instance ID of UE
+ \param eNB_index Index of corresponding CH/eNB
+ \param DRB_config Pointer to DRB_ToAddMod IE from configuration
+ @returns 0 on success */
+int32_t rrc_ue_establish_drb(module_id_t module_idP,frame_t frameP,uint8_t eNB_index,struct DRB_ToAddMod *DRB_config);
+
+/** \brief Process MobilityControlInfo Message to proceed with handover and configure PHY/MAC
+ \param module_idP Instance of UE on which to act
+ \param frame frame time interval
+ \param eNB_index Index of corresponding CH/eNB
+ \param mobilityControlInfo Pointer to mobilityControlInfo
+*/
+void rrc_ue_process_mobilityControlInfo(module_id_t enb_module_idP, module_id_t ue_module_idP, frame_t frameP, struct MobilityControlInfo *mobilityControlInfo);
+
+/** \brief Process a measConfig Message and configure PHY/MAC
+ \param module_idP Instance of UE on which to act
+ \param frame frame time interval
+ \param eNB_index Index of corresponding CH/eNB
+ \param measConfig Pointer to MeasConfig IE from configuration*/
+void rrc_ue_process_measConfig(module_id_t module_idP,frame_t frameP, uint8_t eNB_index,MeasConfig_t *measConfig);
+
+/** \brief Process a RadioResourceConfigDedicated Message and configure PHY/MAC
+ \param module_idP Instance of UE on which to act
+ \param eNB_index Index of corresponding CH/eNB
+ \param radioResourceConfigDedicated Pointer to RadioResourceConfigDedicated IE from configuration*/
+void rrc_ue_process_radioResourceConfigDedicated(module_id_t module_idP,frame_t frameP, uint8_t eNB_index,
+ RadioResourceConfigDedicated_t *radioResourceConfigDedicated);
+
+// eNB/CH RRC Procedures
+
+/**\brief Function to get the next transaction identifier.
+ \param module_idP Instance ID for CH/eNB
+ \return a transaction identifier*/
+uint8_t rrc_eNB_get_next_transaction_identifier(module_id_t module_idP);
+
+/**\brief Entry routine to decode a UL-CCCH-Message. Invokes PER decoder and parses message.
+ \param module_idP Instance ID for CH/eNB
+ \param frame Frame index
+ \param Srb_info Pointer to SRB0 information structure (buffer, etc.)*/
+int rrc_eNB_decode_ccch(module_id_t module_idP, frame_t frameP, SRB_INFO *Srb_info);
+
+/**\brief Entry routine to decode a UL-DCCH-Message. Invokes PER decoder and parses message.
+ \param module_idP Instance ID for CH/eNB
+ \param frame Frame index
+ \param ue_module_idP Index of UE sending the message
+ \param Rx_sdu Pointer Received Message
+ \param sdu_size Size of incoming SDU*/
+int rrc_eNB_decode_dcch(module_id_t module_idP, frame_t frameP, uint8_t Srb_id, module_id_t ue_module_idP, uint8_t *Rx_sdu, sdu_size_t sdu_size);
+
+/**\brief Generate the RRCConnectionSetup based on information coming from RRM
+ \param module_idP Instance ID for eNB/CH
+ \param frame Frame index
+ \param ue_module_idP Index of UE receiving the message*/
+void rrc_eNB_generate_RRCConnectionSetup(module_id_t module_idP,frame_t frameP, module_id_t ue_module_idP);
+
+/**\brief Process the RRCConnectionSetupComplete based on information coming from UE
+ \param module_idP Instance ID for eNB/CH
+ \param frame Frame index
+ \param ue_module_idP Index of UE transmitting the message
+ \param rrcConnectionSetupComplete Pointer to RRCConnectionSetupComplete message*/
+void rrc_eNB_process_RRCConnectionSetupComplete(module_id_t module_idP, frame_t frameP, module_id_t ue_module_idP,
+ RRCConnectionSetupComplete_r8_IEs_t *rrcConnectionSetupComplete);
+
+/**\brief Process the RRCConnectionReconfigurationComplete based on information coming from UE
+ \param module_idP Instance ID for eNB/CH
+ \param ue_module_idP Index of UE transmitting the messages
+ \param rrcConnectionReconfigurationComplete Pointer to RRCConnectionReconfigurationComplete message*/
+void rrc_eNB_process_RRCConnectionReconfigurationComplete(module_id_t module_idP,frame_t frameP,module_id_t ue_module_idP,RRCConnectionReconfigurationComplete_r8_IEs_t *rrcConnectionReconfigurationComplete);
+
+/**\brief Generate the RRCConnectionRelease
+ \param module_idP Instance ID for eNB
+ \param frame Frame index
+ \param ue_module_idP Index of UE receiving the message*/
+void rrc_eNB_generate_RRCConnectionRelease(module_id_t module_idP,frame_t frameP, ue_id_t ue_idP);
+
+#if defined(ENABLE_ITTI)
+/**\brief RRC eNB task.
+ \param void *args_p Pointer on arguments to start the task. */
+void *rrc_enb_task(void *args_p);
+
+/**\brief RRC UE task.
+ \param void *args_p Pointer on arguments to start the task. */
+void *rrc_ue_task(void *args_p);
+#endif
+
+/**\brief Generate/decode the handover RRCConnectionReconfiguration at eNB
+ \param module_idP Instance ID for eNB/CH
+ \param frame Frame index
+ \param ue_module_idP Index of UE transmitting the messages*/
+void rrc_eNB_generate_RRCConnectionReconfiguration_handover(module_id_t module_idP, frame_t frameP, module_id_t ue_module_idP, uint8_t *nas_pdu, uint32_t nas_length);
+
+//L2_interface.c
+int8_t mac_rrc_lite_data_req( module_id_t module_idP, frame_t frameP, rb_id_t Srb_id, uint8_t Nb_tb, uint8_t *buffer_pP,eNB_flag_t eNB_flagP, uint8_t eNB_index, uint8_t mbsfn_sync_area);
+
+int8_t mac_rrc_lite_data_ind( module_id_t module_idP, frame_t frameP, rb_id_t Srb_id, uint8_t *Sdu, sdu_size_t Sdu_len,eNB_flag_t eNB_flagP,uint8_t eNB_index, uint8_t mbsfn_sync_area);
+
+void mac_sync_ind( module_id_t Mod_instP, uint8_t status);
+
+uint8_t rrc_lite_data_req(module_id_t enb_mod_idP,
+ module_id_t ue_mod_idP,
+ frame_t frameP,
+ eNB_flag_t eNB_flagP,
+ rb_id_t rb_idP,
+ mui_t muiP,
+ confirm_t confirmP,
+ sdu_size_t sdu_sizeP,
+ uint8_t *Buffer_pP,
+ pdcp_transmission_mode_t modeP);
+
+void rrc_lite_data_ind(module_id_t eNB_id, module_id_t UE_id, frame_t frameP, eNB_flag_t eNB_flagP, rb_id_t Rb_id, sdu_size_t sdu_size,uint8_t *buffer_pP);
+
+void rrc_lite_in_sync_ind(module_id_t module_idP, frame_t frameP, uint16_t eNB_index);
+
+void rrc_lite_out_of_sync_ind(module_id_t module_idP, frame_t frameP, unsigned short eNB_index);
+
+int decode_MCCH_Message(module_id_t module_idP, frame_t frameP, uint8_t eNB_index, uint8_t *Sdu, uint8_t Sdu_len,uint8_t mbsfn_sync_area);
+
+void decode_MBSFNAreaConfiguration(module_id_t module_idP, uint8_t eNB_index, frame_t frameP,uint8_t mbsfn_sync_area);
+
+int decode_BCCH_DLSCH_Message(module_id_t module_idP,frame_t frameP,uint8_t eNB_index,uint8_t *Sdu,uint8_t Sdu_len, uint8_t rsrq, uint8_t rsrp);
+
+int decode_SIB1(module_id_t module_idP,uint8_t eNB_index, uint8_t rsrq, uint8_t rsrp);
+
+int decode_SI(module_id_t module_idP,frame_t frameP,uint8_t eNB_index,uint8_t si_window);
+
+void ue_meas_filtering(module_id_t module_idP,frame_t frameP,uint8_t eNB_index);
+
+void ue_measurement_report_triggering(module_id_t module_idP, frame_t frameP,uint8_t eNB_index);
+
+int mac_get_rrc_lite_status(module_id_t module_idP,eNB_flag_t eNB_flagP,uint8_t index);
+
+void rrc_eNB_generate_UECapabilityEnquiry(module_id_t module_idP, frame_t frameP, module_id_t ue_module_idP);
+
+void rrc_eNB_generate_SecurityModeCommand(module_id_t module_idP, frame_t frameP, module_id_t ue_module_idP);
+
+void rrc_eNB_process_MeasurementReport(uint8_t module_idP,frame_t frameP, module_id_t ue_module_idP,MeasResults_t *measResults2) ;
+
+void rrc_ue_generate_MeasurementReport(module_id_t eNB_id, module_id_t UE_id, frame_t frameP);
+
+void rrc_eNB_generate_HandoverPreparationInformation (uint8_t module_idP, frame_t frameP, module_id_t ue_module_idP, PhysCellId_t targetPhyId) ;
+
+void check_handovers(uint8_t module_idP, frame_t frameP);
+
+uint8_t check_trigger_meas_event(uint8_t module_idP,frame_t frameP, uint8_t eNB_index, uint8_t ue_cnx_index, uint8_t meas_index,
+ Q_OffsetRange_t ofn, Q_OffsetRange_t ocn, Hysteresis_t hys,
+ Q_OffsetRange_t ofs, Q_OffsetRange_t ocs, long a3_offset, TimeToTrigger_t ttt);
+
+//void rrc_ue_process_ueCapabilityEnquiry(uint8_t module_idP,uint32_t frame,UECapabilityEnquiry_t *UECapabilityEnquiry,uint8_t eNB_index);
+//void rrc_ue_process_securityModeCommand(uint8_t module_idP,uint32_t frame,SecurityModeCommand_t *securityModeCommand,uint8_t eNB_index);
+
+void rrc_eNB_free_UE_index (module_id_t enb_mod_idP, module_id_t ue_mod_idP);
+
+long binary_search_int(int elements[], long numElem, int value);
+
+long binary_search_float(float elements[], long numElem, float value);
+
diff --git a/openair2/RRC/LITE/rrc_common.c b/openair2/RRC/LITE/rrc_common.c
index 957364a791..91366248f8 100644
--- a/openair2/RRC/LITE/rrc_common.c
+++ b/openair2/RRC/LITE/rrc_common.c
@@ -258,6 +258,17 @@ void openair_rrc_top_init(int eMBMS_active, uint8_t cba_group_active,uint8_t HO_
for (module_id=0;module_id<NB_eNB_INST;module_id++) {
eNB_rrc_inst[module_id].num_active_cba_groups = cba_group_active;
}
+#endif
+#ifdef LOCALIZATION
+ /* later set this from xml or enb.config file*/
+ struct timeval ts; // time struct
+ gettimeofday(&ts, NULL); // get the current epoch timestamp
+ for (module_id=0;module_id<NB_eNB_INST;module_id++) {
+ eNB_rrc_inst[module_id].reference_timestamp_ms = ts.tv_sec * 1000 + ts.tv_usec / 1000;
+ initialize(&eNB_rrc_inst[module_id].loc_list);
+ eNB_rrc_inst[module_id].loc_type=0;
+ eNB_rrc_inst[module_id].aggregation_period_ms = 5000;
+ }
#endif
LOG_D(RRC,
"ALLOCATE %d Bytes for eNB_RRC_INST @ %p\n", (unsigned int)(NB_eNB_INST*sizeof(eNB_RRC_INST)), eNB_rrc_inst);
@@ -318,8 +329,12 @@ void rrc_t310_expiration(const frame_t frameP, uint8_t Mod_id, uint8_t eNB_index
}
}
-RRC_status_t rrc_rx_tx(uint8_t Mod_id, const frame_t frameP, const eNB_flag_t eNB_flagP,uint8_t index){
+RRC_status_t rrc_rx_tx(uint8_t Mod_id, const frame_t frameP, const eNB_flag_t eNB_flagP,uint8_t index,int CC_id){
+ uint8_t UE_id;
+ int32_t current_timestamp_ms, ref_timestamp_ms;
+ struct timeval ts;
+
if(eNB_flagP == 0) {
// check timers
@@ -393,8 +408,34 @@ RRC_status_t rrc_rx_tx(uint8_t Mod_id, const frame_t frameP, const eNB_flag_t eN
}
}
- else {
+ else { // eNB
check_handovers(Mod_id,frameP);
+ // counetr, and get the value and aggregate
+#ifdef LOCALIZATION
+ /* for the localization, only primary CC_id might be relevant*/
+ gettimeofday(&ts, NULL);
+ current_timestamp_ms = ts.tv_sec * 1000 + ts.tv_usec / 1000;
+
+ ref_timestamp_ms = eNB_rrc_inst[Mod_id].reference_timestamp_ms;
+
+
+ for (UE_id=0; UE_id < NUMBER_OF_UE_MAX; UE_id++) {
+
+ if ((current_timestamp_ms - ref_timestamp_ms > eNB_rrc_inst[Mod_id].aggregation_period_ms) &&
+ rrc_get_estimated_ue_distance(Mod_id,frameP,UE_id, CC_id,eNB_rrc_inst[Mod_id].loc_type) != -1) {
+ LOG_D(LOCALIZE, " RRC [UE/id %d -> eNB/id %d] timestamp %d frame %d estimated r = %f\n",
+ UE_id,
+ Mod_id,
+ current_timestamp_ms,
+ frameP,
+ rrc_get_estimated_ue_distance(Mod_id,frameP,UE_id, CC_id,eNB_rrc_inst[Mod_id].loc_type));
+ LOG_D(LOCALIZE, " RRC status %d\n", eNB_rrc_inst[Mod_id].Info.UE[UE_id].Status);
+ push_front(&eNB_rrc_inst[Mod_id].loc_list,
+ rrc_get_estimated_ue_distance(Mod_id,frameP,UE_id, CC_id,eNB_rrc_inst[Mod_id].loc_type));
+ eNB_rrc_inst[Mod_id].reference_timestamp_ms = current_timestamp_ms;
+ }
+ }
+#endif
}
return (RRC_OK);
diff --git a/openair2/UTIL/LOG/log.c b/openair2/UTIL/LOG/log.c
index 627e375f67..8c27285798 100755
--- a/openair2/UTIL/LOG/log.c
+++ b/openair2/UTIL/LOG/log.c
@@ -142,7 +142,7 @@ int logInit (void)
g_log->log_component[PHY].filelog_name = "/tmp/phy.log";
g_log->log_component[MAC].name = "MAC";
- g_log->log_component[MAC].level = LOG_DEBUG;
+ g_log->log_component[MAC].level = LOG_EMERG;
g_log->log_component[MAC].flag = LOG_MED;
g_log->log_component[MAC].interval = 1;
g_log->log_component[MAC].fd = 0;
@@ -158,7 +158,7 @@ int logInit (void)
g_log->log_component[OPT].filelog_name = "";
g_log->log_component[RLC].name = "RLC";
- g_log->log_component[RLC].level = LOG_DEBUG;
+ g_log->log_component[RLC].level = LOG_INFO;
g_log->log_component[RLC].flag = LOG_MED;
g_log->log_component[RLC].interval = 1;
g_log->log_component[RLC].fd = 0;
@@ -166,7 +166,7 @@ int logInit (void)
g_log->log_component[RLC].filelog_name = "/tmp/rlc.log";
g_log->log_component[PDCP].name = "PDCP";
- g_log->log_component[PDCP].level = LOG_DEBUG;
+ g_log->log_component[PDCP].level = LOG_INFO;
g_log->log_component[PDCP].flag = LOG_MED;
g_log->log_component[PDCP].interval = 1;
g_log->log_component[PDCP].fd = 0;
@@ -212,7 +212,7 @@ int logInit (void)
g_log->log_component[OTG].fd = 0;
g_log->log_component[OTG].filelog = 0;
g_log->log_component[OTG].filelog_name = "/tmp/otg.log";
-
+
g_log->log_component[OTG_LATENCY].name = "OTG_LATENCY";
g_log->log_component[OTG_LATENCY].level = LOG_EMERG;
g_log->log_component[OTG_LATENCY].flag = LOG_MED;
@@ -380,7 +380,16 @@ int logInit (void)
g_log->log_component[TMR].fd = 0;
g_log->log_component[TMR].filelog = 0;
g_log->log_component[TMR].filelog_name = "";
-
+
+/* following log component are used for the localization*/
+ g_log->log_component[LOCALIZE].name = "LOCALIZE";
+ g_log->log_component[LOCALIZE].level = LOG_EMERG;
+ g_log->log_component[LOCALIZE].flag = LOG_MED;
+ g_log->log_component[LOCALIZE].interval = 1;
+ g_log->log_component[LOCALIZE].fd = 0;
+ g_log->log_component[LOCALIZE].filelog = 1;
+ g_log->log_component[LOCALIZE].filelog_name = "/tmp/localize.log";
+
g_log->level2string[LOG_EMERG] = "G"; //EMERG
g_log->level2string[LOG_ALERT] = "A"; // ALERT
g_log->level2string[LOG_CRIT] = "C"; // CRITIC
diff --git a/openair2/UTIL/LOG/log.h b/openair2/UTIL/LOG/log.h
index 04f1b30d73..a30b51ff47 100755
--- a/openair2/UTIL/LOG/log.h
+++ b/openair2/UTIL/LOG/log.h
@@ -265,6 +265,7 @@ typedef enum {
RAL_UE,
ENB_APP,
TMR,
+ LOCALIZE,
MAX_LOG_COMPONENTS,
} comp_name_t;
diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.conf
new file mode 100644
index 0000000000..db5a61e66e
--- /dev/null
+++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.conf
@@ -0,0 +1,163 @@
+Active_eNBs = ( "eNB_Eurecom_LTEBox");
+# Asn1_verbosity, choice in: none, info, annoying
+Asn1_verbosity = "none";
+
+eNBs =
+(
+ {
+ # real_time choice in {hard, rt-preempt, no}
+ real_time = "no";
+ ////////// Identification parameters:
+ eNB_ID = 0xe00;
+
+ cell_type = "CELL_MACRO_ENB";
+
+ eNB_name = "eNB_Eurecom_LTEBox";
+
+ // Tracking area code, 0x0000 and 0xfffe are reserved values
+ tracking_area_code = "1";
+
+ mobile_country_code = "208";
+
+ mobile_network_code = "92";
+
+ ////////// Physical parameters:
+
+ component_carriers = (
+ {
+ frame_type = "FDD";
+ tdd_config = 3;
+ tdd_config_s = 0;
+ prefix_type = "NORMAL";
+ eutra_band = 7;
+ downlink_frequency = 2680000000L;
+ uplink_frequency_offset = -120000000;
+ Nid_cell = 0;
+ N_RB_DL = 25;
+ Nid_cell_mbsfn = 0;
+ nb_antennas_tx = 1;
+ nb_antennas_rx = 1;
+ tx_gain = 25;
+ rx_gain = 20;
+ prach_root = 0;
+ prach_config_index = 0;
+ prach_high_speed = "DISABLE";
+ prach_zero_correlation = 1;
+ prach_freq_offset = 2;
+ pucch_delta_shift = 1;
+ pucch_nRB_CQI = 1;
+ pucch_nCS_AN = 0;
+ pucch_n1_AN = 32;
+ pdsch_referenceSignalPower = 0;
+ pdsch_p_b = 0;
+ pusch_n_SB = 1;
+ pusch_enable64QAM = "DISABLE";
+ pusch_hoppingMode = "interSubFrame";
+ pusch_hoppingOffset = 0;
+ pusch_groupHoppingEnabled = "ENABLE";
+ pusch_groupAssignment = 0;
+ pusch_sequenceHoppingEnabled = "DISABLE";
+ pusch_nDMRS1 = 0;
+ phich_duration = "NORMAL";
+ phich_resource = "ONESIXTH";
+ srs_enable = "DISABLE";
+ /* srs_BandwidthConfig =;
+ srs_SubframeConfig =;
+ srs_ackNackST =;
+ srs_MaxUpPts =;*/
+
+ pusch_p0_Nominal = -108;
+ pusch_alpha = "AL1";
+ pucch_p0_Nominal = -108;
+ msg3_delta_Preamble = 6;
+ pucch_deltaF_Format1 = "deltaF2";
+ pucch_deltaF_Format1b = "deltaF3";
+ pucch_deltaF_Format2 = "deltaF0";
+ pucch_deltaF_Format2a = "deltaF0";
+ pucch_deltaF_Format2b = "deltaF0";
+
+ rach_numberOfRA_Preambles = 64;
+ rach_preamblesGroupAConfig = "DISABLE";
+/*
+ rach_sizeOfRA_PreamblesGroupA = ;
+ rach_messageSizeGroupA = ;
+ rach_messagePowerOffsetGroupB = ;
+*/
+ rach_powerRampingStep = 2;
+ rach_preambleInitialReceivedTargetPower = -100;
+ rach_preambleTransMax = 10;
+ rach_raResponseWindowSize = 10;
+ rach_macContentionResolutionTimer = 48;
+ rach_maxHARQ_Msg3Tx = 4;
+
+ pcch_default_PagingCycle = 128;
+ pcch_nB = "oneT";
+ bcch_modificationPeriodCoeff = 2;
+ ue_TimersAndConstants_t300 = 1000;
+ ue_TimersAndConstants_t301 = 1000;
+ ue_TimersAndConstants_t310 = 1000;
+ ue_TimersAndConstants_t311 = 10000;
+ ue_TimersAndConstants_n310 = 20;
+ ue_TimersAndConstants_n311 = 1;
+
+ }
+ );
+
+ ////////// MME parameters:
+ mme_ip_address = ( { ipv4 = "192.168.13.11";
+ ipv6 = "192:168:30::17";
+ active = "yes";
+ preference = "ipv4";
+ }
+ );
+
+ NETWORK_INTERFACES :
+ {
+ ENB_INTERFACE_NAME_FOR_S1_MME = "eth0";
+ ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.13.10/24";
+
+ ENB_INTERFACE_NAME_FOR_S1U = "eth0";
+ ENB_IPV4_ADDRESS_FOR_S1U = "192.168.13.10/24";
+ ENB_PORT_FOR_S1U = 2152; # Spec 2152
+ };
+ /*
+ otg_config = (
+ {
+ ue_id =1;
+ app_type ="scbr";
+ bg_traffic ="disable";
+ },
+ {
+ ue_id =2;
+ app_type ="bcbr";
+ bg_traffic ="enable";
+ }
+ );
+*/
+ log_config :
+ {
+ global_log_level ="info";
+ global_log_verbosity ="medium";
+ hw_log_level ="debug";
+ hw_log_verbosity ="medium";
+ phy_log_level ="info";
+ phy_log_verbosity ="medium";
+ mac_log_level ="info";
+ mac_log_verbosity ="high";
+ rlc_log_level ="info";
+ rlc_log_verbosity ="medium";
+ pdcp_log_level ="info";
+ pdcp_log_verbosity ="medium";
+ rrc_log_level ="debug";
+ rrc_log_verbosity ="medium";
+ gtpu_log_level ="error";
+ gtpu_log_verbosity ="medium";
+ udp_log_level ="error";
+ udp_log_verbosity ="medium";
+ osa_log_level ="warn";
+ osa_log_verbosity ="low";
+
+ };
+
+ }
+);
diff --git a/targets/SIMU/EXAMPLES/OSD/WEBXML/template_26.xml b/targets/SIMU/EXAMPLES/OSD/WEBXML/template_26.xml
index ddf1deb758..0cadccd976 100755
--- a/targets/SIMU/EXAMPLES/OSD/WEBXML/template_26.xml
+++ b/targets/SIMU/EXAMPLES/OSD/WEBXML/template_26.xml
@@ -3,11 +3,14 @@
<FADING>
<FREE_SPACE_MODEL_PARAMETERS>
<PATHLOSS_EXPONENT>2.0</PATHLOSS_EXPONENT>
+ <PATHLOSS_0_dB>-100</PATHLOSS_0_dB><!--pathloss at 1km -->
</FREE_SPACE_MODEL_PARAMETERS>
<SMALL_SCALE>AWGN</SMALL_SCALE>
</FADING>
- <SYSTEM_FREQUENCY_GHz>1.9</SYSTEM_FREQUENCY_GHz>
- </ENVIRONMENT_SYSTEM_CONFIG>
+ <SYSTEM_FREQUENCY_GHz>1.9</SYSTEM_FREQUENCY_GHz>
+ <TRANSMISSION_MODE>1</TRANSMISSION_MODE> <!-- validavalue: 1, 2, 5, 6 -->
+
+ </ENVIRONMENT_SYSTEM_CONFIG>
<TOPOLOGY_CONFIG>
<AREA>
@@ -77,8 +80,8 @@
<OWD_RADIO_ACCESS>enable</OWD_RADIO_ACCESS> <!-- option: enable, disable. If enable owd curve shows the one way radio access delay, else it shows end to end owd -->
</PERFORMANCE_METRICS>
<LOG> <!-- set the global log level -->
- <LEVEL>debug</LEVEL>
- <VERBOSITY>medium</VERBOSITY>
+ <LEVEL>info</LEVEL>
+ <VERBOSITY>low</VERBOSITY>
<INTERVAL>1</INTERVAL>
</LOG>
<SEED_VALUE>0</SEED_VALUE> <!-- value 0 means randomly generated by OAI -->
diff --git a/targets/SIMU/USER/Makefile b/targets/SIMU/USER/Makefile
index 04ad7ddfc0..fcb0217661 100644
--- a/targets/SIMU/USER/Makefile
+++ b/targets/SIMU/USER/Makefile
@@ -52,6 +52,14 @@ ifdef EMOS
CFLAGS+=-DEMOS
endif
+ifeq ($(LOCALIZATION), 1)
+CFLAGS += -DLOCALIZATION
+endif
+
+ifeq ($(LINUX_LIST), 1)
+CFLAGS += -DLINUX_LIST
+endif
+
ifdef TRAFFIC_TM5
CFLAGS += -DRLC_UM_TEST_TRAFFIC=1 #-DFULL_BUFFER=1
endif
diff --git a/targets/SIMU/USER/init_lte.c b/targets/SIMU/USER/init_lte.c
index 7d285ea97a..76ecb01be0 100644
--- a/targets/SIMU/USER/init_lte.c
+++ b/targets/SIMU/USER/init_lte.c
@@ -93,7 +93,17 @@ PHY_VARS_eNB* init_lte_eNB(LTE_DL_FRAME_PARMS *frame_parms,
// this is the transmission mode for the signalling channels
// this will be overwritten with the real transmission mode by the RRC once the UE is connected
PHY_vars_eNB->transmission_mode[i] = transmission_mode;
-
+#ifdef LOCALIZATION
+ PHY_vars_eNB->ulsch_eNB[1+i]->aggregation_period_ms = 5000; // 5000 milliseconds // could be given as an argument (TBD))
+ struct timeval ts;
+ gettimeofday(&ts, NULL);
+ PHY_vars_eNB->ulsch_eNB[1+i]->reference_timestamp_ms = ts.tv_sec * 1000 + ts.tv_usec / 1000;
+ initialize(&PHY_vars_eNB->ulsch_eNB[1+i]->loc_rss_list);
+ initialize(&PHY_vars_eNB->ulsch_eNB[1+i]->loc_rssi_list);
+ initialize(&PHY_vars_eNB->ulsch_eNB[1+i]->loc_subcarrier_rss_list);
+ initialize(&PHY_vars_eNB->ulsch_eNB[1+i]->loc_timing_advance_list);
+ initialize(&PHY_vars_eNB->ulsch_eNB[1+i]->loc_timing_update_list);
+#endif
}
// ULSCH for RA
@@ -125,7 +135,7 @@ PHY_VARS_eNB* init_lte_eNB(LTE_DL_FRAME_PARMS *frame_parms,
PHY_vars_eNB->check_for_SUMIMO_transmissions = 0;
PHY_vars_eNB->lte_frame_parms.pucch_config_common.deltaPUCCH_Shift = 1;
-
+
return (PHY_vars_eNB);
}
diff --git a/targets/SIMU/USER/oaisim.c b/targets/SIMU/USER/oaisim.c
index 1b20386c27..cfb6d237a6 100644
--- a/targets/SIMU/USER/oaisim.c
+++ b/targets/SIMU/USER/oaisim.c
@@ -565,7 +565,7 @@ void *l2l1_task(void *args_p) {
start_meas(&oaisim_stats);
for (frame = 0; (l2l1_state != L2L1_TERMINATED) && (frame < oai_emulation.info.n_frames); frame++) {
-
+
#if defined(ENABLE_ITTI)
do {
// Checks if a message has been sent to L2L1 task
@@ -661,7 +661,7 @@ void *l2l1_task(void *args_p) {
for (slot = 0; slot < 20; slot++) {
if (slot%2==0)
start_meas(&oaisim_stats_f);
-
+
wait_for_slot_isr ();
#if defined(ENABLE_ITTI)
@@ -1272,7 +1272,7 @@ void *l2l1_task(void *args_p) {
}
- for (eNB_id=0; eNB_id<NB_eNB_INST; eNB_id++) {
+ for (eNB_id=0; eNB_id<NB_eNB_INST; eNB_id++) {
for (UE_id=0; UE_id<NB_UE_INST; UE_id++) {
reset_meas(&eNB2UE[eNB_id][UE_id][0]->random_channel);
@@ -1285,66 +1285,69 @@ void *l2l1_task(void *args_p) {
reset_meas(&UE2eNB[UE_id][eNB_id][0]->convolution);
}
- reset_meas(&PHY_vars_eNB_g[eNB_id][0]->phy_proc);
- reset_meas(&PHY_vars_eNB_g[eNB_id][0]->phy_proc_rx);
- reset_meas(&PHY_vars_eNB_g[eNB_id][0]->phy_proc_tx);
- reset_meas(&PHY_vars_eNB_g[eNB_id][0]->rx_prach);
-
- reset_meas(&PHY_vars_eNB_g[eNB_id][0]->ofdm_mod_stats);
- reset_meas(&PHY_vars_eNB_g[eNB_id][0]->dlsch_encoding_stats);
- reset_meas(&PHY_vars_eNB_g[eNB_id][0]->dlsch_modulation_stats);
- reset_meas(&PHY_vars_eNB_g[eNB_id][0]->dlsch_scrambling_stats);
- reset_meas(&PHY_vars_eNB_g[eNB_id][0]->dlsch_rate_matching_stats);
- reset_meas(&PHY_vars_eNB_g[eNB_id][0]->dlsch_turbo_encoding_stats);
- reset_meas(&PHY_vars_eNB_g[eNB_id][0]->dlsch_interleaving_stats);
-
- reset_meas(&PHY_vars_eNB_g[eNB_id][0]->ofdm_demod_stats);
- //reset_meas(&PHY_vars_eNB_g[eNB_id]->rx_dft_stats);
- //reset_meas(&PHY_vars_eNB_g[eNB_id]->ulsch_channel_estimation_stats);
- //reset_meas(&PHY_vars_eNB_g[eNB_id]->ulsch_freq_offset_estimation_stats);
- reset_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_decoding_stats);
- reset_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_demodulation_stats);
- reset_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_rate_unmatching_stats);
- reset_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_turbo_decoding_stats);
- reset_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_deinterleaving_stats);
- reset_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_demultiplexing_stats);
- reset_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_llr_stats);
- reset_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_tc_init_stats);
- reset_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_tc_alpha_stats);
- reset_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_tc_beta_stats);
- reset_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_tc_gamma_stats);
- reset_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_tc_ext_stats);
- reset_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_tc_intl1_stats);
- reset_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_tc_intl2_stats);
-
- /*
- * L2 functions
- */
- // eNB MAC
- reset_meas(&eNB_mac_inst[eNB_id].eNB_scheduler); // total
- reset_meas(&eNB_mac_inst[eNB_id].schedule_si); // only schedule + tx
- reset_meas(&eNB_mac_inst[eNB_id].schedule_ra); // only ra
- reset_meas(&eNB_mac_inst[eNB_id].schedule_ulsch); // onlu ulsch
- reset_meas(&eNB_mac_inst[eNB_id].fill_DLSCH_dci);// only dci
- reset_meas(&eNB_mac_inst[eNB_id].schedule_dlsch_preprocessor); // include rlc_data_req + MAC header gen
- reset_meas(&eNB_mac_inst[eNB_id].schedule_dlsch); // include rlc_data_req + MAC header gen + pre-processor
- reset_meas(&eNB_mac_inst[eNB_id].schedule_mch); // only embms
- reset_meas(&eNB_mac_inst[eNB_id].rx_ulsch_sdu); // include rlc_data_ind + mac header parser
-
- reset_meas(&eNB_pdcp_stats[eNB_id].pdcp_run);
- reset_meas(&eNB_pdcp_stats[eNB_id].data_req);
- reset_meas(&eNB_pdcp_stats[eNB_id].data_ind);
- reset_meas(&eNB_pdcp_stats[eNB_id].apply_security);
- reset_meas(&eNB_pdcp_stats[eNB_id].validate_security);
- reset_meas(&eNB_pdcp_stats[eNB_id].pdcp_ip);
- reset_meas(&eNB_pdcp_stats[eNB_id].ip_pdcp);
+ reset_meas(&PHY_vars_eNB_g[eNB_id][0]->phy_proc);
+ reset_meas(&PHY_vars_eNB_g[eNB_id][0]->phy_proc_rx);
+ reset_meas(&PHY_vars_eNB_g[eNB_id][0]->phy_proc_tx);
+ reset_meas(&PHY_vars_eNB_g[eNB_id][0]->rx_prach);
+
+ reset_meas(&PHY_vars_eNB_g[eNB_id][0]->ofdm_mod_stats);
+ reset_meas(&PHY_vars_eNB_g[eNB_id][0]->dlsch_encoding_stats);
+ reset_meas(&PHY_vars_eNB_g[eNB_id][0]->dlsch_modulation_stats);
+ reset_meas(&PHY_vars_eNB_g[eNB_id][0]->dlsch_scrambling_stats);
+ reset_meas(&PHY_vars_eNB_g[eNB_id][0]->dlsch_rate_matching_stats);
+ reset_meas(&PHY_vars_eNB_g[eNB_id][0]->dlsch_turbo_encoding_stats);
+ reset_meas(&PHY_vars_eNB_g[eNB_id][0]->dlsch_interleaving_stats);
+
+ reset_meas(&PHY_vars_eNB_g[eNB_id][0]->ofdm_demod_stats);
+ //reset_meas(&PHY_vars_eNB_g[eNB_id]->rx_dft_stats);
+ //reset_meas(&PHY_vars_eNB_g[eNB_id]->ulsch_channel_estimation_stats);
+ //reset_meas(&PHY_vars_eNB_g[eNB_id]->ulsch_freq_offset_estimation_stats);
+ reset_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_decoding_stats);
+ reset_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_demodulation_stats);
+ reset_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_rate_unmatching_stats);
+ reset_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_turbo_decoding_stats);
+ reset_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_deinterleaving_stats);
+ reset_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_demultiplexing_stats);
+ reset_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_llr_stats);
+ reset_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_tc_init_stats);
+ reset_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_tc_alpha_stats);
+ reset_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_tc_beta_stats);
+ reset_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_tc_gamma_stats);
+ reset_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_tc_ext_stats);
+ reset_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_tc_intl1_stats);
+ reset_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_tc_intl2_stats);
+#ifdef LOCALIZATION
+ reset_meas(&PHY_vars_eNB_g[eNB_id][0]->localization_stats);
+#endif
+
+ /*
+ * L2 functions
+ */
+ // eNB MAC
+ reset_meas(&eNB_mac_inst[eNB_id].eNB_scheduler); // total
+ reset_meas(&eNB_mac_inst[eNB_id].schedule_si); // only schedule + tx
+ reset_meas(&eNB_mac_inst[eNB_id].schedule_ra); // only ra
+ reset_meas(&eNB_mac_inst[eNB_id].schedule_ulsch); // onlu ulsch
+ reset_meas(&eNB_mac_inst[eNB_id].fill_DLSCH_dci);// only dci
+ reset_meas(&eNB_mac_inst[eNB_id].schedule_dlsch_preprocessor); // include rlc_data_req + MAC header gen
+ reset_meas(&eNB_mac_inst[eNB_id].schedule_dlsch); // include rlc_data_req + MAC header gen + pre-processor
+ reset_meas(&eNB_mac_inst[eNB_id].schedule_mch); // only embms
+ reset_meas(&eNB_mac_inst[eNB_id].rx_ulsch_sdu); // include rlc_data_ind + mac header parser
+
+ reset_meas(&eNB_pdcp_stats[eNB_id].pdcp_run);
+ reset_meas(&eNB_pdcp_stats[eNB_id].data_req);
+ reset_meas(&eNB_pdcp_stats[eNB_id].data_ind);
+ reset_meas(&eNB_pdcp_stats[eNB_id].apply_security);
+ reset_meas(&eNB_pdcp_stats[eNB_id].validate_security);
+ reset_meas(&eNB_pdcp_stats[eNB_id].pdcp_ip);
+ reset_meas(&eNB_pdcp_stats[eNB_id].ip_pdcp);
+ }
}
- }
-void print_opp_meas(void){
+ void print_opp_meas(void){
- uint8_t eNB_id=0,UE_id=0;
+ uint8_t eNB_id=0,UE_id=0;
print_meas(&oaisim_stats,"[OAI][total_exec_time]", &oaisim_stats,&oaisim_stats);
print_meas(&oaisim_stats_f,"[OAI][SF_exec_time]", &oaisim_stats,&oaisim_stats_f);
@@ -1433,7 +1436,10 @@ void print_opp_meas(void){
print_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_tc_intl2_stats,"[eNB][ |_tc_intl2]",&oaisim_stats,&oaisim_stats_f);
print_meas(&PHY_vars_eNB_g[eNB_id][0]->rx_prach,"[eNB][rx_prach]",&oaisim_stats,&oaisim_stats_f);
-
+
+#ifdef LOCALIZATION
+ print_meas(&PHY_vars_eNB_g[eNB_id][0]->localization_stats, "[eNB][LOCALIZATION]",&oaisim_stats,&oaisim_stats_f);
+#endif
}
for (UE_id=0; UE_id<NB_UE_INST;UE_id++) {
diff --git a/targets/SIMU/USER/oaisim_functions.c b/targets/SIMU/USER/oaisim_functions.c
index 8a75cf7499..ea9472773f 100644
--- a/targets/SIMU/USER/oaisim_functions.c
+++ b/targets/SIMU/USER/oaisim_functions.c
@@ -51,6 +51,7 @@
#include "RRC/LITE/extern.h"
#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
#include "PHY_INTERFACE/extern.h"
+//#include "ARCH/CBMIMO1/DEVICE_DRIVER/extern.h"
#include "SCHED/extern.h"
#include "SIMULATION/ETH_TRANSPORT/proto.h"
#include "UTIL/OCG/OCG_extern.h"
@@ -811,18 +812,7 @@ void init_openair1(void) {
#endif
// change the nb_connected_eNB
for (CC_id=0;CC_id<MAX_NUM_CCs;CC_id++) {
- init_lte_vars (&frame_parms[CC_id],
- oai_emulation.info.frame_type[CC_id],
- oai_emulation.info.tdd_config[CC_id],
- oai_emulation.info.tdd_config_S[CC_id],
- oai_emulation.info.extended_prefix_flag[CC_id],
- oai_emulation.info.N_RB_DL[CC_id],
- Nid_cell,
- cooperation_flag,
- oai_emulation.info.transmission_mode[CC_id],
- abstraction_flag,
- nb_antennas_rx,
- oai_emulation.info.eMBMS_active_state);
+ init_lte_vars (&frame_parms[CC_id], oai_emulation.info.frame_type[CC_id], oai_emulation.info.tdd_config[CC_id], oai_emulation.info.tdd_config_S[CC_id],oai_emulation.info.extended_prefix_flag[CC_id],oai_emulation.info.N_RB_DL[CC_id], Nid_cell, cooperation_flag, oai_emulation.info.transmission_mode[CC_id], abstraction_flag,nb_antennas_rx, oai_emulation.info.eMBMS_active_state);
}
for (eNB_id=0; eNB_id<NB_eNB_INST;eNB_id++){
@@ -844,8 +834,8 @@ void init_openair1(void) {
printf ("AFTER init: MAX_NUM_CCs %d, Nid_cell %d frame_type %d,tdd_config %d\n",
MAX_NUM_CCs,
PHY_vars_eNB_g[0][0]->lte_frame_parms.Nid_cell,
- PHY_vars_eNB_g[0][0]->lte_frame_parms.frame_type,
- PHY_vars_eNB_g[0][0]->lte_frame_parms.tdd_config);
+ PHY_vars_eNB_g[0][0]->lte_frame_parms.frame_type,
+ PHY_vars_eNB_g[0][0]->lte_frame_parms.tdd_config);
number_of_cards = 1;
@@ -1120,6 +1110,14 @@ void update_ocm() {
LOG_I(OCM,"Path loss (CCid %d) between eNB %d at (%f,%f) and UE %d at (%f,%f) is %f, angle %f\n",
CC_id,eNB_id,enb_data[eNB_id]->x,enb_data[eNB_id]->y,UE_id,ue_data[UE_id]->x,ue_data[UE_id]->y,
eNB2UE[eNB_id][UE_id][CC_id]->path_loss_dB, eNB2UE[eNB_id][UE_id][CC_id]->aoa);
+ double dx, dy, distance;
+ dx = enb_data[eNB_id]->x - ue_data[UE_id]->x;
+ dy = enb_data[eNB_id]->y - ue_data[UE_id]->y;
+ distance = sqrt(dx * dx + dy * dy);
+ /*LOG_D(LOCALIZE, " OCM distance between eNB %d at (%f,%f) and UE %d at (%f,%f) is %f \n",
+ eNB_id, enb_data[eNB_id]->x,enb_data[eNB_id]->y,
+ UE_id, ue_data[UE_id]->x,ue_data[UE_id]->y,
+ distance);*/
}
}
}
diff --git a/targets/TEST/OAI/case02.py b/targets/TEST/OAI/case02.py
index fcd36a4655..274a23596a 100644
--- a/targets/TEST/OAI/case02.py
+++ b/targets/TEST/OAI/case02.py
@@ -170,13 +170,13 @@ def execute(oai, user, pw, host, logfile,logdir,debug):
try:
test = '06'
name = 'Run oai.rel8.itti.abs.rrc'
- diag = 'RRC procedure is not finished completely, check the eNB config file (default is enb.sfr.sud.conf), in addition to the execution logs and trace BCCH, CCCH, and DCCH channels'
+ diag = 'RRC procedure is not finished completely, check the eNB config file (default is enb.band7.generic.conf), in addition to the execution logs and trace BCCH, CCCH, and DCCH channels'
for i in range(NUM_UE) :
for j in range(NUM_eNB) :
log_name = logdir + '/log_' + host + case + test + '_' + str(i) + str(j)
itti_name = log_name + '.log'
trace_name = log_name + '.txt'
- conf = '-a -l7 -A AWGN --enb-conf ../../PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.exmimo2.conf -n' + str((i+1+j) * 50) + ' -u' + str(i+1) +' -b'+ str(j+1) + ' -K' + itti_name
+ conf = '-a -l7 -A AWGN --enb-conf ../../PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.conf -n' + str((i+1+j) * 50) + ' -u' + str(i+1) +' -b'+ str(j+1) + ' -K' + itti_name
tee = ' 2>&1 | tee -a ' + trace_name
command = './oaisim.rel8.itti.' + host + ' ' + conf
oai.send('echo ' + command + ' > ' + trace_name + ';')
diff --git a/targets/TEST/OAI/case03.py b/targets/TEST/OAI/case03.py
index 16287b0320..296bb488ca 100644
--- a/targets/TEST/OAI/case03.py
+++ b/targets/TEST/OAI/case03.py
@@ -189,13 +189,13 @@ def execute(oai, user, pw, host, logfile,logdir,debug):
# try:
# test = '09'
# name = 'Run oai.rel10.itti.phy.eMBMS.MCCH'
-# diag = 'eMBMS procedure is not finished completely, check the eNB config file (enb.sfr.sud.conf), and make sure that the SIB13/MCCH have been correclty received by UEs'
+# diag = 'eMBMS procedure is not finished completely, check the eNB config file (enb.band7.generic.conf), and make sure that the SIB13/MCCH have been correclty received by UEs'
# for i in range(NUM_UE) :
# for j in range(NUM_eNB) :
# log_name = logdir + '/log_' + host + case + test + '_' + str(i) + str(j)
# itti_name = log_name + '.log'
# trace_name = log_name + '.txt'
-# conf = '-A AWGN -l7 -x 1 -Q3 --enb-conf ../../PROJECTS/GENERIC-LTE-EPC/CONF/enb.sfr.sud.conf -n' + str((i+1+j) * 50) + ' -u' + str(i+1) +' -b'+ str(j+1) + ' -K' + itti_name
+# conf = '-A AWGN -l7 -x 1 -Q3 --enb-conf ../../PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.conf -n' + str((i+1+j) * 50) + ' -u' + str(i+1) +' -b'+ str(j+1) + ' -K' + itti_name
# tee = ' 2>&1 | tee -a ' + trace_name
# command = './oaisim.rel10.itti.' + host + ' ' + conf
# oai.send('echo ' + command + ' > ' + trace_name + ';')
diff --git a/targets/TEST/OAI/openair.py b/targets/TEST/OAI/openair.py
index 4d9787141b..94d42611a4 100644
--- a/targets/TEST/OAI/openair.py
+++ b/targets/TEST/OAI/openair.py
@@ -101,7 +101,39 @@ class openair(core):
except Error, val :
print "Error: can't connect to"+username+"@"+self.address
+ def connect2(self, username, password, prompt='$'):
+ self.prompt1 = prompt
+ self.prompt2 = prompt
+
+ while 1:
+ try:
+ if not username:
+ username = root
+ if not password:
+ password = username
+ self.oai = pexpect.spawn('ssh -o "UserKnownHostsFile=/dev/null" -o "StrictHostKeyChecking=no" -o "ConnectionAttempts=1" ' \
+ + username + '@' + self.address)
+
+ index = self.oai.expect([re.escape(self.prompt1), re.escape(self.prompt2), pexpect.TIMEOUT], timeout=40)
+ if index == 0 :
+ return 'Ok'
+ else :
+ index = self.oai.expect(['password:', pexpect.TIMEOUT], timeout=40)
+ if index == 0 :
+ self.oai.sendline(password)
+ index = self.oai.expect([re.escape(self.prompt1), re.escape(self.prompt2), pexpect.TIMEOUT], timeout=10)
+ if index != 0:
+ print 'ERROR! could not login with SSH.'
+ print 'Expected ' + self.prompt1 + ', received >>>>' + self.oai.before + '<<<<'
+ sys.exit(1)
+ return 'Ok'
+
+ except Exception, val:
+ time.sleep(5)
+ print "Error:", val
+
+
def disconnect(self):
print 'disconnecting the ssh connection to ' + self.address + '\n'
self.oai.send('exit')
diff --git a/targets/TEST/OAI/test01.py b/targets/TEST/OAI/test01.py
index ed952179f9..0c77f57bbb 100644
--- a/targets/TEST/OAI/test01.py
+++ b/targets/TEST/OAI/test01.py
@@ -111,7 +111,9 @@ try:
print "username: " + user
#print "password: " + pw
- oai.connect(user,pw)
+ # issues in ubuntu 12.04
+ # oai.connect(user,pw)
+ oai.connect2(user,pw)
#oai.get_shell()
except :
print 'Fail to connect to the local host'
--
GitLab