From 6e76ecddfec589f416482cff35a38861242e0266 Mon Sep 17 00:00:00 2001 From: Raymond Knopp <raymond.knopp@eurecom.fr> Date: Fri, 5 Jun 2015 14:10:02 +0000 Subject: [PATCH] Applied S. Held's patches 16, additional modifications for UE frequency scanning and RSRP/RSSI calibration for ExpressMIMO2 and USRP B210 git-svn-id: http://svn.eurecom.fr/openair4G/trunk@7536 818b1a75-f10b-46b9-bf7c-635c3b92a50f --- cmake_targets/CMakeLists.txt | 1 - .../autotests/test.0101/CMakeLists.txt | 1 - .../autotests/test.0102/CMakeLists.txt | 1 - .../autotests/test.0103/CMakeLists.txt | 1 - .../autotests/test.0106/CMakeLists.txt | 1 - .../autotests/test.0107/CMakeLists.txt | 1 - .../autotests/test.0108/CMakeLists.txt | 1 - .../autotests/test.0114/CMakeLists.txt | 1 - .../autotests/test.0115/CMakeLists.txt | 1 - .../autotests/test.0120/CMakeLists.txt | 1 - .../epc_build_oai/CMakeLists.template | 1 - .../lte_noS1_build_oai/CMakeLists.txt | 2 +- .../oaisim_build_oai/CMakeLists.template | 1 - .../oaisim_mme_build_oai/CMakeLists.template | 1 - .../oaisim_noS1_build_oai/CMakeLists.template | 1 - openair1/PHY/INIT/lte_parms.c | 2 + openair1/PHY/LTE_ESTIMATION/defs.h | 4 +- .../PHY/LTE_ESTIMATION/lte_est_freq_offset.c | 11 +- openair1/PHY/LTE_ESTIMATION/lte_sync_time.c | 4 +- .../PHY/LTE_ESTIMATION/lte_ue_measurements.c | 100 +- openair1/PHY/LTE_TRANSPORT/dci.c | 7 + .../PHY/LTE_TRANSPORT/dlsch_demodulation.c | 4 +- openair1/PHY/LTE_TRANSPORT/initial_sync.c | 138 +- openair1/PHY/LTE_TRANSPORT/print_stats.c | 20 +- openair1/PHY/LTE_TRANSPORT/sss.c | 22 +- .../PHY/LTE_TRANSPORT/ulsch_demodulation.c | 5 + openair1/PHY/MODULATION/defs.h | 4 +- openair1/PHY/MODULATION/slot_fep.c | 6 +- openair1/PHY/TOOLS/lte_phy_scope.c | 6 +- openair1/PHY/defs.h | 2 + openair1/SCHED/phy_procedures_lte_ue.c | 75 +- openair2/ENB_APP/enb_config.c | 374 +++-- openair2/LAYER2/MAC/ra_procedures.c | 4 +- openair2/RRC/LITE/defs.h | 6 +- openair2/RRC/LITE/proto.h | 76 +- openair2/RRC/LITE/rrc_UE.c | 1276 ++++++++++------- openair2/RRC/LITE/rrc_eNB.c | 5 +- openair2/UTIL/LOG/vcd_signal_dumper.c | 1 + openair2/UTIL/LOG/vcd_signal_dumper.h | 1 + targets/ARCH/COMMON/common_lib.h | 19 +- .../ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.c | 27 +- .../ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.h | 3 + targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp | 10 +- targets/RT/USER/lte-softmodem.c | 22 +- targets/RT/USER/lte-ue.c | 234 +-- targets/RT/USER/sched_dlsch.c | 40 +- targets/SIMU/USER/oaisim_functions.c | 105 +- 47 files changed, 1607 insertions(+), 1022 deletions(-) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 9bb062ba20..df670f438c 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -389,7 +389,6 @@ add_boolean_option(USER_MODE True "????") add_boolean_option(OAI_NW_DRIVER_TYPE_ETHERNET False "????") add_boolean_option(DISABLE_USE_NAS False "???") -add_boolean_option(ENABLE_PDCP_NETLINK_FIFO False "????") add_boolean_option(ENABLE_STANDALONE_EPC True "Compile MME, SGW and PGW in a single executable") add_boolean_option(ENABLE_USE_GTPU_IN_KERNEL True "as per name") add_boolean_option(ENABLE_USE_NETFILTER_FOR_SGI False "SGI option") diff --git a/cmake_targets/autotests/test.0101/CMakeLists.txt b/cmake_targets/autotests/test.0101/CMakeLists.txt index d4c2d85cdc..c398c2343a 100644 --- a/cmake_targets/autotests/test.0101/CMakeLists.txt +++ b/cmake_targets/autotests/test.0101/CMakeLists.txt @@ -10,7 +10,6 @@ set ( ENABLE_FXP True ) set ( ENABLE_ITTI False ) set ( ENABLE_NAS_UE_LOGGING False ) set ( ENABLE_NEW_MULTICAST True ) -set ( ENABLE_PDCP_NETLINK_FIFO False ) set ( ENABLE_PGM_TRANSPORT True ) set ( ENABLE_RAL False ) set ( ENABLE_SECURITY False ) diff --git a/cmake_targets/autotests/test.0102/CMakeLists.txt b/cmake_targets/autotests/test.0102/CMakeLists.txt index 37e9dc3791..dd0a607ed9 100644 --- a/cmake_targets/autotests/test.0102/CMakeLists.txt +++ b/cmake_targets/autotests/test.0102/CMakeLists.txt @@ -10,7 +10,6 @@ set ( ENABLE_FXP True ) set ( ENABLE_ITTI False ) set ( ENABLE_NAS_UE_LOGGING False ) set ( ENABLE_NEW_MULTICAST True ) -set ( ENABLE_PDCP_NETLINK_FIFO False ) set ( ENABLE_PGM_TRANSPORT True ) set ( ENABLE_RAL False ) set ( ENABLE_SECURITY False ) diff --git a/cmake_targets/autotests/test.0103/CMakeLists.txt b/cmake_targets/autotests/test.0103/CMakeLists.txt index 2d4e85aec3..2ca2c6c576 100644 --- a/cmake_targets/autotests/test.0103/CMakeLists.txt +++ b/cmake_targets/autotests/test.0103/CMakeLists.txt @@ -10,7 +10,6 @@ set ( ENABLE_FXP True ) set ( ENABLE_ITTI False ) set ( ENABLE_NAS_UE_LOGGING False ) set ( ENABLE_NEW_MULTICAST False ) -set ( ENABLE_PDCP_NETLINK_FIFO False ) set ( ENABLE_PGM_TRANSPORT False ) set ( ENABLE_RAL False ) set ( ENABLE_SECURITY False ) diff --git a/cmake_targets/autotests/test.0106/CMakeLists.txt b/cmake_targets/autotests/test.0106/CMakeLists.txt index 5e12f11149..cc84cd5962 100644 --- a/cmake_targets/autotests/test.0106/CMakeLists.txt +++ b/cmake_targets/autotests/test.0106/CMakeLists.txt @@ -8,7 +8,6 @@ set(ENABLE_FXP True) set(ENABLE_ITTI True) set(ENABLE_NAS_UE_LOGGING False) set(ENABLE_NEW_MULTICAST True) -set(ENABLE_PDCP_NETLINK_FIFO False) set(ENABLE_PGM_TRANSPORT True) set(ENABLE_RAL False) set(ENABLE_SECURITY False) diff --git a/cmake_targets/autotests/test.0107/CMakeLists.txt b/cmake_targets/autotests/test.0107/CMakeLists.txt index aa4f098d78..a99358a2ad 100644 --- a/cmake_targets/autotests/test.0107/CMakeLists.txt +++ b/cmake_targets/autotests/test.0107/CMakeLists.txt @@ -10,7 +10,6 @@ set ( ENABLE_FXP True ) set ( ENABLE_ITTI False ) set ( ENABLE_NAS_UE_LOGGING False ) set ( ENABLE_NEW_MULTICAST True ) -set ( ENABLE_PDCP_NETLINK_FIFO False ) set ( ENABLE_PGM_TRANSPORT True ) set ( ENABLE_RAL False ) set ( ENABLE_SECURITY False ) diff --git a/cmake_targets/autotests/test.0108/CMakeLists.txt b/cmake_targets/autotests/test.0108/CMakeLists.txt index a0648e1767..daa83facf4 100644 --- a/cmake_targets/autotests/test.0108/CMakeLists.txt +++ b/cmake_targets/autotests/test.0108/CMakeLists.txt @@ -8,7 +8,6 @@ set(ENABLE_FXP True) set(ENABLE_ITTI True) set(ENABLE_NAS_UE_LOGGING False) set(ENABLE_NEW_MULTICAST True) -set(ENABLE_PDCP_NETLINK_FIFO False) set(ENABLE_PGM_TRANSPORT True) set(ENABLE_RAL False) set(ENABLE_SECURITY False) diff --git a/cmake_targets/autotests/test.0114/CMakeLists.txt b/cmake_targets/autotests/test.0114/CMakeLists.txt index 1f85bc1042..893b203b07 100644 --- a/cmake_targets/autotests/test.0114/CMakeLists.txt +++ b/cmake_targets/autotests/test.0114/CMakeLists.txt @@ -8,7 +8,6 @@ set(ENABLE_FXP True) set(ENABLE_ITTI True) set(ENABLE_NAS_UE_LOGGING False) set(ENABLE_NEW_MULTICAST True) -set(ENABLE_PDCP_NETLINK_FIFO True) set(ENABLE_PGM_TRANSPORT True) set(ENABLE_RAL True) set(ENABLE_SECURITY False) diff --git a/cmake_targets/autotests/test.0115/CMakeLists.txt b/cmake_targets/autotests/test.0115/CMakeLists.txt index 147c01f852..83936f1159 100644 --- a/cmake_targets/autotests/test.0115/CMakeLists.txt +++ b/cmake_targets/autotests/test.0115/CMakeLists.txt @@ -10,7 +10,6 @@ set ( ENABLE_FXP True ) set ( ENABLE_ITTI True ) set ( ENABLE_NAS_UE_LOGGING False ) set ( ENABLE_NEW_MULTICAST True ) -set ( ENABLE_PDCP_NETLINK_FIFO False ) set ( ENABLE_PGM_TRANSPORT True ) set ( ENABLE_RAL True ) set ( ENABLE_SECURITY False ) diff --git a/cmake_targets/autotests/test.0120/CMakeLists.txt b/cmake_targets/autotests/test.0120/CMakeLists.txt index 37e9dc3791..dd0a607ed9 100644 --- a/cmake_targets/autotests/test.0120/CMakeLists.txt +++ b/cmake_targets/autotests/test.0120/CMakeLists.txt @@ -10,7 +10,6 @@ set ( ENABLE_FXP True ) set ( ENABLE_ITTI False ) set ( ENABLE_NAS_UE_LOGGING False ) set ( ENABLE_NEW_MULTICAST True ) -set ( ENABLE_PDCP_NETLINK_FIFO False ) set ( ENABLE_PGM_TRANSPORT True ) set ( ENABLE_RAL False ) set ( ENABLE_SECURITY False ) diff --git a/cmake_targets/epc_build_oai/CMakeLists.template b/cmake_targets/epc_build_oai/CMakeLists.template index b93370b503..14819cec34 100644 --- a/cmake_targets/epc_build_oai/CMakeLists.template +++ b/cmake_targets/epc_build_oai/CMakeLists.template @@ -12,7 +12,6 @@ set ( ENABLE_FXP False ) set ( ENABLE_ITTI True ) set ( ENABLE_NAS_UE_LOGGING False ) set ( ENABLE_NEW_MULTICAST False ) -set ( ENABLE_PDCP_NETLINK_FIFO False ) set ( ENABLE_PGM_TRANSPORT False ) set ( ENABLE_RAL False ) set ( ENABLE_SECURITY False ) diff --git a/cmake_targets/lte_noS1_build_oai/CMakeLists.txt b/cmake_targets/lte_noS1_build_oai/CMakeLists.txt index 19c684d31b..c1ab6b0f89 100644 --- a/cmake_targets/lte_noS1_build_oai/CMakeLists.txt +++ b/cmake_targets/lte_noS1_build_oai/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 2.8) set(XFORMS 1 ) set(RRC_ASN1_VERSION "Rel10") set(ENABLE_VCD_FIFO False ) -set(RF_BOARD "EXMIMO") +set(RF_BOARD "OAI_USRP") set(NAS 1) set(ENABLE_ITTI False) set(ENABLE_USE_MME False) diff --git a/cmake_targets/oaisim_build_oai/CMakeLists.template b/cmake_targets/oaisim_build_oai/CMakeLists.template index 7b5de3093f..b2955cd20f 100644 --- a/cmake_targets/oaisim_build_oai/CMakeLists.template +++ b/cmake_targets/oaisim_build_oai/CMakeLists.template @@ -10,7 +10,6 @@ set ( ENABLE_FXP True ) set ( ENABLE_ITTI True ) set ( ENABLE_NAS_UE_LOGGING True ) set ( ENABLE_NEW_MULTICAST True ) -set ( ENABLE_PDCP_NETLINK_FIFO False ) set ( ENABLE_PGM_TRANSPORT True ) set ( ENABLE_RAL False ) set ( ENABLE_SECURITY True ) diff --git a/cmake_targets/oaisim_mme_build_oai/CMakeLists.template b/cmake_targets/oaisim_mme_build_oai/CMakeLists.template index dcac0c4f97..7a0f3c2d95 100644 --- a/cmake_targets/oaisim_mme_build_oai/CMakeLists.template +++ b/cmake_targets/oaisim_mme_build_oai/CMakeLists.template @@ -10,7 +10,6 @@ set ( ENABLE_FXP False ) set ( ENABLE_ITTI True ) set ( ENABLE_NAS_UE_LOGGING False ) set ( ENABLE_NEW_MULTICAST False ) -set ( ENABLE_PDCP_NETLINK_FIFO False ) set ( ENABLE_PGM_TRANSPORT False ) set ( ENABLE_RAL False ) set ( ENABLE_SECURITY False ) diff --git a/cmake_targets/oaisim_noS1_build_oai/CMakeLists.template b/cmake_targets/oaisim_noS1_build_oai/CMakeLists.template index 67bb68d54b..c531d9f7eb 100644 --- a/cmake_targets/oaisim_noS1_build_oai/CMakeLists.template +++ b/cmake_targets/oaisim_noS1_build_oai/CMakeLists.template @@ -10,7 +10,6 @@ set ( ENABLE_FXP True ) set ( ENABLE_ITTI True ) set ( ENABLE_NAS_UE_LOGGING False ) set ( ENABLE_NEW_MULTICAST True ) -set ( ENABLE_PDCP_NETLINK_FIFO False ) set ( ENABLE_PGM_TRANSPORT True ) set ( ENABLE_RAL False ) set ( ENABLE_SECURITY False ) diff --git a/openair1/PHY/INIT/lte_parms.c b/openair1/PHY/INIT/lte_parms.c index 08ece491fc..7d6976870a 100644 --- a/openair1/PHY/INIT/lte_parms.c +++ b/openair1/PHY/INIT/lte_parms.c @@ -33,6 +33,8 @@ int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf) uint8_t log2_osf; + LOG_I(PHY,"Initializing frame parms for N_RB_DL %d, Ncp %d, osf %d\n",frame_parms->N_RB_DL,frame_parms->Ncp,osf); + if (frame_parms->Ncp==1) { frame_parms->nb_prefix_samples0=512; frame_parms->nb_prefix_samples = 512; diff --git a/openair1/PHY/LTE_ESTIMATION/defs.h b/openair1/PHY/LTE_ESTIMATION/defs.h index ee8d9d8c6f..bc76c8a38a 100644 --- a/openair1/PHY/LTE_ESTIMATION/defs.h +++ b/openair1/PHY/LTE_ESTIMATION/defs.h @@ -156,11 +156,13 @@ We estimate the frequency offset by calculating the phase difference between cha \param frame_parms pointer to LTE frame parameters \param l symbol within slot \param freq_offset pointer to the returned frequency offset +\param reset When non-zer it resets the filter to the initial value (set whenever tuning has been changed or for a one-shot estimate) */ int lte_est_freq_offset(int **dl_ch_estimates, LTE_DL_FRAME_PARMS *frame_parms, int l, - int* freq_offset); + int* freq_offset, + int reset); int lte_mbsfn_est_freq_offset(int **dl_ch_estimates, LTE_DL_FRAME_PARMS *frame_parms, diff --git a/openair1/PHY/LTE_ESTIMATION/lte_est_freq_offset.c b/openair1/PHY/LTE_ESTIMATION/lte_est_freq_offset.c index 0aab535e1a..77e5be8500 100644 --- a/openair1/PHY/LTE_ESTIMATION/lte_est_freq_offset.c +++ b/openair1/PHY/LTE_ESTIMATION/lte_est_freq_offset.c @@ -60,6 +60,7 @@ int dl_channel_level(int16_t *dl_ch, } + DevAssert( frame_parms->N_RB_DL ); avg = (((int*)&avg128F)[0] + ((int*)&avg128F)[1] + ((int*)&avg128F)[2] + @@ -76,7 +77,8 @@ int dl_channel_level(int16_t *dl_ch, int lte_est_freq_offset(int **dl_ch_estimates, LTE_DL_FRAME_PARMS *frame_parms, int l, - int* freq_offset) + int* freq_offset, + int reset) { int ch_offset, omega, dl_ch_shift; @@ -89,6 +91,9 @@ int lte_est_freq_offset(int **dl_ch_estimates, int coef = 1<<10; int ncoef = 32767 - coef; + // initialize the averaging filter to initial value + if (reset!=0) + first_run=1; ch_offset = (l*(frame_parms->ofdm_symbol_size)); @@ -134,13 +139,13 @@ int lte_est_freq_offset(int **dl_ch_estimates, omega_cpx->i += ((struct complex16*) &omega)->i; // phase_offset += atan2((double)omega_cpx->i,(double)omega_cpx->r); phase_offset += atan2((double)omega_cpx->i,(double)omega_cpx->r); - // LOG_D(PHY,"omega (%d,%d) -> %f\n",omega_cpx->r,omega_cpx->i,phase_offset); + // LOG_I(PHY,"omega (%d,%d) -> %f\n",omega_cpx->r,omega_cpx->i,phase_offset); } // phase_offset /= (frame_parms->nb_antennas_rx*frame_parms->nb_antennas_tx); freq_offset_est = (int) (phase_offset/(2*M_PI)/(frame_parms->Ncp==NORMAL ? (285.8e-6):(2.5e-4))); //2.5e-4 is the time between pilot symbols - // LOG_D(PHY,"symbol %d : freq_offset_est %d\n",l,freq_offset_est); + // LOG_I(PHY,"symbol %d : freq_offset_est %d\n",l,freq_offset_est); // update freq_offset with phase_offset using a moving average filter if (first_run == 1) { diff --git a/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c b/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c index 39771d6289..bff1a7a861 100644 --- a/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c +++ b/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c @@ -504,12 +504,12 @@ int lte_sync_time(int **rxdata, ///rx data in time domain #ifdef USER_MODE - if (debug_cnt == 5) { + if (debug_cnt == 0) { write_output("sync_corr0_ue.m","synccorr0",sync_corr_ue0,2*length,1,2); write_output("sync_corr1_ue.m","synccorr1",sync_corr_ue1,2*length,1,2); write_output("sync_corr2_ue.m","synccorr2",sync_corr_ue2,2*length,1,2); write_output("rxdata0.m","rxd0",rxdata[0],length<<1,1,1); - exit(-1); + // exit(-1); } else { debug_cnt++; } diff --git a/openair1/PHY/LTE_ESTIMATION/lte_ue_measurements.c b/openair1/PHY/LTE_ESTIMATION/lte_ue_measurements.c index 73b524aafe..dbd385dbdc 100644 --- a/openair1/PHY/LTE_ESTIMATION/lte_ue_measurements.c +++ b/openair1/PHY/LTE_ESTIMATION/lte_ue_measurements.c @@ -75,6 +75,7 @@ int16_t get_PL(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index) { PHY_VARS_UE *phy_vars_ue = PHY_vars_UE_g[Mod_id][CC_id]; + /* int RSoffset; @@ -82,7 +83,7 @@ int16_t get_PL(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index) RSoffset = 6; else RSoffset = 3; - + */ LOG_D(PHY,"get_PL : Frame %d : rsrp %f dBm/RE (%f), eNB power %d dBm/RE\n", phy_vars_ue->frame_rx, (1.0*dB_fixed_times10(phy_vars_ue->PHY_measurements.rsrp[eNB_index])-(10.0*phy_vars_ue->rx_total_gain_dB))/10.0, @@ -204,47 +205,83 @@ void ue_rrc_measurements(PHY_VARS_UE *phy_vars_ue, if (phy_vars_ue->lte_frame_parms.Ncp==NORMAL) { for (aarx=0; aarx<phy_vars_ue->lte_frame_parms.nb_antennas_rx; aarx++) { - rxF_sss = (int16_t *)&phy_vars_ue->lte_ue_common_vars.rxdataF[aarx][(5*phy_vars_ue->lte_frame_parms.ofdm_symbol_size)]; - rxF_pss = (int16_t *)&phy_vars_ue->lte_ue_common_vars.rxdataF[aarx][(6*phy_vars_ue->lte_frame_parms.ofdm_symbol_size)]; - + rxF_sss = (int16_t *)&phy_vars_ue->lte_ue_common_vars.rxdataF[aarx][(5*phy_vars_ue->lte_frame_parms.ofdm_symbol_size)]; + rxF_pss = (int16_t *)&phy_vars_ue->lte_ue_common_vars.rxdataF[aarx][(6*phy_vars_ue->lte_frame_parms.ofdm_symbol_size)]; + //-ve spectrum from SSS - phy_vars_ue->PHY_measurements.n0_power[aarx] = (((int32_t)rxF_pss[-72]*rxF_pss[-72])+((int32_t)rxF_pss[-71]*rxF_pss[-71])); - phy_vars_ue->PHY_measurements.n0_power[aarx] += (((int32_t)rxF_pss[-70]*rxF_pss[-70])+((int32_t)rxF_pss[-69]*rxF_pss[-69])); + // printf("slot %d: SSS DTX: %d,%d, non-DTX %d,%d\n",slot,rxF_pss[-72],rxF_pss[-71],rxF_pss[-36],rxF_pss[-35]); + + // phy_vars_ue->PHY_measurements.n0_power[aarx] = (((int32_t)rxF_pss[-72]*rxF_pss[-72])+((int32_t)rxF_pss[-71]*rxF_pss[-71])); + // printf("sssn36 %d\n",phy_vars_ue->PHY_measurements.n0_power[aarx]); + phy_vars_ue->PHY_measurements.n0_power[aarx] = (((int32_t)rxF_pss[-70]*rxF_pss[-70])+((int32_t)rxF_pss[-69]*rxF_pss[-69])); phy_vars_ue->PHY_measurements.n0_power[aarx] += (((int32_t)rxF_pss[-68]*rxF_pss[-68])+((int32_t)rxF_pss[-67]*rxF_pss[-67])); phy_vars_ue->PHY_measurements.n0_power[aarx] += (((int32_t)rxF_pss[-66]*rxF_pss[-66])+((int32_t)rxF_pss[-65]*rxF_pss[-65])); - phy_vars_ue->PHY_measurements.n0_power[aarx] += (((int32_t)rxF_pss[-64]*rxF_pss[-64])+((int32_t)rxF_pss[-63]*rxF_pss[-63])); + // phy_vars_ue->PHY_measurements.n0_power[aarx] += (((int32_t)rxF_pss[-64]*rxF_pss[-64])+((int32_t)rxF_pss[-63]*rxF_pss[-63])); + // printf("sssm32 %d\n",phy_vars_ue->PHY_measurements.n0_power[aarx]); //+ve spectrum from SSS - phy_vars_ue->PHY_measurements.n0_power[aarx] += (((int32_t)rxF_sss[2+72]*rxF_sss[2+72])+((int32_t)rxF_sss[2+71]*rxF_sss[2+71])); - phy_vars_ue->PHY_measurements.n0_power[aarx] += (((int32_t)rxF_sss[2+70]*rxF_sss[2+70])+((int32_t)rxF_sss[2+69]*rxF_sss[2+69])); + phy_vars_ue->PHY_measurements.n0_power[aarx] += (((int32_t)rxF_sss[2+70]*rxF_sss[2+70])+((int32_t)rxF_sss[2+69]*rxF_sss[2+69])); phy_vars_ue->PHY_measurements.n0_power[aarx] += (((int32_t)rxF_sss[2+68]*rxF_sss[2+68])+((int32_t)rxF_sss[2+67]*rxF_sss[2+67])); phy_vars_ue->PHY_measurements.n0_power[aarx] += (((int32_t)rxF_sss[2+66]*rxF_sss[2+66])+((int32_t)rxF_sss[2+65]*rxF_sss[2+65])); - phy_vars_ue->PHY_measurements.n0_power[aarx] += (((int32_t)rxF_sss[2+64]*rxF_sss[2+64])+((int32_t)rxF_sss[2+63]*rxF_sss[2+63])); + // phy_vars_ue->PHY_measurements.n0_power[aarx] += (((int32_t)rxF_sss[2+64]*rxF_sss[2+64])+((int32_t)rxF_sss[2+63]*rxF_sss[2+63])); + // printf("sssp32 %d\n",phy_vars_ue->PHY_measurements.n0_power[aarx]); //+ve spectrum from PSS - phy_vars_ue->PHY_measurements.n0_power[aarx] += (((int32_t)rxF_pss[2+72]*rxF_pss[2+72])+((int32_t)rxF_pss[2+71]*rxF_pss[2+71])); phy_vars_ue->PHY_measurements.n0_power[aarx] += (((int32_t)rxF_pss[2+70]*rxF_pss[2+70])+((int32_t)rxF_pss[2+69]*rxF_pss[2+69])); phy_vars_ue->PHY_measurements.n0_power[aarx] += (((int32_t)rxF_pss[2+68]*rxF_pss[2+68])+((int32_t)rxF_pss[2+67]*rxF_pss[2+67])); phy_vars_ue->PHY_measurements.n0_power[aarx] += (((int32_t)rxF_pss[2+66]*rxF_pss[2+66])+((int32_t)rxF_pss[2+65]*rxF_pss[2+65])); - phy_vars_ue->PHY_measurements.n0_power[aarx] += (((int32_t)rxF_pss[2+64]*rxF_pss[2+64])+((int32_t)rxF_pss[2+63]*rxF_pss[2+63])); - //-ve spectrum from PSS + // phy_vars_ue->PHY_measurements.n0_power[aarx] += (((int32_t)rxF_pss[2+64]*rxF_pss[2+64])+((int32_t)rxF_pss[2+63]*rxF_pss[2+63])); + // printf("pss32 %d\n",phy_vars_ue->PHY_measurements.n0_power[aarx]); //-ve spectrum from PSS rxF_pss = (int16_t *)&phy_vars_ue->lte_ue_common_vars.rxdataF[aarx][(7*phy_vars_ue->lte_frame_parms.ofdm_symbol_size)]; - phy_vars_ue->PHY_measurements.n0_power[aarx] += (((int32_t)rxF_pss[-72]*rxF_pss[-72])+((int32_t)rxF_pss[-71]*rxF_pss[-71])); + // phy_vars_ue->PHY_measurements.n0_power[aarx] += (((int32_t)rxF_pss[-72]*rxF_pss[-72])+((int32_t)rxF_pss[-71]*rxF_pss[-71])); + // printf("pssm36 %d\n",phy_vars_ue->PHY_measurements.n0_power[aarx]); phy_vars_ue->PHY_measurements.n0_power[aarx] += (((int32_t)rxF_pss[-70]*rxF_pss[-70])+((int32_t)rxF_pss[-69]*rxF_pss[-69])); phy_vars_ue->PHY_measurements.n0_power[aarx] += (((int32_t)rxF_pss[-68]*rxF_pss[-68])+((int32_t)rxF_pss[-67]*rxF_pss[-67])); phy_vars_ue->PHY_measurements.n0_power[aarx] += (((int32_t)rxF_pss[-66]*rxF_pss[-66])+((int32_t)rxF_pss[-65]*rxF_pss[-65])); - phy_vars_ue->PHY_measurements.n0_power[aarx] += (((int32_t)rxF_pss[-64]*rxF_pss[-64])+((int32_t)rxF_pss[-63]*rxF_pss[-63])); - phy_vars_ue->PHY_measurements.n0_power_dB[aarx] = (unsigned short) dB_fixed(phy_vars_ue->PHY_measurements.n0_power[aarx]/10); + // phy_vars_ue->PHY_measurements.n0_power[aarx] += (((int32_t)rxF_pss[-64]*rxF_pss[-64])+((int32_t)rxF_pss[-63]*rxF_pss[-63])); + // printf("pssm32 %d\n",phy_vars_ue->PHY_measurements.n0_power[aarx]); + phy_vars_ue->PHY_measurements.n0_power_dB[aarx] = (unsigned short) dB_fixed(phy_vars_ue->PHY_measurements.n0_power[aarx]*phy_vars_ue->lte_frame_parms.ofdm_symbol_size/12); phy_vars_ue->PHY_measurements.n0_power_tot += phy_vars_ue->PHY_measurements.n0_power[aarx]; } - phy_vars_ue->PHY_measurements.n0_power_tot_dB = (unsigned short) dB_fixed(phy_vars_ue->PHY_measurements.n0_power_tot/20); + phy_vars_ue->PHY_measurements.n0_power_tot_dB = (unsigned short) dB_fixed(phy_vars_ue->PHY_measurements.n0_power_tot/(12*aarx*phy_vars_ue->lte_frame_parms.ofdm_symbol_size)); phy_vars_ue->PHY_measurements.n0_power_tot_dBm = phy_vars_ue->PHY_measurements.n0_power_tot_dB - phy_vars_ue->rx_total_gain_dB; - - } + } } + else if ((phy_vars_ue->lte_frame_parms.frame_type == TDD) && + (slot == 1)) { // TDD SSS, compute noise in DTX REs + + if (phy_vars_ue->lte_frame_parms.Ncp==NORMAL) { + for (aarx=0; aarx<phy_vars_ue->lte_frame_parms.nb_antennas_rx; aarx++) { + + rxF_sss = (int16_t *)&phy_vars_ue->lte_ue_common_vars.rxdataF[aarx][(6*phy_vars_ue->lte_frame_parms.ofdm_symbol_size)]; + // note this is a dummy pointer, the pss is not really there! + // in FDD the pss is in the symbol after the sss, but not in TDD + rxF_pss = (int16_t *)&phy_vars_ue->lte_ue_common_vars.rxdataF[aarx][(7*phy_vars_ue->lte_frame_parms.ofdm_symbol_size)]; + + //-ve spectrum from SSS + // phy_vars_ue->PHY_measurements.n0_power[aarx] = (((int32_t)rxF_pss[-72]*rxF_pss[-72])+((int32_t)rxF_pss[-71]*rxF_pss[-71])); + phy_vars_ue->PHY_measurements.n0_power[aarx] = (((int32_t)rxF_pss[-70]*rxF_pss[-70])+((int32_t)rxF_pss[-69]*rxF_pss[-69])); + phy_vars_ue->PHY_measurements.n0_power[aarx] += (((int32_t)rxF_pss[-68]*rxF_pss[-68])+((int32_t)rxF_pss[-67]*rxF_pss[-67])); + phy_vars_ue->PHY_measurements.n0_power[aarx] += (((int32_t)rxF_pss[-66]*rxF_pss[-66])+((int32_t)rxF_pss[-65]*rxF_pss[-65])); + // phy_vars_ue->PHY_measurements.n0_power[aarx] += (((int32_t)rxF_pss[-64]*rxF_pss[-64])+((int32_t)rxF_pss[-63]*rxF_pss[-63])); + //+ve spectrum from SSS + // phy_vars_ue->PHY_measurements.n0_power[aarx] += (((int32_t)rxF_sss[2+72]*rxF_sss[2+72])+((int32_t)rxF_sss[2+71]*rxF_sss[2+71])); + phy_vars_ue->PHY_measurements.n0_power[aarx] = (((int32_t)rxF_sss[2+70]*rxF_sss[2+70])+((int32_t)rxF_sss[2+69]*rxF_sss[2+69])); + phy_vars_ue->PHY_measurements.n0_power[aarx] += (((int32_t)rxF_sss[2+68]*rxF_sss[2+68])+((int32_t)rxF_sss[2+67]*rxF_sss[2+67])); + phy_vars_ue->PHY_measurements.n0_power[aarx] += (((int32_t)rxF_sss[2+66]*rxF_sss[2+66])+((int32_t)rxF_sss[2+65]*rxF_sss[2+65])); + // phy_vars_ue->PHY_measurements.n0_power[aarx] += (((int32_t)rxF_sss[2+64]*rxF_sss[2+64])+((int32_t)rxF_sss[2+63]*rxF_sss[2+63])); + + phy_vars_ue->PHY_measurements.n0_power_dB[aarx] = (unsigned short) dB_fixed(phy_vars_ue->PHY_measurements.n0_power[aarx]/(6*phy_vars_ue->lte_frame_parms.ofdm_symbol_size)); + phy_vars_ue->PHY_measurements.n0_power_tot += phy_vars_ue->PHY_measurements.n0_power[aarx]; + } + phy_vars_ue->PHY_measurements.n0_power_tot_dB = (unsigned short) dB_fixed(phy_vars_ue->PHY_measurements.n0_power_tot/(6*aarx*phy_vars_ue->lte_frame_parms.ofdm_symbol_size)); + phy_vars_ue->PHY_measurements.n0_power_tot_dBm = phy_vars_ue->PHY_measurements.n0_power_tot_dB - phy_vars_ue->rx_total_gain_dB; + + + } + } } } - // recompute nushift with eNB_offset corresponding to adjacent eNB on which to perform channel estimation // printf("[PHY][UE %d] Frame %d slot %d Doing ue_rrc_measurements rsrp/rssi (Nid_cell %d, Nid2 %d, nushift %d, eNB_offset %d)\n",phy_vars_ue->Mod_id,phy_vars_ue->frame,slot,Nid_cell,Nid2,nushift,eNB_offset); if (eNB_offset > 0) @@ -265,7 +302,7 @@ void ue_rrc_measurements(PHY_VARS_UE *phy_vars_ue, for (l=0,nu=0; l<=(4-phy_vars_ue->lte_frame_parms.Ncp); l+=(4-phy_vars_ue->lte_frame_parms.Ncp),nu=3) { k = (nu + nushift)%6; #ifdef DEBUG_MEAS - LOG_D(PHY,"[UE %d] Frame %d slot %d Doing ue_rrc_measurements rsrp/rssi (Nid_cell %d, nushift %d, eNB_offset %d, k %d, l %d)\n",phy_vars_ue->Mod_id,phy_vars_ue->frame_rx,slot,Nid_cell,nushift, + LOG_I(PHY,"[UE %d] Frame %d slot %d Doing ue_rrc_measurements rsrp/rssi (Nid_cell %d, nushift %d, eNB_offset %d, k %d, l %d)\n",phy_vars_ue->Mod_id,phy_vars_ue->frame_rx,slot,Nid_cell,nushift, eNB_offset,k,l); #endif @@ -280,10 +317,10 @@ void ue_rrc_measurements(PHY_VARS_UE *phy_vars_ue, phy_vars_ue->PHY_measurements.rsrp[eNB_offset] += (((int32_t)(rxF[off])*rxF[off])+((int32_t)(rxF[off+1])*rxF[off+1])); // printf("rb %d, off %d : %d\n",rb,off,((((int32_t)rxF[off])*rxF[off])+((int32_t)(rxF[off+1])*rxF[off+1]))); - /* if ((phy_vars_ue->frame_rx&0x3ff) == 0) - printf("rb %d, off %d : %d\n",rb,off,((rxF[off]*rxF[off])+(rxF[off+1]*rxF[off+1]))); + // if ((phy_vars_ue->frame_rx&0x3ff) == 0) + // printf("rb %d, off %d : %d\n",rb,off,((rxF[off]*rxF[off])+(rxF[off+1]*rxF[off+1]))); - */ + off+=12; if (off>=(phy_vars_ue->lte_frame_parms.ofdm_symbol_size<<1)) @@ -317,13 +354,10 @@ void ue_rrc_measurements(PHY_VARS_UE *phy_vars_ue, } } - // 2 RE per PRB // phy_vars_ue->PHY_measurements.rsrp[eNB_offset]/=(24*phy_vars_ue->lte_frame_parms.N_RB_DL); phy_vars_ue->PHY_measurements.rsrp[eNB_offset]/=(2*phy_vars_ue->lte_frame_parms.N_RB_DL*phy_vars_ue->lte_frame_parms.ofdm_symbol_size); - LOG_D(PHY,"eNB: %d, RSRP: %d \n",eNB_offset,phy_vars_ue->PHY_measurements.rsrp[eNB_offset]); - - + // LOG_I(PHY,"eNB: %d, RSRP: %d \n",eNB_offset,phy_vars_ue->PHY_measurements.rsrp[eNB_offset]); if (eNB_offset == 0) { // phy_vars_ue->PHY_measurements.rssi/=(24*phy_vars_ue->lte_frame_parms.N_RB_DL); // phy_vars_ue->PHY_measurements.rssi*=rx_power_correction; @@ -347,16 +381,16 @@ void ue_rrc_measurements(PHY_VARS_UE *phy_vars_ue, #ifdef DEBUG_MEAS - if (slot == 0) { + // if (slot == 0) { if (eNB_offset == 0) - LOG_D(PHY,"[UE %d] Frame %d, slot %d RRC Measurements => rssi %3.1f dBm (digital: %3.1f dB, gain %d), N0 %d dBm\n",phy_vars_ue->Mod_id, + LOG_I(PHY,"[UE %d] Frame %d, slot %d RRC Measurements => rssi %3.1f dBm (digital: %3.1f dB, gain %d), N0 %d dBm\n",phy_vars_ue->Mod_id, phy_vars_ue->frame_rx,slot,10*log10(phy_vars_ue->PHY_measurements.rssi)-phy_vars_ue->rx_total_gain_dB, 10*log10(phy_vars_ue->PHY_measurements.rssi), phy_vars_ue->rx_total_gain_dB, phy_vars_ue->PHY_measurements.n0_power_tot_dBm); - LOG_D(PHY,"[UE %d] Frame %d, slot %d RRC Measurements (idx %d, Cell id %d) => rsrp: %3.1f dBm/RE (%d), rsrq: %3.1f dB\n", + LOG_I(PHY,"[UE %d] Frame %d, slot %d RRC Measurements (idx %d, Cell id %d) => rsrp: %3.1f dBm/RE (%d), rsrq: %3.1f dB\n", phy_vars_ue->Mod_id, phy_vars_ue->frame_rx,slot,eNB_offset, (eNB_offset>0) ? phy_vars_ue->PHY_measurements.adj_cell_id[eNB_offset-1] : phy_vars_ue->lte_frame_parms.Nid_cell, @@ -369,7 +403,7 @@ void ue_rrc_measurements(PHY_VARS_UE *phy_vars_ue, //LOG_D(PHY,"gain_loss_dB: %d \n",phy_vars_ue->rx_total_gain_dB); //LOG_D(PHY,"gain_fixed_dB: %d \n",dB_fixed(phy_vars_ue->lte_frame_parms.N_RB_DL*12)); - } + // } #endif } @@ -383,7 +417,7 @@ void lte_ue_measurements(PHY_VARS_UE *phy_vars_ue, { - int aarx,aatx,eNB_id=0,gain_offset=0; + int aarx,aatx,eNB_id=0; //,gain_offset=0; //int rx_power[NUMBER_OF_CONNECTED_eNB_MAX]; int i; unsigned int limit,subband; diff --git a/openair1/PHY/LTE_TRANSPORT/dci.c b/openair1/PHY/LTE_TRANSPORT/dci.c index 27207272d5..f46e43a58a 100644 --- a/openair1/PHY/LTE_TRANSPORT/dci.c +++ b/openair1/PHY/LTE_TRANSPORT/dci.c @@ -675,6 +675,7 @@ void pdcch_channel_level(int32_t **dl_ch_estimates_ext, */ } + DevAssert( nb_rb ); avg[(aatx<<1)+aarx] = (((int32_t*)&avg128P)[0] + ((int32_t*)&avg128P)[1] + ((int32_t*)&avg128P)[2] + @@ -2542,6 +2543,7 @@ void dci_decoding_procedure0(LTE_UE_PDCCH **lte_ue_pdcch_vars,int do_common,uint else { LOG_E(PHY,"Illegal CCEind %d (Yk %d, m %d, nCCE %d, L2 %d\n",CCEind,Yk,m,nCCE,L2); mac_xface->macphy_exit("Illegal CCEind\n"); + return; // not reached } switch (L2) { @@ -2560,6 +2562,11 @@ void dci_decoding_procedure0(LTE_UE_PDCCH **lte_ue_pdcch_vars,int do_common,uint case 8: CCEmap_mask = (0xff<<(CCEind&0x1f)); break; + + default: + LOG_E( PHY, "Illegal L2 value %d\n", L2 ); + mac_xface->macphy_exit( "Illegal L2\n" ); + return; // not reached } CCEmap_cand = (*CCEmap)&CCEmap_mask; diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c b/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c index a1f1173ede..61d91cc217 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c @@ -248,8 +248,8 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue, // printf("nb_rb = %d, eNB_id %d\n",nb_rb,eNB_id); if (nb_rb==0) { - LOG_W(PHY,"dlsch_demodulation.c: nb_rb=0\n"); - return(-1); + //LOG_W(PHY,"dlsch_demodulation.c: nb_rb=0\n"); + return(0); } /* diff --git a/openair1/PHY/LTE_TRANSPORT/initial_sync.c b/openair1/PHY/LTE_TRANSPORT/initial_sync.c index e1b5a20867..547b73d79f 100644 --- a/openair1/PHY/LTE_TRANSPORT/initial_sync.c +++ b/openair1/PHY/LTE_TRANSPORT/initial_sync.c @@ -48,14 +48,18 @@ #include "gain_control.h" #endif -#define DEBUG_INITIAL_SYNCH +#if defined(OAI_USRP) || defined(EXMIMO) +#include "common_lib.h" +extern openair0_config_t openair0_cfg[]; +#endif +//#define DEBUG_INITIAL_SYNCH -int pbch_detection(PHY_VARS_UE *phy_vars_ue, runmode_t mode) +int pbch_detection(PHY_VARS_UE *phy_vars_ue, runmode_t mode) { - uint8_t l,pbch_decoded,frame_mod4,pbch_tx_ant,dummy; - LTE_DL_FRAME_PARMS *frame_parms=&phy_vars_ue->lte_frame_parms; - char phich_resource[6]; +uint8_t l,pbch_decoded,frame_mod4,pbch_tx_ant,dummy; +LTE_DL_FRAME_PARMS *frame_parms=&phy_vars_ue->lte_frame_parms; +char phich_resource[6]; #ifdef DEBUG_INITIAL_SYNCH LOG_I(PHY,"[UE%d] Initial sync: starting PBCH detection (rx_offset %d)\n",phy_vars_ue->Mod_id, @@ -65,25 +69,46 @@ int pbch_detection(PHY_VARS_UE *phy_vars_ue, runmode_t mode) for (l=0; l<frame_parms->symbols_per_tti/2; l++) { slot_fep(phy_vars_ue, - l, - 1, - phy_vars_ue->rx_offset, - 0); - } + l, + 0, + phy_vars_ue->rx_offset, + 0, + 1); + } + for (l=0; l<frame_parms->symbols_per_tti/2; l++) { + slot_fep(phy_vars_ue, + l, + 1, + phy_vars_ue->rx_offset, + 0, + 1); + } slot_fep(phy_vars_ue, - 0, - 2, - phy_vars_ue->rx_offset, - 0); + 0, + 2, + phy_vars_ue->rx_offset, + 0, + 1); lte_ue_measurements(phy_vars_ue, - phy_vars_ue->rx_offset, - 0, - 0); - + phy_vars_ue->rx_offset, + 0, + 0); + + + if (phy_vars_ue->lte_frame_parms.frame_type == TDD) { + ue_rrc_measurements(phy_vars_ue, + 1, + 0); + } + else { + ue_rrc_measurements(phy_vars_ue, + 0, + 0); + } #ifdef DEBUG_INITIAL_SYNCH - LOG_I(PHY,"[UE %d][initial sync] RX RSSI %d dBm, digital (%d, %d) dB, linear (%d, %d), avg rx power %d dB (%d lin), RX gain %d dB\n", + LOG_I(PHY,"[UE %d] RX RSSI %d dBm, digital (%d, %d) dB, linear (%d, %d), avg rx power %d dB (%d lin), RX gain %d dB\n", phy_vars_ue->Mod_id, phy_vars_ue->PHY_measurements.rx_rssi_dBm[0] - ((phy_vars_ue->lte_frame_parms.nb_antennas_rx==2) ? 3 : 0), phy_vars_ue->PHY_measurements.rx_power_dB[0][0], @@ -94,7 +119,7 @@ int pbch_detection(PHY_VARS_UE *phy_vars_ue, runmode_t mode) phy_vars_ue->PHY_measurements.rx_power_avg[0], phy_vars_ue->rx_total_gain_dB); - LOG_I(PHY,"[UE %d][initial sync] N0 %d dBm digital (%d, %d) dB, linear (%d, %d), avg noise power %d dB (%d lin)\n", + LOG_I(PHY,"[UE %d] N0 %d dBm digital (%d, %d) dB, linear (%d, %d), avg noise power %d dB (%d lin)\n", phy_vars_ue->Mod_id, phy_vars_ue->PHY_measurements.n0_power_tot_dBm, phy_vars_ue->PHY_measurements.n0_power_dB[0], @@ -242,6 +267,10 @@ int pbch_detection(PHY_VARS_UE *phy_vars_ue, runmode_t mode) } +char phich_string[13][4] = {"","1/6","","1/2","","","one","","","","","","two"}; +char duplex_string[2][4] = {"FDD","TDD"}; +char prefix_string[2][9] = {"NORMAL","EXTENDED"}; + int initial_sync(PHY_VARS_UE *phy_vars_ue, runmode_t mode) { @@ -251,16 +280,26 @@ int initial_sync(PHY_VARS_UE *phy_vars_ue, runmode_t mode) uint8_t flip_fdd_ncp,flip_fdd_ecp,flip_tdd_ncp,flip_tdd_ecp; // uint16_t Nid_cell_fdd_ncp=0,Nid_cell_fdd_ecp=0,Nid_cell_tdd_ncp=0,Nid_cell_tdd_ecp=0; LTE_DL_FRAME_PARMS *frame_parms = &phy_vars_ue->lte_frame_parms; - // uint8_t i; + int i; int ret=-1; int aarx,rx_power=0; - +#ifdef OAI_USRP + __m128i *rxdata128; +#endif // LOG_I(PHY,"**************************************************************\n"); // First try FDD normal prefix frame_parms->Ncp=NORMAL; frame_parms->frame_type=FDD; init_frame_parms(frame_parms,1); +#ifdef OAI_USRP + for (aarx = 0; aarx<frame_parms->nb_antennas_rx;aarx++) { + rxdata128 = (__m128i*)phy_vars_ue->lte_ue_common_vars.rxdata[aarx]; + for (i=0; i<(frame_parms->samples_per_tti*10)>>2; i++) { + rxdata128[i] = _mm_srai_epi16(rxdata128[i],4); + } + } +#endif sync_pos = lte_sync_time(phy_vars_ue->lte_ue_common_vars.rxdata, frame_parms, (int *)&phy_vars_ue->lte_ue_common_vars.eNb_id); @@ -480,26 +519,56 @@ int initial_sync(PHY_VARS_UE *phy_vars_ue, runmode_t mode) if (ret==0) { // PBCH found so indicate sync to higher layers and configure frame parameters #ifdef DEBUG_INITIAL_SYNCH - LOG_I(PHY,"[PHY][UE%d] In synch, rx_offset %d samples\n",phy_vars_ue->Mod_id, phy_vars_ue->rx_offset); + LOG_I(PHY,"[UE%d] In synch, rx_offset %d samples\n",phy_vars_ue->Mod_id, phy_vars_ue->rx_offset); #endif + + if (phy_vars_ue->UE_scan_carrier == 0) { #ifdef OPENAIR2 - LOG_I(PHY,"[PHY][UE%d] Sending synch status to higher layers\n",phy_vars_ue->Mod_id); - //mac_resynch(); - mac_xface->dl_phy_sync_success(phy_vars_ue->Mod_id,phy_vars_ue->frame_rx,0,1);//phy_vars_ue->lte_ue_common_vars.eNb_id); + LOG_I(PHY,"[UE%d] Sending synch status to higher layers\n",phy_vars_ue->Mod_id); + //mac_resynch(); + mac_xface->dl_phy_sync_success(phy_vars_ue->Mod_id,phy_vars_ue->frame_rx,0,1);//phy_vars_ue->lte_ue_common_vars.eNb_id); #endif //OPENAIR2 - - generate_pcfich_reg_mapping(frame_parms); - generate_phich_reg_mapping(frame_parms); - // init_prach625(frame_parms); + + generate_pcfich_reg_mapping(frame_parms); + generate_phich_reg_mapping(frame_parms); + // init_prach625(frame_parms); #ifndef OPENAIR2 - phy_vars_ue->UE_mode[0] = PUSCH; + phy_vars_ue->UE_mode[0] = PUSCH; #else - phy_vars_ue->UE_mode[0] = PRACH; + phy_vars_ue->UE_mode[0] = PRACH; #endif - //phy_vars_ue->lte_ue_pbch_vars[0]->pdu_errors=0; - phy_vars_ue->lte_ue_pbch_vars[0]->pdu_errors_conseq=0; + //phy_vars_ue->lte_ue_pbch_vars[0]->pdu_errors=0; + phy_vars_ue->lte_ue_pbch_vars[0]->pdu_errors_conseq=0; //phy_vars_ue->lte_ue_pbch_vars[0]->pdu_errors_last=0; + } + LOG_I(PHY,"[UE %d] Frame %d RRC Measurements => rssi %3.1f dBm (dig %3.1f dB, gain %d), N0 %d dBm, rsrp %3.1f dBm/RE, rsrq %3.1f dB\n",phy_vars_ue->Mod_id, + phy_vars_ue->frame_rx, + 10*log10(phy_vars_ue->PHY_measurements.rssi)-phy_vars_ue->rx_total_gain_dB, + 10*log10(phy_vars_ue->PHY_measurements.rssi), + phy_vars_ue->rx_total_gain_dB, + phy_vars_ue->PHY_measurements.n0_power_tot_dBm, + 10*log10(phy_vars_ue->PHY_measurements.rsrp[0])-phy_vars_ue->rx_total_gain_dB, + (10*log10(phy_vars_ue->PHY_measurements.rsrq[0]))); + + + LOG_I(PHY,"[UE %d] Frame %d MIB Information => %s, %s, NidCell %d, N_RB_DL %d, PHICH DURATION %d, PHICH RESOURCE %s, TX_ANT %d\n", + phy_vars_ue->Mod_id, + phy_vars_ue->frame_rx, + duplex_string[phy_vars_ue->lte_frame_parms.frame_type], + prefix_string[phy_vars_ue->lte_frame_parms.Ncp], + phy_vars_ue->lte_frame_parms.Nid_cell, + phy_vars_ue->lte_frame_parms.N_RB_DL, + phy_vars_ue->lte_frame_parms.phich_config_common.phich_duration, + phich_string[phy_vars_ue->lte_frame_parms.phich_config_common.phich_resource], + phy_vars_ue->lte_frame_parms.nb_antennas_tx_eNB); +#if defined(OAI_USRP) || defined(EXMIMO) + LOG_I(PHY,"[UE %d] Frame %d Measured Carrier Frequency %.0f Hz (offset %d Hz)\n", + phy_vars_ue->Mod_id, + phy_vars_ue->frame_rx, + openair0_cfg[0].rx_freq[0]-phy_vars_ue->lte_ue_common_vars.freq_offset, + phy_vars_ue->lte_ue_common_vars.freq_offset); +#endif } else { #ifdef DEBUG_INITIAL_SYNC LOG_I(PHY,"[UE%d] Initial sync : PBCH not ok\n",phy_vars_ue->Mod_id); @@ -523,3 +592,4 @@ int initial_sync(PHY_VARS_UE *phy_vars_ue, runmode_t mode) return ret; } + diff --git a/openair1/PHY/LTE_TRANSPORT/print_stats.c b/openair1/PHY/LTE_TRANSPORT/print_stats.c index 3316b8aaa6..14c53e5f9f 100644 --- a/openair1/PHY/LTE_TRANSPORT/print_stats.c +++ b/openair1/PHY/LTE_TRANSPORT/print_stats.c @@ -67,8 +67,15 @@ int dump_ue_stats(PHY_VARS_UE *phy_vars_ue, char* buffer, int length, runmode_t if ((mode == normal_txrx) || (mode == no_L2_connect)) { len += sprintf(&buffer[len], "[UE_PROC] UE %d, RNTI %x\n",phy_vars_ue->Mod_id, phy_vars_ue->lte_ue_pdcch_vars[0]->crnti); + len += sprintf(&buffer[len],"[UE PROC] RSRP[0] %.2f dBm/RE, RSSI %.2f dBm, RSRQ[0] %.2f dB, N0 %d dBm/RE\n", + 10*log10(phy_vars_ue->PHY_measurements.rsrp[0])-phy_vars_ue->rx_total_gain_dB, + 10*log10(phy_vars_ue->PHY_measurements.rssi)-phy_vars_ue->rx_total_gain_dB, + 10*log10(phy_vars_ue->PHY_measurements.rsrq[0]), + phy_vars_ue->PHY_measurements.n0_power_tot_dBm); + + /* len += sprintf(&buffer[len], - "[UE PROC] Frame count: %d\neNB0 RSSI %d dBm/RE (%d dB, %d dB)\neNB1 RSSI %d dBm/RE (%d dB, %d dB)\neNB2 RSSI %d dBm/RE (%d dB, %d dB)\nN0 %d dBm/RE, %f dBm/%dPRB (%d dB, %d dB)\n", + "[UE PROC] Frame count: %d\neNB0 RSSI %d dBm/RE (%d dB, %d dB)\neNB1 RSSI %d dBm/RE (%d dB, %d dB)neNB2 RSSI %d dBm/RE (%d dB, %d dB)\nN0 %d dBm/RE, %f dBm/%dPRB (%d dB, %d dB)\n", phy_vars_ue->frame_rx, phy_vars_ue->PHY_measurements.rx_rssi_dBm[0], phy_vars_ue->PHY_measurements.rx_power_dB[0][0], @@ -84,14 +91,17 @@ int dump_ue_stats(PHY_VARS_UE *phy_vars_ue, char* buffer, int length, runmode_t phy_vars_ue->lte_frame_parms.N_RB_DL, phy_vars_ue->PHY_measurements.n0_power_dB[0], phy_vars_ue->PHY_measurements.n0_power_dB[1]); + */ + #ifdef EXMIMO len += sprintf(&buffer[len], "[UE PROC] RX Gain %d dB (LNA %d, vga %d dB)\n",phy_vars_ue->rx_total_gain_dB, openair0_cfg[0].rxg_mode[0],(int)openair0_cfg[0].rx_gain[0]); #endif #ifdef OAI_USRP len += sprintf(&buffer[len], "[UE PROC] RX Gain %d dB\n",phy_vars_ue->rx_total_gain_dB); #endif - - len += sprintf(&buffer[len], "[UE_PROC] Frequency offset %d Hz (%d)\n",phy_vars_ue->lte_ue_common_vars.freq_offset,openair_daq_vars.freq_offset); +#if defined(EXMIMO) || defined(OAI_USRP) + len += sprintf(&buffer[len], "[UE_PROC] Frequency offset %d Hz (%d), estimated carrier frequency %f Hz\n",phy_vars_ue->lte_ue_common_vars.freq_offset,openair_daq_vars.freq_offset,openair0_cfg[0].rx_freq[0]-phy_vars_ue->lte_ue_common_vars.freq_offset); +#endif len += sprintf(&buffer[len], "[UE PROC] UE mode = %s (%d)\n",mode_string[phy_vars_ue->UE_mode[0]],phy_vars_ue->UE_mode[0]); len += sprintf(&buffer[len], "[UE PROC] timing_advance = %d\n",phy_vars_ue->timing_advance); len += sprintf(&buffer[len], "[UE PROC] UE tx power = %d\n", PHY_vars_UE_g[0][0]->tx_power_dBm); @@ -455,10 +465,8 @@ int dump_ue_stats(PHY_VARS_UE *phy_vars_ue, char* buffer, int length, runmode_t RRC_status = mac_UE_get_rrc_status(phy_vars_ue->Mod_id, 0); len += sprintf(&buffer[len],"[UE PROC] RRC status = %d\n",RRC_status); #endif - len += sprintf(&buffer[len],"[UE PROC] RSRP[0] %.2f dBm/RE, RSSI %.2f, RSRQ[0] %.2f\n", - 10*log10(phy_vars_ue->PHY_measurements.rsrp[0])-phy_vars_ue->rx_total_gain_dB, - 10*log10(phy_vars_ue->PHY_measurements.rssi)-phy_vars_ue->rx_total_gain_dB, 10*log10(phy_vars_ue->PHY_measurements.rsrq[0])); + len += sprintf(&buffer[len], "[UE PROC] Transmission Mode %d (mode1_flag %d)\n",phy_vars_ue->transmission_mode[eNB],phy_vars_ue->lte_frame_parms.mode1_flag); len += sprintf(&buffer[len], "[UE PROC] PBCH err conseq %d, PBCH error total %d, PBCH FER %d\n", phy_vars_ue->lte_ue_pbch_vars[eNB]->pdu_errors_conseq, diff --git a/openair1/PHY/LTE_TRANSPORT/sss.c b/openair1/PHY/LTE_TRANSPORT/sss.c index 9fe06586dd..ecc2661d75 100644 --- a/openair1/PHY/LTE_TRANSPORT/sss.c +++ b/openair1/PHY/LTE_TRANSPORT/sss.c @@ -248,13 +248,15 @@ int rx_sss(PHY_VARS_UE *phy_vars_ue,int32_t *tot_metric,uint8_t *flip_max,uint8_ (frame_parms->symbols_per_tti/2)-2, // second to last symbol of 0, // slot 0 phy_vars_ue->rx_offset, - 0); + 0, + 1); // PSS slot_fep(phy_vars_ue, (frame_parms->symbols_per_tti/2)-1, // last symbol of 0, // slot 0 phy_vars_ue->rx_offset, - 0); + 0, + 1); } else { // TDD #ifdef DEBUG_SSS if (phy_vars_ue->lte_frame_parms.Ncp == NORMAL) @@ -268,13 +270,15 @@ int rx_sss(PHY_VARS_UE *phy_vars_ue,int32_t *tot_metric,uint8_t *flip_max,uint8_ (frame_parms->symbols_per_tti>>1)-1, // last symbol of 1, // slot 1 phy_vars_ue->rx_offset, - 0); + 0, + 1); // PSS slot_fep(phy_vars_ue, 2, // symbol 2 of 2, // slot 2 phy_vars_ue->rx_offset, - 0); + 0, + 1); } pss_sss_extract(phy_vars_ue, @@ -303,26 +307,28 @@ int rx_sss(PHY_VARS_UE *phy_vars_ue,int32_t *tot_metric,uint8_t *flip_max,uint8_ (frame_parms->symbols_per_tti/2)-2, 10, phy_vars_ue->rx_offset, - 0); + 0,1); // PSS slot_fep(phy_vars_ue, (frame_parms->symbols_per_tti/2)-1, 10, phy_vars_ue->rx_offset, - 0); + 0,1); } else { // TDD // SSS slot_fep(phy_vars_ue, (frame_parms->symbols_per_tti>>1)-1, 11, phy_vars_ue->rx_offset, - 0); + 0, + 1); // PSS slot_fep(phy_vars_ue, 2, 12, phy_vars_ue->rx_offset, - 0); + 0, + 1); } pss_sss_extract(phy_vars_ue, diff --git a/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c b/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c index 3d7380c42c..c6c7876c09 100644 --- a/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c +++ b/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c @@ -363,6 +363,10 @@ void lte_idft(LTE_DL_FRAME_PARMS *frame_parms,uint32_t *z, uint16_t Msc_PUSCH) dft1200(idft_in2,idft_out2,1); break; + default: + // should not be reached + LOG_E( PHY, "Unsupported Msc_PUSCH value of %"PRIu16"\n", Msc_PUSCH ); + return; } @@ -1267,6 +1271,7 @@ void ulsch_channel_level(int32_t **drs_ch_estimates_ext, } + DevAssert( nb_rb ); avg[aarx] = (((int*)&avg128U)[0] + ((int*)&avg128U)[1] + ((int*)&avg128U)[2] + diff --git a/openair1/PHY/MODULATION/defs.h b/openair1/PHY/MODULATION/defs.h index 0e78ee3416..3c2e1cad05 100644 --- a/openair1/PHY/MODULATION/defs.h +++ b/openair1/PHY/MODULATION/defs.h @@ -62,13 +62,15 @@ void PHY_ofdm_mod(int *input, \param Ns Slot number (0..19) \param sample_offset offset within rxdata (points to beginning of subframe) \param no_prefix if 1 prefix is removed by HW +\param reset_freq_est if non-zero it resets the frequency offset estimation loop */ int slot_fep(PHY_VARS_UE *phy_vars_ue, unsigned char l, unsigned char Ns, int sample_offset, - int no_prefix); + int no_prefix, + int reset_freq_est); int slot_fep_mbsfn(PHY_VARS_UE *phy_vars_ue, unsigned char l, diff --git a/openair1/PHY/MODULATION/slot_fep.c b/openair1/PHY/MODULATION/slot_fep.c index 670a852b67..da313c9b32 100644 --- a/openair1/PHY/MODULATION/slot_fep.c +++ b/openair1/PHY/MODULATION/slot_fep.c @@ -48,7 +48,8 @@ int slot_fep(PHY_VARS_UE *phy_vars_ue, unsigned char l, unsigned char Ns, int sample_offset, - int no_prefix) + int no_prefix, + int reset_freq_est) { LTE_DL_FRAME_PARMS *frame_parms = &phy_vars_ue->lte_frame_parms; @@ -236,7 +237,8 @@ int slot_fep(PHY_VARS_UE *phy_vars_ue, lte_est_freq_offset(ue_common_vars->dl_ch_estimates[0], frame_parms, l, - &ue_common_vars->freq_offset); + &ue_common_vars->freq_offset, + reset_freq_est); stop_meas(&phy_vars_ue->dlsch_freq_offset_estimation_stats); } diff --git a/openair1/PHY/TOOLS/lte_phy_scope.c b/openair1/PHY/TOOLS/lte_phy_scope.c index 5fdf89f253..94230d9d6a 100644 --- a/openair1/PHY/TOOLS/lte_phy_scope.c +++ b/openair1/PHY/TOOLS/lte_phy_scope.c @@ -209,7 +209,7 @@ void phy_scope_eNB(FD_lte_phy_scope_enb *form, } } - // Channel Impulse Response + // Channel Impulse Response if (chest_t != NULL) { ymax = 0; @@ -697,8 +697,8 @@ void phy_scope_UE(FD_lte_phy_scope_ue *form, } // PDSCH Throughput - memcpy((void*)tput_time_ue[UE_id],(void*)&tput_time_ue[UE_id][1],(TPUT_WINDOW_LENGTH-1)*sizeof(float)); - memcpy((void*)tput_ue[UE_id],(void*)&tput_ue[UE_id][1],(TPUT_WINDOW_LENGTH-1)*sizeof(float)); + memmove( tput_time_ue[UE_id], &tput_time_ue[UE_id][1], (TPUT_WINDOW_LENGTH-1)*sizeof(float) ); + memmove( tput_ue[UE_id], &tput_ue[UE_id][1], (TPUT_WINDOW_LENGTH-1)*sizeof(float) ); tput_time_ue[UE_id][TPUT_WINDOW_LENGTH-1] = (float) frame; tput_ue[UE_id][TPUT_WINDOW_LENGTH-1] = ((float) total_dlsch_bitrate)/1000.0; diff --git a/openair1/PHY/defs.h b/openair1/PHY/defs.h index 7a46d9c444..89fe4c2af2 100755 --- a/openair1/PHY/defs.h +++ b/openair1/PHY/defs.h @@ -415,6 +415,8 @@ typedef struct { runmode_t mode; /// \brief Indicator that UE should perform band scanning int UE_scan; + /// \brief Indicator that UE should perform coarse scanning around carrier + int UE_scan_carrier; /// \brief Indicator that UE is synchronized to an eNB int is_synchronized; /// \brief Instance count of TX processing thread (-1 means ready, 0 means busy) diff --git a/openair1/SCHED/phy_procedures_lte_ue.c b/openair1/SCHED/phy_procedures_lte_ue.c index 6394c7dff6..7c19144c45 100755 --- a/openair1/SCHED/phy_procedures_lte_ue.c +++ b/openair1/SCHED/phy_procedures_lte_ue.c @@ -1456,28 +1456,8 @@ void lte_ue_measurement_procedures(uint16_t l, PHY_VARS_UE *phy_vars_ue,uint8_t VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_MEASUREMENT_PROCEDURES, VCD_FUNCTION_IN); -#ifdef EMOS - /* - uint8_t aa; - - // first slot in frame is special - if (((slot_rx==0) || (slot_rx==1) || (slot_rx==12) || (slot_rx==13)) && - ((l==0) || (l==4-frame_parms->Ncp))) { - for (eNB_id=0; eNB_id<3; eNB_id++) - for (aa=0;aa<frame_parms->nb_antennas_tx_eNB;aa++) - lte_dl_channel_estimation_emos(emos_dump_UE.channel[eNB_id], - phy_vars_ue->lte_ue_common_vars->rxdataF, - &phy_vars_ue->lte_frame_parms, - slot_rx, - aa, - l, - eNB_id); - } - */ -#endif - if (l==0) { - // UE measurements + // UE measurements on symbol 0 if (abstraction_flag==0) { LOG_D(PHY,"Calling measurements subframe %d, rxdata %p\n",subframe_rx,phy_vars_ue->lte_ue_common_vars.rxdata); @@ -1491,47 +1471,11 @@ void lte_ue_measurement_procedures(uint16_t l, PHY_VARS_UE *phy_vars_ue,uint8_t 0, 1); } - -#ifdef DEBUG_PHY_PROC - - if (slot_rx == 2) { // && (phy_vars_ue->frame%100==0)) { - - LOG_D(PHY,"[UE %d] frame %d, slot %d, freq_offset_filt = %d \n",Mod_id,phy_vars_ue->frame_tx, slot_rx, phy_vars_ue->lte_ue_common_vars.freq_offset); - /* - LOG_I(PHY,"[UE %d] frame %d, slot %d, RX RSSI (%d,%d,%d) dBm, digital (%d,%d)(%d,%d)(%d,%d) dB, linear (%d,%d), avg rx power %d dB (%d lin), N0 %d dB (%d lin), RX gain %d dB\n", - Mod_id,phy_vars_ue->frame, slot_rx, - phy_vars_ue->PHY_measurements.rx_rssi_dBm[0], - phy_vars_ue->PHY_measurements.rx_rssi_dBm[1], - phy_vars_ue->PHY_measurements.rx_rssi_dBm[2], - phy_vars_ue->PHY_measurements.rx_power_dB[0][0], - phy_vars_ue->PHY_measurements.rx_power_dB[0][1], - phy_vars_ue->PHY_measurements.rx_power_dB[1][0], - phy_vars_ue->PHY_measurements.rx_power_dB[1][1], - phy_vars_ue->PHY_measurements.rx_power_dB[2][0], - phy_vars_ue->PHY_measurements.rx_power_dB[2][1], - phy_vars_ue->PHY_measurements.rx_power[0][0], - phy_vars_ue->PHY_measurements.rx_power[0][1], - phy_vars_ue->PHY_measurements.rx_power_avg_dB[0], - phy_vars_ue->PHY_measurements.rx_power_avg[0], - phy_vars_ue->PHY_measurements.n0_power_avg_dB, - phy_vars_ue->PHY_measurements.n0_power_avg, - phy_vars_ue->rx_total_gain_dB); - - LOG_I(PHY,"[UE %d] frame %d, slot %d, N0 %d dBm digital (%d, %d) dB, linear (%d, %d), avg noise power %d dB (%d lin)\n", - Mod_id,phy_vars_ue->frame, slot_rx, - phy_vars_ue->PHY_measurements.n0_power_tot_dBm, - phy_vars_ue->PHY_measurements.n0_power_dB[0], - phy_vars_ue->PHY_measurements.n0_power_dB[1], - phy_vars_ue->PHY_measurements.n0_power[0], - phy_vars_ue->PHY_measurements.n0_power[1], - phy_vars_ue->PHY_measurements.n0_power_avg_dB, - phy_vars_ue->PHY_measurements.n0_power_avg); */ - } - -#endif } - if (l==(4-frame_parms->Ncp)) { + if (l==(6-phy_vars_ue->lte_frame_parms.Ncp)) { + + // make sure we have signal from PSS/SSS for N0 measurement VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_RRC_MEASUREMENTS, VCD_FUNCTION_IN); ue_rrc_measurements(phy_vars_ue, @@ -1882,7 +1826,7 @@ void lte_ue_pbch_procedures(uint8_t eNB_id,PHY_VARS_UE *phy_vars_ue,uint8_t abst phy_vars_ue->lte_frame_parms.N_RB_DL, phy_vars_ue->lte_frame_parms.phich_config_common.phich_duration, phy_vars_ue->lte_frame_parms.phich_config_common.phich_resource); - + /* if (frame_rx%100 == 0) { LOG_I(PHY,"[UE %d] frame %d, slot %d, PBCH: mode1_flag %d, tx_ant %d, frame_tx %d, phase %d. N_RB_DL %d, phich_duration %d, phich_resource %d/6,Frequency offset %d Hz (%d)\n", phy_vars_ue->Mod_id, @@ -1897,8 +1841,9 @@ void lte_ue_pbch_procedures(uint8_t eNB_id,PHY_VARS_UE *phy_vars_ue,uint8_t abst phy_vars_ue->lte_frame_parms.phich_config_common.phich_resource, phy_vars_ue->lte_ue_common_vars.freq_offset,openair_daq_vars.freq_offset); //dump_frame_parms(&phy_vars_ue->lte_frame_parms); - } + } + */ #endif } else { @@ -2485,7 +2430,8 @@ int phy_procedures_UE_RX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstrac l, slot_rx, phy_vars_ue->rx_offset, - 0); + 0, + 0); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP, VCD_FUNCTION_OUT); stop_meas(&phy_vars_ue->ofdm_demod_stats); } @@ -3240,10 +3186,11 @@ int phy_procedures_UE_RX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstrac LOG_D(PHY,"[UE %d] Calculating bitrate Frame %d: total_TBS = %d, total_TBS_last = %d, bitrate %f kbits\n", phy_vars_ue->Mod_id,frame_rx,phy_vars_ue->total_TBS[eNB_id], phy_vars_ue->total_TBS_last[eNB_id],(float) phy_vars_ue->bitrate[eNB_id]/1000.0); - + /* if ((frame_rx % 100 == 0)) { LOG_I(PHY,"Throughput %5.1f kbps\n",(float) phy_vars_ue->bitrate[eNB_id]/1000.0); } + */ } if (is_pmch_subframe((subframe_rx==9?-1:0)+frame_rx,subframe_rx,&phy_vars_ue->lte_frame_parms)) { diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index 531c2d7c80..33f01a551c 100755 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -1030,8 +1030,7 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP) enb_properties.properties[enb_properties_index]->pusch_hoppingMode[j] = PUSCH_ConfigCommon__pusch_ConfigBasic__hoppingMode_interSubFrame; } else if (strcmp(pusch_hoppingMode,"intraAndInterSubFrame")==0) { enb_properties.properties[enb_properties_index]->pusch_hoppingMode[j] = PUSCH_ConfigCommon__pusch_ConfigBasic__hoppingMode_intraAndInterSubFrame; - } - else + } else AssertError (0, parse_errors ++, "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for pusch_hoppingMode choice: interSubframe,intraAndInterSubframe!\n", lib_config_file_name_pP, i, pusch_hoppingMode); @@ -1051,8 +1050,7 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP) enb_properties.properties[enb_properties_index]->pusch_enable64QAM[j] = TRUE; } else if (strcmp(pusch_enable64QAM, "DISABLE") == 0) { enb_properties.properties[enb_properties_index]->pusch_enable64QAM[j] = FALSE; - } - else + } else AssertError (0, parse_errors ++, "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for pusch_enable64QAM choice: ENABLE,DISABLE!\n", lib_config_file_name_pP, i, pusch_enable64QAM); @@ -1065,8 +1063,7 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP) enb_properties.properties[enb_properties_index]->pusch_groupHoppingEnabled[j] = TRUE; } else if (strcmp(pusch_groupHoppingEnabled, "DISABLE") == 0) { enb_properties.properties[enb_properties_index]->pusch_groupHoppingEnabled[j] = FALSE; - } - else + } else AssertError (0, parse_errors ++, "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for pusch_groupHoppingEnabled choice: ENABLE,DISABLE!\n", lib_config_file_name_pP, i, pusch_groupHoppingEnabled); @@ -1125,8 +1122,7 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP) enb_properties.properties[enb_properties_index]->srs_enable[j] = TRUE; } else if (strcmp(srs_enable, "DISABLE") == 0) { enb_properties.properties[enb_properties_index]->srs_enable[j] = FALSE; - } - else + } else AssertError (0, parse_errors ++, "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for srs_BandwidthConfig choice: ENABLE,DISABLE !\n", lib_config_file_name_pP, i, srs_enable); @@ -1270,8 +1266,7 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP) enb_properties.properties[enb_properties_index]->pucch_deltaF_Format2b[j] = DeltaFList_PUCCH__deltaF_PUCCH_Format2b_deltaF0; } else if (strcmp(pucch_deltaF_Format2b,"deltaF2")==0) { enb_properties.properties[enb_properties_index]->pucch_deltaF_Format2b[j] = DeltaFList_PUCCH__deltaF_PUCCH_Format2b_deltaF2; - } - else + } else AssertError (0, parse_errors ++, "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for pucch_deltaF_Format2b choice: deltaF_2,dltaF0,deltaF2!\n", lib_config_file_name_pP, i, pucch_deltaF_Format2b); @@ -1358,8 +1353,7 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP) else if (strcmp(rach_messagePowerOffsetGroupB,"dB18")==0) { enb_properties.properties[enb_properties_index]->rach_messagePowerOffsetGroupB[j] = RACH_ConfigCommon__preambleInfo__preamblesGroupAConfig__messagePowerOffsetGroupB_dB18; - } - else + } else AssertError (0, parse_errors ++, "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for rach_messagePowerOffsetGroupB choice: minusinfinity,dB0,dB5,dB8,dB10,dB12,dB15,dB18!\n", lib_config_file_name_pP, i, rach_messagePowerOffsetGroupB); @@ -1777,131 +1771,313 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP) } setting_srb1 = config_setting_get_member (setting_enb, ENB_CONFIG_STRING_SRB1); + if (setting_srb1 != NULL) { if (!(config_setting_lookup_int(setting_srb1, ENB_CONFIG_STRING_SRB1_TIMER_POLL_RETRANSMIT, &srb1_timer_poll_retransmit) - && config_setting_lookup_int(setting_srb1, ENB_CONFIG_STRING_SRB1_TIMER_REORDERING, &srb1_timer_reordering) - && config_setting_lookup_int(setting_srb1, ENB_CONFIG_STRING_SRB1_TIMER_STATUS_PROHIBIT, &srb1_timer_status_prohibit) - && config_setting_lookup_int(setting_srb1, ENB_CONFIG_STRING_SRB1_MAX_RETX_THRESHOLD, &srb1_max_retx_threshold) - && config_setting_lookup_int(setting_srb1, ENB_CONFIG_STRING_SRB1_POLL_PDU, &srb1_poll_pdu) - && config_setting_lookup_int(setting_srb1, ENB_CONFIG_STRING_SRB1_POLL_BYTE, &srb1_poll_byte))) - AssertError (0, parse_errors ++, - "Failed to parse eNB configuration file %s, enb %d timer_poll_retransmit, timer_reordering, ", - "timer_status_prohibit, poll_pdu, poll_byte, max_retx_threshold !\n", - lib_config_file_name_pP, i); + && config_setting_lookup_int(setting_srb1, ENB_CONFIG_STRING_SRB1_TIMER_REORDERING, &srb1_timer_reordering) + && config_setting_lookup_int(setting_srb1, ENB_CONFIG_STRING_SRB1_TIMER_STATUS_PROHIBIT, &srb1_timer_status_prohibit) + && config_setting_lookup_int(setting_srb1, ENB_CONFIG_STRING_SRB1_MAX_RETX_THRESHOLD, &srb1_max_retx_threshold) + && config_setting_lookup_int(setting_srb1, ENB_CONFIG_STRING_SRB1_POLL_PDU, &srb1_poll_pdu) + && config_setting_lookup_int(setting_srb1, ENB_CONFIG_STRING_SRB1_POLL_BYTE, &srb1_poll_byte))) + AssertError (0, parse_errors ++, + "Failed to parse eNB configuration file %s, enb %d timer_poll_retransmit, timer_reordering, " + "timer_status_prohibit, poll_pdu, poll_byte, max_retx_threshold !\n", + lib_config_file_name_pP, i); switch (srb1_max_retx_threshold) { - case 1: enb_properties.properties[enb_properties_index]->srb1_max_retx_threshold = UL_AM_RLC__maxRetxThreshold_t1;break; - case 2: enb_properties.properties[enb_properties_index]->srb1_max_retx_threshold = UL_AM_RLC__maxRetxThreshold_t2;break; - case 3: enb_properties.properties[enb_properties_index]->srb1_max_retx_threshold = UL_AM_RLC__maxRetxThreshold_t3;break; - case 4: enb_properties.properties[enb_properties_index]->srb1_max_retx_threshold = UL_AM_RLC__maxRetxThreshold_t4;break; - case 6: enb_properties.properties[enb_properties_index]->srb1_max_retx_threshold = UL_AM_RLC__maxRetxThreshold_t6;break; - case 8: enb_properties.properties[enb_properties_index]->srb1_max_retx_threshold = UL_AM_RLC__maxRetxThreshold_t8;break; - case 16: enb_properties.properties[enb_properties_index]->srb1_max_retx_threshold = UL_AM_RLC__maxRetxThreshold_t16;break; - case 32: enb_properties.properties[enb_properties_index]->srb1_max_retx_threshold = UL_AM_RLC__maxRetxThreshold_t32;break; + case 1: + enb_properties.properties[enb_properties_index]->srb1_max_retx_threshold = UL_AM_RLC__maxRetxThreshold_t1; + break; + + case 2: + enb_properties.properties[enb_properties_index]->srb1_max_retx_threshold = UL_AM_RLC__maxRetxThreshold_t2; + break; + + case 3: + enb_properties.properties[enb_properties_index]->srb1_max_retx_threshold = UL_AM_RLC__maxRetxThreshold_t3; + break; + + case 4: + enb_properties.properties[enb_properties_index]->srb1_max_retx_threshold = UL_AM_RLC__maxRetxThreshold_t4; + break; + + case 6: + enb_properties.properties[enb_properties_index]->srb1_max_retx_threshold = UL_AM_RLC__maxRetxThreshold_t6; + break; + + case 8: + enb_properties.properties[enb_properties_index]->srb1_max_retx_threshold = UL_AM_RLC__maxRetxThreshold_t8; + break; + + case 16: + enb_properties.properties[enb_properties_index]->srb1_max_retx_threshold = UL_AM_RLC__maxRetxThreshold_t16; + break; + + case 32: + enb_properties.properties[enb_properties_index]->srb1_max_retx_threshold = UL_AM_RLC__maxRetxThreshold_t32; + break; + default: AssertError (0, parse_errors ++, - "Bad config value when parsing eNB configuration file %s, enb %d srb1_max_retx_threshold %u!\n", - lib_config_file_name_pP, i, srb1_max_retx_threshold); + "Bad config value when parsing eNB configuration file %s, enb %d srb1_max_retx_threshold %u!\n", + lib_config_file_name_pP, i, srb1_max_retx_threshold); } switch (srb1_poll_pdu) { - case 4: enb_properties.properties[enb_properties_index]->srb1_poll_pdu = PollPDU_p4;break; - case 8: enb_properties.properties[enb_properties_index]->srb1_poll_pdu = PollPDU_p8;break; - case 16: enb_properties.properties[enb_properties_index]->srb1_poll_pdu = PollPDU_p16;break; - case 32: enb_properties.properties[enb_properties_index]->srb1_poll_pdu = PollPDU_p32;break; - case 64: enb_properties.properties[enb_properties_index]->srb1_poll_pdu = PollPDU_p64;break; - case 128: enb_properties.properties[enb_properties_index]->srb1_poll_pdu = PollPDU_p128;break; - case 256: enb_properties.properties[enb_properties_index]->srb1_poll_pdu = PollPDU_p256;break; + case 4: + enb_properties.properties[enb_properties_index]->srb1_poll_pdu = PollPDU_p4; + break; + + case 8: + enb_properties.properties[enb_properties_index]->srb1_poll_pdu = PollPDU_p8; + break; + + case 16: + enb_properties.properties[enb_properties_index]->srb1_poll_pdu = PollPDU_p16; + break; + + case 32: + enb_properties.properties[enb_properties_index]->srb1_poll_pdu = PollPDU_p32; + break; + + case 64: + enb_properties.properties[enb_properties_index]->srb1_poll_pdu = PollPDU_p64; + break; + + case 128: + enb_properties.properties[enb_properties_index]->srb1_poll_pdu = PollPDU_p128; + break; + + case 256: + enb_properties.properties[enb_properties_index]->srb1_poll_pdu = PollPDU_p256; + break; + default: if (srb1_poll_pdu >= 10000) - enb_properties.properties[enb_properties_index]->srb1_poll_pdu = PollPDU_pInfinity; + enb_properties.properties[enb_properties_index]->srb1_poll_pdu = PollPDU_pInfinity; else AssertError (0, parse_errors ++, - "Bad config value when parsing eNB configuration file %s, enb %d srb1_poll_pdu %u!\n", - lib_config_file_name_pP, i, srb1_poll_pdu); + "Bad config value when parsing eNB configuration file %s, enb %d srb1_poll_pdu %u!\n", + lib_config_file_name_pP, i, srb1_poll_pdu); } enb_properties.properties[enb_properties_index]->srb1_poll_byte = srb1_poll_byte; + switch (srb1_poll_byte) { - case 25: enb_properties.properties[enb_properties_index]->srb1_poll_byte = PollByte_kB25;break; - case 50: enb_properties.properties[enb_properties_index]->srb1_poll_byte = PollByte_kB50;break; - case 75: enb_properties.properties[enb_properties_index]->srb1_poll_byte = PollByte_kB75;break; - case 100: enb_properties.properties[enb_properties_index]->srb1_poll_byte = PollByte_kB100;break; - case 125: enb_properties.properties[enb_properties_index]->srb1_poll_byte = PollByte_kB125;break; - case 250: enb_properties.properties[enb_properties_index]->srb1_poll_byte = PollByte_kB250;break; - case 375: enb_properties.properties[enb_properties_index]->srb1_poll_byte = PollByte_kB375;break; - case 500: enb_properties.properties[enb_properties_index]->srb1_poll_byte = PollByte_kB500;break; - case 750: enb_properties.properties[enb_properties_index]->srb1_poll_byte = PollByte_kB750;break; - case 1000: enb_properties.properties[enb_properties_index]->srb1_poll_byte = PollByte_kB1000;break; - case 1250: enb_properties.properties[enb_properties_index]->srb1_poll_byte = PollByte_kB1250;break; - case 1500: enb_properties.properties[enb_properties_index]->srb1_poll_byte = PollByte_kB1500;break; - case 2000: enb_properties.properties[enb_properties_index]->srb1_poll_byte = PollByte_kB2000;break; - case 3000: enb_properties.properties[enb_properties_index]->srb1_poll_byte = PollByte_kB3000;break; + case 25: + enb_properties.properties[enb_properties_index]->srb1_poll_byte = PollByte_kB25; + break; + + case 50: + enb_properties.properties[enb_properties_index]->srb1_poll_byte = PollByte_kB50; + break; + + case 75: + enb_properties.properties[enb_properties_index]->srb1_poll_byte = PollByte_kB75; + break; + + case 100: + enb_properties.properties[enb_properties_index]->srb1_poll_byte = PollByte_kB100; + break; + + case 125: + enb_properties.properties[enb_properties_index]->srb1_poll_byte = PollByte_kB125; + break; + + case 250: + enb_properties.properties[enb_properties_index]->srb1_poll_byte = PollByte_kB250; + break; + + case 375: + enb_properties.properties[enb_properties_index]->srb1_poll_byte = PollByte_kB375; + break; + + case 500: + enb_properties.properties[enb_properties_index]->srb1_poll_byte = PollByte_kB500; + break; + + case 750: + enb_properties.properties[enb_properties_index]->srb1_poll_byte = PollByte_kB750; + break; + + case 1000: + enb_properties.properties[enb_properties_index]->srb1_poll_byte = PollByte_kB1000; + break; + + case 1250: + enb_properties.properties[enb_properties_index]->srb1_poll_byte = PollByte_kB1250; + break; + + case 1500: + enb_properties.properties[enb_properties_index]->srb1_poll_byte = PollByte_kB1500; + break; + + case 2000: + enb_properties.properties[enb_properties_index]->srb1_poll_byte = PollByte_kB2000; + break; + + case 3000: + enb_properties.properties[enb_properties_index]->srb1_poll_byte = PollByte_kB3000; + break; + default: if (srb1_poll_byte >= 10000) - enb_properties.properties[enb_properties_index]->srb1_poll_byte = PollByte_kBinfinity; + enb_properties.properties[enb_properties_index]->srb1_poll_byte = PollByte_kBinfinity; else AssertError (0, parse_errors ++, - "Bad config value when parsing eNB configuration file %s, enb %d srb1_poll_byte %u!\n", - lib_config_file_name_pP, i, srb1_poll_byte); + "Bad config value when parsing eNB configuration file %s, enb %d srb1_poll_byte %u!\n", + lib_config_file_name_pP, i, srb1_poll_byte); } if (srb1_timer_poll_retransmit <= 250) { enb_properties.properties[enb_properties_index]->srb1_timer_poll_retransmit = (srb1_timer_poll_retransmit - 5)/5; } else if (srb1_timer_poll_retransmit <= 500) { - enb_properties.properties[enb_properties_index]->srb1_timer_poll_retransmit = (srb1_timer_poll_retransmit - 300)/50 + 50; + enb_properties.properties[enb_properties_index]->srb1_timer_poll_retransmit = (srb1_timer_poll_retransmit - 300)/50 + 50; } else { - AssertError (0, parse_errors ++, - "Bad config value when parsing eNB configuration file %s, enb %d srb1_timer_poll_retransmit %u!\n", - lib_config_file_name_pP, i, srb1_timer_poll_retransmit); + AssertError (0, parse_errors ++, + "Bad config value when parsing eNB configuration file %s, enb %d srb1_timer_poll_retransmit %u!\n", + lib_config_file_name_pP, i, srb1_timer_poll_retransmit); } if (srb1_timer_status_prohibit <= 250) { enb_properties.properties[enb_properties_index]->srb1_timer_status_prohibit = srb1_timer_status_prohibit/5; } else if ((srb1_timer_poll_retransmit >= 300) && (srb1_timer_poll_retransmit <= 500)) { - enb_properties.properties[enb_properties_index]->srb1_timer_status_prohibit = (srb1_timer_status_prohibit - 300)/50 + 51; + enb_properties.properties[enb_properties_index]->srb1_timer_status_prohibit = (srb1_timer_status_prohibit - 300)/50 + 51; } else { - AssertError (0, parse_errors ++, - "Bad config value when parsing eNB configuration file %s, enb %d srb1_timer_status_prohibit %u!\n", - lib_config_file_name_pP, i, srb1_timer_status_prohibit); + AssertError (0, parse_errors ++, + "Bad config value when parsing eNB configuration file %s, enb %d srb1_timer_status_prohibit %u!\n", + lib_config_file_name_pP, i, srb1_timer_status_prohibit); } switch (srb1_timer_reordering) { - case 0: enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms0; break; - case 5: enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms5; break; - case 10: enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms10; break; - case 15: enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms15; break; - case 20: enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms20; break; - case 25: enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms25; break; - case 30: enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms30; break; - case 35: enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms35; break; - case 40: enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms40; break; - case 45: enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms45; break; - case 50: enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms50; break; - case 55: enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms55; break; - case 60: enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms60; break; - case 65: enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms65; break; - case 70: enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms70; break; - case 75: enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms75; break; - case 80: enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms80; break; - case 85: enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms85; break; - case 90: enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms90; break; - case 95: enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms95; break; - case 100: enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms100; break; - case 110: enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms110; break; - case 120: enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms120; break; - case 130: enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms130; break; - case 140: enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms140; break; - case 150: enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms150; break; - case 160: enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms160; break; - case 170: enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms170; break; - case 180: enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms180; break; - case 190: enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms190; break; - case 200: enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms200; break; + case 0: + enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms0; + break; + + case 5: + enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms5; + break; + + case 10: + enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms10; + break; + + case 15: + enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms15; + break; + + case 20: + enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms20; + break; + + case 25: + enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms25; + break; + + case 30: + enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms30; + break; + + case 35: + enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms35; + break; + + case 40: + enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms40; + break; + + case 45: + enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms45; + break; + + case 50: + enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms50; + break; + + case 55: + enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms55; + break; + + case 60: + enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms60; + break; + + case 65: + enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms65; + break; + + case 70: + enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms70; + break; + + case 75: + enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms75; + break; + + case 80: + enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms80; + break; + + case 85: + enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms85; + break; + + case 90: + enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms90; + break; + + case 95: + enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms95; + break; + + case 100: + enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms100; + break; + + case 110: + enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms110; + break; + + case 120: + enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms120; + break; + + case 130: + enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms130; + break; + + case 140: + enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms140; + break; + + case 150: + enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms150; + break; + + case 160: + enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms160; + break; + + case 170: + enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms170; + break; + + case 180: + enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms180; + break; + + case 190: + enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms190; + break; + + case 200: + enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms200; + break; + default: AssertError (0, parse_errors ++, - "Bad config value when parsing eNB configuration file %s, enb %d srb1_timer_reordering %u!\n", - lib_config_file_name_pP, i, srb1_timer_reordering); + "Bad config value when parsing eNB configuration file %s, enb %d srb1_timer_reordering %u!\n", + lib_config_file_name_pP, i, srb1_timer_reordering); } } else { enb_properties.properties[enb_properties_index]->srb1_timer_poll_retransmit = T_PollRetransmit_ms80; diff --git a/openair2/LAYER2/MAC/ra_procedures.c b/openair2/LAYER2/MAC/ra_procedures.c index 9ea210a271..6c3e96e444 100644 --- a/openair2/LAYER2/MAC/ra_procedures.c +++ b/openair2/LAYER2/MAC/ra_procedures.c @@ -146,7 +146,6 @@ void get_prach_resources(module_id_t module_idP, if (!rach_ConfigCommon->preambleInfo.preamblesGroupAConfig) { noGroupB = 1; - } else { if (rach_ConfigCommon->preambleInfo.preamblesGroupAConfig->sizeOfRA_PreamblesGroupA == rach_ConfigCommon->preambleInfo.numberOfRA_Preambles) { @@ -186,6 +185,7 @@ void get_prach_resources(module_id_t module_idP, UE_mac_inst[module_idP].RA_prach_resources.ra_RACH_MaskIndex = 0; } else { + // FIXME rach_ConfigCommon->preambleInfo.preamblesGroupAConfig may be zero UE_mac_inst[module_idP].RA_prach_resources.ra_PreambleIndex = rach_ConfigCommon->preambleInfo.preamblesGroupAConfig->sizeOfRA_PreamblesGroupA + (taus())%(rach_ConfigCommon->preambleInfo.numberOfRA_Preambles - @@ -363,7 +363,7 @@ PRACH_RESOURCES_t *ue_get_rach(module_id_t module_idP,int CC_id,frame_t frameP, module_idP,frameP, rlc_status.bytes_in_buffer,dcch_header_len); sdu_lengths[0] = mac_rlc_data_req(module_idP, UE_mac_inst[module_idP].crnti, - eNB_indexP, frameP,ENB_FLAG_NO, MBMS_FLAG_NO, + eNB_indexP, frameP,ENB_FLAG_NO, MBMS_FLAG_NO, DCCH, (char *)&ulsch_buff[0]); diff --git a/openair2/RRC/LITE/defs.h b/openair2/RRC/LITE/defs.h index 850f18115f..1bcf08a259 100644 --- a/openair2/RRC/LITE/defs.h +++ b/openair2/RRC/LITE/defs.h @@ -195,10 +195,10 @@ typedef struct UE_RRC_INFO_s { #ifdef Rel10 uint8_t MCCHStatus[8]; // MAX_MBSFN_AREA #endif - uint8_t SIwindowsize; + uint8_t SIwindowsize; //!< Corresponds to the SIB1 si-WindowLength parameter. The unit is ms. Possible values are (final): 1,2,5,10,15,20,40 uint8_t handoverTarget; HO_STATE_t ho_state; - uint16_t SIperiod; + uint16_t SIperiod; //!< Corresponds to the SIB1 si-Periodicity parameter (multiplied by 10). Possible values are (final): 80,160,320,640,1280,2560,5120 unsigned short UE_index; uint32_t T300_active; uint32_t T300_cnt; @@ -460,7 +460,7 @@ typedef struct UE_RRC_INST_s { uint8_t SIB1Status[NB_CNX_UE]; uint8_t SIStatus[NB_CNX_UE]; SystemInformationBlockType1_t *sib1[NB_CNX_UE]; - SystemInformation_t *si[NB_CNX_UE][8]; + SystemInformation_t *si[NB_CNX_UE]; //!< Temporary storage for an SI message. Decoding happens in decode_SI(). SystemInformationBlockType2_t *sib2[NB_CNX_UE]; SystemInformationBlockType3_t *sib3[NB_CNX_UE]; SystemInformationBlockType4_t *sib4[NB_CNX_UE]; diff --git a/openair2/RRC/LITE/proto.h b/openair2/RRC/LITE/proto.h index 398c126653..270a3fa21c 100644 --- a/openair2/RRC/LITE/proto.h +++ b/openair2/RRC/LITE/proto.h @@ -77,12 +77,7 @@ rrc_rx_tx( \param ctxt_pP Running context \param Srb_info Pointer to SRB_INFO structure (SRB0) \param eNB_index Index of corresponding eNB/CH*/ -int -rrc_ue_decode_ccch( - const protocol_ctxt_t* const ctxt_pP, - const SRB_INFO* const Srb_info, - const uint8_t eNB_index -); +int rrc_ue_decode_ccch( const protocol_ctxt_t* const ctxt_pP, const SRB_INFO* const Srb_info, const uint8_t eNB_index ); /** \brief Decodes a DL-DCCH message and invokes appropriate routine to handle the message \param ctxt_pP Running context @@ -106,17 +101,6 @@ rrc_ue_generate_RRCConnectionRequest( const uint8_t eNB_index ); -/** \brief Generates/Encodes RRCConnnectionSetupComplete message at UE - \param ctxt_pP Running context - \param eNB_index Index of corresponding eNB/CH - \param Transaction_id Transaction identifier*/ -void -rrc_ue_generate_RRCConnectionSetupComplete( - const protocol_ctxt_t* const ctxt_pP, - const uint8_t eNB_index, - const uint8_t Transaction_id -); - /** \brief process the received rrcConnectionReconfiguration message at UE \param ctxt_pP Running context \param *rrcConnectionReconfiguration pointer to the sturcture @@ -128,17 +112,6 @@ rrc_ue_process_rrcConnectionReconfiguration( uint8_t eNB_index ); -/** \brief Generates/Encodes RRCConnectionReconfigurationComplete message at UE - \param ctxt_pP Running context - \param eNB_index Index of corresponding eNB/CH - \param Transaction_id RRC transaction identifier */ -void -rrc_ue_generate_RRCConnectionReconfigurationComplete( - const protocol_ctxt_t* const ctxt_pP, - const uint8_t eNB_index, - const 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 @@ -347,41 +320,15 @@ void rrc_lite_in_sync_ind(module_id_t module_idP, frame_t frameP, uint16_t eNB_i void rrc_lite_out_of_sync_ind(module_id_t module_idP, frame_t frameP, unsigned short eNB_index); -int -decode_MCCH_Message( - const protocol_ctxt_t* const ctxt_pP, - const uint8_t eNB_index, - const uint8_t* const Sdu, - const uint8_t Sdu_len, - const 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_MCCH_Message( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index, const uint8_t* const Sdu, const uint8_t Sdu_len, const uint8_t mbsfn_sync_area ); -int -decode_BCCH_DLSCH_Message( +int decode_BCCH_DLSCH_Message( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index, uint8_t* const Sdu, const uint8_t Sdu_len, const uint8_t rsrq, - const uint8_t rsrp -); - -int -decode_SIB1( - const protocol_ctxt_t* const ctxt_pP, - const uint8_t eNB_index, - const uint8_t rsrq, - const uint8_t rsrp -); - -int -decode_SI( - const protocol_ctxt_t* const ctxt_pP, - const uint8_t eNB_index, - const uint8_t si_window -); + const uint8_t rsrp ); void ue_meas_filtering( @@ -426,12 +373,6 @@ rrc_eNB_process_MeasurementReport( const MeasResults_t* const measResults2 ); -void -rrc_ue_generate_MeasurementReport( - const protocol_ctxt_t* const ctxt_pP, - uint8_t eNB_index -); - void rrc_eNB_generate_HandoverPreparationInformation( const protocol_ctxt_t* const ctxt_pP, @@ -444,15 +385,6 @@ check_handovers( protocol_ctxt_t* const ctxt_pP ); -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( diff --git a/openair2/RRC/LITE/rrc_UE.c b/openair2/RRC/LITE/rrc_UE.c index a45faede49..fbb76f63ea 100644 --- a/openair2/RRC/LITE/rrc_UE.c +++ b/openair2/RRC/LITE/rrc_UE.c @@ -107,12 +107,49 @@ extern void *bigphys_malloc(int); extern int8_t dB_fixed2(uint32_t x,uint32_t y); -void -rrc_ue_process_securityModeCommand( - const protocol_ctxt_t* const ctxt_pP, - SecurityModeCommand_t* const securityModeCommand, - const uint8_t eNB_index -); + +// internal prototypes + +void rrc_ue_process_securityModeCommand( const protocol_ctxt_t* const ctxt_pP, SecurityModeCommand_t* const securityModeCommand, const uint8_t eNB_index ); + +static int decode_SI( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index ); + +static int decode_SIB1( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index, const uint8_t rsrq, const uint8_t rsrp ); + +/** \brief Generates/Encodes RRCConnnectionSetupComplete message at UE + * \param ctxt_pP Running context + * \param eNB_index Index of corresponding eNB/CH + * \param Transaction_id Transaction identifier + */ +static void rrc_ue_generate_RRCConnectionSetupComplete( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index, const uint8_t Transaction_id ); + +/** \brief Generates/Encodes RRCConnectionReconfigurationComplete message at UE + * \param ctxt_pP Running context + * \param eNB_index Index of corresponding eNB/CH + * \param Transaction_id RRC transaction identifier + */ +static void rrc_ue_generate_RRCConnectionReconfigurationComplete( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index, const uint8_t Transaction_id ); + +static void rrc_ue_generate_MeasurementReport( const protocol_ctxt_t* const ctxt_pP, uint8_t eNB_index ); + +static 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); + +static void decode_MBSFNAreaConfiguration(module_id_t module_idP, uint8_t eNB_index, frame_t frameP,uint8_t mbsfn_sync_area); + + + + + + + + /*------------------------------------------------------------------------------*/ static Rrc_State_t rrc_get_state (module_id_t ue_mod_idP) { @@ -150,12 +187,7 @@ static int rrc_set_state (module_id_t ue_mod_idP, Rrc_State_t state) } //----------------------------------------------------------------------------- -static int -rrc_set_sub_state ( - module_id_t ue_mod_idP, - Rrc_Sub_State_t subState -) -//----------------------------------------------------------------------------- +static int rrc_set_sub_state( module_id_t ue_mod_idP, Rrc_Sub_State_t subState ) { #if (defined(ENABLE_ITTI) && (defined(ENABLE_USE_MME) || defined(ENABLE_RAL))) @@ -199,33 +231,37 @@ rrc_set_sub_state ( } //----------------------------------------------------------------------------- -void -init_SI_UE( - const protocol_ctxt_t* const ctxt_pP, - const uint8_t eNB_index -) -//----------------------------------------------------------------------------- +static void init_SI_UE( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index ) { - - int i; - - UE_rrc_inst[ctxt_pP->module_id].sizeof_SIB1[eNB_index] = 0; UE_rrc_inst[ctxt_pP->module_id].sizeof_SI[eNB_index] = 0; - UE_rrc_inst[ctxt_pP->module_id].SIB1[eNB_index] = (uint8_t*)malloc16(32); - UE_rrc_inst[ctxt_pP->module_id].sib1[eNB_index] = (SystemInformationBlockType1_t*)malloc16(sizeof(SystemInformationBlockType1_t)); - UE_rrc_inst[ctxt_pP->module_id].SI[eNB_index] = (uint8_t*)malloc16(64); + UE_rrc_inst[ctxt_pP->module_id].SIB1[eNB_index] = (uint8_t*)malloc16_clear( 32 ); + UE_rrc_inst[ctxt_pP->module_id].sib1[eNB_index] = malloc16_clear( sizeof(SystemInformationBlockType1_t) ); + UE_rrc_inst[ctxt_pP->module_id].sib2[eNB_index] = malloc16_clear( sizeof(SystemInformationBlockType2_t) ); + UE_rrc_inst[ctxt_pP->module_id].sib3[eNB_index] = malloc16_clear( sizeof(SystemInformationBlockType3_t) ); + UE_rrc_inst[ctxt_pP->module_id].sib4[eNB_index] = malloc16_clear( sizeof(SystemInformationBlockType4_t) ); + UE_rrc_inst[ctxt_pP->module_id].sib5[eNB_index] = malloc16_clear( sizeof(SystemInformationBlockType5_t) ); + UE_rrc_inst[ctxt_pP->module_id].sib6[eNB_index] = malloc16_clear( sizeof(SystemInformationBlockType6_t) ); + UE_rrc_inst[ctxt_pP->module_id].sib7[eNB_index] = malloc16_clear( sizeof(SystemInformationBlockType7_t) ); + UE_rrc_inst[ctxt_pP->module_id].sib8[eNB_index] = malloc16_clear( sizeof(SystemInformationBlockType8_t) ); + UE_rrc_inst[ctxt_pP->module_id].sib9[eNB_index] = malloc16_clear( sizeof(SystemInformationBlockType9_t) ); + UE_rrc_inst[ctxt_pP->module_id].sib10[eNB_index] = malloc16_clear( sizeof(SystemInformationBlockType10_t) ); + UE_rrc_inst[ctxt_pP->module_id].sib11[eNB_index] = malloc16_clear( sizeof(SystemInformationBlockType11_t) ); +#ifdef Rel10 + UE_rrc_inst[ctxt_pP->module_id].sib12[eNB_index] = malloc16_clear( sizeof(SystemInformationBlockType12_r9_t) ); + UE_rrc_inst[ctxt_pP->module_id].sib13[eNB_index] = malloc16_clear( sizeof(SystemInformationBlockType13_r9_t) ); +#endif + UE_rrc_inst[ctxt_pP->module_id].SI[eNB_index] = (uint8_t*)malloc16_clear( 64 ); - for (i=0; i<8; i++) { - UE_rrc_inst[ctxt_pP->module_id].si[eNB_index][i] = (SystemInformation_t*)malloc16(sizeof(SystemInformation_t)); - } + UE_rrc_inst[ctxt_pP->module_id].si[eNB_index] = (SystemInformation_t*)malloc16_clear( sizeof(SystemInformation_t) ); UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIB1Status = 0; UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus = 0; } #ifdef Rel10 -void init_MCCH_UE(module_id_t ue_mod_idP, uint8_t eNB_index) +//----------------------------------------------------------------------------- +static void init_MCCH_UE(module_id_t ue_mod_idP, uint8_t eNB_index) { int i; UE_rrc_inst[ue_mod_idP].sizeof_MCCH_MESSAGE[eNB_index] = 0; @@ -239,10 +275,8 @@ void init_MCCH_UE(module_id_t ue_mod_idP, uint8_t eNB_index) } #endif -static -void openair_rrc_lite_ue_init_security( - const protocol_ctxt_t* const ctxt_pP -) +//----------------------------------------------------------------------------- +static void openair_rrc_lite_ue_init_security( const protocol_ctxt_t* const ctxt_pP ) { #if defined(ENABLE_SECURITY) // uint8_t *kRRCenc; @@ -263,12 +297,7 @@ void openair_rrc_lite_ue_init_security( } //----------------------------------------------------------------------------- -char -openair_rrc_lite_ue_init( - const module_id_t ue_mod_idP, - const unsigned char eNB_index -) -//----------------------------------------------------------------------------- +char openair_rrc_lite_ue_init( const module_id_t ue_mod_idP, const unsigned char eNB_index ) { protocol_ctxt_t ctxt; PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, ue_mod_idP, ENB_FLAG_NO, NOT_A_RNTI, 0, 0,eNB_index); @@ -321,12 +350,7 @@ openair_rrc_lite_ue_init( } //----------------------------------------------------------------------------- -void -rrc_ue_generate_RRCConnectionRequest( - const protocol_ctxt_t* const ctxt_pP, - const uint8_t eNB_index -) -//----------------------------------------------------------------------------- +void rrc_ue_generate_RRCConnectionRequest( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index ) { uint8_t i=0,rv[6]; @@ -398,13 +422,7 @@ static const char const nas_attach_req_guti[] = { }; //----------------------------------------------------------------------------- -void -rrc_ue_generate_RRCConnectionSetupComplete( - const protocol_ctxt_t* const ctxt_pP, - const uint8_t eNB_index, - const uint8_t Transaction_id -) -//----------------------------------------------------------------------------- +static void rrc_ue_generate_RRCConnectionSetupComplete( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index, const uint8_t Transaction_id ) { uint8_t buffer[100]; @@ -438,13 +456,7 @@ rrc_ue_generate_RRCConnectionSetupComplete( } //----------------------------------------------------------------------------- -void -rrc_ue_generate_RRCConnectionReconfigurationComplete( - const protocol_ctxt_t* const ctxt_pP, - const uint8_t eNB_index, - const uint8_t Transaction_id -) -//----------------------------------------------------------------------------- +static void rrc_ue_generate_RRCConnectionReconfigurationComplete( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index, const uint8_t Transaction_id ) { uint8_t buffer[32], size; @@ -473,13 +485,7 @@ rrc_ue_generate_RRCConnectionReconfigurationComplete( //----------------------------------------------------------------------------- // Called by L2 interface (MAC) -int -rrc_ue_decode_ccch( - const protocol_ctxt_t* const ctxt_pP, - const SRB_INFO* const Srb_info, - const uint8_t eNB_index -) -//----------------------------------------------------------------------------- +int rrc_ue_decode_ccch( const protocol_ctxt_t* const ctxt_pP, const SRB_INFO* const Srb_info, const uint8_t eNB_index ) { DL_CCCH_Message_t* dl_ccch_msg=NULL; asn_dec_rval_t dec_rval; @@ -2147,184 +2153,310 @@ rrc_ue_decode_dcch( #endif } -const char siWindowLength[7][5] = {"1ms\0","2ms\0","5ms\0","10ms\0","15ms\0","20ms\0","40ms\0"}; +const char siWindowLength[8][5] = {"1ms","2ms","5ms","10ms","15ms","20ms","40ms","ERR"}; const char siWindowLength_int[7] = {1,2,5,10,15,20,40}; -const char SIBType[16][6] = {"SIB3\0","SIB4\0","SIB5\0","SIB6\0","SIB7\0","SIB8\0","SIB9\0","SIB10\0","SIB11\0","SIB12\0","SIB13\0","Sp2\0","Sp3\0","Sp4\0"}; -const char SIBPeriod[7][7]= {"80ms\0","160ms\0","320ms\0","640ms\0","1280ms\0","2560ms\0","5120ms\0"}; +const char SIBType[12][6] = {"SIB3","SIB4","SIB5","SIB6","SIB7","SIB8","SIB9","SIB10","SIB11","SIB12","SIB13","Spare"}; +const char SIBPeriod[8][6]= {"rf8","rf16","rf32","rf64","rf128","rf256","rf512","ERR"}; int siPeriod_int[7] = {80,160,320,640,1280,2560,5120}; +static const char* SIBreserved( long value ) +{ + if (value < 0 || value > 1) + return "ERR"; + + if (value) + return "notReserved"; + + return "reserved"; +} +static const char* SIBbarred( long value ) +{ + if (value < 0 || value > 1) + return "ERR"; + + if (value) + return "notBarred"; + + return "barred"; +} +static const char* SIBallowed( long value ) +{ + if (value < 0 || value > 1) + return "ERR"; + + if (value) + return "notAllowed"; + + return "allowed"; +} +static const char* SIB2SoundingPresent( int value ) +{ + switch (value) { + case SoundingRS_UL_ConfigCommon_PR_NOTHING: + return "NOTHING"; + + case SoundingRS_UL_ConfigCommon_PR_release: + return "release"; + + case SoundingRS_UL_ConfigCommon_PR_setup: + return "setup"; + } + + return "ERR"; +} +static const char* SIB2numberOfRA_Preambles( long value ) +{ + static char temp[4] = {0}; + + if (value < 0 || value > 15) + return "ERR"; + + snprintf( temp, sizeof(temp), "n%d", value*4 + 4 ); + temp[3] = 0; // terminate string + return temp; +} +static const char* SIB2powerRampingStep( long value ) +{ + if (value < 0 || value > 3) + return "ERR"; + + static const char str[4][4] = {"dB0","dB2","dB4","dB6"}; + return str[value]; +} +static const char* SIB2preambleInitialReceivedTargetPower( long value ) +{ + static char temp[8] = {0}; + + if (value < 0 || value > 15) + return "ERR"; + + snprintf( temp, sizeof(temp), "dBm-%d", 120 - value*2 ); + temp[7] = 0; // terminate string + return temp; +} +static const char* SIB2preambleTransMax( long value ) +{ + static char temp[5] = {0}; + + if (value < 0 || value > 10) + return "ERR"; + + if (value <= 5) { + snprintf( temp, sizeof(temp), "n%d", value+3 ); + return temp; + } + + switch (value) { + case 6: + return "n10"; + + case 7: + return "n20"; + + case 8: + return "n50"; + + case 9: + return "n100"; + + case 10: + return "n200"; + } +} +static const char* SIB2ra_ResponseWindowSize( long value ) +{ + static char temp[4] = {0}; + + if (value < 0 || value > 7) + return "ERR"; + + if (value == 7) + return "sf10"; + + snprintf( temp, sizeof(temp), "sf%d", value+2 ); + return temp; +} +static const char* SIB2mac_ContentionResolutionTimer( long value ) +{ + static char temp[5] = {0}; + + if (value < 0 || value > 7) + return "ERR"; + + snprintf( temp, sizeof(temp), "sf%d", 8 + value*8 ); + return temp; +} +static const char* SIB2modificationPeriodCoeff( long value ) +{ + static char temp[4] = {0}; + + if (value < 0 || value > 3) + return "ERR"; + + snprintf( temp, sizeof(temp), "n%d", (int)pow(2,value+1) ); + return temp; +} +static const char* SIB2defaultPagingCycle( long value ) +{ + static char temp[6] = {0}; + + if (value < 0 || value > 3) + return "ERR"; + + snprintf( temp, sizeof(temp), "rf%d", (int)pow(2,value+4) ); + return temp; +} +static const char* SIB2nB( long value ) +{ + if (value < 0 || value > 7) + return "ERR"; + + static const char str[8][17] = {"fourT","twoT","oneT","halfT","quarterT","oneEigthT","oneSixteenthT","oneThirtySecondT"}; + return str[value]; +} + + + + //----------------------------------------------------------------------------- -int -decode_BCCH_DLSCH_Message( +int decode_BCCH_DLSCH_Message( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index, uint8_t* const Sdu, const uint8_t Sdu_len, const uint8_t rsrq, - const uint8_t rsrp -) -//----------------------------------------------------------------------------- + const uint8_t rsrp ) { + BCCH_DL_SCH_Message_t *bcch_message = NULL; - //BCCH_DL_SCH_Message_t bcch_message; - BCCH_DL_SCH_Message_t *bcch_message=NULL;//_ptr=&bcch_message; - SystemInformationBlockType1_t** sib1=&UE_rrc_inst[ctxt_pP->module_id].sib1[eNB_index]; - SystemInformation_t** si=UE_rrc_inst[ctxt_pP->module_id].si[eNB_index]; - asn_dec_rval_t dec_rval; - uint32_t si_window;//, sib1_decoded=0, si_decoded=0; - // int i; - - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_BCCH, VCD_FUNCTION_IN); - + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_BCCH, VCD_FUNCTION_IN ); if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIB1Status == 1) && (UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus == 1)) { // Avoid decoding to prevent memory bloating - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_BCCH, VCD_FUNCTION_OUT); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_BCCH, VCD_FUNCTION_OUT ); return 0; - } else { - - rrc_set_sub_state (ctxt_pP->module_id, RRC_SUB_STATE_IDLE_RECEIVING_SIB); - - //memset(&bcch_message,0,sizeof(BCCH_DL_SCH_Message_t)); - - /*LOG_D(RRC,"[UE %d] Decoding DL_BCCH_DLSCH_Message\n",ue_mod_idP);*/ - - dec_rval = uper_decode_complete(NULL, - &asn_DEF_BCCH_DL_SCH_Message, - (void **)&bcch_message, - (const void *)Sdu, - Sdu_len);//,0,0); - - if ((dec_rval.code != RC_OK) && (dec_rval.consumed==0)) { - LOG_E(RRC,"[UE %d] Failed to decode BCCH_DLSCH_MESSAGE (%d bits)\n", - ctxt_pP->module_id, - dec_rval.consumed); - //free the memory - SEQUENCE_free(&asn_DEF_BCCH_DL_SCH_Message, (void*)bcch_message, 1); - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_BCCH, VCD_FUNCTION_OUT); - return -1; - } + } - // xer_fprint(stdout, &asn_DEF_BCCH_DL_SCH_Message, (void*)&bcch_message); + rrc_set_sub_state( ctxt_pP->module_id, RRC_SUB_STATE_IDLE_RECEIVING_SIB ); + + asn_dec_rval_t dec_rval = uper_decode_complete( NULL, + &asn_DEF_BCCH_DL_SCH_Message, + (void **)&bcch_message, + (const void *)Sdu, + Sdu_len ); + + if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) { + LOG_E( RRC, "[UE %"PRIu8"] Failed to decode BCCH_DLSCH_MESSAGE (%zu bits)\n", + ctxt_pP->module_id, + dec_rval.consumed ); + // free the memory + SEQUENCE_free( &asn_DEF_BCCH_DL_SCH_Message, (void*)bcch_message, 1 ); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_BCCH, VCD_FUNCTION_OUT ); + return -1; + } #if defined(ENABLE_ITTI) # if defined(DISABLE_ITTI_XER_PRINT) - { - MessageDef *msg_p; + { + MessageDef *msg_p; - msg_p = itti_alloc_new_message (TASK_RRC_UE, RRC_DL_BCCH_MESSAGE); - memcpy (&msg_p->ittiMsg, (void *) bcch_message, sizeof(RrcDlBcchMessage)); + msg_p = itti_alloc_new_message (TASK_RRC_UE, RRC_DL_BCCH_MESSAGE); + memcpy (&msg_p->ittiMsg, (void *) bcch_message, sizeof(RrcDlBcchMessage)); - itti_send_msg_to_task (TASK_UNKNOWN, ctxt_pP->instance, msg_p); - } + itti_send_msg_to_task (TASK_UNKNOWN, ctxt_pP->instance, msg_p); + } # else - { - char message_string[15000]; - size_t message_string_size; + { + char message_string[15000]; + size_t message_string_size; - if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_BCCH_DL_SCH_Message, (void *)bcch_message)) > 0) { - MessageDef *msg_p; + if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_BCCH_DL_SCH_Message, (void *)bcch_message)) > 0) { + MessageDef *msg_p; - msg_p = itti_alloc_new_message_sized (TASK_RRC_UE, RRC_DL_BCCH, message_string_size + sizeof (IttiMsgText)); - msg_p->ittiMsg.rrc_dl_bcch.size = message_string_size; - memcpy(&msg_p->ittiMsg.rrc_dl_bcch.text, message_string, message_string_size); + msg_p = itti_alloc_new_message_sized (TASK_RRC_UE, RRC_DL_BCCH, message_string_size + sizeof (IttiMsgText)); + msg_p->ittiMsg.rrc_dl_bcch.size = message_string_size; + memcpy(&msg_p->ittiMsg.rrc_dl_bcch.text, message_string, message_string_size); - itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, msg_p); - } + itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, msg_p); } + } # endif #endif - if (bcch_message->message.present == BCCH_DL_SCH_MessageType_PR_c1) { - switch (bcch_message->message.choice.c1.present) { - case BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1: - if ((ctxt_pP->frame %2) == 0) { - if (UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIB1Status == 0) { - memcpy((void*)*sib1, - (void*)&bcch_message->message.choice.c1.choice.systemInformationBlockType1, - sizeof(SystemInformationBlockType1_t)); - LOG_D(RRC,"[UE %d] Decoding First SIB1\n",ctxt_pP->module_id); - decode_SIB1(ctxt_pP, eNB_index, rsrq, rsrp); - //mac_xface->macphy_exit("after decode_SIB1"); - } + if (bcch_message->message.present == BCCH_DL_SCH_MessageType_PR_c1) { + switch (bcch_message->message.choice.c1.present) { + case BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1: + if ((ctxt_pP->frame % 2) == 0) { + // even frame + if (UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIB1Status == 0) { + SystemInformationBlockType1_t* sib1 = UE_rrc_inst[ctxt_pP->module_id].sib1[eNB_index]; + memcpy( (void*)sib1, + (void*)&bcch_message->message.choice.c1.choice.systemInformationBlockType1, + sizeof(SystemInformationBlockType1_t) ); + LOG_D( RRC, "[UE %"PRIu8"] Decoding First SIB1\n", ctxt_pP->module_id ); + decode_SIB1( ctxt_pP, eNB_index, rsrq, rsrp ); } + } - break; + break; - case BCCH_DL_SCH_MessageType__c1_PR_systemInformation: - if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIB1Status == 1) && - (UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus == 0)) { - // if ((frameP %8) == 1) { // check only in odd frames for SI - si_window = (ctxt_pP->frame%(UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIperiod/10))/ - (UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIwindowsize/10); - memcpy((void*)si[si_window], // FIXME check indexing (see line 219) - (void*)&bcch_message->message.choice.c1.choice.systemInformation, - sizeof(SystemInformation_t)); - LOG_D(RRC,"[UE %d] Decoding SI for frameP %d, si_window %d\n", - ctxt_pP->module_id, - ctxt_pP->frame, - si_window); - decode_SI(ctxt_pP,eNB_index,si_window); - //mac_xface->macphy_exit("after decode_SI"); + case BCCH_DL_SCH_MessageType__c1_PR_systemInformation: + if (UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIB1Status == 1) { + // SIB1 with schedulingInfoList is available - // } - } + SystemInformation_t* si = UE_rrc_inst[ctxt_pP->module_id].si[eNB_index]; + memcpy( si, + &bcch_message->message.choice.c1.choice.systemInformation, + sizeof(SystemInformation_t) ); - break; + LOG_D( RRC, "[UE %"PRIu8"] Decoding SI for frameP %"PRIu32"\n", + ctxt_pP->module_id, + ctxt_pP->frame ); - case BCCH_DL_SCH_MessageType__c1_PR_NOTHING: - default: - break; + decode_SI( ctxt_pP, eNB_index ); } + + break; + + case BCCH_DL_SCH_MessageType__c1_PR_NOTHING: + default: + break; } } if ((rrc_get_sub_state(ctxt_pP->module_id) == RRC_SUB_STATE_IDLE_SIB_COMPLETE) -# if defined(ENABLE_USE_MME) +#if defined(ENABLE_USE_MME) && (UE_rrc_inst[ctxt_pP->module_id].initialNasMsg.data != NULL) #endif ) { rrc_ue_generate_RRCConnectionRequest(ctxt_pP, 0); - LOG_I(RRC, "not sending connection request\n"); - rrc_set_sub_state (ctxt_pP->module_id, RRC_SUB_STATE_IDLE_CONNECTING); + LOG_I( RRC, "not sending connection request\n" ); + rrc_set_sub_state( ctxt_pP->module_id, RRC_SUB_STATE_IDLE_CONNECTING ); } - /* if ((UE_rrc_inst[ue_mod_idP].Info[eNB_index].SIB1Status == 1) && - (UE_rrc_inst[ue_mod_idP].Info[eNB_index].SIStatus == 1) && (frameP >= ue_mod_idP * 20 + 10)) - SEQUENCE_free(&asn_DEF_BCCH_DL_SCH_Message, (void*)bcch_message, 0);*/ - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_BCCH, VCD_FUNCTION_OUT); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_BCCH, VCD_FUNCTION_OUT ); return 0; } //----------------------------------------------------------------------------- -int -decode_SIB1( - const protocol_ctxt_t* const ctxt_pP, - const uint8_t eNB_index, - const uint8_t rsrq, - const uint8_t rsrp -) -//----------------------------------------------------------------------------- +static int decode_SIB1( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index, const uint8_t rsrq, const uint8_t rsrp ) { - SystemInformationBlockType1_t** sib1=&UE_rrc_inst[ctxt_pP->module_id].sib1[eNB_index]; - int i; - int mcc,mnc,mccdigits,mncdigits,tac=0; - PLMN_Identity_t *PLMN_identity; - int plmn_ind=0; + SystemInformationBlockType1_t* sib1 = UE_rrc_inst[ctxt_pP->module_id].sib1[eNB_index]; - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_UE_DECODE_SIB1, VCD_FUNCTION_IN); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_UE_DECODE_SIB1, VCD_FUNCTION_IN ); - LOG_I(RRC,"[UE %d] : Dumping SIB 1\n",ctxt_pP->module_id); + LOG_I( RRC, "[UE %d] : Dumping SIB 1\n", ctxt_pP->module_id ); - // xer_fprint(stdout,&asn_DEF_SystemInformationBlockType1, (void*)*sib1); - PLMN_identity = &(*sib1)->cellAccessRelatedInfo.plmn_IdentityList.list.array[0]->plmn_Identity; + PLMN_Identity_t *PLMN_identity = &sib1->cellAccessRelatedInfo.plmn_IdentityList.list.array[0]->plmn_Identity; - mccdigits = PLMN_identity->mcc->list.count; - mncdigits = PLMN_identity->mnc.list.count; + int mccdigits = PLMN_identity->mcc->list.count; + int mncdigits = PLMN_identity->mnc.list.count; + + int mcc; if (mccdigits == 2) { mcc = *PLMN_identity->mcc->list.array[0]*10 + *PLMN_identity->mcc->list.array[1]; @@ -2332,117 +2464,157 @@ decode_SIB1( mcc = *PLMN_identity->mcc->list.array[0]*100 + *PLMN_identity->mcc->list.array[1]*10 + *PLMN_identity->mcc->list.array[2]; } + int mnc; + if (mncdigits == 2) { mnc = *PLMN_identity->mnc.list.array[0]*10 + *PLMN_identity->mnc.list.array[1]; } else { mnc = *PLMN_identity->mnc.list.array[0]*100 + *PLMN_identity->mnc.list.array[1]*10 + *PLMN_identity->mnc.list.array[2]; } - if ((*sib1)->cellAccessRelatedInfo.trackingAreaCode.size == 2) { - tac = ((*sib1)->cellAccessRelatedInfo.trackingAreaCode.buf[0]<<8)+(*sib1)->cellAccessRelatedInfo.trackingAreaCode.buf[1]; + int tac = 0; + + if (sib1->cellAccessRelatedInfo.trackingAreaCode.size == 2) { + tac = (sib1->cellAccessRelatedInfo.trackingAreaCode.buf[0]<<8) + sib1->cellAccessRelatedInfo.trackingAreaCode.buf[1]; } - LOG_I(RRC,"PLMN MCC %d, MNC %d, TAC %x\n",mcc,mnc,tac); - plmn_ind = 0; + LOG_I( RRC, "PLMN MCC %0*d, MNC %0*d, TAC 0x%04x\n", mccdigits, mcc, mncdigits, mnc, tac ); + long cellReservedForOperatorUse = sib1->cellAccessRelatedInfo.plmn_IdentityList.list.array[0]->cellReservedForOperatorUse; + LOG_I( RRC, "cellReservedForOperatorUse : raw:%ld decoded:%s\n", cellReservedForOperatorUse, SIBreserved(cellReservedForOperatorUse) ); - while (plmn_data[plmn_ind].mcc>0) { - if ((plmn_data[plmn_ind].mcc == mcc) && (plmn_data[plmn_ind].mnc==mnc)) { - LOG_I(RRC,"Found %s\n", plmn_data[plmn_ind].oper_short); + // search internal table for provider name + int plmn_ind = 0; + + while (plmn_data[plmn_ind].mcc > 0) { + if ((plmn_data[plmn_ind].mcc == mcc) && (plmn_data[plmn_ind].mnc == mnc)) { + LOG_I( RRC, "Found %s (name from internal table)\n", plmn_data[plmn_ind].oper_short ); break; } plmn_ind++; } - if (plmn_data[plmn_ind].mcc<0) { - LOG_I(RRC,"Found Unknown operator\n"); + if (plmn_data[plmn_ind].mcc < 0) { + LOG_I( RRC, "Found Unknown operator (no entry in internal table)\n" ); } - LOG_I(RRC,"cellAccessRelatedInfo.cellIdentity : %x.%x.%x.%x\n", - (*sib1)->cellAccessRelatedInfo.cellIdentity.buf[0], - (*sib1)->cellAccessRelatedInfo.cellIdentity.buf[1], - (*sib1)->cellAccessRelatedInfo.cellIdentity.buf[2], - (*sib1)->cellAccessRelatedInfo.cellIdentity.buf[3]); + LOG_I( RRC, "cellAccessRelatedInfo.cellIdentity : raw:%"PRIu32" decoded:%02x.%02x.%02x.%02x\n", + BIT_STRING_to_uint32( &sib1->cellAccessRelatedInfo.cellIdentity ), + sib1->cellAccessRelatedInfo.cellIdentity.buf[0], + sib1->cellAccessRelatedInfo.cellIdentity.buf[1], + sib1->cellAccessRelatedInfo.cellIdentity.buf[2], + sib1->cellAccessRelatedInfo.cellIdentity.buf[3] >> sib1->cellAccessRelatedInfo.cellIdentity.bits_unused); + + long cellBarred = sib1->cellAccessRelatedInfo.cellBarred; + LOG_I( RRC, "cellAccessRelatedInfo.cellBarred : raw:%ld decoded:%s\n", cellBarred, SIBbarred(cellBarred) ); + long intraFreqReselection = sib1->cellAccessRelatedInfo.intraFreqReselection; + LOG_I( RRC, "cellAccessRelatedInfo.intraFreqReselection : raw:%ld decoded:%s\n", intraFreqReselection, SIBallowed(intraFreqReselection) ); + LOG_I( RRC, "cellAccessRelatedInfo.csg_Indication : %d\n", sib1->cellAccessRelatedInfo.csg_Indication ); - LOG_I(RRC,"cellSelectionInfo.q_RxLevMin : %d\n",(int)(*sib1)->cellSelectionInfo.q_RxLevMin); - LOG_I(RRC,"freqBandIndicator : %d\n",(int)(*sib1)->freqBandIndicator); - LOG_I(RRC,"siWindowLength : %s\n",siWindowLength[(*sib1)->si_WindowLength]); + if (sib1->cellAccessRelatedInfo.csg_Identity) + LOG_I( RRC, "cellAccessRelatedInfo.csg_Identity : %"PRIu32"\n", BIT_STRING_to_uint32(sib1->cellAccessRelatedInfo.csg_Identity) ); + else + LOG_I( RRC, "cellAccessRelatedInfo.csg_Identity : not defined\n" ); - if ((*sib1)->schedulingInfoList.list.count>0) { - for (i=0; i<(*sib1)->schedulingInfoList.list.count; i++) { - LOG_I(RRC,"siSchedulingInfoPeriod[%d] : %s\n",i,SIBPeriod[(int)(*sib1)->schedulingInfoList.list.array[i]->si_Periodicity]); + LOG_I( RRC, "cellSelectionInfo.q_RxLevMin : %ld\n", sib1->cellSelectionInfo.q_RxLevMin ); - if ((*sib1)->schedulingInfoList.list.array[i]->sib_MappingInfo.list.count>0) { - LOG_I(RRC,"siSchedulingInfoSIBType[%d] : %s\n",i,SIBType[(int)(*(*sib1)->schedulingInfoList.list.array[i]->sib_MappingInfo.list.array[0])]); + if (sib1->cellSelectionInfo.q_RxLevMinOffset) + LOG_I( RRC, "cellSelectionInfo.q_RxLevMinOffset : %ld\n", *sib1->cellSelectionInfo.q_RxLevMinOffset ); + else + LOG_I( RRC, "cellSelectionInfo.q_RxLevMinOffset : not defined\n" ); + + if (sib1->p_Max) + LOG_I( RRC, "p_Max : %ld\n", *sib1->p_Max ); + else + LOG_I( RRC, "p_Max : not defined\n" ); + + LOG_I( RRC, "freqBandIndicator : %ld\n", sib1->freqBandIndicator ); + + if (sib1->schedulingInfoList.list.count > 0) { + for (int i=0; i<sib1->schedulingInfoList.list.count; i++) { + LOG_I( RRC, "si_Periodicity[%d] : %s\n", i, SIBPeriod[min(sib1->schedulingInfoList.list.array[i]->si_Periodicity,7)]); + + if (sib1->schedulingInfoList.list.array[i]->sib_MappingInfo.list.count > 0) { + char temp[32 * sizeof(SIBType[0])] = {0}; // maxSIB==32 + + for (int j=0; j<sib1->schedulingInfoList.list.array[i]->sib_MappingInfo.list.count; j++) { + sprintf( temp + j*sizeof(SIBType[0]), "%*s ", (int)sizeof(SIBType[0])-1, SIBType[min(*sib1->schedulingInfoList.list.array[i]->sib_MappingInfo.list.array[0],11)] ); + } + + LOG_I( RRC, "siSchedulingInfoSIBType[%d] : %s\n", i, temp ); } else { - LOG_W(RRC,"mapping list %d is null\n",i); + LOG_I( RRC, "mapping list %d is null\n", i ); } } } else { - LOG_E(RRC,"siSchedulingInfoPeriod[0] : PROBLEM!!!\n"); + LOG_E( RRC, "siSchedulingInfoPeriod[0] : PROBLEM!!!\n" ); return -1; } - if ((*sib1)->tdd_Config) { - LOG_I(RRC,"TDD subframe assignment : %d\n",(int)(*sib1)->tdd_Config->subframeAssignment); - LOG_I(RRC,"S-Subframe Config : %d\n",(int)(*sib1)->tdd_Config->specialSubframePatterns); + if (sib1->tdd_Config) { + LOG_I( RRC, "TDD subframeAssignment : %ld\n", sib1->tdd_Config->subframeAssignment ); + LOG_I( RRC, "TDD specialSubframePatterns : %ld\n", sib1->tdd_Config->specialSubframePatterns ); } - UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIperiod = siPeriod_int[(*sib1)->schedulingInfoList.list.array[0]->si_Periodicity]; - UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIwindowsize = siWindowLength_int[(*sib1)->si_WindowLength]; - LOG_D(RRC, "[FRAME unknown][RRC_UE][MOD %02d][][--- MAC_CONFIG_REQ (SIB1 params eNB %d) --->][MAC_UE][MOD %02d][]\n", - ctxt_pP->module_id, eNB_index, ctxt_pP->module_id); - rrc_mac_config_req(ctxt_pP->module_id,ENB_FLAG_NO,0,eNB_index, - (RadioResourceConfigCommonSIB_t *)NULL, - (struct PhysicalConfigDedicated *)NULL, + LOG_I( RRC, "siWindowLength : %s\n", siWindowLength[min(sib1->si_WindowLength,7)] ); + LOG_I( RRC, "systemInfoValueTag : %ld\n", sib1->systemInfoValueTag ); + + UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIperiod = siPeriod_int[sib1->schedulingInfoList.list.array[0]->si_Periodicity]; + UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIwindowsize = siWindowLength_int[sib1->si_WindowLength]; + LOG_D( RRC, "[FRAME unknown][RRC_UE][MOD %02"PRIu8"][][--- MAC_CONFIG_REQ (SIB1 params eNB %"PRIu8") --->][MAC_UE][MOD %02"PRIu8"][]\n", + ctxt_pP->module_id, eNB_index, ctxt_pP->module_id ); + + rrc_mac_config_req( ctxt_pP->module_id,ENB_FLAG_NO, 0, eNB_index, + (RadioResourceConfigCommonSIB_t *)NULL, + (struct PhysicalConfigDedicated *)NULL, #ifdef Rel10 - (SCellToAddMod_r10_t *)NULL, - //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, + (SCellToAddMod_r10_t *)NULL, + //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, #endif - (MeasObjectToAddMod_t **)NULL, - (MAC_MainConfig_t *)NULL, - 0, - (struct LogicalChannelConfig *)NULL, - (MeasGapConfig_t *)NULL, - UE_rrc_inst[ctxt_pP->module_id].sib1[eNB_index]->tdd_Config, - (MobilityControlInfo_t *) NULL, - &UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIwindowsize, - &UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIperiod, - NULL, - NULL, - NULL, - (MBSFN_SubframeConfigList_t *)NULL + (MeasObjectToAddMod_t **)NULL, + (MAC_MainConfig_t *)NULL, + 0, + (struct LogicalChannelConfig *)NULL, + (MeasGapConfig_t *)NULL, + UE_rrc_inst[ctxt_pP->module_id].sib1[eNB_index]->tdd_Config, + (MobilityControlInfo_t *) NULL, + &UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIwindowsize, + &UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIperiod, + NULL, + NULL, + NULL, + (MBSFN_SubframeConfigList_t *)NULL #ifdef Rel10 - ,0, - (MBSFN_AreaInfoList_r9_t *)NULL, - (PMCH_InfoList_r9_t *)NULL + ,0, + (MBSFN_AreaInfoList_r9_t *)NULL, + (PMCH_InfoList_r9_t *)NULL #endif #ifdef CBA - , - 0, - 0 + , + 0, + 0 #endif ); UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIB1Status = 1; - UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIB1systemInfoValueTag = (*sib1)->systemInfoValueTag; + UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIB1systemInfoValueTag = sib1->systemInfoValueTag; #if defined(ENABLE_ITTI) && defined(ENABLE_USE_MME) { int cell_valid = 0; - if ((*sib1)->cellAccessRelatedInfo.cellBarred == SystemInformationBlockType1__cellAccessRelatedInfo__cellBarred_notBarred) { + if (sib1->cellAccessRelatedInfo.cellBarred == SystemInformationBlockType1__cellAccessRelatedInfo__cellBarred_notBarred) { /* Cell is not barred */ int plmn; int plmn_number; - plmn_number = (*sib1)->cellAccessRelatedInfo.plmn_IdentityList.list.count; + plmn_number = sib1->cellAccessRelatedInfo.plmn_IdentityList.list.count; /* Compare requested PLMN and PLMNs from SIB1*/ for (plmn = 0; plmn < plmn_number; plmn++) { PLMN_Identity_t *plmn_Identity; - plmn_Identity = &(*sib1)->cellAccessRelatedInfo.plmn_IdentityList.list.array[plmn]->plmn_Identity; + plmn_Identity = &sib1->cellAccessRelatedInfo.plmn_IdentityList.list.array[plmn]->plmn_Identity; if ( ( @@ -2470,8 +2642,8 @@ decode_SIB1( msg_p = itti_alloc_new_message(TASK_RRC_UE, NAS_CELL_SELECTION_CNF); NAS_CELL_SELECTION_CNF (msg_p).errCode = AS_SUCCESS; - NAS_CELL_SELECTION_CNF (msg_p).cellID = BIT_STRING_to_uint32(&(*sib1)->cellAccessRelatedInfo.cellIdentity); - NAS_CELL_SELECTION_CNF (msg_p).tac = BIT_STRING_to_uint16(&(*sib1)->cellAccessRelatedInfo.trackingAreaCode); + NAS_CELL_SELECTION_CNF (msg_p).cellID = BIT_STRING_to_uint32(&sib1->cellAccessRelatedInfo.cellIdentity); + NAS_CELL_SELECTION_CNF (msg_p).tac = BIT_STRING_to_uint16(&sib1->cellAccessRelatedInfo.trackingAreaCode); NAS_CELL_SELECTION_CNF (msg_p).rat = 0xFF; NAS_CELL_SELECTION_CNF (msg_p).rsrq = rsrq; NAS_CELL_SELECTION_CNF (msg_p).rsrp = rsrp; @@ -2494,217 +2666,388 @@ decode_SIB1( } #endif - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_UE_DECODE_SIB1, VCD_FUNCTION_OUT); - return 0; + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_UE_DECODE_SIB1, VCD_FUNCTION_OUT ); + return 0; } //----------------------------------------------------------------------------- -void -dump_sib2( - SystemInformationBlockType2_t *sib2 -) -//----------------------------------------------------------------------------- +static void dump_sib2( SystemInformationBlockType2_t *sib2 ) { + // ac_BarringInfo + if (sib2->ac_BarringInfo) { + LOG_I( RRC, "ac_BarringInfo->ac_BarringForEmergency : %d\n", + sib2->ac_BarringInfo->ac_BarringForEmergency ); + + if (sib2->ac_BarringInfo->ac_BarringForMO_Signalling) { + LOG_I( RRC, "ac_BarringInfo->ac_BarringForMO_Signalling->ac_BarringFactor : %ld\n", + sib2->ac_BarringInfo->ac_BarringForMO_Signalling->ac_BarringFactor ); + LOG_I( RRC, "ac_BarringInfo->ac_BarringForMO_Signalling->ac_BarringTime : %ld\n", + sib2->ac_BarringInfo->ac_BarringForMO_Signalling->ac_BarringTime ); + LOG_I( RRC, "ac_BarringInfo->ac_BarringForMO_Signalling->ac_BarringForSpecialAC : %"PRIu32"\n", + BIT_STRING_to_uint32(&sib2->ac_BarringInfo->ac_BarringForMO_Signalling->ac_BarringForSpecialAC) ); + } else + LOG_I( RRC, "ac_BarringInfo->ac_BarringForMO_Signalling : not defined\n" ); + + if (sib2->ac_BarringInfo->ac_BarringForMO_Data) { + LOG_I( RRC, "ac_BarringInfo->ac_BarringForMO_Data->ac_BarringFactor : %ld\n", + sib2->ac_BarringInfo->ac_BarringForMO_Data->ac_BarringFactor ); + LOG_I( RRC, "ac_BarringInfo->ac_BarringForMO_Data->ac_BarringTime : %ld\n", + sib2->ac_BarringInfo->ac_BarringForMO_Data->ac_BarringTime ); + LOG_I( RRC, "ac_BarringInfo->ac_BarringForMO_Data->ac_BarringForSpecialAC : %"PRIu32"\n", + BIT_STRING_to_uint32(&sib2->ac_BarringInfo->ac_BarringForMO_Data->ac_BarringForSpecialAC) ); + } else + LOG_I( RRC, "ac_BarringInfo->ac_BarringForMO_Data : not defined\n" ); + } else + LOG_I( RRC, "ac_BarringInfo : not defined\n" ); + + // RACH + LOG_I( RRC, "radioResourceConfigCommon.rach_ConfigCommon.preambleInfo.numberOfRA_Preambles : raw:%ld decoded:%s\n", + sib2->radioResourceConfigCommon.rach_ConfigCommon.preambleInfo.numberOfRA_Preambles, + SIB2numberOfRA_Preambles(sib2->radioResourceConfigCommon.rach_ConfigCommon.preambleInfo.numberOfRA_Preambles) ); + + if (sib2->radioResourceConfigCommon.rach_ConfigCommon.preambleInfo.preamblesGroupAConfig) { + LOG_I( RRC, "radioResourceConfigCommon.rach_ConfigCommon.preambleInfo.preamblesGroupAConfig->sizeOfRA_PreamblesGroupA : %ld\n", + sib2->radioResourceConfigCommon.rach_ConfigCommon.preambleInfo.preamblesGroupAConfig->sizeOfRA_PreamblesGroupA ); + LOG_I( RRC, "radioResourceConfigCommon.rach_ConfigCommon.preambleInfo.preamblesGroupAConfig->messageSizeGroupA : %ld\n", + sib2->radioResourceConfigCommon.rach_ConfigCommon.preambleInfo.preamblesGroupAConfig->messageSizeGroupA ); + LOG_I( RRC, "radioResourceConfigCommon.rach_ConfigCommon.preambleInfo.preamblesGroupAConfig->messagePowerOffsetGroupB : %ld\n", + sib2->radioResourceConfigCommon.rach_ConfigCommon.preambleInfo.preamblesGroupAConfig->messagePowerOffsetGroupB ); + } else { + LOG_I( RRC, "radioResourceConfigCommon.rach_ConfigCommon.preambleInfo.preamblesGroupAConfig : not defined\n" ); + } - LOG_I(RRC,"radioResourceConfigCommon.rach_ConfigCommon.preambleInfo.numberOfRA_Preambles : %ld\n", - sib2->radioResourceConfigCommon.rach_ConfigCommon.preambleInfo.numberOfRA_Preambles); - - // if (radioResourceConfigCommon.rach_ConfigCommon.preambleInfo.preamblesGroupAConfig) - //msg("radioResourceConfigCommon.rach_ConfigCommon.preambleInfo.preamblesGroupAConfig ",sib2->radioResourceConfigCommon.rach_ConfigCommon.preambleInfo.preamblesGroupAConfig = NULL; + LOG_I( RRC, "radioResourceConfigCommon.rach_ConfigCommon.powerRampingParameters.powerRampingStep : raw:%ld decoded:%s\n", + sib2->radioResourceConfigCommon.rach_ConfigCommon.powerRampingParameters.powerRampingStep, + SIB2powerRampingStep(sib2->radioResourceConfigCommon.rach_ConfigCommon.powerRampingParameters.powerRampingStep) ); + LOG_I( RRC, "radioResourceConfigCommon.rach_ConfigCommon.powerRampingParameters.preambleInitialReceivedTargetPower : raw:%ld decoded:%s\n", + sib2->radioResourceConfigCommon.rach_ConfigCommon.powerRampingParameters.preambleInitialReceivedTargetPower, + SIB2preambleInitialReceivedTargetPower(sib2->radioResourceConfigCommon.rach_ConfigCommon.powerRampingParameters.preambleInitialReceivedTargetPower) ); + + LOG_I( RRC, "radioResourceConfigCommon.rach_ConfigCommon.ra_SupervisionInfo.preambleTransMax : raw:%ld decoded:%s\n", + sib2->radioResourceConfigCommon.rach_ConfigCommon.ra_SupervisionInfo.preambleTransMax, + SIB2preambleTransMax(sib2->radioResourceConfigCommon.rach_ConfigCommon.ra_SupervisionInfo.preambleTransMax) ); + LOG_I( RRC, "radioResourceConfigCommon.rach_ConfigCommon.ra_SupervisionInfo.ra_ResponseWindowSize : raw:%ld decoded:%s\n", + sib2->radioResourceConfigCommon.rach_ConfigCommon.ra_SupervisionInfo.ra_ResponseWindowSize, + SIB2ra_ResponseWindowSize(sib2->radioResourceConfigCommon.rach_ConfigCommon.ra_SupervisionInfo.ra_ResponseWindowSize) ); + LOG_I( RRC, "radioResourceConfigCommon.rach_ConfigCommon.ra_SupervisionInfo.mac_ContentionResolutionTimer : raw:%ld decoded:%s\n", + sib2->radioResourceConfigCommon.rach_ConfigCommon.ra_SupervisionInfo.mac_ContentionResolutionTimer, + SIB2mac_ContentionResolutionTimer(sib2->radioResourceConfigCommon.rach_ConfigCommon.ra_SupervisionInfo.mac_ContentionResolutionTimer) ); + + LOG_I( RRC, "radioResourceConfigCommon.rach_ConfigCommon.maxHARQ_Msg3Tx : %ld\n", + sib2->radioResourceConfigCommon.rach_ConfigCommon.maxHARQ_Msg3Tx ); + + // BCCH + LOG_I( RRC, "radioResourceConfigCommon.bcch_Config.modificationPeriodCoeff : raw:%ld decoded:%s\n", + sib2->radioResourceConfigCommon.bcch_Config.modificationPeriodCoeff, + SIB2modificationPeriodCoeff(sib2->radioResourceConfigCommon.bcch_Config.modificationPeriodCoeff) ); + + // PCCH + LOG_I( RRC, "radioResourceConfigCommon.pcch_Config.defaultPagingCycle : raw:%ld decoded:%s\n", + sib2->radioResourceConfigCommon.pcch_Config.defaultPagingCycle, + SIB2defaultPagingCycle(sib2->radioResourceConfigCommon.pcch_Config.defaultPagingCycle) ); + LOG_I( RRC, "radioResourceConfigCommon.pcch_Config.nB : raw:%ld decoded:%s\n", + sib2->radioResourceConfigCommon.pcch_Config.nB, + SIB2nB(sib2->radioResourceConfigCommon.pcch_Config.nB) ); + + // PRACH + LOG_I( RRC, "radioResourceConfigCommon.prach_Config.rootSequenceIndex : %ld\n", + sib2->radioResourceConfigCommon.prach_Config.rootSequenceIndex ); + LOG_I( RRC, "radioResourceConfigCommon.prach_Config.prach_ConfigInfo.prach_ConfigIndex : %ld\n", + sib2->radioResourceConfigCommon.prach_Config.prach_ConfigInfo.prach_ConfigIndex ); + LOG_I( RRC, "radioResourceConfigCommon.prach_Config.prach_ConfigInfo.highSpeedFlag : %d\n", + sib2->radioResourceConfigCommon.prach_Config.prach_ConfigInfo.highSpeedFlag ); + LOG_I( RRC, "radioResourceConfigCommon.prach_Config.prach_ConfigInfo.zeroCorrelationZoneConfig : %ld\n", + sib2->radioResourceConfigCommon.prach_Config.prach_ConfigInfo.zeroCorrelationZoneConfig ); + LOG_I( RRC, "radioResourceConfigCommon.prach_Config.prach_ConfigInfo.prach_FreqOffset : %ld\n", + sib2->radioResourceConfigCommon.prach_Config.prach_ConfigInfo.prach_FreqOffset ); - LOG_I(RRC,"[UE]radioResourceConfigCommon.rach_ConfigCommon.powerRampingParameters.powerRampingStep : %ld\n", - sib2->radioResourceConfigCommon.rach_ConfigCommon.powerRampingParameters.powerRampingStep); + // PDSCH-Config + LOG_I( RRC, "radioResourceConfigCommon.pdsch_ConfigCommon.referenceSignalPower : %ld\n", + sib2->radioResourceConfigCommon.pdsch_ConfigCommon.referenceSignalPower ); + LOG_I( RRC, "radioResourceConfigCommon.pdsch_ConfigCommon.p_b : %ld\n", + sib2->radioResourceConfigCommon.pdsch_ConfigCommon.p_b ); - LOG_I(RRC,"[UE]radioResourceConfigCommon.rach_ConfigCommon.powerRampingParameters.preambleInitialReceivedTargetPower : %ld\n", - sib2->radioResourceConfigCommon.rach_ConfigCommon.powerRampingParameters.preambleInitialReceivedTargetPower); + // PUSCH-Config + LOG_I( RRC, "radioResourceConfigCommon.pusch_ConfigCommon.pusch_ConfigBasic.n_SB : %ld\n", + sib2->radioResourceConfigCommon.pusch_ConfigCommon.pusch_ConfigBasic.n_SB ); + LOG_I( RRC, "radioResourceConfigCommon.pusch_ConfigCommon.pusch_ConfigBasic.hoppingMode : %ld\n", + sib2->radioResourceConfigCommon.pusch_ConfigCommon.pusch_ConfigBasic.hoppingMode ); + LOG_I( RRC, "radioResourceConfigCommon.pusch_ConfigCommon.pusch_ConfigBasic.pusch_HoppingOffset : %ld\n", + sib2->radioResourceConfigCommon.pusch_ConfigCommon.pusch_ConfigBasic.pusch_HoppingOffset ); + LOG_I( RRC, "radioResourceConfigCommon.pusch_ConfigCommon.pusch_ConfigBasic.enable64QAM : %d\n", + sib2->radioResourceConfigCommon.pusch_ConfigCommon.pusch_ConfigBasic.enable64QAM ); + LOG_I( RRC, "radioResourceConfigCommon.pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.groupHoppingEnabled : %d\n", + sib2->radioResourceConfigCommon.pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.groupHoppingEnabled ); + LOG_I( RRC, "radioResourceConfigCommon.pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH : %ld\n", + sib2->radioResourceConfigCommon.pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH ); + LOG_I( RRC, "radioResourceConfigCommon.pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled : %d\n", + sib2->radioResourceConfigCommon.pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled ); + LOG_I( RRC, "radioResourceConfigCommon.pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.cyclicShift : %ld\n", + sib2->radioResourceConfigCommon.pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.cyclicShift ); - LOG_I(RRC,"radioResourceConfigCommon.rach_ConfigCommon.ra_SupervisionInfo.preambleTransMax : %ld\n", - sib2->radioResourceConfigCommon.rach_ConfigCommon.ra_SupervisionInfo.preambleTransMax); - LOG_I(RRC,"radioResourceConfigCommon.rach_ConfigCommon.ra_SupervisionInfo.ra_ResponseWindowSize : %ld\n", - sib2->radioResourceConfigCommon.rach_ConfigCommon.ra_SupervisionInfo.ra_ResponseWindowSize); + // PUCCH-Config + LOG_I( RRC, "radioResourceConfigCommon.pucch_ConfigCommon.deltaPUCCH_Shift : %ld\n", + sib2->radioResourceConfigCommon.pucch_ConfigCommon.deltaPUCCH_Shift ); + LOG_I( RRC, "radioResourceConfigCommon.pucch_ConfigCommon.nRB_CQI : %ld\n", + sib2->radioResourceConfigCommon.pucch_ConfigCommon.nRB_CQI ); + LOG_I( RRC, "radioResourceConfigCommon.pucch_ConfigCommon.nCS_AN : %ld\n", + sib2->radioResourceConfigCommon.pucch_ConfigCommon.nCS_AN ); + LOG_I( RRC, "radioResourceConfigCommon.pucch_ConfigCommon.n1PUCCH_AN : %ld\n", + sib2->radioResourceConfigCommon.pucch_ConfigCommon.n1PUCCH_AN ); + + // SoundingRS_UL_Config + LOG_I( RRC, "radioResourceConfigCommon.soundingRS_UL_ConfigCommon.present : raw:%d decoded:%s\n", + sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.present, + SIB2SoundingPresent(sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.present) ); + + if (sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.present == SoundingRS_UL_ConfigCommon_PR_setup) { + LOG_I( RRC, "radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_BandwidthConfig : %ld\n", + sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_BandwidthConfig ); + LOG_I( RRC, "radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_SubframeConfig : %ld\n", + sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_SubframeConfig ); + LOG_I( RRC, "radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.ackNackSRS_SimultaneousTransmission : %d\n", + sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.ackNackSRS_SimultaneousTransmission ); + LOG_I( RRC, "radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_MaxUpPts : %ld\n", + sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_MaxUpPts ); + } - LOG_I(RRC,"radioResourceConfigCommon.rach_ConfigCommon.ra_SupervisionInfo.mac_ContentionResolutionTimer : %ld\n", - sib2->radioResourceConfigCommon.rach_ConfigCommon.ra_SupervisionInfo.mac_ContentionResolutionTimer); + // uplinkPowerControlCommon + LOG_I( RRC, "radioResourceConfigCommon.uplinkPowerControlCommon.p0_NominalPUSCH : %ld\n", + sib2->radioResourceConfigCommon.uplinkPowerControlCommon.p0_NominalPUSCH ); + LOG_I( RRC, "radioResourceConfigCommon.uplinkPowerControlCommon.alpha : %ld\n", + sib2->radioResourceConfigCommon.uplinkPowerControlCommon.alpha ); + LOG_I( RRC, "radioResourceConfigCommon.uplinkPowerControlCommon.p0_NominalPUCCH : %ld\n", + sib2->radioResourceConfigCommon.uplinkPowerControlCommon.p0_NominalPUCCH ); + LOG_I( RRC, "radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format1 : %ld\n", + sib2->radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format1 ); + LOG_I( RRC, "radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format1b : %ld\n", + sib2->radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format1b ); + LOG_I( RRC, "radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format2 : %ld\n", + sib2->radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format2 ); + LOG_I( RRC, "radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format2a : %ld\n", + sib2->radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format2a ); + LOG_I( RRC, "radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format2b : %ld\n", + sib2->radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format2b ); + LOG_I( RRC, "radioResourceConfigCommon.uplinkPowerControlCommon.deltaPreambleMsg3 : %ld\n", + sib2->radioResourceConfigCommon.uplinkPowerControlCommon.deltaPreambleMsg3 ); + + LOG_I( RRC, "radioResourceConfigCommon.ul_CyclicPrefixLength : %ld\n", + sib2->radioResourceConfigCommon.ul_CyclicPrefixLength ); - LOG_I(RRC,"radioResourceConfigCommon.rach_ConfigCommon.maxHARQ_Msg3Tx : %ld\n", - sib2->radioResourceConfigCommon.rach_ConfigCommon.maxHARQ_Msg3Tx); +#ifdef Rel10 + // UplinkPowerControlCommon_v1020 + // ... +#endif - LOG_I(RRC,"radioResourceConfigCommon.prach_Config.rootSequenceIndex : %ld\n",sib2->radioResourceConfigCommon.prach_Config.rootSequenceIndex); - LOG_I(RRC,"radioResourceConfigCommon.prach_Config.prach_ConfigInfo.prach_ConfigIndex : %ld\n", - sib2->radioResourceConfigCommon.prach_Config.prach_ConfigInfo.prach_ConfigIndex); - LOG_I(RRC,"radioResourceConfigCommon.prach_Config.prach_ConfigInfo.highSpeedFlag : %d\n", - (int)sib2->radioResourceConfigCommon.prach_Config.prach_ConfigInfo.highSpeedFlag); - LOG_I(RRC,"radioResourceConfigCommon.prach_Config.prach_ConfigInfo.zeroCorrelationZoneConfig : %ld\n", - sib2->radioResourceConfigCommon.prach_Config.prach_ConfigInfo.zeroCorrelationZoneConfig); - LOG_I(RRC,"radioResourceConfigCommon.prach_Config.prach_ConfigInfo.prach_FreqOffset %ld\n", - sib2->radioResourceConfigCommon.prach_Config.prach_ConfigInfo.prach_FreqOffset); + LOG_I( RRC, "ue_TimersAndConstants.t300 : %ld\n", sib2->ue_TimersAndConstants.t300 ); + LOG_I( RRC, "ue_TimersAndConstants.t301 : %ld\n", sib2->ue_TimersAndConstants.t301 ); + LOG_I( RRC, "ue_TimersAndConstants.t310 : %ld\n", sib2->ue_TimersAndConstants.t310 ); + LOG_I( RRC, "ue_TimersAndConstants.n310 : %ld\n", sib2->ue_TimersAndConstants.n310 ); + LOG_I( RRC, "ue_TimersAndConstants.t311 : %ld\n", sib2->ue_TimersAndConstants.t311 ); + LOG_I( RRC, "ue_TimersAndConstants.n311 : %ld\n", sib2->ue_TimersAndConstants.n311 ); - // PDSCH-Config - LOG_I(RRC,"radioResourceConfigCommon.pdsch_ConfigCommon.referenceSignalPower : %ld\n",sib2->radioResourceConfigCommon.pdsch_ConfigCommon.referenceSignalPower); - LOG_I(RRC,"radioResourceConfigCommon.pdsch_ConfigCommon.p_b : %ld\n",sib2->radioResourceConfigCommon.pdsch_ConfigCommon.p_b); + if (sib2->freqInfo.ul_CarrierFreq) + LOG_I( RRC, "freqInfo.ul_CarrierFreq : %ld\n", *sib2->freqInfo.ul_CarrierFreq ); + else + LOG_I( RRC, "freqInfo.ul_CarrierFreq : not defined\n" ); - // PUSCH-Config - LOG_I(RRC,"radioResourceConfigCommon.pusch_ConfigCommon.pusch_ConfigBasic.n_SB : %ld\n", - sib2->radioResourceConfigCommon.pusch_ConfigCommon.pusch_ConfigBasic.n_SB); - LOG_I(RRC,"radioResourceConfigCommon.pusch_ConfigCommon.pusch_ConfigBasic.hoppingMode : %ld\n", - sib2->radioResourceConfigCommon.pusch_ConfigCommon.pusch_ConfigBasic.hoppingMode); - LOG_I(RRC,"radioResourceConfigCommon.pusch_ConfigCommon.pusch_ConfigBasic.pusch_HoppingOffset : %ld\n", - sib2->radioResourceConfigCommon.pusch_ConfigCommon.pusch_ConfigBasic.pusch_HoppingOffset); - LOG_I(RRC,"radioResourceConfigCommon.pusch_ConfigCommon.pusch_ConfigBasic.enable64QAM : %d\n", - (int)sib2->radioResourceConfigCommon.pusch_ConfigCommon.pusch_ConfigBasic.enable64QAM); - LOG_I(RRC,"radioResourceConfigCommon.pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.groupHoppingEnabled : %d\n", - (int)sib2->radioResourceConfigCommon.pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.groupHoppingEnabled); - LOG_I(RRC,"radioResourceConfigCommon.pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH : %ld\n", - sib2->radioResourceConfigCommon.pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH); - LOG_I(RRC,"radioResourceConfigCommon.pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled : %d\n", - (int)sib2->radioResourceConfigCommon.pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled); - LOG_I(RRC,"radioResourceConfigCommon.pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.cyclicShift : %ld\n", - sib2->radioResourceConfigCommon.pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.cyclicShift); + if (sib2->freqInfo.ul_Bandwidth) + LOG_I( RRC, "freqInfo.ul_Bandwidth : %ld\n", *sib2->freqInfo.ul_Bandwidth ); + else + LOG_I( RRC, "freqInfo.ul_Bandwidth : not defined\n" ); - // PUCCH-Config + LOG_I( RRC, "freqInfo.additionalSpectrumEmission : %ld\n", sib2->freqInfo.additionalSpectrumEmission ); - LOG_I(RRC,"radioResourceConfigCommon.pucch_ConfigCommon.deltaPUCCH_Shift : %ld\n",sib2->radioResourceConfigCommon.pucch_ConfigCommon.deltaPUCCH_Shift); - LOG_I(RRC,"radioResourceConfigCommon.pucch_ConfigCommon.nRB_CQI : %ld\n",sib2->radioResourceConfigCommon.pucch_ConfigCommon.nRB_CQI); - LOG_I(RRC,"radioResourceConfigCommon.pucch_ConfigCommon.nCS_AN : %ld\n",sib2->radioResourceConfigCommon.pucch_ConfigCommon.nCS_AN); - LOG_I(RRC,"radioResourceConfigCommon.pucch_ConfigCommon.n1PUCCH_AN : %ld\n",sib2->radioResourceConfigCommon.pucch_ConfigCommon.n1PUCCH_AN); + if (sib2->mbsfn_SubframeConfigList) { + LOG_I( RRC, "mbsfn_SubframeConfigList : %p\n", sib2->mbsfn_SubframeConfigList ); + // FIXME + } else + LOG_I( RRC, "mbsfn_SubframeConfigList : not defined\n" ); - LOG_I(RRC,"radioResourceConfigCommon.soundingRS_UL_ConfigCommon.present : %d\n",sib2-> radioResourceConfigCommon.soundingRS_UL_ConfigCommon.present); + LOG_I( RRC, "timeAlignmentTimerCommon : %ld\n", sib2->timeAlignmentTimerCommon ); +#ifdef Rel10 - // uplinkPowerControlCommon + if (sib2->lateNonCriticalExtension) { + LOG_I( RRC, "lateNonCriticalExtension : %p\n", sib2->lateNonCriticalExtension ); + } else + LOG_I( RRC, "lateNonCriticalExtension : not defined\n" ); + + if (sib2->ssac_BarringForMMTEL_Voice_r9) { + LOG_I( RRC, "ssac_BarringForMMTEL_Voice_r9->ac_BarringFactor : %ld\n", + sib2->ssac_BarringForMMTEL_Voice_r9->ac_BarringFactor ); + LOG_I( RRC, "ssac_BarringForMMTEL_Voice_r9->ac_BarringTime : %ld\n", + sib2->ssac_BarringForMMTEL_Voice_r9->ac_BarringTime ); + LOG_I( RRC, "ssac_BarringForMMTEL_Voice_r9->ac_BarringForSpecialAC : %"PRIu32"\n", + BIT_STRING_to_uint32(&sib2->ssac_BarringForMMTEL_Voice_r9->ac_BarringForSpecialAC) ); + } else + LOG_I( RRC, "ssac_BarringForMMTEL_Voice_r9 : not defined\n" ); + + if (sib2->ssac_BarringForMMTEL_Video_r9) { + LOG_I( RRC, "ssac_BarringForMMTEL_Video_r9->ac_BarringFactor : %ld\n", + sib2->ssac_BarringForMMTEL_Video_r9->ac_BarringFactor ); + LOG_I( RRC, "ssac_BarringForMMTEL_Video_r9->ac_BarringTime : %ld\n", + sib2->ssac_BarringForMMTEL_Video_r9->ac_BarringTime ); + LOG_I( RRC, "ssac_BarringForMMTEL_Video_r9->ac_BarringForSpecialAC : %"PRIu32"\n", + BIT_STRING_to_uint32(&sib2->ssac_BarringForMMTEL_Video_r9->ac_BarringForSpecialAC) ); + } else + LOG_I( RRC, "ssac_BarringForMMTEL_Video_r9 : not defined\n" ); + + if (sib2->ac_BarringForCSFB_r10) { + LOG_I( RRC, "ac_BarringForCSFB_r10->ac_BarringFactor : %ld\n", + sib2->ac_BarringForCSFB_r10->ac_BarringFactor ); + LOG_I( RRC, "ac_BarringForCSFB_r10->ac_BarringTime : %ld\n", + sib2->ac_BarringForCSFB_r10->ac_BarringTime ); + LOG_I( RRC, "ac_BarringForCSFB_r10->ac_BarringForSpecialAC : %"PRIu32"\n", + BIT_STRING_to_uint32(&sib2->ac_BarringForCSFB_r10->ac_BarringForSpecialAC) ); + } else + LOG_I( RRC, "ac_BarringForCSFB_r10 : not defined\n" ); - LOG_I(RRC,"radioResourceConfigCommon.uplinkPowerControlCommon.p0_NominalPUSCH : %ld\n", - sib2->radioResourceConfigCommon.uplinkPowerControlCommon.p0_NominalPUSCH); - LOG_I(RRC,"radioResourceConfigCommon.uplinkPowerControlCommon.alpha : %ld\n",sib2->radioResourceConfigCommon.uplinkPowerControlCommon.alpha); - - LOG_I(RRC,"radioResourceConfigCommon.uplinkPowerControlCommon.p0_NominalPUCCH : %ld\n", - sib2->radioResourceConfigCommon.uplinkPowerControlCommon.p0_NominalPUCCH); - LOG_I(RRC,"radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format1 : %ld\n", - sib2->radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format1); - LOG_I(RRC,"radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format1b :%ld\n", - sib2->radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format1b); - LOG_I(RRC,"radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format2 :%ld\n", - sib2->radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format2); - LOG_I(RRC,"radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format2a :%ld\n", - sib2->radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format2a); - LOG_I(RRC,"radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format2b :%ld\n", - sib2->radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format2b); - - LOG_I(RRC,"radioResourceConfigCommon.uplinkPowerControlCommon.deltaPreambleMsg3 : %ld\n", - sib2->radioResourceConfigCommon.uplinkPowerControlCommon.deltaPreambleMsg3); - - LOG_I(RRC,"radioResourceConfigCommon.ul_CyclicPrefixLength : %ld\n", sib2->radioResourceConfigCommon.ul_CyclicPrefixLength); - - LOG_I(RRC,"ue_TimersAndConstants.t300 : %ld\n", sib2->ue_TimersAndConstants.t300); - LOG_I(RRC,"ue_TimersAndConstants.t301 : %ld\n", sib2->ue_TimersAndConstants.t301); - LOG_I(RRC,"ue_TimersAndConstants.t310 : %ld\n", sib2->ue_TimersAndConstants.t310); - LOG_I(RRC,"ue_TimersAndConstants.n310 : %ld\n", sib2->ue_TimersAndConstants.n310); - LOG_I(RRC,"ue_TimersAndConstants.t311 : %ld\n", sib2->ue_TimersAndConstants.t311); - LOG_I(RRC,"ue_TimersAndConstants.n311 : %ld\n", sib2->ue_TimersAndConstants.n311); - - LOG_I(RRC,"freqInfo.additionalSpectrumEmission : %ld\n",sib2->freqInfo.additionalSpectrumEmission); - LOG_I(RRC,"freqInfo.ul_CarrierFreq : %p\n", sib2->freqInfo.ul_CarrierFreq); - LOG_I(RRC,"freqInfo.ul_Bandwidth : %p\n", sib2->freqInfo.ul_Bandwidth); - LOG_I(RRC,"mbsfn_SubframeConfigList : %p\n", sib2->mbsfn_SubframeConfigList); - LOG_I(RRC,"timeAlignmentTimerCommon : %ld\n", sib2->timeAlignmentTimerCommon); +#endif } //----------------------------------------------------------------------------- -void -dump_sib3( - SystemInformationBlockType3_t *sib3 -) -//----------------------------------------------------------------------------- +static void dump_sib3( SystemInformationBlockType3_t *sib3 ) { + LOG_I( RRC, "Dumping SIB3 (see TS36.331 V8.21.0)\n" ); + + int q_Hyst_dB = sib3->cellReselectionInfoCommon.q_Hyst; // sib3->cellReselectionInfoCommon.q_Hyst is a enumerated value + + if (q_Hyst_dB > 6) + q_Hyst_dB = (q_Hyst_dB-6) * 2 + 6; + + LOG_I( RRC, "cellReselectionInfoCommon.q_Hyst : raw:%ld decoded:%d dB\n", sib3->cellReselectionInfoCommon.q_Hyst, q_Hyst_dB ); + + if (sib3->cellReselectionInfoCommon.speedStateReselectionPars) { + LOG_I( RRC, "cellReselectionInfoCommon.speedStateReselectionPars->mobilityStateParameters.t_Evaluation : %ld\n", + sib3->cellReselectionInfoCommon.speedStateReselectionPars->mobilityStateParameters.t_Evaluation ); + LOG_I( RRC, "cellReselectionInfoCommon.speedStateReselectionPars->mobilityStateParameters.t_HystNormal : %ld\n", + sib3->cellReselectionInfoCommon.speedStateReselectionPars->mobilityStateParameters.t_HystNormal ); + LOG_I( RRC, "cellReselectionInfoCommon.speedStateReselectionPars->mobilityStateParameters.n_CellChangeMedium : %ld\n", + sib3->cellReselectionInfoCommon.speedStateReselectionPars->mobilityStateParameters.n_CellChangeMedium ); + LOG_I( RRC, "cellReselectionInfoCommon.speedStateReselectionPars->mobilityStateParameters.n_CellChangeHigh : %ld\n", + sib3->cellReselectionInfoCommon.speedStateReselectionPars->mobilityStateParameters.n_CellChangeHigh ); + int q_HystSF_Medium = 6 - 2 * sib3->cellReselectionInfoCommon.speedStateReselectionPars->q_HystSF.sf_Medium; + int q_HystSF_High = 6 - 2 * sib3->cellReselectionInfoCommon.speedStateReselectionPars->q_HystSF.sf_High; + LOG_I( RRC, "cellReselectionInfoCommon.speedStateReselectionPars->q_HystSF.sf_Medium : raw:%ld decoded:%d dB\n", sib3->cellReselectionInfoCommon.speedStateReselectionPars->q_HystSF.sf_Medium, + q_HystSF_Medium ); + LOG_I( RRC, "cellReselectionInfoCommon.speedStateReselectionPars->q_HystSF.sf_High : raw:%ld decoded:%d dB\n", sib3->cellReselectionInfoCommon.speedStateReselectionPars->q_HystSF.sf_High, + q_HystSF_High ); + } else { + LOG_I( RRC, "cellReselectionInfoCommon.speedStateReselectionPars : not defined\n" ); + } + if (sib3->cellReselectionServingFreqInfo.s_NonIntraSearch) { + LOG_I( RRC, "cellReselectionServingFreqInfo.s_NonIntraSearch : %ld\n", *(sib3->cellReselectionServingFreqInfo.s_NonIntraSearch) ); + } else { + LOG_I( RRC, "cellReselectionServingFreqInfo.s_NonIntraSearch : not defined\n" ); + } + + LOG_I( RRC, "cellReselectionServingFreqInfo.threshServingLow : %ld\n", sib3->cellReselectionServingFreqInfo.threshServingLow ); + LOG_I( RRC, "cellReselectionServingFreqInfo.cellReselectionPriority : %ld\n", sib3->cellReselectionServingFreqInfo.cellReselectionPriority ); + + LOG_I( RRC, "intraFreqCellReselectionInfo.q_RxLevMin : %ld\n", sib3->intraFreqCellReselectionInfo.q_RxLevMin ); + + if (sib3->intraFreqCellReselectionInfo.p_Max) { + LOG_I( RRC, "intraFreqCellReselectionInfo.p_Max : %ld\n", *(sib3->intraFreqCellReselectionInfo.p_Max) ); + } else { + LOG_I( RRC, "intraFreqCellReselectionInfo.p_Max : not defined\n" ); + } + + if (sib3->intraFreqCellReselectionInfo.s_IntraSearch) { + LOG_I( RRC, "intraFreqCellReselectionInfo.s_IntraSearch : %ld\n", *(sib3->intraFreqCellReselectionInfo.s_IntraSearch) ); + } else { + LOG_I( RRC, "intraFreqCellReselectionInfo.s_IntraSearch : not defined\n" ); + } + + if (sib3->intraFreqCellReselectionInfo.allowedMeasBandwidth) { + LOG_I( RRC, "intraFreqCellReselectionInfo.allowedMeasBandwidth : %ld\n", *(sib3->intraFreqCellReselectionInfo.allowedMeasBandwidth) ); + } else { + LOG_I( RRC, "intraFreqCellReselectionInfo.allowedMeasBandwidth : not defined\n" ); + } + + LOG_I( RRC, "intraFreqCellReselectionInfo.presenceAntennaPort1 : %d\n", sib3->intraFreqCellReselectionInfo.presenceAntennaPort1 ); + LOG_I( RRC, "intraFreqCellReselectionInfo.neighCellConfig : %"PRIu8"\n", BIT_STRING_to_uint8( &(sib3->intraFreqCellReselectionInfo.neighCellConfig) ) ); + LOG_I( RRC, "intraFreqCellReselectionInfo.t_ReselectionEUTRA : %ld\n", sib3->intraFreqCellReselectionInfo.t_ReselectionEUTRA ); + + if (sib3->intraFreqCellReselectionInfo.t_ReselectionEUTRA_SF) { + LOG_I( RRC, "intraFreqCellReselectionInfo.t_ReselectionEUTRA_SF->sf_Medium : %ld\n", sib3->intraFreqCellReselectionInfo.t_ReselectionEUTRA_SF->sf_Medium ); + LOG_I( RRC, "intraFreqCellReselectionInfo.t_ReselectionEUTRA_SF->sf_High : %ld\n", sib3->intraFreqCellReselectionInfo.t_ReselectionEUTRA_SF->sf_High ); + } else { + LOG_I( RRC, "intraFreqCellReselectionInfo.t_ReselectionEUTRA_SF : not defined\n" ); + } } #ifdef Rel10 //----------------------------------------------------------------------------- -void -dump_sib13( - SystemInformationBlockType13_r9_t *sib13 -) -//----------------------------------------------------------------------------- +static void dump_sib13( SystemInformationBlockType13_r9_t *sib13 ) { - - LOG_D(RRC,"[RRC][UE] Dumping SIB13\n"); - LOG_D(RRC,"[RRC][UE] dumping sib13 second time\n"); - LOG_D(RRC,"[RRC][UE] NotificationRepetitionCoeff-r9 : %ld\n", sib13->notificationConfig_r9.notificationRepetitionCoeff_r9); - LOG_D(RRC,"[RRC][UE] NotificationOffset-r9 : %d\n", (int)sib13->notificationConfig_r9.notificationOffset_r9); - LOG_D(RRC,"[RRC][UE] NotificationSF-Index-r9 : %d\n", (int)sib13->notificationConfig_r9.notificationSF_Index_r9); - + LOG_I( RRC, "[UE] Dumping SIB13\n" ); + LOG_I( RRC, "[UE] dumping sib13 second time\n" ); + LOG_I( RRC, "[UE] NotificationRepetitionCoeff-r9 : %ld\n", sib13->notificationConfig_r9.notificationRepetitionCoeff_r9 ); + LOG_I( RRC, "[UE] NotificationOffset-r9 : %d\n", (int)sib13->notificationConfig_r9.notificationOffset_r9 ); + LOG_I( RRC, "[UE] NotificationSF-Index-r9 : %d\n", (int)sib13->notificationConfig_r9.notificationSF_Index_r9 ); } #endif -//const char SIBPeriod[7][7]= {"80ms\0","160ms\0","320ms\0","640ms\0","1280ms\0","2560ms\0","5120ms\0"}; - -//----------------------------------------------------------------------------- -int -decode_SI( - const protocol_ctxt_t* const ctxt_pP, - const uint8_t eNB_index, - const uint8_t si_window -) //----------------------------------------------------------------------------- +static int decode_SI( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index ) { - SystemInformation_t** si=&UE_rrc_inst[ctxt_pP->module_id].si[eNB_index][si_window]; - int i; - struct SystemInformation_r8_IEs__sib_TypeAndInfo__Member *typeandinfo; + SystemInformation_t** si = &UE_rrc_inst[ctxt_pP->module_id].si[eNB_index]; - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_UE_DECODE_SI , VCD_FUNCTION_IN); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_UE_DECODE_SI, VCD_FUNCTION_IN ); // Dump contents - if ((*si)->criticalExtensions.present==SystemInformation__criticalExtensions_PR_systemInformation_r8) { - LOG_D(RRC,"(*si)->criticalExtensions.choice.systemInformation_r8.sib_TypeAndInfo.list.count %d\n", - (*si)->criticalExtensions.choice.systemInformation_r8.sib_TypeAndInfo.list.count); + if ((*si)->criticalExtensions.present == SystemInformation__criticalExtensions_PR_systemInformation_r8) { + LOG_D( RRC, "[UE] (*si)->criticalExtensions.choice.systemInformation_r8.sib_TypeAndInfo.list.count %d\n", + (*si)->criticalExtensions.choice.systemInformation_r8.sib_TypeAndInfo.list.count ); } else { - LOG_D(RRC,"[UE] Unknown criticalExtension version (not Rel8)\n"); + LOG_D( RRC, "[UE] Unknown criticalExtension version (not Rel8)\n" ); return -1; } - for (i=0; i<(*si)->criticalExtensions.choice.systemInformation_r8.sib_TypeAndInfo.list.count; i++) { - LOG_D(RRC,"SI count %d\n",i); - typeandinfo=(*si)->criticalExtensions.choice.systemInformation_r8.sib_TypeAndInfo.list.array[i]; + for (int i=0; i<(*si)->criticalExtensions.choice.systemInformation_r8.sib_TypeAndInfo.list.count; i++) { + LOG_D( RRC, "SI count %d\n", i ); + struct SystemInformation_r8_IEs__sib_TypeAndInfo__Member *typeandinfo; + typeandinfo = (*si)->criticalExtensions.choice.systemInformation_r8.sib_TypeAndInfo.list.array[i]; switch(typeandinfo->present) { case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib2: - UE_rrc_inst[ctxt_pP->module_id].sib2[eNB_index] = &typeandinfo->choice.sib2; - LOG_D(RRC,"[UE %d] Frame %d Found SIB2 from eNB %d\n",ctxt_pP->module_id,ctxt_pP->frame,eNB_index); - dump_sib2(UE_rrc_inst[ctxt_pP->module_id].sib2[eNB_index]); - LOG_D(RRC, "[FRAME %05d][RRC_UE][MOD %02d][][--- MAC_CONFIG_REQ (SIB2 params eNB %d) --->][MAC_UE][MOD %02d][]\n", - ctxt_pP->frame, ctxt_pP->module_id, eNB_index, ctxt_pP->module_id); - rrc_mac_config_req(ctxt_pP->module_id,ENB_FLAG_NO,0,eNB_index, - &UE_rrc_inst[ctxt_pP->module_id].sib2[eNB_index]->radioResourceConfigCommon, - (struct PhysicalConfigDedicated *)NULL, + memcpy( UE_rrc_inst[ctxt_pP->module_id].sib2[eNB_index], &typeandinfo->choice.sib2, sizeof(SystemInformationBlockType2_t) ); + LOG_D( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB2 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index ); + dump_sib2( UE_rrc_inst[ctxt_pP->module_id].sib2[eNB_index] ); + LOG_D( RRC, "[FRAME %05"PRIu32"][RRC_UE][MOD %02"PRIu8"][][--- MAC_CONFIG_REQ (SIB2 params eNB %"PRIu8") --->][MAC_UE][MOD %02"PRIu8"][]\n", + ctxt_pP->frame, ctxt_pP->module_id, eNB_index, ctxt_pP->module_id ); + rrc_mac_config_req( ctxt_pP->module_id, ENB_FLAG_NO, 0, eNB_index, + &UE_rrc_inst[ctxt_pP->module_id].sib2[eNB_index]->radioResourceConfigCommon, + (struct PhysicalConfigDedicated *)NULL, #ifdef Rel10 - (SCellToAddMod_r10_t *)NULL, - //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, + (SCellToAddMod_r10_t *)NULL, #endif - (MeasObjectToAddMod_t **)NULL, - (MAC_MainConfig_t *)NULL, - 0, - (struct LogicalChannelConfig *)NULL, - (MeasGapConfig_t *)NULL, - (TDD_Config_t *)NULL, - (MobilityControlInfo_t *)NULL, - NULL, - NULL, - UE_rrc_inst[ctxt_pP->module_id].sib2[eNB_index]->freqInfo.ul_CarrierFreq, - UE_rrc_inst[ctxt_pP->module_id].sib2[eNB_index]->freqInfo.ul_Bandwidth, - &UE_rrc_inst[ctxt_pP->module_id].sib2[eNB_index]->freqInfo.additionalSpectrumEmission, - UE_rrc_inst[ctxt_pP->module_id].sib2[eNB_index]->mbsfn_SubframeConfigList + (MeasObjectToAddMod_t **)NULL, + (MAC_MainConfig_t *)NULL, + 0, + (struct LogicalChannelConfig *)NULL, + (MeasGapConfig_t *)NULL, + (TDD_Config_t *)NULL, + (MobilityControlInfo_t *)NULL, + NULL, + NULL, + UE_rrc_inst[ctxt_pP->module_id].sib2[eNB_index]->freqInfo.ul_CarrierFreq, + UE_rrc_inst[ctxt_pP->module_id].sib2[eNB_index]->freqInfo.ul_Bandwidth, + &UE_rrc_inst[ctxt_pP->module_id].sib2[eNB_index]->freqInfo.additionalSpectrumEmission, + UE_rrc_inst[ctxt_pP->module_id].sib2[eNB_index]->mbsfn_SubframeConfigList #ifdef Rel10 - ,0, - (MBSFN_AreaInfoList_r9_t *)NULL, - (PMCH_InfoList_r9_t *)NULL + ,0, + (MBSFN_AreaInfoList_r9_t *)NULL, + (PMCH_InfoList_r9_t *)NULL #endif #ifdef CBA - ,0, - 0 + ,0, + 0 #endif ); UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus = 1; @@ -2714,13 +3057,13 @@ decode_SI( if (UE_rrc_inst[ctxt_pP->module_id].MBMS_flag < 3) // see -Q option #endif #if !(defined(ENABLE_ITTI) && defined(ENABLE_USE_MME)) - rrc_ue_generate_RRCConnectionRequest(ctxt_pP,eNB_index); + rrc_ue_generate_RRCConnectionRequest( ctxt_pP, eNB_index ); - LOG_I(RRC, "not sending connection request\n"); + LOG_I( RRC, "not sending connection request\n" ); #endif if (UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].State == RRC_IDLE) { - LOG_I(RRC,"[UE %d] Received SIB1/SIB2/SIB3 Switching to RRC_SI_RECEIVED\n",ctxt_pP->module_id); + LOG_I( RRC, "[UE %d] Received SIB1/SIB2/SIB3 Switching to RRC_SI_RECEIVED\n", ctxt_pP->module_id ); UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].State = RRC_SI_RECEIVED; #ifdef ENABLE_RAL { @@ -2750,76 +3093,74 @@ decode_SI( #endif } - break; + break; // case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib2 case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib3: - UE_rrc_inst[ctxt_pP->module_id].sib3[eNB_index] = &typeandinfo->choice.sib3; - LOG_I(RRC,"[UE %d] Frame %d Found SIB3 from eNB %d\n",ctxt_pP->module_id,ctxt_pP->frame,eNB_index); - dump_sib3(UE_rrc_inst[ctxt_pP->module_id].sib3[eNB_index]); + memcpy( UE_rrc_inst[ctxt_pP->module_id].sib3[eNB_index], &typeandinfo->choice.sib3, sizeof(SystemInformationBlockType3_t) ); + LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB3 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index ); + dump_sib3( UE_rrc_inst[ctxt_pP->module_id].sib3[eNB_index] ); UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus = 1; - rrc_set_sub_state (ctxt_pP->module_id, RRC_SUB_STATE_IDLE_SIB_COMPLETE); + rrc_set_sub_state( ctxt_pP->module_id, RRC_SUB_STATE_IDLE_SIB_COMPLETE ); break; case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib4: - UE_rrc_inst[ctxt_pP->module_id].sib4[eNB_index] = &typeandinfo->choice.sib4; - LOG_I(RRC,"[UE %d] Frame %d Found SIB4 from eNB %d\n",ctxt_pP->module_id,ctxt_pP->frame,eNB_index); + memcpy( UE_rrc_inst[ctxt_pP->module_id].sib4[eNB_index], &typeandinfo->choice.sib4, sizeof(SystemInformationBlockType4_t) ); + LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB4 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index ); break; case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib5: - UE_rrc_inst[ctxt_pP->module_id].sib5[eNB_index] = &typeandinfo->choice.sib5; - LOG_I(RRC,"[UE %d] Found SIB5 from eNB %d\n",ctxt_pP->module_id,eNB_index); + memcpy( UE_rrc_inst[ctxt_pP->module_id].sib5[eNB_index], &typeandinfo->choice.sib5, sizeof(SystemInformationBlockType5_t) ); + LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB5 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index ); break; case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib6: - UE_rrc_inst[ctxt_pP->module_id].sib6[eNB_index] = &typeandinfo->choice.sib6; - LOG_I(RRC,"[UE %d] Found SIB6 from eNB %d\n",ctxt_pP->module_id,eNB_index); + memcpy( UE_rrc_inst[ctxt_pP->module_id].sib6[eNB_index], &typeandinfo->choice.sib6, sizeof(SystemInformationBlockType6_t) ); + LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB6 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index ); break; case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib7: - UE_rrc_inst[ctxt_pP->module_id].sib7[eNB_index] = &typeandinfo->choice.sib7; - LOG_I(RRC,"[UE %d] Found SIB7 from eNB %d\n",ctxt_pP->module_id,eNB_index); + memcpy( UE_rrc_inst[ctxt_pP->module_id].sib7[eNB_index], &typeandinfo->choice.sib7, sizeof(SystemInformationBlockType7_t) ); + LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB7 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index ); break; case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib8: - UE_rrc_inst[ctxt_pP->module_id].sib8[eNB_index] = &typeandinfo->choice.sib8; - LOG_I(RRC,"[UE %d] Found SIB8 from eNB %d\n",ctxt_pP->module_id,eNB_index); + memcpy( UE_rrc_inst[ctxt_pP->module_id].sib8[eNB_index], &typeandinfo->choice.sib8, sizeof(SystemInformationBlockType8_t) ); + LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB8 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index ); break; case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib9: - UE_rrc_inst[ctxt_pP->module_id].sib9[eNB_index] = &typeandinfo->choice.sib9; - LOG_I(RRC,"[UE %d] Found SIB9 from eNB %d\n",ctxt_pP->module_id,eNB_index); + memcpy( UE_rrc_inst[ctxt_pP->module_id].sib9[eNB_index], &typeandinfo->choice.sib9, sizeof(SystemInformationBlockType9_t) ); + LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB9 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index ); break; case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib10: - UE_rrc_inst[ctxt_pP->module_id].sib10[eNB_index] = &typeandinfo->choice.sib10; - LOG_I(RRC,"[UE %d] Found SIB10 from eNB %d\n",ctxt_pP->module_id,eNB_index); + memcpy( UE_rrc_inst[ctxt_pP->module_id].sib10[eNB_index], &typeandinfo->choice.sib10, sizeof(SystemInformationBlockType10_t) ); + LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB10 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index ); break; case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib11: - UE_rrc_inst[ctxt_pP->module_id].sib11[eNB_index] = &typeandinfo->choice.sib11; - LOG_I(RRC,"[UE %d] Found SIB11 from eNB %d\n",ctxt_pP->module_id,eNB_index); + memcpy( UE_rrc_inst[ctxt_pP->module_id].sib11[eNB_index], &typeandinfo->choice.sib11, sizeof(SystemInformationBlockType11_t) ); + LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB11 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index ); break; + #ifdef Rel10 case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib12_v920: - UE_rrc_inst[ctxt_pP->module_id].sib12[eNB_index] = &typeandinfo->choice.sib12_v920; - LOG_I(RRC,"[RRC][UE %d] Found SIB12 from eNB %d\n",ctxt_pP->module_id,eNB_index); + memcpy( UE_rrc_inst[ctxt_pP->module_id].sib12[eNB_index], &typeandinfo->choice.sib12_v920, sizeof(SystemInformationBlockType12_r9_t) ); + LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB12 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index ); break; case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib13_v920: - UE_rrc_inst[ctxt_pP->module_id].sib13[eNB_index] = &typeandinfo->choice.sib13_v920; - LOG_I(RRC,"[RRC][UE %d] Found SIB13 from eNB %d\n",ctxt_pP->module_id,eNB_index); - dump_sib13(UE_rrc_inst[ctxt_pP->module_id].sib13[eNB_index]); + memcpy( UE_rrc_inst[ctxt_pP->module_id].sib13[eNB_index], &typeandinfo->choice.sib13_v920, sizeof(SystemInformationBlockType13_r9_t) ); + LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB13 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index ); + dump_sib13( UE_rrc_inst[ctxt_pP->module_id].sib13[eNB_index] ); // adding here function to store necessary parameters for using in decode_MCCH_Message + maybe transfer to PHY layer - LOG_D(RRC, "[FRAME %05d][RRC_UE][MOD %02d][][--- MAC_CONFIG_REQ (SIB13 params eNB %d) --->][MAC_UE][MOD %02d][]\n", - ctxt_pP->frame, ctxt_pP->module_id, eNB_index, ctxt_pP->module_id); + LOG_D( RRC, "[FRAME %05"PRIu32"][RRC_UE][MOD %02"PRIu8"][][--- MAC_CONFIG_REQ (SIB13 params eNB %"PRIu8") --->][MAC_UE][MOD %02"PRIu8"][]\n", + ctxt_pP->frame, ctxt_pP->module_id, eNB_index, ctxt_pP->module_id); rrc_mac_config_req(ctxt_pP->module_id,ENB_FLAG_NO,0,eNB_index, (RadioResourceConfigCommonSIB_t *)NULL, (struct PhysicalConfigDedicated *)NULL, -#ifdef Rel10 (SCellToAddMod_r10_t *)NULL, - //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, -#endif (MeasObjectToAddMod_t **)NULL, (MAC_MainConfig_t *)NULL, 0, @@ -2832,8 +3173,8 @@ decode_SI( NULL, NULL, NULL, - (MBSFN_SubframeConfigList_t *)NULL - ,0, + (MBSFN_SubframeConfigList_t *)NULL, + 0, &UE_rrc_inst[ctxt_pP->module_id].sib13[eNB_index]->mbsfn_AreaInfoList_r9, (PMCH_InfoList_r9_t *)NULL #ifdef CBA @@ -2857,12 +3198,7 @@ decode_SI( // layer 3 filtering of RSRP (EUTRA) measurements: 36.331, Sec. 5.5.3.2 //----------------------------------------------------------------------------- -void -ue_meas_filtering( - const protocol_ctxt_t* const ctxt_pP, - const uint8_t eNB_index -) -//----------------------------------------------------------------------------- +void ue_meas_filtering( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index ) { float a = UE_rrc_inst[ctxt_pP->module_id].filter_coeff_rsrp; // 'a' in 36.331 Sec. 5.5.3.2 float a1 = UE_rrc_inst[ctxt_pP->module_id].filter_coeff_rsrq; @@ -2940,12 +3276,7 @@ ue_meas_filtering( //Below routine implements Measurement Reporting procedure from 36.331 Section 5.5.5 //----------------------------------------------------------------------------- -void -rrc_ue_generate_MeasurementReport( - const protocol_ctxt_t* const ctxt_pP, - uint8_t eNB_index -) -//----------------------------------------------------------------------------- +static void rrc_ue_generate_MeasurementReport( const protocol_ctxt_t* const ctxt_pP, uint8_t eNB_index ) { uint8_t buffer[32], size; @@ -3026,12 +3357,7 @@ rrc_ue_generate_MeasurementReport( // Measurement report triggering, described in 36.331 Section 5.5.4.1: called periodically //----------------------------------------------------------------------------- -void -ue_measurement_report_triggering( - const protocol_ctxt_t* const ctxt_pP, - const uint8_t eNB_index -) -//----------------------------------------------------------------------------- +void ue_measurement_report_triggering( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index ) { uint8_t i,j; Hysteresis_t hys; @@ -3143,8 +3469,7 @@ ue_measurement_report_triggering( //check_trigger_meas_event(ue_mod_idP, frameP, eNB_index, i,j,ofn,ocn,hys,ofs,ocs,a3_offset,ttt_ms) //----------------------------------------------------------------------------- -uint8_t -check_trigger_meas_event( +static uint8_t check_trigger_meas_event( module_id_t ue_mod_idP, frame_t frameP, uint8_t eNB_index, @@ -3156,9 +3481,7 @@ check_trigger_meas_event( Q_OffsetRange_t ofs, Q_OffsetRange_t ocs, long a3_offset, - TimeToTrigger_t ttt -) -//----------------------------------------------------------------------------- + TimeToTrigger_t ttt ) { uint8_t eNB_offset; uint8_t currentCellIndex = mac_xface->lte_frame_parms->Nid_cell; @@ -3213,15 +3536,7 @@ check_trigger_meas_event( #ifdef Rel10 //----------------------------------------------------------------------------- -int -decode_MCCH_Message( - const protocol_ctxt_t* const ctxt_pP, - const uint8_t eNB_index, - const uint8_t* const Sdu, - const uint8_t Sdu_len, - const uint8_t mbsfn_sync_area -) -//----------------------------------------------------------------------------- +int decode_MCCH_Message( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index, const uint8_t* const Sdu, const uint8_t Sdu_len, const uint8_t mbsfn_sync_area ) { MCCH_Message_t *mcch=NULL; @@ -3283,14 +3598,7 @@ decode_MCCH_Message( } //----------------------------------------------------------------------------- -void -decode_MBSFNAreaConfiguration( - module_id_t ue_mod_idP, - uint8_t eNB_index, - frame_t frameP, - uint8_t mbsfn_sync_area -) -//----------------------------------------------------------------------------- +static void decode_MBSFNAreaConfiguration( module_id_t ue_mod_idP, uint8_t eNB_index, frame_t frameP, uint8_t mbsfn_sync_area ) { protocol_ctxt_t ctxt; @@ -3368,11 +3676,7 @@ EXPORT_SYMBOL(Rlc_info_am_config); #if defined(ENABLE_ITTI) //----------------------------------------------------------------------------- -void -*rrc_ue_task( - void *args_p -) -//----------------------------------------------------------------------------- +void *rrc_ue_task( void *args_p ) { MessageDef *msg_p; const char *msg_name; diff --git a/openair2/RRC/LITE/rrc_eNB.c b/openair2/RRC/LITE/rrc_eNB.c index cd0661dcdd..37f2e0600f 100644 --- a/openair2/RRC/LITE/rrc_eNB.c +++ b/openair2/RRC/LITE/rrc_eNB.c @@ -378,7 +378,7 @@ init_MCCH( int sync_area = 0; // initialize RRC_eNB_INST MCCH entry eNB_rrc_inst[enb_mod_idP].carrier[CC_id].MCCH_MESSAGE = - malloc(eNB_rrc_inst[enb_mod_idP].carrier[CC_id].num_mbsfn_sync_area * sizeof(uint32_t *)); + malloc(eNB_rrc_inst[enb_mod_idP].carrier[CC_id].num_mbsfn_sync_area * sizeof(uint8_t*)); for (sync_area = 0; sync_area < eNB_rrc_inst[enb_mod_idP].carrier[CC_id].num_mbsfn_sync_area; sync_area++) { @@ -3289,9 +3289,11 @@ openair_rrc_lite_eNB_init( // } // } eNB_rrc_inst[ctxt.module_id].Nb_ue = 0; + for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { eNB_rrc_inst[ctxt.module_id].carrier[CC_id].Srb0.Active = 0; } + uid_linear_allocator_init(&eNB_rrc_inst[ctxt.module_id].uid_allocator); RB_INIT(&eNB_rrc_inst[ctxt.module_id].rrc_ue_head); RB_INIT(&eNB_rrc_inst[ctxt.module_id].rrc_rnti_head); @@ -3334,6 +3336,7 @@ openair_rrc_lite_eNB_init( eNB_rrc_inst[ctxt.module_id].carrier[CC_id].cba_rnti[3], eNB_rrc_inst[ctxt.module_id].carrier[CC_id].num_active_cba_groups); } + #endif for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { diff --git a/openair2/UTIL/LOG/vcd_signal_dumper.c b/openair2/UTIL/LOG/vcd_signal_dumper.c index 328548da47..4f34667b64 100644 --- a/openair2/UTIL/LOG/vcd_signal_dumper.c +++ b/openair2/UTIL/LOG/vcd_signal_dumper.c @@ -94,6 +94,7 @@ const char* eurecomVariablesNames[] = { "rxcnt", "trx_ts", "trx_tst", + "dummy_dump", "itti_send_msg", "itti_poll_msg", "itti_recv_msg", diff --git a/openair2/UTIL/LOG/vcd_signal_dumper.h b/openair2/UTIL/LOG/vcd_signal_dumper.h index 13e9250d68..6c9845de6f 100644 --- a/openair2/UTIL/LOG/vcd_signal_dumper.h +++ b/openair2/UTIL/LOG/vcd_signal_dumper.h @@ -66,6 +66,7 @@ typedef enum { VCD_SIGNAL_DUMPER_VARIABLES_RXCNT, VCD_SIGNAL_DUMPER_VARIABLES_TRX_TS, VCD_SIGNAL_DUMPER_VARIABLES_TRX_TST, + VCD_SIGNAL_DUMPER_VARIABLES_DUMMY_DUMP, VCD_SIGNAL_DUMPER_VARIABLE_ITTI_SEND_MSG, VCD_SIGNAL_DUMPER_VARIABLE_ITTI_POLL_MSG, VCD_SIGNAL_DUMPER_VARIABLE_ITTI_RECV_MSG, diff --git a/targets/ARCH/COMMON/common_lib.h b/targets/ARCH/COMMON/common_lib.h index 56490b65aa..dc8e508c18 100644 --- a/targets/ARCH/COMMON/common_lib.h +++ b/targets/ARCH/COMMON/common_lib.h @@ -44,7 +44,7 @@ typedef struct openair0_device_t openair0_device; #define MAX_CARDS 1 #endif -#define USRP_GAIN_OFFSET (86.0) // 86 calibrated for USRP B210 @ 2.6 GHz to get equivalent RS EPRE in OAI to SMBV100 output +#define USRP_GAIN_OFFSET (56.0) // 86 calibrated for USRP B210 @ 2.6 GHz to get equivalent RS EPRE in OAI to SMBV100 output typedef enum { max_gain=0,med_gain,byp_gain @@ -81,6 +81,8 @@ typedef struct { double rx_bw; //! TX bandwidth in Hz double tx_bw; + //! Auto calibration flag + int autocal[4]; //! RRH IP addr for Ethernet interface char *rrh_ip; //! RRH port number for Ethernet interface @@ -141,13 +143,14 @@ extern "C" #endif /* return 0 if OK, < 0 if error */ -int openair0_device_init(openair0_device* device, openair0_config_t *openair0_cfg); -openair0_timestamp get_usrp_time(openair0_device *device); -int openair0_set_frequencies(openair0_device* device, openair0_config_t *openair0_cfg); -int openair0_set_rx_frequencies(openair0_device* device, openair0_config_t *openair0_cfg); - -int openair0_set_gains(openair0_device* device, openair0_config_t *openair0_cfg); - + int openair0_device_init(openair0_device* device, openair0_config_t *openair0_cfg); + openair0_timestamp get_usrp_time(openair0_device *device); + int openair0_set_frequencies(openair0_device* device, openair0_config_t *openair0_cfg,int exmimo_dump_config); + int openair0_set_rx_frequencies(openair0_device* device, openair0_config_t *openair0_cfg); + + int openair0_set_gains(openair0_device* device, openair0_config_t *openair0_cfg); + + int openair0_stop(int card); #ifdef __cplusplus } #endif diff --git a/targets/ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.c b/targets/ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.c index b30cc89e8b..5e11a4c2f4 100644 --- a/targets/ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.c +++ b/targets/ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.c @@ -250,7 +250,7 @@ int openair0_stop_without_reset(int card) int openair0_device_init(openair0_device *device, openair0_config_t *openair0_cfg) { // Initialize card - exmimo_config_t *p_exmimo_config; + // exmimo_config_t *p_exmimo_config; exmimo_id_t *p_exmimo_id; int ret; @@ -276,7 +276,7 @@ int openair0_device_init(openair0_device *device, openair0_config_t *openair0_cf printf ("Detected %d number of cards, %d number of antennas.\n", openair0_num_detected_cards, openair0_num_antennas[0]); } - p_exmimo_config = openair0_exmimo_pci[0].exmimo_config_ptr; + // p_exmimo_config = openair0_exmimo_pci[0].exmimo_config_ptr; p_exmimo_id = openair0_exmimo_pci[0].exmimo_id_ptr; printf("Card %d: ExpressMIMO %d, HW Rev %d, SW Rev 0x%d\n", 0, p_exmimo_id->board_exmimoversion, p_exmimo_id->board_hwrev, p_exmimo_id->board_swrev); @@ -356,14 +356,15 @@ int openair0_config(openair0_config_t *openair0_cfg, int UE_flag) for (ant=0; ant<4; ant++) { if (openair0_cfg[card].rx_freq[ant] || openair0_cfg[card].tx_freq[ant]) { p_exmimo_config->rf.rf_mode[ant] = RF_MODE_BASE; - p_exmimo_config->rf.do_autocal[ant] = 1; + p_exmimo_config->rf.do_autocal[ant] = 1;//openair0_cfg[card].autocal[ant]; + printf("card %d, antenna %d, autocal %d\n",card,ant,openair0_cfg[card].autocal[ant]); } if (openair0_cfg[card].tx_freq[ant]) { p_exmimo_config->rf.rf_mode[ant] += (TXEN + DMAMODE_TX + TXLPFNORM + TXLPFEN + tx_filter); p_exmimo_config->rf.rf_freq_tx[ant] = (unsigned int)openair0_cfg[card].tx_freq[ant]; p_exmimo_config->rf.tx_gain[ant][0] = (unsigned int)openair0_cfg[card].tx_gain[ant]; - printf("openair0 : programming card %d TX antenna %d (freq %u, gain %d)\n",card,ant,p_exmimo_config->rf.rf_freq_tx[ant],p_exmimo_config->rf.tx_gain[ant][0]); + } if (openair0_cfg[card].rx_freq[ant]) { @@ -419,11 +420,11 @@ int openair0_config(openair0_config_t *openair0_cfg, int UE_flag) int openair0_reconfig(openair0_config_t *openair0_cfg) { - int ret; + int ant, card; exmimo_config_t *p_exmimo_config; - exmimo_id_t *p_exmimo_id; + // exmimo_id_t *p_exmimo_id; if (!openair0_cfg) { printf("Error, openair0_cfg is null!!\n"); @@ -433,7 +434,7 @@ int openair0_reconfig(openair0_config_t *openair0_cfg) for (card=0; card<openair0_num_detected_cards; card++) { p_exmimo_config = openair0_exmimo_pci[card].exmimo_config_ptr; - p_exmimo_id = openair0_exmimo_pci[card].exmimo_id_ptr; + // p_exmimo_id = openair0_exmimo_pci[card].exmimo_id_ptr; for (ant=0; ant<4; ant++) { if (openair0_cfg[card].tx_freq[ant]) { @@ -468,6 +469,18 @@ int openair0_reconfig(openair0_config_t *openair0_cfg) return(0); } +int openair0_set_frequencies(openair0_device* device, openair0_config_t *openair0_cfg,int exmimo_dump_config) { + + if (exmimo_dump_config > 0) { + // do a full configuration + openair0_config(openair0_cfg,0); + } + else { // just change the frequencies in pci descriptor + openair0_reconfig(openair0_cfg); + } + return(0); + +} unsigned int *openair0_daq_cnt(void) { diff --git a/targets/ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.h b/targets/ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.h index d8b605e017..f40b7ae88c 100644 --- a/targets/ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.h +++ b/targets/ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.h @@ -95,4 +95,7 @@ int openair0_stop_without_reset(int card); // return the DAQ block counter unsigned int *openair0_daq_cnt(void); +// set the TX and RX frequencies (card 0 only for now, to retain USRP compatibility) +int openair0_set_frequencies(openair0_device* device, openair0_config_t *openair0_cfg,int exmimo_dump_config); + #endif diff --git a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp index 6e6c3575ab..66e2b9ed9e 100644 --- a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp +++ b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp @@ -195,7 +195,7 @@ static bool is_equal(double a, double b) return std::fabs(a-b) < std::numeric_limits<double>::epsilon(); } -int openair0_set_frequencies(openair0_device* device, openair0_config_t *openair0_cfg) { +int openair0_set_frequencies(openair0_device* device, openair0_config_t *openair0_cfg,int dummy) { usrp_state_t *s = (usrp_state_t*)device->priv; @@ -231,7 +231,13 @@ int openair0_set_gains(openair0_device* device, openair0_config_t *openair0_cfg) s->usrp->set_rx_gain(openair0_cfg[0].rx_gain[0]); return(0); } - + +int openair0_stop(int card) { + + return(0); + +} + int openair0_device_init(openair0_device* device, openair0_config_t *openair0_cfg) { uhd::set_thread_priority_safe(1.0); diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c index 7e2c5274a0..1e04764671 100644 --- a/targets/RT/USER/lte-softmodem.c +++ b/targets/RT/USER/lte-softmodem.c @@ -247,6 +247,7 @@ static char *itti_dump_file = NULL; #endif int UE_scan = 1; +int UE_scan_carrier = 0; runmode_t mode = normal_txrx; @@ -430,7 +431,7 @@ void help (void) { printf(" --no-L2-connect bypass L2 and upper layers\n"); printf(" --ue_rxgain set UE RX gain\n"); printf(" --ue_txgain set UE tx gain\n"); - + printf(" --ue_scan_carrier set UE to scan around carrier\n"); printf(" -C Set the downlink frequecny for all Component carrier\n"); printf(" -d Enable soft scope and L1 and L2 stats (Xforms)\n"); printf(" -F Calibrate the EXMIMO borad, available files: exmimo2_2arxg.lime exmimo2_2brxg.lime \n"); @@ -598,7 +599,7 @@ static void *scope_thread(void *arg) sleep(1); } - printf("%s",stats_buffer); + // printf("%s",stats_buffer); # ifdef ENABLE_XFORMS_WRITE_STATS @@ -1934,6 +1935,7 @@ static void get_options (int argc, char **argv) LONG_OPTION_NO_L2_CONNECT, LONG_OPTION_RXGAIN, LONG_OPTION_TXGAIN, + LONG_OPTION_SCANCARRIER }; static const struct option long_options[] = { @@ -1945,6 +1947,7 @@ static void get_options (int argc, char **argv) {"no-L2-connect", no_argument, NULL, LONG_OPTION_NO_L2_CONNECT}, {"ue_rxgain", required_argument, NULL, LONG_OPTION_RXGAIN}, {"ue_txgain", required_argument, NULL, LONG_OPTION_TXGAIN}, + {"ue_scan_carrier", no_argument, NULL, LONG_OPTION_SCANCARRIER}, {NULL, 0, NULL, 0} }; @@ -1993,6 +1996,11 @@ static void get_options (int argc, char **argv) break; + case LONG_OPTION_SCANCARRIER: + UE_scan_carrier=1; + + break; + case 'M': #ifdef ETHERNET strcpy(rrh_eNB_ip,optarg); @@ -2009,6 +2017,7 @@ static void get_options (int argc, char **argv) } UE_scan=0; + break; case 'd': @@ -2564,6 +2573,7 @@ int main( int argc, char **argv ) UE[CC_id]->UE_scan = UE_scan; + UE[CC_id]->UE_scan_carrier = UE_scan_carrier; UE[CC_id]->mode = mode; compute_prach_seq(&UE[CC_id]->lte_frame_parms.prach_config_common, @@ -2794,6 +2804,7 @@ int main( int argc, char **argv ) for (i=0; i<4; i++) { + openair0_cfg[card].autocal[i] = 1; openair0_cfg[card].tx_gain[i] = tx_gain[0][i]; openair0_cfg[card].rx_gain[i] = ((UE_flag==0) ? PHY_vars_eNB_g[0][0]->rx_total_gain_eNB_dB : PHY_vars_UE_g[0][0]->rx_total_gain_dB) - USRP_GAIN_OFFSET; // calibrated for USRP B210 @ 2.6 GHz, 30.72 MS/s @@ -2830,6 +2841,7 @@ int main( int argc, char **argv ) printf("Initializing openair0 ..."); openair0_cfg[0].log_level = glog_level; + if (openair0_device_init(&openair0, &openair0_cfg[0]) <0) { printf("Exiting, cannot initialize device\n"); exit(-1); @@ -3387,15 +3399,15 @@ int setup_eNB_buffers(PHY_VARS_eNB **phy_vars_eNB, openair0_config_t *openair0_c for (i=0; i<frame_parms->nb_antennas_rx; i++) { free(phy_vars_eNB[CC_id]->lte_eNB_common_vars.rxdata[0][i]); - rxdata[i] = (int32_t*)(16 + malloc16(16+samples_per_frame*sizeof(int32_t))); - phy_vars_eNB[CC_id]->lte_eNB_common_vars.rxdata[0][i] = rxdata[i]-N_TA_offset; // N_TA offset for TDD + rxdata[i] = (int32_t*)(16 + malloc16(16+samples_per_frame*sizeof(int32_t))); // FIXME broken memory allocation + phy_vars_eNB[CC_id]->lte_eNB_common_vars.rxdata[0][i] = rxdata[i]-N_TA_offset; // N_TA offset for TDD FIXME! N_TA_offset > 16 => access of unallocated memory memset(rxdata[i], 0, samples_per_frame*sizeof(int32_t)); printf("rxdata[%d] @ %p (%p) (N_TA_OFFSET %d)\n", i, phy_vars_eNB[CC_id]->lte_eNB_common_vars.rxdata[0][i],rxdata[i],N_TA_offset); } for (i=0; i<frame_parms->nb_antennas_tx; i++) { free(phy_vars_eNB[CC_id]->lte_eNB_common_vars.txdata[0][i]); - txdata[i] = (int32_t*)(16 + malloc16(16 + samples_per_frame*sizeof(int32_t))); + txdata[i] = (int32_t*)(16 + malloc16(16 + samples_per_frame*sizeof(int32_t))); // FIXME broken memory allocation phy_vars_eNB[CC_id]->lte_eNB_common_vars.txdata[0][i] = txdata[i]; memset(txdata[i], 0, samples_per_frame*sizeof(int32_t)); printf("txdata[%d] @ %p\n", i, phy_vars_eNB[CC_id]->lte_eNB_common_vars.txdata[0][i]); diff --git a/targets/RT/USER/lte-ue.c b/targets/RT/USER/lte-ue.c index fd8a6dcfac..a388e7ed3e 100644 --- a/targets/RT/USER/lte-ue.c +++ b/targets/RT/USER/lte-ue.c @@ -119,7 +119,6 @@ extern int oai_exit; extern int32_t **rxdata; extern int32_t **txdata; -extern unsigned int samples_per_frame; extern unsigned int tx_forward_nsamps; extern int tx_delay; @@ -206,10 +205,11 @@ static void *UE_thread_synch(void *arg) PHY_VARS_UE *UE = (PHY_VARS_UE*) arg; int current_band = 0; int current_offset = 0; - sync_mode_t sync_mode = pss; + sync_mode_t sync_mode = pbch; int card; int ind; int found; + int freq_offset=0; UE->is_synchronized = 0; printf("UE_thread_sync in with PHY_vars_UE %p\n",arg); @@ -224,7 +224,7 @@ static void *UE_thread_synch(void *arg) pthread_mutex_unlock(&sync_mutex); printf("unlocked sync_mutex (UE_sync_thread)\n"); - printf("starting UE synch thread\n"); + printf("starting UE synch thread (IC %d)\n",UE->instance_cnt_synch); ind = 0; found = 0; @@ -244,26 +244,28 @@ static void *UE_thread_synch(void *arg) } ind++; - } while (current_band < sizeof(eutra_bands) / sizeof(eutra_bands[0])); - + } while (ind < sizeof(eutra_bands) / sizeof(eutra_bands[0])); + if (found == 0) { exit_fun("Can't find EUTRA band for frequency"); return &UE_thread_synch_retval; } -#ifdef OAI_USRP - // now we know the uplink_frequency_offset - // set the correct TX frequency - for (i=0; i<openair0_cfg[card].tx_num_channels; i++) { - openair0_cfg[0].tx_freq[i] = downlink_frequency[0][i] + uplink_frequency_offset[0][i]; - } - openair0_set_frequencies( &openair0, &openair0_cfg[0] ); -#endif - LOG_D( PHY, "[SCHED][UE] Check absolute frequency %"PRIu32" (oai_exit %d)\n", downlink_frequency[0][0], oai_exit ); + + + LOG_I( PHY, "[SCHED][UE] Check absolute frequency %"PRIu32" (oai_exit %d)\n", downlink_frequency[0][0], oai_exit ); + + for (i=0;i<openair0_cfg[0].rx_num_channels;i++) { + openair0_cfg[0].rx_freq[i] = downlink_frequency[0][i]; + openair0_cfg[0].tx_freq[i] = downlink_frequency[0][i]+uplink_frequency_offset[0][i]; + openair0_cfg[0].autocal[i] = 1; + } + sync_mode = pbch; + } else if (UE->UE_scan == 1) { current_band=0; @@ -298,16 +300,8 @@ static void *UE_thread_synch(void *arg) printf( "UE synch: setting RX gain (%d,%d) to %f\n", card, i, openair0_cfg[card].rx_gain[i] ); #endif } - -#ifdef EXMIMO - //openair0_config(&openair0_cfg[card],1); -#endif } -#if defined(OAI_USRP) && !defined(USRP_DEBUG) - openair0_set_frequencies( &openair0, &openair0_cfg[0] ); - openair0_set_gains( &openair0, &openair0_cfg[0] ); -#endif } while (oai_exit==0) { @@ -317,6 +311,7 @@ static void *UE_thread_synch(void *arg) exit_fun("noting to add"); return &UE_thread_synch_retval; } + while (UE->instance_cnt_synch < 0) { // the thread waits here most of the time @@ -353,8 +348,8 @@ static void *UE_thread_synch(void *arg) uplink_frequency_offset[card][i] = bands_to_scan.band_info[current_band].ul_min-bands_to_scan.band_info[0].dl_min + current_offset; - openair0_cfg[card].rx_freq[i] = downlink_frequency[card][i]+openair_daq_vars.freq_offset; - openair0_cfg[card].tx_freq[i] = downlink_frequency[card][i]+uplink_frequency_offset[card][i]+openair_daq_vars.freq_offset; + openair0_cfg[card].rx_freq[i] = downlink_frequency[card][i]; + openair0_cfg[card].tx_freq[i] = downlink_frequency[card][i]+uplink_frequency_offset[card][i]; #ifdef OAI_USRP openair0_cfg[card].rx_gain[i] = UE->rx_total_gain_dB-USRP_GAIN_OFFSET; // 65 calibrated for USRP B210 @ 2.6 GHz @@ -381,65 +376,100 @@ static void *UE_thread_synch(void *arg) } -#ifdef EXMIMO - //openair0_config(&openair0_cfg[card],1); -#endif } -#ifdef OAI_USRP -#ifndef USRP_DEBUG - openair0_set_frequencies(&openair0,&openair0_cfg[0]); - // openair0_set_gains(&openair0,&openair0_cfg[0]); -#endif -#endif + if (UE->UE_scan_carrier) { - break; + for (i=0;i<openair0_cfg[0].rx_num_channels;i++) + openair0_cfg[0].autocal[i] = 1; + + } + + break; + case pbch: - // This is a hack to fix a bug when using USRP - // FIXME is this necessary anymore? Which bug is fixed by this hack? - memset(PHY_vars_UE_g[0][0]->lte_ue_common_vars.rxdata[0],0,1024); if (initial_sync( UE, UE->mode ) == 0) { - UE->is_synchronized = 1; + + hw_slot_offset = (UE->rx_offset<<1) / UE->lte_frame_parms.samples_per_tti; + LOG_I( HW, "Got synch: hw_slot_offset %d\n", hw_slot_offset ); + if (UE->UE_scan_carrier == 1) { + + UE->UE_scan_carrier = 0; + // rerun with new cell parameters and frequency-offset + for (i=0;i<openair0_cfg[0].rx_num_channels;i++) { + openair0_cfg[0].rx_freq[i] -= UE->lte_ue_common_vars.freq_offset; + openair0_cfg[0].tx_freq[i] = openair0_cfg[0].rx_freq[i]+uplink_frequency_offset[0][i]; + downlink_frequency[0][i] = openair0_cfg[0].rx_freq[i]; + freq_offset=0; + } + + openair0_stop(0); + sleep(1); + switch(UE->lte_frame_parms.N_RB_DL) { + case 6: + openair0_cfg[0].sample_rate =1.92e6; + break; + case 25: + openair0_cfg[0].sample_rate=7.68e6; + break; + case 50: + openair0_cfg[0].sample_rate=15.36e6; + break; + case 100: + openair0_cfg[0].sample_rate=30.72e6; + break; + } + + // reconfigure for potentially different bandwidth + init_frame_parms(&UE->lte_frame_parms,1); + } + else { + UE->is_synchronized = 1; #ifndef EXMIMO - UE->slot_rx = 0; - UE->slot_tx = 4; + UE->slot_rx = 0; + UE->slot_tx = 4; #else - UE->slot_rx = 18; - UE->slot_tx = 2; + UE->slot_rx = 18; + UE->slot_tx = 2; #endif - hw_slot_offset = (UE->rx_offset<<1) / UE->lte_frame_parms.samples_per_tti; - LOG_I( HW, "Got synch: hw_slot_offset %d\n", hw_slot_offset ); - + } } else { // initial sync failed // calculate new offset and try again - if (openair_daq_vars.freq_offset >= 0) { - openair_daq_vars.freq_offset += 100; - openair_daq_vars.freq_offset *= -1; - } else { - openair_daq_vars.freq_offset *= -1; - } - - if (abs(openair_daq_vars.freq_offset) > 7500) { - LOG_I( PHY, "[initial_sync] No cell synchronization found, abandoning\n" ); - mac_xface->macphy_exit("No cell synchronization found, abandoning"); - return &UE_thread_synch_retval; // not reached - } - - LOG_I( PHY, "[initial_sync] trying carrier off %d Hz, rxgain %d (DL %u, UL %u)\n", openair_daq_vars.freq_offset, + if (UE->UE_scan_carrier == 1) { + if (freq_offset >= 0) { + freq_offset += 100; + freq_offset *= -1; + } else { + freq_offset *= -1; + } + + if (abs(freq_offset) > 7500) { + LOG_I( PHY, "[initial_sync] No cell synchronization found, abandoning\n" ); + mac_xface->macphy_exit("No cell synchronization found, abandoning"); + return &UE_thread_synch_retval; // not reached + } + } + else { + + } + LOG_I( PHY, "[initial_sync] trying carrier off %d Hz, rxgain %d (DL %u, UL %u)\n", + 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 ); + downlink_frequency[0][0]+freq_offset, + downlink_frequency[0][0]+uplink_frequency_offset[0][0]+freq_offset ); for (card=0; card<MAX_CARDS; card++) { for (i=0; i<openair0_cfg[card].rx_num_channels; i++) { - openair0_cfg[card].rx_freq[i] = downlink_frequency[card][i]+openair_daq_vars.freq_offset; - openair0_cfg[card].tx_freq[i] = downlink_frequency[card][i]+uplink_frequency_offset[card][i]+openair_daq_vars.freq_offset; + openair0_cfg[card].rx_freq[i] = downlink_frequency[card][i]+freq_offset; + openair0_cfg[card].tx_freq[i] = downlink_frequency[card][i]+uplink_frequency_offset[card][i]+freq_offset; #ifdef OAI_USRP openair0_cfg[card].rx_gain[i] = UE->rx_total_gain_dB-USRP_GAIN_OFFSET; + openair0_set_frequencies(&openair0,&openair0_cfg[0],0); + switch(UE->lte_frame_parms.N_RB_DL) { case 6: openair0_cfg[card].rx_gain[i] -= 12; @@ -461,11 +491,12 @@ static void *UE_thread_synch(void *arg) #endif } } - -#if defined(OAI_USRP) && !defined(USRP_DEBUG) - openair0_set_frequencies( &openair0, &openair0_cfg[0] ); -#endif - } // initial_sync=0 + if (UE->UE_scan_carrier==1) { + for (i=0;i<openair0_cfg[0].rx_num_channels;i++) + openair0_cfg[0].autocal[i] = 1; + + } + }// initial_sync=0 break; @@ -476,6 +507,8 @@ static void *UE_thread_synch(void *arg) VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SYNCH, 0 ); + + if (pthread_mutex_lock(&UE->mutex_synch) != 0) { LOG_E( PHY, "[SCHED][UE] error locking mutex for UE synch\n" ); exit_fun("noting to add"); @@ -830,6 +863,7 @@ void *UE_thread(void *arg) int rx_correction_timer = 0; int first_rx = 0; RTIME T0; + unsigned int rxs; openair0_timestamp timestamp; @@ -863,7 +897,7 @@ void *UE_thread(void *arg) exit_fun("Nothing to add"); return &UE_thread_retval; } - +h LOG_I(HW,"[SCHED][eNB] eNB main deadline thread %lu started on CPU %d\n", (unsigned long)gettid(), sched_getcpu()); @@ -892,6 +926,7 @@ void *UE_thread(void *arg) while (!oai_exit) { VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_HW_SUBFRAME, hw_subframe ); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_HW_FRAME, frame ); + VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_DUMMY_DUMP, dummy_dump ); while (rxpos < (1+hw_subframe)*UE->lte_frame_parms.samples_per_tti) { VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ, 1 ); @@ -903,12 +938,15 @@ void *UE_thread(void *arg) 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]; + + // if (dummy_dump == 0) + // printf("writing %d samples to %d\n",spp - ((first_rx==1) ? rx_off_diff : 0),rxpos); - unsigned int rxs = openair0.trx_read_func(&openair0, - ×tamp, - rxp, - spp - ((first_rx==1) ? rx_off_diff : 0), - UE->lte_frame_parms.nb_antennas_rx); + rxs = openair0.trx_read_func(&openair0, + ×tamp, + 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"); @@ -981,13 +1019,12 @@ void *UE_thread(void *arg) if (UE->mode == rx_calib_ue) { if (frame == 10) { LOG_D(PHY, - "[SCHED][UE] Found cell with N_RB_DL %"PRIu8", PHICH CONFIG (%d,%d), Nid_cell %"PRIu16", NB_ANTENNAS_TX %"PRIu8", initial frequency offset %"PRIi32" Hz, frequency offset "PRIi32" Hz, RSSI (digital) %hu dB, measured Gain %d dB, total_rx_gain %"PRIu32" dB, USRP rx gain %f dB\n", + "[SCHED][UE] Found cell with N_RB_DL %"PRIu8", PHICH CONFIG (%d,%d), Nid_cell %"PRIu16", NB_ANTENNAS_TX %"PRIu8", frequency offset "PRIi32" Hz, RSSI (digital) %hu dB, measured Gain %d dB, total_rx_gain %"PRIu32" dB, USRP rx gain %f dB\n", UE->lte_frame_parms.N_RB_DL, UE->lte_frame_parms.phich_config_common.phich_duration, UE->lte_frame_parms.phich_config_common.phich_resource, UE->lte_frame_parms.Nid_cell, UE->lte_frame_parms.nb_antennas_tx_eNB, - openair_daq_vars.freq_offset, UE->lte_ue_common_vars.freq_offset, UE->PHY_measurements.rx_power_avg_dB[0], UE->PHY_measurements.rx_power_avg_dB[0] - rx_input_level_dBm, @@ -1098,11 +1135,15 @@ void *UE_thread(void *arg) // dump ahead in time to start of frame #ifndef USRP_DEBUG - unsigned int rxs = openair0.trx_read_func(&openair0, - ×tamp, - (void**)rxdata, - UE->rx_offset, - UE->lte_frame_parms.nb_antennas_rx); + rxs = openair0.trx_read_func(&openair0, + ×tamp, + (void**)rxdata, + UE->rx_offset, + UE->lte_frame_parms.nb_antennas_rx); + if (rxs != UE->rx_offset) { + exit_fun("problem in rx"); + return &UE_thread_retval; + } #else rt_sleep_ns(10000000); #endif @@ -1161,7 +1202,7 @@ void *UE_thread(void *arg) unsigned int flags = 0; unsigned long mask = 1; // processor 0 #endif - + int freq_offset; #ifdef RTAI @@ -1223,7 +1264,7 @@ void *UE_thread(void *arg) printf("starting UE thread\n"); - openair_daq_vars.freq_offset = 0; //-7500; + freq_offset = 0; //-7500; first_synch = 1; @@ -1375,7 +1416,7 @@ void *UE_thread(void *arg) UE->lte_frame_parms.phich_config_common.phich_resource, UE->lte_frame_parms.Nid_cell, UE->lte_frame_parms.nb_antennas_tx_eNB, - openair_daq_vars.freq_offset, + freq_offset, UE->lte_ue_common_vars.freq_offset, UE->PHY_measurements.rx_power_avg_dB[0], UE->PHY_measurements.rx_power_avg_dB[0] - rx_input_level_dBm, @@ -1439,11 +1480,14 @@ void *UE_thread(void *arg) LOG_E(PHY,"[SCHED][UE] error locking mutex for UE initial synch thread\n"); exit_fun("noting to add"); } else { - //printf("Before getting frame IC %d (UE_thread)\n",UE->instance_cnt_synch); + if (UE->instance_cnt_synch < 0) { wait_sync_cnt=0; + openair0_config(&openair0_cfg[0],1); + // openair0_set_gains(&openair0,&openair0_cfg[0]); + printf("Getting frame\n"); openair0_get_frame(0); rt_sleep_ns(FRAME_PERIOD); // increment instance count for sync thread @@ -1482,25 +1526,25 @@ void *UE_thread(void *arg) } } else { - if (openair_daq_vars.freq_offset >= 0) { - openair_daq_vars.freq_offset += 100; - openair_daq_vars.freq_offset *= -1; + if (freq_offset >= 0) { + freq_offset += 100; + freq_offset *= -1; } else { - openair_daq_vars.freq_offset *= -1; + freq_offset *= -1; } - if (abs(openair_daq_vars.freq_offset) > 7500) { + if (abs(freq_offset) > 7500) { LOG_I(PHY,"[initial_sync] No cell synchronization found, abondoning\n"); mac_xface->macphy_exit("No cell synchronization found, abondoning"); } else { - // LOG_I(PHY,"[initial_sync] trying carrier off %d Hz\n",openair_daq_vars.freq_offset); + // LOG_I(PHY,"[initial_sync] trying carrier off %d Hz\n",freq_offset); #ifndef USRP for (CC_id=0;CC_id<MAX_NUM_CCs;CC_id++) { for (i=0; i<openair0_cfg[rf_map[CC_id].card].rx_num_channels; i++) - openair0_cfg[rf_map[CC_id].card].rx_freq[rf_map[CC_id].chain+i] = downlink_frequency[CC_id][i]+openair_daq_vars.freq_offset; + openair0_cfg[rf_map[CC_id].card].rx_freq[rf_map[CC_id].chain+i] = downlink_frequency[CC_id][i]+freq_offset; for (i=0; i<openair0_cfg[rf_map[CC_id].card].tx_num_channels; i++) - openair0_cfg[rf_map[CC_id].card].tx_freq[rf_map[CC_id].chain+i] = downlink_frequency[CC_id][i]+openair_daq_vars.freq_offset; + openair0_cfg[rf_map[CC_id].card].tx_freq[rf_map[CC_id].chain+i] = downlink_frequency[CC_id][i]+freq_offset; } openair0_config(&openair0_cfg[0],UE_flag); #endif @@ -1672,14 +1716,14 @@ int setup_ue_buffers(PHY_VARS_UE **phy_vars_ue, openair0_config_t *openair0_cfg, for (i=0; i<frame_parms->nb_antennas_rx; i++) { printf( "Mapping UE CC_id %d, rx_ant %d, freq %u on card %d, chain %d\n", CC_id, i, downlink_frequency[CC_id][i], rf_map[CC_id].card, rf_map[CC_id].chain+i ); free( phy_vars_ue[CC_id]->lte_ue_common_vars.rxdata[i] ); - rxdata[i] = (int32_t*)malloc16_clear( samples_per_frame*sizeof(int32_t) ); + rxdata[i] = (int32_t*)malloc16_clear( 307200*sizeof(int32_t) ); phy_vars_ue[CC_id]->lte_ue_common_vars.rxdata[i] = rxdata[i]; // what about the "-N_TA_offset" ? // N_TA offset for TDD } for (i=0; i<frame_parms->nb_antennas_tx; i++) { printf( "Mapping UE CC_id %d, tx_ant %d, freq %u on card %d, chain %d\n", CC_id, i, downlink_frequency[CC_id][i], rf_map[CC_id].card, rf_map[CC_id].chain+i ); free( phy_vars_ue[CC_id]->lte_ue_common_vars.txdata[i] ); - txdata[i] = (int32_t*)malloc16_clear( samples_per_frame*sizeof(int32_t) ); + txdata[i] = (int32_t*)malloc16_clear( 307200*sizeof(int32_t) ); phy_vars_ue[CC_id]->lte_ue_common_vars.txdata[i] = txdata[i]; } diff --git a/targets/RT/USER/sched_dlsch.c b/targets/RT/USER/sched_dlsch.c index c5c13f414c..c13be0b7d4 100644 --- a/targets/RT/USER/sched_dlsch.c +++ b/targets/RT/USER/sched_dlsch.c @@ -249,22 +249,30 @@ static void * dlsch_thread(void *param) #ifdef DEBUG_PHY - LOG_I(PHY,"[UE %d][PDSCH %x/%d] Frame %d subframe %d: PDSCH/DLSCH decoding iter %d (mcs %d, rv %d, TBS %d)\n", - phy_vars_ue->Mod_id, - phy_vars_ue->dlsch_ue[eNB_id][0]->rnti,harq_pid, - phy_vars_ue->frame_rx,dlsch_subframe[dlsch_thread_index],ret, - phy_vars_ue->dlsch_ue[eNB_id][0]->harq_processes[harq_pid]->mcs, - phy_vars_ue->dlsch_ue[eNB_id][0]->harq_processes[harq_pid]->rvidx, - phy_vars_ue->dlsch_ue[eNB_id][0]->harq_processes[harq_pid]->TBS); - - if (phy_vars_ue->frame_rx%100==0) { - LOG_D(PHY,"[UE %d][PDSCH %x] Frame %d subframe %d dlsch_errors %d, dlsch_received %d, dlsch_fer %d, current_dlsch_cqi %d\n", - phy_vars_ue->Mod_id,phy_vars_ue->dlsch_ue[eNB_id][0]->rnti, - phy_vars_ue->frame_rx,dlsch_subframe[dlsch_thread_index], - phy_vars_ue->dlsch_errors[eNB_id], - phy_vars_ue->dlsch_received[eNB_id], - phy_vars_ue->dlsch_fer[eNB_id], - phy_vars_ue->PHY_measurements.wideband_cqi_tot[eNB_id]); + + if (phy_vars_ue->dlsch_ue[eNB_id][0]) { + LOG_I(PHY,"[UE %d][PDSCH %x/%d] Frame %d subframe %d: PDSCH/DLSCH decoding iter %d (mcs %d, rv %d, TBS %d)\n", + phy_vars_ue->Mod_id, + phy_vars_ue->dlsch_ue[eNB_id][0]->rnti,harq_pid, + phy_vars_ue->frame_rx,dlsch_subframe[dlsch_thread_index],ret, + phy_vars_ue->dlsch_ue[eNB_id][0]->harq_processes[harq_pid]->mcs, + phy_vars_ue->dlsch_ue[eNB_id][0]->harq_processes[harq_pid]->rvidx, + phy_vars_ue->dlsch_ue[eNB_id][0]->harq_processes[harq_pid]->TBS); + + if (phy_vars_ue->frame_rx%100==0) { + LOG_D(PHY,"[UE %d][PDSCH %x] Frame %d subframe %d dlsch_errors %d, dlsch_received %d, dlsch_fer %d, current_dlsch_cqi %d\n", + phy_vars_ue->Mod_id,phy_vars_ue->dlsch_ue[eNB_id][0]->rnti, + phy_vars_ue->frame_rx,dlsch_subframe[dlsch_thread_index], + phy_vars_ue->dlsch_errors[eNB_id], + phy_vars_ue->dlsch_received[eNB_id], + phy_vars_ue->dlsch_fer[eNB_id], + phy_vars_ue->PHY_measurements.wideband_cqi_tot[eNB_id]); + } + } else { + LOG_I( PHY,"[UE %d][PDSCH ?/%d] Frame %d subframe %d: PDSCH/DLSCH decoding iter %d (phy_vars_ue->dlsch_ue[eNB_id][0] == 0)\n", + phy_vars_ue->Mod_id, + harq_pid, + phy_vars_ue->frame_rx, dlsch_subframe[dlsch_thread_index], ret ); } #endif diff --git a/targets/SIMU/USER/oaisim_functions.c b/targets/SIMU/USER/oaisim_functions.c index a1fda46114..7b10023be0 100644 --- a/targets/SIMU/USER/oaisim_functions.c +++ b/targets/SIMU/USER/oaisim_functions.c @@ -803,7 +803,7 @@ void check_and_adjust_params(void) NB_eNB_INST = oai_emulation.info.nb_enb_local + oai_emulation.info.nb_enb_remote; NB_RN_INST = oai_emulation.info.nb_rn_local + oai_emulation.info.nb_rn_remote; -#if defined(ENABLE_PDCP_NETLINK_FIFO) && defined(OPENAIR2) +#if defined(USE_PDCP_NETLINK_QUEUES) && defined(OPENAIR2) pdcp_netlink_init(); #endif @@ -1317,64 +1317,65 @@ void update_otg_eNB(module_id_t enb_module_idP, unsigned int ctime) // MBSM multicast traffic if (ctime >= 500 ) {// only generate when UE can receive MTCH (need to control this value) - for (service_id = 0; service_id < 2 ; service_id++) { //maxServiceCount - for (session_id = 0; session_id < 2; session_id++) { // maxSessionPerPMCH - if (pdcp_mbms_array_eNB[enb_module_idP][service_id][session_id].instanciated_instance == TRUE) { // this service/session is configured - - otg_pkt = malloc (sizeof(Packet_otg_elt_t)); - // LOG_T(OTG,"multicast packet gen for (service/mch %d, session/lcid %d, rb_id %d)\n", service_id, session_id, service_id*maxSessionPerPMCH + session_id); - rb_id = pdcp_mbms_array_eNB[enb_module_idP][service_id][session_id].rb_id; - (otg_pkt->otg_pkt).sdu_buffer = (uint8_t*) packet_gen_multicast(enb_module_idP, session_id, ctime, &((otg_pkt->otg_pkt).sdu_buffer_size)); - - if ((otg_pkt->otg_pkt).sdu_buffer != NULL) { - (otg_pkt->otg_pkt).rb_id = rb_id; - (otg_pkt->otg_pkt).module_id = enb_module_idP; - (otg_pkt->otg_pkt).dst_id = session_id; - (otg_pkt->otg_pkt).is_ue = FALSE; - //Adding the packet to the OTG-PDCP buffer - (otg_pkt->otg_pkt).mode = PDCP_TRANSMISSION_MODE_TRANSPARENT; - pkt_list_add_tail_eurecom(otg_pkt, &(otg_pdcp_buffer[enb_module_idP])); - LOG_I(EMU, "[eNB %d] ADD packet (%p) multicast to OTG buffer for dst %d on rb_id %d\n", - (otg_pkt->otg_pkt).module_id, otg_pkt, (otg_pkt->otg_pkt).dst_id,(otg_pkt->otg_pkt).rb_id); - } else { - //LOG_I(EMU, "OTG returns null \n"); + for (service_id = 0; service_id < 2 ; service_id++) { //maxServiceCount + for (session_id = 0; session_id < 2; session_id++) { // maxSessionPerPMCH + if (pdcp_mbms_array_eNB[enb_module_idP][service_id][session_id].instanciated_instance == TRUE) { // this service/session is configured + + otg_pkt = malloc (sizeof(Packet_otg_elt_t)); + // LOG_T(OTG,"multicast packet gen for (service/mch %d, session/lcid %d, rb_id %d)\n", service_id, session_id, service_id*maxSessionPerPMCH + session_id); + rb_id = pdcp_mbms_array_eNB[enb_module_idP][service_id][session_id].rb_id; + (otg_pkt->otg_pkt).sdu_buffer = (uint8_t*) packet_gen_multicast(enb_module_idP, session_id, ctime, &((otg_pkt->otg_pkt).sdu_buffer_size)); + + if ((otg_pkt->otg_pkt).sdu_buffer != NULL) { + (otg_pkt->otg_pkt).rb_id = rb_id; + (otg_pkt->otg_pkt).module_id = enb_module_idP; + (otg_pkt->otg_pkt).dst_id = session_id; + (otg_pkt->otg_pkt).is_ue = FALSE; + //Adding the packet to the OTG-PDCP buffer + (otg_pkt->otg_pkt).mode = PDCP_TRANSMISSION_MODE_TRANSPARENT; + pkt_list_add_tail_eurecom(otg_pkt, &(otg_pdcp_buffer[enb_module_idP])); + LOG_I(EMU, "[eNB %d] ADD packet (%p) multicast to OTG buffer for dst %d on rb_id %d\n", + (otg_pkt->otg_pkt).module_id, otg_pkt, (otg_pkt->otg_pkt).dst_id,(otg_pkt->otg_pkt).rb_id); + } else { + //LOG_I(EMU, "OTG returns null \n"); + free(otg_pkt); + otg_pkt=NULL; + } + + + // old version + /* // MBSM multicast traffic + #ifdef Rel10 + if (frame >= 46) {// only generate when UE can receive MTCH (need to control this value) + for (service_id = 0; service_id < 2 ; service_id++) { //maxServiceCount + for (session_id = 0; session_id < 2; session_id++) { // maxSessionPerPMCH + // LOG_I(OTG,"DUY:frame %d, pdcp_mbms_array[module_id][rb_id].instanciated_instance is %d\n",frame,pdcp_mbms_array[module_id][service_id*maxSessionPerPMCH + session_id].instanciated_instance); + if ((pdcp_mbms_array[module_idP][service_id*maxSessionPerPMCH + session_id].instanciated_instance== module_idP + 1) && (eNB_flag == 1)){ // this service/session is configured + // LOG_T(OTG,"multicast packet gen for (service/mch %d, session/lcid %d)\n", service_id, session_id); + // Duy add + LOG_I(OTG, "frame %d, multicast packet gen for (service/mch %d, session/lcid %d, rb_id %d)\n",frame, service_id, session_id,service_id*maxSessionPerPMCH + session_id); + // end Duy add + rb_id = pdcp_mbms_array[module_id][service_id*maxSessionPerPMCH + session_id].rb_id; + otg_pkt=(uint8_t*) packet_gen_multicast(module_idP, session_id, ctime, &pkt_size); + if (otg_pkt != NULL) { + LOG_D(OTG,"[eNB %d] sending a multicast packet from module %d on rab id %d (src %d, dst %d) pkt size %d\n", eNB_index, module_idP, rb_id, module_idP, session_id, pkt_size); + pdcp_data_req(module_id, frame, eNB_flag, rb_id, RLC_MUI_UNDEFINED, RLC_SDU_CONFIRM_NO, pkt_size, otg_pkt,PDCP_TM); free(otg_pkt); - otg_pkt=NULL; - } - - - // old version - /* // MBSM multicast traffic - #ifdef Rel10 - if (frame >= 46) {// only generate when UE can receive MTCH (need to control this value) - for (service_id = 0; service_id < 2 ; service_id++) { //maxServiceCount - for (session_id = 0; session_id < 2; session_id++) { // maxSessionPerPMCH - // LOG_I(OTG,"DUY:frame %d, pdcp_mbms_array[module_id][rb_id].instanciated_instance is %d\n",frame,pdcp_mbms_array[module_id][service_id*maxSessionPerPMCH + session_id].instanciated_instance); - if ((pdcp_mbms_array[module_idP][service_id*maxSessionPerPMCH + session_id].instanciated_instance== module_idP + 1) && (eNB_flag == 1)){ // this service/session is configured - // LOG_T(OTG,"multicast packet gen for (service/mch %d, session/lcid %d)\n", service_id, session_id); - // Duy add - LOG_I(OTG, "frame %d, multicast packet gen for (service/mch %d, session/lcid %d, rb_id %d)\n",frame, service_id, session_id,service_id*maxSessionPerPMCH + session_id); - // end Duy add - rb_id = pdcp_mbms_array[module_id][service_id*maxSessionPerPMCH + session_id].rb_id; - otg_pkt=(uint8_t*) packet_gen_multicast(module_idP, session_id, ctime, &pkt_size); - if (otg_pkt != NULL) { - LOG_D(OTG,"[eNB %d] sending a multicast packet from module %d on rab id %d (src %d, dst %d) pkt size %d\n", eNB_index, module_idP, rb_id, module_idP, session_id, pkt_size); - pdcp_data_req(module_id, frame, eNB_flag, rb_id, RLC_MUI_UNDEFINED, RLC_SDU_CONFIRM_NO, pkt_size, otg_pkt,PDCP_TM); - free(otg_pkt); - } - } - } - } - } // end multicast traffic - #endif - */ + } + } + } + } + } // end multicast traffic + #endif + */ + } } } - } } // end multicast traffic + #endif } -- GitLab