From ebb53665d95a95cd6776dff8724a3280e4fc5c59 Mon Sep 17 00:00:00 2001 From: khadraou Date: Wed, 20 Dec 2017 14:26:10 +0100 Subject: [PATCH 1/2] dealing with sync --- openair1/PHY/defs.h | 11 ++++++----- targets/RT/USER/lte-ru.c | 41 +++++++++++++++++++++++----------------- 2 files changed, 30 insertions(+), 22 deletions(-) diff --git a/openair1/PHY/defs.h b/openair1/PHY/defs.h index a841f5e294..fd3d913fd0 100644 --- a/openair1/PHY/defs.h +++ b/openair1/PHY/defs.h @@ -670,11 +670,12 @@ typedef enum { } RU_if_south_t; typedef enum { - RU_IDLE=0, - RU_CONFIG=1, - RU_READY=2, - RU_RUN=3, - RU_ERROR=4 + RU_IDLE = 0, + RU_CONFIG = 1, + RU_READY = 2, + RU_RUN = 3, + RU_ERROR = 4, + RU_SYNC = 5 } rru_state_t; typedef struct RU_t_s{ diff --git a/targets/RT/USER/lte-ru.c b/targets/RT/USER/lte-ru.c index d4c3da7750..e9a5bc01cc 100644 --- a/targets/RT/USER/lte-ru.c +++ b/targets/RT/USER/lte-ru.c @@ -1210,6 +1210,10 @@ void wakeup_eNBs(RU_t *ru) { pthread_mutex_lock(&proc->mutex_RU); for (i=0;inum_RU;i++) { + if (ru->state == RU_SYNC){ + proc->RU_mask |= (1<RU_list[i]) { //AssertFatal(((proc->RU_mask&(1<RU_mask&(1< 0) @@ -1582,25 +1586,26 @@ static void* ru_thread_control( void* param ) { exit(-1); } - ru->state = RU_RUN; + // Set state to RUN for Master RU, Others on SYNC + ru->state = (ru->is_slave == 1) ? RU_SYNC : RU_RUN ; - LOG_I(PHY, "Signaling main thread that RU %d is ready\n",ru->idx); - pthread_mutex_lock(&RC.ru_mutex); - RC.ru_mask &= ~(1<idx); - pthread_cond_signal(&RC.ru_cond); - pthread_mutex_unlock(&RC.ru_mutex); + LOG_I(PHY, "Signaling main thread that RU %d is ready\n",ru->idx); + pthread_mutex_lock(&RC.ru_mutex); + RC.ru_mask &= ~(1<idx); + pthread_cond_signal(&RC.ru_cond); + pthread_mutex_unlock(&RC.ru_mutex); - wait_sync("ru_thread"); + wait_sync("ru_thread"); // send start rru_config_msg.type = RRU_start; rru_config_msg.len = sizeof(RRU_CONFIG_msg_t); // TODO: set to correct msg len LOG_I(PHY,"Sending Start to RRU\n", ru->idx); - AssertFatal((ru->ifdevice.trx_ctlsend_func(&ru->ifdevice,&rru_config_msg,rru_config_msg.len)!=-1) ,"Failed to send msg to RU %d\n",ru->idx); + AssertFatal((ru->ifdevice.trx_ctlsend_func(&ru->ifdevice,&rru_config_msg,rru_config_msg.len)!=-1),"Failed to send msg to RU %d\n",ru->idx); - // TODO: Start ru_thread + proc->instance_cnt_ru = 1; if (pthread_cond_signal(&proc->cond_ru_thread) != 0) { LOG_E( PHY, "ERROR pthread_cond_signal for RU %d\n",ru->idx); @@ -1617,14 +1622,15 @@ static void* ru_thread_control( void* param ) { if (ru->state == RU_READY){ LOG_I(PHY, "Signaling main thread that RU %d is ready\n",ru->idx); - pthread_mutex_lock(&RC.ru_mutex); - RC.ru_mask &= ~(1<idx); - pthread_cond_signal(&RC.ru_cond); - pthread_mutex_unlock(&RC.ru_mutex); + pthread_mutex_lock(&RC.ru_mutex); + RC.ru_mask &= ~(1<idx); + pthread_cond_signal(&RC.ru_cond); + pthread_mutex_unlock(&RC.ru_mutex); - wait_sync("ru_thread"); - // TODO: Start ru_thread - ru->state = RU_RUN; + wait_sync("ru_thread"); + + ru->state = (ru->is_slave == 1) ? RU_SYNC : RU_RUN ; + proc->instance_cnt_ru = 1; if (pthread_cond_signal(&proc->cond_ru_thread) != 0) { LOG_E( PHY, "ERROR pthread_cond_signal for RU %d\n",ru->idx); @@ -1866,7 +1872,8 @@ void *ru_thread_synch(void *arg) { exit(-1); } */ - ru->in_synch=1; + ru->in_synch = 1; + ru->state = RU_SYNC; } // symc_pos > 0 else { write_output("ru_sync.m","sync",(void*)&sync_corr[0],fp->samples_per_tti*5,1,2); From 7fcb24e6d8d61bbd50a42116ca83c6b6544d36d8 Mon Sep 17 00:00:00 2001 From: khadraou Date: Wed, 20 Dec 2017 14:30:20 +0100 Subject: [PATCH 2/2] dealing with sync --- targets/RT/USER/lte-ru.c | 1 + 1 file changed, 1 insertion(+) diff --git a/targets/RT/USER/lte-ru.c b/targets/RT/USER/lte-ru.c index e9a5bc01cc..1c3f43cb29 100644 --- a/targets/RT/USER/lte-ru.c +++ b/targets/RT/USER/lte-ru.c @@ -1230,6 +1230,7 @@ void wakeup_eNBs(RU_t *ru) { pthread_mutex_unlock(&proc->mutex_RU); } + LOG_I(PHY,"wakeup eNB top for for subframe %d\n", ru->proc.subframe_rx); ru->eNB_top(eNB_list[0],ru->proc.frame_rx,ru->proc.subframe_rx,string); } else {