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 $@
......
...@@ -87,6 +87,14 @@ ...@@ -87,6 +87,14 @@
#include "UTIL/MATH/oml.h" #include "UTIL/MATH/oml.h"
#include "UTIL/LOG/vcd_signal_dumper.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 #ifdef XFORMS
#include "PHY/TOOLS/lte_phy_scope.h" #include "PHY/TOOLS/lte_phy_scope.h"
#include "stats.h" #include "stats.h"
...@@ -136,7 +144,10 @@ exmimo_config_t *p_exmimo_config; ...@@ -136,7 +144,10 @@ exmimo_config_t *p_exmimo_config;
exmimo_id_t *p_exmimo_id; exmimo_id_t *p_exmimo_id;
volatile unsigned int *DAQ_MBOX; 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 oai_flag = 0;
//int time_offset[4] = {-138,-138,-138,-138}; //int time_offset[4] = {-138,-138,-138,-138};
...@@ -178,7 +189,8 @@ void cleanup_ulsch_threads(void); ...@@ -178,7 +189,8 @@ void cleanup_ulsch_threads(void);
LTE_DL_FRAME_PARMS *frame_parms; 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) void signal_handler(int sig)
{ {
...@@ -193,27 +205,31 @@ void signal_handler(int sig) ...@@ -193,27 +205,31 @@ void signal_handler(int sig)
fprintf(stderr, "Error: signal %d:\n", sig); fprintf(stderr, "Error: signal %d:\n", sig);
backtrace_symbols_fd(array, size, 2); backtrace_symbols_fd(array, size, 2);
exit(-1); exit(-1);
} } else {
else {
oai_exit=1; oai_exit=1;
} }
} }
void exit_fun(const char* s) void exit_fun(const char *s)
{ {
void *array[10]; if (s != NULL) {
size_t size;
printf("Exiting: %s\n",s); printf("Exiting: %s\n",s);
}
oai_exit=1; oai_exit=1;
#if defined(ENABLE_ITTI)
itti_send_terminate_message (TASK_UNKNOWN);
#endif
//rt_sleep_ns(FRAME_PERIOD); //rt_sleep_ns(FRAME_PERIOD);
//exit (-1); //exit (-1);
} }
#ifdef XFORMS #ifdef XFORMS
void *scope_thread(void *arg) { void *scope_thread(void *arg)
{
s16 prach_corr[1024], i; s16 prach_corr[1024], i;
char stats_buffer[16384]; char stats_buffer[16384];
//FILE *UE_stats, *eNB_stats; //FILE *UE_stats, *eNB_stats;
...@@ -231,7 +247,7 @@ void *scope_thread(void *arg) { ...@@ -231,7 +247,7 @@ void *scope_thread(void *arg) {
fl_set_object_label(form_stats->stats_text, stats_buffer); fl_set_object_label(form_stats->stats_text, stats_buffer);
//rewind (eNB_stats); //rewind (eNB_stats);
//fwrite (stats_buffer, 1, len, eNB_stats); //fwrite (stats_buffer, 1, len, eNB_stats);
for(UE_id=0;UE_id<scope_enb_num_ue;UE_id++) { for(UE_id=0; UE_id<scope_enb_num_ue; UE_id++) {
phy_scope_eNB(form_enb[UE_id], phy_scope_eNB(form_enb[UE_id],
PHY_vars_eNB_g[eNB_id], PHY_vars_eNB_g[eNB_id],
UE_id); UE_id);
...@@ -244,15 +260,17 @@ void *scope_thread(void *arg) { ...@@ -244,15 +260,17 @@ void *scope_thread(void *arg) {
//fclose (UE_stats); //fclose (UE_stats);
//fclose (eNB_stats); //fclose (eNB_stats);
pthread_exit((void*)arg); pthread_exit((void *)arg);
} }
#endif #endif
void do_OFDM_mod(mod_sym_t **txdataF, s32 **txdata, u16 next_slot, LTE_DL_FRAME_PARMS *frame_parms) void do_OFDM_mod(mod_sym_t **txdataF, s32 **txdata, u16 next_slot,
LTE_DL_FRAME_PARMS *frame_parms)
{ {
int aa, slot_offset, slot_offset_F; int aa, slot_offset, slot_offset_F;
slot_offset_F = (next_slot)*(frame_parms->ofdm_symbol_size)*((frame_parms->Ncp == EXTENDED) ? 6 : 7); slot_offset_F = (next_slot)*(frame_parms->ofdm_symbol_size)*((
frame_parms->Ncp == EXTENDED) ? 6 : 7);
slot_offset = (next_slot)*(frame_parms->samples_per_tti>>1); slot_offset = (next_slot)*(frame_parms->samples_per_tti>>1);
for (aa = 0; aa < frame_parms->nb_antennas_tx; aa++) { for (aa = 0; aa < frame_parms->nb_antennas_tx; aa++) {
...@@ -265,8 +283,7 @@ void do_OFDM_mod(mod_sym_t **txdataF, s32 **txdata, u16 next_slot, LTE_DL_FRAME_ ...@@ -265,8 +283,7 @@ void do_OFDM_mod(mod_sym_t **txdataF, s32 **txdata, u16 next_slot, LTE_DL_FRAME_
frame_parms->twiddle_fft, frame_parms->twiddle_fft,
frame_parms->rev, frame_parms->rev,
CYCLIC_PREFIX); CYCLIC_PREFIX);
} } else {
else {
normal_prefix_mod(&txdataF[aa][slot_offset_F], normal_prefix_mod(&txdataF[aa][slot_offset_F],
&txdata[aa][slot_offset], &txdata[aa][slot_offset],
7, 7,
...@@ -277,6 +294,67 @@ void do_OFDM_mod(mod_sym_t **txdataF, s32 **txdata, u16 next_slot, LTE_DL_FRAME_ ...@@ -277,6 +294,67 @@ void do_OFDM_mod(mod_sym_t **txdataF, s32 **txdata, u16 next_slot, LTE_DL_FRAME_
int dummy_tx_buffer[3840*4] __attribute__((aligned(16))); int dummy_tx_buffer[3840*4] __attribute__((aligned(16)));
#if defined(ENABLE_ITTI)
void *l2l1_task(void *arg)
{
MessageDef *message_p = NULL;
itti_set_task_real_time(TASK_L2L1);
itti_mark_task_ready(TASK_L2L1);
if (UE_flag == 0) {
/* Wait for the initialize message */
do {
if (message_p != NULL) {
itti_free (ITTI_MSG_ORIGIN_ID(message_p), message_p);
}
itti_receive_msg (TASK_L2L1, &message_p);
switch (ITTI_MSG_ID(message_p)) {
case INITIALIZE_MESSAGE:
/* Start eNB thread */
start_eNB = 1;
break;
case TERMINATE_MESSAGE:
oai_exit=1;
itti_exit_task ();
break;
default:
LOG_E(EMU, "Received unexpected message %s\n", ITTI_MSG_NAME(message_p));
break;
}
} while (ITTI_MSG_ID(message_p) != INITIALIZE_MESSAGE);
itti_free (ITTI_MSG_ORIGIN_ID(message_p), message_p);
}
do {
// Wait for a message
itti_receive_msg (TASK_L2L1, &message_p);
switch (ITTI_MSG_ID(message_p)) {
case TERMINATE_MESSAGE:
oai_exit=1;
itti_exit_task ();
break;
case MESSAGE_TEST:
LOG_I(EMU, "Received %s\n", ITTI_MSG_NAME(message_p));
break;
default:
LOG_E(EMU, "Received unexpected message %s\n", ITTI_MSG_NAME(message_p));
break;
}
itti_free (ITTI_MSG_ORIGIN_ID(message_p), message_p);
} while(1);
return NULL;
}
#endif
/* This is the main eNB thread. It gets woken up by the kernel driver using the RTAI message mechanism (rt_send and rt_receive). */ /* This is the main eNB thread. It gets woken up by the kernel driver using the RTAI message mechanism (rt_send and rt_receive). */
static void *eNB_thread(void *arg) static void *eNB_thread(void *arg)
{ {
...@@ -299,9 +377,24 @@ static void *eNB_thread(void *arg) ...@@ -299,9 +377,24 @@ static void *eNB_thread(void *arg)
int tx_offset; int tx_offset;
#if defined(ENABLE_ITTI)
/* Wait for eNB application initialization to be complete (eNB registration to MME) */
{
char *indicator[] = {". ", ".. ", "...", " ..", " .", " "};
int i = 0;
while ((!oai_exit) && (start_eNB == 0)) {
LOG_D(HW,"Waiting for eNB application to be ready %s\r", indicator[i]);
i = (i + 1) % (sizeof(indicator) / sizeof(indicator[0]));
usleep(200000);
}
LOG_D(HW,"\n");
}
#endif
#ifdef RTAI #ifdef RTAI
task = rt_task_init_schmod(nam2num("TASK0"), 0, 0, 0, SCHED_FIFO, 0xF); task = rt_task_init_schmod(nam2num("TASK0"), 0, 0, 0, SCHED_FIFO, 0xF);
rt_receive(0, (unsigned long*)((void*)&sem)); rt_receive(0, (unsigned long *)((void *)&sem));
LOG_D(HW,"Started eNB thread (id %p)\n",task); LOG_D(HW,"Started eNB thread (id %p)\n",task);
#endif #endif
...@@ -318,79 +411,89 @@ static void *eNB_thread(void *arg) ...@@ -318,79 +411,89 @@ static void *eNB_thread(void *arg)
// sync to HW subframe == 0 // sync to HW subframe == 0
mbox_current = ((volatile unsigned int*)DAQ_MBOX)[0]; mbox_current = ((volatile unsigned int *)DAQ_MBOX)[0];
rt_sleep_ns((165-mbox_current)*DAQ_PERIOD); rt_sleep_ns((165-mbox_current)*DAQ_PERIOD);
time_in = rt_get_time_ns(); time_in = rt_get_time_ns();
while (!oai_exit) while (!oai_exit) {
{
//this is the mbox counter where we should be //this is the mbox counter where we should be
mbox_target = mbox_bounds[subframe]; mbox_target = mbox_bounds[subframe];
//this is the mbox counter where we are //this is the mbox counter where we are
mbox_current = ((volatile unsigned int *)DAQ_MBOX)[0]; mbox_current = ((volatile unsigned int *)DAQ_MBOX)[0];
//this is the time we need to sleep in order to synchronize with the hw (in multiples of DAQ_PERIOD) //this is the time we need to sleep in order to synchronize with the hw (in multiples of DAQ_PERIOD)
if ((mbox_current>=135) && (mbox_target<15)) //handle the frame wrap-arround if ((mbox_current>=135) && (mbox_target<15)) { //handle the frame wrap-arround
diff = 150-mbox_current+mbox_target; diff = 150-mbox_current+mbox_target;
else if ((mbox_current<15) && (mbox_target>=135)) } else if ((mbox_current<15) && (mbox_target>=135)) {
diff = -150+mbox_target-mbox_current; diff = -150+mbox_target-mbox_current;
else } else {
diff = mbox_target - mbox_current; diff = mbox_target - mbox_current;
}
if (diff < -15) { if (diff < -15) {
LOG_D(HW,"Time %.3f: Frame %d, missed subframe, proceeding with next one (subframe %d, hw_subframe %d, mbox_currend %d, mbox_target %d,diff %d) processing time %.3f\n", LOG_D(HW,
"Time %.3f: Frame %d, missed subframe, proceeding with next one (subframe %d, hw_subframe %d, mbox_currend %d, mbox_target %d,diff %d) processing time %.3f\n",
(float)(rt_get_time_ns()-time_in)/1e6, (float)(rt_get_time_ns()-time_in)/1e6,
frame, subframe, hw_subframe, mbox_current, mbox_target, diff, (float)(timing_info.time_now-timing_info.time_last)/1e6); frame, subframe, hw_subframe, mbox_current, mbox_target, diff,
(float)(timing_info.time_now-timing_info.time_last)/1e6);
subframe++; subframe++;
if (frame>0) if (frame>0) {
oai_exit=1; oai_exit=1;
if (subframe==10){ }
if (subframe==10) {
subframe=0; subframe=0;
frame++; frame++;
} }
continue; continue;
} }
if (diff > 15) { if (diff > 15) {
LOG_D(HW,"Time %.3f: Frame %d, skipped subframe, waiting for hw to catch up (subframe %d, hw_subframe %d, mbox_current %d, mbox_target %d, diff %d), processing time %.3f\n", LOG_D(HW,
"Time %.3f: Frame %d, skipped subframe, waiting for hw to catch up (subframe %d, hw_subframe %d, mbox_current %d, mbox_target %d, diff %d), processing time %.3f\n",
(float)(rt_get_time_ns()-time_in)/1e6, (float)(rt_get_time_ns()-time_in)/1e6,
frame, subframe, hw_subframe, mbox_current, mbox_target, diff, (float)(timing_info.time_now-timing_info.time_last)/1e6); frame, subframe, hw_subframe, mbox_current, mbox_target, diff,
(float)(timing_info.time_now-timing_info.time_last)/1e6);
//exit(-1); //exit(-1);
} }
delay_cnt = 0; delay_cnt = 0;
vcd_signal_dumper_dump_variable_by_name(VCD_SIGNAL_DUMPER_VARIABLES_DAQ_MBOX, *((volatile unsigned int *) openair0_exmimo_pci[card].rxcnt_ptr[0])); vcd_signal_dumper_dump_variable_by_name(VCD_SIGNAL_DUMPER_VARIABLES_DAQ_MBOX,
*((volatile unsigned int *) openair0_exmimo_pci[card].rxcnt_ptr[0]));
vcd_signal_dumper_dump_variable_by_name(VCD_SIGNAL_DUMPER_VARIABLES_DIFF, diff); vcd_signal_dumper_dump_variable_by_name(VCD_SIGNAL_DUMPER_VARIABLES_DIFF, diff);
while ((diff>0) && (!oai_exit)) while ((diff>0) && (!oai_exit)) {
{
time_diff = rt_get_time_ns() - time_in; time_diff = rt_get_time_ns() - time_in;
ret = rt_sleep_ns(diff*DAQ_PERIOD); ret = rt_sleep_ns(diff*DAQ_PERIOD);
if (ret) if (ret) {
LOG_D(HW,"eNB Frame %d, time %llu: rt_sleep_ns returned %d\n",frame, time_in); LOG_D(HW,"eNB Frame %d, time %llu: rt_sleep_ns returned %d\n",frame, time_in);
}
delay_cnt++; delay_cnt++;
if (delay_cnt == 10) if (delay_cnt == 10) {
{
oai_exit = 1; oai_exit = 1;
LOG_D(HW,"eNB Frame %d: HW stopped ... \n",frame); LOG_D(HW,"eNB Frame %d: HW stopped ... \n",frame);
} }
mbox_current = ((volatile unsigned int *)DAQ_MBOX)[0]; mbox_current = ((volatile unsigned int *)DAQ_MBOX)[0];
if ((mbox_current>=135) && (mbox_target<15)) //handle the frame wrap-arround if ((mbox_current>=135) && (mbox_target<15)) { //handle the frame wrap-arround
diff = 150-mbox_current+mbox_target; diff = 150-mbox_current+mbox_target;
else if ((mbox_current<15) && (mbox_target>=135)) } else if ((mbox_current<15) && (mbox_target>=135)) {
diff = -150+mbox_target-mbox_current; diff = -150+mbox_target-mbox_current;
else } else {
diff = mbox_target - mbox_current; diff = mbox_target - mbox_current;
} }
}
hw_subframe = ((((volatile unsigned int *)DAQ_MBOX)[0]+135)%150)/15; hw_subframe = ((((volatile unsigned int *)DAQ_MBOX)[0]+135)%150)/15;
LOG_D(HW,"Time: %.3f: Frame %d, subframe %d, hw_subframe %d (mbox %d) processing time %0.3f\n",(float)(rt_get_time_ns()-time_in)/1e6, LOG_D(HW,
frame,subframe,hw_subframe,((volatile unsigned int *)DAQ_MBOX)[0], (float)(timing_info.time_now-timing_info.time_last)/1e6); "Time: %.3f: Frame %d, subframe %d, hw_subframe %d (mbox %d) processing time %0.3f\n",
(float)(rt_get_time_ns()-time_in)/1e6,
frame,subframe,hw_subframe,((volatile unsigned int *)DAQ_MBOX)[0],
(float)(timing_info.time_now-timing_info.time_last)/1e6);
last_slot = (subframe<<1)+1; last_slot = (subframe<<1)+1;
if (last_slot <0) if (last_slot <0) {
last_slot+=20; last_slot+=20;
}
next_slot = ((subframe<<1)+4)%LTE_SLOTS_PER_FRAME; next_slot = ((subframe<<1)+4)%LTE_SLOTS_PER_FRAME;
if ((skip_first == 0) || (frame>5)) if ((skip_first == 0) || (frame>5))
...@@ -399,16 +502,18 @@ static void *eNB_thread(void *arg) ...@@ -399,16 +502,18 @@ static void *eNB_thread(void *arg)
timing_info.time_last = rt_get_time_ns(); timing_info.time_last = rt_get_time_ns();
//msg("subframe %d, last_slot %d,next_slot %d\n", subframe,last_slot,next_slot); //msg("subframe %d, last_slot %d,next_slot %d\n", subframe,last_slot,next_slot);
vcd_signal_dumper_dump_variable_by_name(VCD_SIGNAL_DUMPER_VARIABLES_DAQ_MBOX, *((volatile unsigned int *) openair0_exmimo_pci[card].rxcnt_ptr[0])); vcd_signal_dumper_dump_variable_by_name(VCD_SIGNAL_DUMPER_VARIABLES_DAQ_MBOX,
*((volatile unsigned int *) openair0_exmimo_pci[card].rxcnt_ptr[0]));
vcd_signal_dumper_dump_variable_by_name(VCD_SIGNAL_DUMPER_VARIABLES_DIFF, diff); vcd_signal_dumper_dump_variable_by_name(VCD_SIGNAL_DUMPER_VARIABLES_DIFF, diff);
phy_procedures_eNB_lte (last_slot, next_slot, PHY_vars_eNB_g[0], 0,0,NULL); phy_procedures_eNB_lte (last_slot, next_slot, PHY_vars_eNB_g[0], 0,0,NULL);
vcd_signal_dumper_dump_variable_by_name(VCD_SIGNAL_DUMPER_VARIABLES_DAQ_MBOX, *((volatile unsigned int *) openair0_exmimo_pci[card].rxcnt_ptr[0])); vcd_signal_dumper_dump_variable_by_name(VCD_SIGNAL_DUMPER_VARIABLES_DAQ_MBOX,
*((volatile unsigned int *) openair0_exmimo_pci[card].rxcnt_ptr[0]));
#ifndef IFFT_FPGA #ifndef IFFT_FPGA
if ((subframe_select(&PHY_vars_eNB_g[0]->lte_frame_parms,next_slot>>1)==SF_DL)|| if ((subframe_select(&PHY_vars_eNB_g[0]->lte_frame_parms,next_slot>>1)==SF_DL)||
((subframe_select(&PHY_vars_eNB_g[0]->lte_frame_parms,next_slot>>1)==SF_S)&&((next_slot&1)==0))) ((subframe_select(&PHY_vars_eNB_g[0]->lte_frame_parms,next_slot>>1)==SF_S)
{ &&((next_slot&1)==0))) {
//LOG_D(HW,"Frame %d: Generating slot %d\n",frame,next_slot); //LOG_D(HW,"Frame %d: Generating slot %d\n",frame,next_slot);
/* /*
do_OFDM_mod(PHY_vars_eNB_g[0]->lte_eNB_common_vars.txdataF[0], do_OFDM_mod(PHY_vars_eNB_g[0]->lte_eNB_common_vars.txdataF[0],
...@@ -422,36 +527,46 @@ static void *eNB_thread(void *arg) ...@@ -422,36 +527,46 @@ static void *eNB_thread(void *arg)
&PHY_vars_eNB_g[0]->lte_frame_parms); &PHY_vars_eNB_g[0]->lte_frame_parms);
*/ */
vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_SFGEN,1); vcd_signal_dumper_dump_function_by_name(
slot_offset_F = (next_slot)*(PHY_vars_eNB_g[0]->lte_frame_parms.ofdm_symbol_size)*7; VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_SFGEN,1);
slot_offset = (next_slot)*(PHY_vars_eNB_g[0]->lte_frame_parms.samples_per_tti>>1); slot_offset_F = (next_slot)*
(PHY_vars_eNB_g[0]->lte_frame_parms.ofdm_symbol_size)*7;
slot_offset = (next_slot)*
(PHY_vars_eNB_g[0]->lte_frame_parms.samples_per_tti>>1);
normal_prefix_mod(&PHY_vars_eNB_g[0]->lte_eNB_common_vars.txdataF[0][0][slot_offset_F], normal_prefix_mod(
&PHY_vars_eNB_g[0]->lte_eNB_common_vars.txdataF[0][0][slot_offset_F],
dummy_tx_buffer, dummy_tx_buffer,
7, 7,
&(PHY_vars_eNB_g[0]->lte_frame_parms)); &(PHY_vars_eNB_g[0]->lte_frame_parms));
for (i = 0; i < PHY_vars_eNB_g[0]->lte_frame_parms.samples_per_tti/2;i++) for (i = 0; i < PHY_vars_eNB_g[0]->lte_frame_parms.samples_per_tti/2; i++) {
{
tx_offset = slot_offset + time_offset[0] + i; tx_offset = slot_offset + time_offset[0] + i;
((short*)&PHY_vars_eNB_g[0]->lte_eNB_common_vars.txdata[0][0][tx_offset])[0] = ((short*)dummy_tx_buffer)[2*i]<<4; ((short *)&PHY_vars_eNB_g[0]->lte_eNB_common_vars.txdata[0][0][tx_offset])[0]
((short*)&PHY_vars_eNB_g[0]->lte_eNB_common_vars.txdata[0][0][tx_offset])[1] = ((short*)dummy_tx_buffer)[2*i+1]<<4; = ((short *)dummy_tx_buffer)[2*i]<<4;
((short *)&PHY_vars_eNB_g[0]->lte_eNB_common_vars.txdata[0][0][tx_offset])[1]
= ((short *)dummy_tx_buffer)[2*i+1]<<4;
} }
slot_offset_F = (next_slot+1)*(PHY_vars_eNB_g[0]->lte_frame_parms.ofdm_symbol_size)*7; slot_offset_F = (next_slot+1)*
slot_offset = (next_slot+1)*(PHY_vars_eNB_g[0]->lte_frame_parms.samples_per_tti>>1); (PHY_vars_eNB_g[0]->lte_frame_parms.ofdm_symbol_size)*7;
slot_offset = (next_slot+1)*
(PHY_vars_eNB_g[0]->lte_frame_parms.samples_per_tti>>1);
normal_prefix_mod(&PHY_vars_eNB_g[0]->lte_eNB_common_vars.txdataF[0][0][slot_offset_F], normal_prefix_mod(
&PHY_vars_eNB_g[0]->lte_eNB_common_vars.txdataF[0][0][slot_offset_F],
dummy_tx_buffer, dummy_tx_buffer,
7, 7,
&(PHY_vars_eNB_g[0]->lte_frame_parms)); &(PHY_vars_eNB_g[0]->lte_frame_parms));
for (i = 0; i < PHY_vars_eNB_g[0]->lte_frame_parms.samples_per_tti/2;i++) for (i = 0; i < PHY_vars_eNB_g[0]->lte_frame_parms.samples_per_tti/2; i++) {
{
tx_offset = slot_offset + i; tx_offset = slot_offset + i;
((short*)&PHY_vars_eNB_g[0]->lte_eNB_common_vars.txdata[0][0][tx_offset])[0] = ((short*)dummy_tx_buffer)[2*i]<<4; ((short *)&PHY_vars_eNB_g[0]->lte_eNB_common_vars.txdata[0][0][tx_offset])[0]
((short*)&PHY_vars_eNB_g[0]->lte_eNB_common_vars.txdata[0][0][tx_offset])[1] = ((short*)dummy_tx_buffer)[2*i+1]<<4; = ((short *)dummy_tx_buffer)[2*i]<<4;
((short *)&PHY_vars_eNB_g[0]->lte_eNB_common_vars.txdata[0][0][tx_offset])[1]
= ((short *)dummy_tx_buffer)[2*i+1]<<4;
} }
} }
vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_SFGEN,0); vcd_signal_dumper_dump_function_by_name(
VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_SFGEN,0);
timing_info.time_now = rt_get_time_ns(); timing_info.time_now = rt_get_time_ns();
#endif //IFFT_FPGA #endif //IFFT_FPGA
/* /*
...@@ -470,10 +585,12 @@ static void *eNB_thread(void *arg) ...@@ -470,10 +585,12 @@ static void *eNB_thread(void *arg)
//dump_ulsch(PHY_vars_eNB_g[0], subframe, 0); //dump_ulsch(PHY_vars_eNB_g[0], subframe, 0);
//exit(-1); //exit(-1);
oai_exit=1; oai_exit=1;
exit_fun("[HW][eNB] HW stopped");
} }
if (oai_flag == 1) if (oai_flag == 1) {
oai_flag = 2; oai_flag = 2;
}
subframe++; subframe++;
if (subframe==10) { if (subframe==10) {
...@@ -484,7 +601,9 @@ static void *eNB_thread(void *arg) ...@@ -484,7 +601,9 @@ static void *eNB_thread(void *arg)
frame = 0; frame = 0;
time_in = rt_get_time_ns(); time_in = rt_get_time_ns();
} }
#if defined(ENABLE_ITTI)
itti_update_lte_time(frame, subframe * 2);
#endif
} }
LOG_D(HW,"eNB_thread: finished, ran %d times.\n",frame); LOG_D(HW,"eNB_thread: finished, ran %d times.\n",frame);
...@@ -502,8 +621,8 @@ static void *eNB_thread(void *arg) ...@@ -502,8 +621,8 @@ static void *eNB_thread(void *arg)
return 0; return 0;
} }
int main(int argc, char **argv) { int main(int argc, char **argv)
{
#ifdef RTAI #ifdef RTAI
RT_TASK *task; RT_TASK *task;
#endif #endif
...@@ -515,8 +634,10 @@ int main(int argc, char **argv) { ...@@ -515,8 +634,10 @@ int main(int argc, char **argv) {
u32 rf_mode_med[4] = {39375,39375,39375,39375}; u32 rf_mode_med[4] = {39375,39375,39375,39375};
u32 rf_mode_byp[4] = {22991,22991,22991,22991}; u32 rf_mode_byp[4] = {22991,22991,22991,22991};
*/ */
u32 my_rf_mode = RXEN + TXEN + TXLPFNORM + TXLPFEN + TXLPF25 + RXLPFNORM + RXLPFEN + RXLPF25 + LNA1ON +LNAMax + RFBBNORM + DMAMODE_RX + DMAMODE_TX; u32 my_rf_mode = RXEN + TXEN + TXLPFNORM + TXLPFEN + TXLPF25 + RXLPFNORM +
u32 rf_mode_base = TXLPFNORM + TXLPFEN + TXLPF25 + RXLPFNORM + RXLPFEN + RXLPF25 + LNA1ON + /*LNAMax Antennas*/ LNAByp + RFBBNORM; RXLPFEN + RXLPF25 + LNA1ON +LNAMax + RFBBNORM + DMAMODE_RX + DMAMODE_TX;
u32 rf_mode_base = TXLPFNORM + TXLPFEN + TXLPF25 + RXLPFNORM + RXLPFEN +
RXLPF25 + LNA1ON + /*LNAMax Antennas*/ LNAByp + RFBBNORM;
u32 rf_mode[4] = {my_rf_mode,0,0,0}; u32 rf_mode[4] = {my_rf_mode,0,0,0};
u32 rf_local[4] = {8255000,8255000,8255000,8255000}; // UE zepto u32 rf_local[4] = {8255000,8255000,8255000,8255000}; // UE zepto
//{8254617, 8254617, 8254617, 8254617}; //eNB khalifa //{8254617, 8254617, 8254617, 8254617}; //eNB khalifa
...@@ -552,21 +673,20 @@ int main(int argc, char **argv) { ...@@ -552,21 +673,20 @@ int main(int argc, char **argv) {
unsigned int fd; unsigned int fd;
int amp; int amp;
unsigned int rxg_max[4]={133,133,133,133}, rxg_med[4]={127,127,127,127}, rxg_byp[4]={120,120,120,120}; unsigned int rxg_max[4]= {133,133,133,133}, rxg_med[4]= {127,127,127,127}, rxg_byp[4]= {120,120,120,120};
int tx_max_power=0; int tx_max_power=0;
int ret, ant; int ret, ant;
int error_code; int error_code;
char *itti_dump_file = NULL;
mode = normal_txrx; mode = normal_txrx;
mme_ip = "146.208.175.6"; mme_ip = "146.208.175.6";
while ((c = getopt(argc, argv, "dC:T:N:R:Vi;")) != -1) while ((c = getopt(argc, argv, "dC:K:O:T:N:R:Vi;")) != -1) {
{ switch (c) {
switch (c)
{
case 'd': case 'd':
do_forms=1; do_forms=1;
printf("Starting XFORMS ...\n"); printf("Starting XFORMS ...\n");
...@@ -581,6 +701,27 @@ int main(int argc, char **argv) { ...@@ -581,6 +701,27 @@ int main(int argc, char **argv) {
frame_type = TDD; // default FDD frame_type = TDD; // default FDD
tdd_config = atoi(optarg); tdd_config = atoi(optarg);
break; break;
case 'K':
#if defined(ENABLE_ITTI)
itti_dump_file = strdup(optarg);
#else
printf("-K option is disabled when ENABLE_ITTI is not defined\n");
#endif
break;
case 'O':
#if defined(ENABLE_USE_MME)
EPC_MODE_ENABLED = 1;
if (optarg == NULL) { /* No IP address provided: use localhost */
memcpy(&EPC_MODE_MME_ADDRESS[0], "127.0.0.1", 10);
} else {
u8 ip_length = strlen(optarg) + 1;
memcpy(&EPC_MODE_MME_ADDRESS[0], optarg,
ip_length > 16 ? 16 : ip_length);
}
#else
printf("You enabled mme mode without s1ap compiled...\n");
#endif
break;
case 'R': case 'R':
N_RB_DL = atoi(optarg); N_RB_DL = atoi(optarg);
if ((N_RB_DL != 6) && (N_RB_DL != 15) && (N_RB_DL != 25) && if ((N_RB_DL != 6) && (N_RB_DL != 15) && (N_RB_DL != 25) &&
...@@ -609,21 +750,37 @@ int main(int argc, char **argv) { ...@@ -609,21 +750,37 @@ int main(int argc, char **argv) {
vcd_signal_dumper_init("/tmp/openair_dump_eNB.vcd"); vcd_signal_dumper_init("/tmp/openair_dump_eNB.vcd");
} }
#if defined(ENABLE_ITTI)
log_set_instance_type (LOG_INSTANCE_ENB);
itti_init(TASK_MAX, THREAD_MAX, MESSAGES_ID_MAX, tasks_info, messages_info,
messages_definition_xml, itti_dump_file);
if (create_tasks(1, 0)) {
exit(EXIT_FAILURE); // need a softer mode
}
printf("After create tasks\n");
#endif
#ifdef NAS_NETLINK #ifdef NAS_NETLINK
netlink_init(); netlink_init();
#endif #endif
#if !defined(ENABLE_ITTI)
// to make a graceful exit when ctrl-c is pressed // to make a graceful exit when ctrl-c is pressed
signal(SIGSEGV, signal_handler); signal(SIGSEGV, signal_handler);
signal(SIGINT, signal_handler); signal(SIGINT, signal_handler);
#endif
#ifndef RTAI #ifndef RTAI
check_clock(); check_clock();
#endif #endif
init_lte_vars(&frame_parms, frame_type, tdd_config, tdd_config_S, extended_prefix_flag, N_RB_DL, init_lte_vars(&frame_parms, frame_type, tdd_config, tdd_config_S,
Nid_cell, cooperation_flag, transmission_mode, abstraction_flag, nb_antennas_rx,0); extended_prefix_flag, N_RB_DL,
Nid_cell, cooperation_flag, transmission_mode, abstraction_flag,
nb_antennas_rx,0);
g_log->log_component[HW].level = LOG_INFO; g_log->log_component[HW].level = LOG_INFO;
g_log->log_component[HW].flag = LOG_LOW; g_log->log_component[HW].flag = LOG_LOW;
...@@ -635,19 +792,32 @@ int main(int argc, char **argv) { ...@@ -635,19 +792,32 @@ int main(int argc, char **argv) {
g_log->log_component[RLC].flag = LOG_LOW; g_log->log_component[RLC].flag = LOG_LOW;
g_log->log_component[PDCP].level = LOG_INFO; g_log->log_component[PDCP].level = LOG_INFO;
g_log->log_component[PDCP].flag = LOG_LOW; g_log->log_component[PDCP].flag = LOG_LOW;
g_log->log_component[S1AP].level = LOG_INFO;
g_log->log_component[S1AP].flag = LOG_LOW;
g_log->log_component[RRC].level = LOG_INFO; g_log->log_component[RRC].level = LOG_INFO;
g_log->log_component[RRC].flag = LOG_LOW; g_log->log_component[RRC].flag = LOG_LOW;
g_log->log_component[OIP].level = LOG_INFO; g_log->log_component[OIP].level = LOG_INFO;
g_log->log_component[OIP].flag = LOG_HIGH; g_log->log_component[OIP].flag = LOG_HIGH;
#if defined(ENABLE_ITTI)
g_log->log_component[EMU].level = LOG_INFO;
g_log->log_component[EMU].flag = LOG_HIGH;
# if defined(ENABLE_USE_MME)
g_log->log_component[S1AP].level = LOG_INFO;
g_log->log_component[S1AP].flag = LOG_HIGH;
g_log->log_component[SCTP].level = LOG_INFO;
g_log->log_component[SCTP].flag = LOG_HIGH;
# endif
g_log->log_component[S1AP].level = LOG_INFO;
g_log->log_component[S1AP].flag = LOG_LOW;
#else
#endif
g_log->log_component[ENB_APP].level = LOG_INFO;
g_log->log_component[ENB_APP].flag = LOG_HIGH;
PHY_vars_eNB_g = malloc(sizeof(PHY_VARS_eNB *));
PHY_vars_eNB_g = malloc(sizeof(PHY_VARS_eNB*)); PHY_vars_eNB_g[0] = init_lte_eNB(frame_parms,eNB_id,Nid_cell,cooperation_flag,
PHY_vars_eNB_g[0] = init_lte_eNB(frame_parms,eNB_id,Nid_cell,cooperation_flag,transmission_mode,abstraction_flag); transmission_mode,abstraction_flag);
#ifndef OPENAIR2 #ifndef OPENAIR2
for (i=0;i<NUMBER_OF_UE_MAX;i++) { for (i=0; i<NUMBER_OF_UE_MAX; i++) {
PHY_vars_eNB_g[0]->pusch_config_dedicated[i].betaOffset_ACK_Index = beta_ACK; PHY_vars_eNB_g[0]->pusch_config_dedicated[i].betaOffset_ACK_Index = beta_ACK;
PHY_vars_eNB_g[0]->pusch_config_dedicated[i].betaOffset_RI_Index = beta_RI; PHY_vars_eNB_g[0]->pusch_config_dedicated[i].betaOffset_RI_Index = beta_RI;
PHY_vars_eNB_g[0]->pusch_config_dedicated[i].betaOffset_CQI_Index = beta_CQI; PHY_vars_eNB_g[0]->pusch_config_dedicated[i].betaOffset_CQI_Index = beta_CQI;
...@@ -670,62 +840,77 @@ int main(int argc, char **argv) { ...@@ -670,62 +840,77 @@ int main(int argc, char **argv) {
// set eNB to max gain // set eNB to max gain
PHY_vars_eNB_g[0]->rx_total_gain_eNB_dB = rxg_max[0] + rxgain[0] - 30; //was measured at rxgain=30; PHY_vars_eNB_g[0]->rx_total_gain_eNB_dB = rxg_max[0] + rxgain[0] -
30; //was measured at rxgain=30;
for (i=0; i<4; i++) { for (i=0; i<4; i++) {
// frame_parms->rfmode[i] = rf_mode_max[i]; // frame_parms->rfmode[i] = rf_mode_max[i];
rf_mode[i] = (rf_mode[i] & (~LNAGAINMASK)) | LNAMax; rf_mode[i] = (rf_mode[i] & (~LNAGAINMASK)) | LNAMax;
} }
// Initialize card // Initialize card
ret = openair0_open(); ret = openair0_open();
if ( ret != 0 ) { if ( ret != 0 ) {
if (ret == -1) if (ret == -1) {
printf("Error opening /dev/openair0"); printf("Error opening /dev/openair0\n");
if (ret == -2) }
printf("Error mapping bigshm"); if (ret == -2) {
if (ret == -3) printf("Error mapping bigshm\n");
printf("Error mapping RX or TX buffer"); }
if (ret == -3) {
printf("Error mapping RX or TX buffer\n");
}
return(ret); return(ret);
} }
printf ("Detected %d number of cards, %d number of antennas.\n", openair0_num_detected_cards, openair0_num_antennas[card]); printf ("Detected %d number of cards, %d number of antennas.\n",
openair0_num_detected_cards, openair0_num_antennas[card]);
p_exmimo_config = openair0_exmimo_pci[card].exmimo_config_ptr; p_exmimo_config = openair0_exmimo_pci[card].exmimo_config_ptr;
p_exmimo_id = openair0_exmimo_pci[card].exmimo_id_ptr; p_exmimo_id = openair0_exmimo_pci[card].exmimo_id_ptr;
printf("Card %d: ExpressMIMO %d, HW Rev %d, SW Rev 0x%d\n", card, p_exmimo_id->board_exmimoversion, p_exmimo_id->board_hwrev, p_exmimo_id->board_swrev); printf("Card %d: ExpressMIMO %d, HW Rev %d, SW Rev 0x%d\n", card,
p_exmimo_id->board_exmimoversion, p_exmimo_id->board_hwrev,
p_exmimo_id->board_swrev);
if (p_exmimo_id->board_swrev>=BOARD_SWREV_CNTL2) if (p_exmimo_id->board_swrev>=BOARD_SWREV_CNTL2) {
p_exmimo_config->framing.eNB_flag = 0; p_exmimo_config->framing.eNB_flag = 0;
else } else {
p_exmimo_config->framing.eNB_flag = 0;//!UE_flag; p_exmimo_config->framing.eNB_flag = 0; //!UE_flag;
}
p_exmimo_config->framing.tdd_config = DUPLEXMODE_FDD + TXRXSWITCH_LSB; p_exmimo_config->framing.tdd_config = DUPLEXMODE_FDD + TXRXSWITCH_LSB;
p_exmimo_config->framing.resampling_factor = 2; p_exmimo_config->framing.resampling_factor = 2;
for (ant=0;ant<max(frame_parms->nb_antennas_tx,frame_parms->nb_antennas_rx);ant++) for (ant=0; ant<max(frame_parms->nb_antennas_tx,frame_parms->nb_antennas_rx);
ant++) {
p_exmimo_config->rf.rf_mode[ant] = rf_mode_base; p_exmimo_config->rf.rf_mode[ant] = rf_mode_base;
for (ant=0;ant<frame_parms->nb_antennas_tx;ant++) }
for (ant=0; ant<frame_parms->nb_antennas_tx; ant++) {
p_exmimo_config->rf.rf_mode[ant] += (TXEN + DMAMODE_TX); p_exmimo_config->rf.rf_mode[ant] += (TXEN + DMAMODE_TX);
for (ant=0;ant<frame_parms->nb_antennas_rx;ant++) }
for (ant=0; ant<frame_parms->nb_antennas_rx; ant++) {
p_exmimo_config->rf.rf_mode[ant] += (RXEN + DMAMODE_RX); p_exmimo_config->rf.rf_mode[ant] += (RXEN + DMAMODE_RX);
for (ant=max(frame_parms->nb_antennas_tx,frame_parms->nb_antennas_rx);ant<4;ant++) { }
for (ant=max(frame_parms->nb_antennas_tx,frame_parms->nb_antennas_rx); ant<4;
ant++) {
p_exmimo_config->rf.rf_mode[ant] = 0; p_exmimo_config->rf.rf_mode[ant] = 0;
carrier_freq[ant] = 0; //this turns off all other LIMEs carrier_freq[ant] = 0; //this turns off all other LIMEs
} }
for (ant = 0; ant < 4; ant++) { for (ant = 0; ant < 4; ant++) {
if (frame_type == FDD) if (frame_type == FDD) {
carrier_freq[ant] = carrier_freq_fdd[ant]; carrier_freq[ant] = carrier_freq_fdd[ant];
else } else {
carrier_freq[ant] = carrier_freq_tdd[ant]; carrier_freq[ant] = carrier_freq_tdd[ant];
} }
}
for (ant = 0; ant<1; ant++) { for (ant = 0; ant<1; ant++) {
p_exmimo_config->rf.do_autocal[ant] = 1; p_exmimo_config->rf.do_autocal[ant] = 1;
if (frame_type == FDD) if (frame_type == FDD) {
p_exmimo_config->rf.rf_freq_rx[ant] = carrier_freq[ant]-120e6; // LTE FDD band 1 duplex space p_exmimo_config->rf.rf_freq_rx[ant] =
else carrier_freq[ant]-120e6; // LTE FDD band 1 duplex space
} else {
p_exmimo_config->rf.rf_freq_rx[ant] = carrier_freq[ant]; p_exmimo_config->rf.rf_freq_rx[ant] = carrier_freq[ant];
}
p_exmimo_config->rf.rf_freq_tx[ant] = carrier_freq[ant]; p_exmimo_config->rf.rf_freq_tx[ant] = carrier_freq[ant];
p_exmimo_config->rf.rx_gain[ant][0] = rxgain[ant]; p_exmimo_config->rf.rx_gain[ant][0] = rxgain[ant];
...@@ -737,8 +922,7 @@ int main(int argc, char **argv) { ...@@ -737,8 +922,7 @@ int main(int argc, char **argv) {
if ((carrier_freq[ant] >= 850000000) && (carrier_freq[ant] <= 865000000)) { if ((carrier_freq[ant] >= 850000000) && (carrier_freq[ant] <= 865000000)) {
p_exmimo_config->rf.rf_vcocal[ant] = rf_vcocal_850[ant]; p_exmimo_config->rf.rf_vcocal[ant] = rf_vcocal_850[ant];
p_exmimo_config->rf.rffe_band_mode[ant] = DD_TDD; p_exmimo_config->rf.rffe_band_mode[ant] = DD_TDD;
} } else {
else {
p_exmimo_config->rf.rf_vcocal[ant] = rf_vcocal[ant]; p_exmimo_config->rf.rf_vcocal[ant] = rf_vcocal[ant];
p_exmimo_config->rf.rffe_band_mode[ant] = B19G_TDD; p_exmimo_config->rf.rffe_band_mode[ant] = B19G_TDD;
} }
...@@ -766,16 +950,18 @@ int main(int argc, char **argv) { ...@@ -766,16 +950,18 @@ int main(int argc, char **argv) {
number_of_cards = openair0_num_detected_cards; number_of_cards = openair0_num_detected_cards;
if (p_exmimo_id->board_exmimoversion==1) //ExpressMIMO1 if (p_exmimo_id->board_exmimoversion==1) { //ExpressMIMO1
openair_daq_vars.timing_advance = 138; openair_daq_vars.timing_advance = 138;
else //ExpressMIMO2 } else { //ExpressMIMO2
openair_daq_vars.timing_advance = 15; openair_daq_vars.timing_advance = 15;
}
setup_eNB_buffers(PHY_vars_eNB_g[0],frame_parms,0); setup_eNB_buffers(PHY_vars_eNB_g[0],frame_parms,0);
openair0_dump_config(card); openair0_dump_config(card);
printf("EXMIMO_CONFIG: rf_mode 0x %x %x %x %x, [0]: TXRXEn %d, TXLPFEn %d, TXLPF %d, RXLPFEn %d, RXLPF %d, RFBB %d, LNA %d, LNAGain %d, RXLPFMode %d, SWITCH %d, rf_rxdc %d, rf_local %d, rf_vcocal %d\n", printf("EXMIMO_CONFIG: rf_mode 0x %x %x %x %x, [0]: TXRXEn %d, TXLPFEn %d, TXLPF %d, RXLPFEn %d, RXLPF %d, RFBB %d, LNA %d, LNAGain %d, RXLPFMode %d, SWITCH %d, rf_rxdc %d, rf_local %d, rf_vcocal %d\n",
p_exmimo_config->rf.rf_mode[0], p_exmimo_config->rf.rf_mode[0],
p_exmimo_config->rf.rf_mode[1], p_exmimo_config->rf.rf_mode[1],
p_exmimo_config->rf.rf_mode[2], p_exmimo_config->rf.rf_mode[2],
...@@ -794,8 +980,9 @@ int main(int argc, char **argv) { ...@@ -794,8 +980,9 @@ int main(int argc, char **argv) {
p_exmimo_config->rf.rf_local[0], p_exmimo_config->rf.rf_local[0],
p_exmimo_config->rf.rf_vcocal[0]); p_exmimo_config->rf.rf_vcocal[0]);
for (ant=0;ant<4;ant++) for (ant=0; ant<4; ant++) {
p_exmimo_config->rf.do_autocal[ant] = 0; p_exmimo_config->rf.do_autocal[ant] = 0;
}
mlockall(MCL_CURRENT | MCL_FUTURE); mlockall(MCL_CURRENT | MCL_FUTURE);
...@@ -815,13 +1002,12 @@ int main(int argc, char **argv) { ...@@ -815,13 +1002,12 @@ int main(int argc, char **argv) {
printf("Init mutex\n"); printf("Init mutex\n");
//mutex = rt_get_adr(nam2num("MUTEX")); //mutex = rt_get_adr(nam2num("MUTEX"));
mutex = rt_sem_init(nam2num("MUTEX"), 0); mutex = rt_sem_init(nam2num("MUTEX"), 0);
if (mutex==0) if (mutex==0) {
{
printf("Error init mutex\n"); printf("Error init mutex\n");
exit(-1); exit(-1);
} } else {
else
printf("mutex=%p\n",mutex); printf("mutex=%p\n",mutex);
}
#endif #endif
DAQ_MBOX = (volatile unsigned int *) openair0_exmimo_pci[card].rxcnt_ptr[0]; DAQ_MBOX = (volatile unsigned int *) openair0_exmimo_pci[card].rxcnt_ptr[0];
...@@ -835,18 +1021,18 @@ int main(int argc, char **argv) { ...@@ -835,18 +1021,18 @@ int main(int argc, char **argv) {
printf("Running XFORMS\n"); printf("Running XFORMS\n");
fl_initialize (&argc, argv, NULL, 0, 0); fl_initialize (&argc, argv, NULL, 0, 0);
form_stats = create_form_stats_form(); form_stats = create_form_stats_form();
for(UE_id=0;UE_id<scope_enb_num_ue;UE_id++) { for(UE_id=0; UE_id<scope_enb_num_ue; UE_id++) {
form_enb[UE_id] = create_lte_phy_scope_enb(); form_enb[UE_id] = create_lte_phy_scope_enb();
sprintf (title, "UE%d LTE UL SCOPE eNB",UE_id+1); sprintf (title, "UE%d LTE UL SCOPE eNB",UE_id+1);
fl_show_form (form_enb[UE_id]->lte_phy_scope_enb, FL_PLACE_HOTSPOT, FL_FULLBORDER, title); fl_show_form (form_enb[UE_id]->lte_phy_scope_enb, FL_PLACE_HOTSPOT,
FL_FULLBORDER, title);
} }
fl_show_form (form_stats->stats_form, FL_PLACE_HOTSPOT, FL_FULLBORDER, "stats"); fl_show_form (form_stats->stats_form, FL_PLACE_HOTSPOT, FL_FULLBORDER, "stats");
for (UE_id=0;UE_id<scope_enb_num_ue;UE_id++) { for (UE_id=0; UE_id<scope_enb_num_ue; UE_id++) {
if (otg_enabled) { if (otg_enabled) {
fl_set_button(form_enb[UE_id]->button_0,1); fl_set_button(form_enb[UE_id]->button_0,1);
fl_set_object_label(form_enb[UE_id]->button_0,"DL Traffic ON"); fl_set_object_label(form_enb[UE_id]->button_0,"DL Traffic ON");
} } else {
else {
fl_set_button(form_enb[UE_id]->button_0,0); fl_set_button(form_enb[UE_id]->button_0,0);
fl_set_object_label(form_enb[UE_id]->button_0,"DL Traffic OFF"); fl_set_object_label(form_enb[UE_id]->button_0,"DL Traffic OFF");
} }
...@@ -863,7 +1049,8 @@ int main(int argc, char **argv) { ...@@ -863,7 +1049,8 @@ int main(int argc, char **argv) {
pthread_attr_init (&attr_dlsch_threads); pthread_attr_init (&attr_dlsch_threads);
pthread_attr_setstacksize(&attr_dlsch_threads,OPENAIR_THREAD_STACK_SIZE); pthread_attr_setstacksize(&attr_dlsch_threads,OPENAIR_THREAD_STACK_SIZE);
//attr_dlsch_threads.priority = 1; //attr_dlsch_threads.priority = 1;
sched_param_dlsch.sched_priority = sched_get_priority_max(SCHED_FIFO); //OPENAIR_THREAD_PRIORITY; sched_param_dlsch.sched_priority = sched_get_priority_max(
SCHED_FIFO); //OPENAIR_THREAD_PRIORITY;
pthread_attr_setschedparam (&attr_dlsch_threads, &sched_param_dlsch); pthread_attr_setschedparam (&attr_dlsch_threads, &sched_param_dlsch);
pthread_attr_setschedpolicy (&attr_dlsch_threads, SCHED_FIFO); pthread_attr_setschedpolicy (&attr_dlsch_threads, SCHED_FIFO);
#endif #endif
...@@ -876,17 +1063,17 @@ int main(int argc, char **argv) { ...@@ -876,17 +1063,17 @@ int main(int argc, char **argv) {
#else #else
error_code = pthread_create(&thread0, &attr_dlsch_threads, eNB_thread, NULL); error_code = pthread_create(&thread0, &attr_dlsch_threads, eNB_thread, NULL);
if (error_code!= 0) { if (error_code!= 0) {
LOG_D(HW,"[lte-softmodem.c] Could not allocate eNB_thread, error %d\n",error_code); LOG_D(HW,"[lte-softmodem.c] Could not allocate eNB_thread, error %d\n",
error_code);
return(error_code); return(error_code);
} } else {
else {
LOG_D(HW,"[lte-softmodem.c] Allocate eNB_thread successful\n"); LOG_D(HW,"[lte-softmodem.c] Allocate eNB_thread successful\n");
} }
#endif #endif
#ifdef OPENAIR2 // #ifdef OPENAIR2
init_pdcp_thread(1); // init_pdcp_thread(1);
#endif // #endif
#ifdef ULSCH_THREAD #ifdef ULSCH_THREAD
init_ulsch_threads(); init_ulsch_threads();
...@@ -900,17 +1087,20 @@ int main(int argc, char **argv) { ...@@ -900,17 +1087,20 @@ int main(int argc, char **argv) {
//while (oai_exit==0) //while (oai_exit==0)
// rt_sleep_ns(FRAME_PERIOD); // rt_sleep_ns(FRAME_PERIOD);
#if defined(ENABLE_ITTI)
itti_wait_tasks_end();
#else
rt_sem_wait(mutex); rt_sem_wait(mutex);
#endif
// stop threads // stop threads
#ifdef XFORMS #ifdef XFORMS
printf("waiting for XFORMS thread\n"); printf("waiting for XFORMS thread\n");
if (do_forms==1) if (do_forms==1) {
{
pthread_join(thread2,&status); pthread_join(thread2,&status);
fl_hide_form(form_stats->stats_form); fl_hide_form(form_stats->stats_form);
fl_free_form(form_stats->stats_form); fl_free_form(form_stats->stats_form);
for(UE_id=0;UE_id<scope_enb_num_ue;UE_id++) { for(UE_id=0; UE_id<scope_enb_num_ue; UE_id++) {
fl_hide_form(form_enb[UE_id]->lte_phy_scope_enb); fl_hide_form(form_enb[UE_id]->lte_phy_scope_enb);
fl_free_form(form_enb[UE_id]->lte_phy_scope_enb); fl_free_form(form_enb[UE_id]->lte_phy_scope_enb);
} }
...@@ -928,11 +1118,6 @@ int main(int argc, char **argv) { ...@@ -928,11 +1118,6 @@ int main(int argc, char **argv) {
cleanup_ulsch_threads(); cleanup_ulsch_threads();
#endif #endif
#ifdef OPENAIR2
cleanup_pdcp_thread();
#endif
#ifdef RTAI #ifdef RTAI
rt_sem_delete(mutex); rt_sem_delete(mutex);
stop_rt_timer(); stop_rt_timer();
...@@ -946,21 +1131,25 @@ int main(int argc, char **argv) { ...@@ -946,21 +1131,25 @@ int main(int argc, char **argv) {
if (ouput_vcd) if (ouput_vcd) {
vcd_signal_dumper_close(); vcd_signal_dumper_close();
}
logClean(); logClean();
return 0; return 0;
} }
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)
{
int i,j; int i,j;
u16 N_TA_offset = 0; u16 N_TA_offset = 0;
if (frame_parms->frame_type == TDD) if (frame_parms->frame_type == TDD) {
N_TA_offset = 624/4; N_TA_offset = 624/4;
}
if (phy_vars_eNB) { if (phy_vars_eNB) {
if ((frame_parms->nb_antennas_rx>1) && (carrier>0)) { if ((frame_parms->nb_antennas_rx>1) && (carrier>0)) {
...@@ -974,9 +1163,11 @@ void setup_eNB_buffers(PHY_VARS_eNB *phy_vars_eNB, LTE_DL_FRAME_PARMS *frame_par ...@@ -974,9 +1163,11 @@ void setup_eNB_buffers(PHY_VARS_eNB *phy_vars_eNB, LTE_DL_FRAME_PARMS *frame_par
} }
// replace RX signal buffers with mmaped HW versions // replace RX signal buffers with mmaped HW versions
for (i=0;i<frame_parms->nb_antennas_rx;i++) { for (i=0; i<frame_parms->nb_antennas_rx; i++) {
free(phy_vars_eNB->lte_eNB_common_vars.rxdata[0][i]); free(phy_vars_eNB->lte_eNB_common_vars.rxdata[0][i]);
phy_vars_eNB->lte_eNB_common_vars.rxdata[0][i] = ((s32*) openair0_exmimo_pci[card].adc_head[i+carrier]) - N_TA_offset; // N_TA offset for TDD phy_vars_eNB->lte_eNB_common_vars.rxdata[0][i] = ((s32 *)
openair0_exmimo_pci[card].adc_head[i+carrier]) -
N_TA_offset; // N_TA offset for TDD
/* /*
printf("rxdata[%d] @ %p\n",i,phy_vars_eNB->lte_eNB_common_vars.rxdata[0][i]); printf("rxdata[%d] @ %p\n",i,phy_vars_eNB->lte_eNB_common_vars.rxdata[0][i]);
...@@ -986,9 +1177,10 @@ void setup_eNB_buffers(PHY_VARS_eNB *phy_vars_eNB, LTE_DL_FRAME_PARMS *frame_par ...@@ -986,9 +1177,10 @@ void setup_eNB_buffers(PHY_VARS_eNB *phy_vars_eNB, LTE_DL_FRAME_PARMS *frame_par
} }
*/ */
} }
for (i=0;i<frame_parms->nb_antennas_tx;i++) { for (i=0; i<frame_parms->nb_antennas_tx; i++) {
free(phy_vars_eNB->lte_eNB_common_vars.txdata[0][i]); free(phy_vars_eNB->lte_eNB_common_vars.txdata[0][i]);
phy_vars_eNB->lte_eNB_common_vars.txdata[0][i] = (s32*) openair0_exmimo_pci[card].dac_head[i+carrier]; phy_vars_eNB->lte_eNB_common_vars.txdata[0][i] = (s32 *)
openair0_exmimo_pci[card].dac_head[i+carrier];
/* /*
printf("txdata[%d] @ %p\n",i,phy_vars_eNB->lte_eNB_common_vars.txdata[0][i]); printf("txdata[%d] @ %p\n",i,phy_vars_eNB->lte_eNB_common_vars.txdata[0][i]);
......
...@@ -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