Commit 68909776 authored by winckel's avatar winckel

Removed eNB_app from oaisim.c.

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4580 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 03d76e8d
...@@ -185,6 +185,14 @@ include $(OPENAIR2_DIR)/LAYER2/Makefile.inc ...@@ -185,6 +185,14 @@ include $(OPENAIR2_DIR)/LAYER2/Makefile.inc
include $(OPENAIR1_DIR)/SIMULATION/ETH_TRANSPORT/Makefile.inc include $(OPENAIR1_DIR)/SIMULATION/ETH_TRANSPORT/Makefile.inc
include $(OPENAIR2_DIR)/RRC/NAS/Makefile.inc include $(OPENAIR2_DIR)/RRC/NAS/Makefile.inc
include $(OPENAIR2_DIR)/UTIL/Makefile.inc include $(OPENAIR2_DIR)/UTIL/Makefile.inc
include $(OPENAIR2_DIR)/ENB_APP/Makefile.inc
INCLUDES = -I$(TOP_DIR)
INCLUDES += $(L2_incl)
INCLUDES += $(ENB_APP_incl)
INCLUDES += $(UTIL_incl)
INCLUDES += $(UTILS_incl)
INCLUDES += -I$(ASN1_MSG_INC)
SIMULATION_OBJS = $(TOP_DIR)/SIMULATION/TOOLS/gauss.o SIMULATION_OBJS = $(TOP_DIR)/SIMULATION/TOOLS/gauss.o
SIMULATION_OBJS += $(TOP_DIR)/SIMULATION/TOOLS/random_channel.o SIMULATION_OBJS += $(TOP_DIR)/SIMULATION/TOOLS/random_channel.o
...@@ -243,7 +251,8 @@ CFLAGS += $(PGM_CFLAGS) -DENABLE_PGM_TRANSPORT ...@@ -243,7 +251,8 @@ CFLAGS += $(PGM_CFLAGS) -DENABLE_PGM_TRANSPORT
LIBS += $(PGM_LIBS) LIBS += $(PGM_LIBS)
endif endif
OBJ = $(PHY_OBJS) $(SIMULATION_OBJS) $(ETHERNET_TRANSPORT_OBJS) $(TOOLS_OBJS) $(SCHED_OBJS) $(STATS_OBJS) $(NAS_OBJS) $(INT_OBJS) $(UTIL_OBJ) $(UTILS_OBJS) $(OAISIM_OBJS_COMMON) OBJ = $(PHY_OBJS) $(SIMULATION_OBJS) $(ETHERNET_TRANSPORT_OBJS) $(TOOLS_OBJS) $(SCHED_OBJS) $(STATS_OBJS) $(NAS_OBJS)
OBJ += $(INT_OBJS) $(UTIL_OBJ) $(UTILS_OBJS) $(OAISIM_OBJS_COMMON) $(ENB_APP_OBJS)
ifeq ($(OPENAIR2),1) ifeq ($(OPENAIR2),1)
OBJ += $(L2_OBJS) OBJ += $(L2_OBJS)
endif endif
...@@ -293,8 +302,8 @@ $(OAISIM_COMPILED_OBJECTS): | objsdir ...@@ -293,8 +302,8 @@ $(OAISIM_COMPILED_OBJECTS): | objsdir
$(OAISIM_COMPILED_OBJECTS) $(OAISIM_PAD_OBJS): %.o : $$(subst $(OBJS_DIR), $(OPENAIR_HOME), $$*.c) $(OAISIM_COMPILED_OBJECTS) $(OAISIM_PAD_OBJS): %.o : $$(subst $(OBJS_DIR), $(OPENAIR_HOME), $$*.c)
@echo Compiling $< @echo Compiling $<
@if [ ! -d $(dir $@) ]; then mkdir -p $(dir $@); fi; @if [ ! -d $(dir $@) ]; then mkdir -p $(dir $@); fi;
@$(CC) -c $(CFLAGS) $(EXTRA_CFLAGS) -DPHY_CONTEXT=1 -I$(TOP_DIR) $(L2_incl) $(UTIL_incl) $(UTILS_incl) -I$(ASN1_MSG_INC) -o $@ $< @$(CC) -c $(CFLAGS) $(EXTRA_CFLAGS) -DPHY_CONTEXT=1 $(INCLUDES) -o $@ $<
@$(CC) -MM $(CFLAGS) $(EXTRA_CFLAGS) -DPHY_CONTEXT=1 -I$(TOP_DIR) $(L2_incl) $(UTIL_incl) $(UTILS_incl) -I$(ASN1_MSG_INC) $< > $*.d @$(CC) -MM $(CFLAGS) $(EXTRA_CFLAGS) -DPHY_CONTEXT=1 $(INCLUDES) $< > $*.d
@mv -f $*.d $*.d.tmp @mv -f $*.d $*.d.tmp
@sed -e 's|.*:|$*.o:|' < $*.d.tmp > $*.d @sed -e 's|.*:|$*.o:|' < $*.d.tmp > $*.d
@sed -e 's/.*://' -e 's/\\$$//' < $*.d.tmp | fmt -1 | \ @sed -e 's/.*://' -e 's/\\$$//' < $*.d.tmp | fmt -1 | \
...@@ -308,12 +317,12 @@ $(LFDS_LIB): ...@@ -308,12 +317,12 @@ $(LFDS_LIB):
oaisim_pad: $(OBJ) $(OAISIM_PAD_OBJS) $(ASN1_MSG_OBJS1) oaisim_pad: $(OBJ) $(OAISIM_PAD_OBJS) $(ASN1_MSG_OBJS1)
@echo "Linking oaisim_pad ..." @echo "Linking oaisim_pad ..."
@$(MPICC) -I$(TOP_DIR) $(L2_incl) $(UTIL_incl) $(UTILS_incl) -I$(ASN1_MSG_INC) $(S1AP_Incl) -o oaisim_pad $(CFLAGS) $(EXTRA_CFLAGS) $(OBJ) $(OAISIM_PAD_OBJS) $(ASN1_MSG_OBJS1) \ @$(MPICC) $(INCLUDES) $(S1AP_Incl) -o oaisim_pad $(CFLAGS) $(EXTRA_CFLAGS) $(OBJ) $(OAISIM_PAD_OBJS) $(ASN1_MSG_OBJS1) \
-lpthread -llapack_atlas -lforms -lrt $(LIBS) $(DB_LDFLAGS) -lpthread -llapack_atlas -lforms -lrt $(LIBS) $(DB_LDFLAGS)
oaisim: $(OAISIM_COMPILED_OBJECTS) $(SHARED_DEPENDENCIES) oaisim: $(OAISIM_COMPILED_OBJECTS) $(SHARED_DEPENDENCIES)
@echo "Linking oaisim ..." @echo "Linking oaisim ..."
@$(CC) -I$(TOP_DIR) $(L2_incl) $(UTIL_incl) $(UTILS_incl) -I$(ASN1_MSG_INC) $(S1AP_Incl) -o oaisim $(CFLAGS) $(EXTRA_CFLAGS) $(OAISIM_COMPILED_OBJECTS) \ @$(CC) $(INCLUDES) $(S1AP_Incl) -o oaisim $(CFLAGS) $(EXTRA_CFLAGS) $(OAISIM_COMPILED_OBJECTS) \
-lpthread -llapack_atlas -lforms -lrt $(LIBS) $(DB_LDFLAGS) -lpthread -llapack_atlas -lforms -lrt $(LIBS) $(DB_LDFLAGS)
ifeq ($(rrc_cellular_eNB),1) ifeq ($(rrc_cellular_eNB),1)
...@@ -325,7 +334,7 @@ endif ...@@ -325,7 +334,7 @@ endif
oaisimCROWN: $(OBJ) $(ASN1_MSG_OBJS1) oaisimCROWN.c oaisimCROWN: $(OBJ) $(ASN1_MSG_OBJS1) oaisimCROWN.c
@echo "Compiling oaisimCROWN.c ..." @echo "Compiling oaisimCROWN.c ..."
@$(CC) oaisimCROWN.c -I$(TOP_DIR) $(L2_incl) $(UTIL_incl) $(UTILS_incl) -I$(ASN1_MSG_INC) $(S1AP_Incl) -o oaisimCROWN $(CFLAGS) $(EXTRA_CFLAGS) $(OBJ) $(ASN1_MSG_OBJS1) -lm -lblas -lpthread -llapack_atlas -lforms $(LIBXML2_LIBS) -lX11 -lXpm -lrt @$(CC) oaisimCROWN.c $(INCLUDES) $(S1AP_Incl) -o oaisimCROWN $(CFLAGS) $(EXTRA_CFLAGS) $(OBJ) $(ASN1_MSG_OBJS1) -lm -lblas -lpthread -llapack_atlas -lforms $(LIBXML2_LIBS) -lX11 -lXpm -lrt
nasmesh_fix: nasmesh_fix:
(cd $(OPENAIR2_DIR)/NAS/DRIVER/MESH/RB_TOOL && $(MAKE)) (cd $(OPENAIR2_DIR)/NAS/DRIVER/MESH/RB_TOOL && $(MAKE))
...@@ -411,6 +420,7 @@ print: ...@@ -411,6 +420,7 @@ print:
@echo "CFLAGS are " $(CFLAGS) @echo "CFLAGS are " $(CFLAGS)
@echo "EXTRA_CFLAGS are" $(EXTRA_CFLAGS) @echo "EXTRA_CFLAGS are" $(EXTRA_CFLAGS)
@echo "L2 includes are" $(L2_incl) @echo "L2 includes are" $(L2_incl)
@echo "INCLUDES are" $(INCLUDES)
@echo "S1AP Includes are" $(S1AP_Incl) @echo "S1AP Includes are" $(S1AP_Incl)
@echo "TOP_DIR Include is" I$(TOP_DIR) @echo "TOP_DIR Include is" I$(TOP_DIR)
@echo "UTIL includes are" $(UTIL_incl) @echo "UTIL includes are" $(UTIL_incl)
......
...@@ -71,6 +71,8 @@ char smbv_ip[16]; ...@@ -71,6 +71,8 @@ char smbv_ip[16];
#include "UTIL/OTG/otg_kpi.h" #include "UTIL/OTG/otg_kpi.h"
#include "assertions.h" #include "assertions.h"
#include "enb_app.h"
#if defined(ENABLE_ITTI) #if defined(ENABLE_ITTI)
# include "intertask_interface_init.h" # include "intertask_interface_init.h"
# include "timer.h" # include "timer.h"
...@@ -404,169 +406,6 @@ int itti_create_task_successful(void){ ...@@ -404,169 +406,6 @@ int itti_create_task_successful(void){
} }
#endif #endif
#if defined(ENABLE_ITTI)
/*
* later, the eNB task will be moved from here
*/
# if defined(ENABLE_USE_MME)
#define ENB_REGISTER_RETRY_DELAY 10
uint32_t eNB_app_register()
{
MessageDef *msg_p;
uint32_t register_enb_pending = 0;
for (eNB_id = oai_emulation.info.first_enb_local;
(eNB_id < (oai_emulation.info.first_enb_local + oai_emulation.info.nb_enb_local)) && (oai_emulation.info.cli_start_enb[eNB_id] == 1);
eNB_id++) {
char *mme_address_v4;
if (EPC_MODE_ENABLED){
mme_address_v4 = EPC_MODE_MME_ADDRESS;
} else {
mme_address_v4 = "192.168.12.87";
}
char *mme_address_v6 = "2001:660:5502:12:30da:829a:2343:b6cf";
s1ap_register_enb_req_t *s1ap_register_eNB;
uint32_t hash;
//note: there is an implicit relationship between the data struct and the message name
msg_p = itti_alloc_new_message(TASK_ENB_APP, S1AP_REGISTER_ENB_REQ);
s1ap_register_eNB = &S1AP_REGISTER_ENB_REQ(msg_p);
hash = s1ap_generate_eNB_id();
/* Some default/random parameters */
s1ap_register_eNB->eNB_id = eNB_id + (hash & 0xFFFF8);
s1ap_register_eNB->cell_type = CELL_MACRO_ENB;
s1ap_register_eNB->tac = 0;
s1ap_register_eNB->mcc = 208;
s1ap_register_eNB->mnc = 34;
s1ap_register_eNB->default_drx = PAGING_DRX_256;
s1ap_register_eNB->nb_mme = 1;
s1ap_register_eNB->mme_ip_address[0].ipv4 = 1;
s1ap_register_eNB->mme_ip_address[0].ipv6 = 0;
memcpy(s1ap_register_eNB->mme_ip_address[0].ipv4_address, mme_address_v4, strlen(mme_address_v4));
memcpy(s1ap_register_eNB->mme_ip_address[0].ipv6_address, mme_address_v6, strlen(mme_address_v6));
# if defined ENB_APP_ENB_REGISTER_2_MME
s1ap_register_eNB->nb_mme = 2;
s1ap_register_eNB->mme_ip_address[1].ipv4 = 1;
s1ap_register_eNB->mme_ip_address[1].ipv6 = 0;
mme_address_v4 = "192.168.12.88";
memcpy(s1ap_register_eNB->mme_ip_address[1].ipv4_address, mme_address_v4, strlen(mme_address_v4));
memcpy(s1ap_register_eNB->mme_ip_address[1].ipv6_address, mme_address_v6, strlen(mme_address_v6));
# endif
itti_send_msg_to_task(TASK_S1AP, eNB_id, msg_p);
register_enb_pending ++;
}
return register_enb_pending;
}
# endif
#endif
void *eNB_app_task(void *args_p) {
#if defined(ENABLE_ITTI)
# if defined(ENABLE_USE_MME)
static uint32_t register_enb_pending;
static uint32_t registered_enb;
static long enb_register_retry_timer_id;
# endif
MessageDef *msg_p;
const char *msg_name;
instance_t instance;
itti_mark_task_ready (TASK_ENB_APP);
# if defined(ENABLE_USE_MME)
/* Try to register each eNB */
registered_enb = 0;
register_enb_pending = eNB_app_register();
# else
msg_p = itti_alloc_new_message(TASK_ENB_APP, INITIALIZE_MESSAGE);
itti_send_msg_to_task(TASK_L2L1, INSTANCE_DEFAULT, msg_p);
# endif
do {
// Wait for a message
itti_receive_msg (TASK_ENB_APP, &msg_p);
msg_name = ITTI_MSG_NAME (msg_p);
instance = ITTI_MSG_INSTANCE (msg_p);
switch (ITTI_MSG_ID(msg_p)) {
case TERMINATE_MESSAGE:
itti_exit_task ();
break;
case MESSAGE_TEST:
LOG_I(EMU, "Received %s\n", ITTI_MSG_NAME(msg_p));
break;
# if defined(ENABLE_USE_MME)
case S1AP_REGISTER_ENB_CNF:
LOG_I(EMU, "[eNB %d] Received %s: associated MME %d\n", instance, msg_name, S1AP_REGISTER_ENB_CNF(msg_p).nb_mme);
DevAssert(register_enb_pending > 0);
register_enb_pending--;
/* Check if at least eNB is registered with one MME */
if (S1AP_REGISTER_ENB_CNF(msg_p).nb_mme > 0) {
registered_enb ++;
}
/* Check if all register eNB requests have been processed */
if (register_enb_pending == 0) {
if (registered_enb == oai_emulation.info.nb_enb_local) {
/* If all eNB are registered, start L2L1 task */
MessageDef *msg_init_p;
msg_init_p = itti_alloc_new_message (TASK_ENB_APP, INITIALIZE_MESSAGE);
itti_send_msg_to_task (TASK_L2L1, INSTANCE_DEFAULT, msg_init_p);
}
else {
uint32_t not_associated = oai_emulation.info.nb_enb_local - registered_enb;
LOG_W(EMU, " %d eNB %s not associated with a MME, retrying registration in %d seconds ...\n",
not_associated, not_associated > 1 ? "are" : "is", ENB_REGISTER_RETRY_DELAY);
/* Restart the eNB registration process in ENB_REGISTER_RETRY_DELAY seconds */
if (timer_setup (ENB_REGISTER_RETRY_DELAY, 0, TASK_ENB_APP, INSTANCE_DEFAULT, TIMER_ONE_SHOT, NULL, &enb_register_retry_timer_id) < 0) {
LOG_E(EMU, " Can not start eNB register retry timer!\n");
}
}
}
break;
case TIMER_HAS_EXPIRED:
LOG_I(EMU, " Received %s: timer_id %d\n", msg_name, TIMER_HAS_EXPIRED(msg_p).timer_id);
if (TIMER_HAS_EXPIRED(msg_p).timer_id == enb_register_retry_timer_id) {
/* Restart the registration process */
registered_enb = 0;
register_enb_pending = eNB_app_register();
}
break;
# endif
default:
LOG_E(EMU, "Received unexpected message %s\n", msg_name);
break;
}
free (msg_p);
} while(1);
#endif
return NULL;
}
void *l2l1_task(void *args_p) { void *l2l1_task(void *args_p) {
// Framing variables // Framing variables
s32 slot, last_slot, next_slot; s32 slot, last_slot, next_slot;
......
...@@ -42,7 +42,6 @@ void calc_path_loss(node_desc_t* node_tx, node_desc_t* node_rx, channel_desc_t * ...@@ -42,7 +42,6 @@ void calc_path_loss(node_desc_t* node_tx, node_desc_t* node_rx, channel_desc_t *
void do_OFDM_mod(mod_sym_t **txdataF, s32 **txdata, uint32_t frame, u16 next_slot, LTE_DL_FRAME_PARMS *frame_parms); void do_OFDM_mod(mod_sym_t **txdataF, s32 **txdata, uint32_t frame, u16 next_slot, LTE_DL_FRAME_PARMS *frame_parms);
void *eNB_app_task(void *args_p);
#ifdef ENABLE_ITTI #ifdef ENABLE_ITTI
int itti_create_task_successful(void); int itti_create_task_successful(void);
void *l2l1_task(void *args_p); void *l2l1_task(void *args_p);
......
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