From fe861bf49ee7986d07d0a14a54affd9411f480de Mon Sep 17 00:00:00 2001 From: Raymond Knopp Date: Sun, 13 May 2018 05:16:57 -0700 Subject: [PATCH] compilation passes and 1 UE simulation ok. --- cmake_targets/build_oai | 14 ++-- openair1/PHY/LTE_TRANSPORT/if4_tools.c | 2 +- openair1/PHY/LTE_TRANSPORT/prach.c | 2 +- openair1/SCHED/fapi_l1.c | 2 +- openair1/SCHED/phy_procedures_lte_eNb.c | 2 +- openair1/SCHED/prach_procedures.c | 2 +- targets/RT/USER/lte-enb.c | 4 +- targets/RT/USER/lte-ru.c | 106 ++++++++++++------------ targets/SIMU/USER/channel_sim.c | 4 +- targets/SIMU/USER/oaisim_config.c | 4 +- targets/SIMU/USER/oaisim_functions.c | 7 +- 11 files changed, 77 insertions(+), 72 deletions(-) diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai index eb34191107..ce7ebc46be 100755 --- a/cmake_targets/build_oai +++ b/cmake_targets/build_oai @@ -685,13 +685,6 @@ function main() { oaisim_build_dir=oaisim_build_oai oaisim_exec=oaisim fi -# mandatory shared lib - compilations \ - $oaisim_build_dir $config_libconfig_shlib \ - lib$config_libconfig_shlib.so $dbin/lib$config_libconfig_shlib.so - compilations \ - $oaisim_build_dir coding \ - libcoding.so $dbin/libcoding.so echo_info "Compiling $oaisim_exec ($oaisim_build_dir)" cmake_file=$DIR/$oaisim_build_dir/CMakeLists.txt @@ -711,6 +704,13 @@ function main() { compilations \ $oaisim_build_dir $oaisim_exec \ $oaisim_exec $dbin/$oaisim_exec.$REL + compilations \ + $oaisim_build_dir $config_libconfig_shlib \ + lib$config_libconfig_shlib.so $dbin/lib$config_libconfig_shlib.so + compilations \ + $oaisim_build_dir coding \ + libcoding.so $dbin/libcoding.so + if [ "$NOS1" != "1" ] ; then diff --git a/openair1/PHY/LTE_TRANSPORT/if4_tools.c b/openair1/PHY/LTE_TRANSPORT/if4_tools.c index a0c137942b..874907c482 100644 --- a/openair1/PHY/LTE_TRANSPORT/if4_tools.c +++ b/openair1/PHY/LTE_TRANSPORT/if4_tools.c @@ -407,7 +407,7 @@ void recv_IF4p5(RU_t *ru, int *frame, int *subframe, uint16_t *packet_type, uint PRACH_BLOCK_SIZE_BYTES); } } - LOG_I(PHY,"PRACH_IF4p5: CC_id %d : frame %d, subframe %d => %d dB\n",ru->idx,*frame,*subframe, + LOG_D(PHY,"PRACH_IF4p5: CC_id %d : frame %d, subframe %d => %d dB\n",ru->idx,*frame,*subframe, dB_fixed(signal_energy((int*)&prach_rxsigF[0][0],839))); for (idx=0;idxnum_eNB;idx++) ru->wakeup_prach_eNB(ru->eNB_list[idx],ru,*frame,*subframe); diff --git a/openair1/PHY/LTE_TRANSPORT/prach.c b/openair1/PHY/LTE_TRANSPORT/prach.c index c7d80d9241..54b91184b9 100644 --- a/openair1/PHY/LTE_TRANSPORT/prach.c +++ b/openair1/PHY/LTE_TRANSPORT/prach.c @@ -1514,7 +1514,7 @@ void rx_prach0(PHY_VARS_eNB *eNB, else #endif send_IF4p5(ru, ru->proc.frame_prach, ru->proc.subframe_prach, IF4p5_PRACH); - + LOG_D(PHY,"SFN/SF %d.%d: Sending PRACH over IF4p5\n",ru->proc.frame_prach,ru->proc.subframe_prach); return; } else if (eNB!=NULL) { diff --git a/openair1/SCHED/fapi_l1.c b/openair1/SCHED/fapi_l1.c index e74c937670..a6f2eec5f2 100644 --- a/openair1/SCHED/fapi_l1.c +++ b/openair1/SCHED/fapi_l1.c @@ -834,7 +834,7 @@ void schedule_response(Sched_Rsp_t *Sched_INFO) else { for (i=0;iul_config_request_body.ul_config_pdu_list[i]; - LOG_I(PHY,"NFAPI: ul_pdu %d : type %d\n",i,ul_config_pdu->pdu_type); + LOG_D(PHY,"NFAPI: ul_pdu %d : type %d\n",i,ul_config_pdu->pdu_type); AssertFatal(ul_config_pdu->pdu_type == NFAPI_UL_CONFIG_ULSCH_PDU_TYPE || ul_config_pdu->pdu_type == NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE || ul_config_pdu->pdu_type == NFAPI_UL_CONFIG_ULSCH_CQI_RI_PDU_TYPE || diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c index 92ee1b4436..4d658dff25 100644 --- a/openair1/SCHED/phy_procedures_lte_eNb.c +++ b/openair1/SCHED/phy_procedures_lte_eNb.c @@ -1898,7 +1898,7 @@ void phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,const VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_ENB_RX_UESPEC, 1 ); - LOG_I(PHY,"[eNB %d] Frame %d: Doing phy_procedures_eNB_uespec_RX(%d)\n",eNB->Mod_id,frame, subframe); + LOG_D(PHY,"[eNB %d] Frame %d: Doing phy_procedures_eNB_uespec_RX(%d)\n",eNB->Mod_id,frame, subframe); eNB->rb_mask_ul[0]=0; eNB->rb_mask_ul[1]=0; diff --git a/openair1/SCHED/prach_procedures.c b/openair1/SCHED/prach_procedures.c index 51ce01ae42..4730eed613 100644 --- a/openair1/SCHED/prach_procedures.c +++ b/openair1/SCHED/prach_procedures.c @@ -116,7 +116,7 @@ void prach_procedures(PHY_VARS_eNB *eNB #endif ); - LOG_I(PHY,"[RAPROC] Frame %d, subframe %d : Most likely preamble %d, energy %d dB delay %d (prach_energy counter %d)\n", + 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, diff --git a/targets/RT/USER/lte-enb.c b/targets/RT/USER/lte-enb.c index a6099c0228..740aae931a 100644 --- a/targets/RT/USER/lte-enb.c +++ b/targets/RT/USER/lte-enb.c @@ -391,7 +391,7 @@ void eNB_top(PHY_VARS_eNB *eNB, int frame_rx, int subframe_rx, char *string) proc->frame_tx = proc_rxtx->frame_tx; proc_rxtx->timestamp_tx = proc->timestamp_tx; - LOG_I(PHY,"RXTX for TX: %d.%d, RX: %d.%d\n",proc_rxtx->frame_tx,proc_rxtx->subframe_tx,proc_rxtx->frame_rx,proc_rxtx->subframe_rx); + LOG_D(PHY,"RXTX for TX: %d.%d, RX: %d.%d\n",proc_rxtx->frame_tx,proc_rxtx->subframe_tx,proc_rxtx->frame_rx,proc_rxtx->subframe_rx); if (rxtx(eNB,proc_rxtx,string) < 0) LOG_E(PHY,"eNB %d CC_id %d failed during execution\n",eNB->Mod_id,eNB->CC_id); } @@ -630,7 +630,7 @@ static void* eNB_thread_prach( void* param ) { if (wait_on_condition(&proc->mutex_prach,&proc->cond_prach,&proc->instance_cnt_prach,"eNB_prach_thread") < 0) break; - LOG_I(PHY,"Running eNB prach procedures\n"); + LOG_D(PHY,"Running eNB prach procedures\n"); prach_procedures(eNB #ifdef Rel14 ,0 diff --git a/targets/RT/USER/lte-ru.c b/targets/RT/USER/lte-ru.c index cb22f1bd2c..be3fdfa9f1 100644 --- a/targets/RT/USER/lte-ru.c +++ b/targets/RT/USER/lte-ru.c @@ -1097,7 +1097,7 @@ static void* ru_thread_prach( void* param ) { ); } else { - LOG_I(PHY,"Running rx_prach in %d.%d\n",proc->frame_prach,proc->subframe_prach); + LOG_D(PHY,"Running rx_prach in %d.%d\n",proc->frame_prach,proc->subframe_prach); rx_prach(NULL, ru, NULL, @@ -1289,7 +1289,7 @@ void wakeup_eNBs(RU_t *ru) { sprintf(string,"Incoming RU %d",ru->idx); pthread_mutex_lock(&proc->mutex_RU); - LOG_I(PHY,"Frame %d, Subframe %d: RU %d done (wait_cnt %d),RU_mask[%d] %x\n", + LOG_D(PHY,"Frame %d, Subframe %d: RU %d done (wait_cnt %d),RU_mask[%d] %x\n", ru->proc.frame_rx,ru->proc.subframe_rx,ru->idx,ru->wait_cnt,ru->proc.subframe_rx,proc->RU_mask[ru->proc.subframe_rx]); clock_gettime(CLOCK_MONOTONIC,&ru->proc.t[ru->proc.subframe_rx]); @@ -1612,7 +1612,7 @@ static void* ru_thread_control( void* param ) { &rru_config_msg, msg_len))<0) { LOG_D(PHY,"Waiting msg for RU %d\n", ru->idx); - + } else { switch(rru_config_msg.type) @@ -1845,7 +1845,7 @@ static void* ru_thread( void* param ) { PHY_VARS_eNB **eNB_list = ru->eNB_list; PHY_VARS_eNB *eNB=eNB_list[0]; eNB_proc_t *eNBproc = &eNB->proc; - + int ret; // set default return value thread_top_init("ru_thread",0,870000,1000000,1000000); @@ -1862,8 +1862,8 @@ static void* ru_thread( void* param ) { phy_init_RU(ru); - ret = openair0_device_load(&ru->rfdevice,&ru->openair0_cfg); - } + ret = openair0_device_load(&ru->rfdevice,&ru->openair0_cfg); + if (setup_RU_buffers(ru)!=0) { printf("Exiting, cannot initialize RU Buffers\n"); exit(-1); @@ -1891,9 +1891,9 @@ static void* ru_thread( void* param ) { // wait to be woken up if (ru->function!=eNodeB_3GPP && ru->has_ctrl_prt == 1) { if (wait_on_condition(&ru->proc.mutex_ru,&ru->proc.cond_ru_thread,&ru->proc.instance_cnt_ru,"ru_thread")<0) break; - + } else wait_sync("ru_thread"); - + if (ru->is_slave == 0) AssertFatal(ru->state == RU_RUN,"ru-%d state = %s != RU_RUN\n",ru->idx,ru_states[ru->state]); else if (ru->is_slave == 1) AssertFatal(ru->state == RU_SYNC || ru->state == RU_RUN,"ru %d state = %s != RU_SYNC or RU_RUN\n",ru->idx,ru_states[ru->state]); // Start RF device if any @@ -1903,11 +1903,11 @@ static void* ru_thread( void* param ) { else LOG_I(PHY,"RU %d rf device ready\n",ru->idx); } else LOG_D(PHY,"RU %d no rf device\n",ru->idx); - - + + // if an asnych_rxtx thread exists // wakeup the thread because the devices are ready at this point - + LOG_D(PHY,"Locking asynch mutex\n"); if ((ru->fh_south_asynch_in)||(ru->fh_north_asynch_in)) { pthread_mutex_lock(&proc->mutex_asynch_rxtx); @@ -1916,15 +1916,15 @@ static void* ru_thread( void* param ) { pthread_cond_signal(&proc->cond_asynch_rxtx); } else LOG_D(PHY,"RU %d no asynch_south interface\n",ru->idx); - + // if this is a slave RRU, try to synchronize on the DL frequency if ((ru->is_slave == 1) && (ru->if_south == LOCAL_RF)) do_ru_synch(ru); - - + + LOG_D(PHY,"Starting steady-state operation\n"); // This is a forever while loop, it loops over subframes which are scheduled by incoming samples from HW devices while (ru->state == RU_RUN) { - + // these are local subframe/frame counters to check that we are in synch with the fronthaul timing. // They are set on the first rx/tx in the underly FH routines. if (subframe==9) { @@ -1934,8 +1934,8 @@ static void* ru_thread( void* param ) { } else { subframe++; } - - + + // synchronization on input FH interface, acquire signals/data and block if (ru->stop_rf && ru->cmd == STOP_RU) { ru->stop_rf(ru); @@ -1951,38 +1951,38 @@ static void* ru_thread( void* param ) { break; } if (oai_exit == 1) break; - + if (ru->fh_south_in && ru->state == RU_RUN ) ru->fh_south_in(ru,&frame,&subframe); else AssertFatal(1==0, "No fronthaul interface at south port"); - + if (ru->wait_cnt > 0) { - - ru->wait_cnt--; + + ru->wait_cnt--; - - LOG_I(PHY,"RU thread %d, frame %d, subframe %d, wait_cnt %d \n",ru->idx, frame, subframe, ru->wait_cnt); - - if (ru->if_south!=LOCAL_RF && ru->wait_cnt <=20 && subframe == 5 && frame != RC.ru[0]->proc.frame_rx && resynch_done == 0) { - // Send RRU_frame adjust - RRU_CONFIG_msg_t rru_config_msg; - rru_config_msg.type = RRU_frame_resynch; - rru_config_msg.len = sizeof(RRU_CONFIG_msg_t); // TODO: set to correct msg len - ((uint16_t*)&rru_config_msg.msg[0])[0] = RC.ru[0]->proc.frame_rx; - ru->cmd=WAIT_RESYNCH; - LOG_D(PHY,"Sending Frame Resynch %d to RRU %d\n", RC.ru[0]->proc.frame_rx,ru->idx); - AssertFatal((ru->ifdevice.trx_ctlsend_func(&ru->ifdevice,&rru_config_msg,rru_config_msg.len)!=-1),"Failed to send msg to RAU\n"); - resynch_done=1; - } - wakeup_eNBs(ru); + + LOG_I(PHY,"RU thread %d, frame %d, subframe %d, wait_cnt %d \n",ru->idx, frame, subframe, ru->wait_cnt); + + if (ru->if_south!=LOCAL_RF && ru->wait_cnt <=20 && subframe == 5 && frame != RC.ru[0]->proc.frame_rx && resynch_done == 0) { + // Send RRU_frame adjust + RRU_CONFIG_msg_t rru_config_msg; + rru_config_msg.type = RRU_frame_resynch; + rru_config_msg.len = sizeof(RRU_CONFIG_msg_t); // TODO: set to correct msg len + ((uint16_t*)&rru_config_msg.msg[0])[0] = RC.ru[0]->proc.frame_rx; + ru->cmd=WAIT_RESYNCH; + LOG_D(PHY,"Sending Frame Resynch %d to RRU %d\n", RC.ru[0]->proc.frame_rx,ru->idx); + AssertFatal((ru->ifdevice.trx_ctlsend_func(&ru->ifdevice,&rru_config_msg,rru_config_msg.len)!=-1),"Failed to send msg to RAU\n"); + resynch_done=1; + } + wakeup_eNBs(ru); } - - else { - + + else { + LOG_D(PHY,"RU thread %d, frame %d, subframe %d \n", ru->idx,frame,subframe); - + if ((ru->do_prach>0) && (is_prach_subframe(fp, proc->frame_rx, proc->subframe_rx)==1)) { - LOG_I(PHY,"Waking up prach for %d.%d\n",proc->frame_rx,proc->subframe_rx); + LOG_D(PHY,"Waking up prach for %d.%d\n",proc->frame_rx,proc->subframe_rx); wakeup_prach_ru(ru); } #ifdef Rel14 @@ -1990,14 +1990,14 @@ static void* ru_thread( void* param ) { wakeup_prach_ru_br(ru); } #endif - + // adjust for timing offset between RU if (ru->idx!=0) proc->frame_tx = (proc->frame_tx+proc->frame_offset)&1023; - + // At this point, all information for subframe has been received on FH interface // If this proc is to provide synchronization, do so wakeup_slaves(proc); - + // do RX front-end processing (frequency-shift, dft) if needed if (ru->feprx) ru->feprx(ru); @@ -2019,18 +2019,18 @@ static void* ru_thread( void* param ) { if (ru->fh_north_out) ru->fh_north_out(ru); } } - + } // while !oai_exit - + printf( "Exiting ru_thread \n"); - + if (ru->stop_rf != NULL) { if (ru->stop_rf(ru) != 0) LOG_E(HW,"Could not stop the RF device\n"); else LOG_I(PHY,"RU %d rf device stopped\n",ru->idx); } - + return NULL; } @@ -2886,12 +2886,16 @@ void RCconfig_RU(void) { // Check if control port set if (!(config_isparamset(RUParamList.paramarray[j],RU_REMOTE_PORTC_IDX)) ){ - RC.ru[j]->eth_params.my_portc = *(RUParamList.paramarray[j][RU_LOCAL_PORTC_IDX].uptr); - RC.ru[j]->eth_params.remote_portc = *(RUParamList.paramarray[j][RU_REMOTE_PORTC_IDX].uptr); + printf("Removing control port for RU %d\n",j); RC.ru[j]->has_ctrl_prt = 0; } - + else { + RC.ru[j]->eth_params.my_portc = *(RUParamList.paramarray[j][RU_LOCAL_PORTC_IDX].uptr); + RC.ru[j]->eth_params.remote_portc = *(RUParamList.paramarray[j][RU_REMOTE_PORTC_IDX].uptr); + printf(" Control port %u \n",RC.ru[j]->eth_params.my_portc); + + } if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "udp") == 0) { RC.ru[j]->if_south = LOCAL_RF; diff --git a/targets/SIMU/USER/channel_sim.c b/targets/SIMU/USER/channel_sim.c index 553d480782..f3636ee96a 100644 --- a/targets/SIMU/USER/channel_sim.c +++ b/targets/SIMU/USER/channel_sim.c @@ -497,7 +497,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] ULPOWERS UE %d tx_pwr %d dBm (num_RE %d) for subframe %d (sf_offset %d)\n", + LOG_D(PHY,"[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], @@ -516,7 +516,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] ULPOWERS UE %d tx_pwr %f dBm (target %d dBm, num_RE %d) for subframe %d (sf_offset %d)\n", + LOG_D(PHY,"[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], diff --git a/targets/SIMU/USER/oaisim_config.c b/targets/SIMU/USER/oaisim_config.c index 17ed9ff571..6188d49004 100644 --- a/targets/SIMU/USER/oaisim_config.c +++ b/targets/SIMU/USER/oaisim_config.c @@ -443,13 +443,13 @@ int olg_config(void) //set_log(OCM, LOG_INFO, 20); //set_log(OTG, LOG_INFO, 1); set_comp_log(OCG, LOG_ERR, 0x15,1); - set_comp_log(EMU, LOG_DEBUG, 0x15,20); + set_comp_log(EMU, LOG_INFO, 0x15,20); set_comp_log(MAC, LOG_TRACE, 0x15,1); set_comp_log(RLC, LOG_TRACE, 0x15,1); set_comp_log(PHY, LOG_TRACE, 0x15, 1); set_comp_log(PDCP, LOG_DEBUG, 0x15,1); set_comp_log(RRC, LOG_DEBUG, 0x15,1); - set_comp_log(OCM, LOG_DEBUG, 0x15,20); + set_comp_log(OCM, LOG_INFO, 0x15,20); set_comp_log(OTG, LOG_DEBUG, 0x15,1); set_comp_log(OMG, LOG_NOTICE, 0x15,1); set_comp_log(OPT, LOG_ERR, 0x15,1); diff --git a/targets/SIMU/USER/oaisim_functions.c b/targets/SIMU/USER/oaisim_functions.c index 070ea58e1d..1ebf993b2b 100644 --- a/targets/SIMU/USER/oaisim_functions.c +++ b/targets/SIMU/USER/oaisim_functions.c @@ -1072,7 +1072,7 @@ int ru_trx_read(openair0_device *device, openair0_timestamp *ptimestamp, void ** *ptimestamp = last_ru_rx_timestamp[ru_id][CC_id]; - LOG_D(EMU,"RU_trx_read nsamps %d TS(%llu,%llu) => subframe %d\n",nsamps, + LOG_D(PHY,"RU_trx_read nsamps %d TS(%llu,%llu) => subframe %d\n",nsamps, (unsigned long long)current_ru_rx_timestamp[ru_id][CC_id], (unsigned long long)last_ru_rx_timestamp[ru_id][CC_id], (int)((*ptimestamp/RC.ru[ru_id]->frame_parms.samples_per_tti)%10)); @@ -1087,8 +1087,9 @@ int ru_trx_read(openair0_device *device, openair0_timestamp *ptimestamp, void ** subframe = (last_ru_rx_timestamp[ru_id][CC_id]/RC.ru[ru_id]->frame_parms.samples_per_tti)%10; - if (subframe_select(&RC.ru[ru_id]->frame_parms,subframe) != SF_DL) { - LOG_D(EMU,"RU_trx_read generating UL subframe %d (Ts %llu, current TS %llu)\n", + if (RC.ru[ru_id]->frame_parms.frame_type == FDD || + subframe_select(&RC.ru[ru_id]->frame_parms,subframe) != SF_DL) { + LOG_D(PHY,"RU_trx_read generating UL subframe %d (Ts %llu, current TS %llu)\n", subframe,(unsigned long long)*ptimestamp, (unsigned long long)current_ru_rx_timestamp[ru_id][CC_id]);