Commit c26a1300 authored by Cedric Roux's avatar Cedric Roux

- Mapped malloc/free for ITTI to itti_malloc/itti_free functions for future...

- Mapped malloc/free for ITTI to itti_malloc/itti_free functions for future use within real-time softmodem
- Fixed softmodem build issues with RAL
- Merged ITTI into agilent softmodem for eNB

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4661 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 008c0adb
......@@ -37,10 +37,6 @@
#include <errno.h>
#include <signal.h>
#ifdef RTAI
# include <rtai_fifos.h>
#endif
#include "assertions.h"
#include <sys/epoll.h>
......@@ -50,6 +46,10 @@
#include "intertask_interface.h"
#include "intertask_interface_dump.h"
#ifdef RTAI
# include <rtai_shm.h>
#endif
#if defined(OAI_EMU) || defined(RTAI)
# include "vcd_signal_dumper.h"
#endif
......@@ -87,6 +87,11 @@ const int itti_debug_poll = 0;
# define KERNEL_VERSION_PRE_2_6_30 1
#endif
#ifdef RTAI
# define ITTI_MEM_PAGE_SIZE (1024)
# define ITTI_MEM_SIZE (16 * 1024 * 1024)
#endif
typedef enum task_state_s {
TASK_STATE_NOT_CONFIGURED, TASK_STATE_STARTING, TASK_STATE_READY, TASK_STATE_ENDED, TASK_STATE_MAX,
} task_state_t;
......@@ -174,6 +179,32 @@ typedef struct itti_desc_s {
static itti_desc_t itti_desc;
void *itti_malloc(task_id_t task_id, ssize_t size)
{
void *ptr = NULL;
#ifdef RTAI
// ptr = rt_malloc(size);
ptr = malloc(size);
#else
ptr = malloc(size);
#endif
DevCheck(ptr != NULL, ptr, size, task_id);
return ptr;
}
void itti_free(task_id_t task_id, void *ptr)
{
DevAssert(ptr != NULL);
#ifdef RTAI
free(ptr);
#else
free(ptr);
#endif
}
static inline message_number_t itti_increment_message_number(void) {
/* Atomic operation supported by GCC: returns the current message number
* and then increment it by 1.
......@@ -227,6 +258,7 @@ void itti_update_lte_time(uint32_t frame, uint8_t slot)
int itti_send_broadcast_message(MessageDef *message_p) {
task_id_t destination_task_id;
task_id_t origin_task_id;
thread_id_t origin_thread_id;
uint32_t thread_id;
int ret = 0;
......@@ -234,7 +266,8 @@ int itti_send_broadcast_message(MessageDef *message_p) {
DevAssert(message_p != NULL);
origin_thread_id = TASK_GET_THREAD_ID(message_p->ittiMsgHeader.originTaskId);
origin_task_id = message_p->ittiMsgHeader.originTaskId;
origin_thread_id = TASK_GET_THREAD_ID(origin_task_id);
destination_task_id = TASK_FIRST;
for (thread_id = THREAD_FIRST; thread_id < itti_desc.thread_max; thread_id++) {
......@@ -248,7 +281,7 @@ int itti_send_broadcast_message(MessageDef *message_p) {
if (thread_id != origin_thread_id) {
/* Skip tasks which are not running */
if (itti_desc.threads[thread_id].task_state == TASK_STATE_READY) {
new_message_p = malloc (sizeof(MessageDef));
new_message_p = itti_malloc (origin_task_id, sizeof(MessageDef));
DevAssert(message_p != NULL);
memcpy (new_message_p, message_p, sizeof(MessageDef));
......@@ -278,7 +311,7 @@ inline MessageDef *itti_alloc_new_message_sized(task_id_t origin_task_id, Messag
origin_task_id = itti_get_current_task_id();
}
temp = malloc (sizeof(MessageHeader) + size);
temp = itti_malloc (origin_task_id, sizeof(MessageHeader) + size);
DevAssert(temp != NULL);
temp->ittiMsgHeader.messageId = message_id;
......@@ -329,16 +362,7 @@ int itti_send_msg_to_task(task_id_t destination_task_id, instance_t instance, Me
/* Increment the global message number */
message_number = itti_increment_message_number ();
/*
*
#ifdef RTAI
if ((pthread_self() == itti_desc.threads[TASK_GET_THREAD_ID(origin_task_id)].task_thread) ||
(task_id == TASK_UNKNOWN) ||
((TASK_GET_PARENT_TASK_ID(origin_task_id) != TASK_UNKNOWN) &&
(pthread_self() == itti_desc.threads[TASK_GET_PARENT_TASK_ID(origin_task_id)].task_thread)))
#endif
*/
itti_dump_queue_message (message_number, message, itti_desc.messages_info[message_id].name,
itti_dump_queue_message (origin_task_id, message_number, message, itti_desc.messages_info[message_id].name,
sizeof(MessageHeader) + message->ittiMsgHeader.ittiMsgSize);
if (destination_task_id != TASK_UNKNOWN)
......@@ -364,7 +388,7 @@ int itti_send_msg_to_task(task_id_t destination_task_id, instance_t instance, Me
itti_desc.threads[destination_thread_id].task_state, message_id);
/* Allocate new list element */
new = (message_list_t *) malloc (sizeof(struct message_list_s));
new = (message_list_t *) itti_malloc (origin_task_id, sizeof(struct message_list_s));
DevAssert(new != NULL);
/* Fill in members */
......@@ -552,7 +576,7 @@ static inline void itti_receive_msg_internal_event_fd(task_id_t task_id, uint8_t
}
DevAssert(message != NULL);
*received_msg = message->msg;
free (message);
itti_free (ITTI_MSG_ORIGIN_ID(*received_msg), message);
return;
}
}
......@@ -659,6 +683,12 @@ void itti_mark_task_ready(task_id_t task_id)
DevCheck(thread_id < itti_desc.thread_max, thread_id, itti_desc.thread_max, 0);
/* Register the thread in itti dump */
itti_dump_thread_use_ring_buffer();
/* Mark the thread as using LFDS queue */
lfds611_queue_use(itti_desc.tasks[task_id].message_queue);
#ifdef RTAI
/* Assign low priority to created threads */
{
......@@ -668,12 +698,6 @@ void itti_mark_task_ready(task_id_t task_id)
}
#endif
/* Register the thread in itti dump */
itti_dump_thread_use_ring_buffer();
/* Mark the thread as using LFDS queue */
lfds611_queue_use(itti_desc.tasks[task_id].message_queue);
itti_desc.threads[thread_id].task_state = TASK_STATE_READY;
}
......@@ -779,13 +803,6 @@ int itti_init(task_id_t task_max, thread_id_t thread_max, MessagesIds messages_i
ITTI_ERROR("lfds611_queue_new failed for task %u\n", task_id);
DevAssert(0 == 1);
}
# ifdef RTAI
if (task_id == TASK_L2L1)
{
ret = rtf_sem_init(56, 0);
}
# endif
}
/* Initializing each thread */
......@@ -844,6 +861,8 @@ int itti_init(task_id_t task_max, thread_id_t thread_max, MessagesIds messages_i
#ifdef RTAI
/* Start RT relay thread */
DevAssert(pthread_create (&itti_desc.rt_relay_thread, NULL, itti_rt_relay_thread, NULL) >= 0);
rt_global_heap_open();
#endif
#if defined(OAI_EMU) || defined(RTAI)
......
......@@ -225,5 +225,9 @@ void itti_wait_tasks_end(void);
**/
void itti_send_terminate_message(task_id_t task_id);
void *itti_malloc(task_id_t task_id, ssize_t size);
void itti_free(task_id_t task_id, void *ptr);
#endif /* INTERTASK_INTERFACE_H_ */
/* @} */
......@@ -90,12 +90,12 @@ static const int itti_dump_debug = 0;
#define ITTI_DUMP_EXIT_SIGNAL 0x4
typedef struct itti_dump_queue_item_s {
void *data;
uint32_t data_size;
uint32_t message_number;
char message_name[SIGNAL_NAME_LENGTH];
uint32_t message_type;
uint32_t message_size;
MessageDef *data;
uint32_t data_size;
uint32_t message_number;
char message_name[SIGNAL_NAME_LENGTH];
uint32_t message_type;
uint32_t message_size;
} itti_dump_queue_item_t;
typedef struct {
......@@ -215,6 +215,9 @@ static void itti_dump_fwrite_message(itti_dump_queue_item_t *message)
fwrite (&message->message_number, sizeof(message->message_number), 1, dump_file);
fwrite (message->message_name, sizeof(message->message_name), 1, dump_file);
fwrite (message->data, message->data_size, 1, dump_file);
// #if !defined(RTAI)
fflush (dump_file);
// #endif
}
}
......@@ -303,7 +306,8 @@ static int itti_dump_enqueue_message(itti_dump_queue_item_t *new, uint32_t messa
return 0;
}
int itti_dump_queue_message(message_number_t message_number,
int itti_dump_queue_message(task_id_t sender_task,
message_number_t message_number,
MessageDef *message_p,
const char *message_name,
const uint32_t message_size)
......@@ -316,21 +320,22 @@ int itti_dump_queue_message(message_number_t message_number,
DevAssert(message_name != NULL);
DevAssert(message_p != NULL);
new = malloc(sizeof(itti_dump_queue_item_t));
if (new == NULL) {
ITTI_DUMP_ERROR("Failed to allocate memory (%s:%d)\n",
__FILE__, __LINE__);
return -1;
}
#if defined(OAI_EMU) || defined(RTAI)
vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_ITTI_DUMP_ENQUEUE_MESSAGE_MALLOC, VCD_FUNCTION_IN);
#endif
new = itti_malloc(sender_task, sizeof(itti_dump_queue_item_t));
#if defined(OAI_EMU) || defined(RTAI)
vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_ITTI_DUMP_ENQUEUE_MESSAGE_MALLOC, VCD_FUNCTION_OUT);
#endif
new->data = malloc(message_size);
#if defined(OAI_EMU) || defined(RTAI)
vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_ITTI_DUMP_ENQUEUE_MESSAGE_MALLOC, VCD_FUNCTION_IN);
#endif
new->data = itti_malloc(sender_task, message_size);
#if defined(OAI_EMU) || defined(RTAI)
vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_ITTI_DUMP_ENQUEUE_MESSAGE_MALLOC, VCD_FUNCTION_OUT);
#endif
if (new->data == NULL) {
ITTI_DUMP_ERROR("Failed to allocate memory (%s:%d)\n",
__FILE__, __LINE__);
return -1;
}
memcpy(new->data, message_p, message_size);
new->data_size = message_size;
new->message_number = message_number;
......@@ -764,13 +769,16 @@ static void itti_dump_user_data_delete_function(void *user_data, void *user_stat
if (user_data != NULL)
{
itti_dump_queue_item_t *item;
task_id_t task_id;
item = (itti_dump_queue_item_t *)user_data;
task_id = ITTI_MSG_ORIGIN_ID(item->data);
if (item->data != NULL)
{
free(item->data);
itti_free(task_id, item->data);
}
free(item);
itti_free(task_id, item);
}
}
......
......@@ -31,13 +31,9 @@
#ifndef INTERTASK_INTERFACE_DUMP_H_
#define INTERTASK_INTERFACE_DUMP_H_
int itti_dump_queue_message(message_number_t message_number, MessageDef *message_p, const char *message_name,
int itti_dump_queue_message(task_id_t sender_task, message_number_t message_number, MessageDef *message_p, const char *message_name,
const uint32_t message_size);
int itti_dump_queue_generic_string_message(message_number_t message_number,
char *string_message,
const uint32_t string_message_length);
int itti_dump_init(const char * const messages_definition_xml, const char * const dump_file_name);
void itti_dump_exit(void);
......
......@@ -76,7 +76,7 @@ void *nas_ue_task(void *args_p) {
break;
}
free (msg_p);
itti_free (ITTI_MSG_ORIGIN_ID(msg_p), msg_p);
msg_p = NULL;
}
}
......
......@@ -288,7 +288,7 @@ void *s1ap_eNB_task(void *arg)
break;
}
free(received_msg);
itti_free (ITTI_MSG_ORIGIN_ID(received_msg), received_msg);
received_msg = NULL;
}
......
......@@ -25,7 +25,7 @@ void lte_adjust_synch(LTE_DL_FRAME_PARMS *frame_parms,
{
static int max_pos_fil = 0;
int temp, i, aa, max_val = 0, max_pos = 0;
int temp = 0, i, aa, max_val = 0, max_pos = 0;
int diff;
short Re,Im,ncoef;
......@@ -73,7 +73,8 @@ void lte_adjust_synch(LTE_DL_FRAME_PARMS *frame_parms,
#ifdef DEBUG_PHY
LOG_D(PHY,"frame %d: rx_offset (after) = %d : max_pos = %d,max_pos_fil = %d (peak %d)\n",phy_vars_ue->frame,phy_vars_ue->rx_offset,max_pos,max_pos_fil,temp);
LOG_D(PHY,"frame %d: rx_offset (after) = %d : max_pos = %d,max_pos_fil = %d (peak %d)\n",
phy_vars_ue->frame,phy_vars_ue->rx_offset,max_pos,max_pos_fil,temp);
#endif //DEBUG_PHY
#ifdef CBMIMO1
......
......@@ -250,7 +250,7 @@ void *eNB_app_task(void *args_p)
break;
}
free (msg_p);
itti_free (ITTI_MSG_ORIGIN_ID(msg_p), msg_p);
} while (1);
#endif
......
......@@ -4281,7 +4281,7 @@ void eNB_dlsch_ulsch_scheduler(u8 Mod_id,u8 cooperation_flag, u32 frame, u8 subf
break;
}
free (msg_p);
itti_free (ITTI_MSG_ORIGIN_ID(msg_p), msg_p);
}
} while(msg_p != NULL);
#endif
......
......@@ -1310,7 +1310,7 @@ UE_L2_STATE_t ue_scheduler(u8 Mod_id,u32 frame, u8 subframe, lte_subframe_t dire
break;
}
free (msg_p);
itti_free (ITTI_MSG_ORIGIN_ID(msg_p), msg_p);
}
} while(msg_p != NULL);
#endif
......
......@@ -519,7 +519,7 @@ void pdcp_run (u32_t frame, u8 eNB_flag, u8 UE_index, u8 eNB_index) {
RRC_DCCH_DATA_REQ (msg_p).sdu_p, RRC_DCCH_DATA_REQ (msg_p).mode);
// Message buffer has been processed, free it now.
free (RRC_DCCH_DATA_REQ (msg_p).sdu_p);
itti_free (ITTI_MSG_ORIGIN_ID(msg_p), RRC_DCCH_DATA_REQ (msg_p).sdu_p);
break;
default:
......@@ -527,7 +527,7 @@ void pdcp_run (u32_t frame, u8 eNB_flag, u8 UE_index, u8 eNB_index) {
break;
}
free (msg_p);
itti_free (ITTI_MSG_ORIGIN_ID(msg_p), msg_p);
}
} while(msg_p != NULL);
#endif
......
......@@ -485,7 +485,7 @@ u8 rrc_lite_data_req(u8 Mod_id, u32 frame, u8 eNB_flag, unsigned int rb_id, u32
// Uses a new buffer to avoid issue with PDCP buffer content that could be changed by PDCP (asynchronous message handling).
u8 *message_buffer;
message_buffer = malloc (sdu_size);
message_buffer = itti_malloc (eNB_flag ? TASK_RRC_ENB : TASK_RRC_UE, sdu_size);
memcpy (message_buffer, Buffer, sdu_size);
message_p = itti_alloc_new_message (eNB_flag ? TASK_RRC_ENB : TASK_RRC_UE, RRC_DCCH_DATA_REQ);
......@@ -524,7 +524,7 @@ void rrc_lite_data_ind(module_id_t Mod_id, u32 frame, u8 eNB_flag,u32 Srb_id, u3
// Uses a new buffer to avoid issue with PDCP buffer content that could be changed by PDCP (asynchronous message handling).
u8 *message_buffer;
message_buffer = malloc (sdu_size);
message_buffer = itti_malloc (eNB_flag ? TASK_PDCP_ENB : TASK_PDCP_UE, sdu_size);
memcpy (message_buffer, Buffer, sdu_size);
message_p = itti_alloc_new_message (eNB_flag ? TASK_PDCP_ENB : TASK_PDCP_UE, RRC_DCCH_DATA_IND);
......
......@@ -273,7 +273,8 @@ void rrc_ue_generate_RRCConnectionSetupComplete(u8 Mod_id, u32 frame, u8 eNB_ind
u8 buffer[100];
u8 size;
size = do_RRCConnectionSetupComplete(buffer, Transaction_id, sizeof(nas_attach_req_guti), nas_attach_req_guti);
// size = do_RRCConnectionSetupComplete(buffer, Transaction_id, sizeof(nas_attach_req_guti), nas_attach_req_guti);
size = do_RRCConnectionSetupComplete(buffer, Transaction_id, sizeof(nas_attach_req_imsi), nas_attach_req_imsi);
LOG_I(RRC,"[UE %d][RAPROC] Frame %d : Logical Channel UL-DCCH (SRB1), Generating RRCConnectionSetupComplete (bytes%d, eNB %d)\n",
Mod_id,frame, size, eNB_index);
......@@ -2496,7 +2497,7 @@ void *rrc_ue_task(void *args_p) {
RRC_DCCH_DATA_IND (msg_p).ue_index);
// Message buffer has been processed, free it now.
free (RRC_DCCH_DATA_IND (msg_p).sdu_p);
itti_free (ITTI_MSG_ORIGIN_ID(msg_p), RRC_DCCH_DATA_IND (msg_p).sdu_p);
break;
/* NAS messages */
......@@ -2555,7 +2556,7 @@ void *rrc_ue_task(void *args_p) {
break;
}
free (msg_p);
itti_free (ITTI_MSG_ORIGIN_ID(msg_p), msg_p);
msg_p = NULL;
}
}
......
......@@ -3056,7 +3056,7 @@ void *rrc_enb_task(void *args_p) {
RRC_DCCH_DATA_IND (msg_p).sdu_size);
// Message buffer has been processed, free it now.
free (RRC_DCCH_DATA_IND (msg_p).sdu_p);
itti_free (ITTI_MSG_ORIGIN_ID(msg_p), RRC_DCCH_DATA_IND (msg_p).sdu_p);
break;
#if defined(ENABLE_USE_MME)
......@@ -3087,7 +3087,7 @@ void *rrc_enb_task(void *args_p) {
break;
}
free (msg_p);
itti_free (ITTI_MSG_ORIGIN_ID(msg_p), msg_p);
msg_p = NULL;
}
}
......
......@@ -167,6 +167,7 @@ const char* eurecomFunctionsNames[] = {
"pdcp_validate_security",
"itti_enqueue_message",
"itti_dump_enqueue_message",
"itti_dump_enqueue_message_malloc",
"test"
};
......@@ -270,11 +271,15 @@ void *vcd_dumper_thread_rt(void *args)
{
vcd_queue_user_data_t *data;
char binary_string[(sizeof (uint64_t) * BYTE_SIZE) + 1];
struct sched_param sched_param;
# if defined(ENABLE_ITTI)
signal_mask();
# endif
sched_param.sched_priority = sched_get_priority_min(SCHED_FIFO) + 1;
sched_setscheduler(0, SCHED_FIFO, &sched_param);
while(1) {
if (lfds611_queue_dequeue(vcd_queue, (void **) &data) == 0) {
/* No element -> sleep a while */
......
......@@ -138,6 +138,7 @@ typedef enum
VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_VALIDATE_SECURITY,
VCD_SIGNAL_DUMPER_FUNCTIONS_ITTI_ENQUEUE_MESSAGE,
VCD_SIGNAL_DUMPER_FUNCTIONS_ITTI_DUMP_ENQUEUE_MESSAGE,
VCD_SIGNAL_DUMPER_FUNCTIONS_ITTI_DUMP_ENQUEUE_MESSAGE_MALLOC,
VCD_SIGNAL_DUMPER_FUNCTIONS_TEST,
VCD_SIGNAL_DUMPER_FUNCTIONS_LAST,
VCD_SIGNAL_DUMPER_FUNCTIONS_END = VCD_SIGNAL_DUMPER_FUNCTIONS_LAST,
......
......@@ -81,7 +81,7 @@ typedef struct ral_lte_channel {
float pkBitrate[2];
float MTU[2];
#if ! defined(ENABLE_USE_MME)
// #if ! defined(ENABLE_USE_MME)
//IP driver parameters
u16 rbId;
u16 RadioQoSclass;
......@@ -89,7 +89,7 @@ typedef struct ral_lte_channel {
u16 dscpDL;
u16 nas_state;
u16 status;
#endif
// #endif
}ral_lte_channel_t;
/*
......
RAL_OBJS =
ifdef $(ENABLE_RAL)
RAL_OBJS += $(OPENAIR3_DIR)/RAL-LTE/INTERFACE-802.21/C/MIH_C_header_codec.o
RAL_OBJS += $(OPENAIR3_DIR)/RAL-LTE/INTERFACE-802.21/C/MIH_C_msg_codec.o
RAL_OBJS += $(OPENAIR3_DIR)/RAL-LTE/INTERFACE-802.21/C/MIH_C_primitive_codec.o
......@@ -33,8 +34,7 @@ RAL_OBJS += $(OPENAIR3_DIR)/RAL-LTE/LTE_RAL_UE/SRC/lteRALue_process.o
RAL_OBJS += $(OPENAIR3_DIR)/RAL-LTE/LTE_RAL_UE/SRC/lteRALue_rrc_msg.o
RAL_OBJS += $(OPENAIR3_DIR)/RAL-LTE/LTE_RAL_UE/SRC/lteRALue_subscribe.o
RAL_OBJS += $(OPENAIR3_DIR)/RAL-LTE/LTE_RAL_UE/SRC/lteRALue_thresholds.o
endif
EXTRA_CFLAGS += -DMIH_C_MEDIEVAL_EXTENSIONS
L2_OBJS += $(RAL_OBJS)
......
......@@ -2,7 +2,7 @@
include $(OPENAIR_TARGETS)/Makerules
default: lte-softmodem
all: lte-softmodem
all: lte-softmodem lte-enb
include $(OPENAIR_TARGETS)/Makefile.common
......@@ -19,7 +19,9 @@ endif
CFLAGS += -O2
CFLAGS += -DDRIVER2013 -I$(OPENAIR_TARGETS)/ARCH/EXMIMO/USERSPACE/LIB/ -I$(OPENAIR_TARGETS)/ARCH/EXMIMO/DEFS -DENABLE_VCD_FIFO
ifdef DEBUG
CFLAGS += -g -ggdb
endif
SRC = synctest.c condtest.c #lte-softmodem.c
ifndef RTAI
......@@ -33,20 +35,24 @@ endif
ifeq ($(RTAI),1)
CFLAGS += -DENABLE_RTAI_CLOCK
CFLAGS += -DCONFIG_RTAI_LXRT_INLINE #remend the RTAI warning
#RTAI_OBJ = sched_dlsch.o sched_ulsch.o sched_rx_pdsch.o lte-softmodem.o rt_wrapper.o
RTAI_OBJ = sched_dlsch.o sched_ulsch.o sched_rx_pdsch.o rt_wrapper.o
ifeq ($(USRP),1)
RTAI_OBJ += lte-softmodem-usrp.o
else
RTAI_OBJ += lte-softmodem.o
# RTAI_OBJ += lte-softmodem.o
# RTAI_OBJ += lte-enb.o
# RTAI_OBJ += lte-softmodem-enb.o
# RTAI_OBJ += lte-softmodem-ue.o
endif
else
#OBJ += sched_dlsch.o sched_ulsch.o sched_rx_pdsch.o lte-softmodem.o rt_wrapper.o
OBJ += sched_dlsch.o sched_ulsch.o sched_rx_pdsch.o rt_wrapper.o
ifeq ($(USRP),1)
OBJ += lte-softmodem-usrp.o
else
OBJ += lte-softmodem.o
# OBJ += lte-softmodem.o
# OBJ += lte-enb.o
# OBJ += lte-softmodem-enb.o
# OBJ += lte-softmodem-ue.o
endif
CFLAGS += -DENABLE_USE_CPU_EXECUTION_TIME
endif
......@@ -76,6 +82,7 @@ include $(OPENAIR2_DIR)/LAYER2/Makefile.inc
include $(OPENAIR2_DIR)/UTIL/Makefile.inc
include $(OPENAIR2_DIR)/RRC/NAS/Makefile.inc
include $(OPENAIR2_DIR)/ENB_APP/Makefile.inc
include $(OPENAIR3_DIR)/RAL-LTE/Makefile.inc
OBJ += $(ENB_APP_OBJS)
......@@ -176,15 +183,21 @@ SHARED_DEPENDENCIES += $(LFDS_LIB)
-include $(OBJ:.o=.d)
-include $(ASN1_MSG_OBJS1:.o=.d)
-include $(RTAI_OBJ:.o=.d)
-include lte-softmodem.d
-include lte-enb.d
$(LFDS_LIB):
@if [ ! -d $(LFDS_OBJ_DIR)/bin ]; then mkdir -p $(LFDS_OBJ_DIR)/bin; fi;
@if [ ! -d $(LFDS_OBJ_DIR)/obj ]; then mkdir -p $(LFDS_OBJ_DIR)/obj; fi;
$(MAKE) -C $(LFDS_DIR) -f makefile.linux OUTDIR=$(LFDS_OBJ_DIR)
ifeq ($(RTAI),1)
$(RTAI_OBJ) lte-enb.o lte-softmodem.o: %.o : %.c
else
$(RTAI_OBJ): %.o : %.c
endif
@echo Compiling $< ...
@$(CC) -c $(CFLAGS) $(EXTRA_CFLAGS) $(RTAI_CFLAGS) -o $@ $<
$(CC) -c $(CFLAGS) $(EXTRA_CFLAGS) $(RTAI_CFLAGS) -o $@ $<
@$(CC) -MM $(CFLAGS) $(EXTRA_CFLAGS) $(RTAI_CFLAGS) $< > $*.d
@mv -f $*.d $*.d.tmp
@sed -e 's|.*:|$*.o:|' < $*.d.tmp > $*.d
......@@ -196,7 +209,11 @@ ifdef ENABLE_ITTI
$(OBJ) $(RTAI_OBJ): $(ITTI_MESSAGES_H)
endif
ifeq ($(RTAI),1)
$(OBJ) $(ASN1_MSG_OBJS1): %.o : %.c
else
$(OBJ) $(ASN1_MSG_OBJS1) lte-enb.o lte-softmodem.o: %.o : %.c
endif
@echo Compiling $< ...
@$(CC) -c $(CFLAGS) $(EXTRA_CFLAGS) -o $@ $<
@$(CC) -MM $(CFLAGS) $(EXTRA_CFLAGS) $< > $*.d
......@@ -216,9 +233,13 @@ condtest: condtest.c
synctest: $(OBJ) $(ASN1_MSG_OBJS1) $(RTAI_OBJ)
$(CC) $(CFLAGS) $(LDFLAGS) $(OBJ) $(RTAI_OBJ) $(ASN1_MSG_OBJS1) -o synctest
lte-softmodem: $(OBJ) $(ASN1_MSG_OBJS1) $(RTAI_OBJ) $(SHARED_DEPENDENCIES)
lte-softmodem: $(OBJ) $(ASN1_MSG_OBJS1) $(RTAI_OBJ) lte-softmodem.o $(SHARED_DEPENDENCIES)
@echo Linking $@
@$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(OBJ) $(RTAI_OBJ) $(ASN1_MSG_OBJS1) lte-softmodem.o -o lte-softmodem $(LDFLAGS) $(LIBS)
lte-enb: $(OBJ) $(ASN1_MSG_OBJS1) $(RTAI_OBJ) lte-enb.o $(SHARED_DEPENDENCIES)
@echo Linking $@
@$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(OBJ) $(RTAI_OBJ) $(ASN1_MSG_OBJS1) -o lte-softmodem $(LDFLAGS) $(LIBS)
@$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(OBJ) $(RTAI_OBJ) $(ASN1_MSG_OBJS1) lte-enb.o -o lte-enb $(LDFLAGS) $(LIBS)
lte-softmodem-usrp: $(OBJ) $(ASN1_MSG_OBJS1) $(RTAI_OBJ) $(USRP_OBJ) $(SHARED_DEPENDENCIES)
@echo Linking $@
......
......@@ -87,11 +87,19 @@
#include "UTIL/MATH/oml.h"
#include "UTIL/LOG/vcd_signal_dumper.h"
#if defined(ENABLE_ITTI)
# include "intertask_interface_init.h"
# include "create_tasks.h"
# if defined(ENABLE_USE_MME)
# include "s1ap_eNB.h"
# endif
#endif
#ifdef XFORMS
#include "PHY/TOOLS/lte_phy_scope.h"
#include "stats.h"
// current status is that every UE has a DL scope for a SINGLE eNB (eNB_id=0)
// at eNB 0, an UL scope for every UE
// at eNB 0, an UL scope for every UE
FD_lte_phy_scope_ue *form_ue[NUMBER_OF_UE_MAX];
FD_lte_phy_scope_enb *form_enb[NUMBER_OF_UE_MAX];
FD_stats_form *form_stats=NULL;
......@@ -136,7 +144,10 @@ exmimo_config_t *p_exmimo_config;
exmimo_id_t *p_exmimo_id;
volatile unsigned int *DAQ_MBOX;
int oai_exit = 0;
#if defined(ENABLE_ITTI)
volatile int start_eNB = 0;
#endif
volatile int oai_exit = 0;
int oai_flag = 0;
//int time_offset[4] = {-138,-138,-138,-138};
......@@ -178,7 +189,8 @@ void cleanup_ulsch_threads(void);
LTE_DL_FRAME_PARMS *frame_parms;
void setup_eNB_buffers(PHY_VARS_eNB *phy_vars_eNB, LTE_DL_FRAME_PARMS *frame_parms, int carrier);
void setup_eNB_buffers(PHY_VARS_eNB *phy_vars_eNB,
LTE_DL_FRAME_PARMS *frame_parms, int carrier);
void signal_handler(int sig)
{
......@@ -188,41 +200,45 @@ void signal_handler(int sig)
if (sig==SIGSEGV) {
// get void*'s for all entries on the stack
size = backtrace(array, 10);
// print out all the frames to stderr
fprintf(stderr, "Error: signal %d:\n", sig);
backtrace_symbols_fd(array, size, 2);
exit(-1);
}
else {
} else {
oai_exit=1;
}
}
void exit_fun(const char* s)
void exit_fun(const char *s)
{
void *array[10];
size_t size;
printf("Exiting: %s\n",s);
if (s != NULL) {
printf("Exiting: %s\n",s);
}
oai_exit=1;
#if defined(ENABLE_ITTI)
itti_send_terminate_message (TASK_UNKNOWN);
#endif
//rt_sleep_ns(FRAME_PERIOD);
//exit (-1);
}
#ifdef XFORMS
void *scope_thread(void *arg) {
void *scope_thread(void *arg)
{
s16 prach_corr[1024], i;
char stats_buffer[16384];
//FILE *UE_stats, *eNB_stats;
int len=0;
/*
if (UE_flag==1)
if (UE_flag==1)
UE_stats = fopen("UE_stats.txt", "w");
else
else
eNB_stats = fopen("eNB_stats.txt", "w");