diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 3dbb61b5ae..b24db90edb 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -241,6 +241,7 @@ add_boolean_option(UE_AUTOTEST_TRACE False "Activate UE autotest specific logs add_boolean_option(UE_DEBUG_TRACE False "Activate UE debug trace") add_boolean_option(UE_TIMING_TRACE False "Activate UE timing trace") add_boolean_option(DISABLE_LOG_X False "Deactivate all LOG_* macros") +add_boolean_option(USRP_REC_PLAY False "Enable USRP record playback mode") add_boolean_option(DEBUG_CONSOLE False "makes debugging easier, disables stdout/stderr buffering") @@ -1803,6 +1804,7 @@ add_executable(lte-softmodem-nos1 ${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c ${OPENAIR_TARGETS}/RT/USER/lte-ue.c ${OPENAIR_TARGETS}/RT/USER/lte-enb.c + ${OPENAIR_TARGETS}/RT/USER/lte-ru.c ${OPENAIR_TARGETS}/RT/USER/lte-softmodem.c ${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c ${OPENAIR_TARGETS}/SIMU/USER/init_lte.c @@ -1933,7 +1935,7 @@ add_executable(oaisim_nos1 ${x2ap_h} ${OPENAIR_BIN_DIR}/messages_xml.h ${OPENAIR_TARGETS}/RT/USER/lte-ue.c - ${OPENAIR_TARGETS}/RT/USER/lte-enb.c + ${OPENAIR_TARGETS}/RT/USER/lte-ru.c ${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c ${OPENAIR_TARGETS}/SIMU/USER/channel_sim.c ${OPENAIR_TARGETS}/SIMU/USER/init_lte.c diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai index d3a13c41c9..d625dfa159 100755 --- a/cmake_targets/build_oai +++ b/cmake_targets/build_oai @@ -66,6 +66,7 @@ UE_AUTOTEST_TRACE="False" UE_DEBUG_TRACE="False" UE_TIMING_TRACE="False" DISABLE_LOG_X="False" +USRP_REC_PLAY="False" BUILD_ECLIPSE=0 trap handle_ctrl_c INT @@ -158,6 +159,8 @@ Options Disable all LOG_* macros --build-eclipse Build eclipse project files. Paths are auto corrected by fixprj.sh +--usrp-recplay + Build for I/Q record-playback modes Usage (first build): oaisim (eNB + UE): ./build_oai -I --oaisim -x --install-system-files Eurecom EXMIMO + COTS UE : ./build_oai -I --eNB -x --install-system-files @@ -350,6 +353,10 @@ function main() { BUILD_TELNETSRV=1 echo_info "Build embedded telnet server" shift ;; + --usrp-recplay) + USRP_REC_PLAY="True" + echo_info "Enabling USRP record playback mode" + shift 1;; -h | --help) print_help exit 1;; @@ -540,6 +547,7 @@ function main() { echo "set (UE_DEBUG_TRACE $UE_DEBUG_TRACE)" >> $cmake_file echo "set (UE_TIMING_TRACE $UE_TIMING_TRACE)" >> $cmake_file echo "set (DISABLE_LOG_X $DISABLE_LOG_X)" >> $cmake_file + echo "set (USRP_REC_PLAY $USRP_REC_PLAY)" >> $cmake_file if [ "$UE" = 1 -a "$NOS1" = "0" ] ; then echo_info "Compiling UE S1 build : enabling Linux and NETLINK" echo "set (LINUX True )" >> $cmake_file diff --git a/cmake_targets/oaisim_noS1_build_oai/CMakeLists.template b/cmake_targets/oaisim_noS1_build_oai/CMakeLists.template index 8e1670ea43..68be4b5b02 100644 --- a/cmake_targets/oaisim_noS1_build_oai/CMakeLists.template +++ b/cmake_targets/oaisim_noS1_build_oai/CMakeLists.template @@ -36,7 +36,7 @@ set ( MESSAGE_CHART_GENERATOR_PHY False ) set ( MIH_C_MEDIEVAL_EXTENSIONS False ) set ( MSG_PRINT False ) set ( MU_RECEIVER False ) -set ( NAS_ADDRESS_FIX True ) +set ( NAS_ADDRESS_FIX False ) set ( NAS_BUILT_IN_UE False) set ( NAS_MME False ) set ( NAS_UE False ) diff --git a/cmake_targets/tools/init_nas_nos1 b/cmake_targets/tools/init_nas_nos1 index 9bcaa0afb5..f7347e5508 100755 --- a/cmake_targets/tools/init_nas_nos1 +++ b/cmake_targets/tools/init_nas_nos1 @@ -44,11 +44,11 @@ load_module $OPENAIR_DIR/targets/bin/nasmesh.ko if [ "$1" = "eNB" ]; then echo "bring up oai0 interface for enb" sudo ifconfig oai0 10.0.1.1 netmask 255.255.255.0 broadcast 10.0.1.255 - $OPENAIR_DIR/targets/bin/rb_tool -a -c0 -i0 -z0 -s 10.0.1.1 -t 10.0.1.9 -r 1 + $OPENAIR_DIR/targets/bin/rb_tool -a -c0 -i0 -z0 -s 10.0.1.1 -t 10.0.1.2 -r 1 else if [ "$1" = "UE" ]; then echo "bring up oai0 interface for UE" sudo ifconfig oai0 10.0.1.9 netmask 255.255.255.0 broadcast 10.0.1.255 - $OPENAIR_DIR/targets/bin/rb_tool -a -c0 -i0 -z0 -s 10.0.1.9 -t 10.0.1.1 -r 1 + $OPENAIR_DIR/targets/bin/rb_tool -a -c0 -i0 -z0 -s 10.0.1.2 -t 10.0.1.1 -r 1 fi fi diff --git a/common/config/config_cmdline.c b/common/config/config_cmdline.c index 42ea7259c3..cb24cc5222 100644 --- a/common/config/config_cmdline.c +++ b/common/config/config_cmdline.c @@ -52,9 +52,12 @@ char defbool[2]="1"; switch(cfgoptions->type) { case TYPE_STRING: - config_check_valptr(cfgoptions, (char **)(cfgoptions->strptr), sizeof(char *)); - config_check_valptr(cfgoptions, cfgoptions->strptr, strlen(tmpval+1)); - sprintf(*(cfgoptions->strptr), "%s",tmpval); + if (cfgoptions->numelt == 0 ) { + config_check_valptr(cfgoptions, cfgoptions->strptr, strlen(tmpval)+1); + sprintf(*(cfgoptions->strptr), "%s",tmpval); + } else { + sprintf( (char *)(cfgoptions->strptr), "%s",tmpval); + } printf_cmdl("[CONFIG] %s set to %s from command line\n", cfgoptions->optname, tmpval); optisset=1; break; diff --git a/common/config/config_load_configmodule.c b/common/config/config_load_configmodule.c index 8351d4d82c..ff66d22a1c 100644 --- a/common/config/config_load_configmodule.c +++ b/common/config/config_load_configmodule.c @@ -129,20 +129,21 @@ int i; /* default */ if (cfgparam == NULL) { - cfgparam = "libconfig:oaisoftmodem.conf"; + tmpflags = tmpflags | CONFIG_NOOOPT; + cfgparam = DEFAULT_CFGMODE ":" DEFAULT_CFGFILENAME; } /* parse the config parameters to set the config source */ i = sscanf(cfgparam,"%m[^':']:%ms",&cfgmode,&modeparams); if (i< 0) { fprintf(stderr,"[CONFIG] %s, %d, sscanf error parsing config source %s: %s\n", __FILE__, __LINE__,cfgparam, strerror(errno)); - cfgmode=strdup("libconfig"); - modeparams = strdup("oaisoftmodem.conf"); + cfgmode=strdup(DEFAULT_CFGMODE); + modeparams = strdup(DEFAULT_CFGFILENAME); } else if ( i == 1 ) { /* -O argument doesn't contain ":" separator, assume -O option, default cfgmode to libconfig with one parameter, the path to the configuration file */ modeparams=cfgmode; - cfgmode=strdup("libconfig"); + cfgmode=strdup(DEFAULT_CFGMODE); } cfgptr = malloc(sizeof(configmodule_interface_t)); diff --git a/common/config/config_load_configmodule.h b/common/config/config_load_configmodule.h index 71c642f680..76f074cd6c 100644 --- a/common/config/config_load_configmodule.h +++ b/common/config/config_load_configmodule.h @@ -46,6 +46,7 @@ #define CONFIG_DEBUGCMDLINE 4 // print command line processing messages #define CONFIG_HELP 8 // print help message #define CONFIG_ABORT 16 // config failed,abort execution +#define CONFIG_NOOOPT 32 // no -O option found when parsing command line typedef int(*configmodule_initfunc_t)(char *cfgP[],int numP); diff --git a/common/config/config_userapi.c b/common/config/config_userapi.c index ad2e355d52..4e49f2c56a 100644 --- a/common/config/config_userapi.c +++ b/common/config/config_userapi.c @@ -50,7 +50,11 @@ configmodule_interface_t *config_get_if(void) char * config_check_valptr(paramdef_t *cfgoptions, char **ptr, int length) { - printf_ptrs("-- %s 0x%08lx %i\n",cfgoptions->optname,(uintptr_t)(*ptr),length); + printf_ptrs("[CONFIG] %s ptr: 0x%08lx requested size: %i\n",cfgoptions->optname,(uintptr_t)(ptr),length); + if(cfgoptions->numelt > 0) { /* already allocated */ + return *ptr; + } + if (*ptr == NULL) { *ptr = malloc(length); if ( *ptr != NULL) { @@ -147,3 +151,7 @@ int config_isparamset(paramdef_t *params,int paramidx) return 0; } } + +int config_getparamval_fromparamdefidx(paramdef_t *cfgoptions,int paramidx) { + return -1; +} diff --git a/common/config/config_userapi.h b/common/config/config_userapi.h index 6acaacf716..5bbc20a950 100644 --- a/common/config/config_userapi.h +++ b/common/config/config_userapi.h @@ -38,6 +38,9 @@ extern "C" { #endif +#define DEFAULT_CFGFILENAME "oaisoftmodem.conf" +#define DEFAULT_CFGMODE "libconfig" + #define CONFIG_GETSOURCE ( (config_get_if()==NULL) ? NULL : config_get_if()->cfgmode ) #define CONFIG_GETNUMP ( (config_get_if()==NULL) ? 0 : config_get_if()->num_cfgP ) #define CONFIG_GETP(P) ( (config_get_if()==NULL) ? NULL : config_get_if()->cfgP[P] ) @@ -51,6 +54,7 @@ extern int config_get(paramdef_t *params,int numparams, char *prefix); extern int config_isparamset(paramdef_t *params,int paramidx); extern void config_assign_int(paramdef_t *cfgoptions, char *fullname, int val); extern int config_process_cmdline(paramdef_t *cfgoptions,int numoptions, char *prefix); +extern int config_getparamval_fromparamdefidx(paramdef_t *cfgoptions,int paramidx); #define config_getlist config_get_if()->getlist #define CONFIG_GETCONFFILE (config_get_if()->cfgP[0]) diff --git a/common/config/libconfig/config_libconfig.c b/common/config/libconfig/config_libconfig.c index 35a70dfcc7..00f5f38b8f 100644 --- a/common/config/libconfig/config_libconfig.c +++ b/common/config/libconfig/config_libconfig.c @@ -104,17 +104,28 @@ int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix ) cfgpath,str,cfgoptions[i].numelt); str[strlen(str)-1] = 0; } - config_check_valptr(&(cfgoptions[i]), (char **)(&(cfgoptions[i].strptr)), sizeof(char *)); - config_check_valptr(&(cfgoptions[i]), cfgoptions[i].strptr, strlen(str)+1); - sprintf( *(cfgoptions[i].strptr) , "%s", str); - printf_params("[LIBCONFIG] %s: %s\n", cfgpath,*(cfgoptions[i].strptr) ); + if (cfgoptions[i].numelt == 0 ) { + config_check_valptr(&(cfgoptions[i]), (char **)(&(cfgoptions[i].strptr)), sizeof(char *)); + config_check_valptr(&(cfgoptions[i]), cfgoptions[i].strptr, strlen(str)+1); + sprintf( *(cfgoptions[i].strptr) , "%s", str); + printf_params("[LIBCONFIG] %s: %s\n", cfgpath,*(cfgoptions[i].strptr) ); + } else { + sprintf( (char *)(cfgoptions[i].strptr) , "%s", str); + printf_params("[LIBCONFIG] %s: %s\n", cfgpath,(char *)cfgoptions[i].strptr ); + } } else { if( cfgoptions[i].defstrval != NULL) { defval=1; - config_check_valptr(&(cfgoptions[i]), (char **)(&(cfgoptions[i].strptr)), sizeof(char *)); - config_check_valptr(&(cfgoptions[i]), cfgoptions[i].strptr, strlen(cfgoptions[i].defstrval)+1); - sprintf(*(cfgoptions[i].strptr), "%s",cfgoptions[i].defstrval); - printf_params("[LIBCONFIG] %s set to default value %s\n", cfgpath, *(cfgoptions[i].strptr)); + + if (cfgoptions[i].numelt == 0 ) { + config_check_valptr(&(cfgoptions[i]), (char **)(&(cfgoptions[i].strptr)), sizeof(char *)); + config_check_valptr(&(cfgoptions[i]), cfgoptions[i].strptr, strlen(cfgoptions[i].defstrval)+1); + sprintf(*(cfgoptions[i].strptr), "%s",cfgoptions[i].defstrval); + printf_params("[LIBCONFIG] %s set to default value %s\n", cfgpath, *(cfgoptions[i].strptr)); + } else { + sprintf((char *)(cfgoptions[i].strptr), "%s",cfgoptions[i].defstrval); + printf_params("[LIBCONFIG] %s set to default value %s\n", cfgpath, (char *)cfgoptions[i].strptr); + } } else { notfound=1; } @@ -183,7 +194,7 @@ int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix ) read_intarray(&cfgoptions[i],setting,cfgpath); } else { if( cfgoptions[i].defintarrayval != NULL) { - config_check_valptr(&(cfgoptions[i]),(char **)&(cfgoptions[i].iptr), sizeof(int32_t)); + config_check_valptr(&(cfgoptions[i]),(char **)&(cfgoptions[i].iptr), sizeof(int32_t*)); cfgoptions[i].iptr=cfgoptions[i].defintarrayval; defval=1; for (int j=0; jpdcch_vars[0][eNB_id]->crnti, phy_vars_ue->pdcch_vars[1][eNB_id]->crnti); + } void phy_config_cba_rnti (module_id_t Mod_id,int CC_id,eNB_flag_t eNB_flag, uint8_t index, rnti_t cba_rnti, uint8_t cba_group_id, uint8_t num_active_cba_groups) diff --git a/openair1/PHY/LTE_TRANSPORT/dci.c b/openair1/PHY/LTE_TRANSPORT/dci.c index 1bea8db59a..eac5c53175 100755 --- a/openair1/PHY/LTE_TRANSPORT/dci.c +++ b/openair1/PHY/LTE_TRANSPORT/dci.c @@ -2257,7 +2257,7 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols, y[0] = &yseq0[0]; y[1] = &yseq1[0]; -#if 0 +#if 1 // reset all bits to , here we set elements as 2 // memset(e, 2, DCI_BITS_MAX); // here we interpret NIL as a random QPSK sequence. That makes power estimation easier. @@ -2268,7 +2268,7 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols, /* clear all bits, the above code may generate too much false detections * (not sure about this, to be checked somehow) */ - memset(e, 0, DCI_BITS_MAX); + // memset(e, 0, DCI_BITS_MAX); e_ptr = e; @@ -3095,8 +3095,8 @@ uint16_t dci_CRNTI_decoding_procedure(PHY_VARS_UE *ue, mi, ((ue->decode_SIB == 1) ? SI_RNTI : 0), ra_rnti, - P_RNTI, - agregationLevel, + P_RNTI, + agregationLevel, format1A, format1A, format1A, @@ -3114,7 +3114,7 @@ uint16_t dci_CRNTI_decoding_procedure(PHY_VARS_UE *ue, ((format0_found==1)&&(format_c_found==1))) return(dci_cnt); - if (DCIFormat == 1) + if (DCIFormat == format1) { if ((tmode < 3) || (tmode == 7)) { //printf("Crnti decoding frame param agregation %d DCI %d \n",agregationLevel,DCIFormat); @@ -3157,14 +3157,14 @@ uint16_t dci_CRNTI_decoding_procedure(PHY_VARS_UE *ue, //printf("Crnti 1 decoding frame param agregation %d DCI %d \n",agregationLevel,DCIFormat); } - else + else if (DCIFormat == format1A) { AssertFatal(0,"Other Transmission mode not yet coded\n"); } } else { - AssertFatal(0,"DCI format %d not yet implemented \n",DCIFormat); + LOG_W(PHY,"DCI format %d wrong or not yet implemented \n",DCIFormat); } return(dci_cnt); @@ -3388,7 +3388,7 @@ uint16_t dci_decoding_procedure(PHY_VARS_UE *ue, if (do_common == 1) { #ifdef DEBUG_DCI_DECODING - printf("[DCI search] doing common search/format0 aggregation 4\n"); + printf("[DCI search] subframe %d: doing common search/format0 aggregation 4\n",subframe); #endif if (ue->prach_resources[eNB_id]) diff --git a/openair1/PHY/LTE_TRANSPORT/dci_tools.c b/openair1/PHY/LTE_TRANSPORT/dci_tools.c index 97a9709df5..ff29f9429d 100644 --- a/openair1/PHY/LTE_TRANSPORT/dci_tools.c +++ b/openair1/PHY/LTE_TRANSPORT/dci_tools.c @@ -4988,10 +4988,10 @@ void compute_llr_offset(LTE_DL_FRAME_PARMS *frame_parms, if(symbol < (frame_parms->symbols_per_tti-1)) pdsch_vars->llr_offset[symbol+1] = pdsch_vars->llr_offset[symbol] + llr_offset; - //LOG_I(PHY,"Granted Re subframe %d / symbol %d => %d (%d RBs)\n", subframe, symbol_mod, granted_re,dlsch0_harq->nb_rb); - //LOG_I(PHY,"Pbch/PSS/SSS Re subframe %d / symbol %d => %d \n", subframe, symbol_mod, pbch_pss_sss_re); - //LOG_I(PHY,"CRS Re Per PRB subframe %d / symbol %d => %d \n", subframe, symbol_mod, crs_re); - //LOG_I(PHY,"Data Re subframe %d / symbol %d => %d \n", subframe, symbol_mod, data_re); + // LOG_I(PHY,"Granted Re subframe %d / symbol %d => %d (%d RBs)\n", subframe, symbol_mod, granted_re,dlsch0_harq->nb_rb); + // LOG_I(PHY,"Pbch/PSS/SSS Re subframe %d / symbol %d => %d \n", subframe, symbol_mod, pbch_pss_sss_re); + // LOG_I(PHY,"CRS Re Per PRB subframe %d / symbol %d => %d \n", subframe, symbol_mod, crs_re); + // LOG_I(PHY,"Data Re subframe %d / symbol %d => %d \n", subframe, symbol_mod, data_re); @@ -5028,7 +5028,6 @@ void prepare_dl_decoding_format1_1A(DCI_format_t dci_format, uint8_t NPRB = 0; uint8_t NPRB4TBS = 0; - uint8_t nb_rb_alloc = 0; if(dci_format == format1A) { @@ -5070,14 +5069,12 @@ void prepare_dl_decoding_format1_1A(DCI_format_t dci_format, } */ - nb_rb_alloc = NPRB; } } else // format1 { NPRB = conv_nprb(rah, rballoc, N_RB_DL); NPRB4TBS=NPRB; - nb_rb_alloc = NPRB; } pdlsch0->current_harq_pid = harq_pid; @@ -5178,7 +5175,6 @@ void prepare_dl_decoding_format1_1A(DCI_format_t dci_format, pdlsch0_harq->rb_alloc_even[1] = localRIV2alloc_LUT50_1[rballoc]; pdlsch0_harq->rb_alloc_odd[0] = localRIV2alloc_LUT50_0[rballoc]; pdlsch0_harq->rb_alloc_odd[1] = localRIV2alloc_LUT50_1[rballoc]; - printf("rballoc: %08x.%08x\n",pdlsch0_harq->rb_alloc_even[0],pdlsch0_harq->rb_alloc_even[1]); } else { // DISTRIBUTED if ((rballoc&(1<<10)) == 0) { rballoc = rballoc&(~(1<<10)); @@ -5260,7 +5256,7 @@ void prepare_dl_decoding_format1_1A(DCI_format_t dci_format, pdcch_vars, pdsch_vars, pdlsch0_harq, - nb_rb_alloc, + NPRB, subframe); } @@ -6492,7 +6488,7 @@ uint8_t pdcch_alloc2ul_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint8_t n) else ul_subframe = ((n+4)%10); - if (subframe_select(frame_parms,ul_subframe) != SF_UL) return(255); + // AssertFatal(frame_parms->frame_type == FDD || subframe_select(frame_parms,ul_subframe) == SF_UL,"illegal ul_subframe %d (n %d)\n",ul_subframe,n); LOG_D(PHY, "subframe %d: PUSCH subframe = %d\n", n, ul_subframe); return ul_subframe; @@ -7193,6 +7189,10 @@ int generate_ue_ulsch_params_from_dci(void *dci_pdu, harq_pid = subframe2harq_pid(frame_parms, pdcch_alloc2ul_frame(frame_parms,proc->frame_rx,subframe), pdcch_alloc2ul_subframe(frame_parms,subframe)); + LOG_D(PHY,"Frame %d, Subframe %d: Programming ULSCH for (%d.%d) => harq_pid %d\n", + proc->frame_rx,subframe, + pdcch_alloc2ul_frame(frame_parms,proc->frame_rx,subframe), + pdcch_alloc2ul_subframe(frame_parms,subframe), harq_pid); if (harq_pid == 255) { LOG_E(PHY, "frame %d, subframe %d, rnti %x, format %d: illegal harq_pid!\n", @@ -7985,7 +7985,7 @@ int generate_ue_ulsch_params_from_dci(void *dci_pdu, dlsch[0]->harq_ack[subframe].vDAI_UL = dai+1; - /*LOG_I(PHY, "[PUSCH %d] Format0 DCI %s, CQI_req=%d, cshift=%d, TPC=%d, DAI=%d, vDAI_UL[sf#%d]=%d, NDI=%d, MCS=%d, RBalloc=%d, first_rb=%d, harq_pid=%d, nb_rb=%d, subframe_scheduling_flag=%d" + LOG_D(PHY, "[PUSCH %d] Format0 DCI %s, CQI_req=%d, cshift=%d, TPC=%d, DAI=%d, vDAI_UL[sf#%d]=%d, NDI=%d, MCS=%d, RBalloc=%d, first_rb=%d, harq_pid=%d, nb_rb=%d, subframe_scheduling_flag=%d" " ulsch->bundling %d, O_ACK %d \n", harq_pid, (frame_parms->frame_type == TDD? "TDD" : "FDD"), @@ -7993,7 +7993,8 @@ int generate_ue_ulsch_params_from_dci(void *dci_pdu, ulsch->harq_processes[harq_pid]->first_rb, harq_pid, ulsch->harq_processes[harq_pid]->nb_rb, ulsch->harq_processes[harq_pid]->subframe_scheduling_flag, ulsch->bundling, - ulsch->harq_processes[harq_pid]->O_ACK);*/ + ulsch->harq_processes[harq_pid]->O_ACK); + LOG_D(PHY,"Setting beta_offset_cqi_times8 to %d, index %d\n", beta_cqi[ue->pusch_config_dedicated[eNB_id].betaOffset_CQI_Index], ue->pusch_config_dedicated[eNB_id].betaOffset_CQI_Index); @@ -8050,7 +8051,7 @@ int generate_ue_ulsch_params_from_dci(void *dci_pdu, #ifdef UE_DEBUG_TRACE - LOG_I(PHY,"Format 0 DCI : ulsch (ue): AbsSubframe %d.%d\n",proc->frame_rx%1024,subframe); + LOG_D(PHY,"Format 0 DCI : ulsch (ue): AbsSubframe %d.%d\n",proc->frame_rx%1024,subframe); LOG_D(PHY,"Format 0 DCI : ulsch (ue): NBRB %d\n",ulsch->harq_processes[harq_pid]->nb_rb); LOG_D(PHY,"Format 0 DCI :ulsch (ue): first_rb %d\n",ulsch->harq_processes[harq_pid]->first_rb); LOG_D(PHY,"Format 0 DCI :ulsch (ue): rballoc %d\n",rballoc); diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c b/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c index f53e83dbaf..ed9719f2b2 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c @@ -849,18 +849,20 @@ int rx_pdsch(PHY_VARS_UE *ue, pllr_symbol_cw1 = (int8_t*)pdsch_vars[eNB_id]->llr[1]; pllr_symbol_cw0 += llr_offset_symbol; pllr_symbol_cw1 += llr_offset_symbol; - - /*LOG_I(PHY,"compute LLRs [AbsSubframe %d.%d-%d] NbRB %d Qm %d LLRs-Length %d LLR-Offset %d @LLR Buff %x @LLR Buff(symb) %x\n", - proc->frame_rx, proc->subframe_rx,symbol, + /* + LOG_I(PHY,"compute LLRs [AbsSubframe %d.%d-%d] NbRB %d Qm %d LLRs-Length %d LLR-Offset %d @LLR Buff %x @LLR Buff(symb) %x\n", + frame, subframe,symbol, nb_rb,dlsch0_harq->Qm, pdsch_vars[eNB_id]->llr_length[symbol], pdsch_vars[eNB_id]->llr_offset[symbol], (int16_t*)pdsch_vars[eNB_id]->llr[0], - pllr_symbol);*/ - + pllr_symbol_cw0); + */ switch (dlsch0_harq->Qm) { case 2 : if ((rx_type==rx_standard) || (codeword_TB1 == -1)) { + + dlsch_qpsk_llr(frame_parms, pdsch_vars[eNB_id]->rxdataF_comp0, (int16_t*)pllr_symbol_cw0, diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_llr_computation.c b/openair1/PHY/LTE_TRANSPORT/dlsch_llr_computation.c index 8ea922b85c..46689a9aaa 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_llr_computation.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_llr_computation.c @@ -672,14 +672,14 @@ int dlsch_qpsk_llr(LTE_DL_FRAME_PARMS *frame_parms, } - //printf("dlsch_qpsk_llr: symbol %d,nb_rb %d, len %d,pbch_pss_sss_adjust %d\n",symbol,nb_rb,len,pbch_pss_sss_adjust); - /*LOG_I(PHY,"dlsch_qpsk_llr: [symb %d / FirstSym %d / Length %d]: @LLR Buff %x, @LLR Buff(symb) %x \n", + /* + LOG_I(PHY,"dlsch_qpsk_llr: [symb %d / FirstSym %d / Length %d]: @LLR Buff %x, @LLR Buff(symb) %x \n", symbol, first_symbol_flag, len, dlsch_llr, - llr32);*/ - + llr32); + */ //printf("ll32p=%p , dlsch_llr=%p, symbol=%d, flag=%d \n", llr32, dlsch_llr, symbol, first_symbol_flag); for (i=0; iifdevice.trx_write_func(&ru->ifdevice, symbol_id, &tx_buffer, - db_fulllength, + db_fulllength, 1, IF4p5_PDLFFT)) < 0) { perror("ETHERNET write for IF4p5_PDLFFT\n"); @@ -138,19 +138,18 @@ void send_IF4p5(RU_t *ru, int frame, int subframe, uint16_t packet_type) { if (packet_type == IF4p5_PULFFT) { - uint16_t *rx0 = (uint16_t*) &rxdataF[0][blockoffsetF]; - uint16_t *rx1 = (uint16_t*) &rxdataF[0][slotoffsetF]; + for (symbol_id=fp->symbols_per_tti-nsym; symbol_idsymbols_per_tti; symbol_id++) { + uint32_t *rx0 = (uint32_t*) &rxdataF[0][blockoffsetF]; + uint32_t *rx1 = (uint32_t*) &rxdataF[0][slotoffsetF]; - for (symbol_id=fp->symbols_per_tti-nsym; symbol_idsymbols_per_tti; symbol_id++) { - VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_SEND_IF4_SYMBOL, symbol_id ); + VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_SEND_IF4_SYMBOL, symbol_id ); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_COMPR_IF, 1 ); - start_meas(&ru->compression); - for (element_id=0; element_idcompression); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_COMPR_IF, 0 ); - packet_header->frame_status &= ~(0x000f<<26); - packet_header->frame_status |= (symbol_id&0x000f)<<26; + packet_header->frame_status &= ~(0x000f<<26); + packet_header->frame_status |= (symbol_id&0x000f)<<26; VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE_IF, 1 ); - start_meas(&ru->transport); + start_meas(&ru->transport); if ((ru->ifdevice.trx_write_func(&ru->ifdevice, symbol_id, &tx_buffer, @@ -188,7 +187,7 @@ void send_IF4p5(RU_t *ru, int frame, int subframe, uint16_t packet_type) { IF4p5_PULFFT)) < 0) { perror("ETHERNET write for IF4p5_PULFFT\n"); } - stop_meas(&ru->transport); + stop_meas(&ru->transport); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE_IF, 0 ); slotoffsetF += fp->ofdm_symbol_size; blockoffsetF += fp->ofdm_symbol_size; @@ -351,6 +350,9 @@ void recv_IF4p5(RU_t *ru, int *frame, int *subframe, uint16_t *packet_type, uint //if (element_id==0) LOG_I(PHY,"recv_if4p5: symbol %d rxdata0 = (%u,%u)\n",*symbol_number,*i,*(i+1)); } + LOG_D(PHY,"PULFFT_IF4p5: CC_id %d : frame %d, subframe %d (symbol %d)=> %d dB\n",ru->idx,*frame,*subframe,*symbol_number, + dB_fixed(signal_energy((int*)&rxdataF[0][slotoffsetF],db_halflength)+ + signal_energy((int*)&rxdataF[0][blockoffsetF],db_halflength))); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_DECOMPR_IF, 0 ); } else if (*packet_type >= IF4p5_PRACH && *packet_type <= IF4p5_PRACH + 4) { diff --git a/openair1/PHY/LTE_TRANSPORT/pucch.c b/openair1/PHY/LTE_TRANSPORT/pucch.c index 61d2cc0e9b..c8da27bcb8 100644 --- a/openair1/PHY/LTE_TRANSPORT/pucch.c +++ b/openair1/PHY/LTE_TRANSPORT/pucch.c @@ -1871,6 +1871,23 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB, eNB->pucch1ab_stats_cnt[j][i]=0; } } +#if defined(USRP_REC_PLAY) + // It's probably bad to do this statically only once. + // Looks like the above is incomplete. + // Such reset needs to be done once a UE PHY structure is being used/re-used + // Don't know if this is ever possible in current architecture + for (i=0;i<10240;i++) { + for (j=0;jpucch1_stats[j][i]=0; + eNB->pucch1_stats_thres[j][i]=0; + } + } + for (i=0;i<20480;i++) { + for (j=0;jpucch1ab_stats[j][i]=0; + } + } +#endif first_call=0; } @@ -2152,8 +2169,9 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB, } //phase // stat_max *= nsymb; // normalize to energy per symbol -// stat_max /= (frame_parms->N_RB_UL*12); // +// stat_max /= (frame_parms->N_RB_UL*12); // stat_max /= (nsymb*12); + #ifdef DEBUG_PUCCH_RX printf("[eNB] PUCCH: stat %d, stat_max %d, phase_max %d\n", stat,stat_max,phase_max); #endif @@ -2289,8 +2307,13 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB, stat_im=0; // Do detection now +#if defined(USRP_REC_PLAY) + // It looks like the value is a bit messy when RF is replayed. + // For instance i assume to skip pucch1_thres from the test below. + if (sigma2_dB<(dB_fixed(stat_max))) {// +#else if (sigma2_dB<(dB_fixed(stat_max)-pucch1_thres)) {// - +#endif chL = (nsymb>>1)-4; chest_mag=0; cfo = (frame_parms->Ncp==0) ? &cfo_pucch_np[14*phase_max] : &cfo_pucch_ep[12*phase_max]; @@ -2431,7 +2454,11 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB, if (fmt==pucch_format1b) *(1+payload) = (stat_im<0) ? 1 : 2; } else { // insufficient energy on PUCCH so NAK +#if defined(USRP_REC_PLAY) + LOG_I(PHY,"PUCCH 1a/b: NAK subframe %d : sigma2_dB %d, stat_max %d, pucch1_thres %d\n",subframe,sigma2_dB,dB_fixed(stat_max),pucch1_thres); +#else LOG_I(PHY,"PUCCH 1a/b: subframe %d : sigma2_dB %d, stat_max %d, pucch1_thres %d\n",subframe,sigma2_dB,dB_fixed(stat_max),pucch1_thres); +#endif *payload = 4; // DTX ((int16_t*)&eNB->pucch1ab_stats[UE_id][(subframe<<10) + (eNB->pucch1ab_stats_cnt[UE_id][subframe])])[0] = (int16_t)(stat_re); ((int16_t*)&eNB->pucch1ab_stats[UE_id][(subframe<<10) + (eNB->pucch1ab_stats_cnt[UE_id][subframe])])[1] = (int16_t)(stat_im); diff --git a/openair1/SCHED/fapi_l1.c b/openair1/SCHED/fapi_l1.c index 8aff92d485..e749a52a44 100644 --- a/openair1/SCHED/fapi_l1.c +++ b/openair1/SCHED/fapi_l1.c @@ -580,9 +580,14 @@ void schedule_response(Sched_Rsp_t *Sched_INFO) AssertFatal(RC.eNB[Mod_id]!=NULL,"RC.eNB[%d] is null\n",Mod_id); AssertFatal(RC.eNB[Mod_id][CC_id]!=NULL,"RC.eNB[%d][%d] is null\n",Mod_id,CC_id); + + eNB = RC.eNB[Mod_id][CC_id]; fp = &eNB->frame_parms; proc = &eNB->proc.proc_rxtx[0]; + + if ((fp->frame_type == TDD) && (subframe_select(fp,subframe)==SF_UL)) return; + ul_subframe = pdcch_alloc2ul_subframe(fp,subframe); ul_frame = pdcch_alloc2ul_frame(fp,frame,subframe); @@ -608,8 +613,9 @@ void schedule_response(Sched_Rsp_t *Sched_INFO) frame,subframe,ul_subframe,number_dl_pdu,TX_req->tx_request_body.number_of_pdus,number_hi_dci0_pdu,number_ul_pdu); - if (ul_subframe<10) { // This means that there is an ul_subframe that can be configured here - LOG_D(PHY,"NFAPI: Clearing dci allocations for potential UL\n"); + if ((ul_subframe<10)&& + (subframe_select(fp,ul_subframe)==SF_UL)) { // This means that there is an ul_subframe that can be configured here + LOG_D(PHY,"NFAPI: Clearing dci allocations for potential UL subframe %d\n",ul_subframe); harq_pid = subframe2harq_pid(fp,ul_frame,ul_subframe); // clear DCI allocation maps for new subframe diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c index d39d011669..098d15b6f7 100644 --- a/openair1/SCHED/phy_procedures_lte_eNb.c +++ b/openair1/SCHED/phy_procedures_lte_eNb.c @@ -404,6 +404,7 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB, int offset = eNB->CC_id;//proc == &eNB->proc.proc_rxtx[0] ? 0 : 1; + if ((fp->frame_type == TDD) && (subframe_select(fp,subframe)==SF_UL)) return; VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_ENB_TX+offset,1); @@ -437,7 +438,8 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB, } /* save old HARQ information needed for PHICH generation */ - if (ul_subframe < 10) { // This means that there is a potential UL subframe that will be scheduled here + if ((ul_subframe < 10)&& + (subframe_select(fp,ul_subframe)==SF_UL)) { // This means that there is a potential UL subframe that will be scheduled here for (i=0; iulsch[i]) { @@ -607,13 +609,14 @@ void prach_procedures(PHY_VARS_eNB *eNB, #endif ); - //#ifdef DEBUG_PHY_PROC - LOG_D(PHY,"[RAPROC] Frame %d, subframe %d : Most likely preamble %d, energy %d dB delay %d\n", + #ifdef DEBUG_PHY_PROC + LOG_D(PHY,"[RAPROC] Frame %d, subframe %d : Most likely preamble %d, energy %d dB delay %d (prach_energy counter %d)\n", frame,subframe, max_preamble[0], max_preamble_energy[0]/10, - max_preamble_delay[0]); - //q#endif + max_preamble_delay[0], + eNB->prach_energy_counter); + #endif #ifdef Rel14 if (br_flag==1) { @@ -665,7 +668,7 @@ void prach_procedures(PHY_VARS_eNB *eNB, if ((eNB->prach_energy_counter == 100) && (max_preamble_energy[0] > eNB->measurements.prach_I0+100)) { - LOG_D(PHY,"[eNB %d/%d][RAPROC] Frame %d, subframe %d Initiating RA procedure with preamble %d, energy %d.%d dB, delay %d\n", + LOG_I(PHY,"[eNB %d/%d][RAPROC] Frame %d, subframe %d Initiating RA procedure with preamble %d, energy %d.%d dB, delay %d\n", eNB->Mod_id, eNB->CC_id, frame, @@ -1374,13 +1377,14 @@ void pusch_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) fill_crc_indication(eNB,i,frame,subframe,1); // indicate NAK to MAC fill_rx_indication(eNB,i,frame,subframe); // indicate SDU to MAC - LOG_D(PHY,"[eNB %d][PUSCH %d] frame %d subframe %d UE %d Error receiving ULSCH, round %d/%d (ACK %d,%d)\n", + LOG_I(PHY,"[eNB %d][PUSCH %d] frame %d subframe %d UE %d Error receiving ULSCH, round %d/%d (ACK %d,%d)\n", eNB->Mod_id,harq_pid, frame,subframe, i, ulsch_harq->round-1, ulsch->Mlimit, ulsch_harq->o_ACK[0], ulsch_harq->o_ACK[1]); + if (ulsch_harq->round >= 3) { ulsch_harq->status = SCH_IDLE; ulsch_harq->handled = 0; diff --git a/openair1/SCHED/phy_procedures_lte_ue.c b/openair1/SCHED/phy_procedures_lte_ue.c index a1ad4c5375..9614d2d9e7 100644 --- a/openair1/SCHED/phy_procedures_lte_ue.c +++ b/openair1/SCHED/phy_procedures_lte_ue.c @@ -82,6 +82,7 @@ extern uint32_t downlink_frequency[MAX_NUM_CCs][4]; #endif +#define DEBUG_UE_TRACE 1 void dump_dlsch(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t subframe,uint8_t harq_pid) { @@ -1480,38 +1481,36 @@ void ue_prach_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin ue->tx_power_dBm[subframe_tx], dB_fixed(prach_power), ue->prach_vars[eNB_id]->amp); - } else { - UE_transport_info[ue->Mod_id][ue->CC_id].cntl.prach_flag=1; - UE_transport_info[ue->Mod_id][ue->CC_id].cntl.prach_id=ue->prach_resources[eNB_id]->ra_PreambleIndex; + + + + if (ue->mac_enabled==1){ + Msg1_transmitted(ue->Mod_id, + ue->CC_id, + frame_tx, + eNB_id); + } + + LOG_I(PHY,"[UE %d][RAPROC] Frame %d, subframe %d: Generating PRACH (eNB %d) preamble index %d for UL, TX power %d dBm (PL %d dB), l3msg \n", + ue->Mod_id,frame_tx,subframe_tx,eNB_id, + ue->prach_resources[eNB_id]->ra_PreambleIndex, + ue->prach_resources[eNB_id]->ra_PREAMBLE_RECEIVED_TARGET_POWER+get_PL(ue->Mod_id,ue->CC_id,eNB_id), + get_PL(ue->Mod_id,ue->CC_id,eNB_id)); + + + + // if we're calibrating the PRACH kill the pointer to its resources so that the RA protocol doesn't continue + if (mode == calib_prach_tx) + ue->prach_resources[eNB_id]=NULL; + + LOG_D(PHY,"[UE %d] frame %d subframe %d : generate_prach %d, prach_cnt %d\n", + ue->Mod_id,frame_tx,subframe_tx,ue->generate_prach,ue->prach_cnt); + + ue->prach_cnt++; + + if (ue->prach_cnt==3) + ue->generate_prach=0; } - - if (ue->mac_enabled==1){ - Msg1_transmitted(ue->Mod_id, - ue->CC_id, - frame_tx, - eNB_id); - } - - LOG_I(PHY,"[UE %d][RAPROC] Frame %d, subframe %d: Generating PRACH (eNB %d) preamble index %d for UL, TX power %d dBm (PL %d dB), l3msg \n", - ue->Mod_id,frame_tx,subframe_tx,eNB_id, - ue->prach_resources[eNB_id]->ra_PreambleIndex, - ue->prach_resources[eNB_id]->ra_PREAMBLE_RECEIVED_TARGET_POWER+get_PL(ue->Mod_id,ue->CC_id,eNB_id), - get_PL(ue->Mod_id,ue->CC_id,eNB_id)); - - - - // if we're calibrating the PRACH kill the pointer to its resources so that the RA protocol doesn't continue - if (mode == calib_prach_tx) - ue->prach_resources[eNB_id]=NULL; - - LOG_D(PHY,"[UE %d] frame %d subframe %d : generate_prach %d, prach_cnt %d\n", - ue->Mod_id,frame_tx,subframe_tx,ue->generate_prach,ue->prach_cnt); - - ue->prach_cnt++; - - if (ue->prach_cnt==3) - ue->generate_prach=0; - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_PRACH, VCD_FUNCTION_OUT); } @@ -1543,18 +1542,21 @@ void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB frame_tx, subframe_tx); + LOG_D(PHY,"Frame %d, Subframe %d : ue_uespec_procedures, harq_pid %d => subframe_scheduling %d\n", + frame_tx,subframe_tx,harq_pid, + ue->ulsch[eNB_id]->harq_processes[harq_pid]->subframe_scheduling_flag); if (ue->mac_enabled == 1) { - if ((ue->ulsch_Msg3_active[eNB_id] == 1) && - (ue->ulsch_Msg3_frame[eNB_id] == frame_tx) && - (ue->ulsch_Msg3_subframe[eNB_id] == subframe_tx)) { // Initial Transmission of Msg3 + if ((ue->ulsch_Msg3_active[eNB_id] == 1) && + (ue->ulsch_Msg3_frame[eNB_id] == frame_tx) && + (ue->ulsch_Msg3_subframe[eNB_id] == subframe_tx)) { // Initial Transmission of Msg3 ue->ulsch[eNB_id]->harq_processes[harq_pid]->subframe_scheduling_flag = 1; if (ue->ulsch[eNB_id]->harq_processes[harq_pid]->round==0) - generate_ue_ulsch_params_from_rar(ue, - proc, - eNB_id); + generate_ue_ulsch_params_from_rar(ue, + proc, + eNB_id); ue->ulsch[eNB_id]->power_offset = 14; LOG_D(PHY,"[UE %d][RAPROC] Frame %d: Setting Msg3_flag in subframe %d, for harq_pid %d\n", @@ -1697,7 +1699,7 @@ void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB #ifdef UE_DEBUG_TRACE - LOG_I(PHY, + LOG_D(PHY, "[UE %d][PUSCH %d] AbsSubframe %d.%d Generating PUSCH : first_rb %d, nb_rb %d, round %d, mcs %d, rv %d, " "cyclic_shift %d (cyclic_shift_common %d,n_DMRS2 %d,n_PRS %d), ACK (%d,%d), O_ACK %d, ack_status_cw0 %d ack_status_cw1 %d bundling %d, Nbundled %d, CQI %d, RI %d\n", Mod_id,harq_pid,frame_tx%1024,subframe_tx, @@ -1756,7 +1758,6 @@ void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB stop_meas(&ue->phy_proc_tx); printf("------FULL TX PROC : %5.2f ------\n",ue->phy_proc_tx.p_time/(cpuf*1000.0)); #endif - return; #if UE_TIMING_TRACE stop_meas(&ue->ulsch_encoding_stats); @@ -1867,7 +1868,7 @@ void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB T_INT(tx_amp),T_INT(ue->ulsch[eNB_id]->f_pusch),T_INT(get_PL(Mod_id,0,eNB_id)),T_INT(nb_rb)); #ifdef UE_DEBUG_TRACE - LOG_I(PHY,"[UE %d][PUSCH %d] AbsSubFrame %d.%d, generating PUSCH, Po_PUSCH: %d dBm (max %d dBm), amp %d\n", + LOG_D(PHY,"[UE %d][PUSCH %d] AbsSubFrame %d.%d, generating PUSCH, Po_PUSCH: %d dBm (max %d dBm), amp %d\n", Mod_id,harq_pid,frame_tx%1024,subframe_tx,ue->tx_power_dBm[subframe_tx],ue->tx_power_max_dBm, tx_amp); #endif #if UE_TIMING_TRACE @@ -1892,6 +1893,7 @@ void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB #if UE_TIMING_TRACE stop_meas(&ue->ulsch_modulation_stats); #endif + } if (abstraction_flag==1) { @@ -2228,20 +2230,20 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin #ifdef UE_DEBUG_TRACE if(format == pucch_format1) - { - LOG_I(PHY,"[UE %d][SR %x] AbsSubframe %d.%d Generating PUCCH 1 (SR for PUSCH), an_srs_simultanous %d, shorten_pucch %d, n1_pucch %d, Po_PUCCH %d\n", - Mod_id, - ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->rnti, - frame_tx%1024, subframe_tx, - frame_parms->soundingrs_ul_config_common.ackNackSRS_SimultaneousTransmission, - isShortenPucch, - ue->scheduling_request_config[eNB_id].sr_PUCCH_ResourceIndex, - Po_PUCCH); + { + LOG_D(PHY,"[UE %d][SR %x] AbsSubframe %d.%d Generating PUCCH 1 (SR for PUSCH), an_srs_simultanous %d, shorten_pucch %d, n1_pucch %d, Po_PUCCH %d\n", + Mod_id, + ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->rnti, + frame_tx%1024, subframe_tx, + frame_parms->soundingrs_ul_config_common.ackNackSRS_SimultaneousTransmission, + isShortenPucch, + ue->scheduling_request_config[eNB_id].sr_PUCCH_ResourceIndex, + Po_PUCCH); } else { if (SR_payload>0) { - LOG_I(PHY,"[UE %d][SR %x] AbsSubFrame %d.%d Generating PUCCH %s payload %d,%d (with SR for PUSCH), an_srs_simultanous %d, shorten_pucch %d, n1_pucch %d, Po_PUCCH %d, amp %d\n", + LOG_D(PHY,"[UE %d][SR %x] AbsSubFrame %d.%d Generating PUCCH %s payload %d,%d (with SR for PUSCH), an_srs_simultanous %d, shorten_pucch %d, n1_pucch %d, Po_PUCCH %d, amp %d\n", Mod_id, ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->rnti, frame_tx % 1024, subframe_tx, @@ -2254,7 +2256,7 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin Po_PUCCH, tx_amp); } else { - LOG_I(PHY,"[UE %d][PDSCH %x] AbsSubFrame %d.%d rx_offset_diff: %d, Generating PUCCH %s, an_srs_simultanous %d, shorten_pucch %d, n1_pucch %d, b[0]=%d,b[1]=%d (SR_Payload %d), Po_PUCCH %d, amp %d\n", + LOG_D(PHY,"[UE %d][PDSCH %x] AbsSubFrame %d.%d rx_offset_diff: %d, Generating PUCCH %s, an_srs_simultanous %d, shorten_pucch %d, n1_pucch %d, b[0]=%d,b[1]=%d (SR_Payload %d), Po_PUCCH %d, amp %d\n", Mod_id, ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->rnti, frame_tx%1024, subframe_tx,ue->rx_offset_diff, @@ -2321,7 +2323,7 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin T_INT(tx_amp),T_INT(ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->g_pucch),T_INT(get_PL(ue->Mod_id,ue->CC_id,eNB_id))); #endif #ifdef UE_DEBUG_TRACE - LOG_I(PHY,"[UE %d][RNTI %x] AbsSubFrame %d.%d Generating PUCCH 2 (RI or CQI), Po_PUCCH %d, isShortenPucch %d, amp %d\n", + LOG_D(PHY,"[UE %d][RNTI %x] AbsSubFrame %d.%d Generating PUCCH 2 (RI or CQI), Po_PUCCH %d, isShortenPucch %d, amp %d\n", Mod_id, ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->rnti, frame_tx%1024, subframe_tx, @@ -2411,6 +2413,8 @@ void phy_procedures_UE_TX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,ui ue_ulsch_uespec_procedures(ue,proc,eNB_id,abstraction_flag); + LOG_D(PHY,"ULPOWERS After ulsch_uespec_procedures : ue->tx_power_dBm[%d]=%d, NPRB %d\n", + subframe_tx,ue->tx_power_dBm[subframe_tx],ue->tx_total_RE[subframe_tx]); } if (ue->UE_mode[eNB_id] == PUSCH) { @@ -2934,24 +2938,24 @@ int ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint // we received a CRNTI, so we're in PUSCH if (ue->UE_mode[eNB_id] != PUSCH) { #ifdef DEBUG_PHY_PROC - LOG_I(PHY,"[UE %d] Frame %d, subframe %d: Received DCI with CRNTI %x => Mode PUSCH\n",ue->Mod_id,frame_rx,subframe_rx,ue->pdcch_vars[subframe_rx&1][eNB_id]->crnti); + LOG_D(PHY,"[UE %d] Frame %d, subframe %d: Received DCI with CRNTI %x => Mode PUSCH\n",ue->Mod_id,frame_rx,subframe_rx,ue->pdcch_vars[subframe_rx&1][eNB_id]->crnti); #endif //dump_dci(&ue->frame_parms, &dci_alloc_rx[i]); ue->UE_mode[eNB_id] = PUSCH; - - } else { + } + } else { LOG_E(PHY,"[UE %d] Frame %d, subframe %d: Problem in DCI!\n",ue->Mod_id,frame_rx,subframe_rx); dump_dci(&ue->frame_parms, &dci_alloc_rx[i]); } - } + } else if ((dci_alloc_rx[i].rnti == SI_RNTI) && ((dci_alloc_rx[i].format == format1A) || (dci_alloc_rx[i].format == format1C))) { #ifdef DEBUG_PHY_PROC - LOG_I(PHY,"[UE %d] subframe %d: Found rnti %x, format 1%s, dci_cnt %d\n",ue->Mod_id,subframe_rx,dci_alloc_rx[i].rnti,dci_alloc_rx[i].format==format1A?"A":"C",i); + LOG_D(PHY,"[UE %d] subframe %d: Found rnti %x, format 1%s, dci_cnt %d\n",ue->Mod_id,subframe_rx,dci_alloc_rx[i].rnti,dci_alloc_rx[i].format==format1A?"A":"C",i); #endif if (generate_ue_dlsch_params_from_dci(frame_rx, @@ -2972,18 +2976,17 @@ int ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint ue->dlsch_SI_received[eNB_id]++; - LOG_I(PHY,"[UE %d] Frame %d, subframe %d : Generate UE DLSCH SI_RNTI format 1%s\n",ue->Mod_id,frame_rx,subframe_rx,dci_alloc_rx[i].format==format1A?"A":"C"); + LOG_D(PHY,"[UE %d] Frame %d, subframe %d : Generate UE DLSCH SI_RNTI format 1%s\n",ue->Mod_id,frame_rx,subframe_rx,dci_alloc_rx[i].format==format1A?"A":"C"); //dump_dci(&ue->frame_parms, &dci_alloc_rx[i]); } } - } else if ((dci_alloc_rx[i].rnti == P_RNTI) && ((dci_alloc_rx[i].format == format1A) || (dci_alloc_rx[i].format == format1C))) { #ifdef DEBUG_PHY_PROC - LOG_I(PHY,"[UE %d] subframe %d: Found rnti %x, format 1%s, dci_cnt %d\n",ue->Mod_id,subframe_rx,dci_alloc_rx[i].rnti,dci_alloc_rx[i].format==format1A?"A":"C",i); + LOG_D(PHY,"[UE %d] subframe %d: Found rnti %x, format 1%s, dci_cnt %d\n",ue->Mod_id,subframe_rx,dci_alloc_rx[i].rnti,dci_alloc_rx[i].format==format1A?"A":"C",i); #endif @@ -3015,7 +3018,7 @@ int ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint (dci_alloc_rx[i].format == format1A)) { #ifdef DEBUG_PHY_PROC - LOG_I(PHY,"[UE %d][RAPROC] subframe %d: Found RA rnti %x, format 1A, dci_cnt %d\n",ue->Mod_id,subframe_rx,dci_alloc_rx[i].rnti,i); + LOG_D(PHY,"[UE %d][RAPROC] subframe %d: Found RA rnti %x, format 1A, dci_cnt %d\n",ue->Mod_id,subframe_rx,dci_alloc_rx[i].rnti,i); #endif @@ -3081,7 +3084,7 @@ int ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint T_INT(ue->ulsch[eNB_id]->harq_processes[harq_pid]->TBS)); #endif #ifdef DEBUG_PHY_PROC - LOG_D(PHY,"[UE %d] Generate UE ULSCH C_RNTI format 0 (subframe %d)\n",ue->Mod_id,subframe_rx); + LOG_D(PHY,"[UE %d] Generate UE ULSCH C_RNTI format 0 (subframe %d)\n",ue->Mod_id,subframe_rx); #endif } @@ -3124,7 +3127,7 @@ int ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint else { #ifdef DEBUG_PHY_PROC - LOG_I(PHY,"[UE %d] frame %d, subframe %d: received DCI %d with RNTI=%x (C-RNTI:%x, CBA_RNTI %x) and format %d!\n",ue->Mod_id,frame_rx,subframe_rx,i,dci_alloc_rx[i].rnti, + LOG_D(PHY,"[UE %d] frame %d, subframe %d: received DCI %d with RNTI=%x (C-RNTI:%x, CBA_RNTI %x) and format %d!\n",ue->Mod_id,frame_rx,subframe_rx,i,dci_alloc_rx[i].rnti, ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->crnti, ue->ulsch[eNB_id]->cba_rnti[0], dci_alloc_rx[i].format); @@ -3812,7 +3815,7 @@ void ue_dlsch_procedures(PHY_VARS_UE *ue, if(is_cw1_active) { if (ret1 == (1+dlsch0->max_turbo_iterations)) { - LOG_I(PHY,"[UE %d][PDSCH %x/%d] Frame %d subframe %d DLSCH CW1 in error (rv %d,mcs %d,TBS %d)\n", + LOG_D(PHY,"[UE %d][PDSCH %x/%d] Frame %d subframe %d DLSCH CW1 in error (rv %d,mcs %d,TBS %d)\n", ue->Mod_id,dlsch0->rnti, harq_pid,frame_rx,subframe_rx, dlsch0->harq_processes[harq_pid]->rvidx, @@ -3820,7 +3823,7 @@ void ue_dlsch_procedures(PHY_VARS_UE *ue, dlsch0->harq_processes[harq_pid]->TBS); } else { - LOG_I(PHY,"[UE %d][PDSCH %x/%d] Frame %d subframe %d: Received DLSCH CW1 (rv %d,mcs %d,TBS %d)\n", + LOG_D(PHY,"[UE %d][PDSCH %x/%d] Frame %d subframe %d: Received DLSCH CW1 (rv %d,mcs %d,TBS %d)\n", ue->Mod_id,dlsch0->rnti, harq_pid,frame_rx,subframe_rx, dlsch0->harq_processes[harq_pid]->rvidx, @@ -4202,7 +4205,7 @@ int phy_procedures_slot_parallelization_UE_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *pr // start timers #ifdef UE_DEBUG_TRACE - LOG_I(PHY," ****** start RX-Chain for AbsSubframe %d.%d ****** \n", frame_rx%1024, subframe_rx); + LOG_D(PHY," ****** start RX-Chain for AbsSubframe %d.%d ****** \n", frame_rx%1024, subframe_rx); #endif #if UE_TIMING_TRACE diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index 9168613db1..810c8277eb 100644 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -2598,7 +2598,9 @@ void RCConfig(void) { /* get global parameters, defined outside any section in the config file */ - + + printf("Getting ENBSParams\n"); + config_get( ENBSParams,sizeof(ENBSParams)/sizeof(paramdef_t),NULL); RC.nb_inst = ENBSParams[ENB_ACTIVE_ENBS_IDX].numelt; diff --git a/openair2/LAYER2/MAC/config.c b/openair2/LAYER2/MAC/config.c index 764c762f6a..6943013c34 100644 --- a/openair2/LAYER2/MAC/config.c +++ b/openair2/LAYER2/MAC/config.c @@ -63,34 +63,34 @@ extern RAN_CONTEXT_t RC; void ue_mac_reset(module_id_t module_idP, uint8_t eNB_index) { - //Resetting Bj - UE_mac_inst[module_idP].scheduling_info.Bj[0] = 0; - UE_mac_inst[module_idP].scheduling_info.Bj[1] = 0; - UE_mac_inst[module_idP].scheduling_info.Bj[2] = 0; + //Resetting Bj + UE_mac_inst[module_idP].scheduling_info.Bj[0] = 0; + UE_mac_inst[module_idP].scheduling_info.Bj[1] = 0; + UE_mac_inst[module_idP].scheduling_info.Bj[2] = 0; - //Stopping all timers + //Stopping all timers - //timeAlignmentTimer expires + //timeAlignmentTimer expires - // PHY changes for UE MAC reset - phy_reset_ue(module_idP, 0, eNB_index); + // PHY changes for UE MAC reset + phy_reset_ue(module_idP, 0, eNB_index); - // notify RRC to relase PUCCH/SRS - // cancel all pending SRs - UE_mac_inst[module_idP].scheduling_info.SR_pending = 0; - UE_mac_inst[module_idP].scheduling_info.SR_COUNTER = 0; + // notify RRC to relase PUCCH/SRS + // cancel all pending SRs + UE_mac_inst[module_idP].scheduling_info.SR_pending = 0; + UE_mac_inst[module_idP].scheduling_info.SR_COUNTER = 0; -//Set BSR Trigger Bmp and remove timer flags - UE_mac_inst[module_idP].BSR_reporting_active = BSR_TRIGGER_NONE; + //Set BSR Trigger Bmp and remove timer flags + UE_mac_inst[module_idP].BSR_reporting_active = BSR_TRIGGER_NONE; - // stop ongoing RACH procedure + // stop ongoing RACH procedure - // discard explicitly signaled ra_PreambleIndex and ra_RACH_MaskIndex, if any - UE_mac_inst[module_idP].RA_prach_resources.ra_PreambleIndex = 0; // check! - UE_mac_inst[module_idP].RA_prach_resources.ra_RACH_MaskIndex = 0; + // discard explicitly signaled ra_PreambleIndex and ra_RACH_MaskIndex, if any + UE_mac_inst[module_idP].RA_prach_resources.ra_PreambleIndex = 0; // check! + UE_mac_inst[module_idP].RA_prach_resources.ra_RACH_MaskIndex = 0; - ue_init_mac(module_idP); //This will hopefully do the rest of the MAC reset procedure + ue_init_mac(module_idP); //This will hopefully do the rest of the MAC reset procedure } @@ -99,121 +99,121 @@ int32_t **txdata; typedef struct eutra_bandentry_s { - int16_t band; - uint32_t ul_min; - uint32_t ul_max; - uint32_t dl_min; - uint32_t dl_max; - uint32_t N_OFFs_DL; + int16_t band; + uint32_t ul_min; + uint32_t ul_max; + uint32_t dl_min; + uint32_t dl_max; + uint32_t N_OFFs_DL; } eutra_bandentry_t; typedef struct band_info_s { - int nbands; - eutra_bandentry_t band_info[100]; + int nbands; + eutra_bandentry_t band_info[100]; } band_info_t; static const eutra_bandentry_t eutra_bandtable[] = { - {1, 19200, 19800, 21100, 21700, 0}, - {2, 18500, 19100, 19300, 19900, 6000}, - {3, 17100, 17850, 18050, 18800, 12000}, - {4, 17100, 17550, 21100, 21550, 19500}, - {5, 8240, 8490, 8690, 8940, 24000}, - {6, 8300, 8400, 8750, 8850, 26500}, - {7, 25000, 25700, 26200, 26900, 27500}, - {8, 8800, 9150, 9250, 9600, 34500}, - {9, 17499, 17849, 18449, 18799, 38000}, - {10, 17100, 17700, 21100, 21700, 41500}, - {11, 14279, 14529, 14759, 15009, 47500}, - {12, 6980, 7160, 7280, 7460, 50100}, - {13, 7770, 7870, 7460, 7560, 51800}, - {14, 7880, 7980, 7580, 7680, 52800}, - {17, 7040, 7160, 7340, 7460, 57300}, - {18, 8150, 9650, 8600, 10100, 58500}, - {19, 8300, 8450, 8750, 8900, 60000}, - {20, 8320, 8620, 7910, 8210, 61500}, - {21, 14479, 14629, 14959, 15109, 64500}, - {22, 34100, 34900, 35100, 35900, 66000}, - {23, 20000, 20200, 21800, 22000, 75000}, - {24, 16126, 16605, 15250, 15590, 77000}, - {25, 18500, 19150, 19300, 19950, 80400}, - {26, 8140, 8490, 8590, 8940, 86900}, - {27, 8070, 8240, 8520, 8690, 90400}, - {28, 7030, 7580, 7580, 8130, 92100}, - {29, 0, 0, 7170, 7280, 96600}, - {30, 23050, 23250, 23500, 23600, 97700}, - {31, 45250, 34900, 46250, 35900, 98700}, - {32, 0, 0, 14520, 14960, 99200}, - {33, 19000, 19200, 19000, 19200, 36000}, - {34, 20100, 20250, 20100, 20250, 36200}, - {35, 18500, 19100, 18500, 19100, 36350}, - {36, 19300, 19900, 19300, 19900, 36950}, - {37, 19100, 19300, 19100, 19300, 37550}, - {38, 25700, 26200, 25700, 26300, 37750}, - {39, 18800, 19200, 18800, 19200, 38250}, - {40, 23000, 24000, 23000, 24000, 38650}, - {41, 24960, 26900, 24960, 26900, 39650}, - {42, 34000, 36000, 34000, 36000, 41590}, - {43, 36000, 38000, 36000, 38000, 43590}, - {44, 7030, 8030, 7030, 8030, 45590}, - {45, 14470, 14670, 14470, 14670, 46590}, - {46, 51500, 59250, 51500, 59250, 46790}, - {65, 19200, 20100, 21100, 22000, 65536}, - {66, 17100, 18000, 21100, 22000, 66436}, - {67, 0, 0, 7380, 7580, 67336}, - {68, 6980, 7280, 7530, 7830, 67536} + {1, 19200, 19800, 21100, 21700, 0}, + {2, 18500, 19100, 19300, 19900, 6000}, + {3, 17100, 17850, 18050, 18800, 12000}, + {4, 17100, 17550, 21100, 21550, 19500}, + {5, 8240, 8490, 8690, 8940, 24000}, + {6, 8300, 8400, 8750, 8850, 26500}, + {7, 25000, 25700, 26200, 26900, 27500}, + {8, 8800, 9150, 9250, 9600, 34500}, + {9, 17499, 17849, 18449, 18799, 38000}, + {10, 17100, 17700, 21100, 21700, 41500}, + {11, 14279, 14529, 14759, 15009, 47500}, + {12, 6980, 7160, 7280, 7460, 50100}, + {13, 7770, 7870, 7460, 7560, 51800}, + {14, 7880, 7980, 7580, 7680, 52800}, + {17, 7040, 7160, 7340, 7460, 57300}, + {18, 8150, 9650, 8600, 10100, 58500}, + {19, 8300, 8450, 8750, 8900, 60000}, + {20, 8320, 8620, 7910, 8210, 61500}, + {21, 14479, 14629, 14959, 15109, 64500}, + {22, 34100, 34900, 35100, 35900, 66000}, + {23, 20000, 20200, 21800, 22000, 75000}, + {24, 16126, 16605, 15250, 15590, 77000}, + {25, 18500, 19150, 19300, 19950, 80400}, + {26, 8140, 8490, 8590, 8940, 86900}, + {27, 8070, 8240, 8520, 8690, 90400}, + {28, 7030, 7580, 7580, 8130, 92100}, + {29, 0, 0, 7170, 7280, 96600}, + {30, 23050, 23250, 23500, 23600, 97700}, + {31, 45250, 34900, 46250, 35900, 98700}, + {32, 0, 0, 14520, 14960, 99200}, + {33, 19000, 19200, 19000, 19200, 36000}, + {34, 20100, 20250, 20100, 20250, 36200}, + {35, 18500, 19100, 18500, 19100, 36350}, + {36, 19300, 19900, 19300, 19900, 36950}, + {37, 19100, 19300, 19100, 19300, 37550}, + {38, 25700, 26200, 25700, 26300, 37750}, + {39, 18800, 19200, 18800, 19200, 38250}, + {40, 23000, 24000, 23000, 24000, 38650}, + {41, 24960, 26900, 24960, 26900, 39650}, + {42, 34000, 36000, 34000, 36000, 41590}, + {43, 36000, 38000, 36000, 38000, 43590}, + {44, 7030, 8030, 7030, 8030, 45590}, + {45, 14470, 14670, 14470, 14670, 46590}, + {46, 51500, 59250, 51500, 59250, 46790}, + {65, 19200, 20100, 21100, 22000, 65536}, + {66, 17100, 18000, 21100, 22000, 66436}, + {67, 0, 0, 7380, 7580, 67336}, + {68, 6980, 7280, 7530, 7830, 67536} }; uint32_t to_earfcn(int eutra_bandP, uint32_t dl_CarrierFreq, uint32_t bw) { - uint32_t dl_CarrierFreq_by_100k = dl_CarrierFreq / 100000; - int bw_by_100 = bw / 100; + uint32_t dl_CarrierFreq_by_100k = dl_CarrierFreq / 100000; + int bw_by_100 = bw / 100; - int i; + int i; - AssertFatal(eutra_bandP < 69, "eutra_band %d > 68\n", eutra_bandP); - for (i = 0; i < 69 && eutra_bandtable[i].band != eutra_bandP; i++); + AssertFatal(eutra_bandP < 69, "eutra_band %d > 68\n", eutra_bandP); + for (i = 0; i < 69 && eutra_bandtable[i].band != eutra_bandP; i++); - AssertFatal(dl_CarrierFreq_by_100k >= eutra_bandtable[i].dl_min, - "Band %d, bw %u : DL carrier frequency %u Hz < %u\n", - eutra_bandP, bw, dl_CarrierFreq, - eutra_bandtable[i].dl_min); - AssertFatal(dl_CarrierFreq_by_100k <= - (eutra_bandtable[i].dl_max - bw_by_100), - "Band %d, bw %u: DL carrier frequency %u Hz > %d\n", - eutra_bandP, bw, dl_CarrierFreq, - eutra_bandtable[i].dl_max - bw_by_100); + AssertFatal(dl_CarrierFreq_by_100k >= eutra_bandtable[i].dl_min, + "Band %d, bw %u : DL carrier frequency %u Hz < %u\n", + eutra_bandP, bw, dl_CarrierFreq, + eutra_bandtable[i].dl_min); + AssertFatal(dl_CarrierFreq_by_100k <= + (eutra_bandtable[i].dl_max - bw_by_100), + "Band %d, bw %u: DL carrier frequency %u Hz > %d\n", + eutra_bandP, bw, dl_CarrierFreq, + eutra_bandtable[i].dl_max - bw_by_100); - return (dl_CarrierFreq_by_100k - eutra_bandtable[i].dl_min + - (eutra_bandtable[i].N_OFFs_DL / 10)); + return (dl_CarrierFreq_by_100k - eutra_bandtable[i].dl_min + + (eutra_bandtable[i].N_OFFs_DL / 10)); } uint32_t from_earfcn(int eutra_bandP, uint32_t dl_earfcn) { - int i; + int i; - AssertFatal(eutra_bandP < 69, "eutra_band %d > 68\n", eutra_bandP); - for (i = 0; i < 69 && eutra_bandtable[i].band != eutra_bandP; i++); + AssertFatal(eutra_bandP < 69, "eutra_band %d > 68\n", eutra_bandP); + for (i = 0; i < 69 && eutra_bandtable[i].band != eutra_bandP; i++); - return (eutra_bandtable[i].dl_min + - (dl_earfcn - (eutra_bandtable[i].N_OFFs_DL / 10))) * 100000; + return (eutra_bandtable[i].dl_min + + (dl_earfcn - (eutra_bandtable[i].N_OFFs_DL / 10))) * 100000; } int32_t get_uldl_offset(int eutra_bandP) { - int i; + int i; - for (i = 0; i < 69 && eutra_bandtable[i].band != eutra_bandP; i++); - return (eutra_bandtable[i].dl_min - eutra_bandtable[i].ul_min); + for (i = 0; i < 69 && eutra_bandtable[i].band != eutra_bandP; i++); + return (eutra_bandtable[i].dl_min - eutra_bandtable[i].ul_min); } uint32_t bw_table[6] = - { 6 * 180, 15 * 180, 25 * 180, 50 * 180, 75 * 180, 100 * 180 }; + { 6 * 180, 15 * 180, 25 * 180, 50 * 180, 75 * 180, 100 * 180 }; void config_mib(int Mod_idP, @@ -228,52 +228,52 @@ config_mib(int Mod_idP, uint32_t ul_CarrierFreqP, uint32_t pbch_repetitionP) { - nfapi_config_request_t *cfg = &RC.mac[Mod_idP]->config[CC_idP]; + nfapi_config_request_t *cfg = &RC.mac[Mod_idP]->config[CC_idP]; - cfg->subframe_config.pcfich_power_offset.value = 6000; // 0dB - cfg->subframe_config.dl_cyclic_prefix_type.value = NcpP; - cfg->subframe_config.ul_cyclic_prefix_type.value = NcpP; + cfg->subframe_config.pcfich_power_offset.value = 6000; // 0dB + cfg->subframe_config.dl_cyclic_prefix_type.value = NcpP; + cfg->subframe_config.ul_cyclic_prefix_type.value = NcpP; - LOG_I(MAC, "Ncp %d,p_eNB %d\n", NcpP, p_eNBP); + LOG_I(MAC, "Ncp %d,p_eNB %d\n", NcpP, p_eNBP); - cfg->rf_config.dl_channel_bandwidth.value = dl_BandwidthP; - cfg->rf_config.ul_channel_bandwidth.value = dl_BandwidthP; - cfg->rf_config.tx_antenna_ports.value = p_eNBP; - cfg->rf_config.rx_antenna_ports.value = 2; + cfg->rf_config.dl_channel_bandwidth.value = dl_BandwidthP; + cfg->rf_config.ul_channel_bandwidth.value = dl_BandwidthP; + cfg->rf_config.tx_antenna_ports.value = p_eNBP; + cfg->rf_config.rx_antenna_ports.value = 2; - cfg->nfapi_config.earfcn.value = - to_earfcn(eutra_bandP, dl_CarrierFreqP, - bw_table[dl_BandwidthP] / 100); - cfg->nfapi_config.rf_bands.number_rf_bands = 1; - cfg->nfapi_config.rf_bands.rf_band[0] = eutra_bandP; - cfg->phich_config.phich_resource.value = phich_configP->phich_Resource; - cfg->phich_config.phich_duration.value = phich_configP->phich_Duration; - cfg->phich_config.phich_power_offset.value = 6000; // 0dB + cfg->nfapi_config.earfcn.value = + to_earfcn(eutra_bandP, dl_CarrierFreqP, + bw_table[dl_BandwidthP] / 100); + cfg->nfapi_config.rf_bands.number_rf_bands = 1; + cfg->nfapi_config.rf_bands.rf_band[0] = eutra_bandP; + cfg->phich_config.phich_resource.value = phich_configP->phich_Resource; + cfg->phich_config.phich_duration.value = phich_configP->phich_Duration; + cfg->phich_config.phich_power_offset.value = 6000; // 0dB - cfg->sch_config.primary_synchronization_signal_epre_eprers.value = 6000; // 0dB - cfg->sch_config.secondary_synchronization_signal_epre_eprers.value = 6000; // 0dB - cfg->sch_config.physical_cell_id.value = Nid_cellP; + cfg->sch_config.primary_synchronization_signal_epre_eprers.value = 6000; // 0dB + cfg->sch_config.secondary_synchronization_signal_epre_eprers.value = 6000; // 0dB + cfg->sch_config.physical_cell_id.value = Nid_cellP; #ifdef Rel14 - cfg->emtc_config.pbch_repetitions_enable_r13.value = pbch_repetitionP; + cfg->emtc_config.pbch_repetitions_enable_r13.value = pbch_repetitionP; #endif } void config_sib1(int Mod_idP, int CC_idP, TDD_Config_t * tdd_ConfigP) { - nfapi_config_request_t *cfg = &RC.mac[Mod_idP]->config[CC_idP]; + nfapi_config_request_t *cfg = &RC.mac[Mod_idP]->config[CC_idP]; - if (tdd_ConfigP) { //TDD - cfg->subframe_config.duplex_mode.value = 0; - cfg->tdd_frame_structure_config.subframe_assignment.value = - tdd_ConfigP->subframeAssignment; - cfg->tdd_frame_structure_config.special_subframe_patterns.value = - tdd_ConfigP->specialSubframePatterns; - } else { // FDD - cfg->subframe_config.duplex_mode.value = 1; - // Note no half-duplex here - } + if (tdd_ConfigP) { //TDD + cfg->subframe_config.duplex_mode.value = 0; + cfg->tdd_frame_structure_config.subframe_assignment.value = + tdd_ConfigP->subframeAssignment; + cfg->tdd_frame_structure_config.special_subframe_patterns.value = + tdd_ConfigP->specialSubframePatterns; + } else { // FDD + cfg->subframe_config.duplex_mode.value = 1; + // Note no half-duplex here + } } @@ -294,241 +294,154 @@ config_sib2(int Mod_idP, struct MBSFN_SubframeConfigList *mbsfn_SubframeConfigListP) { - nfapi_config_request_t *cfg = &RC.mac[Mod_idP]->config[CC_idP]; + nfapi_config_request_t *cfg = &RC.mac[Mod_idP]->config[CC_idP]; - cfg->subframe_config.pb.value = - radioResourceConfigCommonP->pdsch_ConfigCommon.p_b; - cfg->rf_config.reference_signal_power.value = - radioResourceConfigCommonP->pdsch_ConfigCommon. - referenceSignalPower; - cfg->nfapi_config.max_transmit_power.value = - cfg->rf_config.reference_signal_power.value + - power_off_dB[cfg->rf_config.dl_channel_bandwidth.value]; + cfg->subframe_config.pb.value = radioResourceConfigCommonP->pdsch_ConfigCommon.p_b; + cfg->rf_config.reference_signal_power.value = radioResourceConfigCommonP->pdsch_ConfigCommon.referenceSignalPower; + cfg->nfapi_config.max_transmit_power.value = cfg->rf_config.reference_signal_power.value + + power_off_dB[cfg->rf_config.dl_channel_bandwidth.value]; - cfg->prach_config.configuration_index.value = - radioResourceConfigCommonP->prach_Config. - prach_ConfigInfo.prach_ConfigIndex; - cfg->prach_config.root_sequence_index.value = - radioResourceConfigCommonP->prach_Config.rootSequenceIndex; - cfg->prach_config.zero_correlation_zone_configuration.value = - radioResourceConfigCommonP->prach_Config. - prach_ConfigInfo.zeroCorrelationZoneConfig; - cfg->prach_config.high_speed_flag.value = - radioResourceConfigCommonP->prach_Config.prach_ConfigInfo. - highSpeedFlag; - cfg->prach_config.frequency_offset.value = - radioResourceConfigCommonP->prach_Config. - prach_ConfigInfo.prach_FreqOffset; + cfg->prach_config.configuration_index.value = radioResourceConfigCommonP->prach_Config.prach_ConfigInfo.prach_ConfigIndex; + cfg->prach_config.root_sequence_index.value = radioResourceConfigCommonP->prach_Config.rootSequenceIndex; + cfg->prach_config.zero_correlation_zone_configuration.value = radioResourceConfigCommonP->prach_Config.prach_ConfigInfo.zeroCorrelationZoneConfig; + cfg->prach_config.high_speed_flag.value = radioResourceConfigCommonP->prach_Config.prach_ConfigInfo.highSpeedFlag; + cfg->prach_config.frequency_offset.value = radioResourceConfigCommonP->prach_Config.prach_ConfigInfo.prach_FreqOffset; - cfg->pusch_config.hopping_mode.value = - radioResourceConfigCommonP->pusch_ConfigCommon. - pusch_ConfigBasic.hoppingMode; - cfg->pusch_config.number_of_subbands.value = - radioResourceConfigCommonP->pusch_ConfigCommon.pusch_ConfigBasic. - n_SB; - cfg->pusch_config.hopping_offset.value = - radioResourceConfigCommonP->pusch_ConfigCommon. - pusch_ConfigBasic.pusch_HoppingOffset; + cfg->pusch_config.hopping_mode.value = radioResourceConfigCommonP->pusch_ConfigCommon.pusch_ConfigBasic.hoppingMode; + cfg->pusch_config.number_of_subbands.value = radioResourceConfigCommonP->pusch_ConfigCommon.pusch_ConfigBasic.n_SB; + cfg->pusch_config.hopping_offset.value = radioResourceConfigCommonP->pusch_ConfigCommon.pusch_ConfigBasic.pusch_HoppingOffset; + cfg->pucch_config.delta_pucch_shift.value = radioResourceConfigCommonP->pucch_ConfigCommon.deltaPUCCH_Shift; + cfg->pucch_config.n_cqi_rb.value = radioResourceConfigCommonP->pucch_ConfigCommon.nRB_CQI; + cfg->pucch_config.n_an_cs.value = radioResourceConfigCommonP->pucch_ConfigCommon.nCS_AN; + cfg->pucch_config.n1_pucch_an.value = radioResourceConfigCommonP->pucch_ConfigCommon.n1PUCCH_AN; + if (radioResourceConfigCommonP->pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.groupHoppingEnabled == true) + cfg->uplink_reference_signal_config.uplink_rs_hopping.value = 1; + else if (radioResourceConfigCommonP->pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled == true) + cfg->uplink_reference_signal_config.uplink_rs_hopping.value = 2; + else // No hopping + cfg->uplink_reference_signal_config.uplink_rs_hopping.value = 0; - cfg->pucch_config.delta_pucch_shift.value = - radioResourceConfigCommonP->pucch_ConfigCommon.deltaPUCCH_Shift; - cfg->pucch_config.n_cqi_rb.value = - radioResourceConfigCommonP->pucch_ConfigCommon.nRB_CQI; - cfg->pucch_config.n_an_cs.value = - radioResourceConfigCommonP->pucch_ConfigCommon.nCS_AN; - cfg->pucch_config.n1_pucch_an.value = - radioResourceConfigCommonP->pucch_ConfigCommon.n1PUCCH_AN; + cfg->uplink_reference_signal_config.group_assignment.value = radioResourceConfigCommonP->pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH; + cfg->uplink_reference_signal_config.cyclic_shift_1_for_drms.value = radioResourceConfigCommonP->pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.cyclicShift; - if (radioResourceConfigCommonP-> - pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.groupHoppingEnabled == - true) - cfg->uplink_reference_signal_config.uplink_rs_hopping.value = 1; - else if (radioResourceConfigCommonP-> - pusch_ConfigCommon.ul_ReferenceSignalsPUSCH. - sequenceHoppingEnabled == true) - cfg->uplink_reference_signal_config.uplink_rs_hopping.value = 2; - else // No hopping - cfg->uplink_reference_signal_config.uplink_rs_hopping.value = 0; + // how to enable/disable SRS? + if (radioResourceConfigCommonP->soundingRS_UL_ConfigCommon.present == SoundingRS_UL_ConfigCommon_PR_setup) { + cfg->srs_config.bandwidth_configuration.value = radioResourceConfigCommonP->soundingRS_UL_ConfigCommon.choice.setup.srs_BandwidthConfig; + cfg->srs_config.srs_subframe_configuration.value = radioResourceConfigCommonP->soundingRS_UL_ConfigCommon.choice.setup.srs_SubframeConfig; + cfg->srs_config.srs_acknack_srs_simultaneous_transmission.value = radioResourceConfigCommonP->soundingRS_UL_ConfigCommon.choice.setup.ackNackSRS_SimultaneousTransmission; - cfg->uplink_reference_signal_config.group_assignment.value = - radioResourceConfigCommonP-> - pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH; - cfg->uplink_reference_signal_config.cyclic_shift_1_for_drms.value = - radioResourceConfigCommonP-> - pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.cyclicShift; - - // how to enable/disable SRS? - if (radioResourceConfigCommonP->soundingRS_UL_ConfigCommon.present == - SoundingRS_UL_ConfigCommon_PR_setup) { - cfg->srs_config.bandwidth_configuration.value = - radioResourceConfigCommonP->soundingRS_UL_ConfigCommon. - choice.setup.srs_BandwidthConfig; - cfg->srs_config.srs_subframe_configuration.value = - radioResourceConfigCommonP->soundingRS_UL_ConfigCommon. - choice.setup.srs_SubframeConfig; - cfg->srs_config.srs_acknack_srs_simultaneous_transmission.value = - radioResourceConfigCommonP->soundingRS_UL_ConfigCommon. - choice.setup.ackNackSRS_SimultaneousTransmission; - - if (radioResourceConfigCommonP->soundingRS_UL_ConfigCommon. - choice.setup.srs_MaxUpPts) - cfg->srs_config.max_up_pts.value = 1; - else - cfg->srs_config.max_up_pts.value = 0; - } + if (radioResourceConfigCommonP->soundingRS_UL_ConfigCommon.choice.setup.srs_MaxUpPts) + cfg->srs_config.max_up_pts.value = 1; + else + cfg->srs_config.max_up_pts.value = 0; + } #ifdef Rel14 - if (RC.mac[Mod_idP]->common_channels[CC_idP].mib-> - message.schedulingInfoSIB1_BR_r13 > 0) { - AssertFatal(radioResourceConfigCommon_BRP != NULL, - "radioResource rou is missing\n"); - AssertFatal(radioResourceConfigCommon_BRP->ext4 != NULL, - "ext4 is missing\n"); - cfg->emtc_config.prach_catm_root_sequence_index.value = - radioResourceConfigCommon_BRP->prach_Config.rootSequenceIndex; - cfg->emtc_config.prach_catm_zero_correlation_zone_configuration. - value = - radioResourceConfigCommon_BRP->prach_Config. - prach_ConfigInfo.zeroCorrelationZoneConfig; - cfg->emtc_config.prach_catm_high_speed_flag.value = - radioResourceConfigCommon_BRP->prach_Config. - prach_ConfigInfo.highSpeedFlag; + if (RC.mac[Mod_idP]->common_channels[CC_idP].mib->message.schedulingInfoSIB1_BR_r13 > 0) { + AssertFatal(radioResourceConfigCommon_BRP != NULL, + "radioResource rou is missing\n"); + AssertFatal(radioResourceConfigCommon_BRP->ext4 != NULL, + "ext4 is missing\n"); + cfg->emtc_config.prach_catm_root_sequence_index.value = radioResourceConfigCommon_BRP->prach_Config.rootSequenceIndex; + cfg->emtc_config.prach_catm_zero_correlation_zone_configuration.value = radioResourceConfigCommon_BRP->prach_Config.prach_ConfigInfo.zeroCorrelationZoneConfig; + cfg->emtc_config.prach_catm_high_speed_flag.value = radioResourceConfigCommon_BRP->prach_Config.prach_ConfigInfo.highSpeedFlag; - struct PRACH_ConfigSIB_v1310 *ext4_prach = - radioResourceConfigCommon_BRP->ext4->prach_ConfigCommon_v1310; + struct PRACH_ConfigSIB_v1310 *ext4_prach = radioResourceConfigCommon_BRP->ext4->prach_ConfigCommon_v1310; - PRACH_ParametersListCE_r13_t *prach_ParametersListCE_r13 = - &ext4_prach->prach_ParametersListCE_r13; + PRACH_ParametersListCE_r13_t *prach_ParametersListCE_r13 = &ext4_prach->prach_ParametersListCE_r13; - PRACH_ParametersCE_r13_t *p; - cfg->emtc_config.prach_ce_level_0_enable.value = 0; - cfg->emtc_config.prach_ce_level_1_enable.value = 0; - cfg->emtc_config.prach_ce_level_2_enable.value = 0; - cfg->emtc_config.prach_ce_level_3_enable.value = 0; - switch (prach_ParametersListCE_r13->list.count) { - case 4: - p = prach_ParametersListCE_r13->list.array[3]; - cfg->emtc_config.prach_ce_level_3_enable.value = 1; - cfg->emtc_config.prach_ce_level_3_configuration_index.value = - p->prach_ConfigIndex_r13; - cfg->emtc_config.prach_ce_level_3_frequency_offset.value = - p->prach_FreqOffset_r13; - cfg-> - emtc_config.prach_ce_level_3_number_of_repetitions_per_attempt. - value = p->numRepetitionPerPreambleAttempt_r13; - if (p->prach_StartingSubframe_r13) - cfg-> - emtc_config.prach_ce_level_3_starting_subframe_periodicity. - value = *p->prach_StartingSubframe_r13; - cfg->emtc_config.prach_ce_level_3_hopping_enable.value = - p->prach_HoppingConfig_r13; - cfg->emtc_config.prach_ce_level_3_hopping_offset.value = - cfg->rf_config.ul_channel_bandwidth.value - 6; - case 3: - p = prach_ParametersListCE_r13->list.array[2]; - cfg->emtc_config.prach_ce_level_2_enable.value = 1; - cfg->emtc_config.prach_ce_level_2_configuration_index.value = - p->prach_ConfigIndex_r13; - cfg->emtc_config.prach_ce_level_2_frequency_offset.value = - p->prach_FreqOffset_r13; - cfg-> - emtc_config.prach_ce_level_2_number_of_repetitions_per_attempt. - value = p->numRepetitionPerPreambleAttempt_r13; - if (p->prach_StartingSubframe_r13) - cfg-> - emtc_config.prach_ce_level_2_starting_subframe_periodicity. - value = *p->prach_StartingSubframe_r13; - cfg->emtc_config.prach_ce_level_2_hopping_enable.value = - p->prach_HoppingConfig_r13; - cfg->emtc_config.prach_ce_level_2_hopping_offset.value = - cfg->rf_config.ul_channel_bandwidth.value - 6; - case 2: - p = prach_ParametersListCE_r13->list.array[1]; - cfg->emtc_config.prach_ce_level_1_enable.value = 1; - cfg->emtc_config.prach_ce_level_1_configuration_index.value = - p->prach_ConfigIndex_r13; - cfg->emtc_config.prach_ce_level_1_frequency_offset.value = - p->prach_FreqOffset_r13; - cfg-> - emtc_config.prach_ce_level_1_number_of_repetitions_per_attempt. - value = p->numRepetitionPerPreambleAttempt_r13; - if (p->prach_StartingSubframe_r13) - cfg-> - emtc_config.prach_ce_level_1_starting_subframe_periodicity. - value = *p->prach_StartingSubframe_r13; - cfg->emtc_config.prach_ce_level_1_hopping_enable.value = - p->prach_HoppingConfig_r13; - cfg->emtc_config.prach_ce_level_1_hopping_offset.value = - cfg->rf_config.ul_channel_bandwidth.value - 6; - case 1: - p = prach_ParametersListCE_r13->list.array[0]; - cfg->emtc_config.prach_ce_level_0_enable.value = 1; - cfg->emtc_config.prach_ce_level_0_configuration_index.value = - p->prach_ConfigIndex_r13; - cfg->emtc_config.prach_ce_level_0_frequency_offset.value = - p->prach_FreqOffset_r13; - cfg-> - emtc_config.prach_ce_level_0_number_of_repetitions_per_attempt. - value = p->numRepetitionPerPreambleAttempt_r13; - if (p->prach_StartingSubframe_r13) - cfg-> - emtc_config.prach_ce_level_0_starting_subframe_periodicity. - value = *p->prach_StartingSubframe_r13; - cfg->emtc_config.prach_ce_level_0_hopping_enable.value = - p->prach_HoppingConfig_r13; - cfg->emtc_config.prach_ce_level_0_hopping_offset.value = - cfg->rf_config.ul_channel_bandwidth.value - 6; - } - - struct FreqHoppingParameters_r13 *ext4_freqHoppingParameters = - radioResourceConfigCommonP->ext4->freqHoppingParameters_r13; - if ((ext4_freqHoppingParameters) - && - (ext4_freqHoppingParameters->interval_ULHoppingConfigCommonModeA_r13)) - { - switch - (ext4_freqHoppingParameters->interval_ULHoppingConfigCommonModeA_r13-> - present) { - case FreqHoppingParameters_r13__interval_ULHoppingConfigCommonModeA_r13_PR_NOTHING: /* No components present */ - break; - case FreqHoppingParameters_r13__interval_ULHoppingConfigCommonModeA_r13_PR_interval_FDD_r13: - cfg->emtc_config. - pucch_interval_ulhoppingconfigcommonmodea.value = - ext4_freqHoppingParameters->interval_ULHoppingConfigCommonModeA_r13-> - choice.interval_FDD_r13; - break; - case FreqHoppingParameters_r13__interval_ULHoppingConfigCommonModeA_r13_PR_interval_TDD_r13: - cfg->emtc_config. - pucch_interval_ulhoppingconfigcommonmodea.value = - ext4_freqHoppingParameters->interval_ULHoppingConfigCommonModeA_r13-> - choice.interval_TDD_r13; - break; - } - } - if ((ext4_freqHoppingParameters) && - (ext4_freqHoppingParameters->interval_ULHoppingConfigCommonModeB_r13)) - { - switch - (ext4_freqHoppingParameters->interval_ULHoppingConfigCommonModeB_r13-> - present) { - case FreqHoppingParameters_r13__interval_ULHoppingConfigCommonModeB_r13_PR_NOTHING: /* No components present */ - break; - case FreqHoppingParameters_r13__interval_ULHoppingConfigCommonModeB_r13_PR_interval_FDD_r13: - cfg->emtc_config. - pucch_interval_ulhoppingconfigcommonmodeb.value = - ext4_freqHoppingParameters->interval_ULHoppingConfigCommonModeB_r13-> - choice.interval_FDD_r13; - break; - case FreqHoppingParameters_r13__interval_ULHoppingConfigCommonModeB_r13_PR_interval_TDD_r13: - cfg->emtc_config. - pucch_interval_ulhoppingconfigcommonmodeb.value = - ext4_freqHoppingParameters->interval_ULHoppingConfigCommonModeB_r13-> - choice.interval_TDD_r13; - break; - } - } + PRACH_ParametersCE_r13_t *p; + cfg->emtc_config.prach_ce_level_0_enable.value = 0; + cfg->emtc_config.prach_ce_level_1_enable.value = 0; + cfg->emtc_config.prach_ce_level_2_enable.value = 0; + cfg->emtc_config.prach_ce_level_3_enable.value = 0; + switch (prach_ParametersListCE_r13->list.count) { + case 4: + p = prach_ParametersListCE_r13->list.array[3]; + cfg->emtc_config.prach_ce_level_3_enable.value = 1; + cfg->emtc_config.prach_ce_level_3_configuration_index.value = p->prach_ConfigIndex_r13; + cfg->emtc_config.prach_ce_level_3_frequency_offset.value = p->prach_FreqOffset_r13; + cfg->emtc_config.prach_ce_level_3_number_of_repetitions_per_attempt.value = p->numRepetitionPerPreambleAttempt_r13; + if (p->prach_StartingSubframe_r13) + cfg->emtc_config.prach_ce_level_3_starting_subframe_periodicity.value = *p->prach_StartingSubframe_r13; + cfg->emtc_config.prach_ce_level_3_hopping_enable.value = p->prach_HoppingConfig_r13; + cfg->emtc_config.prach_ce_level_3_hopping_offset.value = cfg->rf_config.ul_channel_bandwidth.value - 6; + case 3: + p = prach_ParametersListCE_r13->list.array[2]; + cfg->emtc_config.prach_ce_level_2_enable.value = 1; + cfg->emtc_config.prach_ce_level_2_configuration_index.value = p->prach_ConfigIndex_r13; + cfg->emtc_config.prach_ce_level_2_frequency_offset.value = p->prach_FreqOffset_r13; + cfg->emtc_config.prach_ce_level_2_number_of_repetitions_per_attempt.value = p->numRepetitionPerPreambleAttempt_r13; + if (p->prach_StartingSubframe_r13) + cfg->emtc_config.prach_ce_level_2_starting_subframe_periodicity.value = *p->prach_StartingSubframe_r13; + cfg->emtc_config.prach_ce_level_2_hopping_enable.value = p->prach_HoppingConfig_r13; + cfg->emtc_config.prach_ce_level_2_hopping_offset.value = cfg->rf_config.ul_channel_bandwidth.value - 6; + case 2: + p = prach_ParametersListCE_r13->list.array[1]; + cfg->emtc_config.prach_ce_level_1_enable.value = 1; + cfg->emtc_config.prach_ce_level_1_configuration_index.value = p->prach_ConfigIndex_r13; + cfg->emtc_config.prach_ce_level_1_frequency_offset.value = p->prach_FreqOffset_r13; + cfg->emtc_config.prach_ce_level_1_number_of_repetitions_per_attempt.value = p->numRepetitionPerPreambleAttempt_r13; + if (p->prach_StartingSubframe_r13) + cfg->emtc_config.prach_ce_level_1_starting_subframe_periodicity.value = *p->prach_StartingSubframe_r13; + cfg->emtc_config.prach_ce_level_1_hopping_enable.value = p->prach_HoppingConfig_r13; + cfg->emtc_config.prach_ce_level_1_hopping_offset.value = cfg->rf_config.ul_channel_bandwidth.value - 6; + case 1: + p = prach_ParametersListCE_r13->list.array[0]; + cfg->emtc_config.prach_ce_level_0_enable.value = 1; + cfg->emtc_config.prach_ce_level_0_configuration_index.value = p->prach_ConfigIndex_r13; + cfg->emtc_config.prach_ce_level_0_frequency_offset.value = p->prach_FreqOffset_r13; + cfg->emtc_config.prach_ce_level_0_number_of_repetitions_per_attempt.value = p->numRepetitionPerPreambleAttempt_r13; + if (p->prach_StartingSubframe_r13) + cfg->emtc_config.prach_ce_level_0_starting_subframe_periodicity.value = *p->prach_StartingSubframe_r13; + cfg->emtc_config.prach_ce_level_0_hopping_enable.value = p->prach_HoppingConfig_r13; + cfg->emtc_config.prach_ce_level_0_hopping_offset.value = cfg->rf_config.ul_channel_bandwidth.value - 6; } + + struct FreqHoppingParameters_r13 *ext4_freqHoppingParameters = radioResourceConfigCommonP->ext4->freqHoppingParameters_r13; + if ((ext4_freqHoppingParameters)&& + (ext4_freqHoppingParameters->interval_ULHoppingConfigCommonModeA_r13)) + { + switch (ext4_freqHoppingParameters->interval_ULHoppingConfigCommonModeA_r13->present) { + case FreqHoppingParameters_r13__interval_ULHoppingConfigCommonModeA_r13_PR_NOTHING: /* No components present */ + break; + case FreqHoppingParameters_r13__interval_ULHoppingConfigCommonModeA_r13_PR_interval_FDD_r13: + cfg->emtc_config.pucch_interval_ulhoppingconfigcommonmodea.value = + ext4_freqHoppingParameters->interval_ULHoppingConfigCommonModeA_r13-> + choice.interval_FDD_r13; + break; + case FreqHoppingParameters_r13__interval_ULHoppingConfigCommonModeA_r13_PR_interval_TDD_r13: + cfg->emtc_config. + pucch_interval_ulhoppingconfigcommonmodea.value = + ext4_freqHoppingParameters->interval_ULHoppingConfigCommonModeA_r13-> + choice.interval_TDD_r13; + break; + } + } + if ((ext4_freqHoppingParameters) && + (ext4_freqHoppingParameters->interval_ULHoppingConfigCommonModeB_r13)) + { + switch + (ext4_freqHoppingParameters->interval_ULHoppingConfigCommonModeB_r13-> + present) { + case FreqHoppingParameters_r13__interval_ULHoppingConfigCommonModeB_r13_PR_NOTHING: /* No components present */ + break; + case FreqHoppingParameters_r13__interval_ULHoppingConfigCommonModeB_r13_PR_interval_FDD_r13: + cfg->emtc_config. + pucch_interval_ulhoppingconfigcommonmodeb.value = + ext4_freqHoppingParameters->interval_ULHoppingConfigCommonModeB_r13-> + choice.interval_FDD_r13; + break; + case FreqHoppingParameters_r13__interval_ULHoppingConfigCommonModeB_r13_PR_interval_TDD_r13: + cfg->emtc_config. + pucch_interval_ulhoppingconfigcommonmodeb.value = + ext4_freqHoppingParameters->interval_ULHoppingConfigCommonModeB_r13-> + choice.interval_TDD_r13; + break; + } + } + } #endif } @@ -597,273 +510,273 @@ rrc_mac_config_req_eNB(module_id_t Mod_idP, SystemInformationBlockType1_v1310_IEs_t * sib1_v13ext #endif - ) + ) { - int i; + int i; - int UE_id = -1; - eNB_MAC_INST *eNB = RC.mac[Mod_idP]; - UE_list_t *UE_list = &eNB->UE_list; + int UE_id = -1; + eNB_MAC_INST *eNB = RC.mac[Mod_idP]; + UE_list_t *UE_list = &eNB->UE_list; - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME - (VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_MAC_CONFIG, VCD_FUNCTION_IN); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME + (VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_MAC_CONFIG, VCD_FUNCTION_IN); - if (mib != NULL) { - if (RC.mac == NULL) - l2_init_eNB(); + if (mib != NULL) { + if (RC.mac == NULL) + l2_init_eNB(); - mac_top_init_eNB(); + mac_top_init_eNB(); - RC.mac[Mod_idP]->common_channels[CC_idP].mib = mib; - RC.mac[Mod_idP]->common_channels[CC_idP].physCellId = physCellId; - RC.mac[Mod_idP]->common_channels[CC_idP].p_eNB = p_eNB; - RC.mac[Mod_idP]->common_channels[CC_idP].Ncp = Ncp; - RC.mac[Mod_idP]->common_channels[CC_idP].eutra_band = eutra_band; - RC.mac[Mod_idP]->common_channels[CC_idP].dl_CarrierFreq = - dl_CarrierFreq; + RC.mac[Mod_idP]->common_channels[CC_idP].mib = mib; + RC.mac[Mod_idP]->common_channels[CC_idP].physCellId = physCellId; + RC.mac[Mod_idP]->common_channels[CC_idP].p_eNB = p_eNB; + RC.mac[Mod_idP]->common_channels[CC_idP].Ncp = Ncp; + RC.mac[Mod_idP]->common_channels[CC_idP].eutra_band = eutra_band; + RC.mac[Mod_idP]->common_channels[CC_idP].dl_CarrierFreq = + dl_CarrierFreq; - LOG_I(MAC, - "Configuring MIB for instance %d, CCid %d : (band %d,N_RB_DL %d,Nid_cell %d,p %d,DL freq %u,phich_config.resource %d, phich_config.duration %d)\n", - Mod_idP, - CC_idP, - eutra_band, - to_prb((int) mib->message.dl_Bandwidth), - physCellId, - p_eNB, - dl_CarrierFreq, - (int) mib->message.phich_Config.phich_Resource, - (int) mib->message.phich_Config.phich_Duration); + LOG_I(MAC, + "Configuring MIB for instance %d, CCid %d : (band %d,N_RB_DL %d,Nid_cell %d,p %d,DL freq %u,phich_config.resource %d, phich_config.duration %d)\n", + Mod_idP, + CC_idP, + eutra_band, + to_prb((int) mib->message.dl_Bandwidth), + physCellId, + p_eNB, + dl_CarrierFreq, + (int) mib->message.phich_Config.phich_Resource, + (int) mib->message.phich_Config.phich_Duration); - config_mib(Mod_idP, CC_idP, - eutra_band, - mib->message.dl_Bandwidth, - &mib->message.phich_Config, - physCellId, Ncp, p_eNB, dl_CarrierFreq, ul_CarrierFreq + config_mib(Mod_idP, CC_idP, + eutra_band, + mib->message.dl_Bandwidth, + &mib->message.phich_Config, + physCellId, Ncp, p_eNB, dl_CarrierFreq, ul_CarrierFreq #ifdef Rel14 - , pbch_repetition + , pbch_repetition #endif - ); + ); - mac_init_cell_params(Mod_idP, CC_idP); - } - if (schedulingInfoList != NULL) { - RC.mac[Mod_idP]->common_channels[CC_idP].tdd_Config = tdd_Config; - RC.mac[Mod_idP]->common_channels[CC_idP].schedulingInfoList = - schedulingInfoList; - config_sib1(Mod_idP, CC_idP, tdd_Config); - } + mac_init_cell_params(Mod_idP, CC_idP); + } + if (schedulingInfoList != NULL) { + RC.mac[Mod_idP]->common_channels[CC_idP].tdd_Config = tdd_Config; + RC.mac[Mod_idP]->common_channels[CC_idP].schedulingInfoList = + schedulingInfoList; + config_sib1(Mod_idP, CC_idP, tdd_Config); + } #ifdef Rel14 - if (sib1_v13ext != NULL) { - RC.mac[Mod_idP]->common_channels[CC_idP].sib1_v13ext = sib1_v13ext; - } + if (sib1_v13ext != NULL) { + RC.mac[Mod_idP]->common_channels[CC_idP].sib1_v13ext = sib1_v13ext; + } #endif - if (radioResourceConfigCommon != NULL) { - LOG_I(MAC, "[CONFIG]SIB2/3 Contents (partial)\n"); - LOG_I(MAC, "[CONFIG]pusch_config_common.n_SB = %ld\n", - radioResourceConfigCommon-> - pusch_ConfigCommon.pusch_ConfigBasic.n_SB); - LOG_I(MAC, "[CONFIG]pusch_config_common.hoppingMode = %ld\n", - radioResourceConfigCommon-> - pusch_ConfigCommon.pusch_ConfigBasic.hoppingMode); - LOG_I(MAC, - "[CONFIG]pusch_config_common.pusch_HoppingOffset = %ld\n", - radioResourceConfigCommon-> - pusch_ConfigCommon.pusch_ConfigBasic.pusch_HoppingOffset); - LOG_I(MAC, "[CONFIG]pusch_config_common.enable64QAM = %d\n", - radioResourceConfigCommon-> - pusch_ConfigCommon.pusch_ConfigBasic.enable64QAM); - LOG_I(MAC, - "[CONFIG]pusch_config_common.groupHoppingEnabled = %d\n", - radioResourceConfigCommon-> - pusch_ConfigCommon.ul_ReferenceSignalsPUSCH. - groupHoppingEnabled); - LOG_I(MAC, - "[CONFIG]pusch_config_common.groupAssignmentPUSCH = %ld\n", - radioResourceConfigCommon-> - pusch_ConfigCommon.ul_ReferenceSignalsPUSCH. - groupAssignmentPUSCH); - LOG_I(MAC, - "[CONFIG]pusch_config_common.sequenceHoppingEnabled = %d\n", - radioResourceConfigCommon-> - pusch_ConfigCommon.ul_ReferenceSignalsPUSCH. - sequenceHoppingEnabled); - LOG_I(MAC, "[CONFIG]pusch_config_common.cyclicShift = %ld\n", - radioResourceConfigCommon-> - pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.cyclicShift); + if (radioResourceConfigCommon != NULL) { + LOG_I(MAC, "[CONFIG]SIB2/3 Contents (partial)\n"); + LOG_I(MAC, "[CONFIG]pusch_config_common.n_SB = %ld\n", + radioResourceConfigCommon-> + pusch_ConfigCommon.pusch_ConfigBasic.n_SB); + LOG_I(MAC, "[CONFIG]pusch_config_common.hoppingMode = %ld\n", + radioResourceConfigCommon-> + pusch_ConfigCommon.pusch_ConfigBasic.hoppingMode); + LOG_I(MAC, + "[CONFIG]pusch_config_common.pusch_HoppingOffset = %ld\n", + radioResourceConfigCommon-> + pusch_ConfigCommon.pusch_ConfigBasic.pusch_HoppingOffset); + LOG_I(MAC, "[CONFIG]pusch_config_common.enable64QAM = %d\n", + radioResourceConfigCommon-> + pusch_ConfigCommon.pusch_ConfigBasic.enable64QAM); + LOG_I(MAC, + "[CONFIG]pusch_config_common.groupHoppingEnabled = %d\n", + radioResourceConfigCommon-> + pusch_ConfigCommon.ul_ReferenceSignalsPUSCH. + groupHoppingEnabled); + LOG_I(MAC, + "[CONFIG]pusch_config_common.groupAssignmentPUSCH = %ld\n", + radioResourceConfigCommon-> + pusch_ConfigCommon.ul_ReferenceSignalsPUSCH. + groupAssignmentPUSCH); + LOG_I(MAC, + "[CONFIG]pusch_config_common.sequenceHoppingEnabled = %d\n", + radioResourceConfigCommon-> + pusch_ConfigCommon.ul_ReferenceSignalsPUSCH. + sequenceHoppingEnabled); + LOG_I(MAC, "[CONFIG]pusch_config_common.cyclicShift = %ld\n", + radioResourceConfigCommon-> + pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.cyclicShift); - AssertFatal(radioResourceConfigCommon-> - rach_ConfigCommon.maxHARQ_Msg3Tx > 0, - "radioResourceconfigCommon %d == 0\n", - (int) radioResourceConfigCommon-> - rach_ConfigCommon.maxHARQ_Msg3Tx); + AssertFatal(radioResourceConfigCommon-> + rach_ConfigCommon.maxHARQ_Msg3Tx > 0, + "radioResourceconfigCommon %d == 0\n", + (int) radioResourceConfigCommon-> + rach_ConfigCommon.maxHARQ_Msg3Tx); - RC.mac[Mod_idP]->common_channels[CC_idP]. - radioResourceConfigCommon = radioResourceConfigCommon; - if (ul_CarrierFreq > 0) - RC.mac[Mod_idP]->common_channels[CC_idP].ul_CarrierFreq = - ul_CarrierFreq; - if (ul_Bandwidth) - RC.mac[Mod_idP]->common_channels[CC_idP].ul_Bandwidth = - *ul_Bandwidth; - else - RC.mac[Mod_idP]->common_channels[CC_idP].ul_Bandwidth = - RC.mac[Mod_idP]->common_channels[CC_idP].mib->message. - dl_Bandwidth; + RC.mac[Mod_idP]->common_channels[CC_idP]. + radioResourceConfigCommon = radioResourceConfigCommon; + if (ul_CarrierFreq > 0) + RC.mac[Mod_idP]->common_channels[CC_idP].ul_CarrierFreq = + ul_CarrierFreq; + if (ul_Bandwidth) + RC.mac[Mod_idP]->common_channels[CC_idP].ul_Bandwidth = + *ul_Bandwidth; + else + RC.mac[Mod_idP]->common_channels[CC_idP].ul_Bandwidth = + RC.mac[Mod_idP]->common_channels[CC_idP].mib->message. + dl_Bandwidth; - config_sib2(Mod_idP, CC_idP, radioResourceConfigCommon, + config_sib2(Mod_idP, CC_idP, radioResourceConfigCommon, #ifdef Rel14 - radioResourceConfigCommon_BR, + radioResourceConfigCommon_BR, #endif - NULL, ul_Bandwidth, additionalSpectrumEmission, - mbsfn_SubframeConfigList); + NULL, ul_Bandwidth, additionalSpectrumEmission, + mbsfn_SubframeConfigList); + } + // SRB2_lchan_config->choice.explicitValue.ul_SpecificParameters->logicalChannelGroup + if (logicalChannelConfig != NULL) { // check for eMTC specific things + UE_id = find_UE_id(Mod_idP, rntiP); + + if (UE_id == -1) { + LOG_E(MAC, "%s:%d:%s: ERROR, UE_id == -1\n", __FILE__, + __LINE__, __FUNCTION__); + } else { + if (logicalChannelConfig) + UE_list-> + UE_template[CC_idP][UE_id].lcgidmap + [logicalChannelIdentity] = + *logicalChannelConfig-> + ul_SpecificParameters->logicalChannelGroup; + else + UE_list-> + UE_template[CC_idP][UE_id].lcgidmap + [logicalChannelIdentity] = 0; } - // SRB2_lchan_config->choice.explicitValue.ul_SpecificParameters->logicalChannelGroup - if (logicalChannelConfig != NULL) { // check for eMTC specific things - UE_id = find_UE_id(Mod_idP, rntiP); - - if (UE_id == -1) { - LOG_E(MAC, "%s:%d:%s: ERROR, UE_id == -1\n", __FILE__, - __LINE__, __FUNCTION__); - } else { - if (logicalChannelConfig) - UE_list-> - UE_template[CC_idP][UE_id].lcgidmap - [logicalChannelIdentity] = - *logicalChannelConfig-> - ul_SpecificParameters->logicalChannelGroup; - else - UE_list-> - UE_template[CC_idP][UE_id].lcgidmap - [logicalChannelIdentity] = 0; - } - } + } - if (physicalConfigDedicated != NULL) { - UE_id = find_UE_id(Mod_idP, rntiP); + if (physicalConfigDedicated != NULL) { + UE_id = find_UE_id(Mod_idP, rntiP); - if (UE_id == -1) - LOG_E(MAC, "%s:%d:%s: ERROR, UE_id == -1\n", __FILE__, - __LINE__, __FUNCTION__); - else - UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated = - physicalConfigDedicated; - } + if (UE_id == -1) + LOG_E(MAC, "%s:%d:%s: ERROR, UE_id == -1\n", __FILE__, + __LINE__, __FUNCTION__); + else + UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated = + physicalConfigDedicated; + } #if defined(Rel10) || defined(Rel14) - if (sCellToAddMod_r10 != NULL) { - UE_id = find_UE_id(Mod_idP, rntiP); - if (UE_id == -1) - LOG_E(MAC, "%s:%d:%s: ERROR, UE_id == -1\n", __FILE__, - __LINE__, __FUNCTION__); - else - config_dedicated_scell(Mod_idP, rntiP, sCellToAddMod_r10); + if (sCellToAddMod_r10 != NULL) { + UE_id = find_UE_id(Mod_idP, rntiP); + if (UE_id == -1) + LOG_E(MAC, "%s:%d:%s: ERROR, UE_id == -1\n", __FILE__, + __LINE__, __FUNCTION__); + else + config_dedicated_scell(Mod_idP, rntiP, sCellToAddMod_r10); - } + } #endif - if (mbsfn_SubframeConfigList != NULL) { - LOG_I(MAC, - "[eNB %d][CONFIG] Received %d subframe allocation pattern for MBSFN\n", - Mod_idP, mbsfn_SubframeConfigList->list.count); - RC.mac[Mod_idP]->common_channels[0].num_sf_allocation_pattern = - mbsfn_SubframeConfigList->list.count; + if (mbsfn_SubframeConfigList != NULL) { + LOG_I(MAC, + "[eNB %d][CONFIG] Received %d subframe allocation pattern for MBSFN\n", + Mod_idP, mbsfn_SubframeConfigList->list.count); + RC.mac[Mod_idP]->common_channels[0].num_sf_allocation_pattern = + mbsfn_SubframeConfigList->list.count; - for (i = 0; i < mbsfn_SubframeConfigList->list.count; i++) { - RC.mac[Mod_idP]->common_channels[0].mbsfn_SubframeConfig[i] = - mbsfn_SubframeConfigList->list.array[i]; - LOG_I(MAC, - "[eNB %d][CONFIG] MBSFN_SubframeConfig[%d] pattern is %x\n", - Mod_idP, i, - RC.mac[Mod_idP]-> - common_channels[0].mbsfn_SubframeConfig[i]-> - subframeAllocation.choice.oneFrame.buf[0]); - } + for (i = 0; i < mbsfn_SubframeConfigList->list.count; i++) { + RC.mac[Mod_idP]->common_channels[0].mbsfn_SubframeConfig[i] = + mbsfn_SubframeConfigList->list.array[i]; + LOG_I(MAC, + "[eNB %d][CONFIG] MBSFN_SubframeConfig[%d] pattern is %x\n", + Mod_idP, i, + RC.mac[Mod_idP]-> + common_channels[0].mbsfn_SubframeConfig[i]-> + subframeAllocation.choice.oneFrame.buf[0]); + } #ifdef Rel10 - RC.mac[Mod_idP]->common_channels[0].MBMS_flag = MBMS_Flag; + RC.mac[Mod_idP]->common_channels[0].MBMS_flag = MBMS_Flag; #endif - } + } #if defined(Rel10) || defined(Rel14) - if (mbsfn_AreaInfoList != NULL) { - // One eNB could be part of multiple mbsfn syc area, this could change over time so reset each time - LOG_I(MAC, "[eNB %d][CONFIG] Received %d MBSFN Area Info\n", - Mod_idP, mbsfn_AreaInfoList->list.count); - RC.mac[Mod_idP]->common_channels[0].num_active_mbsfn_area = - mbsfn_AreaInfoList->list.count; + if (mbsfn_AreaInfoList != NULL) { + // One eNB could be part of multiple mbsfn syc area, this could change over time so reset each time + LOG_I(MAC, "[eNB %d][CONFIG] Received %d MBSFN Area Info\n", + Mod_idP, mbsfn_AreaInfoList->list.count); + RC.mac[Mod_idP]->common_channels[0].num_active_mbsfn_area = + mbsfn_AreaInfoList->list.count; - for (i = 0; i < mbsfn_AreaInfoList->list.count; i++) { - RC.mac[Mod_idP]->common_channels[0].mbsfn_AreaInfo[i] = - mbsfn_AreaInfoList->list.array[i]; - LOG_I(MAC, - "[eNB %d][CONFIG] MBSFN_AreaInfo[%d]: MCCH Repetition Period = %ld\n", - Mod_idP, i, - RC.mac[Mod_idP]->common_channels[0]. - mbsfn_AreaInfo[i]->mcch_Config_r9. - mcch_RepetitionPeriod_r9); - // config_sib13(Mod_idP,0,i,RC.mac[Mod_idP]->common_channels[0].mbsfn_AreaInfo[i]->mbsfn_AreaId_r9); - } + for (i = 0; i < mbsfn_AreaInfoList->list.count; i++) { + RC.mac[Mod_idP]->common_channels[0].mbsfn_AreaInfo[i] = + mbsfn_AreaInfoList->list.array[i]; + LOG_I(MAC, + "[eNB %d][CONFIG] MBSFN_AreaInfo[%d]: MCCH Repetition Period = %ld\n", + Mod_idP, i, + RC.mac[Mod_idP]->common_channels[0]. + mbsfn_AreaInfo[i]->mcch_Config_r9. + mcch_RepetitionPeriod_r9); + // config_sib13(Mod_idP,0,i,RC.mac[Mod_idP]->common_channels[0].mbsfn_AreaInfo[i]->mbsfn_AreaId_r9); } + } - if (pmch_InfoList != NULL) { + if (pmch_InfoList != NULL) { - // LOG_I(MAC,"DUY: lcid when entering rrc_mac config_req is %02d\n",(pmch_InfoList->list.array[0]->mbms_SessionInfoList_r9.list.array[0]->logicalChannelIdentity_r9)); + // LOG_I(MAC,"DUY: lcid when entering rrc_mac config_req is %02d\n",(pmch_InfoList->list.array[0]->mbms_SessionInfoList_r9.list.array[0]->logicalChannelIdentity_r9)); - LOG_I(MAC, "[CONFIG] Number of PMCH in this MBSFN Area %d\n", - pmch_InfoList->list.count); + LOG_I(MAC, "[CONFIG] Number of PMCH in this MBSFN Area %d\n", + pmch_InfoList->list.count); - for (i = 0; i < pmch_InfoList->list.count; i++) { - RC.mac[Mod_idP]->common_channels[0].pmch_Config[i] = - &pmch_InfoList->list.array[i]->pmch_Config_r9; + for (i = 0; i < pmch_InfoList->list.count; i++) { + RC.mac[Mod_idP]->common_channels[0].pmch_Config[i] = + &pmch_InfoList->list.array[i]->pmch_Config_r9; - LOG_I(MAC, - "[CONFIG] PMCH[%d]: This PMCH stop (sf_AllocEnd_r9) at subframe %ldth\n", - i, - RC.mac[Mod_idP]->common_channels[0]. - pmch_Config[i]->sf_AllocEnd_r9); - LOG_I(MAC, "[CONFIG] PMCH[%d]: mch_Scheduling_Period = %ld\n", - i, - RC.mac[Mod_idP]->common_channels[0]. - pmch_Config[i]->mch_SchedulingPeriod_r9); - LOG_I(MAC, "[CONFIG] PMCH[%d]: dataMCS = %ld\n", i, - RC.mac[Mod_idP]->common_channels[0]. - pmch_Config[i]->dataMCS_r9); + LOG_I(MAC, + "[CONFIG] PMCH[%d]: This PMCH stop (sf_AllocEnd_r9) at subframe %ldth\n", + i, + RC.mac[Mod_idP]->common_channels[0]. + pmch_Config[i]->sf_AllocEnd_r9); + LOG_I(MAC, "[CONFIG] PMCH[%d]: mch_Scheduling_Period = %ld\n", + i, + RC.mac[Mod_idP]->common_channels[0]. + pmch_Config[i]->mch_SchedulingPeriod_r9); + LOG_I(MAC, "[CONFIG] PMCH[%d]: dataMCS = %ld\n", i, + RC.mac[Mod_idP]->common_channels[0]. + pmch_Config[i]->dataMCS_r9); - // MBMS session info list in each MCH - RC.mac[Mod_idP]->common_channels[0].mbms_SessionList[i] = - &pmch_InfoList->list.array[i]->mbms_SessionInfoList_r9; - LOG_I(MAC, "PMCH[%d] Number of session (MTCH) is: %d\n", i, - RC.mac[Mod_idP]->common_channels[0]. - mbms_SessionList[i]->list.count); - } + // MBMS session info list in each MCH + RC.mac[Mod_idP]->common_channels[0].mbms_SessionList[i] = + &pmch_InfoList->list.array[i]->mbms_SessionInfoList_r9; + LOG_I(MAC, "PMCH[%d] Number of session (MTCH) is: %d\n", i, + RC.mac[Mod_idP]->common_channels[0]. + mbms_SessionList[i]->list.count); } + } #endif - if (radioResourceConfigCommon != NULL) { - AssertFatal(RC.mac[Mod_idP]->if_inst->PHY_config_req != NULL, - "if_inst->phy_config_request is null\n"); - PHY_Config_t phycfg; - phycfg.Mod_id = Mod_idP; - phycfg.CC_id = CC_idP; - phycfg.cfg = &RC.mac[Mod_idP]->config[CC_idP]; + if (radioResourceConfigCommon != NULL) { + AssertFatal(RC.mac[Mod_idP]->if_inst->PHY_config_req != NULL, + "if_inst->phy_config_request is null\n"); + PHY_Config_t phycfg; + phycfg.Mod_id = Mod_idP; + phycfg.CC_id = CC_idP; + phycfg.cfg = &RC.mac[Mod_idP]->config[CC_idP]; - if (RC.mac[Mod_idP]->if_inst->PHY_config_req) - RC.mac[Mod_idP]->if_inst->PHY_config_req(&phycfg); - } - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME - (VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_MAC_CONFIG, VCD_FUNCTION_OUT); + if (RC.mac[Mod_idP]->if_inst->PHY_config_req) + RC.mac[Mod_idP]->if_inst->PHY_config_req(&phycfg); + } + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME + (VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_MAC_CONFIG, VCD_FUNCTION_OUT); - return (0); + return (0); } int @@ -901,450 +814,450 @@ rrc_mac_config_req_ue(module_id_t Mod_idP, #ifdef CBA , uint8_t num_active_cba_groups, uint16_t cba_rnti #endif - ) + ) { - int i; + int i; - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME - (VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_MAC_CONFIG, VCD_FUNCTION_IN); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME + (VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_MAC_CONFIG, VCD_FUNCTION_IN); - LOG_I(MAC, "[CONFIG][UE %d] Configuring MAC/PHY from eNB %d\n", + LOG_I(MAC, "[CONFIG][UE %d] Configuring MAC/PHY from eNB %d\n", + Mod_idP, eNB_index); + + if (tdd_Config != NULL) { + UE_mac_inst[Mod_idP].tdd_Config = tdd_Config; + } + + + if (tdd_Config && SIwindowsize && SIperiod) { + phy_config_sib1_ue(Mod_idP, 0, eNB_index, tdd_Config, + *SIwindowsize, *SIperiod); + } + + if (radioResourceConfigCommon != NULL) { + UE_mac_inst[Mod_idP].radioResourceConfigCommon = + radioResourceConfigCommon; + phy_config_sib2_ue(Mod_idP, 0, eNB_index, + radioResourceConfigCommon, ul_CarrierFreq, + ul_Bandwidth, additionalSpectrumEmission, + mbsfn_SubframeConfigList); + } + // SRB2_lchan_config->choice.explicitValue.ul_SpecificParameters->logicalChannelGroup + if (logicalChannelConfig != NULL) { + LOG_I(MAC, + "[CONFIG][UE %d] Applying RRC logicalChannelConfig from eNB%d\n", Mod_idP, eNB_index); + UE_mac_inst[Mod_idP].logicalChannelConfig[logicalChannelIdentity] = + logicalChannelConfig; + UE_mac_inst[Mod_idP].scheduling_info.Bj[logicalChannelIdentity] = 0; // initilize the bucket for this lcid - if (tdd_Config != NULL) { - UE_mac_inst[Mod_idP].tdd_Config = tdd_Config; + AssertFatal(logicalChannelConfig->ul_SpecificParameters != NULL, + "[UE %d] LCID %ld NULL ul_SpecificParameters\n", + Mod_idP, logicalChannelIdentity); + UE_mac_inst[Mod_idP].scheduling_info.bucket_size[logicalChannelIdentity] = logicalChannelConfig->ul_SpecificParameters->prioritisedBitRate * logicalChannelConfig->ul_SpecificParameters->bucketSizeDuration; // set the max bucket size + if (logicalChannelConfig->ul_SpecificParameters-> + logicalChannelGroup != NULL) { + UE_mac_inst[Mod_idP].scheduling_info. + LCGID[logicalChannelIdentity] = + *logicalChannelConfig->ul_SpecificParameters-> + logicalChannelGroup; + LOG_D(MAC, + "[CONFIG][UE %d] LCID %ld is attached to the LCGID %ld\n", + Mod_idP, logicalChannelIdentity, + *logicalChannelConfig-> + ul_SpecificParameters->logicalChannelGroup); + } else { + UE_mac_inst[Mod_idP].scheduling_info. + LCGID[logicalChannelIdentity] = MAX_NUM_LCGID; } + UE_mac_inst[Mod_idP]. + scheduling_info.LCID_buffer_remain[logicalChannelIdentity] = 0; + } + if (mac_MainConfig != NULL) { + LOG_I(MAC, + "[CONFIG][UE%d] Applying RRC macMainConfig from eNB%d\n", + Mod_idP, eNB_index); + UE_mac_inst[Mod_idP].macConfig = mac_MainConfig; + UE_mac_inst[Mod_idP].measGapConfig = measGapConfig; - if (tdd_Config && SIwindowsize && SIperiod) { - phy_config_sib1_ue(Mod_idP, 0, eNB_index, tdd_Config, - *SIwindowsize, *SIperiod); - } + if (mac_MainConfig->ul_SCH_Config) { - if (radioResourceConfigCommon != NULL) { - UE_mac_inst[Mod_idP].radioResourceConfigCommon = - radioResourceConfigCommon; - phy_config_sib2_ue(Mod_idP, 0, eNB_index, - radioResourceConfigCommon, ul_CarrierFreq, - ul_Bandwidth, additionalSpectrumEmission, - mbsfn_SubframeConfigList); - } - // SRB2_lchan_config->choice.explicitValue.ul_SpecificParameters->logicalChannelGroup - if (logicalChannelConfig != NULL) { - LOG_I(MAC, - "[CONFIG][UE %d] Applying RRC logicalChannelConfig from eNB%d\n", - Mod_idP, eNB_index); - UE_mac_inst[Mod_idP].logicalChannelConfig[logicalChannelIdentity] = - logicalChannelConfig; - UE_mac_inst[Mod_idP].scheduling_info.Bj[logicalChannelIdentity] = 0; // initilize the bucket for this lcid - - AssertFatal(logicalChannelConfig->ul_SpecificParameters != NULL, - "[UE %d] LCID %ld NULL ul_SpecificParameters\n", - Mod_idP, logicalChannelIdentity); - UE_mac_inst[Mod_idP].scheduling_info.bucket_size[logicalChannelIdentity] = logicalChannelConfig->ul_SpecificParameters->prioritisedBitRate * logicalChannelConfig->ul_SpecificParameters->bucketSizeDuration; // set the max bucket size - if (logicalChannelConfig->ul_SpecificParameters-> - logicalChannelGroup != NULL) { - UE_mac_inst[Mod_idP].scheduling_info. - LCGID[logicalChannelIdentity] = - *logicalChannelConfig->ul_SpecificParameters-> - logicalChannelGroup; - LOG_D(MAC, - "[CONFIG][UE %d] LCID %ld is attached to the LCGID %ld\n", - Mod_idP, logicalChannelIdentity, - *logicalChannelConfig-> - ul_SpecificParameters->logicalChannelGroup); - } else { - UE_mac_inst[Mod_idP].scheduling_info. - LCGID[logicalChannelIdentity] = MAX_NUM_LCGID; - } - UE_mac_inst[Mod_idP]. - scheduling_info.LCID_buffer_remain[logicalChannelIdentity] = 0; - } - - if (mac_MainConfig != NULL) { - LOG_I(MAC, - "[CONFIG][UE%d] Applying RRC macMainConfig from eNB%d\n", - Mod_idP, eNB_index); - UE_mac_inst[Mod_idP].macConfig = mac_MainConfig; - UE_mac_inst[Mod_idP].measGapConfig = measGapConfig; - - if (mac_MainConfig->ul_SCH_Config) { - - if (mac_MainConfig->ul_SCH_Config->periodicBSR_Timer) { - UE_mac_inst[Mod_idP].scheduling_info.periodicBSR_Timer = - (uint16_t) * - mac_MainConfig->ul_SCH_Config->periodicBSR_Timer; - } else { - UE_mac_inst[Mod_idP].scheduling_info.periodicBSR_Timer = + if (mac_MainConfig->ul_SCH_Config->periodicBSR_Timer) { + UE_mac_inst[Mod_idP].scheduling_info.periodicBSR_Timer = + (uint16_t) * + mac_MainConfig->ul_SCH_Config->periodicBSR_Timer; + } else { + UE_mac_inst[Mod_idP].scheduling_info.periodicBSR_Timer = #ifndef Rel14 - (uint16_t) - MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_infinity + (uint16_t) + MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_infinity #else - (uint16_t) PeriodicBSR_Timer_r12_infinity; + (uint16_t) PeriodicBSR_Timer_r12_infinity; #endif - ; - } + ; + } - if (mac_MainConfig->ul_SCH_Config->maxHARQ_Tx) { - UE_mac_inst[Mod_idP].scheduling_info.maxHARQ_Tx = - (uint16_t) * mac_MainConfig->ul_SCH_Config->maxHARQ_Tx; - } else { - UE_mac_inst[Mod_idP].scheduling_info.maxHARQ_Tx = - (uint16_t) - MAC_MainConfig__ul_SCH_Config__maxHARQ_Tx_n5; - } - phy_config_harq_ue(Mod_idP, 0, eNB_index, - UE_mac_inst[Mod_idP]. - scheduling_info.maxHARQ_Tx); + if (mac_MainConfig->ul_SCH_Config->maxHARQ_Tx) { + UE_mac_inst[Mod_idP].scheduling_info.maxHARQ_Tx = + (uint16_t) * mac_MainConfig->ul_SCH_Config->maxHARQ_Tx; + } else { + UE_mac_inst[Mod_idP].scheduling_info.maxHARQ_Tx = + (uint16_t) + MAC_MainConfig__ul_SCH_Config__maxHARQ_Tx_n5; + } + phy_config_harq_ue(Mod_idP, 0, eNB_index, + UE_mac_inst[Mod_idP]. + scheduling_info.maxHARQ_Tx); - if (mac_MainConfig->ul_SCH_Config->retxBSR_Timer) { - UE_mac_inst[Mod_idP].scheduling_info.retxBSR_Timer = - (uint16_t) mac_MainConfig->ul_SCH_Config-> - retxBSR_Timer; - } else { + if (mac_MainConfig->ul_SCH_Config->retxBSR_Timer) { + UE_mac_inst[Mod_idP].scheduling_info.retxBSR_Timer = + (uint16_t) mac_MainConfig->ul_SCH_Config-> + retxBSR_Timer; + } else { #ifndef Rel14 - UE_mac_inst[Mod_idP].scheduling_info.retxBSR_Timer = - (uint16_t) - MAC_MainConfig__ul_SCH_Config__retxBSR_Timer_sf2560; + UE_mac_inst[Mod_idP].scheduling_info.retxBSR_Timer = + (uint16_t) + MAC_MainConfig__ul_SCH_Config__retxBSR_Timer_sf2560; #else - UE_mac_inst[Mod_idP].scheduling_info.retxBSR_Timer = - (uint16_t) RetxBSR_Timer_r12_sf2560; + UE_mac_inst[Mod_idP].scheduling_info.retxBSR_Timer = + (uint16_t) RetxBSR_Timer_r12_sf2560; #endif - } - } -#if defined(Rel10) || defined(Rel14) - - if (mac_MainConfig->ext1 - && mac_MainConfig->ext1->sr_ProhibitTimer_r9) { - UE_mac_inst[Mod_idP].scheduling_info.sr_ProhibitTimer = - (uint16_t) * mac_MainConfig->ext1->sr_ProhibitTimer_r9; - } else { - UE_mac_inst[Mod_idP].scheduling_info.sr_ProhibitTimer = 0; - } - - if (mac_MainConfig->ext2 - && mac_MainConfig->ext2->mac_MainConfig_v1020) { - if (mac_MainConfig->ext2-> - mac_MainConfig_v1020->extendedBSR_Sizes_r10) { - UE_mac_inst[Mod_idP].scheduling_info. - extendedBSR_Sizes_r10 = - (uint16_t) * - mac_MainConfig->ext2-> - mac_MainConfig_v1020->extendedBSR_Sizes_r10; - } else { - UE_mac_inst[Mod_idP].scheduling_info. - extendedBSR_Sizes_r10 = (uint16_t) 0; - } - if (mac_MainConfig->ext2->mac_MainConfig_v1020-> - extendedPHR_r10) { - UE_mac_inst[Mod_idP].scheduling_info.extendedPHR_r10 = - (uint16_t) * - mac_MainConfig->ext2->mac_MainConfig_v1020-> - extendedPHR_r10; - } else { - UE_mac_inst[Mod_idP].scheduling_info.extendedPHR_r10 = - (uint16_t) 0; - } - } else { - UE_mac_inst[Mod_idP].scheduling_info.extendedBSR_Sizes_r10 = - (uint16_t) 0; - UE_mac_inst[Mod_idP].scheduling_info.extendedPHR_r10 = - (uint16_t) 0; - } -#endif - UE_mac_inst[Mod_idP].scheduling_info.periodicBSR_SF = - MAC_UE_BSR_TIMER_NOT_RUNNING; - UE_mac_inst[Mod_idP].scheduling_info.retxBSR_SF = - MAC_UE_BSR_TIMER_NOT_RUNNING; - - UE_mac_inst[Mod_idP].BSR_reporting_active = BSR_TRIGGER_NONE; - - LOG_D(MAC, "[UE %d]: periodic BSR %d (SF), retx BSR %d (SF)\n", - Mod_idP, - UE_mac_inst[Mod_idP].scheduling_info.periodicBSR_SF, - UE_mac_inst[Mod_idP].scheduling_info.retxBSR_SF); - - UE_mac_inst[Mod_idP].scheduling_info.drx_config = - mac_MainConfig->drx_Config; - UE_mac_inst[Mod_idP].scheduling_info.phr_config = - mac_MainConfig->phr_Config; - - if (mac_MainConfig->phr_Config) { - UE_mac_inst[Mod_idP].PHR_state = - mac_MainConfig->phr_Config->present; - UE_mac_inst[Mod_idP].PHR_reconfigured = 1; - UE_mac_inst[Mod_idP].scheduling_info.periodicPHR_Timer = - mac_MainConfig->phr_Config->choice.setup.periodicPHR_Timer; - UE_mac_inst[Mod_idP].scheduling_info.prohibitPHR_Timer = - mac_MainConfig->phr_Config->choice.setup.prohibitPHR_Timer; - UE_mac_inst[Mod_idP].scheduling_info.PathlossChange = - mac_MainConfig->phr_Config->choice.setup.dl_PathlossChange; - } else { - UE_mac_inst[Mod_idP].PHR_reconfigured = 0; - UE_mac_inst[Mod_idP].PHR_state = - MAC_MainConfig__phr_Config_PR_setup; - UE_mac_inst[Mod_idP].scheduling_info.periodicPHR_Timer = - MAC_MainConfig__phr_Config__setup__periodicPHR_Timer_sf20; - UE_mac_inst[Mod_idP].scheduling_info.prohibitPHR_Timer = - MAC_MainConfig__phr_Config__setup__prohibitPHR_Timer_sf20; - UE_mac_inst[Mod_idP].scheduling_info.PathlossChange = - MAC_MainConfig__phr_Config__setup__dl_PathlossChange_dB1; - } - - UE_mac_inst[Mod_idP].scheduling_info.periodicPHR_SF = - get_sf_perioidicPHR_Timer(UE_mac_inst[Mod_idP]. - scheduling_info.periodicPHR_Timer); - UE_mac_inst[Mod_idP].scheduling_info.prohibitPHR_SF = - get_sf_prohibitPHR_Timer(UE_mac_inst[Mod_idP]. - scheduling_info.prohibitPHR_Timer); - UE_mac_inst[Mod_idP].scheduling_info.PathlossChange_db = - get_db_dl_PathlossChange(UE_mac_inst[Mod_idP]. - scheduling_info.PathlossChange); - UE_mac_inst[Mod_idP].PHR_reporting_active = 0; - LOG_D(MAC, - "[UE %d] config PHR (%d): periodic %d (SF) prohibit %d (SF) pathlosschange %d (db) \n", - Mod_idP, - (mac_MainConfig->phr_Config) ? mac_MainConfig-> - phr_Config->present : -1, - UE_mac_inst[Mod_idP].scheduling_info.periodicPHR_SF, - UE_mac_inst[Mod_idP].scheduling_info.prohibitPHR_SF, - UE_mac_inst[Mod_idP].scheduling_info.PathlossChange_db); - } - - - if (physicalConfigDedicated != NULL) { - phy_config_dedicated_ue(Mod_idP, 0, eNB_index, - physicalConfigDedicated); - UE_mac_inst[Mod_idP].physicalConfigDedicated = physicalConfigDedicated; // for SR proc + } } #if defined(Rel10) || defined(Rel14) - if (sCellToAddMod_r10 != NULL) { + if (mac_MainConfig->ext1 + && mac_MainConfig->ext1->sr_ProhibitTimer_r9) { + UE_mac_inst[Mod_idP].scheduling_info.sr_ProhibitTimer = + (uint16_t) * mac_MainConfig->ext1->sr_ProhibitTimer_r9; + } else { + UE_mac_inst[Mod_idP].scheduling_info.sr_ProhibitTimer = 0; + } - - phy_config_dedicated_scell_ue(Mod_idP, eNB_index, - sCellToAddMod_r10, 1); - UE_mac_inst[Mod_idP].physicalConfigDedicatedSCell_r10 = sCellToAddMod_r10->radioResourceConfigDedicatedSCell_r10->physicalConfigDedicatedSCell_r10; // using SCell index 0 + if (mac_MainConfig->ext2 + && mac_MainConfig->ext2->mac_MainConfig_v1020) { + if (mac_MainConfig->ext2-> + mac_MainConfig_v1020->extendedBSR_Sizes_r10) { + UE_mac_inst[Mod_idP].scheduling_info. + extendedBSR_Sizes_r10 = + (uint16_t) * + mac_MainConfig->ext2-> + mac_MainConfig_v1020->extendedBSR_Sizes_r10; + } else { + UE_mac_inst[Mod_idP].scheduling_info. + extendedBSR_Sizes_r10 = (uint16_t) 0; + } + if (mac_MainConfig->ext2->mac_MainConfig_v1020-> + extendedPHR_r10) { + UE_mac_inst[Mod_idP].scheduling_info.extendedPHR_r10 = + (uint16_t) * + mac_MainConfig->ext2->mac_MainConfig_v1020-> + extendedPHR_r10; + } else { + UE_mac_inst[Mod_idP].scheduling_info.extendedPHR_r10 = + (uint16_t) 0; + } + } else { + UE_mac_inst[Mod_idP].scheduling_info.extendedBSR_Sizes_r10 = + (uint16_t) 0; + UE_mac_inst[Mod_idP].scheduling_info.extendedPHR_r10 = + (uint16_t) 0; } #endif + UE_mac_inst[Mod_idP].scheduling_info.periodicBSR_SF = + MAC_UE_BSR_TIMER_NOT_RUNNING; + UE_mac_inst[Mod_idP].scheduling_info.retxBSR_SF = + MAC_UE_BSR_TIMER_NOT_RUNNING; - if (measObj != NULL) { - if (measObj[0] != NULL) { - UE_mac_inst[Mod_idP].n_adj_cells = - measObj[0]->measObject.choice. - measObjectEUTRA.cellsToAddModList->list.count; - LOG_I(MAC, "Number of adjacent cells %d\n", - UE_mac_inst[Mod_idP].n_adj_cells); + UE_mac_inst[Mod_idP].BSR_reporting_active = BSR_TRIGGER_NONE; - for (i = 0; i < UE_mac_inst[Mod_idP].n_adj_cells; i++) { - UE_mac_inst[Mod_idP].adj_cell_id[i] = - measObj[0]->measObject.choice. - measObjectEUTRA.cellsToAddModList->list.array[i]-> - physCellId; - LOG_I(MAC, "Cell %d : Nid_cell %d\n", i, - UE_mac_inst[Mod_idP].adj_cell_id[i]); - } + LOG_D(MAC, "[UE %d]: periodic BSR %d (SF), retx BSR %d (SF)\n", + Mod_idP, + UE_mac_inst[Mod_idP].scheduling_info.periodicBSR_SF, + UE_mac_inst[Mod_idP].scheduling_info.retxBSR_SF); - phy_config_meas_ue(Mod_idP, 0, eNB_index, - UE_mac_inst[Mod_idP].n_adj_cells, - UE_mac_inst[Mod_idP].adj_cell_id); - } + UE_mac_inst[Mod_idP].scheduling_info.drx_config = + mac_MainConfig->drx_Config; + UE_mac_inst[Mod_idP].scheduling_info.phr_config = + mac_MainConfig->phr_Config; + + if (mac_MainConfig->phr_Config) { + UE_mac_inst[Mod_idP].PHR_state = + mac_MainConfig->phr_Config->present; + UE_mac_inst[Mod_idP].PHR_reconfigured = 1; + UE_mac_inst[Mod_idP].scheduling_info.periodicPHR_Timer = + mac_MainConfig->phr_Config->choice.setup.periodicPHR_Timer; + UE_mac_inst[Mod_idP].scheduling_info.prohibitPHR_Timer = + mac_MainConfig->phr_Config->choice.setup.prohibitPHR_Timer; + UE_mac_inst[Mod_idP].scheduling_info.PathlossChange = + mac_MainConfig->phr_Config->choice.setup.dl_PathlossChange; + } else { + UE_mac_inst[Mod_idP].PHR_reconfigured = 0; + UE_mac_inst[Mod_idP].PHR_state = + MAC_MainConfig__phr_Config_PR_setup; + UE_mac_inst[Mod_idP].scheduling_info.periodicPHR_Timer = + MAC_MainConfig__phr_Config__setup__periodicPHR_Timer_sf20; + UE_mac_inst[Mod_idP].scheduling_info.prohibitPHR_Timer = + MAC_MainConfig__phr_Config__setup__prohibitPHR_Timer_sf20; + UE_mac_inst[Mod_idP].scheduling_info.PathlossChange = + MAC_MainConfig__phr_Config__setup__dl_PathlossChange_dB1; } - - if (mobilityControlInfo != NULL) { - - LOG_D(MAC, "[UE%d] MAC Reset procedure triggered by RRC eNB %d \n", - Mod_idP, eNB_index); - ue_mac_reset(Mod_idP, eNB_index); - - if (mobilityControlInfo->radioResourceConfigCommon. - rach_ConfigCommon) { - memcpy((void *) - &UE_mac_inst[Mod_idP].radioResourceConfigCommon-> - rach_ConfigCommon, - (void *) mobilityControlInfo-> - radioResourceConfigCommon.rach_ConfigCommon, - sizeof(RACH_ConfigCommon_t)); - } - - memcpy((void *) &UE_mac_inst[Mod_idP]. - radioResourceConfigCommon->prach_Config.prach_ConfigInfo, - (void *) mobilityControlInfo-> - radioResourceConfigCommon.prach_Config.prach_ConfigInfo, - sizeof(PRACH_ConfigInfo_t)); - UE_mac_inst[Mod_idP].radioResourceConfigCommon-> - prach_Config.rootSequenceIndex = - mobilityControlInfo->radioResourceConfigCommon. - prach_Config.rootSequenceIndex; - - if (mobilityControlInfo->radioResourceConfigCommon. - pdsch_ConfigCommon) { - memcpy((void *) - &UE_mac_inst[Mod_idP].radioResourceConfigCommon-> - pdsch_ConfigCommon, - (void *) mobilityControlInfo-> - radioResourceConfigCommon.pdsch_ConfigCommon, - sizeof(PDSCH_ConfigCommon_t)); - } - // not a pointer: mobilityControlInfo->radioResourceConfigCommon.pusch_ConfigCommon - memcpy((void *) &UE_mac_inst[Mod_idP]. - radioResourceConfigCommon->pusch_ConfigCommon, - (void *) &mobilityControlInfo-> - radioResourceConfigCommon.pusch_ConfigCommon, - sizeof(PUSCH_ConfigCommon_t)); - - if (mobilityControlInfo->radioResourceConfigCommon.phich_Config) { - /* memcpy((void *)&UE_mac_inst[Mod_idP].radioResourceConfigCommon->phich_Config, - (void *)mobilityControlInfo->radioResourceConfigCommon.phich_Config, - sizeof(PHICH_Config_t)); */ - } - - if (mobilityControlInfo->radioResourceConfigCommon. - pucch_ConfigCommon) { - memcpy((void *) - &UE_mac_inst[Mod_idP].radioResourceConfigCommon-> - pucch_ConfigCommon, - (void *) mobilityControlInfo-> - radioResourceConfigCommon.pucch_ConfigCommon, - sizeof(PUCCH_ConfigCommon_t)); - } - - if (mobilityControlInfo-> - radioResourceConfigCommon.soundingRS_UL_ConfigCommon) { - memcpy((void *) - &UE_mac_inst[Mod_idP].radioResourceConfigCommon-> - soundingRS_UL_ConfigCommon, - (void *) mobilityControlInfo-> - radioResourceConfigCommon.soundingRS_UL_ConfigCommon, - sizeof(SoundingRS_UL_ConfigCommon_t)); - } - - if (mobilityControlInfo-> - radioResourceConfigCommon.uplinkPowerControlCommon) { - memcpy((void *) - &UE_mac_inst[Mod_idP].radioResourceConfigCommon-> - uplinkPowerControlCommon, - (void *) mobilityControlInfo-> - radioResourceConfigCommon.uplinkPowerControlCommon, - sizeof(UplinkPowerControlCommon_t)); - } - //configure antennaInfoCommon somewhere here.. - if (mobilityControlInfo->radioResourceConfigCommon.p_Max) { - //to be configured - } - - if (mobilityControlInfo->radioResourceConfigCommon.tdd_Config) { - UE_mac_inst[Mod_idP].tdd_Config = - mobilityControlInfo->radioResourceConfigCommon.tdd_Config; - } - - if (mobilityControlInfo-> - radioResourceConfigCommon.ul_CyclicPrefixLength) { - memcpy((void *) - &UE_mac_inst[Mod_idP].radioResourceConfigCommon-> - ul_CyclicPrefixLength, - (void *) mobilityControlInfo-> - radioResourceConfigCommon.ul_CyclicPrefixLength, - sizeof(UL_CyclicPrefixLength_t)); - } - // store the previous rnti in case of failure, and set thenew rnti - UE_mac_inst[Mod_idP].crnti_before_ho = UE_mac_inst[Mod_idP].crnti; - UE_mac_inst[Mod_idP].crnti = - ((mobilityControlInfo-> - newUE_Identity.buf[0]) | (mobilityControlInfo-> - newUE_Identity.buf[1] << 8)); - LOG_I(MAC, "[UE %d] Received new identity %x from %d\n", Mod_idP, - UE_mac_inst[Mod_idP].crnti, eNB_index); - UE_mac_inst[Mod_idP].rach_ConfigDedicated = - malloc(sizeof(*mobilityControlInfo->rach_ConfigDedicated)); - - if (mobilityControlInfo->rach_ConfigDedicated) { - memcpy((void *) UE_mac_inst[Mod_idP].rach_ConfigDedicated, - (void *) mobilityControlInfo->rach_ConfigDedicated, - sizeof(*mobilityControlInfo->rach_ConfigDedicated)); - } - - phy_config_afterHO_ue(Mod_idP, 0, eNB_index, mobilityControlInfo, - 0); - } + UE_mac_inst[Mod_idP].scheduling_info.periodicPHR_SF = + get_sf_perioidicPHR_Timer(UE_mac_inst[Mod_idP]. + scheduling_info.periodicPHR_Timer); + UE_mac_inst[Mod_idP].scheduling_info.prohibitPHR_SF = + get_sf_prohibitPHR_Timer(UE_mac_inst[Mod_idP]. + scheduling_info.prohibitPHR_Timer); + UE_mac_inst[Mod_idP].scheduling_info.PathlossChange_db = + get_db_dl_PathlossChange(UE_mac_inst[Mod_idP]. + scheduling_info.PathlossChange); + UE_mac_inst[Mod_idP].PHR_reporting_active = 0; + LOG_D(MAC, + "[UE %d] config PHR (%d): periodic %d (SF) prohibit %d (SF) pathlosschange %d (db) \n", + Mod_idP, + (mac_MainConfig->phr_Config) ? mac_MainConfig-> + phr_Config->present : -1, + UE_mac_inst[Mod_idP].scheduling_info.periodicPHR_SF, + UE_mac_inst[Mod_idP].scheduling_info.prohibitPHR_SF, + UE_mac_inst[Mod_idP].scheduling_info.PathlossChange_db); + } - if (mbsfn_SubframeConfigList != NULL) { - LOG_I(MAC, - "[UE %d][CONFIG] Received %d subframe allocation pattern for MBSFN\n", - Mod_idP, mbsfn_SubframeConfigList->list.count); - UE_mac_inst[Mod_idP].num_sf_allocation_pattern = - mbsfn_SubframeConfigList->list.count; - - for (i = 0; i < mbsfn_SubframeConfigList->list.count; i++) { - LOG_I(MAC, - "[UE %d] Configuring MBSFN_SubframeConfig %d from received SIB2 \n", - Mod_idP, i); - UE_mac_inst[Mod_idP].mbsfn_SubframeConfig[i] = - mbsfn_SubframeConfigList->list.array[i]; - // LOG_I("[UE %d] MBSFN_SubframeConfig[%d] pattern is %ld\n", Mod_idP, - // UE_mac_inst[Mod_idP].mbsfn_SubframeConfig[i]->subframeAllocation.choice.oneFrame.buf[0]); - } - } + if (physicalConfigDedicated != NULL) { + phy_config_dedicated_ue(Mod_idP, 0, eNB_index, + physicalConfigDedicated); + UE_mac_inst[Mod_idP].physicalConfigDedicated = physicalConfigDedicated; // for SR proc + } #if defined(Rel10) || defined(Rel14) - if (mbsfn_AreaInfoList != NULL) { - LOG_I(MAC, "[UE %d][CONFIG] Received %d MBSFN Area Info\n", - Mod_idP, mbsfn_AreaInfoList->list.count); - UE_mac_inst[Mod_idP].num_active_mbsfn_area = - mbsfn_AreaInfoList->list.count; + if (sCellToAddMod_r10 != NULL) { - for (i = 0; i < mbsfn_AreaInfoList->list.count; i++) { - UE_mac_inst[Mod_idP].mbsfn_AreaInfo[i] = - mbsfn_AreaInfoList->list.array[i]; - LOG_I(MAC, - "[UE %d] MBSFN_AreaInfo[%d]: MCCH Repetition Period = %ld\n", - Mod_idP, i, - UE_mac_inst[Mod_idP].mbsfn_AreaInfo[i]-> - mcch_Config_r9.mcch_RepetitionPeriod_r9); - phy_config_sib13_ue(Mod_idP, 0, eNB_index, i, - UE_mac_inst[Mod_idP]. - mbsfn_AreaInfo[i]->mbsfn_AreaId_r9); - } + + phy_config_dedicated_scell_ue(Mod_idP, eNB_index, + sCellToAddMod_r10, 1); + UE_mac_inst[Mod_idP].physicalConfigDedicatedSCell_r10 = sCellToAddMod_r10->radioResourceConfigDedicatedSCell_r10->physicalConfigDedicatedSCell_r10; // using SCell index 0 + } +#endif + + if (measObj != NULL) { + if (measObj[0] != NULL) { + UE_mac_inst[Mod_idP].n_adj_cells = + measObj[0]->measObject.choice. + measObjectEUTRA.cellsToAddModList->list.count; + LOG_I(MAC, "Number of adjacent cells %d\n", + UE_mac_inst[Mod_idP].n_adj_cells); + + for (i = 0; i < UE_mac_inst[Mod_idP].n_adj_cells; i++) { + UE_mac_inst[Mod_idP].adj_cell_id[i] = + measObj[0]->measObject.choice. + measObjectEUTRA.cellsToAddModList->list.array[i]-> + physCellId; + LOG_I(MAC, "Cell %d : Nid_cell %d\n", i, + UE_mac_inst[Mod_idP].adj_cell_id[i]); + } + + phy_config_meas_ue(Mod_idP, 0, eNB_index, + UE_mac_inst[Mod_idP].n_adj_cells, + UE_mac_inst[Mod_idP].adj_cell_id); + } + } + + + if (mobilityControlInfo != NULL) { + + LOG_D(MAC, "[UE%d] MAC Reset procedure triggered by RRC eNB %d \n", + Mod_idP, eNB_index); + ue_mac_reset(Mod_idP, eNB_index); + + if (mobilityControlInfo->radioResourceConfigCommon. + rach_ConfigCommon) { + memcpy((void *) + &UE_mac_inst[Mod_idP].radioResourceConfigCommon-> + rach_ConfigCommon, + (void *) mobilityControlInfo-> + radioResourceConfigCommon.rach_ConfigCommon, + sizeof(RACH_ConfigCommon_t)); } - if (pmch_InfoList != NULL) { + memcpy((void *) &UE_mac_inst[Mod_idP]. + radioResourceConfigCommon->prach_Config.prach_ConfigInfo, + (void *) mobilityControlInfo-> + radioResourceConfigCommon.prach_Config.prach_ConfigInfo, + sizeof(PRACH_ConfigInfo_t)); + UE_mac_inst[Mod_idP].radioResourceConfigCommon-> + prach_Config.rootSequenceIndex = + mobilityControlInfo->radioResourceConfigCommon. + prach_Config.rootSequenceIndex; - // LOG_I(MAC,"DUY: lcid when entering rrc_mac config_req is %02d\n",(pmch_InfoList->list.array[0]->mbms_SessionInfoList_r9.list.array[0]->logicalChannelIdentity_r9)); - - LOG_I(MAC, "[UE %d] Configuring PMCH_config from MCCH MESSAGE \n", - Mod_idP); - - for (i = 0; i < pmch_InfoList->list.count; i++) { - UE_mac_inst[Mod_idP].pmch_Config[i] = - &pmch_InfoList->list.array[i]->pmch_Config_r9; - LOG_I(MAC, "[UE %d] PMCH[%d]: MCH_Scheduling_Period = %ld\n", - Mod_idP, i, - UE_mac_inst[Mod_idP]. - pmch_Config[i]->mch_SchedulingPeriod_r9); - } - - UE_mac_inst[Mod_idP].mcch_status = 1; + if (mobilityControlInfo->radioResourceConfigCommon. + pdsch_ConfigCommon) { + memcpy((void *) + &UE_mac_inst[Mod_idP].radioResourceConfigCommon-> + pdsch_ConfigCommon, + (void *) mobilityControlInfo-> + radioResourceConfigCommon.pdsch_ConfigCommon, + sizeof(PDSCH_ConfigCommon_t)); } + // not a pointer: mobilityControlInfo->radioResourceConfigCommon.pusch_ConfigCommon + memcpy((void *) &UE_mac_inst[Mod_idP]. + radioResourceConfigCommon->pusch_ConfigCommon, + (void *) &mobilityControlInfo-> + radioResourceConfigCommon.pusch_ConfigCommon, + sizeof(PUSCH_ConfigCommon_t)); + + if (mobilityControlInfo->radioResourceConfigCommon.phich_Config) { + /* memcpy((void *)&UE_mac_inst[Mod_idP].radioResourceConfigCommon->phich_Config, + (void *)mobilityControlInfo->radioResourceConfigCommon.phich_Config, + sizeof(PHICH_Config_t)); */ + } + + if (mobilityControlInfo->radioResourceConfigCommon. + pucch_ConfigCommon) { + memcpy((void *) + &UE_mac_inst[Mod_idP].radioResourceConfigCommon-> + pucch_ConfigCommon, + (void *) mobilityControlInfo-> + radioResourceConfigCommon.pucch_ConfigCommon, + sizeof(PUCCH_ConfigCommon_t)); + } + + if (mobilityControlInfo-> + radioResourceConfigCommon.soundingRS_UL_ConfigCommon) { + memcpy((void *) + &UE_mac_inst[Mod_idP].radioResourceConfigCommon-> + soundingRS_UL_ConfigCommon, + (void *) mobilityControlInfo-> + radioResourceConfigCommon.soundingRS_UL_ConfigCommon, + sizeof(SoundingRS_UL_ConfigCommon_t)); + } + + if (mobilityControlInfo-> + radioResourceConfigCommon.uplinkPowerControlCommon) { + memcpy((void *) + &UE_mac_inst[Mod_idP].radioResourceConfigCommon-> + uplinkPowerControlCommon, + (void *) mobilityControlInfo-> + radioResourceConfigCommon.uplinkPowerControlCommon, + sizeof(UplinkPowerControlCommon_t)); + } + //configure antennaInfoCommon somewhere here.. + if (mobilityControlInfo->radioResourceConfigCommon.p_Max) { + //to be configured + } + + if (mobilityControlInfo->radioResourceConfigCommon.tdd_Config) { + UE_mac_inst[Mod_idP].tdd_Config = + mobilityControlInfo->radioResourceConfigCommon.tdd_Config; + } + + if (mobilityControlInfo-> + radioResourceConfigCommon.ul_CyclicPrefixLength) { + memcpy((void *) + &UE_mac_inst[Mod_idP].radioResourceConfigCommon-> + ul_CyclicPrefixLength, + (void *) mobilityControlInfo-> + radioResourceConfigCommon.ul_CyclicPrefixLength, + sizeof(UL_CyclicPrefixLength_t)); + } + // store the previous rnti in case of failure, and set thenew rnti + UE_mac_inst[Mod_idP].crnti_before_ho = UE_mac_inst[Mod_idP].crnti; + UE_mac_inst[Mod_idP].crnti = + ((mobilityControlInfo-> + newUE_Identity.buf[0]) | (mobilityControlInfo-> + newUE_Identity.buf[1] << 8)); + LOG_I(MAC, "[UE %d] Received new identity %x from %d\n", Mod_idP, + UE_mac_inst[Mod_idP].crnti, eNB_index); + UE_mac_inst[Mod_idP].rach_ConfigDedicated = + malloc(sizeof(*mobilityControlInfo->rach_ConfigDedicated)); + + if (mobilityControlInfo->rach_ConfigDedicated) { + memcpy((void *) UE_mac_inst[Mod_idP].rach_ConfigDedicated, + (void *) mobilityControlInfo->rach_ConfigDedicated, + sizeof(*mobilityControlInfo->rach_ConfigDedicated)); + } + + phy_config_afterHO_ue(Mod_idP, 0, eNB_index, mobilityControlInfo, + 0); + } + + + if (mbsfn_SubframeConfigList != NULL) { + LOG_I(MAC, + "[UE %d][CONFIG] Received %d subframe allocation pattern for MBSFN\n", + Mod_idP, mbsfn_SubframeConfigList->list.count); + UE_mac_inst[Mod_idP].num_sf_allocation_pattern = + mbsfn_SubframeConfigList->list.count; + + for (i = 0; i < mbsfn_SubframeConfigList->list.count; i++) { + LOG_I(MAC, + "[UE %d] Configuring MBSFN_SubframeConfig %d from received SIB2 \n", + Mod_idP, i); + UE_mac_inst[Mod_idP].mbsfn_SubframeConfig[i] = + mbsfn_SubframeConfigList->list.array[i]; + // LOG_I("[UE %d] MBSFN_SubframeConfig[%d] pattern is %ld\n", Mod_idP, + // UE_mac_inst[Mod_idP].mbsfn_SubframeConfig[i]->subframeAllocation.choice.oneFrame.buf[0]); + } + } +#if defined(Rel10) || defined(Rel14) + + if (mbsfn_AreaInfoList != NULL) { + LOG_I(MAC, "[UE %d][CONFIG] Received %d MBSFN Area Info\n", + Mod_idP, mbsfn_AreaInfoList->list.count); + UE_mac_inst[Mod_idP].num_active_mbsfn_area = + mbsfn_AreaInfoList->list.count; + + for (i = 0; i < mbsfn_AreaInfoList->list.count; i++) { + UE_mac_inst[Mod_idP].mbsfn_AreaInfo[i] = + mbsfn_AreaInfoList->list.array[i]; + LOG_I(MAC, + "[UE %d] MBSFN_AreaInfo[%d]: MCCH Repetition Period = %ld\n", + Mod_idP, i, + UE_mac_inst[Mod_idP].mbsfn_AreaInfo[i]-> + mcch_Config_r9.mcch_RepetitionPeriod_r9); + phy_config_sib13_ue(Mod_idP, 0, eNB_index, i, + UE_mac_inst[Mod_idP]. + mbsfn_AreaInfo[i]->mbsfn_AreaId_r9); + } + } + + if (pmch_InfoList != NULL) { + + // LOG_I(MAC,"DUY: lcid when entering rrc_mac config_req is %02d\n",(pmch_InfoList->list.array[0]->mbms_SessionInfoList_r9.list.array[0]->logicalChannelIdentity_r9)); + + LOG_I(MAC, "[UE %d] Configuring PMCH_config from MCCH MESSAGE \n", + Mod_idP); + + for (i = 0; i < pmch_InfoList->list.count; i++) { + UE_mac_inst[Mod_idP].pmch_Config[i] = + &pmch_InfoList->list.array[i]->pmch_Config_r9; + LOG_I(MAC, "[UE %d] PMCH[%d]: MCH_Scheduling_Period = %ld\n", + Mod_idP, i, + UE_mac_inst[Mod_idP]. + pmch_Config[i]->mch_SchedulingPeriod_r9); + } + + UE_mac_inst[Mod_idP].mcch_status = 1; + } #endif #ifdef CBA - if (cba_rnti) { - UE_mac_inst[Mod_idP].cba_rnti[num_active_cba_groups - 1] = - cba_rnti; - LOG_D(MAC, - "[UE %d] configure CBA group %d RNTI %x for eNB %d (total active cba group %d)\n", - Mod_idP, Mod_idP % num_active_cba_groups, cba_rnti, - eNB_index, num_active_cba_groups); - phy_config_cba_rnti(Mod_idP, CC_idP, eNB_flagP, eNB_index, - cba_rnti, num_active_cba_groups - 1, - num_active_cba_groups); - } + if (cba_rnti) { + UE_mac_inst[Mod_idP].cba_rnti[num_active_cba_groups - 1] = + cba_rnti; + LOG_D(MAC, + "[UE %d] configure CBA group %d RNTI %x for eNB %d (total active cba group %d)\n", + Mod_idP, Mod_idP % num_active_cba_groups, cba_rnti, + eNB_index, num_active_cba_groups); + phy_config_cba_rnti(Mod_idP, CC_idP, eNB_flagP, eNB_index, + cba_rnti, num_active_cba_groups - 1, + num_active_cba_groups); + } #endif - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME - (VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_MAC_CONFIG, VCD_FUNCTION_OUT); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME + (VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_MAC_CONFIG, VCD_FUNCTION_OUT); - return (0); + return (0); } diff --git a/openair2/LAYER2/MAC/defs.h b/openair2/LAYER2/MAC/defs.h index 65e090e370..43d8167fe6 100644 --- a/openair2/LAYER2/MAC/defs.h +++ b/openair2/LAYER2/MAC/defs.h @@ -128,7 +128,11 @@ /*!\brief Maximum number od control elemenets */ #define MAX_NUM_CE 5 /*!\brief Maximum number of random access process */ +#if defined(USRP_REC_PLAY) +#define NB_RA_PROC_MAX 1 +#else #define NB_RA_PROC_MAX 4 +#endif /*!\brief size of buffer status report table */ #define BSR_TABLE_SIZE 64 /*!\brief The power headroom reporting range is from -23 ...+40 dB and beyond, with step 1 */ diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c index f7c3f5829d..2c3b88306a 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler.c +++ b/openair2/LAYER2/MAC/eNB_scheduler.c @@ -352,17 +352,17 @@ schedule_SR(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP) ul_req = &RC.mac[module_idP]->UL_req[CC_id].ul_config_request_body; + // drop the allocation if the UE hasn't send RRCConnectionSetupComplete yet + if (mac_eNB_get_rrc_status + (module_idP, UE_RNTI(module_idP, UE_id)) < RRC_CONNECTED) + continue; + AssertFatal(UE_list-> UE_template[CC_id][UE_id].physicalConfigDedicated != NULL, "physicalConfigDedicated is null for UE %d\n", UE_id); - // drop the allocation if the UE hasn't send RRCConnectionSetupComplete yet - if (mac_eNB_get_rrc_status - (module_idP, UE_RNTI(module_idP, UE_id)) < RRC_CONNECTED) - continue; - if ((SRconfig = UE_list-> UE_template[CC_id][UE_id].physicalConfigDedicated-> diff --git a/openair2/LAYER2/MAC/eNB_scheduler_RA.c b/openair2/LAYER2/MAC/eNB_scheduler_RA.c index 939f35f2eb..327f5faafe 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_RA.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_RA.c @@ -1579,7 +1579,25 @@ initiate_ra_proc(module_id_t module_idP, ra[i].Msg2_subframe = (subframeP + 4) % 10; /* TODO: find better procedure to allocate RNTI */ do { +#if defined(USRP_REC_PLAY) // deterministic rnti in usrp record/playback mode + static int drnti[NUMBER_OF_UE_MAX] = { 0xbda7, 0x71da, 0x9c40, 0xc350, 0x2710, 0x4e20, 0x7530, 0x1388, 0x3a98, 0x61a8, 0x88b8, 0xafc8, 0xd6d8, 0x1b58, 0x4268, 0x6978 }; + int j = 0; + int nb_ue = 0; + for (j = 0; j < NUMBER_OF_UE_MAX; j++) { + if (UE_RNTI(module_idP, j) > 0) { + nb_ue++; + } else { + break; + } + } + if (nb_ue >= NUMBER_OF_UE_MAX) { + printf("No more free RNTI available, increase NUMBER_OF_UE_MAX\n"); + abort(); + } + ra[i].rnti = drnti[nb_ue]; +#else ra[i].rnti = taus(); +#endif loop++; } while (loop != 100 && diff --git a/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c b/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c index 9dbbb39d03..08bb13e691 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c @@ -912,8 +912,8 @@ schedule_ue_spec(module_id_t module_idP, if (rlc_status.bytes_in_buffer > 0) { // There is DCCH to transmit LOG_D(MAC, - "[eNB %d] Frame %d, DL-DCCH->DLSCH CC_id %d, Requesting %d bytes from RLC (RRC message)\n", - module_idP, frameP, CC_id, + "[eNB %d] SFN/SF %d.%d, DL-DCCH->DLSCH CC_id %d, Requesting %d bytes from RLC (RRC message)\n", + module_idP, frameP, subframeP, CC_id, TBS - header_len_dcch); sdu_lengths[0] = mac_rlc_data_req(module_idP, rnti, module_idP, frameP, ENB_FLAG_YES, MBMS_FLAG_NO, DCCH, TBS, //not used (char *) diff --git a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c index 42c50d8063..df84675dc1 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c @@ -1349,9 +1349,14 @@ fill_nfapi_harq_information(module_id_t module_idP, AssertFatal(UE_id >= 0, "UE_id cannot be found, impossible\n"); AssertFatal(UE_list != NULL, "UE_list is null\n"); +#if 0 + /* TODO: revisit, don't use Assert, it's perfectly possible to + * have physicalConfigDedicated NULL here + */ AssertFatal(UE_list->UE_template[CC_idP][UE_id]. physicalConfigDedicated != NULL, "physicalConfigDedicated for rnti %x is null\n", rntiP); +#endif harq_information->harq_information_rel11.num_ant_ports = 1; @@ -2057,6 +2062,9 @@ int add_new_ue(module_id_t mod_idP, int cc_idP, rnti_t rntiP, int harq_pidP UE_list->ordered_ULCCids[0][UE_id] = cc_idP; UE_list->num_UEs++; UE_list->active[UE_id] = TRUE; +#if defined(USRP_REC_PLAY) // not specific to record/playback ? + UE_list->UE_template[cc_idP][UE_id].pre_assigned_mcs_ul = 0; +#endif #ifdef Rel14 UE_list->UE_template[cc_idP][UE_id].rach_resource_type = @@ -3585,11 +3593,9 @@ extract_harq(module_id_t mod_idP, int CC_idP, int UE_id, uint8_t *pdu; #ifdef Rel14 - AssertFatal(UE_list-> - UE_template[pCCid][UE_id].physicalConfigDedicated-> - pucch_ConfigDedicated != NULL, - "pucch_ConfigDedicated is null!\n"); - if ((UE_list->UE_template[pCCid][UE_id].physicalConfigDedicated->ext7) + if (UE_list->UE_template[pCCid][UE_id].physicalConfigDedicated != NULL && + UE_list->UE_template[pCCid][UE_id].physicalConfigDedicated->pucch_ConfigDedicated != NULL && + (UE_list->UE_template[pCCid][UE_id].physicalConfigDedicated->ext7) && (UE_list->UE_template[pCCid][UE_id]. physicalConfigDedicated->ext7->pucch_ConfigDedicated_r13) && diff --git a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c index 343d391538..e8de34ca68 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c @@ -268,6 +268,9 @@ rx_sdu(const module_id_t enb_mod_idP, "[eNB %d] Frame %d, Subframe %d CC_id %d MAC CE_LCID %d (ce %d/%d): CRNTI %x (UE_id %d) in Msg3\n", enb_mod_idP, frameP, subframeP, CC_idP, rx_ces[i], i, num_ce, old_rnti, old_UE_id); + /* receiving CRNTI means that the current rnti has to go away */ + cancel_ra_proc(enb_mod_idP, CC_idP, frameP, + current_rnti); if (old_UE_id != -1) { /* TODO: if the UE did random access (followed by a MAC uplink with * CRNTI) because none of its scheduling request was granted, then @@ -288,9 +291,6 @@ rx_sdu(const module_id_t enb_mod_idP, mac_eNB_rrc_ul_in_sync(enb_mod_idP, CC_idP, frameP, subframeP, old_rnti); } - /* receiving CRNTI means that the current rnti has to go away */ - cancel_ra_proc(enb_mod_idP, CC_idP, frameP, - current_rnti); current_rnti = old_rnti; } crnti_rx = 1; @@ -1181,8 +1181,8 @@ schedule_ulsch_rnti(module_id_t module_idP, AssertFatal(round < 8, "round %d > 7 for UE %d/%x\n", round, UE_id, rnti); LOG_D(MAC, - "[eNB %d] frame %d subframe %d,Checking PUSCH %d for UE %d/%x CC %d : aggregation level %d, N_RB_UL %d\n", - module_idP, frameP, subframeP, harq_pid, UE_id, rnti, + "[eNB %d] frame %d subframe %d (sched_frame %d, sched_subframe %d), Checking PUSCH %d for UE %d/%x CC %d : aggregation level %d, N_RB_UL %d\n", + module_idP, frameP, subframeP, sched_frame, sched_subframeP, harq_pid, UE_id, rnti, CC_id, aggregation, N_RB_UL); RC.eNB[module_idP][CC_id]->pusch_stats_BO[UE_id][(frameP * diff --git a/openair2/LAYER2/MAC/main.c b/openair2/LAYER2/MAC/main.c index fcaab0b80b..534f603dfd 100644 --- a/openair2/LAYER2/MAC/main.c +++ b/openair2/LAYER2/MAC/main.c @@ -210,7 +210,7 @@ void mac_init_cell_params(int Mod_idP, int CC_idP) UE_TEMPLATE *UE_template; LOG_D(MAC, "[MSC_NEW][FRAME 00000][MAC_eNB][MOD %02d][]\n", Mod_idP); - COMMON_channels_t *cc = &RC.mac[Mod_idP]->common_channels[CC_idP]; + //COMMON_channels_t *cc = &RC.mac[Mod_idP]->common_channels[CC_idP]; memset(&RC.mac[Mod_idP]->eNB_stats, 0, sizeof(eNB_STATS)); UE_template = diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_security.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_security.c index d395f95981..2554eb145a 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_security.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_security.c @@ -220,7 +220,7 @@ pdcp_validate_security( stream_decrypt(pdcp_pP->cipheringAlgorithm, &decrypt_params, &buffer_decrypted); - +#if !defined(USRP_REC_PLAY) if (srb_flagP) { /* Now check the integrity of the complete PDU */ decrypt_params.message = pdcp_pdu_buffer; @@ -241,7 +241,7 @@ pdcp_validate_security( return -1; } } - +#endif VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_VALIDATE_SECURITY, VCD_FUNCTION_OUT); return 0; diff --git a/openair2/RRC/LITE/L2_interface.c b/openair2/RRC/LITE/L2_interface.c index 408e0e8175..504bf8ee9b 100644 --- a/openair2/RRC/LITE/L2_interface.c +++ b/openair2/RRC/LITE/L2_interface.c @@ -807,7 +807,10 @@ mac_UE_get_rrc_status( ) //------------------------------------------------------------------------------ { - return(UE_rrc_inst[Mod_idP].Info[indexP].State); + if (UE_rrc_inst) + return(UE_rrc_inst[Mod_idP].Info[indexP].State); + else + return(-1); } //-------------------------------------------------------------------------------------------// diff --git a/openair2/RRC/LITE/defs.h b/openair2/RRC/LITE/defs.h index 0811818c72..9d7f7fdf2d 100644 --- a/openair2/RRC/LITE/defs.h +++ b/openair2/RRC/LITE/defs.h @@ -242,7 +242,11 @@ typedef enum HO_STATE_e { // #define NUM_MAX_CBA_GROUP 4 // in the platform_constants /* TS 36.331: RRC-TransactionIdentifier ::= INTEGER (0..3) */ +#if defined(USRP_REC_PLAY) +#define RRC_TRANSACTION_IDENTIFIER_NUMBER 1 +#else #define RRC_TRANSACTION_IDENTIFIER_NUMBER 3 +#endif typedef struct { unsigned short transport_block_size; /*!< \brief Minimum PDU size in bytes provided by RLC to MAC layer interface */ diff --git a/openair2/RRC/LITE/rrc_UE.c b/openair2/RRC/LITE/rrc_UE.c index f0f495e8b7..67159fa248 100644 --- a/openair2/RRC/LITE/rrc_UE.c +++ b/openair2/RRC/LITE/rrc_UE.c @@ -730,13 +730,8 @@ rrc_ue_establish_drb( */ #ifdef PDCP_USE_NETLINK # if !defined(OAI_NW_DRIVER_TYPE_ETHERNET) && !defined(EXMIMO) && !defined(OAI_USRP) && !defined(OAI_BLADERF) && !defined(ETHERNET) && !defined(LINK_ENB_PDCP_TO_GTPV1U) -# ifdef OAI_EMU - ip_addr_offset3 = oai_emulation.info.nb_enb_local; - ip_addr_offset4 = NB_eNB_INST; -# else ip_addr_offset3 = 0; - ip_addr_offset4 = 8; -# endif + ip_addr_offset4 = 1; LOG_I(OIP,"[UE %d] trying to bring up the OAI interface oai%d, IP 10.0.%d.%d\n", ue_mod_idP, ip_addr_offset3+ue_mod_idP, ip_addr_offset3+ue_mod_idP+1,ip_addr_offset4+ue_mod_idP+1); oip_ifup=nas_config(ip_addr_offset3+ue_mod_idP, // interface_id @@ -1540,7 +1535,7 @@ rrc_ue_process_radioResourceConfigDedicated( UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].State = RRC_CONNECTED; LOG_I(RRC,"[UE %d] State = RRC_CONNECTED (eNB %d)\n",ctxt_pP->module_id,eNB_index); -#if !defined(ENABLE_USE_MME) && defined(OAI_EMU) +#if 0//!defined(ENABLE_USE_MME) && defined(OAI_EMU) # ifdef OAI_EMU rrc_eNB_emulation_notify_ue_module_id( ctxt_pP->module_id, @@ -1691,64 +1686,68 @@ rrc_ue_process_securityModeCommand( #endif //#if defined(ENABLE_SECURITY) if (securityModeCommand->criticalExtensions.present == SecurityModeCommand__criticalExtensions_PR_c1) { - if (securityModeCommand->criticalExtensions.choice.c1.present == SecurityModeCommand__criticalExtensions__c1_PR_securityModeCommand_r8) { - - ul_dcch_msg.message.choice.c1.choice.securityModeComplete.rrc_TransactionIdentifier = securityModeCommand->rrc_TransactionIdentifier; - ul_dcch_msg.message.choice.c1.choice.securityModeComplete.criticalExtensions.present = SecurityModeCommand__criticalExtensions_PR_c1; - ul_dcch_msg.message.choice.c1.choice.securityModeComplete.criticalExtensions.choice.securityModeComplete_r8.nonCriticalExtension =NULL; - - LOG_I(RRC,"[UE %d] Frame %d: Receiving from SRB1 (DL-DCCH), encoding securityModeComplete (eNB %d)\n", - ctxt_pP->module_id,ctxt_pP->frame,eNB_index); - - enc_rval = uper_encode_to_buffer(&asn_DEF_UL_DCCH_Message, - (void*)&ul_dcch_msg, - buffer, - 100); - AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %jd)!\n", - enc_rval.failed_type->name, enc_rval.encoded); - + if (securityModeCommand->criticalExtensions.choice.c1.present != SecurityModeCommand__criticalExtensions__c1_PR_securityModeCommand_r8) + LOG_W(RRC,"securityModeCommand->criticalExtensions.choice.c1.present (%d) != SecurityModeCommand__criticalExtensions__c1_PR_securityModeCommand_r8\n", + securityModeCommand->criticalExtensions.choice.c1.present); + + + ul_dcch_msg.message.choice.c1.choice.securityModeComplete.rrc_TransactionIdentifier = securityModeCommand->rrc_TransactionIdentifier; + ul_dcch_msg.message.choice.c1.choice.securityModeComplete.criticalExtensions.present = SecurityModeCommand__criticalExtensions_PR_c1; + ul_dcch_msg.message.choice.c1.choice.securityModeComplete.criticalExtensions.choice.securityModeComplete_r8.nonCriticalExtension =NULL; + + LOG_I(RRC,"[UE %d] Frame %d: Receiving from SRB1 (DL-DCCH), encoding securityModeComplete (eNB %d)\n", + ctxt_pP->module_id,ctxt_pP->frame,eNB_index); + + enc_rval = uper_encode_to_buffer(&asn_DEF_UL_DCCH_Message, + (void*)&ul_dcch_msg, + buffer, + 100); + AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %jd)!\n", + enc_rval.failed_type->name, enc_rval.encoded); + #ifdef XER_PRINT - xer_fprint(stdout, &asn_DEF_UL_DCCH_Message, (void*)&ul_dcch_msg); + xer_fprint(stdout, &asn_DEF_UL_DCCH_Message, (void*)&ul_dcch_msg); #endif - + #if defined(ENABLE_ITTI) # if !defined(DISABLE_XER_SPRINT) - { - char message_string[20000]; - size_t message_string_size; - - if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_UL_DCCH_Message, (void *) &ul_dcch_msg)) > 0) { - MessageDef *msg_p; - - msg_p = itti_alloc_new_message_sized (TASK_RRC_UE, RRC_UL_DCCH, message_string_size + sizeof (IttiMsgText)); - msg_p->ittiMsg.rrc_ul_dcch.size = message_string_size; - memcpy(&msg_p->ittiMsg.rrc_ul_dcch.text, message_string, message_string_size); - - itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, msg_p); - } + { + char message_string[20000]; + size_t message_string_size; + + if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_UL_DCCH_Message, (void *) &ul_dcch_msg)) > 0) { + MessageDef *msg_p; + + msg_p = itti_alloc_new_message_sized (TASK_RRC_UE, RRC_UL_DCCH, message_string_size + sizeof (IttiMsgText)); + msg_p->ittiMsg.rrc_ul_dcch.size = message_string_size; + memcpy(&msg_p->ittiMsg.rrc_ul_dcch.text, message_string, message_string_size); + + itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, msg_p); } + } # endif #endif - + #ifdef USER_MODE - LOG_D(RRC, "securityModeComplete Encoded %zd bits (%zd bytes)\n", enc_rval.encoded, (enc_rval.encoded+7)/8); + LOG_D(RRC, "securityModeComplete Encoded %zd bits (%zd bytes)\n", enc_rval.encoded, (enc_rval.encoded+7)/8); #endif - - for (i = 0; i < (enc_rval.encoded + 7) / 8; i++) { - LOG_T(RRC, "%02x.", buffer[i]); - } - - LOG_T(RRC, "\n"); - rrc_data_req ( - ctxt_pP, - DCCH, - rrc_mui++, - SDU_CONFIRM_NO, - (enc_rval.encoded + 7) / 8, - buffer, - PDCP_TRANSMISSION_MODE_CONTROL); + + for (i = 0; i < (enc_rval.encoded + 7) / 8; i++) { + LOG_T(RRC, "%02x.", buffer[i]); } + + LOG_T(RRC, "\n"); + rrc_data_req ( + ctxt_pP, + DCCH, + rrc_mui++, + SDU_CONFIRM_NO, + (enc_rval.encoded + 7) / 8, + buffer, + PDCP_TRANSMISSION_MODE_CONTROL); } + else LOG_W(RRC,"securityModeCommand->criticalExtensions.present (%d) != SecurityModeCommand__criticalExtensions_PR_c1\n", + securityModeCommand->criticalExtensions.present); } //----------------------------------------------------------------------------- @@ -1792,68 +1791,72 @@ rrc_ue_process_ueCapabilityEnquiry( // ue_CapabilityRAT_Container.ueCapabilityRAT_Container.size = UE_rrc_inst[ue_mod_idP].UECapability_size; - if (UECapabilityEnquiry->criticalExtensions.present == UECapabilityEnquiry__criticalExtensions_PR_c1) { - if (UECapabilityEnquiry->criticalExtensions.choice.c1.present == UECapabilityEnquiry__criticalExtensions__c1_PR_ueCapabilityEnquiry_r8) { - ul_dcch_msg.message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.present = UECapabilityInformation__criticalExtensions_PR_c1; - ul_dcch_msg.message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.choice.c1.present = - UECapabilityInformation__criticalExtensions__c1_PR_ueCapabilityInformation_r8; - ul_dcch_msg.message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList.list.count - =0; - - for (i=0; icriticalExtensions.choice.c1.choice.ueCapabilityEnquiry_r8.ue_CapabilityRequest.list.count; i++) { - - if (*UECapabilityEnquiry->criticalExtensions.choice.c1.choice.ueCapabilityEnquiry_r8.ue_CapabilityRequest.list.array[i] - == RAT_Type_eutra) { - ASN_SEQUENCE_ADD( - &ul_dcch_msg.message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList.list, - &ue_CapabilityRAT_Container); - - enc_rval = uper_encode_to_buffer(&asn_DEF_UL_DCCH_Message, (void*) &ul_dcch_msg, buffer, 100); - AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %jd)!\n", - enc_rval.failed_type->name, enc_rval.encoded); + AssertFatal(UECapabilityEnquiry->criticalExtensions.present == UECapabilityEnquiry__criticalExtensions_PR_c1, + "UECapabilityEnquiry->criticalExtensions.present (%d) != UECapabilityEnquiry__criticalExtensions_PR_c1 (%d)\n", + UECapabilityEnquiry->criticalExtensions.present,UECapabilityEnquiry__criticalExtensions_PR_c1); + if (UECapabilityEnquiry->criticalExtensions.choice.c1.present != UECapabilityEnquiry__criticalExtensions__c1_PR_ueCapabilityEnquiry_r8) + LOG_W(RRC,"UECapabilityEnquiry->criticalExtensions.choice.c1.present (%d) != UECapabilityEnquiry__criticalExtensions__c1_PR_ueCapabilityEnquiry_r8)\n", + UECapabilityEnquiry->criticalExtensions.choice.c1.present); + + ul_dcch_msg.message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.present = UECapabilityInformation__criticalExtensions_PR_c1; + ul_dcch_msg.message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.choice.c1.present = + UECapabilityInformation__criticalExtensions__c1_PR_ueCapabilityInformation_r8; + ul_dcch_msg.message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList.list.count + =0; + + for (i=0; icriticalExtensions.choice.c1.choice.ueCapabilityEnquiry_r8.ue_CapabilityRequest.list.count; i++) { + + if (*UECapabilityEnquiry->criticalExtensions.choice.c1.choice.ueCapabilityEnquiry_r8.ue_CapabilityRequest.list.array[i] + == RAT_Type_eutra) { + ASN_SEQUENCE_ADD( + &ul_dcch_msg.message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList.list, + &ue_CapabilityRAT_Container); + + enc_rval = uper_encode_to_buffer(&asn_DEF_UL_DCCH_Message, (void*) &ul_dcch_msg, buffer, 100); + AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %jd)!\n", + enc_rval.failed_type->name, enc_rval.encoded); + #ifdef XER_PRINT - xer_fprint(stdout, &asn_DEF_UL_DCCH_Message, (void*)&ul_dcch_msg); + xer_fprint(stdout, &asn_DEF_UL_DCCH_Message, (void*)&ul_dcch_msg); #endif - + #if defined(ENABLE_ITTI) # if !defined(DISABLE_XER_SPRINT) - { - char message_string[20000]; - size_t message_string_size; - - if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_UL_DCCH_Message, (void *) &ul_dcch_msg)) > 0) { - MessageDef *msg_p; - - msg_p = itti_alloc_new_message_sized (TASK_RRC_UE, RRC_UL_DCCH, message_string_size + sizeof (IttiMsgText)); - msg_p->ittiMsg.rrc_ul_dcch.size = message_string_size; - memcpy(&msg_p->ittiMsg.rrc_ul_dcch.text, message_string, message_string_size); - - itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, msg_p); - } - } + { + char message_string[20000]; + size_t message_string_size; + + if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_UL_DCCH_Message, (void *) &ul_dcch_msg)) > 0) { + MessageDef *msg_p; + + msg_p = itti_alloc_new_message_sized (TASK_RRC_UE, RRC_UL_DCCH, message_string_size + sizeof (IttiMsgText)); + msg_p->ittiMsg.rrc_ul_dcch.size = message_string_size; + memcpy(&msg_p->ittiMsg.rrc_ul_dcch.text, message_string, message_string_size); + + itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, msg_p); + } + } # endif #endif + -#ifdef USER_MODE - LOG_D(RRC,"UECapabilityInformation Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8); -#endif + LOG_I(RRC,"UECapabilityInformation Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8); - for (i = 0; i < (enc_rval.encoded + 7) / 8; i++) { - LOG_T(RRC, "%02x.", buffer[i]); - } - - LOG_T(RRC, "\n"); - rrc_data_req ( - ctxt_pP, - DCCH, - rrc_mui++, - SDU_CONFIRM_NO, - (enc_rval.encoded + 7) / 8, - buffer, - PDCP_TRANSMISSION_MODE_CONTROL); - } + + for (i = 0; i < (enc_rval.encoded + 7) / 8; i++) { + LOG_T(RRC, "%02x.", buffer[i]); } + + LOG_T(RRC, "\n"); + rrc_data_req ( + ctxt_pP, + DCCH, + rrc_mui++, + SDU_CONFIRM_NO, + (enc_rval.encoded + 7) / 8, + buffer, + PDCP_TRANSMISSION_MODE_CONTROL); } } } diff --git a/openair2/RRC/LITE/rrc_eNB.c b/openair2/RRC/LITE/rrc_eNB.c index 28d6982652..c8b0e3390a 100644 --- a/openair2/RRC/LITE/rrc_eNB.c +++ b/openair2/RRC/LITE/rrc_eNB.c @@ -608,7 +608,7 @@ rrc_eNB_get_next_free_ue_context( } } -#if !defined(ENABLE_USE_MME) +#if 0 //!defined(ENABLE_USE_MME) void rrc_eNB_emulation_notify_ue_module_id( const module_id_t ue_module_idP, const rnti_t rntiP, @@ -627,12 +627,12 @@ void rrc_eNB_emulation_notify_ue_module_id( return; } for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { - if (RC.rrc[enb_module_id].carrier[CC_id].sib1 != NULL) { + if (&RC.rrc[enb_module_id]->carrier[CC_id].sib1 != NULL) { if ( - (RC.rrc[enb_module_id].carrier[CC_id].sib1->cellAccessRelatedInfo.cellIdentity.buf[0] == cell_identity_byte0P) && - (RC.rrc[enb_module_id].carrier[CC_id].sib1->cellAccessRelatedInfo.cellIdentity.buf[1] == cell_identity_byte1P) && - (RC.rrc[enb_module_id].carrier[CC_id].sib1->cellAccessRelatedInfo.cellIdentity.buf[2] == cell_identity_byte2P) && - (RC.rrc[enb_module_id].carrier[CC_id].sib1->cellAccessRelatedInfo.cellIdentity.buf[3] == cell_identity_byte3P) + (&RC.rrc[enb_module_id]->carrier[CC_id].sib1->cellAccessRelatedInfo.cellIdentity.buf[0] == cell_identity_byte0P) && + (&RC.rrc[enb_module_id]->carrier[CC_id].sib1->cellAccessRelatedInfo.cellIdentity.buf[1] == cell_identity_byte1P) && + (&RC.rrc[enb_module_id]->carrier[CC_id].sib1->cellAccessRelatedInfo.cellIdentity.buf[2] == cell_identity_byte2P) && + (&RC.rrc[enb_module_id]->carrier[CC_id].sib1->cellAccessRelatedInfo.cellIdentity.buf[3] == cell_identity_byte3P) ) { ue_context_p = rrc_eNB_get_ue_context( RC.rrc[enb_module_id], @@ -3561,12 +3561,7 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete( ctxt_pP->module_id + 1); // fourth octet if (oip_ifup == 0) { // interface is up --> send a config the DRB -# ifdef OAI_EMU - oai_emulation.info.oai_ifup[ctxt_pP->module_id] = 1; - dest_ip_offset = NB_eNB_INST; -# else dest_ip_offset = 8; -# endif LOG_I(OIP, "[eNB %d] Config the oai%d to send/receive pkt on DRB %ld to/from the protocol stack\n", ctxt_pP->module_id, ctxt_pP->module_id, diff --git a/openair2/RRC/LITE/rrc_eNB_S1AP.c b/openair2/RRC/LITE/rrc_eNB_S1AP.c index 55adb217fa..24ee3c06da 100644 --- a/openair2/RRC/LITE/rrc_eNB_S1AP.c +++ b/openair2/RRC/LITE/rrc_eNB_S1AP.c @@ -390,8 +390,10 @@ rrc_pdcp_config_security( ue_context_pP->ue_context.kenb, &kRRCint); +#if !defined(USRP_REC_PLAY) #define DEBUG_SECURITY 1 - +#endif + #if defined (DEBUG_SECURITY) #undef msg #define msg printf diff --git a/openair2/UTIL/LOG/log.h b/openair2/UTIL/LOG/log.h index 7b6d41f7e0..1d795740b6 100644 --- a/openair2/UTIL/LOG/log.h +++ b/openair2/UTIL/LOG/log.h @@ -314,8 +314,8 @@ void *log_thread_function(void * list); /* optname helpstr paramflags XXXptr defXXXval type numelt */ /*--------------------------------------------------------------------------------------------------------------------------------------------------------------*/ #define LOG_GLOBALPARAMS_DESC { \ -{LOG_CONFIG_STRING_GLOBAL_LOG_LEVEL, NULL, 0, strptr:(char **)&gloglevel, defstrval:log_level_names[2].name, TYPE_STRING, sizeof(gloglevel)}, \ -{LOG_CONFIG_STRING_GLOBAL_LOG_VERBOSITY,NULL, 0, strptr:(char **)&glogverbo, defstrval:log_verbosity_names[2].name, TYPE_STRING, sizeof(glogverbo)}, \ +{LOG_CONFIG_STRING_GLOBAL_LOG_LEVEL, NULL, 0, strptr:(char **)&gloglevel, defstrval:log_level_names[2].name, TYPE_STRING, 0}, \ +{LOG_CONFIG_STRING_GLOBAL_LOG_VERBOSITY,NULL, 0, strptr:(char **)&glogverbo, defstrval:log_verbosity_names[2].name, TYPE_STRING, 0}, \ {LOG_CONFIG_STRING_GLOBAL_LOG_ONLINE, NULL, 0, iptr:&(g_log->onlinelog), defintval:1, TYPE_INT, 0, }, \ {LOG_CONFIG_STRING_GLOBAL_LOG_INFILE, NULL, 0, iptr:&(g_log->filelog), defintval:0, TYPE_INT, 0, }, \ } diff --git a/targets/ARCH/COMMON/common_lib.h b/targets/ARCH/COMMON/common_lib.h index 6214c81cc6..2dc1650bfd 100644 --- a/targets/ARCH/COMMON/common_lib.h +++ b/targets/ARCH/COMMON/common_lib.h @@ -207,6 +207,15 @@ typedef struct { int iq_rxrescale; //! Configuration file for LMS7002M char *configFilename; +#if defined(USRP_REC_PLAY) + unsigned short sf_mode; // 1=record, 2=replay + char sf_filename[1024]; // subframes file path + unsigned int sf_max; // max number of recorded subframes + unsigned int sf_loops; // number of loops in replay mode + unsigned int sf_read_delay; // read delay in replay mode + unsigned int sf_write_delay; // write delay in replay mode + unsigned int eth_mtu; // ethernet MTU +#endif } openair0_config_t; /*! \brief RF mapping */ diff --git a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp index 30faf8d2b7..8b62a8e698 100644 --- a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp +++ b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp @@ -270,11 +270,53 @@ static int sync_to_gps(openair0_device *device) return EXIT_SUCCESS; } +#if defined(USRP_REC_PLAY) +#include "usrp_lib.h" +static FILE *pFile = NULL; +int mmapfd = 0; +struct stat sb; +iqrec_t *ms_sample = NULL; // memory for all subframes +unsigned int nb_samples = 0; +unsigned int cur_samples = 0; +int64_t wrap_count = 0; +int64_t wrap_ts = 0; +unsigned int u_sf_mode = 0; // 1=record, 2=replay +unsigned int u_sf_record = 0; // record mode +unsigned int u_sf_replay = 0; // replay mode +char u_sf_filename[1024]; // subframes file path +unsigned int u_sf_max = DEF_NB_SF; // max number of recorded subframes +unsigned int u_sf_loops = DEF_SF_NB_LOOP; // number of loops in replay mode +unsigned int u_sf_read_delay = DEF_SF_DELAY_READ; // read delay in replay mode +unsigned int u_sf_write_delay = DEF_SF_DELAY_WRITE; // write delay in replay mode +char *tmp_filename[1]; // use an array of pointer (libconfig does not seems to work with char array yet) + +char config_opt_sf_file[] = CONFIG_OPT_SF_FILE; +char config_def_sf_file[] = DEF_SF_FILE; +char config_hlp_sf_file[] = CONFIG_HLP_SF_FILE; +char config_opt_sf_rec[] = CONFIG_OPT_SF_REC; +char config_hlp_sf_rec[] = CONFIG_HLP_SF_REC; +char config_opt_sf_rep[] = CONFIG_OPT_SF_REP; +char config_hlp_sf_rep[] = CONFIG_HLP_SF_REP; +char config_opt_sf_max[] = CONFIG_OPT_SF_MAX; +char config_hlp_sf_max[] = CONFIG_HLP_SF_MAX; +char config_opt_sf_loops[] = CONFIG_OPT_SF_LOOPS; +char config_hlp_sf_loops[] = CONFIG_HLP_SF_LOOPS; +char config_opt_sf_rdelay[] = CONFIG_OPT_SF_RDELAY; +char config_hlp_sf_rdelay[] = CONFIG_HLP_SF_RDELAY; +char config_opt_sf_wdelay[] = CONFIG_OPT_SF_WDELAY; +char config_hlp_sf_wdelay[] = CONFIG_HLP_SF_WDELAY; + +#endif + /*! \brief Called to start the USRP transceiver. Return 0 if OK, < 0 if error @param device pointer to the device structure specific to the RF hardware target */ static int trx_usrp_start(openair0_device *device) { +#if defined(USRP_REC_PLAY) + if (u_sf_mode != 2) { // not replay mode +#endif + usrp_state_t *s = (usrp_state_t*)device->priv; @@ -313,12 +355,21 @@ static int trx_usrp_start(openair0_device *device) { s->rx_count = 0; s->tx_count = 0; s->rx_timestamp = 0; +#if defined(USRP_REC_PLAY) + } +#endif return 0; } /*! \brief Terminate operation of the USRP transceiver -- free all associated resources * \param device the hardware to use */ static void trx_usrp_end(openair0_device *device) { +#if defined(USRP_REC_PLAY) // For some ugly reason, this can be called several times... + static int done = 0; + if (done == 1) return; + done = 1; + if (u_sf_mode != 2) { // not subframes replay +#endif usrp_state_t *s = (usrp_state_t*)device->priv; s->rx_stream->issue_stream_cmd(uhd::stream_cmd_t::STREAM_MODE_STOP_CONTINUOUS); @@ -326,7 +377,45 @@ static void trx_usrp_end(openair0_device *device) { s->tx_md.end_of_burst = true; s->tx_stream->send("", 0, s->tx_md); s->tx_md.end_of_burst = false; - +#if defined(USRP_REC_PLAY) + } +#endif +#if defined(USRP_REC_PLAY) + if (u_sf_mode == 1) { // subframes store + pFile = fopen (u_sf_filename,"wb+"); + if (pFile == NULL) { + std::cerr << "Cannot open " << u_sf_filename << std::endl; + } else { + unsigned int i = 0; + unsigned int modu = 0; + if ((modu = nb_samples % 10) != 0) { + nb_samples -= modu; // store entire number of frames + } + std::cerr << "Writing " << nb_samples << " subframes to " << u_sf_filename << " ..." << std::endl; + for (i = 0; i < nb_samples; i++) { + fwrite(ms_sample+i, sizeof(unsigned char), sizeof(iqrec_t), pFile); + } + fclose (pFile); + std::cerr << "File " << u_sf_filename << " closed." << std::endl; + } + } + if (u_sf_mode == 1) { // record + if (ms_sample != NULL) { + free((void*)ms_sample); + ms_sample = NULL; + } + } + if (u_sf_mode == 2) { // replay + if (ms_sample != MAP_FAILED) { + munmap(ms_sample, sb.st_size); + ms_sample = NULL; + } + if (mmapfd != 0) { + close(mmapfd); + mmapfd = 0; + } + } +#endif } /*! \brief Called to send samples to the USRP RF target @@ -339,6 +428,9 @@ static void trx_usrp_end(openair0_device *device) { */ static int trx_usrp_write(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps, int cc, int flags) { int ret=0; +#if defined(USRP_REC_PLAY) + if (u_sf_mode != 2) { // not replay mode +#endif usrp_state_t *s = (usrp_state_t*)device->priv; int nsamps2; // aligned to upper 32 or 16 byte boundary @@ -405,6 +497,15 @@ static int trx_usrp_write(openair0_device *device, openair0_timestamp timestamp, if (ret != nsamps) LOG_E(PHY,"[xmit] tx samples %d != %d\n",ret,nsamps); +#if defined(USRP_REC_PLAY) + } else { + struct timespec req; + req.tv_sec = 0; + req.tv_nsec = u_sf_write_delay * 1000; + nanosleep(&req, NULL); + ret = nsamps; + } +#endif return ret; } @@ -421,9 +522,12 @@ static int trx_usrp_write(openair0_device *device, openair0_timestamp timestamp, * \returns the number of sample read */ static int trx_usrp_read(openair0_device *device, openair0_timestamp *ptimestamp, void **buff, int nsamps, int cc) { - usrp_state_t *s = (usrp_state_t*)device->priv; - int samples_received=0,i,j; - int nsamps2; // aligned to upper 32 or 16 byte boundary + usrp_state_t *s = (usrp_state_t*)device->priv; + int samples_received=0,i,j; + int nsamps2; // aligned to upper 32 or 16 byte boundary +#if defined(USRP_REC_PLAY) + if (u_sf_mode != 2) { // not replay mode +#endif #if defined(__x86_64) || defined(__i386__) #ifdef __AVX2__ nsamps2 = (nsamps+7)>>3; @@ -490,7 +594,45 @@ static int trx_usrp_read(openair0_device *device, openair0_timestamp *ptimestamp s->rx_count += nsamps; s->rx_timestamp = s->rx_md.time_spec.to_ticks(s->sample_rate); *ptimestamp = s->rx_timestamp; - return samples_received; +#if defined (USRP_REC_PLAY) + } +#endif +#if defined(USRP_REC_PLAY) + if (u_sf_mode == 1) { // record mode + // Copy subframes to memory (later dump on a file) + if (nb_samples < u_sf_max) { + (ms_sample+nb_samples)->header = BELL_LABS_IQ_HEADER; + (ms_sample+nb_samples)->ts = *ptimestamp; + memcpy((ms_sample+nb_samples)->samples, buff[0], nsamps*4); + nb_samples++; + } + } else if (u_sf_mode == 2) { // replay mode + if (cur_samples == nb_samples) { + cur_samples = 0; + wrap_count++; + if (wrap_count == u_sf_loops) { + std::cerr << "USRP device terminating subframes replay mode after " << u_sf_loops << " loops." << std::endl; + return 0; // should make calling process exit + } + wrap_ts = wrap_count * (nb_samples * (((int)(device->openair0_cfg[0].sample_rate)) / 1000)); + } + if (cur_samples < nb_samples) { + *ptimestamp = (ms_sample[0].ts + (cur_samples * (((int)(device->openair0_cfg[0].sample_rate)) / 1000))) + wrap_ts; + if (cur_samples == 0) { + std::cerr << "starting subframes file with wrap_count=" << wrap_count << " wrap_ts=" << wrap_ts + << " ts=" << *ptimestamp << std::endl; + } + memcpy(buff[0], &ms_sample[cur_samples].samples[0], nsamps*4); + cur_samples++; + } + struct timespec req; + req.tv_sec = 0; + req.tv_nsec = u_sf_read_delay * 1000; + nanosleep(&req, NULL); + return nsamps; + } +#endif + return samples_received; } /*! \brief Compares two variables within precision @@ -684,12 +826,135 @@ int trx_usrp_reset_stats(openair0_device* device) { return(0); } +#if defined(USRP_REC_PLAY) +extern "C" { +/*! \brief Initializer for USRP record/playback config + * \param parameter array description + * \returns 0 on success + */ +int trx_usrp_recplay_config_init(paramdef_t *usrp_recplay_params) { + // --subframes-file + memcpy(usrp_recplay_params[0].optname, config_opt_sf_file, strlen(config_opt_sf_file)); + usrp_recplay_params[0].helpstr = config_hlp_sf_file; + usrp_recplay_params[0].paramflags=PARAMFLAG_NOFREE; + usrp_recplay_params[0].strptr=(char **)&tmp_filename[0]; + usrp_recplay_params[0].defstrval = NULL; + usrp_recplay_params[0].type=TYPE_STRING; + usrp_recplay_params[0].numelt=sizeof(u_sf_filename); + // --subframes-record + memcpy(usrp_recplay_params[1].optname, config_opt_sf_rec, strlen(config_opt_sf_rec)); + usrp_recplay_params[1].helpstr = config_hlp_sf_rec; + usrp_recplay_params[1].paramflags=PARAMFLAG_BOOL; + usrp_recplay_params[1].uptr=&u_sf_record; + usrp_recplay_params[1].defuintval=0; + usrp_recplay_params[1].type=TYPE_UINT; + usrp_recplay_params[1].numelt=0; + // --subframes-replay + memcpy(usrp_recplay_params[2].optname, config_opt_sf_rep, strlen(config_opt_sf_rep)); + usrp_recplay_params[2].helpstr = config_hlp_sf_rep; + usrp_recplay_params[2].paramflags=PARAMFLAG_BOOL; + usrp_recplay_params[2].uptr=&u_sf_replay; + usrp_recplay_params[2].defuintval=0; + usrp_recplay_params[2].type=TYPE_UINT; + usrp_recplay_params[2].numelt=0; + // --subframes-max + memcpy(usrp_recplay_params[3].optname, config_opt_sf_max, strlen(config_opt_sf_max)); + usrp_recplay_params[3].helpstr = config_hlp_sf_max; + usrp_recplay_params[3].paramflags=0; + usrp_recplay_params[3].uptr=&u_sf_max; + usrp_recplay_params[3].defuintval=DEF_NB_SF; + usrp_recplay_params[3].type=TYPE_UINT; + usrp_recplay_params[3].numelt=0; + // --subframes-loops + memcpy(usrp_recplay_params[4].optname, config_opt_sf_loops, strlen(config_opt_sf_loops)); + usrp_recplay_params[4].helpstr = config_hlp_sf_loops; + usrp_recplay_params[4].paramflags=0; + usrp_recplay_params[4].uptr=&u_sf_loops; + usrp_recplay_params[4].defuintval=DEF_SF_NB_LOOP; + usrp_recplay_params[4].type=TYPE_UINT; + usrp_recplay_params[4].numelt=0; + // --subframes-read-delay + memcpy(usrp_recplay_params[5].optname, config_opt_sf_rdelay, strlen(config_opt_sf_rdelay)); + usrp_recplay_params[5].helpstr = config_hlp_sf_rdelay; + usrp_recplay_params[5].paramflags=0; + usrp_recplay_params[5].uptr=&u_sf_read_delay; + usrp_recplay_params[5].defuintval=DEF_SF_DELAY_READ; + usrp_recplay_params[5].type=TYPE_UINT; + usrp_recplay_params[5].numelt=0; + // --subframes-write-delay + memcpy(usrp_recplay_params[6].optname, config_opt_sf_wdelay, strlen(config_opt_sf_wdelay)); + usrp_recplay_params[6].helpstr = config_hlp_sf_wdelay; + usrp_recplay_params[6].paramflags=0; + usrp_recplay_params[6].uptr=&u_sf_write_delay; + usrp_recplay_params[6].defuintval=DEF_SF_DELAY_WRITE; + usrp_recplay_params[6].type=TYPE_UINT; + usrp_recplay_params[6].numelt=0; + + return 0; // always ok +} +} +#endif + extern "C" { /*! \brief Initialize Openair USRP target. It returns 0 if OK * \param device the hardware to use * \param openair0_cfg RF frontend parameters set by application */ int device_init(openair0_device* device, openair0_config_t *openair0_cfg) { +#if defined(USRP_REC_PLAY) + paramdef_t usrp_recplay_params[7]; + // to check + static int done = 0; + if (done == 1) { + return 0; + } // prevent from multiple init + done = 1; + // end to check + memset(usrp_recplay_params, 0, 7*sizeof(paramdef_t)); + memset(&u_sf_filename[0], 0, 1024); + tmp_filename[0] = u_sf_filename; + if (trx_usrp_recplay_config_init(usrp_recplay_params) != 0) { + std::cerr << "USRP device record/replay mode configuration error exiting" << std::endl; + return -1; + } + config_process_cmdline(usrp_recplay_params,sizeof(usrp_recplay_params)/sizeof(paramdef_t),NULL); + + if (strlen(tmp_filename[0]) != 0) { + (void) strcpy(u_sf_filename, tmp_filename[0]); + } else { + (void) strcpy(u_sf_filename, DEF_SF_FILE); + } + + if (u_sf_replay == 1) u_sf_mode = 2; + if (u_sf_record == 1) u_sf_mode = 1; + + if (u_sf_mode == 2) { + // Replay subframes from from file + int bw_gain_adjust=0; + device->openair0_cfg = openair0_cfg; + device->type = USRP_B200_DEV; + openair0_cfg[0].rx_gain_calib_table = calib_table_b210_38; + bw_gain_adjust=1; + openair0_cfg[0].tx_sample_advance = 80; + openair0_cfg[0].tx_bw = 20e6; + openair0_cfg[0].rx_bw = 20e6; + openair0_cfg[0].iq_txshift = 4;//shift + openair0_cfg[0].iq_rxrescale = 15;//rescale iqs + set_rx_gain_offset(&openair0_cfg[0],0,bw_gain_adjust); + device->priv = NULL; + device->trx_start_func = trx_usrp_start; + device->trx_write_func = trx_usrp_write; + device->trx_read_func = trx_usrp_read; + device->trx_get_stats_func = trx_usrp_get_stats; + device->trx_reset_stats_func = trx_usrp_reset_stats; + device->trx_end_func = trx_usrp_end; + device->trx_stop_func = trx_usrp_stop; + device->trx_set_freq_func = trx_usrp_set_freq; + device->trx_set_gains_func = trx_usrp_set_gains; + device->openair0_cfg = openair0_cfg; + std::cerr << "USRP device initialized in subframes replay mode for " << u_sf_loops << " loops." << std::endl; + } else { +#endif uhd::set_thread_priority_safe(1.0); usrp_state_t *s = (usrp_state_t*)calloc(sizeof(usrp_state_t),1); @@ -705,6 +970,11 @@ extern "C" { int vers=0,subvers=0,subsubvers=0; int bw_gain_adjust=0; +#if defined(USRP_REC_PLAY) + if (u_sf_mode == 1) { + std::cerr << "USRP device initialized in subframes record mode" << std::endl; + } +#endif sscanf(uhd::get_version_string().c_str(),"%d.%d.%d",&vers,&subvers,&subsubvers); LOG_I(PHY,"Checking for USRPs : UHD %s (%d.%d.%d)\n", uhd::get_version_string().c_str(),vers,subvers,subsubvers); @@ -742,7 +1012,9 @@ extern "C" { //s->usrp->set_master_clock_rate(usrp_master_clock); openair0_cfg[0].rx_gain_calib_table = calib_table_x310; - +#if defined(USRP_REC_PLAY) + std::cerr << "-- Using calibration table: calib_table_x310" << std::endl; // Bell Labs info +#endif switch ((int)openair0_cfg[0].sample_rate) { case 30720000: // from usrp_time_offset @@ -801,9 +1073,15 @@ extern "C" { if ((vers == 3) && (subvers == 9) && (subsubvers>=2)) { openair0_cfg[0].rx_gain_calib_table = calib_table_b210; bw_gain_adjust=0; +#if defined(USRP_REC_PLAY) + std::cerr << "-- Using calibration table: calib_table_b210" << std::endl; // Bell Labs info +#endif } else { openair0_cfg[0].rx_gain_calib_table = calib_table_b210_38; bw_gain_adjust=1; +#if defined(USRP_REC_PLAY) + std::cerr << "-- Using calibration table: calib_table_b210_38" << std::endl; // Bell Labs info +#endif } switch ((int)openair0_cfg[0].sample_rate) { @@ -965,6 +1243,45 @@ extern "C" { } } +#if defined(USRP_REC_PLAY) + } +#endif +#if defined(USRP_REC_PLAY) + if (u_sf_mode == 1) { // record mode + ms_sample = (iqrec_t*) malloc(u_sf_max * sizeof(iqrec_t)); + if (ms_sample == NULL) { + std::cerr<< "Memory allocation failed for subframe record or replay mode." << std::endl; + exit(-1); + } + memset(ms_sample, 0, u_sf_max * BELL_LABS_IQ_BYTES_PER_SF); + } + if (u_sf_mode == 2) { + // use mmap + mmapfd = open(u_sf_filename, O_RDONLY | O_LARGEFILE); + if (mmapfd != 0) { + fstat(mmapfd, &sb); + std::cerr << "Loading subframes using mmap() from " << u_sf_filename << " size=" << (uint64_t)sb.st_size << " bytes ..." << std::endl; + ms_sample = (iqrec_t*) mmap(NULL, sb.st_size, PROT_WRITE, MAP_PRIVATE, mmapfd, 0); + if (ms_sample != MAP_FAILED) { + nb_samples = (sb.st_size / sizeof(iqrec_t)); + int aligned = (((unsigned long)ms_sample & 31) == 0)? 1:0; + std::cerr<< "Loaded "<< nb_samples << " subframes." << std::endl; + if (aligned == 0) { + std::cerr<< "mmap address is not 32 bytes aligned, exiting." << std::endl; + close(mmapfd); + exit(-1); + } + } else { + std::cerr << "Cannot mmap file, exiting." << std::endl; + close(mmapfd); + exit(-1); + } + } else { + std::cerr << "Cannot open " << u_sf_filename << " , exiting." << std::endl; + exit(-1); + } + } +#endif return 0; } } diff --git a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.h b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.h new file mode 100644 index 0000000000..47ba171f1b --- /dev/null +++ b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.h @@ -0,0 +1,89 @@ +#ifndef __USRP_LIB_H +#define __USRP_LIB_H +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +/** usrp_lib.h + * + * \author: bruno.mongazon-cazavet@nokia-bell-labs.com + */ + +#if defined (USRP_REC_PLAY) + +#include +#include +#include +#include +#include "common/config/config_paramdesc.h" +#include "common/config/config_userapi.h" + +#define BELL_LABS_IQ_HEADER 0xabababababababab +#define BELL_LABS_IQ_PER_SF 7680 // Up to 5MHz bw for now +#define BELL_LABS_IQ_BYTES_PER_SF (BELL_LABS_IQ_PER_SF * 4) +typedef struct { + int64_t header; + int64_t ts; + int64_t rfu1; + int64_t rfu2; // pad for 256 bits alignement required by AVX2 + unsigned char samples[BELL_LABS_IQ_BYTES_PER_SF]; // iq's for one subframe +} iqrec_t; +#define DEF_NB_SF 120000 // default nb of sf or ms to capture (2 minutes at 5MHz) +#define DEF_SF_FILE "/home/nokia/iqfile" // default subframes file name +#define DEF_SF_DELAY_READ 400 // default read delay µs (860=real) +#define DEF_SF_DELAY_WRITE 15 // default write delay µs (15=real) +#define DEF_SF_NB_LOOP 5 // default nb loops + + +/* help strings definition for command line options, used in CMDLINE_XXX_DESC macros and printed when -h option is used */ +#define CONFIG_HLP_SF_FILE "Path of the file used for subframes record or replay" +#define CONFIG_HLP_SF_REC "Record subframes from USRP driver into a file for later replay" +#define CONFIG_HLP_SF_REP "Replay subframes into USRP driver from a file" +#define CONFIG_HLP_SF_MAX "Maximum count of subframes to be recorded in subframe file" +#define CONFIG_HLP_SF_LOOPS "Number of loops to replay of the entire subframes file" +#define CONFIG_HLP_SF_RDELAY "Delay in microseconds to read a subframe in replay mode" +#define CONFIG_HLP_SF_WDELAY "Delay in microseconds to write a subframe in replay mode" + +/* keyword strings for command line options, used in CMDLINE_XXX_DESC macros and printed when -h option is used */ +#define CONFIG_OPT_SF_FILE "subframes-file" +#define CONFIG_OPT_SF_REC "subframes-record" +#define CONFIG_OPT_SF_REP "subframes-replay" +#define CONFIG_OPT_SF_MAX "subframes-max" +#define CONFIG_OPT_SF_LOOPS "subframes-loops" +#define CONFIG_OPT_SF_RDELAY "subframes-read-delay" +#define CONFIG_OPT_SF_WDELAY "subframes-write-delay" + +/* For information only - the macro is not usable in C++ */ +/*---------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ +/* command line parameters for USRP record/playback */ +/* optname helpstr paramflags XXXptr defXXXval type numelt */ +/*---------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ +#define USRP_RECPLAY_PARAMS_DESC { \ +{"subframes-file", CONFIG_HLP_SF_FILE, 0, strptr:(char **)&u_sf_filename, defstrval:DEF_SF_FILE, TYPE_STRING, sizeof(u_sf_filename)}, \ +{"subframes-record", CONFIG_HLP_SF_REC, PARAMFLAG_BOOL, uptr:&u_sf_record, defuintval:0, TYPE_UINT, 0}, \ +{"subframes-replay", CONFIG_HLP_SF_REP, PARAMFLAG_BOOL, uptr:&u_sf_replay, defuintval:0, TYPE_UINT, 0}, \ +{"subframes-max", CONFIG_HLP_SF_MAX, 0, uptr:&u_sf_max, defintval:DEF_NB_SF, TYPE_UINT, 0}, \ +{"subframes-loops", CONFIG_HLP_SF_LOOPS, 0, uptr:&u_sf_loops, defintval:DEF_SF_NB_LOOP, TYPE_UINT, 0}, \ +{"subframes-read-delay", CONFIG_HLP_SF_RDELAY, 0, uptr:&u_sf_read_delay, defintval:DEF_SF_DELAY_READ, TYPE_UINT, 0}, \ +{"subframes-write-delay", CONFIG_HLP_SF_WDELAY, 0, uptr:&u_sf_write_delay, defintval:DEF_SF_DELAY_WRITE, TYPE_UINT, 0}, \ +} +#endif // BELL_LABS_MUST +#endif // __USRP_LIB_H + diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band7.tm1.if4p5.50PRB.lo.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band7.tm1.if4p5.50PRB.lo.conf index 048f2fcc35..e60e793438 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band7.tm1.if4p5.50PRB.lo.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band7.tm1.if4p5.50PRB.lo.conf @@ -197,13 +197,13 @@ RUs = ( ); log_config = { - global_log_level ="debug"; + global_log_level ="info"; global_log_verbosity ="medium"; hw_log_level ="info"; hw_log_verbosity ="medium"; - phy_log_level ="debug"; + phy_log_level ="info"; phy_log_verbosity ="medium"; - mac_log_level ="debug"; + mac_log_level ="info"; mac_log_verbosity ="high"; rlc_log_level ="info"; rlc_log_verbosity ="medium"; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rru.oaisim.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rru.oaisim.conf index af262223f0..24ae36a0a4 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rru.oaisim.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rru.oaisim.conf @@ -17,3 +17,20 @@ RUs = ( } ); +log_config = { + global_log_level ="debug"; + global_log_verbosity ="medium"; + hw_log_level ="info"; + hw_log_verbosity ="medium"; + phy_log_level ="debug"; + phy_log_verbosity ="medium"; + mac_log_level ="debug"; + mac_log_verbosity ="high"; + rlc_log_level ="info"; + rlc_log_verbosity ="medium"; + pdcp_log_level ="info"; + pdcp_log_verbosity ="medium"; + rrc_log_level ="info"; + rrc_log_verbosity ="medium"; +}; + diff --git a/targets/RT/USER/lte-ru.c b/targets/RT/USER/lte-ru.c index 1dff713be9..35b29a1798 100644 --- a/targets/RT/USER/lte-ru.c +++ b/targets/RT/USER/lte-ru.c @@ -709,7 +709,8 @@ void fh_if4p5_north_asynch_in(RU_t *ru,int *frame,int *subframe) { if ((frame_tx == 0)&&(subframe_tx == 0)) proc->frame_tx_unwrap += 1024; - proc->timestamp_tx = (((frame_tx + proc->frame_tx_unwrap) * 10) + subframe_tx) * fp->samples_per_tti; + proc->timestamp_tx = ((((uint64_t)frame_tx + (uint64_t)proc->frame_tx_unwrap) * 10) + (uint64_t)subframe_tx) * (uint64_t)fp->samples_per_tti; + LOG_D(PHY,"RU %d/%d TST %llu, frame %d, subframe %d\n",ru->idx,0,(long long unsigned int)proc->timestamp_tx,frame_tx,subframe_tx); // dump VCD output for first RU in list if (ru == RC.ru[0]) { @@ -2140,8 +2141,11 @@ void configure_rru(int idx, ru->frame_parms.threequarter_fs = config->threequarter_fs[0]; ru->frame_parms.pdsch_config_common.referenceSignalPower = ru->max_pdschReferenceSignalPower-config->att_tx[0]; if (ru->function==NGFI_RRU_IF4p5) { - LOG_I(PHY,"Setting ru->function to NGFI_RRU_IF4p5, prach_FrequOffset %d, prach_ConfigIndex %d\n", - config->prach_FreqOffset[0],config->prach_ConfigIndex[0]); + ru->frame_parms.att_rx = ru->att_rx; + ru->frame_parms.att_tx = ru->att_tx; + + LOG_I(PHY,"Setting ru->function to NGFI_RRU_IF4p5, prach_FrequOffset %d, prach_ConfigIndex %d, att (%d,%d)\n", + config->prach_FreqOffset[0],config->prach_ConfigIndex[0],ru->att_tx,ru->att_rx); ru->frame_parms.prach_config_common.prach_ConfigInfo.prach_FreqOffset = config->prach_FreqOffset[0]; ru->frame_parms.prach_config_common.prach_ConfigInfo.prach_ConfigIndex = config->prach_ConfigIndex[0]; #ifdef Rel14 @@ -2155,6 +2159,8 @@ void configure_rru(int idx, init_frame_parms(&ru->frame_parms,1); + fill_rf_config(ru,ru->rf_config_file); + phy_init_RU(ru); diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c index 3dfa2f5936..1fe3e4e0a0 100644 --- a/targets/RT/USER/lte-softmodem.c +++ b/targets/RT/USER/lte-softmodem.c @@ -227,6 +227,9 @@ threads_t threads= {-1,-1,-1,-1,-1,-1,-1}; */ uint8_t abstraction_flag=0; +/* forward declarations */ +void set_default_frame_parms(LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]); + /*---------------------BMC: timespec helpers -----------------------------*/ struct timespec min_diff_time = { .tv_sec = 0, .tv_nsec = 0 }; @@ -593,10 +596,11 @@ static void get_options(void) { if (UE_flag > 0) { + uint8_t n_rb_dl; paramdef_t cmdline_uemodeparams[] =CMDLINE_UEMODEPARAMS_DESC; paramdef_t cmdline_ueparams[] =CMDLINE_UEPARAMS_DESC; - + set_default_frame_parms(frame_parms); config_process_cmdline( cmdline_uemodeparams,sizeof(cmdline_uemodeparams)/sizeof(paramdef_t),NULL); config_process_cmdline( cmdline_ueparams,sizeof(cmdline_ueparams)/sizeof(paramdef_t),NULL); @@ -606,22 +610,21 @@ static void get_options(void) { input_fd = fopen(loopfile,"r"); AssertFatal(input_fd != NULL,"Please provide a valid input file\n"); } + if ( (cmdline_uemodeparams[CMDLINE_CALIBUERX_IDX].paramflags & PARAMFLAG_PARAMSET) != 0) mode = rx_calib_ue; if ( (cmdline_uemodeparams[CMDLINE_CALIBUERXMED_IDX].paramflags & PARAMFLAG_PARAMSET) != 0) mode = rx_calib_ue_med; if ( (cmdline_uemodeparams[CMDLINE_CALIBUERXBYP_IDX].paramflags & PARAMFLAG_PARAMSET) != 0) mode = rx_calib_ue_byp; - if ( *(cmdline_uemodeparams[CMDLINE_DEBUGUEPRACH_IDX].uptr) > 0) mode = debug_prach; - if ( *(cmdline_uemodeparams[CMDLINE_NOL2CONNECT_IDX].uptr) > 0) mode = no_L2_connect; - if ( *(cmdline_uemodeparams[CMDLINE_CALIBPRACHTX_IDX].uptr) > 0) mode = calib_prach_tx; - if (dumpframe > 0) mode = rx_dump_frame; + if ( (cmdline_uemodeparams[CMDLINE_DEBUGUEPRACH_IDX].paramflags & PARAMFLAG_PARAMSET) != 0) mode = debug_prach; + if ( (cmdline_uemodeparams[CMDLINE_NOL2CONNECT_IDX].paramflags & PARAMFLAG_PARAMSET) != 0) mode = no_L2_connect; + if ( (cmdline_uemodeparams[CMDLINE_CALIBPRACHTX_IDX].paramflags & PARAMFLAG_PARAMSET) != 0) mode = calib_prach_tx; + if ( (cmdline_uemodeparams[CMDLINE_DUMPMEMORY_IDX].paramflags & PARAMFLAG_PARAMSET) != 0) mode = rx_dump_frame; if ( downlink_frequency[0][0] > 0) { - for (CC_id=1; CC_iddl_CarrierFreq = downlink_frequency[0][0]; + } + UE_scan=0; } if (tddflag > 0) { @@ -629,38 +632,38 @@ static void get_options(void) { frame_parms[CC_id]->frame_type = TDD; } - if (frame_parms[0]->N_RB_DL !=0) { - if ( frame_parms[0]->N_RB_DL < 6 ) { - frame_parms[0]->N_RB_DL = 6; - printf ( "%i: Invalid number of ressource blocks, adjusted to 6\n",frame_parms[0]->N_RB_DL); - } - if ( frame_parms[0]->N_RB_DL > 100 ) { - frame_parms[0]->N_RB_DL = 100; - printf ( "%i: Invalid number of ressource blocks, adjusted to 100\n",frame_parms[0]->N_RB_DL); - } - if ( frame_parms[0]->N_RB_DL > 50 && frame_parms[0]->N_RB_DL < 100 ) { - frame_parms[0]->N_RB_DL = 50; - printf ( "%i: Invalid number of ressource blocks, adjusted to 50\n",frame_parms[0]->N_RB_DL); - } - if ( frame_parms[0]->N_RB_DL > 25 && frame_parms[0]->N_RB_DL < 50 ) { - frame_parms[0]->N_RB_DL = 25; - printf ( "%i: Invalid number of ressource blocks, adjusted to 25\n",frame_parms[0]->N_RB_DL); - } - UE_scan = 0; - frame_parms[0]->N_RB_UL=frame_parms[0]->N_RB_DL; - for (CC_id=1; CC_idN_RB_DL=frame_parms[0]->N_RB_DL; - frame_parms[CC_id]->N_RB_UL=frame_parms[0]->N_RB_UL; - } + if (n_rb_dl !=0) { + printf("NB_RB set to %d\n",n_rb_dl); + if ( n_rb_dl < 6 ) { + n_rb_dl = 6; + printf ( "%i: Invalid number of ressource blocks, adjusted to 6\n",n_rb_dl); + } + if ( n_rb_dl > 100 ) { + n_rb_dl = 100; + printf ( "%i: Invalid number of ressource blocks, adjusted to 100\n",n_rb_dl); + } + if ( n_rb_dl > 50 && n_rb_dl < 100 ) { + n_rb_dl = 50; + printf ( "%i: Invalid number of ressource blocks, adjusted to 50\n",n_rb_dl); + } + if ( n_rb_dl > 25 && n_rb_dl < 50 ) { + n_rb_dl = 25; + printf ( "%i: Invalid number of ressource blocks, adjusted to 25\n",n_rb_dl); + } + UE_scan = 0; + for (CC_id=0; CC_idN_RB_DL=n_rb_dl; + frame_parms[CC_id]->N_RB_UL=n_rb_dl; + } } - - for (CC_id=1;CC_id 0 */ + #if T_TRACER paramdef_t cmdline_ttraceparams[] =CMDLINE_TTRACEPARAMS_DESC ; config_process_cmdline( cmdline_ttraceparams,sizeof(cmdline_ttraceparams)/sizeof(paramdef_t),NULL); @@ -675,10 +678,11 @@ static void get_options(void) { NB_RU = RC.nb_RU; printf("Configuration: nb_rrc_inst %d, nb_L1_inst %d, nb_ru %d\n",NB_eNB_INST,RC.nb_L1_inst,NB_RU); } - } else if (UE_flag == 1 && (CONFIG_GETCONFFILE != NULL)) { + } else if (UE_flag == 1 && (!(CONFIG_ISFLAGSET(CONFIG_NOOOPT))) ) { // Here the configuration file is the XER encoded UE capabilities // Read it in and store in asn1c data structures - strcpy(uecap_xer,CONFIG_GETCONFFILE); + sprintf(uecap_xer,"%stargets/PROJECTS/GENERIC-LTE-EPC/CONF/UE_config.xml",getenv("OPENAIR_HOME")); + printf("%s\n",uecap_xer); uecap_xer_in=1; } /* UE with config file */ } @@ -691,7 +695,7 @@ int T_dont_fork = 0; /* default is to fork, see 'T_init' to understand */ #endif -void set_default_frame_parms(LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]); + void set_default_frame_parms(LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]) { int CC_id; @@ -728,11 +732,12 @@ void set_default_frame_parms(LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]) { frame_parms[CC_id]->prach_config_common.prach_ConfigInfo.highSpeedFlag=0; frame_parms[CC_id]->prach_config_common.prach_ConfigInfo.prach_FreqOffset=0; - downlink_frequency[CC_id][0] = 2680000000; // Use float to avoid issue with frequency over 2^31. - downlink_frequency[CC_id][1] = downlink_frequency[CC_id][0]; - downlink_frequency[CC_id][2] = downlink_frequency[CC_id][0]; - downlink_frequency[CC_id][3] = downlink_frequency[CC_id][0]; +// downlink_frequency[CC_id][0] = 2680000000; // Use float to avoid issue with frequency over 2^31. +// downlink_frequency[CC_id][1] = downlink_frequency[CC_id][0]; +// downlink_frequency[CC_id][2] = downlink_frequency[CC_id][0]; +// downlink_frequency[CC_id][3] = downlink_frequency[CC_id][0]; //printf("Downlink for CC_id %d frequency set to %u\n", CC_id, downlink_frequency[CC_id][0]); + frame_parms[CC_id]->dl_CarrierFreq=downlink_frequency[CC_id][0]; } @@ -905,14 +910,14 @@ int main( int argc, char **argv ) // set default parameters - if (UE_flag == 1) set_default_frame_parms(frame_parms); + //if (UE_flag == 1) set_default_frame_parms(frame_parms); logInit(); printf("Reading in command-line options\n"); get_options (); - if (CONFIG_ISFLAGSET(CONFIG_ABORT)) { + if (CONFIG_ISFLAGSET(CONFIG_ABORT) && UE_flag == 0) { fprintf(stderr,"Getting configuration failed\n"); exit(-1); } @@ -931,7 +936,7 @@ int main( int argc, char **argv ) printf("configuring for UE\n"); set_comp_log(HW, LOG_DEBUG, LOG_HIGH, 1); - set_comp_log(PHY, LOG_DEBUG, LOG_HIGH, 1); + set_comp_log(PHY, LOG_INFO, LOG_HIGH, 1); set_comp_log(MAC, LOG_INFO, LOG_HIGH, 1); set_comp_log(RLC, LOG_INFO, LOG_HIGH | FLAG_THREAD, 1); set_comp_log(PDCP, LOG_INFO, LOG_HIGH, 1); @@ -1080,8 +1085,9 @@ int main( int argc, char **argv ) else if (frame_parms[CC_id]->N_RB_DL == 25) UE[CC_id]->N_TA_offset = 624/4; } - + init_openair0(); } + } fill_modeled_runtime_table(runtime_phy_rx,runtime_phy_tx); @@ -1130,8 +1136,6 @@ int main( int argc, char **argv ) #if defined(ENABLE_ITTI) - - if ((UE_flag == 1)|| (RC.nb_inst > 0)) { @@ -1149,16 +1153,6 @@ int main( int argc, char **argv ) } #endif - if (phy_test==0) { - if (UE_flag==1) { - printf("Filling UE band info\n"); - fill_ue_band_info(); - dl_phy_sync_success (0, 0, 0, 1); - } - } - - - mlockall(MCL_CURRENT | MCL_FUTURE); @@ -1225,14 +1219,18 @@ int main( int argc, char **argv ) rt_sleep_ns(10*100000000ULL); - - // start the main threads if (UE_flag == 1) { int eMBMS_active = 0; - init_UE(1,eMBMS_active,uecap_xer_in); + init_UE(1,eMBMS_active,uecap_xer_in,0); + + if (phy_test==0) { + printf("Filling UE band info\n"); + fill_ue_band_info(); + dl_phy_sync_success (0, 0, 0, 1); + } + number_of_cards = 1; - for(CC_id=0; CC_idrf_map.card=0; PHY_vars_UE_g[0][CC_id]->rf_map.chain=CC_id+chain_offset; diff --git a/targets/RT/USER/lte-softmodem.h b/targets/RT/USER/lte-softmodem.h index c0cc6ba77c..e162476038 100644 --- a/targets/RT/USER/lte-softmodem.h +++ b/targets/RT/USER/lte-softmodem.h @@ -65,7 +65,7 @@ #define CONFIG_HLP_NOSNGLT "Disables single-thread mode in lte-softmodem\n" #define CONFIG_HLP_TADV "Set timing_advance\n" #define CONFIG_HLP_DLF "Set the downlink frequency for all component carriers\n" -#define CONFIG_HLP_CHOFF "Channel id offset" +#define CONFIG_HLP_CHOFF "Channel id offset\n" #define CONFIG_HLP_SOFTS "Enable soft scope and L1 and L2 stats (Xforms)\n" #define CONFIG_HLP_EXMCAL "Calibrate the EXMIMO borad, available files: exmimo2_2arxg.lime exmimo2_2brxg.lime \n" #define CONFIG_HLP_ITTIL "Generate ITTI analyzser logs (similar to wireshark logs but with more details)\n" @@ -127,7 +127,7 @@ {"ue-nb-ant-tx", CONFIG_HLP_UENANTT, 0, u8ptr:&nb_antenna_tx, defuintval:1, TYPE_UINT8, 0}, \ {"ue-scan-carrier", CONFIG_HLP_UESCAN, PARAMFLAG_BOOL, iptr:&UE_scan_carrier, defintval:0, TYPE_INT, 0}, \ {"ue-max-power", NULL, 0, iptr:&(tx_max_power[0]), defintval:90, TYPE_INT, 0}, \ -{"r" , CONFIG_HLP_PRB, 0, u8ptr:&(frame_parms[0]->N_RB_DL), defintval:0, TYPE_UINT8, 0}, \ +{"r" , CONFIG_HLP_PRB, 0, u8ptr:&n_rb_dl, defintval:0, TYPE_UINT8, 0}, \ } @@ -249,7 +249,7 @@ extern void init_RU(const char*); extern int setup_ue_buffers(PHY_VARS_UE **phy_vars_ue, openair0_config_t *openair0_cfg); extern void fill_ue_band_info(void); -extern void init_UE(int,int,int); +extern void init_UE(int,int,int,int); extern void init_thread(int sched_runtime, int sched_deadline, int sched_fifo, cpu_set_t *cpuset, char * name); extern void reset_opp_meas(void); diff --git a/targets/RT/USER/lte-ue.c b/targets/RT/USER/lte-ue.c index cf0754f63d..2c83ea9a04 100644 --- a/targets/RT/USER/lte-ue.c +++ b/targets/RT/USER/lte-ue.c @@ -70,7 +70,7 @@ typedef enum { void init_UE_threads(int); void *UE_thread(void *arg); -void init_UE(int nb_inst,int,int); +void init_UE(int nb_inst,int,int,int); int32_t **rxdata; int32_t **txdata; @@ -202,7 +202,7 @@ void init_thread(int sched_runtime, int sched_deadline, int sched_fifo, cpu_set_ } -void init_UE(int nb_inst,int eMBMS_active, int uecap_xer_in) { +void init_UE(int nb_inst,int eMBMS_active, int uecap_xer_in, int timing_correction) { PHY_VARS_UE *UE; int inst; @@ -218,6 +218,8 @@ void init_UE(int nb_inst,int eMBMS_active, int uecap_xer_in) { LOG_I(PHY,"Initializing memory for UE instance %d (%p)\n",inst,PHY_vars_UE_g[inst]); PHY_vars_UE_g[inst][0] = init_ue_vars(NULL,inst,0); + // turn off timing control loop in UE + PHY_vars_UE_g[inst][0]->no_timing_correction = timing_correction; LOG_I(PHY,"Intializing UE Threads for instance %d (%p,%p)...\n",inst,PHY_vars_UE_g[inst],PHY_vars_UE_g[inst][0]); init_UE_threads(inst); @@ -303,6 +305,7 @@ static void *UE_thread_synch(void *arg) } while (ind < sizeof(eutra_bands) / sizeof(eutra_bands[0])); if (found == 0) { + LOG_E(PHY,"Can't find EUTRA band for frequency %d",UE->frame_parms.dl_CarrierFreq); exit_fun("Can't find EUTRA band for frequency"); return &UE_thread_synch_retval; } @@ -851,14 +854,19 @@ void *UE_thread(void *arg) { writeBlockSize=UE->frame_parms.samples_per_tti; } else { // set TO compensation to zero + UE->rx_offset_diff = 0; + // compute TO compensation that should be applied for this frame - if ( UE->rx_offset < 5*UE->frame_parms.samples_per_tti && - UE->rx_offset > 0 ) + + if (UE->no_timing_correction == 0) { + if ( UE->rx_offset < 5*UE->frame_parms.samples_per_tti && + UE->rx_offset > 0 ) UE->rx_offset_diff = -1 ; - if ( UE->rx_offset > 5*UE->frame_parms.samples_per_tti && - UE->rx_offset < 10*UE->frame_parms.samples_per_tti ) + if ( UE->rx_offset > 5*UE->frame_parms.samples_per_tti && + UE->rx_offset < 10*UE->frame_parms.samples_per_tti ) UE->rx_offset_diff = 1; + } LOG_D(PHY,"AbsSubframe %d.%d SET rx_off_diff to %d rx_offset %d \n",proc->frame_rx,sub_frame,UE->rx_offset_diff,UE->rx_offset); readBlockSize=UE->frame_parms.samples_per_tti - diff --git a/targets/SIMU/USER/channel_sim.c b/targets/SIMU/USER/channel_sim.c index 91fc1cd059..a7aa1b1df7 100644 --- a/targets/SIMU/USER/channel_sim.c +++ b/targets/SIMU/USER/channel_sim.c @@ -60,7 +60,7 @@ #include "oaisim.h" #define RF -#define DEBUG_SIM +//#define DEBUG_SIM int number_rb_ul; int first_rbUL ; @@ -83,8 +83,8 @@ void do_DL_sig(channel_desc_t *RU2UE[NUMBER_OF_RU_MAX][NUMBER_OF_UE_MAX][MAX_NUM node_desc_t *enb_data[NUMBER_OF_RU_MAX], node_desc_t *ue_data[NUMBER_OF_UE_MAX], uint16_t subframe, - uint16_t offset, - uint16_t length, + uint32_t offset, + uint32_t length, uint8_t abstraction_flag,LTE_DL_FRAME_PARMS *ue_frame_parms, uint8_t UE_id, int CC_id) @@ -244,22 +244,54 @@ void do_DL_sig(channel_desc_t *RU2UE[NUMBER_OF_RU_MAX][NUMBER_OF_UE_MAX][MAX_NUM frame_parms = &RC.ru[ru_id]->frame_parms; sf_offset = (subframe*frame_parms->samples_per_tti) + offset; - LOG_D(EMU,"TXPATH: RU %d : DL_sig reading TX for subframe %d (sf_offset %d, length %d) from %p\n",ru_id,subframe,sf_offset,length,txdata[0]+sf_offset); + LOG_D(EMU,">>>>>>>>>>>>>>>>>TXPATH: RU %d : DL_sig reading TX for subframe %d (sf_offset %d, length %d) from %p\n",ru_id,subframe,sf_offset,length,txdata[0]+sf_offset); int length_meas = frame_parms->ofdm_symbol_size; - tx_pwr = dac_fixed_gain(s_re, - s_im, - txdata, - sf_offset, - nb_antennas_tx, - length, - sf_offset, - length_meas, - 14, - frame_parms->pdsch_config_common.referenceSignalPower, // dBm/RE - 0, - &ru_amp[ru_id], - frame_parms->N_RB_DL*12); + if (sf_offset+length <= frame_parms->samples_per_tti*10) { + tx_pwr = dac_fixed_gain(s_re, + s_im, + txdata, + sf_offset, + nb_antennas_tx, + length, + sf_offset, + length_meas, + 14, + frame_parms->pdsch_config_common.referenceSignalPower, // dBm/RE + 0, + &ru_amp[ru_id], + frame_parms->N_RB_DL*12); + + } + else { + tx_pwr = dac_fixed_gain(s_re, + s_im, + txdata, + sf_offset, + nb_antennas_tx, + (frame_parms->samples_per_tti*10)-sf_offset, + sf_offset, + length_meas, + 14, + frame_parms->pdsch_config_common.referenceSignalPower, // dBm/RE + 0, + &ru_amp[ru_id], + frame_parms->N_RB_DL*12); + + tx_pwr = dac_fixed_gain(s_re, + s_im, + txdata, + sf_offset, + nb_antennas_tx, + length+sf_offset-(frame_parms->samples_per_tti*10), + sf_offset, + length_meas, + 14, + frame_parms->pdsch_config_common.referenceSignalPower, // dBm/RE + 0, + &ru_amp[ru_id], + frame_parms->N_RB_DL*12); + } #ifdef DEBUG_SIM LOG_D(PHY,"[SIM][DL] subframe %d: txp (time) %d dB\n", subframe,dB_fixed(signal_energy(&txdata[0][sf_offset],length_meas))); @@ -503,7 +535,7 @@ void do_UL_sig(channel_desc_t *UE2RU[NUMBER_OF_UE_MAX][NUMBER_OF_RU_MAX][MAX_NUM if (((double)PHY_vars_UE_g[UE_id][CC_id]->tx_power_dBm[subframe] + UE2RU[UE_id][ru_id][CC_id]->path_loss_dB) <= -125.0) { // don't simulate a UE that is too weak - LOG_D(OCM,"[SIM][UL] UE %d tx_pwr %d dBm (num_RE %d) for subframe %d (sf_offset %d)\n", + LOG_D(OCM,"[SIM][UL] ULPOWERS UE %d tx_pwr %d dBm (num_RE %d) for subframe %d (sf_offset %d)\n", UE_id, PHY_vars_UE_g[UE_id][CC_id]->tx_power_dBm[subframe], PHY_vars_UE_g[UE_id][CC_id]->tx_total_RE[subframe], @@ -522,7 +554,7 @@ void do_UL_sig(channel_desc_t *UE2RU[NUMBER_OF_UE_MAX][NUMBER_OF_RU_MAX][MAX_NUM 1, NULL, PHY_vars_UE_g[UE_id][CC_id]->tx_total_RE[subframe]); // This make the previous argument the total power - LOG_D(OCM,"[SIM][UL] UE %d tx_pwr %f dBm (target %d dBm, num_RE %d) for subframe %d (sf_offset %d)\n", + LOG_D(OCM,"[SIM][UL] ULPOWERS UE %d tx_pwr %f dBm (target %d dBm, num_RE %d) for subframe %d (sf_offset %d)\n", UE_id, 10*log10(tx_pwr*PHY_vars_UE_g[UE_id][CC_id]->tx_total_RE[subframe]), PHY_vars_UE_g[UE_id][CC_id]->tx_power_dBm[subframe], @@ -582,11 +614,11 @@ void do_UL_sig(channel_desc_t *UE2RU[NUMBER_OF_UE_MAX][NUMBER_OF_RU_MAX][MAX_NUM 1e3/UE2RU[0][ru_id][CC_id]->sampling_rate, // sampling time (ns) (double)RC.ru[ru_id]->max_rxgain-(double)RC.ru[ru_id]->att_rx - 66.227); // rx_gain (dB) (66.227 = 20*log10(pow2(11)) = gain from the adc that will be applied later) -#ifdef DEBUG_SIM + //#ifdef DEBUG_SIM rx_pwr = signal_energy_fp(r_re_p,r_im_p,nb_antennas_rx,frame_parms->samples_per_tti,0);//*(double)frame_parms->ofdm_symbol_size/(12.0*frame_parms->N_RB_DL; LOG_D(OCM,"[SIM][UL] rx_pwr (ADC in) %f dB for subframe %d (rx_gain %f)\n",10*log10(rx_pwr),subframe, (double)RC.ru[ru_id]->max_rxgain-(double)RC.ru[ru_id]->att_rx); -#endif + //#endif rxdata = RC.ru[ru_id]->common.rxdata; sf_offset = subframe*frame_parms->samples_per_tti; diff --git a/targets/SIMU/USER/oaisim.c b/targets/SIMU/USER/oaisim.c index 94e05dd754..4b6e27178f 100644 --- a/targets/SIMU/USER/oaisim.c +++ b/targets/SIMU/USER/oaisim.c @@ -524,11 +524,6 @@ l2l1_task (void *args_p) } } - // UL scope at eNB 0 - form_enb[UE_inst] = create_lte_phy_scope_enb(); - sprintf (title, "LTE UL SCOPE UE %d to eNB %d", UE_inst, eNB_inst); - fl_show_form (form_enb[UE_inst]->lte_phy_scope_enb, FL_PLACE_HOTSPOT, FL_FULLBORDER, title); - } } @@ -747,7 +742,7 @@ l2l1_task (void *args_p) int subframe_ru_mask_local = subframe_ru_mask; int subframe_UE_mask_local = subframe_UE_mask; pthread_mutex_unlock(&subframe_mutex); - LOG_D(EMU,"Frame %d, Subframe %d: Checking masks %x,%x\n",frame,sf,subframe_ru_mask_local,subframe_UE_mask_local); + LOG_D(EMU,"Frame %d, Subframe %d, NB_RU %d, NB_UE %d: Checking masks %x,%x\n",frame,sf,NB_RU,NB_UE_INST,subframe_ru_mask_local,subframe_UE_mask_local); if ((subframe_ru_mask_local == ((1<= (UE_inst * 20)) // activate UE only after 20*UE_id frames so that different UEs turn on separately -#endif - { - LOG_D(EMU, - "PHY procedures UE %d for frame %d, slot %d (subframe TX %d, RX %d)\n", - UE_inst, frame % MAX_FRAME_NUMBER, slot, next_slot >> 1, - last_slot >> 1); - - if (PHY_vars_UE_g[UE_inst][0]->UE_mode[0] - != NOT_SYNCHED) { - if (frame > 0) { - PHY_vars_UE_g[UE_inst][0]->frame_rx = frame % MAX_FRAME_NUMBER; - PHY_vars_UE_g[UE_inst][0]->slot_rx = last_slot; - PHY_vars_UE_g[UE_inst][0]->slot_tx = next_slot; - - if (next_slot > 1) - PHY_vars_UE_g[UE_inst][0]->frame_tx = frame % MAX_FRAME_NUMBER; - else - PHY_vars_UE_g[UE_inst][0]->frame_tx = (frame + 1) % MAX_FRAME_NUMBER; -#ifdef OPENAIR2 - //Application - update_otg_UE (UE_inst, oai_emulation.info.time_ms); - - //Access layer - // PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, UE_inst, ENB_FLAG_NO, NOT_A_RNTI, frame, next_slot>>1, 0); - PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, UE_inst, 0, ENB_FLAG_NO, NOT_A_RNTI, frame % MAX_FRAME_NUMBER, next_slot); - pdcp_run (&ctxt); -#endif - - for (CC_id = 0; CC_id < MAX_NUM_CCs; - CC_id++) { - phy_procedures_UE_lte ( - PHY_vars_UE_g[UE_inst][CC_id], - 0, abstraction_flag, - normal_txrx, no_relay, - NULL); - } - - ue_data[UE_inst]->tx_power_dBm = - PHY_vars_UE_g[UE_inst][0]->tx_power_dBm; - } - } else { - if (abstraction_flag == 1) { - LOG_E(EMU, - "sync not supported in abstraction mode (UE%d,mode%d)\n", - UE_inst, - PHY_vars_UE_g[UE_inst][0]->UE_mode[0]); - exit (-1); - } - - if ((frame > 0) - && (last_slot - == (LTE_SLOTS_PER_FRAME - - 2))) { - initial_sync (PHY_vars_UE_g[UE_inst][0], - normal_txrx); - - } - } - -#ifdef PRINT_STATS - - if(last_slot==2 && frame%10==0) { - if (UE_stats_th[UE_inst]) { - fprintf(UE_stats_th[UE_inst],"%d %d\n",frame%MAX_FRAME_NUMBER, PHY_vars_UE_g[UE_inst][0]->bitrate[0]/1000); - } - } - - if (UE_stats[UE_inst]) { - len = dump_ue_stats (PHY_vars_UE_g[UE_inst][0], stats_buffer, 0, normal_txrx, 0); - rewind (UE_stats[UE_inst]); - fwrite (stats_buffer, 1, len, UE_stats[UE_inst]); - fflush(UE_stats[UE_inst]); - } - -#endif - } - } - } - -#if defined(Rel10) || defined(Rel14) - - for (RN_id=oai_emulation.info.first_rn_local; - RN_idframe = frame % MAX_FRAME_NUMBER; - - if ( oai_emulation.info.frame_type == 0) { - // RN == UE - if (frame>0) { - if (PHY_vars_UE_g[UE_inst][0]->UE_mode[0] != NOT_SYNCHED) { - LOG_D(EMU,"[RN %d] PHY procedures UE %d for frame %d, slot %d (subframe TX %d, RX %d)\n", - RN_id, UE_inst, frame, slot, next_slot >> 1,last_slot>>1); - PHY_vars_UE_g[UE_inst][0]->frame_rx = frame % MAX_FRAME_NUMBER; - PHY_vars_UE_g[UE_inst][0]->slot_rx = last_slot; - PHY_vars_UE_g[UE_inst][0]->slot_tx = next_slot; - - if (next_slot>1) PHY_vars_UE_g[UE_inst][0]->frame_tx = frame % MAX_FRAME_NUMBER; - else PHY_vars_UE_g[UE_inst][0]->frame_tx = (frame+1) % MAX_FRAME_NUMBER; - - phy_procedures_UE_lte (PHY_vars_UE_g[UE_inst][0], 0, abstraction_flag,normal_txrx, - r_type, PHY_vars_RN_g[RN_id]); - } else if (last_slot == (LTE_SLOTS_PER_FRAME-2)) { - initial_sync(PHY_vars_UE_g[UE_inst][0],normal_txrx); - } - } - - emu_transport (frame % MAX_FRAME_NUMBER, sf<<1, ((sf+4)%10)<<1, subframe_select(&PHY_vars_eNB_g[0][0]->frame_parms,sf), - oai_emulation.info.frame_type[0], ethernet_flag); - - start_meas (&dl_chan_stats); - - for (UE_inst = 0; UE_inst < NB_UE_INST; UE_inst++) - for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { - //#warning figure out what to do with UE frame_parms during initial_sync - do_DL_sig (r_re0, - r_im0, - r_re, - r_im, - s_re, - s_im, - eNB2UE, - enb_data, - ue_data, - PHY_vars_eNB_g[0][CC_id]->proc.proc_rxtx[sf&1].subframe_tx<<1, - abstraction_flag, - &PHY_vars_eNB_g[0][CC_id]->frame_parms, - UE_inst, CC_id); - do_DL_sig (r_re0, - r_im0, - r_re, - r_im,n - - s_re, - s_im, - eNB2UE, - enb_data, - ue_data, - (PHY_vars_eNB_g[0][CC_id]->proc.proc_rxtx[sf&1].subframe_tx<<1)+1, - abstraction_flag, - &PHY_vars_eNB_g[0][CC_id]->frame_parms, - UE_inst, CC_id); - } - - stop_meas (&dl_chan_stats); - - - start_meas (&ul_chan_stats); - - for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { - //#warning figure out what to do with UE frame_parms during initial_sync - do_UL_sig (r_re0, r_im0, r_re, r_im, s_re, s_im, UE2eNB, - enb_data, ue_data, - PHY_vars_UE_g[0][CC_id]->proc.proc_rxtx[sf&1].subframe_tx<<1, - abstraction_flag, - &PHY_vars_eNB_g[0][CC_id]->frame_parms, - frame % MAX_FRAME_NUMBER, CC_id); - do_UL_sig (r_re0, r_im0, r_re, r_im, s_re, s_im, UE2eNB, - enb_data, ue_data, - (PHY_vars_UE_g[0][CC_id]->proc.proc_rxtx[sf&1].subframe_tx<<1)+1, - abstraction_flag, - &PHY_vars_eNB_g[0][CC_id]->frame_parms, - frame % MAX_FRAME_NUMBER, CC_id); - } - - stop_meas (&ul_chan_stats); - - */ - if ((sf == 0) && ((frame % MAX_FRAME_NUMBER) == 0) && (abstraction_flag == 0) && (oai_emulation.info.n_frames == 1)) { @@ -1237,9 +1038,22 @@ void wait_RUs() { printf("RUs are ready, let's go\n"); } -void init_UE(int,int,int); +void init_UE(int,int,int,int); void init_RU(const char*); +void set_UE_defaults(int nb_ue) { + + for (int UE_id = 0;UE_idpdcch_vars[i][0]->dciFormat = 0; + PHY_vars_UE_g[UE_id][CC_id]->pdcch_vars[i][0]->agregationLevel = 0xFF; + } + PHY_vars_UE_g[UE_id][CC_id]->current_dlsch_cqi[0] = 10; + } + } +} + static void print_current_directory(void) { @@ -1372,7 +1186,10 @@ main (int argc, char **argv) printf("Waiting for RUs to get set up\n"); wait_RUs(); - init_UE(NB_UE_INST,0,0); + init_UE(NB_UE_INST,0,0,1); + + set_UE_defaults(NB_UE_INST); + init_ocm (); printf("Sending sync to all threads\n"); @@ -1493,6 +1310,8 @@ reset_opp_meas_oaisim (void) reset_meas (&PHY_vars_UE_g[UE_id][0]->ulsch_turbo_encoding_stats); reset_meas (&PHY_vars_UE_g[UE_id][0]->ulsch_interleaving_stats); reset_meas (&PHY_vars_UE_g[UE_id][0]->ulsch_multiplexing_stats); + + /* * L2 functions */ @@ -1513,6 +1332,7 @@ reset_opp_meas_oaisim (void) reset_meas (&UE_pdcp_stats[UE_id].pdcp_ip); reset_meas (&UE_pdcp_stats[UE_id].ip_pdcp); + } for (eNB_id = 0; eNB_id < NB_eNB_INST; eNB_id++) { diff --git a/targets/SIMU/USER/oaisim.h b/targets/SIMU/USER/oaisim.h index ce21470ed4..0fdc4002e4 100644 --- a/targets/SIMU/USER/oaisim.h +++ b/targets/SIMU/USER/oaisim.h @@ -48,10 +48,11 @@ void do_UL_sig(channel_desc_t *UE2RU[NUMBER_OF_UE_MAX][NUMBER_OF_RU_MAX][MAX_NUM uint32_t frame,int eNB_id,uint8_t CC_id); void do_DL_sig(channel_desc_t *RU2UE[NUMBER_OF_RU_MAX][NUMBER_OF_UE_MAX][MAX_NUM_CCs], - node_desc_t *enb_data[NUMBER_OF_RU_MAX],node_desc_t *ue_data[NUMBER_OF_UE_MAX], + node_desc_t *enb_data[NUMBER_OF_RU_MAX], + node_desc_t *ue_data[NUMBER_OF_UE_MAX], uint16_t subframe, - uint16_t offset, - uint16_t length, + uint32_t offset, + uint32_t length, uint8_t abstraction_flag,LTE_DL_FRAME_PARMS *frame_parms,uint8_t UE_id,int CC_id); void init_ue(node_desc_t *ue_data, UE_Antenna ue_ant);//Abstraction changes diff --git a/targets/SIMU/USER/oaisim_functions.c b/targets/SIMU/USER/oaisim_functions.c index dce104dc0a..4f30a5c2e7 100644 --- a/targets/SIMU/USER/oaisim_functions.c +++ b/targets/SIMU/USER/oaisim_functions.c @@ -782,7 +782,10 @@ void get_simulation_options(int argc, char *argv[]) } } - + if ( load_configmodule(argc,argv) == NULL) { + exit_fun("[SOFTMODEM] Error, configuration module init failed\n"); + } + if (RC.config_file_name != NULL) { /* Read eNB configuration file */ RCConfig(); @@ -1096,62 +1099,70 @@ int UE_trx_read(openair0_device *device, openair0_timestamp *ptimestamp, void ** int UE_id = device->Mod_id; int CC_id = device->CC_id; - int subframe,new_subframe; + int subframe; int sample_count=0; int read_size; + int sptti = PHY_vars_UE_g[UE_id][CC_id]->frame_parms.samples_per_tti; *ptimestamp = last_UE_rx_timestamp[UE_id][CC_id]; - LOG_D(EMU,"[TXPATH]UE_trx_read nsamps %d TS %llu (%llu) antenna %d\n",nsamps, + LOG_D(EMU,"UE %d DL simulation 0: UE_trx_read nsamps %d TS %llu (%llu, offset %d) antenna %d\n", + UE_id, + nsamps, (unsigned long long)current_UE_rx_timestamp[UE_id][CC_id], (unsigned long long)last_UE_rx_timestamp[UE_id][CC_id], + (int)(last_UE_rx_timestamp[UE_id][CC_id]%sptti), cc); - if (nsamps < PHY_vars_UE_g[UE_id][CC_id]->frame_parms.samples_per_tti) + if (nsamps < sptti) read_size = nsamps; else - read_size = PHY_vars_UE_g[UE_id][CC_id]->frame_parms.samples_per_tti; + read_size = sptti; while (sample_countframe_parms.samples_per_tti)%10; - new_subframe = ((last_UE_rx_timestamp[UE_id][CC_id]+read_size)/PHY_vars_UE_g[UE_id][CC_id]->frame_parms.samples_per_tti)%10; - if (new_subframe!=subframe) { - // tell top-level we are busy - pthread_mutex_lock(&subframe_mutex); - subframe_UE_mask|=(1<frame_parms.samples_per_tti, - nsamps, + last_UE_rx_timestamp[UE_id][CC_id]%sptti, + sptti, 0, //abstraction_flag, &PHY_vars_UE_g[UE_id][CC_id]->frame_parms, UE_id, CC_id); - - LOG_D(EMU,"[TXPATH]UE_trx_read @ TS %llu (%llu)=> frame %d, subframe %d\n", - (unsigned long long)current_UE_rx_timestamp[UE_id][CC_id], + LOG_D(EMU,"UE %d: DL simulation 6: UE_trx_read @ TS %llu (%llu)=> frame %d, subframe %d\n", + UE_id,(unsigned long long)current_UE_rx_timestamp[UE_id][CC_id], (unsigned long long)last_UE_rx_timestamp[UE_id][CC_id], - ((unsigned long long)last_UE_rx_timestamp[UE_id][CC_id]/(PHY_vars_UE_g[UE_id][CC_id]->frame_parms.samples_per_tti*10))&1023, + ((unsigned long long)last_UE_rx_timestamp[UE_id][CC_id]/(sptti*10))&1023, subframe); last_UE_rx_timestamp[UE_id][CC_id] += read_size; @@ -1326,7 +1337,9 @@ void init_devices(void){ PHY_vars_UE_g[UE_id][CC_id]->rfdevice.trx_set_freq_func = UE_trx_set_freq; PHY_vars_UE_g[UE_id][CC_id]->rfdevice.trx_set_gains_func = UE_trx_set_gains; last_UE_rx_timestamp[UE_id][CC_id] = 0; - + + + } } } @@ -1396,7 +1409,7 @@ void init_ocm(void) for (ru_id = 0; ru_id < RC.nb_RU; ru_id++) { for (UE_id = 0; UE_id < NB_UE_INST; UE_id++) { for (CC_id=0; CC_idpath_loss_dB = -132.24 + snr_dB - RC.ru[ru_id]->frame_parms.pdsch_config_common.referenceSignalPower;