diff --git a/openair1/PHY/LTE_TRANSPORT/dci.c b/openair1/PHY/LTE_TRANSPORT/dci.c index 1c015b1c84452beb7f0f9d0f3c3b0ec2fe43d51b..520488664d26289952564d1c1a75b15fbc8c01a0 100755 --- a/openair1/PHY/LTE_TRANSPORT/dci.c +++ b/openair1/PHY/LTE_TRANSPORT/dci.c @@ -346,6 +346,13 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols, y[0] = &yseq0[0]; y[1] = &yseq1[0]; +#if BASIC_SIMULATOR + /* this should be the normal case + * but it has to be validated for all the various cases + * so let's just do it for the basic simulator + */ + memset(e, 2, DCI_BITS_MAX); +#else #if 1 // reset all bits to <NIL>, here we set <NIL> elements as 2 // memset(e, 2, DCI_BITS_MAX); @@ -358,6 +365,7 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols, * (not sure about this, to be checked somehow) */ //memset(e, 0, DCI_BITS_MAX); +#endif /* BASIC_SIMULATOR */ e_ptr = e; diff --git a/targets/ARCH/tcp_bridge/tcp_bridge_oai.c b/targets/ARCH/tcp_bridge/tcp_bridge_oai.c index ba6d96db93372c3407d0d1c41ff666e3a2a85606..4d7d49d9c7836c800430afc56d033a9fb8a921cd 100644 --- a/targets/ARCH/tcp_bridge/tcp_bridge_oai.c +++ b/targets/ARCH/tcp_bridge/tcp_bridge_oai.c @@ -253,7 +253,7 @@ int tcp_bridge_ue_first_read(openair0_device *device, openair0_timestamp *timest tcp_bridge_state_t *t = device->priv; uint32_t b[t->samples_per_subframe * 12]; - memset(b, 0, nsamps * 4); + memset(b, 0, t->samples_per_subframe * 12 * 4); int n = fullwrite(t->sock, b, t->samples_per_subframe * 12 * 4); if (n != t->samples_per_subframe * 12 * 4) { printf("tcp_bridge: write error ret %d error %s\n", n, strerror(errno)); diff --git a/targets/RT/USER/lte-ue.c b/targets/RT/USER/lte-ue.c index ab84249f9fe660bf0af91c6434396f4519da00dd..66107d79a42c5e88b613451c1c5f4458ea2c48d4 100644 --- a/targets/RT/USER/lte-ue.c +++ b/targets/RT/USER/lte-ue.c @@ -446,7 +446,6 @@ static void *UE_thread_synch(void *arg) int freq_offset=0; char threadname[128]; - UE->is_synchronized = 0; printf("UE_thread_sync in with PHY_vars_UE %p\n",arg); cpu_set_t cpuset; @@ -522,11 +521,6 @@ static void *UE_thread_synch(void *arg) printf("Started device, unlocked sync_mutex (UE_sync_thread)\n"); - if (UE->rfdevice.trx_start_func(&UE->rfdevice) != 0 ) { - LOG_E(HW,"Could not start the device\n"); - oai_exit=1; - } - while (oai_exit==0) { AssertFatal ( 0== pthread_mutex_lock(&UE->proc.mutex_synch), ""); while (UE->proc.instance_cnt_synch < 0) @@ -755,7 +749,6 @@ static void *UE_thread_rxn_txnp4(void *arg) { UE_rxtx_proc_t *proc = rtd->proc; PHY_VARS_UE *UE = rtd->UE; - proc->instance_cnt_rxtx=-1; proc->subframe_rx=proc->sub_frame_start; char threadname[256]; @@ -1457,20 +1450,25 @@ void *UE_thread(void *arg) { int sub_frame=-1; //int cumulated_shift=0; + if (UE->rfdevice.trx_start_func(&UE->rfdevice) != 0 ) { + LOG_E(HW,"Could not start the device\n"); + oai_exit=1; + } while (!oai_exit) { +#if BASIC_SIMULATOR + while (!(UE->proc.instance_cnt_synch < 0)) { + printf("ue sync not ready\n"); + usleep(500*1000); + } +#endif + AssertFatal ( 0== pthread_mutex_lock(&UE->proc.mutex_synch), ""); int instance_cnt_synch = UE->proc.instance_cnt_synch; int is_synchronized = UE->is_synchronized; AssertFatal ( 0== pthread_mutex_unlock(&UE->proc.mutex_synch), ""); if (is_synchronized == 0) { -#if BASIC_SIMULATOR - while (!((instance_cnt_synch = UE->proc.instance_cnt_synch) < 0)) { - printf("ue sync not ready\n"); - usleep(500*1000); - } -#endif if (instance_cnt_synch < 0) { // we can invoke the synch // grab 10 ms of signal and wakeup synch thread for (int i=0; i<UE->frame_parms.nb_antennas_rx; i++) @@ -1661,12 +1659,7 @@ void *UE_thread(void *arg) { proc->instance_cnt_rxtx++; LOG_D( PHY, "[SCHED][UE %d] UE RX instance_cnt_rxtx %d subframe %d !!\n", UE->Mod_id, proc->instance_cnt_rxtx,proc->subframe_rx); - if (proc->instance_cnt_rxtx == 0) { - if (pthread_cond_signal(&proc->cond_rxtx) != 0) { - LOG_E( PHY, "[SCHED][UE %d] ERROR pthread_cond_signal for UE RX thread\n", UE->Mod_id); - exit_fun("nothing to add"); - } - } else { + if (proc->instance_cnt_rxtx != 0) { LOG_E( PHY, "[SCHED][UE %d] UE RX thread busy (IC %d)!!\n", UE->Mod_id, proc->instance_cnt_rxtx); if (proc->instance_cnt_rxtx > 2) exit_fun("instance_cnt_rxtx > 2"); @@ -1717,6 +1710,8 @@ void init_UE_threads(int inst) { pthread_mutex_init(&UE->proc.mutex_synch,NULL); pthread_cond_init(&UE->proc.cond_synch,NULL); + UE->proc.instance_cnt_synch = -1; + UE->is_synchronized = 0; // the threads are not yet active, therefore access is allowed without locking int nb_threads=RX_NB_TH; @@ -1728,6 +1723,7 @@ void init_UE_threads(int inst) { pthread_mutex_init(&UE->proc.proc_rxtx[i].mutex_rxtx,NULL); pthread_cond_init(&UE->proc.proc_rxtx[i].cond_rxtx,NULL); + UE->proc.proc_rxtx[i].instance_cnt_rxtx = -1; UE->proc.proc_rxtx[i].sub_frame_start=i; UE->proc.proc_rxtx[i].sub_frame_step=nb_threads; printf("Init_UE_threads rtd %d proc %d nb_threads %d i %d\n",rtd->proc->sub_frame_start, UE->proc.proc_rxtx[i].sub_frame_start,nb_threads, i);