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 @@ ...@@ -37,10 +37,6 @@
#include <errno.h> #include <errno.h>
#include <signal.h> #include <signal.h>
#ifdef RTAI
# include <rtai_fifos.h>
#endif
#include "assertions.h" #include "assertions.h"
#include <sys/epoll.h> #include <sys/epoll.h>
...@@ -50,6 +46,10 @@ ...@@ -50,6 +46,10 @@
#include "intertask_interface.h" #include "intertask_interface.h"
#include "intertask_interface_dump.h" #include "intertask_interface_dump.h"
#ifdef RTAI
# include <rtai_shm.h>
#endif
#if defined(OAI_EMU) || defined(RTAI) #if defined(OAI_EMU) || defined(RTAI)
# include "vcd_signal_dumper.h" # include "vcd_signal_dumper.h"
#endif #endif
...@@ -87,6 +87,11 @@ const int itti_debug_poll = 0; ...@@ -87,6 +87,11 @@ const int itti_debug_poll = 0;
# define KERNEL_VERSION_PRE_2_6_30 1 # define KERNEL_VERSION_PRE_2_6_30 1
#endif #endif
#ifdef RTAI
# define ITTI_MEM_PAGE_SIZE (1024)
# define ITTI_MEM_SIZE (16 * 1024 * 1024)
#endif
typedef enum task_state_s { typedef enum task_state_s {
TASK_STATE_NOT_CONFIGURED, TASK_STATE_STARTING, TASK_STATE_READY, TASK_STATE_ENDED, TASK_STATE_MAX, TASK_STATE_NOT_CONFIGURED, TASK_STATE_STARTING, TASK_STATE_READY, TASK_STATE_ENDED, TASK_STATE_MAX,
} task_state_t; } task_state_t;
...@@ -174,6 +179,32 @@ typedef struct itti_desc_s { ...@@ -174,6 +179,32 @@ typedef struct itti_desc_s {
static itti_desc_t itti_desc; 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) { static inline message_number_t itti_increment_message_number(void) {
/* Atomic operation supported by GCC: returns the current message number /* Atomic operation supported by GCC: returns the current message number
* and then increment it by 1. * and then increment it by 1.
...@@ -227,6 +258,7 @@ void itti_update_lte_time(uint32_t frame, uint8_t slot) ...@@ -227,6 +258,7 @@ void itti_update_lte_time(uint32_t frame, uint8_t slot)
int itti_send_broadcast_message(MessageDef *message_p) { int itti_send_broadcast_message(MessageDef *message_p) {
task_id_t destination_task_id; task_id_t destination_task_id;
task_id_t origin_task_id;
thread_id_t origin_thread_id; thread_id_t origin_thread_id;
uint32_t thread_id; uint32_t thread_id;
int ret = 0; int ret = 0;
...@@ -234,7 +266,8 @@ int itti_send_broadcast_message(MessageDef *message_p) { ...@@ -234,7 +266,8 @@ int itti_send_broadcast_message(MessageDef *message_p) {
DevAssert(message_p != NULL); 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; destination_task_id = TASK_FIRST;
for (thread_id = THREAD_FIRST; thread_id < itti_desc.thread_max; thread_id++) { 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) { ...@@ -248,7 +281,7 @@ int itti_send_broadcast_message(MessageDef *message_p) {
if (thread_id != origin_thread_id) { if (thread_id != origin_thread_id) {
/* Skip tasks which are not running */ /* Skip tasks which are not running */
if (itti_desc.threads[thread_id].task_state == TASK_STATE_READY) { 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); DevAssert(message_p != NULL);
memcpy (new_message_p, message_p, sizeof(MessageDef)); 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 ...@@ -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(); 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); DevAssert(temp != NULL);
temp->ittiMsgHeader.messageId = message_id; 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 ...@@ -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 */ /* Increment the global message number */
message_number = itti_increment_message_number (); message_number = itti_increment_message_number ();
/* itti_dump_queue_message (origin_task_id, message_number, message, itti_desc.messages_info[message_id].name,
*
#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,
sizeof(MessageHeader) + message->ittiMsgHeader.ittiMsgSize); sizeof(MessageHeader) + message->ittiMsgHeader.ittiMsgSize);
if (destination_task_id != TASK_UNKNOWN) 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 ...@@ -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); itti_desc.threads[destination_thread_id].task_state, message_id);
/* Allocate new list element */ /* 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); DevAssert(new != NULL);
/* Fill in members */ /* Fill in members */
...@@ -552,7 +576,7 @@ static inline void itti_receive_msg_internal_event_fd(task_id_t task_id, uint8_t ...@@ -552,7 +576,7 @@ static inline void itti_receive_msg_internal_event_fd(task_id_t task_id, uint8_t
} }
DevAssert(message != NULL); DevAssert(message != NULL);
*received_msg = message->msg; *received_msg = message->msg;
free (message); itti_free (ITTI_MSG_ORIGIN_ID(*received_msg), message);
return; return;
} }
} }
...@@ -659,6 +683,12 @@ void itti_mark_task_ready(task_id_t task_id) ...@@ -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); 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 #ifdef RTAI
/* Assign low priority to created threads */ /* Assign low priority to created threads */
{ {
...@@ -668,12 +698,6 @@ void itti_mark_task_ready(task_id_t task_id) ...@@ -668,12 +698,6 @@ void itti_mark_task_ready(task_id_t task_id)
} }
#endif #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; 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 ...@@ -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); ITTI_ERROR("lfds611_queue_new failed for task %u\n", task_id);
DevAssert(0 == 1); DevAssert(0 == 1);
} }
# ifdef RTAI
if (task_id == TASK_L2L1)
{
ret = rtf_sem_init(56, 0);
}
# endif
} }
/* Initializing each thread */ /* Initializing each thread */
...@@ -844,6 +861,8 @@ int itti_init(task_id_t task_max, thread_id_t thread_max, MessagesIds messages_i ...@@ -844,6 +861,8 @@ int itti_init(task_id_t task_max, thread_id_t thread_max, MessagesIds messages_i
#ifdef RTAI #ifdef RTAI
/* Start RT relay thread */ /* Start RT relay thread */
DevAssert(pthread_create (&itti_desc.rt_relay_thread, NULL, itti_rt_relay_thread, NULL) >= 0); DevAssert(pthread_create (&itti_desc.rt_relay_thread, NULL, itti_rt_relay_thread, NULL) >= 0);
rt_global_heap_open();
#endif #endif
#if defined(OAI_EMU) || defined(RTAI) #if defined(OAI_EMU) || defined(RTAI)
......
...@@ -225,5 +225,9 @@ void itti_wait_tasks_end(void); ...@@ -225,5 +225,9 @@ void itti_wait_tasks_end(void);
**/ **/
void itti_send_terminate_message(task_id_t task_id); 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_ */ #endif /* INTERTASK_INTERFACE_H_ */
/* @} */ /* @} */
...@@ -90,7 +90,7 @@ static const int itti_dump_debug = 0; ...@@ -90,7 +90,7 @@ static const int itti_dump_debug = 0;
#define ITTI_DUMP_EXIT_SIGNAL 0x4 #define ITTI_DUMP_EXIT_SIGNAL 0x4
typedef struct itti_dump_queue_item_s { typedef struct itti_dump_queue_item_s {
void *data; MessageDef *data;
uint32_t data_size; uint32_t data_size;
uint32_t message_number; uint32_t message_number;
char message_name[SIGNAL_NAME_LENGTH]; char message_name[SIGNAL_NAME_LENGTH];
...@@ -215,6 +215,9 @@ static void itti_dump_fwrite_message(itti_dump_queue_item_t *message) ...@@ -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_number, sizeof(message->message_number), 1, dump_file);
fwrite (message->message_name, sizeof(message->message_name), 1, dump_file); fwrite (message->message_name, sizeof(message->message_name), 1, dump_file);
fwrite (message->data, message->data_size, 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 ...@@ -303,7 +306,8 @@ static int itti_dump_enqueue_message(itti_dump_queue_item_t *new, uint32_t messa
return 0; 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, MessageDef *message_p,
const char *message_name, const char *message_name,
const uint32_t message_size) const uint32_t message_size)
...@@ -316,21 +320,22 @@ int itti_dump_queue_message(message_number_t message_number, ...@@ -316,21 +320,22 @@ int itti_dump_queue_message(message_number_t message_number,
DevAssert(message_name != NULL); DevAssert(message_name != NULL);
DevAssert(message_p != NULL); DevAssert(message_p != NULL);
new = malloc(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_IN);
if (new == NULL) { #endif
ITTI_DUMP_ERROR("Failed to allocate memory (%s:%d)\n", new = itti_malloc(sender_task, sizeof(itti_dump_queue_item_t));
__FILE__, __LINE__); #if defined(OAI_EMU) || defined(RTAI)
return -1; 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); memcpy(new->data, message_p, message_size);
new->data_size = message_size; new->data_size = message_size;
new->message_number = message_number; new->message_number = message_number;
...@@ -764,13 +769,16 @@ static void itti_dump_user_data_delete_function(void *user_data, void *user_stat ...@@ -764,13 +769,16 @@ static void itti_dump_user_data_delete_function(void *user_data, void *user_stat
if (user_data != NULL) if (user_data != NULL)
{ {
itti_dump_queue_item_t *item; itti_dump_queue_item_t *item;
task_id_t task_id;
item = (itti_dump_queue_item_t *)user_data; item = (itti_dump_queue_item_t *)user_data;
task_id = ITTI_MSG_ORIGIN_ID(item->data);
if (item->data != NULL) if (item->data != NULL)
{ {
free(item->data); itti_free(task_id, item->data);
} }
free(item); itti_free(task_id, item);
} }
} }
......
...@@ -31,13 +31,9 @@ ...@@ -31,13 +31,9 @@
#ifndef INTERTASK_INTERFACE_DUMP_H_ #ifndef INTERTASK_INTERFACE_DUMP_H_
#define 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); 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); int itti_dump_init(const char * const messages_definition_xml, const char * const dump_file_name);
void itti_dump_exit(void); void itti_dump_exit(void);
......
...@@ -76,7 +76,7 @@ void *nas_ue_task(void *args_p) { ...@@ -76,7 +76,7 @@ void *nas_ue_task(void *args_p) {
break; break;
} }
free (msg_p); itti_free (ITTI_MSG_ORIGIN_ID(msg_p), msg_p);
msg_p = NULL; msg_p = NULL;
} }
} }
......
...@@ -288,7 +288,7 @@ void *s1ap_eNB_task(void *arg) ...@@ -288,7 +288,7 @@ void *s1ap_eNB_task(void *arg)
break; break;
} }
free(received_msg); itti_free (ITTI_MSG_ORIGIN_ID(received_msg), received_msg);
received_msg = NULL; received_msg = NULL;
} }
......
...@@ -25,7 +25,7 @@ void lte_adjust_synch(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -25,7 +25,7 @@ void lte_adjust_synch(LTE_DL_FRAME_PARMS *frame_parms,
{ {
static int max_pos_fil = 0; 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; int diff;
short Re,Im,ncoef; short Re,Im,ncoef;
...@@ -73,7 +73,8 @@ void lte_adjust_synch(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -73,7 +73,8 @@ void lte_adjust_synch(LTE_DL_FRAME_PARMS *frame_parms,
#ifdef DEBUG_PHY #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 #endif //DEBUG_PHY
#ifdef CBMIMO1 #ifdef CBMIMO1
......
...@@ -250,7 +250,7 @@ void *eNB_app_task(void *args_p) ...@@ -250,7 +250,7 @@ void *eNB_app_task(void *args_p)
break; break;
} }
free (msg_p); itti_free (ITTI_MSG_ORIGIN_ID(msg_p), msg_p);
} while (1); } while (1);
#endif #endif
......
...@@ -4281,7 +4281,7 @@ void eNB_dlsch_ulsch_scheduler(u8 Mod_id,u8 cooperation_flag, u32 frame, u8 subf ...@@ -4281,7 +4281,7 @@ void eNB_dlsch_ulsch_scheduler(u8 Mod_id,u8 cooperation_flag, u32 frame, u8 subf
break; break;
} }
free (msg_p); itti_free (ITTI_MSG_ORIGIN_ID(msg_p), msg_p);
} }
} while(msg_p != NULL); } while(msg_p != NULL);
#endif #endif
......
...@@ -1310,7 +1310,7 @@ UE_L2_STATE_t ue_scheduler(u8 Mod_id,u32 frame, u8 subframe, lte_subframe_t dire ...@@ -1310,7 +1310,7 @@ UE_L2_STATE_t ue_scheduler(u8 Mod_id,u32 frame, u8 subframe, lte_subframe_t dire
break; break;
} }
free (msg_p); itti_free (ITTI_MSG_ORIGIN_ID(msg_p), msg_p);
} }
} while(msg_p != NULL); } while(msg_p != NULL);
#endif #endif
......
...@@ -519,7 +519,7 @@ void pdcp_run (u32_t frame, u8 eNB_flag, u8 UE_index, u8 eNB_index) { ...@@ -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); RRC_DCCH_DATA_REQ (msg_p).sdu_p, RRC_DCCH_DATA_REQ (msg_p).mode);
// Message buffer has been processed, free it now. // 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; break;
default: default:
...@@ -527,7 +527,7 @@ void pdcp_run (u32_t frame, u8 eNB_flag, u8 UE_index, u8 eNB_index) { ...@@ -527,7 +527,7 @@ void pdcp_run (u32_t frame, u8 eNB_flag, u8 UE_index, u8 eNB_index) {
break; break;
} }
free (msg_p); itti_free (ITTI_MSG_ORIGIN_ID(msg_p), msg_p);
} }
} while(msg_p != NULL); } while(msg_p != NULL);
#endif #endif
......
...@@ -485,7 +485,7 @@ u8 rrc_lite_data_req(u8 Mod_id, u32 frame, u8 eNB_flag, unsigned int rb_id, u32 ...@@ -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). // Uses a new buffer to avoid issue with PDCP buffer content that could be changed by PDCP (asynchronous message handling).
u8 *message_buffer; 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); memcpy (message_buffer, Buffer, sdu_size);
message_p = itti_alloc_new_message (eNB_flag ? TASK_RRC_ENB : TASK_RRC_UE, RRC_DCCH_DATA_REQ); 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 ...@@ -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). // Uses a new buffer to avoid issue with PDCP buffer content that could be changed by PDCP (asynchronous message handling).
u8 *message_buffer; 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); memcpy (message_buffer, Buffer, sdu_size);
message_p = itti_alloc_new_message (eNB_flag ? TASK_PDCP_ENB : TASK_PDCP_UE, RRC_DCCH_DATA_IND); 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 ...@@ -273,7 +273,8 @@ void rrc_ue_generate_RRCConnectionSetupComplete(u8 Mod_id, u32 frame, u8 eNB_ind
u8 buffer[100]; u8 buffer[100];
u8 size; 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", 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); Mod_id,frame, size, eNB_index);
...@@ -2496,7 +2497,7 @@ void *rrc_ue_task(void *args_p) { ...@@ -2496,7 +2497,7 @@ void *rrc_ue_task(void *args_p) {
RRC_DCCH_DATA_IND (msg_p).ue_index); RRC_DCCH_DATA_IND (msg_p).ue_index);
// Message buffer has been processed, free it now. // 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; break;
/* NAS messages */ /* NAS messages */
...@@ -2555,7 +2556,7 @@ void *rrc_ue_task(void *args_p) { ...@@ -2555,7 +2556,7 @@ void *rrc_ue_task(void *args_p) {
break; break;
} }
free (msg_p); itti_free (ITTI_MSG_ORIGIN_ID(msg_p), msg_p);
msg_p = NULL; msg_p = NULL;
} }
} }
......
...@@ -3056,7 +3056,7 @@ void *rrc_enb_task(void *args_p) { ...@@ -3056,7 +3056,7 @@ void *rrc_enb_task(void *args_p) {
RRC_DCCH_DATA_IND (msg_p).sdu_size); RRC_DCCH_DATA_IND (msg_p).sdu_size);
// Message buffer has been processed, free it now. // 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; break;
#if defined(ENABLE_USE_MME) #if defined(ENABLE_USE_MME)
...@@ -3087,7 +3087,7 @@ void *rrc_enb_task(void *args_p) { ...@@ -3087,7 +3087,7 @@ void *rrc_enb_task(void *args_p) {
break; break;
} }
free (msg_p); itti_free (ITTI_MSG_ORIGIN_ID(msg_p), msg_p);
msg_p = NULL; msg_p = NULL;
} }
} }
......
...@@ -167,6 +167,7 @@ const char* eurecomFunctionsNames[] = { ...@@ -167,6 +167,7 @@ const char* eurecomFunctionsNames[] = {
"pdcp_validate_security", "pdcp_validate_security",
"itti_enqueue_message", "itti_enqueue_message",
"itti_dump_enqueue_message", "itti_dump_enqueue_message",
"itti_dump_enqueue_message_malloc",
"test" "test"
}; };
...@@ -270,11 +271,15 @@ void *vcd_dumper_thread_rt(void *args) ...@@ -270,11 +271,15 @@ void *vcd_dumper_thread_rt(void *args)
{ {
vcd_queue_user_data_t *data; vcd_queue_user_data_t *data;
char binary_string[(sizeof (uint64_t) * BYTE_SIZE) + 1]; char binary_string[(sizeof (uint64_t) * BYTE_SIZE) + 1];
struct sched_param sched_param;
# if defined(ENABLE_ITTI) # if defined(ENABLE_ITTI)
signal_mask(); signal_mask();
# endif # endif
sched_param.sched_priority = sched_get_priority_min(SCHED_FIFO) + 1;
sched_setscheduler(0, SCHED_FIFO, &sched_param);
while(1) { while(1) {
if (lfds611_queue_dequeue(vcd_queue, (void **) &data) == 0) { if (lfds611_queue_dequeue(vcd_queue, (void **) &data) == 0) {
/* No element -> sleep a while */ /* No element -> sleep a while */
......
...@@ -138,6 +138,7 @@ typedef enum ...@@ -138,6 +138,7 @@ typedef enum
VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_VALIDATE_SECURITY, VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_VALIDATE_SECURITY,
VCD_SIGNAL_DUMPER_FUNCTIONS_ITTI_ENQUEUE_MESSAGE, VCD_SIGNAL_DUMPER_FUNCTIONS_ITTI_ENQUEUE_MESSAGE,
VCD_SIGNAL_DUMPER_FUNCTIONS_ITTI_DUMP_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_TEST,
VCD_SIGNAL_DUMPER_FUNCTIONS_LAST, VCD_SIGNAL_DUMPER_FUNCTIONS_LAST,
VCD_SIGNAL_DUMPER_FUNCTIONS_END = VCD_SIGNAL_DUMPER_FUNCTIONS_LAST, VCD_SIGNAL_DUMPER_FUNCTIONS_END = VCD_SIGNAL_DUMPER_FUNCTIONS_LAST,
......
...@@ -81,7 +81,7 @@ typedef struct ral_lte_channel { ...@@ -81,7 +81,7 @@ typedef struct ral_lte_channel {
float pkBitrate[2]; float pkBitrate[2];
float MTU[2]; float MTU[2];
#if ! defined(ENABLE_USE_MME) // #if ! defined(ENABLE_USE_MME)
//IP driver parameters //IP driver parameters
u16 rbId; u16 rbId;
u16 RadioQoSclass; u16 RadioQoSclass;
...@@ -89,7 +89,7 @@ typedef struct ral_lte_channel { ...@@ -89,7 +89,7 @@ typedef struct ral_lte_channel {
u16 dscpDL; u16 dscpDL;
u16 nas_state; u16 nas_state;
u16 status; u16 status;
#endif // #endif
}ral_lte_channel_t; }ral_lte_channel_t;
/* /*
......
RAL_OBJS = 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_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_msg_codec.o
RAL_OBJS += $(OPENAIR3_DIR)/RAL-LTE/INTERFACE-802.21/C/MIH_C_primitive_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 ...@@ -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_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_subscribe.o
RAL_OBJS += $(OPENAIR3_DIR)/RAL-LTE/LTE_RAL_UE/SRC/lteRALue_thresholds.o RAL_OBJS += $(OPENAIR3_DIR)/RAL-LTE/LTE_RAL_UE/SRC/lteRALue_thresholds.o
endif
EXTRA_CFLAGS += -DMIH_C_MEDIEVAL_EXTENSIONS EXTRA_CFLAGS += -DMIH_C_MEDIEVAL_EXTENSIONS
L2_OBJS += $(RAL_OBJS) L2_OBJS += $(RAL_OBJS)
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
include $(OPENAIR_TARGETS)/Makerules include $(OPENAIR_TARGETS)/Makerules
default: lte-softmodem default: lte-softmodem
all: lte-softmodem all: lte-softmodem lte-enb
include $(OPENAIR_TARGETS)/Makefile.common include $(OPENAIR_TARGETS)/Makefile.common
...@@ -19,7 +19,9 @@ endif ...@@ -19,7 +19,9 @@ endif
CFLAGS += -O2 CFLAGS += -O2
CFLAGS += -DDRIVER2013 -I$(OPENAIR_TARGETS)/ARCH/EXMIMO/USERSPACE/LIB/ -I$(OPENAIR_TARGETS)/ARCH/EXMIMO/DEFS -DENABLE_VCD_FIFO 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 SRC = synctest.c condtest.c #lte-softmodem.c
ifndef RTAI ifndef RTAI
...@@ -33,20 +35,24 @@ endif ...@@ -33,20 +35,24 @@ endif
ifeq ($(RTAI),1) ifeq ($(RTAI),1)
CFLAGS += -DENABLE_RTAI_CLOCK CFLAGS += -DENABLE_RTAI_CLOCK
CFLAGS += -DCONFIG_RTAI_LXRT_INLINE #remend the RTAI warning 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 RTAI_OBJ = sched_dlsch.o sched_ulsch.o sched_rx_pdsch.o rt_wrapper.o
ifeq ($(USRP),1) ifeq ($(USRP),1)
RTAI_OBJ += lte-softmodem-usrp.o RTAI_OBJ += lte-softmodem-usrp.o
else 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 endif
else 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 OBJ += sched_dlsch.o sched_ulsch.o sched_rx_pdsch.o rt_wrapper.o
ifeq ($(USRP),1) ifeq ($(USRP),1)
OBJ += lte-softmodem-usrp.o OBJ += lte-softmodem-usrp.o
else else
OBJ += lte-softmodem.o # OBJ += lte-softmodem.o
# OBJ += lte-enb.o
# OBJ += lte-softmodem-enb.o
# OBJ += lte-softmodem-ue.o
endif endif
CFLAGS += -DENABLE_USE_CPU_EXECUTION_TIME CFLAGS += -DENABLE_USE_CPU_EXECUTION_TIME
endif endif
...@@ -76,6 +82,7 @@ include $(OPENAIR2_DIR)/LAYER2/Makefile.inc ...@@ -76,6 +82,7 @@ include $(OPENAIR2_DIR)/LAYER2/Makefile.inc
include $(OPENAIR2_DIR)/UTIL/Makefile.inc include $(OPENAIR2_DIR)/UTIL/Makefile.inc
include $(OPENAIR2_DIR)/RRC/NAS/Makefile.inc include $(OPENAIR2_DIR)/RRC/NAS/Makefile.inc
include $(OPENAIR2_DIR)/ENB_APP/Makefile.inc include $(OPENAIR2_DIR)/ENB_APP/Makefile.inc
include $(OPENAIR3_DIR)/RAL-LTE/Makefile.inc
OBJ += $(ENB_APP_OBJS) OBJ += $(ENB_APP_OBJS)
...@@ -176,15 +183,21 @@ SHARED_DEPENDENCIES += $(LFDS_LIB) ...@@ -176,15 +183,21 @@ SHARED_DEPENDENCIES += $(LFDS_LIB)
-include $(OBJ:.o=.d) -include $(OBJ:.o=.d)
-include $(ASN1_MSG_OBJS1:.o=.d) -include $(ASN1_MSG_OBJS1:.o=.d)
-include $(RTAI_OBJ:.o=.d) -include $(RTAI_OBJ:.o=.d)
-include lte-softmodem.d
-include lte-enb.d
$(LFDS_LIB): $(LFDS_LIB):
@if [ ! -d $(LFDS_OBJ_DIR)/bin ]; then mkdir -p $(LFDS_OBJ_DIR)/bin; fi; @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; @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) $(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 $(RTAI_OBJ): %.o : %.c
endif
@echo Compiling $< ... @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 @$(CC) -MM $(CFLAGS) $(EXTRA_CFLAGS) $(RTAI_CFLAGS) $< > $*.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
...@@ -196,7 +209,11 @@ ifdef ENABLE_ITTI ...@@ -196,7 +209,11 @@ ifdef ENABLE_ITTI
$(OBJ) $(RTAI_OBJ): $(ITTI_MESSAGES_H) $(OBJ) $(RTAI_OBJ): $(ITTI_MESSAGES_H)
endif endif
ifeq ($(RTAI),1)
$(OBJ) $(ASN1_MSG_OBJS1): %.o : %.c $(OBJ) $(ASN1_MSG_OBJS1): %.o : %.c
else
$(OBJ) $(ASN1_MSG_OBJS1) lte-enb.o lte-softmodem.o: %.o : %.c
endif
@echo Compiling $< ... @echo Compiling $< ...
@$(CC) -c $(CFLAGS) $(EXTRA_CFLAGS) -o $@ $< @$(CC) -c $(CFLAGS) $(EXTRA_CFLAGS) -o $@ $<
@$(CC) -MM $(CFLAGS) $(EXTRA_CFLAGS) $< > $*.d @$(CC) -MM $(CFLAGS) $(EXTRA_CFLAGS) $< > $*.d
...@@ -216,9 +233,13 @@ condtest: condtest.c ...@@ -216,9 +233,13 @@ condtest: condtest.c
synctest: $(OBJ) $(ASN1_MSG_OBJS1) $(RTAI_OBJ) synctest: $(OBJ) $(ASN1_MSG_OBJS1) $(RTAI_OBJ)
$(CC) $(CFLAGS) $(LDFLAGS) $(OBJ) $(RTAI_OBJ) $(ASN1_MSG_OBJS1) -o synctest $(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 $@ @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) lte-softmodem-usrp: $(OBJ) $(ASN1_MSG_OBJS1) $(RTAI_OBJ) $(USRP_OBJ) $(SHARED_DEPENDENCIES)
@echo Linking $@ @echo Linking $@
......
This diff is collapsed.
...@@ -483,7 +483,7 @@ void *l2l1_task(void *arg) ...@@ -483,7 +483,7 @@ void *l2l1_task(void *arg)
/* Wait for the initialize message */ /* Wait for the initialize message */
do { do {
if (message_p != NULL) { if (message_p != NULL) {
free (message_p); itti_free (ITTI_MSG_ORIGIN_ID(message_p), message_p);
} }
itti_receive_msg (TASK_L2L1, &message_p); itti_receive_msg (TASK_L2L1, &message_p);
...@@ -503,7 +503,7 @@ void *l2l1_task(void *arg) ...@@ -503,7 +503,7 @@ void *l2l1_task(void *arg)
break; break;
} }
} while (ITTI_MSG_ID(message_p) != INITIALIZE_MESSAGE); } while (ITTI_MSG_ID(message_p) != INITIALIZE_MESSAGE);
free (message_p); itti_free (ITTI_MSG_ORIGIN_ID(message_p), message_p);
} }
do { do {
...@@ -525,7 +525,7 @@ void *l2l1_task(void *arg) ...@@ -525,7 +525,7 @@ void *l2l1_task(void *arg)
break; break;
} }
free (message_p); itti_free (ITTI_MSG_ORIGIN_ID(message_p), message_p);
} while(1); } while(1);
return NULL; return NULL;
......
...@@ -470,7 +470,7 @@ void *l2l1_task(void *args_p) { ...@@ -470,7 +470,7 @@ void *l2l1_task(void *args_p) {
/* Wait for the initialize message */ /* Wait for the initialize message */
do { do {
if (message_p != NULL) { if (message_p != NULL) {
free (message_p); itti_free (ITTI_MSG_ORIGIN_ID(message_p), message_p);
} }
itti_receive_msg (TASK_L2L1, &message_p); itti_receive_msg (TASK_L2L1, &message_p);
...@@ -487,7 +487,7 @@ void *l2l1_task(void *args_p) { ...@@ -487,7 +487,7 @@ void *l2l1_task(void *args_p) {
break; break;
} }
} while (ITTI_MSG_ID(message_p) != INITIALIZE_MESSAGE); } while (ITTI_MSG_ID(message_p) != INITIALIZE_MESSAGE);
free (message_p); itti_free (ITTI_MSG_ORIGIN_ID(message_p), message_p);
} }
#endif #endif
...@@ -513,7 +513,7 @@ void *l2l1_task(void *args_p) { ...@@ -513,7 +513,7 @@ void *l2l1_task(void *args_p) {
break; break;
} }
free (message_p); itti_free (ITTI_MSG_ORIGIN_ID(message_p), message_p);
} }
} while(message_p != NULL); } while(message_p != NULL);
#endif #endif
......
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