Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 #ifndef CONFIGURATION_H_
00038 #define CONFIGURATION_H_
00039
00040 #include <sys/types.h>
00041 #include <sys/time.h>
00042 #include <unistd.h>
00043 #include <stdlib.h>
00044 #include <stdio.h>
00045 #include <string.h>
00046 #include "errno.h"
00047 #include <pthread.h>
00048 #include <limits.h>
00049 #include <math.h>
00050 #include <signal.h>
00051 #include <time.h>
00052 #include <stdarg.h>
00053
00054 #include <malloc.h>
00055 #include <semaphore.h>
00056 #include "../../../core/include/wmp_utils.h"
00057
00058 #define MALLOC(p) malloc(p)
00059 #define FREE(p) free(p)
00060
00061 #define SEM_T sem_t
00062 #define SEM_INIT(p,q,r) sem_init(p,q,r)
00063 #define WAIT(nMutex) sem_wait(&nMutex )
00064 #define WAIT_TIMED(nMutex,time) \
00065 ({ \
00066 struct timespec ts; \
00067 clock_gettime(CLOCK_REALTIME,&ts); \
00068 wmp_add_ms(&ts,time); \
00069 sem_timedwait(&nMutex, &ts); \
00070 })
00071 #define SIGNAL(nMutex) sem_post(&nMutex)
00072
00073 #define MUTEX pthread_mutex_t
00074 #define MUTEX_INIT(m) pthread_mutex_init(m,0);
00075 #define MUTEX_WAIT(m) pthread_mutex_lock(&m)
00076 #define MUTEX_WAIT_SPIN(m) pthread_mutex_lock(&m)
00077 #define MUTEX_SIGNAL(m) pthread_mutex_unlock(&m)
00078
00079 #define THREAD_T(name) pthread_t name = 0
00080 #define THREAD_CREATE(th_var,th_fun,name) pthread_create(&th_var, NULL, th_fun, NULL)
00081 #define THREAD_STOP(th_var)
00082
00083 #define THREAD_SEM_T pthread_mutex_t
00084 #define THREAD_MUTEX_INIT_LOCKED(p) pthread_mutex_init(p,0); pthread_mutex_lock(p);
00085 #define THREAD_SEM_WAIT(p) pthread_mutex_lock(p)
00086 #define THREAD_SEM_WAIT_TIMED(nMutex,time) \
00087 ({ \
00088 struct timespec ts; \
00089 clock_gettime(CLOCK_REALTIME,&ts); \
00090 wmp_add_ms(&ts,time); \
00091 pthread_mutex_timedlock(&nMutex, &ts); \
00092 })
00093 #define THREAD_SEM_SIGNAL(p) pthread_mutex_unlock(p)
00094
00095 #define ASSERT
00096
00097 #define GETNSTIMEOFDAY(p) clock_gettime(CLOCK_REALTIME, p)
00098
00099 #define FLOAT_OPS_START()
00100 #define FLOAT_OPS_END()
00101
00102 #define DO_DIV64(n , b) ((n)/(b))
00103
00104 #define EXIT(val) exit(val)
00105
00106 #define ATOF(src, dst) *dst = atof(src)
00107
00108 #define EXPORT_SYMBOLS()
00109
00110 #if WMP_DEBUG_LEVEL > 0
00111 #define DEBUG(p) p
00112 #define WMP_DEBUG(output, ...) fprintf(output, __VA_ARGS__)
00113 #define WMP_DBG(level,...) if (level == WMP_DEBUG_LEVEL) fprintf(stderr, __VA_ARGS__)
00114 #else
00115 #define DEBUG(p)
00116 #define WMP_DEBUG(output, ...)
00117 #define WMP_DBG(level,...)
00118 #endif
00119 #define WMP_MSG(output, ...) fprintf(output, __VA_ARGS__)
00120 #define WMP_ERROR(output, ...) fprintf(output, __VA_ARGS__)
00121
00122 #endif
00123