Commit 7d154e4c authored by winckel's avatar winckel

Changed L2L1 task start and termination control.

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@5011 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent b65c515c
...@@ -375,18 +375,30 @@ static s32 UE_id = 0, eNB_id = 0; ...@@ -375,18 +375,30 @@ static s32 UE_id = 0, eNB_id = 0;
static s32 RN_id=0; static s32 RN_id=0;
#endif #endif
Packet_OTG_List *otg_pdcp_buffer;
typedef enum l2l1_task_state_e
{
L2L1_WAITTING,
L2L1_RUNNING,
L2L1_TERMINATED,
} l2l1_task_state_t;
/*------------------------------------------------------------------------------*/
void *l2l1_task(void *args_p) { void *l2l1_task(void *args_p) {
l2l1_task_state_t l2l1_state = L2L1_WAITTING;
clock_t t;
// Framing variables // Framing variables
s32 slot, last_slot, next_slot; s32 slot, last_slot, next_slot;
#ifdef Rel10 #ifdef Rel10
relaying_type_t r_type=no_relay; // no relaying relaying_type_t r_type = no_relay; // no relaying
#endif #endif
lte_subframe_t direction; lte_subframe_t direction;
char fname[64], vname[64];
char fname[64], vname[64];
#ifdef XFORMS #ifdef XFORMS
// current status is that every UE has a DL scope for a SINGLE eNB (eNB_id=0) // current status is that every UE has a DL scope for a SINGLE eNB (eNB_id=0)
...@@ -432,7 +444,6 @@ void *l2l1_task(void *args_p) { ...@@ -432,7 +444,6 @@ void *l2l1_task(void *args_p) {
} }
#endif #endif
#ifdef PRINT_STATS #ifdef PRINT_STATS
for (UE_id=0;UE_id<NB_UE_INST;UE_id++) { for (UE_id=0;UE_id<NB_UE_INST;UE_id++) {
sprintf(UE_stats_filename,"UE_stats%d.txt",UE_id); sprintf(UE_stats_filename,"UE_stats%d.txt",UE_id);
...@@ -466,7 +477,6 @@ void *l2l1_task(void *args_p) { ...@@ -466,7 +477,6 @@ void *l2l1_task(void *args_p) {
#endif #endif
#if defined(ENABLE_ITTI) #if defined(ENABLE_ITTI)
MessageDef *message_p = NULL; MessageDef *message_p = NULL;
int result; int result;
...@@ -485,6 +495,7 @@ void *l2l1_task(void *args_p) { ...@@ -485,6 +495,7 @@ void *l2l1_task(void *args_p) {
switch (ITTI_MSG_ID(message_p)) { switch (ITTI_MSG_ID(message_p)) {
case INITIALIZE_MESSAGE: case INITIALIZE_MESSAGE:
l2l1_state = L2L1_RUNNING;
break; break;
case ACTIVATE_MESSAGE: case ACTIVATE_MESSAGE:
...@@ -496,20 +507,20 @@ void *l2l1_task(void *args_p) { ...@@ -496,20 +507,20 @@ void *l2l1_task(void *args_p) {
break; break;
case TERMINATE_MESSAGE: case TERMINATE_MESSAGE:
itti_exit_task (); l2l1_state = L2L1_TERMINATED;
break; break;
default: default:
LOG_E(EMU, "Received unexpected message %s\n", ITTI_MSG_NAME(message_p)); LOG_E(EMU, "Received unexpected message %s\n", ITTI_MSG_NAME(message_p));
break; break;
} }
} while (ITTI_MSG_ID(message_p) != INITIALIZE_MESSAGE); } while (l2l1_state == L2L1_WAITTING);
result = itti_free (ITTI_MSG_ORIGIN_ID(message_p), message_p); result = itti_free (ITTI_MSG_ORIGIN_ID(message_p), message_p);
AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
} }
#endif #endif
for (frame = 0; frame < oai_emulation.info.n_frames; frame++) { for (frame = 0; (l2l1_state != L2L1_TERMINATED) && (frame < oai_emulation.info.n_frames); frame++) {
#if defined(ENABLE_ITTI) #if defined(ENABLE_ITTI)
do { do {
...@@ -527,7 +538,7 @@ void *l2l1_task(void *args_p) { ...@@ -527,7 +538,7 @@ void *l2l1_task(void *args_p) {
break; break;
case TERMINATE_MESSAGE: case TERMINATE_MESSAGE:
itti_exit_task (); l2l1_state = L2L1_TERMINATED;
break; break;
case MESSAGE_TEST: case MESSAGE_TEST:
...@@ -975,8 +986,7 @@ void *l2l1_task(void *args_p) { ...@@ -975,8 +986,7 @@ void *l2l1_task(void *args_p) {
return NULL; return NULL;
} }
Packet_OTG_List *otg_pdcp_buffer; /*------------------------------------------------------------------------------*/
int main(int argc, char **argv) { int main(int argc, char **argv) {
s32 i; s32 i;
...@@ -1081,7 +1091,7 @@ int main(int argc, char **argv) { ...@@ -1081,7 +1091,7 @@ int main(int argc, char **argv) {
#if defined(ENABLE_ITTI) #if defined(ENABLE_ITTI)
// Handle signals until all tasks are terminated // Handle signals until all tasks are terminated
if (create_tasks(oai_emulation.info.nb_enb_local, oai_emulation.info.nb_ue_local) >= 0) { if (create_tasks(oai_emulation.info.nb_enb_local, oai_emulation.info.nb_ue_local) >= 0) {
itti_wait_tasks_end(); itti_wait_tasks_end();
} else { } else {
exit(-1); // need a softer mode exit(-1); // need a softer mode
} }
...@@ -1091,7 +1101,6 @@ int main(int argc, char **argv) { ...@@ -1091,7 +1101,6 @@ int main(int argc, char **argv) {
} }
l2l1_task (NULL); l2l1_task (NULL);
#endif #endif
t = clock () - t; t = clock () - t;
LOG_I (EMU,"Duration of the simulation: %f seconds\n", ((float) t) / CLOCKS_PER_SEC); LOG_I (EMU,"Duration of the simulation: %f seconds\n", ((float) t) / CLOCKS_PER_SEC);
......
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