Commit 4302afee authored by Raymond Knopp's avatar Raymond Knopp

small changes

parent e5132ebf
...@@ -2534,11 +2534,11 @@ void phy_procedures_eNB_common_RX(PHY_VARS_eNB *eNB,const uint8_t abstraction_fl ...@@ -2534,11 +2534,11 @@ void phy_procedures_eNB_common_RX(PHY_VARS_eNB *eNB,const uint8_t abstraction_fl
proc->first_rx = 0; 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_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_FRAME_NUMBER_RX_ENB, proc->frame_rx );
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_SUBFRAME_NUMBER_RX_ENB, proc->subframe_rx );
if (rxs != fp->samples_per_tti) if (rxs != fp->samples_per_tti)
exit_fun( "problem receiving samples" ); exit_fun( "problem receiving samples" );
...@@ -2547,27 +2547,27 @@ void phy_procedures_eNB_common_RX(PHY_VARS_eNB *eNB,const uint8_t abstraction_fl ...@@ -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 // 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); 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,proc->subframe_rx<<1);
remove_7_5_kHz(eNB,1+(subframe<<1)); remove_7_5_kHz(eNB,1+(proc->subframe_rx<<1));
for (l=0; l<fp->symbols_per_tti/2; l++) { for (l=0; l<fp->symbols_per_tti/2; l++) {
slot_fep_ul(fp, slot_fep_ul(fp,
&eNB->common_vars, &eNB->common_vars,
l, l,
subframe<<1, proc->subframe_rx<<1,
0, 0,
0 0
); );
slot_fep_ul(fp, slot_fep_ul(fp,
&eNB->common_vars, &eNB->common_vars,
l, l,
1+(subframe<<1), 1+(proc->subframe_rx<<1),
0, 0,
0 0
); );
} }
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_SLOT_FEP,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) **** /// /// **** 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 ...@@ -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) /// **** send_IF4 of prach to RCC **** /// done in prach thread (below)
// check if we have to detect PRACH first // 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 // wake up thread for PRACH RX
if (pthread_mutex_lock(&proc->mutex_prach) != 0) { 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 ); 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 ...@@ -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; int cnt_prach = ++proc->instance_cnt_prach;
// set timing for prach thread // set timing for prach thread
proc->frame_prach = frame; proc->frame_prach = proc->frame_rx;
proc->subframe_prach = subframe; proc->subframe_prach = proc->subframe_rx;
pthread_mutex_unlock( &proc->mutex_prach ); 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 ...@@ -2602,7 +2602,7 @@ void phy_procedures_eNB_common_RX(PHY_VARS_eNB *eNB,const uint8_t abstraction_fl
return; return;
} }
} else { } 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" ); exit_fun( "PRACH thread busy" );
return; return;
} }
...@@ -2642,8 +2642,8 @@ void phy_procedures_eNB_common_RX(PHY_VARS_eNB *eNB,const uint8_t abstraction_fl ...@@ -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; int cnt_prach = ++proc->instance_cnt_prach;
// set timing for prach thread // set timing for prach thread
proc->frame_prach = frame; proc->frame_prach = proc->frame_rx;
proc->subframe_prach = subframe; proc->subframe_prach = proc->subframe_rx;
pthread_mutex_unlock( &proc->mutex_prach ); pthread_mutex_unlock( &proc->mutex_prach );
......
...@@ -283,7 +283,7 @@ static void *watchdog_thread(void *arg) { ...@@ -283,7 +283,7 @@ static void *watchdog_thread(void *arg) {
volatile unsigned int *daq_mbox = openair0_daq_cnt(); volatile unsigned int *daq_mbox = openair0_daq_cnt();
unsigned int mbox,diff; unsigned int mbox,diff;
int first_acquisition;
/* Set affinity mask to include CPUs 1 to MAX_CPUS */ /* Set affinity mask to include CPUs 1 to MAX_CPUS */
/* CPU 0 is reserved for UHD threads */ /* CPU 0 is reserved for UHD threads */
...@@ -351,8 +351,6 @@ static void *watchdog_thread(void *arg) { ...@@ -351,8 +351,6 @@ static void *watchdog_thread(void *arg) {
cpu_affinity ); cpu_affinity );
mlockall(MCL_CURRENT | MCL_FUTURE); mlockall(MCL_CURRENT | MCL_FUTURE);
exm->watchdog_exit = 0; exm->watchdog_exit = 0;
...@@ -387,6 +385,8 @@ static void *watchdog_thread(void *arg) { ...@@ -387,6 +385,8 @@ static void *watchdog_thread(void *arg) {
printf("Unknown sampling rate %f, exiting \n",cfg->sample_rate); printf("Unknown sampling rate %f, exiting \n",cfg->sample_rate);
exm->watchdog_exit=1; exm->watchdog_exit=1;
} }
first_acquisition=1;
// main loop to keep up with DMA transfers from exmimo2 // main loop to keep up with DMA transfers from exmimo2
while ((!oai_exit) && (!exm->watchdog_exit)) { while ((!oai_exit) && (!exm->watchdog_exit)) {
...@@ -394,6 +394,7 @@ static void *watchdog_thread(void *arg) { ...@@ -394,6 +394,7 @@ static void *watchdog_thread(void *arg) {
// grab time from MBOX // grab time from MBOX
mbox = daq_mbox[0]; mbox = daq_mbox[0];
if (mbox<exm->last_mbox) { // wrap-around if (mbox<exm->last_mbox) { // wrap-around
diff = 150 + mbox - exm->last_mbox; diff = 150 + mbox - exm->last_mbox;
} }
...@@ -405,13 +406,25 @@ static void *watchdog_thread(void *arg) { ...@@ -405,13 +406,25 @@ static void *watchdog_thread(void *arg) {
pthread_mutex_lock(&exm->watchdog_mutex); pthread_mutex_lock(&exm->watchdog_mutex);
exm->ts += (diff*exm->samples_per_frame/150) ; 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; 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) { if (exm->ts - exm->last_ts_rx > exm->samples_per_frame) {
exm->watchdog_exit = 1; exm->watchdog_exit = 1;
printf("RX Overflow, exiting\n"); 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); pthread_mutex_unlock(&exm->watchdog_mutex);
} }
...@@ -444,6 +457,7 @@ int trx_exmimo_start(openair0_device *device) { ...@@ -444,6 +457,7 @@ int trx_exmimo_start(openair0_device *device) {
exmimo_state_t *exm=device->priv; exmimo_state_t *exm=device->priv;
printf("Starting ...\n");
openair0_start_rt_acquisition(0); openair0_start_rt_acquisition(0);
exm->daq_state = running; exm->daq_state = running;
...@@ -460,7 +474,7 @@ int trx_exmimo_read(openair0_device *device, openair0_timestamp *ptimestamp, voi ...@@ -460,7 +474,7 @@ int trx_exmimo_read(openair0_device *device, openair0_timestamp *ptimestamp, voi
exmimo_state_t *exm=device->priv; exmimo_state_t *exm=device->priv;
openair0_config_t *cfg=&device->openair0_cfg[0]; openair0_config_t *cfg=&device->openair0_cfg[0];
openair0_timestamp ts,diff; openair0_timestamp ts,diff;
int i; // int i;
pthread_mutex_lock(&exm->watchdog_mutex); pthread_mutex_lock(&exm->watchdog_mutex);
ts = exm->ts; ts = exm->ts;
...@@ -469,25 +483,35 @@ int trx_exmimo_read(openair0_device *device, openair0_timestamp *ptimestamp, voi ...@@ -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 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) // 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)); 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 // get new timestamp, in case we have to sleep again
pthread_mutex_lock(&exm->watchdog_mutex); pthread_mutex_lock(&exm->watchdog_mutex);
ts = exm->ts; ts = exm->ts;
pthread_mutex_unlock(&exm->watchdog_mutex); pthread_mutex_unlock(&exm->watchdog_mutex);
} }
/*
if (cfg->mmapped_dma == 0) { // if buff is not the dma buffer, do a memcpy, otherwise do nothing if (cfg->mmapped_dma == 0) { // if buff is not the dma buffer, do a memcpy, otherwise do nothing
for (i=0;i<cc;i++) { for (i=0;i<cc;i++) {
memcpy(buff[i], memcpy(buff[i],
openair0_exmimo_pci[0].adc_head[i]+(exm->last_ts_rx % exm->samples_per_frame), openair0_exmimo_pci[0].adc_head[i]+(exm->last_ts_rx % exm->samples_per_frame),
nsamps*sizeof(int)); nsamps*sizeof(int));
} }
} }*/
*ptimestamp=exm->last_ts_rx; *ptimestamp=exm->last_ts_rx;
exm->last_ts_rx += nsamps; exm->last_ts_rx += nsamps;
return(0); return(nsamps);
} }
void trx_exmimo_end(openair0_device *device) { void trx_exmimo_end(openair0_device *device) {
...@@ -592,6 +616,8 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) { ...@@ -592,6 +616,8 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
device->openair0_cfg = openair0_cfg; device->openair0_cfg = openair0_cfg;
device->priv = (void *)exm; device->priv = (void *)exm;
openair0_config(openair0_cfg,0);
create_watchdog(device); create_watchdog(device);
return(0); return(0);
......
...@@ -17,7 +17,7 @@ eNBs = ...@@ -17,7 +17,7 @@ eNBs =
mobile_country_code = "208"; mobile_country_code = "208";
mobile_network_code = "92"; mobile_network_code = "93";
////////// Physical parameters: ////////// Physical parameters:
...@@ -211,7 +211,7 @@ eNBs = ...@@ -211,7 +211,7 @@ eNBs =
}; };
////////// MME parameters: ////////// MME parameters:
mme_ip_address = ( { ipv4 = "192.168.13.11"; mme_ip_address = ( { ipv4 = "192.168.12.70";
ipv6 = "192:168:30::17"; ipv6 = "192:168:30::17";
active = "yes"; active = "yes";
preference = "ipv4"; preference = "ipv4";
...@@ -221,10 +221,10 @@ eNBs = ...@@ -221,10 +221,10 @@ eNBs =
NETWORK_INTERFACES : NETWORK_INTERFACES :
{ {
ENB_INTERFACE_NAME_FOR_S1_MME = "eth0"; 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_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 ENB_PORT_FOR_S1U = 2152; # Spec 2152
}; };
......
...@@ -127,7 +127,7 @@ extern volatile int start_UE; ...@@ -127,7 +127,7 @@ extern volatile int start_UE;
#endif #endif
extern volatile int oai_exit; 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_cond_t sync_cond;
extern pthread_mutex_t sync_mutex; extern pthread_mutex_t sync_mutex;
...@@ -920,7 +920,7 @@ static void* eNB_thread_prach( void* param ) { ...@@ -920,7 +920,7 @@ static void* eNB_thread_prach( void* param ) {
exit_fun("Error getting thread priority"); 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_FIFO) ? "SCHED_FIFO" :
(policy == SCHED_RR) ? "SCHED_RR" : (policy == SCHED_RR) ? "SCHED_RR" :
(policy == SCHED_OTHER) ? "SCHED_OTHER" : (policy == SCHED_OTHER) ? "SCHED_OTHER" :
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment