compiler.h
Go to the documentation of this file.
00001 /*------------------------------------------------------------------------
00002  *---------------------           RT-WMP              --------------------
00003  *------------------------------------------------------------------------
00004  *                                                         V7.0B  11/05/10
00005  *
00006  *
00007  *  File: ./src/platforms/MaRTE_OS/config/compiler.h
00008  *  Authors: Danilo Tardioli
00009  *  ----------------------------------------------------------------------
00010  *  Copyright (C) 2000-2010, Universidad de Zaragoza, SPAIN
00011  *
00012  *  Contact Addresses: Danilo Tardioli                   dantard@unizar.es
00013  *
00014  *  RT-WMP is free software; you can  redistribute it and/or  modify it
00015  *  under the terms of the GNU General Public License  as published by the
00016  *  Free Software Foundation;  either  version 2, or (at  your option) any
00017  *  later version.
00018  *
00019  *  RT-WMP  is distributed  in the  hope  that  it will be   useful, but
00020  *  WITHOUT  ANY  WARRANTY;     without  even the   implied   warranty  of
00021  *  MERCHANTABILITY  or  FITNESS FOR A  PARTICULAR PURPOSE.    See the GNU
00022  *  General Public License for more details.
00023  *
00024  *  You should have received  a  copy of  the  GNU General Public  License
00025  *  distributed with RT-WMP;  see file COPYING.   If not,  write to the
00026  *  Free Software  Foundation,  59 Temple Place  -  Suite 330,  Boston, MA
00027  *  02111-1307, USA.
00028  *
00029  *  As a  special exception, if you  link this  unit  with other  files to
00030  *  produce an   executable,   this unit  does  not  by  itself cause  the
00031  *  resulting executable to be covered by the  GNU General Public License.
00032  *  This exception does  not however invalidate  any other reasons why the
00033  *  executable file might be covered by the GNU Public License.
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 /*CONFIGURATION_H_*/
00123 


ros_rt_wmp
Author(s): Danilo Tardioli, dantard@unizar.es
autogenerated on Fri Jan 3 2014 12:07:54