Commit 18cff959 authored by winckel's avatar winckel

Added support of LTE time (logical time) in ITTI messages.

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4393 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent cce6793d
...@@ -74,7 +74,7 @@ typedef enum task_state_s { ...@@ -74,7 +74,7 @@ typedef enum task_state_s {
} task_state_t; } task_state_t;
/* This list acts as a FIFO of messages received by tasks (RRC, NAS, ...) */ /* This list acts as a FIFO of messages received by tasks (RRC, NAS, ...) */
struct message_list_s { typedef struct message_list_s {
#if !defined(ENABLE_EVENT_FD) #if !defined(ENABLE_EVENT_FD)
STAILQ_ENTRY(message_list_s) next_element; STAILQ_ENTRY(message_list_s) next_element;
#endif #endif
...@@ -83,7 +83,7 @@ struct message_list_s { ...@@ -83,7 +83,7 @@ struct message_list_s {
message_number_t message_number; ///< Unique message number message_number_t message_number; ///< Unique message number
uint32_t message_priority; ///< Message priority uint32_t message_priority; ///< Message priority
}; } message_list_t;
typedef struct thread_desc_s { typedef struct thread_desc_s {
/* pthread associated with the thread */ /* pthread associated with the thread */
...@@ -126,7 +126,7 @@ typedef struct task_desc_s { ...@@ -126,7 +126,7 @@ typedef struct task_desc_s {
#endif #endif
} task_desc_t; } task_desc_t;
struct itti_desc_s { typedef struct itti_desc_s {
thread_desc_t *threads; thread_desc_t *threads;
task_desc_t *tasks; task_desc_t *tasks;
...@@ -141,9 +141,11 @@ struct itti_desc_s { ...@@ -141,9 +141,11 @@ struct itti_desc_s {
const task_info_t *tasks_info; const task_info_t *tasks_info;
const message_info_t *messages_info; const message_info_t *messages_info;
};
static struct itti_desc_s itti_desc; itti_lte_time_t lte_time;
} itti_desc_t;
static itti_desc_t itti_desc;
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
...@@ -172,6 +174,12 @@ const char *itti_get_task_name(task_id_t task_id) ...@@ -172,6 +174,12 @@ const char *itti_get_task_name(task_id_t task_id)
return (itti_desc.tasks_info[task_id].name); return (itti_desc.tasks_info[task_id].name);
} }
void itti_update_lte_time(uint32_t frame, uint8_t slot)
{
itti_desc.lte_time.frame = frame;
itti_desc.lte_time.slot = 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;
thread_id_t origin_thread_id; thread_id_t origin_thread_id;
...@@ -226,7 +234,7 @@ inline MessageDef *itti_alloc_new_message(task_id_t origin_task_id, MessagesIds ...@@ -226,7 +234,7 @@ inline MessageDef *itti_alloc_new_message(task_id_t origin_task_id, MessagesIds
int itti_send_msg_to_task(task_id_t task_id, instance_t instance, MessageDef *message) { int itti_send_msg_to_task(task_id_t task_id, instance_t instance, MessageDef *message) {
thread_id_t thread_id = TASK_GET_THREAD_ID(task_id); thread_id_t thread_id = TASK_GET_THREAD_ID(task_id);
struct message_list_s *new; message_list_t *new;
uint32_t priority; uint32_t priority;
message_number_t message_number; message_number_t message_number;
uint32_t message_id; uint32_t message_id;
...@@ -236,6 +244,8 @@ int itti_send_msg_to_task(task_id_t task_id, instance_t instance, MessageDef *me ...@@ -236,6 +244,8 @@ int itti_send_msg_to_task(task_id_t task_id, instance_t instance, MessageDef *me
message->header.destinationTaskId = task_id; message->header.destinationTaskId = task_id;
message->header.instance = instance; message->header.instance = instance;
message->header.lte_time.frame = itti_desc.lte_time.frame;
message->header.lte_time.slot = itti_desc.lte_time.slot;
message_id = message->header.messageId; message_id = message->header.messageId;
DevCheck(message_id < itti_desc.messages_id_max, itti_desc.messages_id_max, message_id, 0); DevCheck(message_id < itti_desc.messages_id_max, itti_desc.messages_id_max, message_id, 0);
...@@ -263,7 +273,7 @@ int itti_send_msg_to_task(task_id_t task_id, instance_t instance, MessageDef *me ...@@ -263,7 +273,7 @@ int itti_send_msg_to_task(task_id_t task_id, instance_t instance, MessageDef *me
#endif #endif
/* Allocate new list element */ /* Allocate new list element */
new = (struct message_list_s *) malloc (sizeof(struct message_list_s)); new = (message_list_t *) malloc (sizeof(struct message_list_s));
DevAssert(new != NULL); DevAssert(new != NULL);
/* Fill in members */ /* Fill in members */
...@@ -470,7 +480,7 @@ void itti_receive_msg(task_id_t task_id, MessageDef **received_msg) ...@@ -470,7 +480,7 @@ void itti_receive_msg(task_id_t task_id, MessageDef **received_msg)
} }
if (!STAILQ_EMPTY (&itti_desc.tasks[task_id].message_queue)) { if (!STAILQ_EMPTY (&itti_desc.tasks[task_id].message_queue)) {
struct message_list_s *temp = STAILQ_FIRST (&itti_desc.tasks[task_id].message_queue); message_list_t *temp = STAILQ_FIRST (&itti_desc.tasks[task_id].message_queue);
/* Update received_msg reference */ /* Update received_msg reference */
*received_msg = temp->msg; *received_msg = temp->msg;
...@@ -495,7 +505,7 @@ void itti_poll_msg(task_id_t task_id, MessageDef **received_msg) { ...@@ -495,7 +505,7 @@ void itti_poll_msg(task_id_t task_id, MessageDef **received_msg) {
itti_receive_msg_internal_event_fd(task_id, 1, received_msg); itti_receive_msg_internal_event_fd(task_id, 1, received_msg);
#else #else
if (itti_desc.tasks[task_id].message_in_queue != 0) { if (itti_desc.tasks[task_id].message_in_queue != 0) {
struct message_list_s *temp; message_list_t *temp;
// Lock the mutex to get exclusive access to the list // Lock the mutex to get exclusive access to the list
pthread_mutex_lock (&itti_desc.tasks[task_id].message_queue_mutex); pthread_mutex_lock (&itti_desc.tasks[task_id].message_queue_mutex);
......
...@@ -94,6 +94,13 @@ typedef struct task_info_s { ...@@ -94,6 +94,13 @@ typedef struct task_info_s {
const char * const name; const char * const name;
} task_info_t; } task_info_t;
/** \brief Update the itti LTE time reference for messages
\param current reference frame
\param current reference slot
@returns < 0 on failure, 0 otherwise
**/
void itti_update_lte_time(uint32_t frame, uint8_t slot);
/** \brief Send a broadcast message to every task /** \brief Send a broadcast message to every task
\param message_p Pointer to the message to send \param message_p Pointer to the message to send
@returns < 0 on failure, 0 otherwise @returns < 0 on failure, 0 otherwise
......
...@@ -123,18 +123,26 @@ typedef union msg_s ...@@ -123,18 +123,26 @@ typedef union msg_s
typedef int16_t instance_t; typedef int16_t instance_t;
typedef uint16_t MessageHeaderSize; typedef uint16_t MessageHeaderSize;
typedef struct itti_lte_time_s
{
uint32_t frame;
uint8_t slot;
} itti_lte_time_t;
/** @struct MessageHeader /** @struct MessageHeader
* @brief Message Header structure for inter-task communication. * @brief Message Header structure for inter-task communication.
*/ */
typedef struct MessageHeader_s typedef struct MessageHeader_s
{ {
MessagesIds messageId; /**< Unique message id as referenced in enum MessagesIds */ MessagesIds messageId; /**< Unique message id as referenced in enum MessagesIds */
task_id_t originTaskId; /**< ID of the sender task */ task_id_t originTaskId; /**< ID of the sender task */
task_id_t destinationTaskId; /**< ID of the destination task */ task_id_t destinationTaskId; /**< ID of the destination task */
instance_t instance; /**< Task instance for virtualization */ instance_t instance; /**< Task instance for virtualization */
MessageHeaderSize size; /**< Message size (not including header size) */ MessageHeaderSize size; /**< Message size (not including header size) */
itti_lte_time_t lte_time; /**< Reference LTE time */
} MessageHeader; } MessageHeader;
/** @struct MessageDef /** @struct MessageDef
......
...@@ -45,10 +45,10 @@ ...@@ -45,10 +45,10 @@
#include "queue.h" #include "queue.h"
#ifndef TMR_DEBUG #ifndef TMR_DEBUG
# define TMR_DEBUG(x, args...) do { fprintf(stdout, "[TMR] [D]"x, ##args); } while(0) # define TMR_DEBUG(x, args...) do { fprintf(stdout, "[TMR][D]"x, ##args); } while(0)
#endif #endif
#ifndef TMR_ERROR #ifndef TMR_ERROR
# define TMR_ERROR(x, args...) do { fprintf(stdout, "[TMR] [E]"x, ##args); } while(0) # define TMR_ERROR(x, args...) do { fprintf(stdout, "[TMR][E]"x, ##args); } while(0)
#endif #endif
int timer_handle_signal(siginfo_t *info); int timer_handle_signal(siginfo_t *info);
......
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