Commit f0e10b0d authored by Eurecom's avatar Eurecom

bug fix for shared info between threads

parent 3efaa383
...@@ -241,6 +241,9 @@ static void* tx_thread(void* param) { ...@@ -241,6 +241,9 @@ static void* tx_thread(void* param) {
pthread_mutex_lock(&eNB_proc->ru_proc->mutex_eNBs); pthread_mutex_lock(&eNB_proc->ru_proc->mutex_eNBs);
++eNB_proc->ru_proc->instance_cnt_eNBs; ++eNB_proc->ru_proc->instance_cnt_eNBs;
eNB_proc->ru_proc->timestamp_tx = proc->timestamp_tx;
eNB_proc->ru_proc->subframe_tx = proc->subframe_tx;
eNB_proc->ru_proc->frame_tx = proc->frame_tx;
pthread_cond_signal(&eNB_proc->ru_proc->cond_eNBs); pthread_cond_signal(&eNB_proc->ru_proc->cond_eNBs);
pthread_mutex_unlock(&eNB_proc->ru_proc->mutex_eNBs); pthread_mutex_unlock(&eNB_proc->ru_proc->mutex_eNBs);
} }
...@@ -369,7 +372,8 @@ int wakeup_tx(PHY_VARS_eNB *eNB,RU_proc_t *ru_proc) { ...@@ -369,7 +372,8 @@ int wakeup_tx(PHY_VARS_eNB *eNB,RU_proc_t *ru_proc) {
eNB_proc_t *proc=&eNB->proc; eNB_proc_t *proc=&eNB->proc;
eNB_rxtx_proc_t *proc_rxtx=&proc->proc_rxtx[1];//*proc_rxtx=&proc->proc_rxtx[proc->frame_rx&1]; eNB_rxtx_proc_t *proc_rxtx1=&proc->proc_rxtx[1];//*proc_rxtx=&proc->proc_rxtx[proc->frame_rx&1];
eNB_rxtx_proc_t *proc_rxtx0=&proc->proc_rxtx[0];
LTE_DL_FRAME_PARMS *fp = &eNB->frame_parms; LTE_DL_FRAME_PARMS *fp = &eNB->frame_parms;
...@@ -377,34 +381,34 @@ int wakeup_tx(PHY_VARS_eNB *eNB,RU_proc_t *ru_proc) { ...@@ -377,34 +381,34 @@ int wakeup_tx(PHY_VARS_eNB *eNB,RU_proc_t *ru_proc) {
wait.tv_sec=0; wait.tv_sec=0;
wait.tv_nsec=5000000L; wait.tv_nsec=5000000L;
if (proc_rxtx->instance_cnt_rxtx == 0) { if (proc_rxtx1->instance_cnt_rxtx == 0) {
LOG_E(PHY,"Frame %d, subframe %d: TX1 thread busy, dropping\n",proc_rxtx->frame_rx,proc_rxtx->subframe_rx); LOG_E(PHY,"Frame %d, subframe %d: TX1 thread busy, dropping\n",proc_rxtx1->frame_rx,proc_rxtx1->subframe_rx);
return(-1); return(-1);
} }
if (pthread_mutex_timedlock(&proc_rxtx->mutex_rxtx,&wait) != 0) { if (pthread_mutex_timedlock(&proc_rxtx1->mutex_rxtx,&wait) != 0) {
LOG_E( PHY, "[eNB] ERROR pthread_mutex_lock for eNB TX1 thread %d (IC %d)\n", proc_rxtx->subframe_rx&1,proc_rxtx->instance_cnt_rxtx ); LOG_E( PHY, "[eNB] ERROR pthread_mutex_lock for eNB TX1 thread %d (IC %d)\n", proc_rxtx1->subframe_rx&1,proc_rxtx1->instance_cnt_rxtx );
exit_fun( "error locking mutex_tx" ); exit_fun( "error locking mutex_tx" );
return(-1); return(-1);
} }
++proc_rxtx->instance_cnt_rxtx; ++proc_rxtx1->instance_cnt_rxtx;
proc_rxtx->subframe_rx = ru_proc->subframe_rx; proc_rxtx1->subframe_rx = proc_rxtx0->subframe_rx;
proc_rxtx->frame_rx = ru_proc->frame_rx; proc_rxtx1->frame_rx = proc_rxtx0->frame_rx;
proc_rxtx->subframe_tx = (ru_proc->subframe_rx+4)%10; proc_rxtx1->subframe_tx = proc_rxtx0->subframe_tx;
proc_rxtx->frame_tx = (ru_proc->subframe_rx>5) ? (1+ru_proc->frame_rx)&1023 : ru_proc->frame_rx; proc_rxtx1->frame_tx = proc_rxtx0->frame_tx;
proc_rxtx->timestamp_tx = ru_proc->timestamp_tx; proc_rxtx1->timestamp_tx = proc_rxtx0->timestamp_tx;
// the thread can now be woken up // the thread can now be woken up
if (pthread_cond_signal(&proc_rxtx->cond_rxtx) != 0) { if (pthread_cond_signal(&proc_rxtx1->cond_rxtx) != 0) {
LOG_E( PHY, "[eNB] ERROR pthread_cond_signal for eNB TXnp4 thread\n"); LOG_E( PHY, "[eNB] ERROR pthread_cond_signal for eNB TXnp4 thread\n");
exit_fun( "ERROR pthread_cond_signal" ); exit_fun( "ERROR pthread_cond_signal" );
return(-1); return(-1);
} }
pthread_mutex_unlock( &proc_rxtx->mutex_rxtx ); pthread_mutex_unlock( &proc_rxtx1->mutex_rxtx );
return(0); return(0);
} }
...@@ -486,7 +490,7 @@ int wakeup_rxtx(PHY_VARS_eNB *eNB,RU_t *ru) { ...@@ -486,7 +490,7 @@ int wakeup_rxtx(PHY_VARS_eNB *eNB,RU_t *ru) {
proc_rxtx->frame_tx = (ru_proc->subframe_rx>5) ? (1+ru_proc->frame_rx)&1023 : ru_proc->frame_rx; proc_rxtx->frame_tx = (ru_proc->subframe_rx>5) ? (1+ru_proc->frame_rx)&1023 : ru_proc->frame_rx;
proc->frame_tx = proc_rxtx->frame_tx; proc->frame_tx = proc_rxtx->frame_tx;
proc->frame_rx = proc_rxtx->frame_rx; proc->frame_rx = proc_rxtx->frame_rx;
proc_rxtx->timestamp_tx = ru_proc->timestamp_tx; proc_rxtx->timestamp_tx = ru_proc->timestamp_rx+(4*fp->samples_per_tti);
// the thread can now be woken up // the thread can now be woken up
if (pthread_cond_signal(&proc_rxtx->cond_rxtx) != 0) { if (pthread_cond_signal(&proc_rxtx->cond_rxtx) != 0) {
......
...@@ -761,9 +761,9 @@ void rx_rf(RU_t *ru,int *frame,int *subframe) { ...@@ -761,9 +761,9 @@ void rx_rf(RU_t *ru,int *frame,int *subframe) {
proc->subframe_rx = (proc->timestamp_rx / fp->samples_per_tti)%10; proc->subframe_rx = (proc->timestamp_rx / fp->samples_per_tti)%10;
// synchronize first reception to frame 0 subframe 0 // synchronize first reception to frame 0 subframe 0
proc->timestamp_tx = proc->timestamp_rx+(4*fp->samples_per_tti); //proc->timestamp_tx = proc->timestamp_rx+(4*fp->samples_per_tti);
proc->subframe_tx = (proc->subframe_rx+4)%10; //proc->subframe_tx = (proc->subframe_rx+4)%10;
proc->frame_tx = (proc->subframe_rx>5) ? (proc->frame_rx+1)&1023 : proc->frame_rx; //proc->frame_tx = (proc->subframe_rx>5) ? (proc->frame_rx+1)&1023 : proc->frame_rx;
LOG_D(PHY,"RU %d/%d TS %llu (off %d), frame %d, subframe %d\n", LOG_D(PHY,"RU %d/%d TS %llu (off %d), frame %d, subframe %d\n",
ru->idx, ru->idx,
......
...@@ -171,8 +171,6 @@ extern int16_t dlsch_demod_shift; ...@@ -171,8 +171,6 @@ extern int16_t dlsch_demod_shift;
{"S" , CONFIG_HLP_MSLOTS, PARAMFLAG_BOOL, u8ptr:&exit_missed_slots, defintval:1, TYPE_UINT8, 0}, \ {"S" , CONFIG_HLP_MSLOTS, PARAMFLAG_BOOL, u8ptr:&exit_missed_slots, defintval:1, TYPE_UINT8, 0}, \
{"T" , CONFIG_HLP_TDD, PARAMFLAG_BOOL, iptr:&tddflag, defintval:0, TYPE_INT, 0}, \ {"T" , CONFIG_HLP_TDD, PARAMFLAG_BOOL, iptr:&tddflag, defintval:0, TYPE_INT, 0}, \
{"numerology" , CONFIG_HLP_NUMEROLOGY, PARAMFLAG_BOOL, iptr:&numerology, defintval:0, TYPE_INT, 0} \ {"numerology" , CONFIG_HLP_NUMEROLOGY, PARAMFLAG_BOOL, iptr:&numerology, defintval:0, TYPE_INT, 0} \
//{"coding-worker-disable" , CONFIG_HLP_CODINGW, PARAMFLAG_BOOL, iptr:&codingw, defintval:0, TYPE_INT, 0}, \
//{"fep-worker-disable" , CONFIG_HLP_FEPW, PARAMFLAG_BOOL, iptr:&fepw, defintval:0, TYPE_INT, 0} \
} }
#define CONFIG_HLP_FLOG "Enable online log \n" #define CONFIG_HLP_FLOG "Enable online log \n"
......
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