diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c index 92392070af3b4c3002fb99ee9210281ffc87cb1f..71b31fcad62c87456247e7cf5c02c679d5ac56b5 100755 --- a/openair1/SCHED/phy_procedures_lte_eNb.c +++ b/openair1/SCHED/phy_procedures_lte_eNb.c @@ -2534,11 +2534,11 @@ void phy_procedures_eNB_common_RX(PHY_VARS_eNB *eNB,const uint8_t abstraction_fl proc->first_rx = 0; } - //printf("timestamp_rx %lu, frame %d(%d), subframe %d(%d)\n",proc->timestamp_rx,proc->frame_rx,frame,proc->subframe_rx,subframe); + // printf("timestamp_rx %lu, frame %d(%d), subframe %d(%d)\n",proc->timestamp_rx,proc->frame_rx,frame,proc->subframe_rx,subframe); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TRX_TS, proc->timestamp_rx&0xffffffff ); - VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX_ENB, frame ); - VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_RX_ENB, subframe ); + VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX_ENB, proc->frame_rx ); + VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_RX_ENB, proc->subframe_rx ); if (rxs != fp->samples_per_tti) exit_fun( "problem receiving samples" ); @@ -2547,27 +2547,27 @@ void phy_procedures_eNB_common_RX(PHY_VARS_eNB *eNB,const uint8_t abstraction_fl // now do common RX processing for first slot in subframe VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_SLOT_FEP,1); - remove_7_5_kHz(eNB,subframe<<1); - remove_7_5_kHz(eNB,1+(subframe<<1)); + remove_7_5_kHz(eNB,proc->subframe_rx<<1); + remove_7_5_kHz(eNB,1+(proc->subframe_rx<<1)); for (l=0; l<fp->symbols_per_tti/2; l++) { slot_fep_ul(fp, &eNB->common_vars, l, - subframe<<1, + proc->subframe_rx<<1, 0, 0 ); slot_fep_ul(fp, &eNB->common_vars, l, - 1+(subframe<<1), + 1+(proc->subframe_rx<<1), 0, 0 ); } VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_SLOT_FEP,0); - if (eNB->node_function == NGFI_RRU_IF4 && is_prach_subframe(fp, frame, subframe)<=0) { + if (eNB->node_function == NGFI_RRU_IF4 && is_prach_subframe(fp, proc->frame_rx, proc->subframe_rx)<=0) { /// **** send_IF4 of rxdataF to RCC (no prach now) **** /// @@ -2579,7 +2579,7 @@ void phy_procedures_eNB_common_RX(PHY_VARS_eNB *eNB,const uint8_t abstraction_fl /// **** send_IF4 of prach to RCC **** /// done in prach thread (below) // check if we have to detect PRACH first - if (is_prach_subframe(fp,frame,subframe)>0) { + if (is_prach_subframe(fp,proc->frame_rx,proc->subframe_rx)>0) { // wake up thread for PRACH RX if (pthread_mutex_lock(&proc->mutex_prach) != 0) { LOG_E( PHY, "[eNB] ERROR pthread_mutex_lock for eNB PRACH thread %d (IC %d)\n", proc->instance_cnt_prach ); @@ -2589,8 +2589,8 @@ void phy_procedures_eNB_common_RX(PHY_VARS_eNB *eNB,const uint8_t abstraction_fl int cnt_prach = ++proc->instance_cnt_prach; // set timing for prach thread - proc->frame_prach = frame; - proc->subframe_prach = subframe; + proc->frame_prach = proc->frame_rx; + proc->subframe_prach = proc->subframe_rx; pthread_mutex_unlock( &proc->mutex_prach ); @@ -2602,7 +2602,7 @@ void phy_procedures_eNB_common_RX(PHY_VARS_eNB *eNB,const uint8_t abstraction_fl return; } } else { - LOG_W( PHY,"[eNB] Frame %d, eNB PRACH thread busy!!\n", frame); + LOG_W( PHY,"[eNB] Frame %d Subframe %d, eNB PRACH thread busy (IC %d)!!\n", proc->frame_rx,proc->subframe_rx,cnt_prach); exit_fun( "PRACH thread busy" ); return; } @@ -2642,8 +2642,8 @@ void phy_procedures_eNB_common_RX(PHY_VARS_eNB *eNB,const uint8_t abstraction_fl int cnt_prach = ++proc->instance_cnt_prach; // set timing for prach thread - proc->frame_prach = frame; - proc->subframe_prach = subframe; + proc->frame_prach = proc->frame_rx; + proc->subframe_prach = proc->subframe_rx; pthread_mutex_unlock( &proc->mutex_prach ); diff --git a/targets/ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.c b/targets/ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.c index a8b5f3e21b508c539bcfb1595a92b4da4d529d54..b608c8acd2e5ba9a17df14e81ed1a054d189c73f 100644 --- a/targets/ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.c +++ b/targets/ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.c @@ -283,7 +283,7 @@ static void *watchdog_thread(void *arg) { volatile unsigned int *daq_mbox = openair0_daq_cnt(); unsigned int mbox,diff; - + int first_acquisition; /* Set affinity mask to include CPUs 1 to MAX_CPUS */ /* CPU 0 is reserved for UHD threads */ @@ -351,8 +351,6 @@ static void *watchdog_thread(void *arg) { cpu_affinity ); - - mlockall(MCL_CURRENT | MCL_FUTURE); exm->watchdog_exit = 0; @@ -387,6 +385,8 @@ static void *watchdog_thread(void *arg) { printf("Unknown sampling rate %f, exiting \n",cfg->sample_rate); exm->watchdog_exit=1; } + + first_acquisition=1; // main loop to keep up with DMA transfers from exmimo2 while ((!oai_exit) && (!exm->watchdog_exit)) { @@ -394,6 +394,7 @@ static void *watchdog_thread(void *arg) { // grab time from MBOX mbox = daq_mbox[0]; + if (mbox<exm->last_mbox) { // wrap-around diff = 150 + mbox - exm->last_mbox; } @@ -405,13 +406,25 @@ static void *watchdog_thread(void *arg) { pthread_mutex_lock(&exm->watchdog_mutex); exm->ts += (diff*exm->samples_per_frame/150) ; - if (diff > 10) // we're too late so exit + if (first_acquisition==1) //set last read to a closest subframe boundary + exm->last_ts_rx = (exm->ts/(exm->samples_per_frame/10))*(exm->samples_per_frame/10); + + if ((diff > 16)&&(first_acquisition==0)) {// we're too late so exit exm->watchdog_exit = 1; + printf("exiting, too late to keep up\n"); + } + first_acquisition=0; + + if (diff == 0) { + exm->watchdog_exit = 1; + printf("exiting, HW stopped\n"); + } if (exm->ts - exm->last_ts_rx > exm->samples_per_frame) { exm->watchdog_exit = 1; printf("RX Overflow, exiting\n"); } + // printf("ts %lu, last_ts_rx %lu, mbox %d, diff %d\n",exm->ts, exm->last_ts_rx,mbox,diff); pthread_mutex_unlock(&exm->watchdog_mutex); } @@ -444,6 +457,7 @@ int trx_exmimo_start(openair0_device *device) { exmimo_state_t *exm=device->priv; + printf("Starting ...\n"); openair0_start_rt_acquisition(0); exm->daq_state = running; @@ -460,7 +474,7 @@ int trx_exmimo_read(openair0_device *device, openair0_timestamp *ptimestamp, voi exmimo_state_t *exm=device->priv; openair0_config_t *cfg=&device->openair0_cfg[0]; openair0_timestamp ts,diff; - int i; + // int i; pthread_mutex_lock(&exm->watchdog_mutex); ts = exm->ts; @@ -469,25 +483,35 @@ int trx_exmimo_read(openair0_device *device, openair0_timestamp *ptimestamp, voi diff = exm->last_ts_rx+nsamps - ts; // difference in samples between current timestamp and last RX received sample // go to sleep until we should have enough samples (1024 for a bit more) +#ifdef DEBUG_EXMIMO + printf("Reading %d samples, ts %lu, last_ts_rx %lu (%lu) => sleeping %u us\n",nsamps,ts,exm->last_ts_rx,exm->last_ts_rx+nsamps, + (unsigned int)((double)(diff+1024)*1e6/cfg->sample_rate)); +#endif usleep((unsigned int)((double)(diff+1024)*1e6/cfg->sample_rate)); +#ifdef DEBUG_EXMIMO + printf("back\n"); +#endif // get new timestamp, in case we have to sleep again pthread_mutex_lock(&exm->watchdog_mutex); ts = exm->ts; pthread_mutex_unlock(&exm->watchdog_mutex); } + /* if (cfg->mmapped_dma == 0) { // if buff is not the dma buffer, do a memcpy, otherwise do nothing for (i=0;i<cc;i++) { + memcpy(buff[i], openair0_exmimo_pci[0].adc_head[i]+(exm->last_ts_rx % exm->samples_per_frame), nsamps*sizeof(int)); + } - } + }*/ *ptimestamp=exm->last_ts_rx; exm->last_ts_rx += nsamps; - return(0); + return(nsamps); } void trx_exmimo_end(openair0_device *device) { @@ -592,6 +616,8 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) { device->openair0_cfg = openair0_cfg; device->priv = (void *)exm; + openair0_config(openair0_cfg,0); + create_watchdog(device); return(0); diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.dual.band7_band20.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.dual.band7_band20.conf index 781e2a82e917adebdb132d29fe294be0ab50b07a..02f9077984bb876aa3921b556c5fef909f93b8d6 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.dual.band7_band20.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.dual.band7_band20.conf @@ -17,7 +17,7 @@ eNBs = mobile_country_code = "208"; - mobile_network_code = "92"; + mobile_network_code = "93"; ////////// Physical parameters: @@ -211,7 +211,7 @@ eNBs = }; ////////// MME parameters: - mme_ip_address = ( { ipv4 = "192.168.13.11"; + mme_ip_address = ( { ipv4 = "192.168.12.70"; ipv6 = "192:168:30::17"; active = "yes"; preference = "ipv4"; @@ -221,10 +221,10 @@ eNBs = NETWORK_INTERFACES : { ENB_INTERFACE_NAME_FOR_S1_MME = "eth0"; - ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.13.82/24"; + ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.212/24"; ENB_INTERFACE_NAME_FOR_S1U = "eth0"; - ENB_IPV4_ADDRESS_FOR_S1U = "192.168.13.82/24"; + ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.212/24"; ENB_PORT_FOR_S1U = 2152; # Spec 2152 }; diff --git a/targets/RT/USER/lte-enb.c b/targets/RT/USER/lte-enb.c index 8126ef46e0c3fc3fe54145f96fec190de72c2c00..abdbe0fb350a59275f518cc7815662a15a971178 100644 --- a/targets/RT/USER/lte-enb.c +++ b/targets/RT/USER/lte-enb.c @@ -127,7 +127,7 @@ extern volatile int start_UE; #endif extern volatile int oai_exit; -extern openair0_config_t *openair0_cfg; +extern openair0_config_t openair0_cfg[MAX_CARDS]; extern pthread_cond_t sync_cond; extern pthread_mutex_t sync_mutex; @@ -920,7 +920,7 @@ static void* eNB_thread_prach( void* param ) { exit_fun("Error getting thread priority"); } - LOG_I(HW, "[SCHED][eNB] PRACH thread started on CPU %d TID %ld, sched_policy = %s, priority = %d, CPU Affinity = %s\n", sched_getcpu(),gettid(), + LOG_I(HW, "[SCHED][eNB] PRACH thread started on CPU %d TID %ld, IC %d, sched_policy = %s, priority = %d, CPU Affinity = %s\n", sched_getcpu(),gettid(),proc->instance_cnt_prach, (policy == SCHED_FIFO) ? "SCHED_FIFO" : (policy == SCHED_RR) ? "SCHED_RR" : (policy == SCHED_OTHER) ? "SCHED_OTHER" :