Commit 8273680d authored by Wang Tsu-Han's avatar Wang Tsu-Han

bug fix for initialization

parent aa232879
......@@ -3004,10 +3004,7 @@ int RCconfig_nr_parallel(void) {
}
if(parallel_config == NULL) set_parallel_conf(parallel_conf);
if(parallel_config == NULL)printf("~~~~~~~~~~~~~~~~~~~~parallel_conf = %s\n",parallel_conf);
if(worker_config == NULL) set_worker_conf(worker_conf);
if(worker_config == NULL)printf("~~~~~~~~~~~~~~~~~~~~worker_conf = %s\n",worker_conf);
return 0;
}
......
......@@ -287,15 +287,15 @@ static inline int rxtx(PHY_VARS_gNB *gNB,gNB_L1_rxtx_proc_t *proc, char *thread_
static void* gNB_L1_thread_tx(void* param) {
gNB_L1_proc_t *gNB_proc = (gNB_L1_proc_t*)param;
PHY_VARS_gNB *gNB = (PHY_VARS_gNB*)param;
gNB_L1_proc_t *gNB_proc = &gNB->proc;
gNB_L1_rxtx_proc_t *proc = &gNB_proc->L1_proc_tx;
PHY_VARS_gNB *gNB = RC.gNB[0][proc->CC_id];
//PHY_VARS_gNB *gNB = RC.gNB[0][proc->CC_id];
printf("~~~~~~~~~~~~~~~~~~~~gNB_L1_thread_tx is created\n");
char thread_name[100];
sprintf(thread_name,"TXnp4_%d\n",&gNB->proc.L1_proc == proc ? 0 : 1);
thread_top_init(thread_name,1,470000,500000,500000);
//thread_top_init(thread_name,1,470000,500000,500000);
//wait_sync("tx_thread");
......@@ -341,21 +341,22 @@ printf("~~~~~~~~~~~~~~~~~~~~gNB_L1_thread_tx is created\n");
static void* gNB_L1_thread( void* param ) {
static int gNB_thread_rxtx_status;
gNB_L1_proc_t *gNB_proc = (gNB_L1_proc_t*)param;
PHY_VARS_gNB *gNB = (PHY_VARS_gNB*)param;
gNB_L1_proc_t *gNB_proc = &gNB->proc;
gNB_L1_rxtx_proc_t *proc = &gNB_proc->L1_proc;
PHY_VARS_gNB *gNB = RC.gNB[0][proc->CC_id];
//PHY_VARS_gNB *gNB = RC.gNB[0][proc->CC_id];
printf("~~~~~~~~~~~~~~~~~~~~gNB_L1_thread_tx is created\n");
char thread_name[100];
// set default return value
gNB_thread_rxtx_status = 0;
sprintf(thread_name,"RXn_TXnp4_%d",&gNB->proc.L1_proc == proc ? 0 : 1);
thread_top_init(thread_name,1,850000L,1000000L,2000000L);
//thread_top_init(thread_name,1,850000L,1000000L,2000000L);
while (!oai_exit) {
......@@ -454,7 +455,7 @@ int wakeup_txfh(gNB_L1_rxtx_proc_t *proc,PHY_VARS_gNB *gNB) {
struct timespec wait;
wait.tv_sec=0;
wait.tv_nsec=5000000L;
//printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~inside wakeup_txfh %d.%d IC_RU = %d\n", proc->frame_tx, proc->subframe_tx, proc->instance_cnt_RUs);
printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~inside wakeup_txfh %d.%d IC_RU = %d\n", proc->frame_tx, proc->subframe_tx, proc->instance_cnt_RUs);
if(wait_on_condition(&proc->mutex_RUs,&proc->cond_RUs,&proc->instance_cnt_RUs,"wakeup_txfh")<0) {
LOG_E(PHY,"Frame %d, subframe %d: TX FH not ready\n", proc->frame_tx, proc->subframe_tx);
......@@ -607,6 +608,8 @@ int wakeup_rxtx(PHY_VARS_gNB *gNB,RU_t *ru) {
L1_proc->frame_tx = (L1_proc->subframe_rx > (9-sf_ahead)) ? (L1_proc->frame_rx+1)&1023 : L1_proc->frame_rx;
L1_proc->subframe_tx = (L1_proc->subframe_rx + sf_ahead)%10;
printf("~~~~~~~~~~~~~~~~~~~~~~passing parameter IC = %d, RX: %d.%d, TX: %d.%d to L1 sf_ahead = %d\n", L1_proc->instance_cnt, L1_proc->frame_rx, L1_proc->subframe_rx, L1_proc->frame_tx, L1_proc->subframe_tx, sf_ahead);
// the thread can now be woken up
if (pthread_cond_signal(&L1_proc->cond) != 0) {
LOG_E( PHY, "[gNB] ERROR pthread_cond_signal for gNB RXn-TXnp4 thread\n");
......@@ -785,11 +788,9 @@ void init_gNB_proc(int inst) {
LOG_I(PHY,"gNB->single_thread_flag:%d\n", gNB->single_thread_flag);
printf("~~~~~~~~~~~~~~~~~~~thread_parallel = %d",get_thread_parallel_conf());
if (get_thread_parallel_conf() == PARALLEL_RU_L1_SPLIT || get_thread_parallel_conf() == PARALLEL_RU_L1_TRX_SPLIT) {
printf("~~~~~~~~~~~~~~~~~~~~~~~creating gNB_L1_thread and gNB_L1_thread_tx \n");
pthread_create( &L1_proc->pthread, attr0, gNB_L1_thread, proc );
pthread_create( &L1_proc_tx->pthread, attr1, gNB_L1_thread_tx, proc);
pthread_create( &L1_proc->pthread, attr0, gNB_L1_thread, gNB );
pthread_create( &L1_proc_tx->pthread, attr1, gNB_L1_thread_tx, gNB);
}
//pthread_create( &proc->pthread_prach, attr_prach, gNB_thread_prach, gNB );
......@@ -1064,7 +1065,6 @@ void init_eNB_afterRU(void) {
//init_transport(gNB);
//init_precoding_weights(RC.gNB[inst][CC_id]);
}
printf("~~~~~~~~~~~~~~~~~~~~~~~start init gNB proc\n");
init_gNB_proc(inst);
}
......
......@@ -1141,7 +1141,7 @@ void wakeup_gNB_L1s(RU_t *ru) {
LOG_D(PHY,"wakeup_gNB_L1s (num %d) for RU %d ru->gNB_top:%p\n",ru->num_gNB,ru->idx, ru->gNB_top);
if (ru->num_gNB==1 && ru->gNB_top!=0) {
if (ru->num_gNB==1 && ru->gNB_top!=0 && get_thread_parallel_conf() == PARALLEL_SINGLE_THREAD) {
// call gNB function directly
char string[20];
......@@ -1156,7 +1156,6 @@ void wakeup_gNB_L1s(RU_t *ru) {
for (i=0;i<ru->num_gNB;i++)
{
LOG_D(PHY,"ru->wakeup_rxtx:%p\n", ru->nr_wakeup_rxtx);
if (ru->nr_wakeup_rxtx!=0 && ru->nr_wakeup_rxtx(gNB_list[i],ru) < 0)
{
LOG_E(PHY,"could not wakeup gNB rxtx process for subframe %d\n", ru->proc.subframe_rx);
......@@ -1429,7 +1428,7 @@ static void* ru_thread_tx( void* param ) {
}
else
{
/*if(proc->frame_tx == print_frame)
if(proc->frame_tx == print_frame)
{
for (i=0; i<ru->nb_tx; i++)
{
......@@ -1453,7 +1452,7 @@ static void* ru_thread_tx( void* param ) {
}
}//if(proc->subframe_tx == 9)
}//for (i=0; i<ru->nb_tx; i++)
}//if(proc->frame_tx == print_frame)*/
}//if(proc->frame_tx == print_frame)
}//else emulate_rf
release_thread(&proc->mutex_gNBs,&proc->instance_cnt_gNBs,"ru_thread_tx");
for(i = 0; i<ru->num_gNB; i++)
......@@ -1555,11 +1554,6 @@ static void* ru_thread( void* param ) {
pthread_cond_signal(&RC.ru_cond);
pthread_mutex_unlock(&RC.ru_mutex);
pthread_mutex_lock(&proc->mutex_FH1);
proc->instance_cnt_FH1 = 0;
pthread_mutex_unlock(&proc->mutex_FH1);
pthread_cond_signal(&proc->cond_FH1);
wait_sync("ru_thread");
if(!emulate_rf){
......@@ -1587,6 +1581,10 @@ static void* ru_thread( void* param ) {
if ((ru->is_slave) && (ru->if_south == LOCAL_RF)) do_ru_synch(ru);
}
pthread_mutex_lock(&proc->mutex_FH1);
proc->instance_cnt_FH1 = 0;
pthread_mutex_unlock(&proc->mutex_FH1);
pthread_cond_signal(&proc->cond_FH1);
// This is a forever while loop, it loops over subframes which are scheduled by incoming samples from HW devices
while (!oai_exit) {
......@@ -1830,6 +1828,7 @@ void init_RU_proc(RU_t *ru) {
proc->instance_cnt_synch = -1; ;
proc->instance_cnt_FH = -1;
proc->instance_cnt_FH1 = -1;
proc->instance_cnt_gNBs = -1;
proc->instance_cnt_asynch_rxtx = -1;
proc->instance_cnt_emulateRF = -1;
proc->first_rx = 1;
......
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