Commit 16936fb1 authored by Florian Kaltenberger's avatar Florian Kaltenberger

fixed some bugs that prevented lte-softmodem to exit properly

eNB stats are printed on screen on program exit


git-svn-id: http://svn.eurecom.fr/openair4G/trunk@5870 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent cd9be8f6
......@@ -60,5 +60,5 @@ void display_backtrace(void)
void backtrace_handle_signal(siginfo_t *info)
{
display_backtrace();
exit(EXIT_FAILURE);
//exit(EXIT_FAILURE);
}
......@@ -112,7 +112,7 @@ int signal_handle(int *end)
return ret;
}
// printf("Received signal %d\n", info.si_signo);
printf("Received signal %d\n", info.si_signo);
/* Real-time signals are non constant and are therefore not suitable for
* use in switch.
......
......@@ -169,8 +169,8 @@ unsigned char scope_enb_num_ue = 1;
static SEM *mutex;
//static CND *cond;
static int main_eNB_thread;
static int main_ue_thread;
static long main_eNB_thread;
static long main_ue_thread;
#ifdef USRP
static SEM *sync_sem; // to sync rx & tx streaming
#endif
......@@ -438,6 +438,7 @@ static void set_latency_target(void)
void reset_stats(FL_OBJECT *button, long arg) {
int i,j,k;
PHY_VARS_eNB *phy_vars_eNB = PHY_vars_eNB_g[0][0];
for (i=0;i<NUMBER_OF_UE_MAX;i++) {
for (k=0;k<8;k++) {//harq_processes
for (j=0;j<phy_vars_eNB->dlsch_eNB[i][0]->Mdlharq;j++) {
phy_vars_eNB->eNB_UE_stats[i].dlsch_NAK[k][j]=0;
......@@ -457,7 +458,7 @@ void reset_stats(FL_OBJECT *button, long arg) {
phy_vars_eNB->eNB_UE_stats[i].dlsch_sliding_cnt=0;
phy_vars_eNB->eNB_UE_stats[i].dlsch_NAK_round0=0;
phy_vars_eNB->eNB_UE_stats[i].dlsch_mcs_offset=0;
}
}
static void *scope_thread(void *arg) {
......@@ -473,12 +474,12 @@ static void *scope_thread(void *arg) {
printf("Scope thread has priority %d\n",sched_param.sched_priority);
/*
# ifdef ENABLE_XFORMS_WRITE_STATS
if (UE_flag==1)
UE_stats = fopen("UE_stats.txt", "w");
else
eNB_stats = fopen("eNB_stats.txt", "w");
*/
#endif
while (!oai_exit) {
if (UE_flag==1) {
......@@ -487,10 +488,7 @@ static void *scope_thread(void *arg) {
# endif
dump_ue_stats (PHY_vars_UE_g[0][0], stats_buffer, 0, mode,rx_input_level_dBm);
fl_set_object_label(form_stats->stats_text, stats_buffer);
# ifdef ENABLE_XFORMS_WRITE_STATS
rewind (UE_stats);
fwrite (stats_buffer, 1, len, UE_stats);
# endif
phy_scope_UE(form_ue[UE_id],
PHY_vars_UE_g[UE_id][0],
eNB_id,
......@@ -499,15 +497,16 @@ static void *scope_thread(void *arg) {
} else {
# ifdef ENABLE_XFORMS_WRITE_STATS
len =
# endif
dump_eNB_stats (PHY_vars_eNB_g[0][0], stats_buffer, 0);
fl_set_object_label(form_stats->stats_text, stats_buffer);
# ifdef ENABLE_XFORMS_WRITE_STATS
rewind (eNB_stats);
fwrite (stats_buffer, 1, len, eNB_stats);
# endif
dump_eNB_l2_stats (stats_buffer, 0);
fl_set_object_label(form_stats_l2->stats_text, stats_buffer);
# ifdef ENABLE_XFORMS_WRITE_STATS
len =
# endif
dump_eNB_stats (PHY_vars_eNB_g[0][0], stats_buffer, 0);
fl_set_object_label(form_stats->stats_text, stats_buffer);
for(UE_id=0;UE_id<scope_enb_num_ue;UE_id++) {
phy_scope_eNB(form_enb[UE_id],
PHY_vars_eNB_g[eNB_id][0],
......@@ -520,9 +519,23 @@ static void *scope_thread(void *arg) {
sleep(1);
}
printf("%s",stats_buffer);
# ifdef ENABLE_XFORMS_WRITE_STATS
if (UE_flag==1) {
if (UE_stats) {
rewind (UE_stats);
fwrite (stats_buffer, 1, len, UE_stats);
fclose (UE_stats);
}
}
else {
if (eNB_stats) {
rewind (eNB_stats);
fwrite (stats_buffer, 1, len, eNB_stats);
fclose (eNB_stats);
}
}
# endif
pthread_exit((void*)arg);
......@@ -1336,22 +1349,16 @@ static void *eNB_thread(void *arg)
first_run=0;
if (diff<0)
diff = diff +150;
LOG_I(HW,"eNB Frame %d, time %llu: diff %d\n",frame, rt_get_time_ns(), diff);
LOG_I(HW,"eNB Frame %d, time %llu: slot %d, hw_slot %d, diff %d\n",frame, rt_get_time_ns(), slot, hw_slot, diff);
}
if (((slot%2==0) && (diff < (-14))) || ((slot%2==1) && (diff < (-7)))) {
// at the eNB, even slots have double as much time since most of the processing is done here and almost nothing in odd slots
LOG_D(HW,"eNB Frame %d, time %llu: missed slot, proceeding with next one (slot %d, hw_slot %d, diff %d)\n",frame, rt_get_time_ns(), slot, hw_slot, diff);
LOG_D(HW,"eNB Frame %d, time %llu: missed slot, proceeding with next one (slot %d, hw_slot %d, mbox_current %d, mbox_target %d, diff %d)\n",frame, rt_get_time_ns(), slot, hw_slot, mbox_current, mbox_target, diff);
slot++;
if (frame > 0) {
//if (frame > 0)
exit_fun("[HW][eNB] missed slot");
}
if (slot==20){
slot=0;
frame++;
}
continue;
}
if (diff>8)
LOG_D(HW,"eNB Frame %d, time %llu: skipped slot, waiting for hw to catch up (slot %d, hw_slot %d, mbox_current %d, mbox_target %d, diff %d)\n",frame, rt_get_time_ns(), slot, hw_slot, mbox_current, mbox_target, diff);
......@@ -3079,7 +3086,7 @@ int main(int argc, char **argv) {
for(CC_id=0;CC_id<MAX_NUM_CCs;CC_id++) {
rf_map[CC_id].card=0;
rf_map[CC_id].chain=CC_id;
rf_map[CC_id].chain=CC_id+1;
}
// connect the TX/RX buffers
......@@ -3253,7 +3260,7 @@ int main(int argc, char **argv) {
// start the main thread
if (UE_flag == 1) {
init_UE_threads();
sleep(1);
#ifdef RTAI
main_ue_thread = rt_thread_create(UE_thread, NULL, 100000000);
#else
......@@ -3277,9 +3284,10 @@ int main(int argc, char **argv) {
if (multi_thread>0) {
init_eNB_proc();
sleep(1);
LOG_D(HW,"[lte-softmodem.c] eNB threads created\n");
}
printf("Creating eNB_thread \n");
printf("Creating main eNB_thread \n");
#ifdef RTAI
main_eNB_thread = rt_thread_create(eNB_thread, NULL, OPENAIR_THREAD_STACK_SIZE);
#else
......@@ -3295,7 +3303,7 @@ int main(int argc, char **argv) {
}
// Sleep to allow all threads to setup
sleep(5);
sleep(1);
#ifdef USRP
......
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