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 <assert.h>
00057 #include "wmp_config.h"
00058 #include "../../../core/include/wmp_utils.h"
00059
00060 #define MALLOC(p) malloc(p)
00061 #define FREE(p) free(p)
00062
00063 #define SEM_T sem_t
00064 #define SEM_INIT(p,q,r) sem_init(p,q,r)
00065 #define WAIT(nMutex) sem_wait(&nMutex )
00066 #define WAIT_TIMED(nMutex,time) \
00067 ({ \
00068 struct timespec ts; \
00069 clock_gettime(CLOCK_REALTIME,&ts); \
00070 wmp_add_ms(&ts,time); \
00071 sem_timedwait(&nMutex, &ts); \
00072 })
00073 #define SIGNAL(nMutex) sem_post(&nMutex)
00074 #define SEM_GET_COUNT(nMutex) ({int val; sem_getvalue(&nMutex, &val); val;})
00075
00076 #define MUTEX pthread_mutex_t
00077 #define MUTEX_INIT(m) pthread_mutex_init(m,0);
00078 #define MUTEX_WAIT(m) pthread_mutex_lock(&m)
00079 #define MUTEX_WAIT_SPIN(m) pthread_mutex_lock(&m)
00080 #define MUTEX_SIGNAL(m) pthread_mutex_unlock(&m)
00081
00082
00083 #define THREAD_T(name) pthread_t name = 0
00084 #define THREAD_CREATE(th_var,th_fun,name) pthread_create(&th_var, NULL, th_fun, NULL)
00085 #define THREAD_STOP(th_var)
00086
00087 #define THREAD_SEM_T pthread_mutex_t
00088 #define THREAD_SEM_INIT_LOCKED(p) pthread_mutex_init(p,0); pthread_mutex_lock(p);
00089 #define THREAD_SEM_WAIT(p) pthread_mutex_lock(p)
00090 #define THREAD_SEM_WAIT_TIMED(nMutex,time) \
00091 ({ \
00092 struct timespec ts; \
00093 clock_gettime(CLOCK_REALTIME,&ts); \
00094 wmp_add_ms(&ts,time); \
00095 pthread_mutex_timedlock(&nMutex, &ts); \
00096 })
00097 #define THREAD_SEM_SIGNAL(p) pthread_mutex_unlock(p)
00098
00099 #define ASSERT(p) assert(p);
00100
00101 #define GETNSTIMEOFDAY(p) clock_gettime(CLOCK_REALTIME, p)
00102
00103 #define FLOAT_OPS_START()
00104 #define FLOAT_OPS_END()
00105
00106 #define DO_DIV64(n , b) ((n)/(b))
00107
00108 #define EXIT(val) exit(val)
00109
00110 #define ATOF(src, dst) *dst = atof(src)
00111
00112 #define EXPORT_SYMBOLS()
00113
00114 #if WMP_DEBUG_LEVEL > 0
00115 #define DEBUG(p) p
00116 #define WMP_DEBUG(output, ...) fprintf(output, __VA_ARGS__)
00117 #define WMP_DEBUG1(output, ...) fprintf(output, __VA_ARGS__)
00118 #define WMP_DBG(level,...) if (level & (WMP_DEBUG_LEVEL)) fprintf(stderr, __VA_ARGS__)
00119 #else
00120 #define DEBUG(p)
00121 #define WMP_DEBUG(output, ...)
00122 #define WMP_DEBUG1(output, ...)
00123 #define WMP_DBG(output,...)
00124
00125 #endif
00126 #define WMP_MSG(output, ...) fprintf(output, __VA_ARGS__)
00127
00128 #define WMP_ERROR(output, ...) fprintf(output, __VA_ARGS__);
00129 #endif
00130
00131