Commit 470c664f authored by magounak's avatar magounak

Changes after the merge with L1_renaming in order to work at least in FDD...

Changes after the merge with L1_renaming in order to work at least in FDD mode. We need to handle the RU_mask_tx for TDD mode.
parent 5ac4ced1
...@@ -86,6 +86,7 @@ const char* eurecomVariablesNames[] = { ...@@ -86,6 +86,7 @@ const char* eurecomVariablesNames[] = {
"frame_number_if4p5_south_out", "frame_number_if4p5_south_out",
"subframe_number_if4p5_south_in", "subframe_number_if4p5_south_in",
"frame_number_if4p5_south_in", "frame_number_if4p5_south_in",
"ic_enb",
"runtime_TX_eNB", "runtime_TX_eNB",
"runtime_RX_eNB", "runtime_RX_eNB",
"frame_number_TX0_UE", "frame_number_TX0_UE",
......
...@@ -63,6 +63,7 @@ typedef enum { ...@@ -63,6 +63,7 @@ typedef enum {
VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_IF4P5_SOUTH_OUT, VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_IF4P5_SOUTH_OUT,
VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_IF4P5_SOUTH_IN, VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_IF4P5_SOUTH_IN,
VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_IF4P5_SOUTH_IN, VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_IF4P5_SOUTH_IN,
VCD_SIGNAL_DUMPER_VARIABLES_IC_ENB,
VCD_SIGNAL_DUMPER_VARIABLES_RUNTIME_TX_ENB, VCD_SIGNAL_DUMPER_VARIABLES_RUNTIME_TX_ENB,
VCD_SIGNAL_DUMPER_VARIABLES_RUNTIME_RX_ENB, VCD_SIGNAL_DUMPER_VARIABLES_RUNTIME_RX_ENB,
VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX0_UE, VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX0_UE,
......
...@@ -44,7 +44,7 @@ typedef struct { ...@@ -44,7 +44,7 @@ typedef struct {
#define VCD_NUM_FUNCTIONS (218) #define VCD_NUM_FUNCTIONS (218)
/* number of VCD variables (to be kept up to date! see in T_messages.txt) */ /* number of VCD variables (to be kept up to date! see in T_messages.txt) */
#define VCD_NUM_VARIABLES (136)/*(128)*/ #define VCD_NUM_VARIABLES (137) /*(136)*//*(128)*/
/* first VCD function (to be kept up to date! see in T_messages.txt) */ /* first VCD function (to be kept up to date! see in T_messages.txt) */
#define VCD_FIRST_FUNCTION ((uintptr_t)T_VCD_FUNCTION_RT_SLEEP) #define VCD_FIRST_FUNCTION ((uintptr_t)T_VCD_FUNCTION_RT_SLEEP)
......
...@@ -1071,6 +1071,11 @@ ID = VCD_VARIABLE_FRAME_NUMBER_IF4P5_SOUTH_IN ...@@ -1071,6 +1071,11 @@ ID = VCD_VARIABLE_FRAME_NUMBER_IF4P5_SOUTH_IN
GROUP = ALL:VCD:ENB:VCD_VARIABLE GROUP = ALL:VCD:ENB:VCD_VARIABLE
FORMAT = ulong,value FORMAT = ulong,value
VCD_NAME = frame_number_if4p5_south_in VCD_NAME = frame_number_if4p5_south_in
ID = VCD_VARIABLE_IC_ENB
DESC = VCD variable IC_ENB
GROUP = ALL:VCD:ENB:VCD_VARIABLE
FORMAT = ulong,value
VCD_NAME = ic_enb
ID = VCD_VARIABLE_RUNTIME_TX_ENB ID = VCD_VARIABLE_RUNTIME_TX_ENB
DESC = VCD variable RUNTIME_TX_ENB DESC = VCD variable RUNTIME_TX_ENB
GROUP = ALL:VCD:ENB:VCD_VARIABLE GROUP = ALL:VCD:ENB:VCD_VARIABLE
......
...@@ -335,7 +335,6 @@ static void* L1_thread_tx(void* param) { ...@@ -335,7 +335,6 @@ static void* L1_thread_tx(void* param) {
L1_proc_t *eNB_proc = (L1_proc_t*)param; L1_proc_t *eNB_proc = (L1_proc_t*)param;
L1_rxtx_proc_t *proc = &eNB_proc->L1_proc_tx; L1_rxtx_proc_t *proc = &eNB_proc->L1_proc_tx;
PHY_VARS_eNB *eNB = RC.eNB[0][proc->CC_id]; PHY_VARS_eNB *eNB = RC.eNB[0][proc->CC_id];
LOG_I(PHY,"ENTERED L1_thread_tx\n");
char thread_name[100]; char thread_name[100];
sprintf(thread_name,"TXnp4_%d\n",&eNB->proc.L1_proc == proc ? 0 : 1); sprintf(thread_name,"TXnp4_%d\n",&eNB->proc.L1_proc == proc ? 0 : 1);
thread_top_init(thread_name,1,470000,500000,500000); thread_top_init(thread_name,1,470000,500000,500000);
...@@ -381,9 +380,7 @@ static void* L1_thread_tx(void* param) { ...@@ -381,9 +380,7 @@ static void* L1_thread_tx(void* param) {
static void* L1_thread( void* param ) { static void* L1_thread( void* param ) {
static int eNB_thread_rxtx_status; static int eNB_thread_rxtx_status;
//L1_proc_t *eNB_proc = (L1_proc_t*)param;
L1_rxtx_proc_t *proc; L1_rxtx_proc_t *proc;
LOG_I(PHY,"ENTERED L1_thread\n");
// Working // Working
if(nfapi_mode ==2){ if(nfapi_mode ==2){
proc = (L1_rxtx_proc_t*)param; proc = (L1_rxtx_proc_t*)param;
...@@ -491,9 +488,8 @@ int wakeup_txfh(L1_rxtx_proc_t *proc,PHY_VARS_eNB *eNB) { ...@@ -491,9 +488,8 @@ int wakeup_txfh(L1_rxtx_proc_t *proc,PHY_VARS_eNB *eNB) {
wait.tv_sec=0; wait.tv_sec=0;
wait.tv_nsec=5000000L; wait.tv_nsec=5000000L;
LTE_DL_FRAME_PARMS *fp; LTE_DL_FRAME_PARMS *fp;
LOG_I(PHY,"ENTERED wakeup_txfh\n");
printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~inside wakeup_txfh %d.%d IC_RU = %d\n", proc->frame_tx, proc->subframe_tx, proc->instance_cnt_RUs); LOG_I(PHY,"Entered 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) { 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); LOG_E(PHY,"Frame %d, subframe %d: TX FH not ready\n", proc->frame_tx, proc->subframe_tx);
return(-1); return(-1);
...@@ -506,11 +502,16 @@ int wakeup_txfh(L1_rxtx_proc_t *proc,PHY_VARS_eNB *eNB) { ...@@ -506,11 +502,16 @@ int wakeup_txfh(L1_rxtx_proc_t *proc,PHY_VARS_eNB *eNB) {
for(int ru_id=0; ru_id<eNB->num_RU; ru_id++){ for(int ru_id=0; ru_id<eNB->num_RU; ru_id++){
ru_proc = &eNB->RU_list[ru_id]->proc; ru_proc = &eNB->RU_list[ru_id]->proc;
fp = &eNB->RU_list[ru_id]->frame_parms; fp = &eNB->RU_list[ru_id]->frame_parms;
if ((fp->frame_type == TDD) && (subframe_select(fp,proc->subframe_tx)==SF_UL)) continue; if ((fp->frame_type == TDD) && (subframe_select(fp,proc->subframe_tx)==SF_UL)){
pthread_mutex_lock(&proc->mutex_RUs);
proc->instance_cnt_RUs = 0;
pthread_mutex_unlock(&proc->mutex_RUs);
continue;//hacking only works when all RU_tx works on the same subframe #TODO: adding mask stuff
}
// skip the RUs that are not synced // skip the RUs that are not synced
if (eNB->RU_list[ru_id]->state == RU_SYNC) { LOG_D(PHY,"wakeup_txfh: eNB %d : Skipping ru %d\n",eNB->Mod_id,ru_id); continue; } if (eNB->RU_list[ru_id]->state == RU_SYNC) { LOG_D(PHY,"wakeup_txfh: eNB %d : Skipping ru %d\n",eNB->Mod_id,ru_id); continue; }
if(ru_proc == NULL) {return(0);} //if(ru_proc == NULL) {return(0);}
if (ru_proc->instance_cnt_eNBs == 0) { if (ru_proc->instance_cnt_eNBs == 0) {
LOG_E(PHY,"Frame %d, subframe %d: TX FH thread busy, dropping Frame %d, subframe %d\n", ru_proc->frame_tx, ru_proc->subframe_tx, proc->frame_rx, proc->subframe_rx); LOG_E(PHY,"Frame %d, subframe %d: TX FH thread busy, dropping Frame %d, subframe %d\n", ru_proc->frame_tx, ru_proc->subframe_tx, proc->frame_rx, proc->subframe_rx);
...@@ -521,12 +522,13 @@ int wakeup_txfh(L1_rxtx_proc_t *proc,PHY_VARS_eNB *eNB) { ...@@ -521,12 +522,13 @@ int wakeup_txfh(L1_rxtx_proc_t *proc,PHY_VARS_eNB *eNB) {
exit_fun( "error locking mutex_eNB" ); exit_fun( "error locking mutex_eNB" );
return(-1); return(-1);
} }
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_IC_ENB,ru_proc->instance_cnt_eNBs);
ru_proc->instance_cnt_eNBs = 0; ru_proc->instance_cnt_eNBs = 0;
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_IC_ENB,ru_proc->instance_cnt_eNBs);
ru_proc->timestamp_tx = proc->timestamp_tx; ru_proc->timestamp_tx = proc->timestamp_tx;
ru_proc->subframe_tx = proc->subframe_tx; ru_proc->subframe_tx = proc->subframe_tx;
ru_proc->frame_tx = proc->frame_tx; ru_proc->frame_tx = proc->frame_tx;
LOG_I(PHY,"wakeup_txfh: ru_proc->subframe_tx %d\n",ru_proc->subframe_tx);
// the thread can now be woken up // the thread can now be woken up
if (pthread_cond_signal(&ru_proc->cond_eNBs) != 0) { if (pthread_cond_signal(&ru_proc->cond_eNBs) != 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");
...@@ -541,9 +543,9 @@ int wakeup_txfh(L1_rxtx_proc_t *proc,PHY_VARS_eNB *eNB) { ...@@ -541,9 +543,9 @@ int wakeup_txfh(L1_rxtx_proc_t *proc,PHY_VARS_eNB *eNB) {
int wakeup_tx(PHY_VARS_eNB *eNB) { int wakeup_tx(PHY_VARS_eNB *eNB) {
L1_proc_t *proc=&eNB->proc; L1_proc_t *proc=&eNB->proc;
/* LTE_DL_FRAME_PARMS *fp; /* LTE_DL_FRAME_PARMS *fp;
fp = &eNB->frame_parms; fp = &eNB->frame_parms;
if ((fp->frame_type == TDD) && (subframe_select(fp,proc_rxtx0->subframe_tx)==SF_UL)) return; if ((fp->frame_type == TDD) && (subframe_select(fp,proc_rxtx0->subframe_tx)==SF_UL)) return;
*/ */
L1_rxtx_proc_t *L1_proc_tx = &proc->L1_proc_tx; L1_rxtx_proc_t *L1_proc_tx = &proc->L1_proc_tx;
L1_rxtx_proc_t *L1_proc = &proc->L1_proc; L1_rxtx_proc_t *L1_proc = &proc->L1_proc;
...@@ -625,7 +627,7 @@ int wakeup_rxtx(PHY_VARS_eNB *eNB,RU_t *ru) { ...@@ -625,7 +627,7 @@ int wakeup_rxtx(PHY_VARS_eNB *eNB,RU_t *ru) {
L1_proc->subframe_rx = ru_proc->subframe_rx; L1_proc->subframe_rx = ru_proc->subframe_rx;
L1_proc->frame_tx = (L1_proc->subframe_rx > (9-sf_ahead)) ? (L1_proc->frame_rx+1)&1023 : L1_proc->frame_rx; 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; L1_proc->subframe_tx = (L1_proc->subframe_rx + sf_ahead)%10;
LOG_I(PHY,"wakeup_rxtx: L1_proc->subframe_rx %d, L1_proc->subframe_tx %d\n",L1_proc->subframe_rx,L1_proc->subframe_tx);
// the thread can now be woken up // the thread can now be woken up
if (pthread_cond_signal(&L1_proc->cond) != 0) { if (pthread_cond_signal(&L1_proc->cond) != 0) {
LOG_E( PHY, "[eNB] ERROR pthread_cond_signal for eNB RXn-TXnp4 thread\n"); LOG_E( PHY, "[eNB] ERROR pthread_cond_signal for eNB RXn-TXnp4 thread\n");
......
...@@ -1144,11 +1144,9 @@ void wakeup_L1s(RU_t *ru) { ...@@ -1144,11 +1144,9 @@ void wakeup_L1s(RU_t *ru) {
L1_proc_t *proc = &eNB->proc; L1_proc_t *proc = &eNB->proc;
RU_proc_t *ruproc = &ru->proc; RU_proc_t *ruproc = &ru->proc;
struct timespec t; struct timespec t;
LOG_D(PHY,"wakeup_eNBs (num %d) for RU %d (state %s)ru->eNB_top:%p\n",ru->num_eNB,ru->idx, ru_states[ru->state],ru->eNB_top);
LOG_I(PHY,"wakeup_L1s (num %d) for RU %d ru->eNB_top:%p\n",ru->num_eNB,ru->idx, ru->eNB_top); LOG_I(PHY,"wakeup_L1s (num %d) for RU %d ru->eNB_top:%p\n",ru->num_eNB,ru->idx, ru->eNB_top);
// call eNB function directly // call eNB function directly
char string[20]; char string[20];
...@@ -1217,20 +1215,20 @@ void wakeup_L1s(RU_t *ru) { ...@@ -1217,20 +1215,20 @@ void wakeup_L1s(RU_t *ru) {
} }
} }
} }
AssertFatal(0==pthread_mutex_lock(&ruproc->mutex_eNBs),""); /* AssertFatal(0==pthread_mutex_lock(&ruproc->mutex_eNBs),"");
LOG_D(PHY,"RU %d sending signal to unlock waiting ru_threads\n", ru->idx); LOG_D(PHY,"RU %d sending signal to unlock waiting ru_threads\n", ru->idx);
AssertFatal(0==pthread_cond_broadcast(&ruproc->cond_eNBs),""); AssertFatal(0==pthread_cond_broadcast(&ruproc->cond_eNBs),"");
if (ruproc->instance_cnt_eNBs==-1) ruproc->instance_cnt_eNBs++; if (ruproc->instance_cnt_eNBs==-1) ruproc->instance_cnt_eNBs++;
AssertFatal(0==pthread_mutex_unlock(&ruproc->mutex_eNBs),""); AssertFatal(0==pthread_mutex_unlock(&ruproc->mutex_eNBs),"");
*/
} }
else /*else
AssertFatal(0==pthread_mutex_unlock(&proc->mutex_RU),""); AssertFatal(0==pthread_mutex_unlock(&proc->mutex_RU),"");
// pthread_mutex_unlock(&proc->mutex_RU); // pthread_mutex_unlock(&proc->mutex_RU);
// LOG_D(PHY,"wakeup eNB top for for subframe %d\n", ru->proc.subframe_rx); // LOG_D(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); // ru->eNB_top(eNB_list[0],ru->proc.frame_rx,ru->proc.subframe_rx,string);
*/
ru->proc.emulate_rf_busy = 0; ru->proc.emulate_rf_busy = 0;
} }
...@@ -1502,7 +1500,7 @@ static void* ru_thread_tx( void* param ) { ...@@ -1502,7 +1500,7 @@ static void* ru_thread_tx( void* param ) {
//wait_sync("ru_thread_tx"); //wait_sync("ru_thread_tx");
wait_on_condition(&proc->mutex_FH1,&proc->cond_FH1,&proc->instance_cnt_FH1,"ru_thread_tx"); wait_on_condition(&proc->mutex_FH1,&proc->cond_FH1,&proc->instance_cnt_FH1,"ru_thread_tx");
printf( "ru_thread_tx ready\n"); //printf( "ru_thread_tx ready\n");
while (!oai_exit) { while (!oai_exit) {
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_CPUID_RU_THREAD_TX,sched_getcpu()); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_CPUID_RU_THREAD_TX,sched_getcpu());
...@@ -1527,8 +1525,10 @@ static void* ru_thread_tx( void* param ) { ...@@ -1527,8 +1525,10 @@ static void* ru_thread_tx( void* param ) {
if (ru->fh_north_out) ru->fh_north_out(ru); if (ru->fh_north_out) ru->fh_north_out(ru);
} }
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_IC_ENB,proc->instance_cnt_eNBs);
release_thread(&proc->mutex_eNBs,&proc->instance_cnt_eNBs,"ru_thread_tx"); release_thread(&proc->mutex_eNBs,&proc->instance_cnt_eNBs,"ru_thread_tx");
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_IC_ENB,proc->instance_cnt_eNBs);
for(int i = 0; i<ru->num_eNB; i++) for(int i = 0; i<ru->num_eNB; i++)
{ {
eNB = ru->eNB_list[i]; eNB = ru->eNB_list[i];
...@@ -1545,17 +1545,17 @@ static void* ru_thread_tx( void* param ) { ...@@ -1545,17 +1545,17 @@ static void* ru_thread_tx( void* param ) {
} }
} }
if (eNB_proc->RU_mask_tx != (1<<eNB->num_RU)-1) { // not all RUs have provided their information so return if (eNB_proc->RU_mask_tx != (1<<eNB->num_RU)-1) { // not all RUs have provided their information so return
printf("~~~~~~~~~~~~~~~~~~~~~~(mask = %d)\n", eNB_proc->RU_mask_tx); LOG_I(PHY,"Not all RUs have provided their info (mask = %d)\n", eNB_proc->RU_mask_tx);
pthread_mutex_unlock(&eNB_proc->mutex_RU_tx); pthread_mutex_unlock(&eNB_proc->mutex_RU_tx);
} }
else { // all RUs TX are finished so send the ready signal to eNB processing else { // all RUs TX are finished so send the ready signal to eNB processing
printf("~~~~~~~~~~~~~~~~~~~~~~ready to send wakeup signal\n"); LOG_I(PHY,"All RUs TX are finished. Ready to send wakeup signal to eNB processing\n");
eNB_proc->RU_mask_tx = 0; eNB_proc->RU_mask_tx = 0;
pthread_mutex_unlock(&eNB_proc->mutex_RU_tx); pthread_mutex_unlock(&eNB_proc->mutex_RU_tx);
pthread_mutex_lock( &L1_proc->mutex_RUs); pthread_mutex_lock( &L1_proc->mutex_RUs);
L1_proc->instance_cnt_RUs = 0; L1_proc->instance_cnt_RUs = 0;
printf("~~~~~~~~~~~~~~~~~~~~~~ru_thread_tx send signal to L1_thread_tx with (mask = %d)\n", eNB_proc->RU_mask_tx); LOG_I(PHY,"ru_thread_tx send signal to L1_thread_tx with (mask = %d)\n", eNB_proc->RU_mask_tx);
// the thread can now be woken up // the thread can now be woken up
if (pthread_cond_signal(&L1_proc->cond_RUs) != 0) { if (pthread_cond_signal(&L1_proc->cond_RUs) != 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");
...@@ -1661,7 +1661,7 @@ static void* ru_thread( void* param ) { ...@@ -1661,7 +1661,7 @@ static void* ru_thread( void* param ) {
if (wait_on_condition(&ru->proc.mutex_ru,&ru->proc.cond_ru_thread,&ru->proc.instance_cnt_ru,"ru_thread")<0) break; if (wait_on_condition(&ru->proc.mutex_ru,&ru->proc.cond_ru_thread,&ru->proc.instance_cnt_ru,"ru_thread")<0) break;
} }
else wait_sync("ru_thread"); else wait_sync("ru_thread");
if(!emulate_rf){
if (ru->is_slave == 0) AssertFatal(ru->state == RU_RUN,"ru-%d state = %s != RU_RUN\n",ru->idx,ru_states[ru->state]); if (ru->is_slave == 0) AssertFatal(ru->state == RU_RUN,"ru-%d state = %s != RU_RUN\n",ru->idx,ru_states[ru->state]);
else if (ru->is_slave == 1) AssertFatal(ru->state == RU_SYNC || ru->state == RU_RUN,"ru %d state = %s != RU_SYNC or RU_RUN\n",ru->idx,ru_states[ru->state]); else if (ru->is_slave == 1) AssertFatal(ru->state == RU_SYNC || ru->state == RU_RUN,"ru %d state = %s != RU_SYNC or RU_RUN\n",ru->idx,ru_states[ru->state]);
// Start RF device if any // Start RF device if any
...@@ -1671,7 +1671,7 @@ static void* ru_thread( void* param ) { ...@@ -1671,7 +1671,7 @@ static void* ru_thread( void* param ) {
else LOG_I(PHY,"RU %d rf device ready\n",ru->idx); else LOG_I(PHY,"RU %d rf device ready\n",ru->idx);
} }
else LOG_D(PHY,"RU %d no rf device\n",ru->idx); else LOG_D(PHY,"RU %d no rf device\n",ru->idx);
}
// if an asnych_rxtx thread exists // if an asnych_rxtx thread exists
// wakeup the thread because the devices are ready at this point // wakeup the thread because the devices are ready at this point
......
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