Commit ebb53665 authored by khadraou's avatar khadraou

dealing with sync

parent efabb8b6
...@@ -670,11 +670,12 @@ typedef enum { ...@@ -670,11 +670,12 @@ typedef enum {
} RU_if_south_t; } RU_if_south_t;
typedef enum { typedef enum {
RU_IDLE=0, RU_IDLE = 0,
RU_CONFIG=1, RU_CONFIG = 1,
RU_READY=2, RU_READY = 2,
RU_RUN=3, RU_RUN = 3,
RU_ERROR=4 RU_ERROR = 4,
RU_SYNC = 5
} rru_state_t; } rru_state_t;
typedef struct RU_t_s{ typedef struct RU_t_s{
......
...@@ -1210,6 +1210,10 @@ void wakeup_eNBs(RU_t *ru) { ...@@ -1210,6 +1210,10 @@ void wakeup_eNBs(RU_t *ru) {
pthread_mutex_lock(&proc->mutex_RU); pthread_mutex_lock(&proc->mutex_RU);
for (i=0;i<eNB->num_RU;i++) { for (i=0;i<eNB->num_RU;i++) {
if (ru->state == RU_SYNC){
proc->RU_mask |= (1<<i);
break;
}
if (ru == eNB->RU_list[i]) { if (ru == eNB->RU_list[i]) {
//AssertFatal(((proc->RU_mask&(1<<i)) == 0) , //AssertFatal(((proc->RU_mask&(1<<i)) == 0) ,
if ((proc->RU_mask&(1<<i)) > 0) if ((proc->RU_mask&(1<<i)) > 0)
...@@ -1582,7 +1586,8 @@ static void* ru_thread_control( void* param ) { ...@@ -1582,7 +1586,8 @@ static void* ru_thread_control( void* param ) {
exit(-1); 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); LOG_I(PHY, "Signaling main thread that RU %d is ready\n",ru->idx);
...@@ -1598,9 +1603,9 @@ static void* ru_thread_control( void* param ) { ...@@ -1598,9 +1603,9 @@ static void* ru_thread_control( void* param ) {
rru_config_msg.len = sizeof(RRU_CONFIG_msg_t); // TODO: set to correct msg len 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); 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; proc->instance_cnt_ru = 1;
if (pthread_cond_signal(&proc->cond_ru_thread) != 0) { if (pthread_cond_signal(&proc->cond_ru_thread) != 0) {
LOG_E( PHY, "ERROR pthread_cond_signal for RU %d\n",ru->idx); LOG_E( PHY, "ERROR pthread_cond_signal for RU %d\n",ru->idx);
...@@ -1623,8 +1628,9 @@ static void* ru_thread_control( void* param ) { ...@@ -1623,8 +1628,9 @@ static void* ru_thread_control( void* param ) {
pthread_mutex_unlock(&RC.ru_mutex); pthread_mutex_unlock(&RC.ru_mutex);
wait_sync("ru_thread"); wait_sync("ru_thread");
// TODO: Start ru_thread
ru->state = RU_RUN; ru->state = (ru->is_slave == 1) ? RU_SYNC : RU_RUN ;
proc->instance_cnt_ru = 1; proc->instance_cnt_ru = 1;
if (pthread_cond_signal(&proc->cond_ru_thread) != 0) { if (pthread_cond_signal(&proc->cond_ru_thread) != 0) {
LOG_E( PHY, "ERROR pthread_cond_signal for RU %d\n",ru->idx); LOG_E( PHY, "ERROR pthread_cond_signal for RU %d\n",ru->idx);
...@@ -1866,7 +1872,8 @@ void *ru_thread_synch(void *arg) { ...@@ -1866,7 +1872,8 @@ void *ru_thread_synch(void *arg) {
exit(-1); exit(-1);
} }
*/ */
ru->in_synch=1; ru->in_synch = 1;
ru->state = RU_SYNC;
} // symc_pos > 0 } // symc_pos > 0
else { else {
write_output("ru_sync.m","sync",(void*)&sync_corr[0],fp->samples_per_tti*5,1,2); write_output("ru_sync.m","sync",(void*)&sync_corr[0],fp->samples_per_tti*5,1,2);
......
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