Commit 889d03c0 authored by Cedric Roux's avatar Cedric Roux

- Fix build for NAS timers on UE side

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4654 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 4a4773b3
...@@ -51,7 +51,7 @@ Description Timer utilities ...@@ -51,7 +51,7 @@ Description Timer utilities
* value when the timer entry was allocated. * value when the timer entry was allocated.
*/ */
typedef struct { typedef struct {
#if defined(EPC_BUILD) #if defined(ENABLE_ITTI)
long timer_id; /* Timer id returned by the timer API from ITTI */ long timer_id; /* Timer id returned by the timer API from ITTI */
#else #else
pthread_t pid; /* Thread identifier of the callback */ pthread_t pid; /* Thread identifier of the callback */
...@@ -88,7 +88,7 @@ typedef struct { ...@@ -88,7 +88,7 @@ typedef struct {
timer_queue_t tq[TIMER_DATABASE_SIZE]; timer_queue_t tq[TIMER_DATABASE_SIZE];
timer_queue_t *head;/* Pointer to the first timer entry to be fired */ timer_queue_t *head;/* Pointer to the first timer entry to be fired */
#if !defined(EPC_BUILD) #if !defined(ENABLE_ITTI)
pthread_mutex_t mutex; pthread_mutex_t mutex;
#endif #endif
} nas_timer_database_t; } nas_timer_database_t;
...@@ -100,12 +100,12 @@ static nas_timer_database_t _nas_timer_db = { ...@@ -100,12 +100,12 @@ static nas_timer_database_t _nas_timer_db = {
0, 0,
{}, {},
NULL NULL
#if !defined(EPC_BUILD) #if !defined(ENABLE_ITTI)
, PTHREAD_MUTEX_INITIALIZER , PTHREAD_MUTEX_INITIALIZER
#endif #endif
}; };
#if defined(EPC_BUILD) #if defined(ENABLE_ITTI)
#define nas_timer_lock_db() #define nas_timer_lock_db()
#define nas_timer_unlock_db() #define nas_timer_unlock_db()
#else #else
...@@ -116,7 +116,7 @@ static nas_timer_database_t _nas_timer_db = { ...@@ -116,7 +116,7 @@ static nas_timer_database_t _nas_timer_db = {
/* /*
* The handler executed whenever the system timer expires * The handler executed whenever the system timer expires
*/ */
#if !defined(EPC_BUILD) #if !defined(ENABLE_ITTI)
static void _nas_timer_handler(int signal); static void _nas_timer_handler(int signal);
#endif #endif
...@@ -173,7 +173,7 @@ int nas_timer_init(void) ...@@ -173,7 +173,7 @@ int nas_timer_init(void)
/* Initialize the timer database */ /* Initialize the timer database */
_nas_timer_db_init(); _nas_timer_db_init();
#if !defined(EPC_BUILD) #if !defined(ENABLE_ITTI)
/* Setup the timer database handler */ /* Setup the timer database handler */
struct sigaction act; struct sigaction act;
...@@ -223,7 +223,7 @@ int nas_timer_start(long sec, nas_timer_callback_t cb, void *args) ...@@ -223,7 +223,7 @@ int nas_timer_start(long sec, nas_timer_callback_t cb, void *args)
{ {
int id; int id;
nas_timer_entry_t *te; nas_timer_entry_t *te;
#if defined(EPC_BUILD) #if defined(ENABLE_ITTI)
int ret; int ret;
long timer_id; long timer_id;
#endif #endif
...@@ -248,9 +248,12 @@ int nas_timer_start(long sec, nas_timer_callback_t cb, void *args) ...@@ -248,9 +248,12 @@ int nas_timer_start(long sec, nas_timer_callback_t cb, void *args)
/* Insert the new entry into the timer queue */ /* Insert the new entry into the timer queue */
_nas_timer_db_insert_entry(id, te); _nas_timer_db_insert_entry(id, te);
#if defined(EPC_BUILD) #if defined(ENABLE_ITTI)
# if defined(EPC_BUILD)
ret = timer_setup(sec, 0, TASK_NAS, INSTANCE_DEFAULT, TIMER_PERIODIC, args, &timer_id); ret = timer_setup(sec, 0, TASK_NAS, INSTANCE_DEFAULT, TIMER_PERIODIC, args, &timer_id);
# else
ret = timer_setup(sec, 0, TASK_NAS_UE, INSTANCE_DEFAULT, TIMER_PERIODIC, args, &timer_id);
# endif
if (ret == -1) { if (ret == -1) {
return NAS_TIMER_INACTIVE_ID; return NAS_TIMER_INACTIVE_ID;
} }
...@@ -346,7 +349,7 @@ int nas_timer_restart(int id) ...@@ -346,7 +349,7 @@ int nas_timer_restart(int id)
** Others: _nas_timer_db ** ** Others: _nas_timer_db **
** ** ** **
***************************************************************************/ ***************************************************************************/
#if defined(EPC_BUILD) #if defined(ENABLE_ITTI)
void nas_timer_handle_signal_expiry(long timer_id, void *arg_p) void nas_timer_handle_signal_expiry(long timer_id, void *arg_p)
{ {
/* Get the timer entry for which the system timer expired */ /* Get the timer entry for which the system timer expired */
...@@ -573,7 +576,7 @@ static void _nas_timer_db_insert_entry(int id, nas_timer_entry_t *te) ...@@ -573,7 +576,7 @@ static void _nas_timer_db_insert_entry(int id, nas_timer_entry_t *te)
restart = _nas_timer_db_insert(&_nas_timer_db.tq[id]); restart = _nas_timer_db_insert(&_nas_timer_db.tq[id]);
nas_timer_unlock_db(); nas_timer_unlock_db();
#if !defined(EPC_BUILD) #if !defined(ENABLE_ITTI)
if (restart) { if (restart) {
/* The new entry is the first entry of the list; /* The new entry is the first entry of the list;
* restart the system timer */ * restart the system timer */
...@@ -665,7 +668,7 @@ static nas_timer_entry_t *_nas_timer_db_remove_entry(int id) ...@@ -665,7 +668,7 @@ static nas_timer_entry_t *_nas_timer_db_remove_entry(int id)
/* tv = tv - time() */ /* tv = tv - time() */
rc = _nas_timer_sub(&_nas_timer_db.head->entry->tv, &tv, &it.it_value); rc = _nas_timer_sub(&_nas_timer_db.head->entry->tv, &tv, &it.it_value);
#if defined(EPC_BUILD) #if defined(ENABLE_ITTI)
timer_remove(_nas_timer_db.head->entry->timer_id); timer_remove(_nas_timer_db.head->entry->timer_id);
(void) (rc); (void) (rc);
#else #else
...@@ -705,7 +708,7 @@ static int _nas_timer_db_remove(timer_queue_t *entry) ...@@ -705,7 +708,7 @@ static int _nas_timer_db_remove(timer_queue_t *entry)
/* Other timers are scheduled to expire */ /* Other timers are scheduled to expire */
return TRUE; return TRUE;
} }
#if !defined(EPC_BUILD) #if !defined(ENABLE_ITTI)
{ {
/* No more timer is scheduled to expire; stop the system timer */ /* No more timer is scheduled to expire; stop the system timer */
struct itimerval it; struct itimerval it;
...@@ -727,17 +730,17 @@ static int _nas_timer_db_remove(timer_queue_t *entry) ...@@ -727,17 +730,17 @@ static int _nas_timer_db_remove(timer_queue_t *entry)
*/ */
/**************************************************************************** /****************************************************************************
** ** ** **
** Name: _nas_timer_cmp() ** ** Name: _nas_timer_cmp() **
** ** ** **
** Description: Performs timeval comparaison ** ** Description: Performs timeval comparaison **
** ** ** **
** Inputs: a: The first timeval structure ** ** Inputs: a: The first timeval structure **
** b: The second timeval structure ** ** b: The second timeval structure **
** Others: None ** ** Others: None **
** ** ** **
** Outputs: None ** ** Outputs: None **
** Return: -1 if a < b; 1 if a > b; 0 if a == b ** ** Return: -1 if a < b; 1 if a > b; 0 if a == b **
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
static int _nas_timer_cmp(const struct timeval *a, const struct timeval *b) static int _nas_timer_cmp(const struct timeval *a, const struct timeval *b)
......
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