diff --git a/3rdPartyLibs/cint_platform_Ubuntu_gcc4_so b/3rdPartyLibs/cint_platform_Ubuntu_gcc4_so new file mode 100755 index 0000000..0fa6bd0 --- /dev/null +++ b/3rdPartyLibs/cint_platform_Ubuntu_gcc4_so @@ -0,0 +1,49 @@ +############################################################ +# platform/linux_RH7.3_gcc4_so +# Platform dependent information for LINUX 2.0 RedHatH6.2 or later +# using gcc-4.1.2 +# Build libcint.so instead of G__ci.a. And creates multi-thread safe DLLs. +# Based on Christoph Bugel's proposal about multi-threading. +############################################################ + +# Tools +RM = rm -f +CP = cp +AR = ar +AROPT = clq +KRCC = gcc -traditional +CC = gcc -fexceptions -Wall +CPP = g++ -Wall +LD = g++ +CPREP = gcc -E -C +CPPPREP = g++ -E -C + +# Compiler and linker option +CCDLLOPT = -fPIC +LDDLLOPT = -shared -lpthread +OPTIMIZE = -O3 +LDOPT = -lm -ldl -lncurses -lpthread +SHLIB_OPT = -Wl,-hlibcint.so +SYSMACRO = -DG__REGEXP -DG__SHAREDLIB -DG__OSFDLL -DG__ANSI -DG__ERRORCALLBACK -DG__NEWSTDHEADER +OTHMACRO = -DG__P2FCAST -DG__REDIRECTIO -DG__DETECT_NEWDEL -DG__POSIX -DG__STD_EXCEPTION $(CCDLLPOST) +SYSIPATH = + +# libraries +MAINO = $(CINTSYSDIR)/main/G__cppmain.o +CINTLIB = $(CINTSYSDIR)/libcint.so +READLINEA = /usr/lib/i386-linux-gnu/libreadline.so +APIO = Api.o Class.o BaseCls.o Type.o DataMbr.o Method.o MethodAr.o CallFunc.o Typedf.o Apiif.o Token.o +RANLIB = /usr/bin/ranlib +STDLIBS = dmystrm.o stdstrct.o +PLATFORM = $(CINTSYSDIR)/main/G__setup.o + +# source code postfix +CSRCPOST = .c +CHDRPOST = .h +CPPSRCPOST = .C +CPPHDRPOST = .h +OBJPOST = .o +DLLPOST = .dl + + + diff --git a/BaseLib2/Level0/Directory.h b/BaseLib2/Level0/Directory.h index 02fe8eb..5611d5b 100644 --- a/BaseLib2/Level0/Directory.h +++ b/BaseLib2/Level0/Directory.h @@ -59,6 +59,7 @@ class DirectoryEntry: public LinkedListable{ #if (defined (_VXWORKS) || defined(_RTAI) || defined(_LINUX) || (defined _SOLARIS) || defined(_MACOSX)) /** attributes of the file */ struct stat fileStatistics; + int fileStatisticsErr; #elif defined(_WIN32) /** all the data about the file or directory */ WIN32_FIND_DATA fileData; @@ -97,7 +98,7 @@ class DirectoryEntry: public LinkedListable{ /** is it a directory */ bool IsDirectory(){ #if (defined (_VXWORKS)||defined(_RTAI)|| defined(_LINUX) || defined(_SOLARIS) || defined(_MACOSX)) - return S_ISDIR(fileStatistics.st_mode); + return (fileStatisticsErr == 0 && S_ISDIR(fileStatistics.st_mode)); #elif defined(_WIN32) return ((fileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)!=0); #else @@ -108,7 +109,7 @@ class DirectoryEntry: public LinkedListable{ /** is it a file */ bool IsFile(){ #if (defined (_VXWORKS)||defined(_RTAI)|| defined(_LINUX) || defined(_SOLARIS) || defined(_MACOSX)) - return S_ISREG(fileStatistics.st_mode); + return (fileStatisticsErr == 0 && S_ISREG(fileStatistics.st_mode)); #else return IsDirectory() == False; #endif @@ -129,7 +130,10 @@ class DirectoryEntry: public LinkedListable{ /** the file size */ int64 Size(){ #if (defined (_VXWORKS)||defined(_RTAI)|| defined(_LINUX) || defined(_SOLARIS) || defined(_MACOSX)) - return fileStatistics.st_size; + // st_size is of type "off_t" which the standard specifies "shall be signed integer type." + // We will return 0 as the size when stat(...) has returned an error, because the size + // is still used to calculate total size of files in a LinkedListHolder + return (fileStatisticsErr == 0 ? fileStatistics.st_size : (off_t)(0)); #elif defined(_WIN32) uint64 sz = fileData.nFileSizeHigh; sz <<= 32; @@ -143,7 +147,8 @@ class DirectoryEntry: public LinkedListable{ /** last write time */ time_t Time(){ #if (defined (_VXWORKS)||defined(_RTAI)|| defined(_LINUX) || defined(_SOLARIS) || defined(_MACOSX)) - return fileStatistics.st_mtime; + // time( time_t *arg ) returns a time_t with value of -1 for an error, so we will do the same + return (fileStatisticsErr == 0 ? fileStatistics.st_mtime : (time_t)(-1)); #elif defined(_WIN32) uint64 t = *((uint64 *)&fileData.ftLastWriteTime); uint64 t2; @@ -160,7 +165,8 @@ class DirectoryEntry: public LinkedListable{ /** last access time */ time_t LastAccessTime(){ #if (defined (_VXWORKS)||defined(_RTAI)|| defined(_LINUX) || defined(_SOLARIS) || defined(_MACOSX)) - return fileStatistics.st_atime; + // time( time_t *arg ) returns a time_t with value of -1 for an error, so we will do the same + return (fileStatisticsErr == 0 ? fileStatistics.st_atime : (time_t)(-1)); #elif defined(_WIN32) uint64 t = *((uint64 *)&fileData.ftLastAccessTime); uint64 t2; @@ -231,7 +237,7 @@ class Directory: public LinkedListHolder { strcat(statAddr, "/"); strcat(statAddr, entry->fname); - stat(statAddr,&entry->fileStatistics); + entry->fileStatisticsErr = stat(statAddr,&entry->fileStatistics); size += entry->Size(); } free((void *&)de); @@ -263,7 +269,7 @@ class Directory: public LinkedListHolder { strcat(statAddr, "/"); strcat(statAddr, entry->fname); - stat(statAddr,&entry->fileStatistics); + entry->fileStatisticsErr = stat(statAddr,&entry->fileStatistics); size += entry->Size(); } } @@ -298,7 +304,7 @@ class Directory: public LinkedListHolder { strcat(statAddr, "/"); strcat(statAddr, entry->fname); - stat(statAddr,&entry->fileStatistics); + &entry->fileStatisticsErr = stat(statAddr,&entry->fileStatistics); size += entry->Size(); } closedir(d); @@ -320,7 +326,7 @@ class Directory: public LinkedListHolder { strcat(statAddr, "/"); strcat(statAddr, entry->fname); - stat(statAddr,&entry->fileStatistics); + &entry->fileStatisticsErr = stat(statAddr,&entry->fileStatistics); size += entry->Size(); } closedir(d); @@ -432,8 +438,11 @@ class Directory: public LinkedListHolder { return (attrs & FILE_ATTRIBUTE_DIRECTORY); #elif (defined(_LINUX) || defined(_MACOSX)) struct stat fileStats; - stat(address, &fileStats); - return S_ISDIR(fileStats.st_mode); + if (stat(address, &fileStats) == 0) { + return S_ISDIR(fileStats.st_mode); + } else { + return False; + } #else // NOT IMPLEMENTED return False; diff --git a/BaseLib2/Level0/LoadableLibrary.h b/BaseLib2/Level0/LoadableLibrary.h index d3de58b..16a3806 100644 --- a/BaseLib2/Level0/LoadableLibrary.h +++ b/BaseLib2/Level0/LoadableLibrary.h @@ -30,6 +30,7 @@ #define LOADABLE_LIBRARY_H #include "System.h" +#include "ErrorManagement.h" #if defined _VXWORKS /** */ @@ -125,7 +126,10 @@ class LoadableLibrary{ if (module != 0) Close(); module = dlopen(dllName, RTLD_NOW|RTLD_GLOBAL); - if (module==NULL) return False; + if (module==NULL) { + CStaticAssertErrorCondition(Information,"LoadableLibrary: %s", dlerror()); + return False; + } return True; #elif (defined (_WIN32) || defined(_RSXNT)) if (dllName == NULL) return False; diff --git a/BaseLib2/Level0/StaticListTemplate.h b/BaseLib2/Level0/StaticListTemplate.h index 836e6b6..b54c569 100644 --- a/BaseLib2/Level0/StaticListTemplate.h +++ b/BaseLib2/Level0/StaticListTemplate.h @@ -74,7 +74,7 @@ class StaticListTemplate:protected StaticListHolder { /** Add a the top */ inline void ListInsert(const T &element){ - return StaticListHolder::ListAdd((const intptr *)&element,SLH_StartOfList); + StaticListHolder::ListAdd((const intptr *)&element,SLH_StartOfList); } /** removes at the specified position */ diff --git a/BaseLib2/Level0/Threads.cpp b/BaseLib2/Level0/Threads.cpp index 56ce63a..dc13c8a 100644 --- a/BaseLib2/Level0/Threads.cpp +++ b/BaseLib2/Level0/Threads.cpp @@ -406,7 +406,15 @@ TID ThreadsBeginThread(ThreadFunctionType function, pthread_attr_init(&stackSizeAttribute); pthread_attr_setstacksize(&stackSizeAttribute, stacksize); StandardThreadFunction Function = (StandardThreadFunction)SystemThreadFunction; - pthread_create(&ID, &stackSizeAttribute, Function, tii); + int threadCreationReturn = pthread_create(&ID, &stackSizeAttribute, Function, tii); + if (threadCreationReturn != 0) { + if (threadCreationReturn == 11) { + CStaticAssertErrorCondition(FatalError,"Threads::BeginThread (%s) pthread_create failed with error number 11! Usually 11=EAGAIN, no memory or too many threads. Check `ulimit -a`",name); + } else { + CStaticAssertErrorCondition(FatalError,"Threads::BeginThread (%s) pthread_create failed with error number %d! ",name); + } + return 0; + } pthread_detach(ID); pthread_setaffinity_np(ID, sizeof(runOnCPUs.processorMask), (cpu_set_t *)&runOnCPUs.processorMask); #elif (defined _SOLARIS || defined(_MACOSX)) && (defined USE_PTHREAD) diff --git a/BaseLib2/Level1/ObjectRegistryDataBase.cpp b/BaseLib2/Level1/ObjectRegistryDataBase.cpp index 79d2342..63b4850 100644 --- a/BaseLib2/Level1/ObjectRegistryDataBase.cpp +++ b/BaseLib2/Level1/ObjectRegistryDataBase.cpp @@ -173,6 +173,9 @@ class ObjectRegistryDataBase : private LinkedListHolder{ char dllName_[maxSize]; const char *dllName; + // check for empty className + if (className[0] == 0) return NULL; + // check for dllName::className syntax if (hasDllName){ int size = hasDllName-className; @@ -204,16 +207,6 @@ class ObjectRegistryDataBase : private LinkedListHolder{ // ret = ll->Open(fullName); // } - // GENERAL APPLICATION MODULE - if (!ret) { - sprintf(fullName,"%s.gam",dllName); - ret = ll->Open(fullName); - } - // HIGH LEVEL DRIVER (GENERAL ACQUISITION MODULE) - if (!ret) { - sprintf(fullName,"%s.drv",dllName); - ret = ll->Open(fullName); - } #if defined(_MACOSX) // MAC OS X NAME FOR DLL if (!ret) { @@ -221,17 +214,27 @@ class ObjectRegistryDataBase : private LinkedListHolder{ ret = ll->Open(fullName); } #else + // LINUX NAME FOR DLL + if (!ret) { + sprintf(fullName,"%s.so",dllName); + ret = ll->Open(fullName); + } // STD NAME FOR DLL if (!ret) { sprintf(fullName,"%s.dll",dllName); ret = ll->Open(fullName); } - // LINUX NAME FOR DLL +#endif + // GENERAL APPLICATION MODULE if (!ret) { - sprintf(fullName,"%s.so",dllName); + sprintf(fullName,"%s.gam",dllName); + ret = ll->Open(fullName); + } + // HIGH LEVEL DRIVER (GENERAL ACQUISITION MODULE) + if (!ret) { + sprintf(fullName,"%s.drv",dllName); ret = ll->Open(fullName); } -#endif free((void *&)fullName); if (!ret) return NULL; diff --git a/BaseLib2/Level6/WaveformInterface.h b/BaseLib2/Level6/WaveformInterface.h index 41ac786..3e8b14b 100644 --- a/BaseLib2/Level6/WaveformInterface.h +++ b/BaseLib2/Level6/WaveformInterface.h @@ -30,6 +30,7 @@ #define WAVEFORMINTERFACE_H_ #include "System.h" +#include "GAM.h" class WaveformInterface { public: @@ -51,6 +52,8 @@ class WaveformInterface { return (double)GetValue((int32)usecTime); } + inline virtual void SetState(GAM_FunctionNumbers state) {} + virtual void Reset() = 0; }; diff --git a/GAMs/DataCollectionGAM/DataCollectionGAM.h b/GAMs/DataCollectionGAM/DataCollectionGAM.h index 8497eb0..c6e9e69 100644 --- a/GAMs/DataCollectionGAM/DataCollectionGAM.h +++ b/GAMs/DataCollectionGAM/DataCollectionGAM.h @@ -114,6 +114,9 @@ OBJECT_DLL_STUFF(DataCollectionGAM) * @return False on error, True otherwise. */ virtual bool ProcessHttpMessage(HttpStream &hStream); + + + int GetTotalSamplesCollected(); }; #endif diff --git a/GAMs/ExpEval/Makefile.inc b/GAMs/ExpEval/Makefile.inc index c619f19..ad1795d 100644 --- a/GAMs/ExpEval/Makefile.inc +++ b/GAMs/ExpEval/Makefile.inc @@ -42,5 +42,6 @@ all: $(OBJS) $(SUBPROJ)\ $(TARGET)/ExpEvalGAM$(GAMEXT) echo $(OBJS) +include depends.$(TARGET) include $(MAKEDEFAULTDIR)/MakeStdLibRules.$(TARGET) diff --git a/GAMs/ExpEval/Module/Makefile.inc b/GAMs/ExpEval/Module/Makefile.inc index 2753f73..1b71ed2 100644 --- a/GAMs/ExpEval/Module/Makefile.inc +++ b/GAMs/ExpEval/Module/Makefile.inc @@ -43,5 +43,6 @@ all: $(OBJS) \ $(TARGET)/ExpEval$(DLLEXT) echo $(OBJS) +include depends.$(TARGET) include $(MAKEDEFAULTDIR)/MakeStdLibRules.$(TARGET) diff --git a/GAMs/PIDGAM/PIDGAMClassInfo.sinfo.cpp b/GAMs/PIDGAM/PIDGAMClassInfo.sinfo.cpp deleted file mode 100644 index c697a25..0000000 --- a/GAMs/PIDGAM/PIDGAMClassInfo.sinfo.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright 2011 EFDA | European Fusion Development Agreement - * - * Licensed under the EUPL, Version 1.1 or - as soon they - will be approved by the European Commission - subsequent - versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the - Licence. - * You may obtain a copy of the Licence at: - * - * http://ec.europa.eu/idabc/eupl - * - * Unless required by applicable law or agreed to in - writing, software distributed under the Licence is - distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either - express or implied. - * See the Licence for the specific language governing - permissions and limitations under the Licence. - * - * $Id$ - * -**/ -#define protected public -#define private public -#include "PIDGAMClassInfo.h" -#include "ObjectRegistryItem.h" -#include "ClassStructure.h" -#include "ObjectMacros.h" -static ClassStructureEntry PIDGAMOutputStructure_controlSignal_CSE_EL("float","",0,0,0,0,0 ,"controlSignal",msizeof(PIDGAMOutputStructure,controlSignal),indexof(PIDGAMOutputStructure,controlSignal)); -static ClassStructureEntry PIDGAMOutputStructure_feedback_CSE_EL("float","",0,0,0,0,0 ,"feedback",msizeof(PIDGAMOutputStructure,feedback),indexof(PIDGAMOutputStructure,feedback)); -static ClassStructureEntry PIDGAMOutputStructure_error_CSE_EL("float","",0,0,0,0,0 ,"error",msizeof(PIDGAMOutputStructure,error),indexof(PIDGAMOutputStructure,error)); -static ClassStructureEntry PIDGAMOutputStructure_integratorState_CSE_EL("float","",0,0,0,0,0 ,"integratorState",msizeof(PIDGAMOutputStructure,integratorState),indexof(PIDGAMOutputStructure,integratorState)); -static ClassStructureEntry PIDGAMOutputStructure_fastDischargeAction_CSE_EL("float","",0,0,0,0,0 ,"fastDischargeAction",msizeof(PIDGAMOutputStructure,fastDischargeAction),indexof(PIDGAMOutputStructure,fastDischargeAction)); -static ClassStructureEntry PIDGAMOutputStructure_antiwindupAction_CSE_EL("float","",0,0,0,0,0 ,"antiwindupAction",msizeof(PIDGAMOutputStructure,antiwindupAction),indexof(PIDGAMOutputStructure,antiwindupAction)); -static ClassStructureEntry * PIDGAMOutputStructure__CSE__[] = { - &PIDGAMOutputStructure_controlSignal_CSE_EL, - &PIDGAMOutputStructure_feedback_CSE_EL, - &PIDGAMOutputStructure_error_CSE_EL, - &PIDGAMOutputStructure_integratorState_CSE_EL, - &PIDGAMOutputStructure_fastDischargeAction_CSE_EL, - &PIDGAMOutputStructure_antiwindupAction_CSE_EL, - NULL -}; -ClassStructure PIDGAMOutputStructure__CS__("PIDGAMOutputStructure",sizeof(PIDGAMOutputStructure),0 ,PIDGAMOutputStructure__CSE__); -STRUCTREGISTER("PIDGAMOutputStructure",PIDGAMOutputStructure__CS__) -static ClassStructureEntry PIDGAMInputStructure_usecTime_CSE_EL("unsigned int","",0,0,0,0,0 ,"usecTime",msizeof(PIDGAMInputStructure,usecTime),indexof(PIDGAMInputStructure,usecTime)); -static ClassStructureEntry PIDGAMInputStructure_reference_CSE_EL("float","",0,0,0,0,0 ,"reference",msizeof(PIDGAMInputStructure,reference),indexof(PIDGAMInputStructure,reference)); -static ClassStructureEntry PIDGAMInputStructure_measurement_CSE_EL("float","",0,0,0,0,0 ,"measurement",msizeof(PIDGAMInputStructure,measurement),indexof(PIDGAMInputStructure,measurement)); -static ClassStructureEntry PIDGAMInputStructure_feedforward_CSE_EL("float","",0,0,0,0,0 ,"feedforward",msizeof(PIDGAMInputStructure,feedforward),indexof(PIDGAMInputStructure,feedforward)); -static ClassStructureEntry * PIDGAMInputStructure__CSE__[] = { - &PIDGAMInputStructure_usecTime_CSE_EL, - &PIDGAMInputStructure_reference_CSE_EL, - &PIDGAMInputStructure_measurement_CSE_EL, - &PIDGAMInputStructure_feedforward_CSE_EL, - NULL -}; -ClassStructure PIDGAMInputStructure__CS__("PIDGAMInputStructure",sizeof(PIDGAMInputStructure),0 ,PIDGAMInputStructure__CSE__); -STRUCTREGISTER("PIDGAMInputStructure",PIDGAMInputStructure__CS__) -static ClassStructureEntry PIDGAMClassInfo_input_CSE_EL("PIDGAMInputStructure","",0,0,0,0,0 ,"input",msizeof(PIDGAMClassInfo,input),indexof(PIDGAMClassInfo,input)); -static ClassStructureEntry PIDGAMClassInfo_output_CSE_EL("PIDGAMOutputStructure","",0,0,0,0,0 ,"output",msizeof(PIDGAMClassInfo,output),indexof(PIDGAMClassInfo,output)); -static ClassStructureEntry * PIDGAMClassInfo__CSE__[] = { - &PIDGAMClassInfo_input_CSE_EL, - &PIDGAMClassInfo_output_CSE_EL, - NULL -}; -ClassStructure PIDGAMClassInfo__CS__("PIDGAMClassInfo",sizeof(PIDGAMClassInfo),0 ,PIDGAMClassInfo__CSE__); -STRUCTREGISTER("PIDGAMClassInfo",PIDGAMClassInfo__CS__) -ClassStructure * PIDGAMClassInfo_sinfo[] = { - &PIDGAMOutputStructure__CS__, - &PIDGAMInputStructure__CS__, - &PIDGAMClassInfo__CS__, - NULL -}; diff --git a/GAMs/PIDGAM/temp/temp.pp b/GAMs/PIDGAM/temp/temp.pp deleted file mode 100644 index 21c4470..0000000 --- a/GAMs/PIDGAM/temp/temp.pp +++ /dev/null @@ -1,202 +0,0 @@ -# 1 "PIDGAMClassInfo.h" -# 1 "/home/andre/Projects/EFDA-MARTe/GAMs/PIDGAM//" -# 1 "" -# 1 "" -# 1 "PIDGAMClassInfo.h" -# 28 "PIDGAMClassInfo.h" -# 1 "../../BaseLib2/Level0/System.h" 1 -# 51 "../../BaseLib2/Level0/System.h" -# 1 "../../BaseLib2/Level0/SystemCINT.h" 1 -# 36 "../../BaseLib2/Level0/SystemCINT.h" -struct unknown{ - void *nowhere; -}; -# 52 "../../BaseLib2/Level0/System.h" 2 - - -# 1 "../../BaseLib2/Level0/GenDefs.h" 1 -# 38 "../../BaseLib2/Level0/GenDefs.h" -typedef float real; -# 175 "../../BaseLib2/Level0/GenDefs.h" -enum Colours{ - - Black = 0, - - DarkBlue = 1, - - DarkGreen = 2, - - DarkCyan = 3, - - DarkRed = 4, - - DarkPurple = 5, - - DarkYellow = 6, - - Grey = 7, - - DarkGrey = 8, - - Blue = 9, - - Green = 10, - - Cyan = 11, - - Red = 12, - - Purple = 13, - - Yellow = 14, - - White = 15 -}; -# 55 "../../BaseLib2/Level0/System.h" 2 -# 1 "../../BaseLib2/Level0/Memory.h" 1 -# 32 "../../BaseLib2/Level0/Memory.h" -# 1 "../../BaseLib2/Level0/System.h" 1 -# 33 "../../BaseLib2/Level0/Memory.h" 2 - - -class StreamInterface; - - -enum MemoryAllocationFlags{ - - MEMORYStandardMemory = 0x00000000, - - - MEMORYExtraMemory = 0x00000001, -}; - - -enum MemoryTestAccessMode{ - - MTAM_Execute = 0x00000001, - - - MTAM_Read = 0x00000002, - - - MTAM_Write = 0x00000004 - -}; - - -static inline MemoryTestAccessMode operator &(MemoryTestAccessMode a, MemoryTestAccessMode b){ - return (MemoryTestAccessMode) ((int)a & (int) b); -} - - -static inline MemoryTestAccessMode operator |(MemoryTestAccessMode a, MemoryTestAccessMode b){ - return (MemoryTestAccessMode) ((int)a | (int) b); -} - -extern "C" { - - - - - - - void *MEMORYMalloc(int size,MemoryAllocationFlags allocFlags=MEMORYStandardMemory); - - - - - void MEMORYFree(void *&data); - - - - - - - void *MEMORYRealloc(void *&data,int newSize); - - - - - - char *MEMORYStrDup(const char *s); - - - - - void MEMORYDisplayAllocationStatistics(StreamInterface *out); - - - - - - - - bool MEMORYAllocationStatistics(int &size, int &chunks, long tid = (long)0xFFFFFFFF); - - - - - - - - bool MEMORYCheck(void *address, MemoryTestAccessMode accessMode,int size=4); -# 125 "../../BaseLib2/Level0/Memory.h" - void *SharedMemoryAlloc(unsigned int key, unsigned int size, unsigned int permMask = 0666); - - - - - void SharedMemoryFree(void *address); - - -} -# 56 "../../BaseLib2/Level0/System.h" 2 - - - - -extern "C"{ - - int UserMainFunction(int argc,char **argv); - - - - - int MainHandler(int (*userMainFunction)(int argc,char **argv),int argc,char **argv); -} -# 29 "PIDGAMClassInfo.h" 2 -# 1 "PIDGAMInputStructure.h" 1 -# 30 "PIDGAMInputStructure.h" -struct PIDGAMInputStructure { - - unsigned int usecTime; - - float reference; - - float measurement; - - float feedforward; -}; -# 30 "PIDGAMClassInfo.h" 2 -# 1 "PIDGAMOutputStructure.h" 1 -# 30 "PIDGAMOutputStructure.h" -struct PIDGAMOutputStructure { - - float controlSignal; - - float feedback; - - float error; - - float integratorState; - - float fastDischargeAction; - - float antiwindupAction; -}; -# 31 "PIDGAMClassInfo.h" 2 - -struct PIDGAMClassInfo { - PIDGAMInputStructure input; - PIDGAMOutputStructure output; -}; diff --git a/GAMs/WaveformGenerator2009/Makefile.inc b/GAMs/WaveformGenerator2009/Makefile.inc index f668acc..6eb21ea 100644 --- a/GAMs/WaveformGenerator2009/Makefile.inc +++ b/GAMs/WaveformGenerator2009/Makefile.inc @@ -51,10 +51,14 @@ CFLAGS+= -I../../BaseLib2/Level4 CFLAGS+= -I../../BaseLib2/Level5 CFLAGS+= -I../../BaseLib2/Level6 +CFLAGS+= -I ../ExpressionEvaluator2009 +CFLAGS+= -I ../ExpressionEvaluator2009/Module + all: $(OBJS) \ $(TARGET)/WaveformGenerator$(GAMEXT) echo $(OBJS) +include depends.$(TARGET) include $(MAKEDEFAULTDIR)/MakeStdLibRules.$(TARGET) diff --git a/GAMs/WaveformGenerator2009/WaveformGenericClass.h b/GAMs/WaveformGenerator2009/WaveformGenericClass.h index 6065914..5f2ecf8 100644 --- a/GAMs/WaveformGenerator2009/WaveformGenericClass.h +++ b/GAMs/WaveformGenerator2009/WaveformGenericClass.h @@ -31,6 +31,7 @@ #include "TriggerObj.h" #include "HttpInterface.h" #include "HttpJScopeInterface.h" +#include "GAM.h" //#define PI2 6.28318530717959 @@ -118,6 +119,11 @@ class WaveformGenericClass: public WaveformInterface, public GCReferenceContaine /** */ bool simMode; +/*******************************************/ + + /** */ + GAM_FunctionNumbers currentState; + public: /** */ @@ -137,6 +143,7 @@ class WaveformGenericClass: public WaveformInterface, public GCReferenceContaine xGraphData = ""; yGraphData = ""; simMode = False; + currentState = GAMOffline; } /** Copy constructor */ @@ -156,6 +163,7 @@ class WaveformGenericClass: public WaveformInterface, public GCReferenceContaine this->xGraphData = wave.xGraphData; this->yGraphData = wave.yGraphData; this->simMode = wave.simMode; + this->currentState = wave.currentState; if( this->variableOffset ) this->offsetWaveform = wave.offsetWaveform; if( this->variableGain ) this->gainWaveform = wave.gainWaveform; @@ -193,6 +201,11 @@ class WaveformGenericClass: public WaveformInterface, public GCReferenceContaine this->tEnd = (float)(tEndUsec)/1000000; } + /** */ + virtual void SetState(GAM_FunctionNumbers currentState) { + this->currentState = currentState; + } + /** */ virtual bool ProcessHttpMessage(HttpStream &hStream); diff --git a/IOGAMs/ATCAadc/Makefile.linux b/IOGAMs/ATCAadc/Makefile.linux index 69a558f..0112740 100644 --- a/IOGAMs/ATCAadc/Makefile.linux +++ b/IOGAMs/ATCAadc/Makefile.linux @@ -28,6 +28,6 @@ include Makefile.inc LIBRARIES += -L../../BaseLib2/$(TARGET) -lBaseLib2 LIBRARIES += -L../../MARTe/MARTeSupportLib/$(TARGET) -lMARTeSupLib - +LIBRARIES += -lm -ldl -lnsl -lpthread -lrt -lncurses OPTIM= diff --git a/IOGAMs/ATCAadc/module/mknod.sh b/IOGAMs/ATCAadc/module/mknod.sh old mode 100644 new mode 100755 diff --git a/IOGAMs/FileReaderDriver/FileSignalList.cpp b/IOGAMs/FileReaderDriver/FileSignalList.cpp index 2db8c06..cd945ad 100644 --- a/IOGAMs/FileReaderDriver/FileSignalList.cpp +++ b/IOGAMs/FileReaderDriver/FileSignalList.cpp @@ -48,7 +48,7 @@ bool FileSignalList::LoadData(){ } //Check signal size consistency int32 signalCounter = 0; - while(line.GetToken(token, " ")){ + while(line.GetToken(token, separator.Buffer())){ signalCounter++; token.SetSize(0); } @@ -176,6 +176,8 @@ void *FileSignalList::GetNextSample(uint32 usecTime){ } //Moves the internal counter to the next sample after the specified time //and returns the previous sample + if (sampleCounter < 0) + sampleCounter = 0; while(time[sampleCounter] <= usecTime){ sampleCounter++; if(sampleCounter == numberOfSamples){ diff --git a/IOGAMs/FilteredInputGAM.cpp b/IOGAMs/FilteredInputGAM.cpp index ebe1ed9..65f440a 100644 --- a/IOGAMs/FilteredInputGAM.cpp +++ b/IOGAMs/FilteredInputGAM.cpp @@ -144,10 +144,6 @@ bool FilteredInputGAM::Execute(GAM_FunctionNumbers functionNumber){ intBuffer[sig] = intB[sig]; } } - - for(sig = 0; sig < output->BufferWordSize(); sig++){ - floatBuffer[sig] += buffer[sig]*filterCoefficients[i]; - } } output->Write(); diff --git a/IOGAMs/InputGAM.cpp b/IOGAMs/InputGAM.cpp index 14ca821..4bcb394 100644 --- a/IOGAMs/InputGAM.cpp +++ b/IOGAMs/InputGAM.cpp @@ -286,7 +286,7 @@ bool InputGAM::Initialise(ConfigurationDataBase& cdbData){ calibrationRequested = False; startUpCycleNumber = 0; - AssertErrorCondition(Warning,"InputGAM::Initialise: %s: Module %s Has been Successfully Loaded", Name(),inputModule->Name()); + AssertErrorCondition(Information,"InputGAM::Initialise: %s: Module %s has been successfully loaded", Name(),inputModule->Name()); return True; } diff --git a/IOGAMs/LinuxATMDriver/ATMDrv.cpp b/IOGAMs/LinuxATMDriver/ATMDrv.cpp index f77b63e..770c1be 100644 --- a/IOGAMs/LinuxATMDriver/ATMDrv.cpp +++ b/IOGAMs/LinuxATMDriver/ATMDrv.cpp @@ -35,8 +35,8 @@ #endif struct AtmMsgHeaderStruct{ - unsigned int nSampleNumber; // the sample number since the last t=0 - unsigned int nSampleTime; // the time since t=0, going to PRE as microseconds + uint32 nSampleNumber; // the sample number since the last t=0 + uint32 nSampleTime; // the time since t=0, going to PRE as microseconds }; // Timing ATM module @@ -322,7 +322,7 @@ int32 ATMDrv::GetData(uint32 usecTime, int32 *buffer, int32 bufferNumber) { // Check data age uint32 sampleNo = header->nSampleNumber; if(freshPacket) { - if(abs(usecTime-header->nSampleTime) > maxDataAgeUsec) { + if(abs((int64)usecTime-(int64)(header->nSampleTime)) > (int64)maxDataAgeUsec) { // Packet too old // return the last received data and put 0xFFFFFFFF as nSampleNumber sampleNo = 0xFFFFFFFF; @@ -550,7 +550,11 @@ void ATMDrv::RecCallback(void* arg){ if(producerUsecPeriod != -1) { int64 counter = HRT::HRTCounter(); /// Allow for a 10% deviation from the specified producer usec period - if(abs((uint32)((counter-lastCounter)*HRT::HRTPeriod()*1000000)-(uint32)((header->nSampleNumber-originalNSampleNumber)*producerUsecPeriod)) > 0.1*producerUsecPeriod) { + //Computation involving HRTPeriod will promote the int64s to double. + //Computation involving producerUsecPeriod is uint*int so needs explicit cast int64 or in this case double + //0.1 would have promoted the comparison to a float anyway therefore decided to perform the whole comparison in double + if( abs( (double)(((counter-lastCounter)*1000000)*HRT::HRTPeriod()) - + ((double)(header->nSampleNumber-originalNSampleNumber)*producerUsecPeriod) ) > (0.1L*producerUsecPeriod)) { deviationErrorCounter++; } originalNSampleNumber = header->nSampleNumber; diff --git a/IOGAMs/LinuxATMDriver/Makefile.linux b/IOGAMs/LinuxATMDriver/Makefile.linux index 5b5891e..c09d832 100644 --- a/IOGAMs/LinuxATMDriver/Makefile.linux +++ b/IOGAMs/LinuxATMDriver/Makefile.linux @@ -28,6 +28,7 @@ include Makefile.inc LIBRARIES += -L ../../BaseLib2/$(TARGET) -lBaseLib2 LIBRARIES += -L../../MARTe/MARTeSupportLib/$(TARGET) -lMARTeSupLib +LIBRARIES += -ldl $(TARGET)/test.ex: $(TARGET)/test.o $(TARGET)/ATMDrv$(OBJEXT) - $(COMPILER) $(LIBRARIES) $(CFLAGSPEC) $(CFLAGS) $(LFLAGS) $(TARGET)/ATMDrv$(OBJEXT) $(TARGET)/test$(OBJEXT) -o $(TARGET)/test.ex + $(COMPILER) $(CFLAGSPEC) $(CFLAGS) $(LFLAGS) $(TARGET)/ATMDrv$(OBJEXT) $(TARGET)/test$(OBJEXT) $(LIBRARIES) -o $(TARGET)/test.ex diff --git a/IOGAMs/SharedMemoryDriver/Makefile.linux b/IOGAMs/SharedMemoryDriver/Makefile.linux index a5cb202..a2e84fa 100644 --- a/IOGAMs/SharedMemoryDriver/Makefile.linux +++ b/IOGAMs/SharedMemoryDriver/Makefile.linux @@ -28,4 +28,4 @@ include Makefile.inc LIBRARIES += -L../../BaseLib2/$(TARGET) -lBaseLib2 LIBRARIES += -L../../MARTe/MARTeSupportLib/$(TARGET) -lMARTeSupLib - +LIBRARIES += -lm -ldl -lnsl -lpthread -lrt -lncurses diff --git a/IOGAMs/SrTrATCADriver/Makefile.linux b/IOGAMs/SrTrATCADriver/Makefile.linux index 0c55ef0..14e46c1 100644 --- a/IOGAMs/SrTrATCADriver/Makefile.linux +++ b/IOGAMs/SrTrATCADriver/Makefile.linux @@ -27,9 +27,10 @@ TARGET=linux include Makefile.inc LIBRARIES += -L../../BaseLib2/$(TARGET) -lBaseLib2 -LIBRARIES += -L../../MARTe/MARTeSupportLib/$(TARGET) -lMARTeSupLib +LIBRARIES += -L../../MARTe/MARTeSupportLib/$(TARGET) -lMARTeSupLib +LIBRARIES += -lm -ldl -lnsl -lpthread -lrt -lncurses # #OPTIM= -G6 -O2 -Ob2 $(TARGET)/test.ex: $(TARGET)/test.o $(TARGET)/SrTrATCADrv$(OBJEXT) - $(COMPILER) $(LIBRARIES) $(CFLAGSPEC) $(CFLAGS) $(LFLAGS) $(TARGET)/SrTrATCADrv$(OBJEXT) $(TARGET)/test$(OBJEXT) -o $(TARGET)/test.ex + $(COMPILER) $(CFLAGSPEC) $(CFLAGS) $(LFLAGS) $(TARGET)/SrTrATCADrv$(OBJEXT) $(TARGET)/test$(OBJEXT) $(LIBRARIES) -o $(TARGET)/test.ex diff --git a/IOGAMs/SrTrATCADriver/linux/SrTrATCADrv.drv b/IOGAMs/SrTrATCADriver/linux/SrTrATCADrv.drv deleted file mode 100755 index 23ef73e..0000000 Binary files a/IOGAMs/SrTrATCADriver/linux/SrTrATCADrv.drv and /dev/null differ diff --git a/IOGAMs/StreamingDriver/Makefile.linux b/IOGAMs/StreamingDriver/Makefile.linux index c0cad77..bbcd29a 100644 --- a/IOGAMs/StreamingDriver/Makefile.linux +++ b/IOGAMs/StreamingDriver/Makefile.linux @@ -28,4 +28,4 @@ include Makefile.inc LIBRARIES += -L../../BaseLib2/$(TARGET) -lBaseLib2 LIBRARIES += -L../../MARTe/MARTeSupportLib/$(TARGET) -lMARTeSupLib - +LIBRARIES += -lm -ldl -lnsl -lpthread -lrt -lncurses diff --git a/IOGAMs/TimeInputGAM.cpp b/IOGAMs/TimeInputGAM.cpp index 53fb3cb..7901933 100644 --- a/IOGAMs/TimeInputGAM.cpp +++ b/IOGAMs/TimeInputGAM.cpp @@ -65,7 +65,9 @@ bool TimeInputGAM::Initialise(ConfigurationDataBase& cdbData){ return False; } - AssertErrorCondition(Warning,"TimeInputGAM::Initialise: %s: Module %s Has been Successfully Loaded", Name(),inputModule->Name()); + reportSyncError = True; + + AssertErrorCondition(Information,"TimeInputGAM::Initialise: %s: Module %s has been successfully loaded", Name(),inputModule->Name()); return True; } @@ -77,7 +79,12 @@ bool TimeInputGAM::Execute(GAM_FunctionNumbers functionNumber){ ////////////////////////////////////////// if(!trigger->Synchronise()){ - AssertErrorCondition(FatalError,"TimeInputGAM::Execute: Timeout on Execute(FunctionNumber = %d)", (int)functionNumber); + if(reportSyncError == True){ + AssertErrorCondition(FatalError,"TimeInputGAM::Execute: Timeout on Execute(FunctionNumber = %d)", (int)functionNumber); + reportSyncError = False; + } + } else { + reportSyncError = True; } return InputGAM::Execute(functionNumber); } diff --git a/IOGAMs/TimeInputGAM.h b/IOGAMs/TimeInputGAM.h index 89805b1..7775314 100644 --- a/IOGAMs/TimeInputGAM.h +++ b/IOGAMs/TimeInputGAM.h @@ -40,6 +40,7 @@ class TimeInputGAM: public InputGAM{ OBJECT_DLL_STUFF(TimeInputGAM) private: + bool reportSyncError; /** Reference to the triggering service facility */ GCRTemplate trigger; diff --git a/IOGAMs/UDPDriver/UDPDrv.cpp b/IOGAMs/UDPDriver/UDPDrv.cpp index 0fafbf1..44ac8bf 100644 --- a/IOGAMs/UDPDriver/UDPDrv.cpp +++ b/IOGAMs/UDPDriver/UDPDrv.cpp @@ -29,8 +29,8 @@ #include "FastPollingMutexSem.h" struct UDPMsgHeaderStruct{ - unsigned int nSampleNumber; // the sample number since the last t=0 - unsigned int nSampleTime; // the sample time + uint32 nSampleNumber; // the sample number since the last t=0 + uint32 nSampleTime; // the sample time }; /** @@ -321,7 +321,7 @@ int32 UDPDrv::GetData(uint32 usecTime, int32 *buffer, int32 bufferNumber) { // Check data age uint32 sampleNo = header->nSampleNumber; if(freshPacket) { - if(abs(usecTime-header->nSampleTime) > maxDataAgeUsec) { + if(abs((int64)usecTime-(int64)header->nSampleTime) > (int64)maxDataAgeUsec) { // Packet too old // return the last received data and put 0xFFFFFFFF as nSampleNumber sampleNo = 0xFFFFFFFF; @@ -552,7 +552,8 @@ void UDPDrv::RecCallback(void* arg){ if(producerUsecPeriod != -1) { int64 counter = HRT::HRTCounter(); /// Allow for a 10% deviation from the specified producer usec period - if(abs((uint32)((counter-lastCounter)*HRT::HRTPeriod()*1000000)-(uint32)((header->nSampleNumber-originalNSampleNumber)*producerUsecPeriod)) > 0.1*producerUsecPeriod) { + if(abs( ((double)((counter-lastCounter)*1000000)*HRT::HRTPeriod()) - + (double)((header->nSampleNumber-originalNSampleNumber)*producerUsecPeriod) ) > (0.1L*producerUsecPeriod)) { deviationErrorCounter++; } originalNSampleNumber = header->nSampleNumber; diff --git a/Interfaces/ConfigurationLibrary/Makefile.linux b/Interfaces/ConfigurationLibrary/Makefile.linux index 064a2d8..e51d316 100644 --- a/Interfaces/ConfigurationLibrary/Makefile.linux +++ b/Interfaces/ConfigurationLibrary/Makefile.linux @@ -26,9 +26,10 @@ TARGET=linux include Makefile.inc -LIBRARIES += -L../../BaseLib2/$(TARGET) -lBaseLib2 +LIBRARIES += -L../../BaseLib2/$(TARGET) -lBaseLib2 +LIBRARIES += -lm -ldl -lnsl -lpthread -lrt -lncurses OPTIM= $(TARGET)/MessageSender.ex: $(TARGET)/main$(OBJEXT) - $(COMPILER) $(LIBRARIES) -L$(TARGET) -lConfigurationLibrary $(CFLAGSPEC) $(CFLAGS) $(LFLAGS) $(TARGET)/main$(OBJEXT) -o $(TARGET)/MessageSender$(EXEEXT) + $(COMPILER) $(CFLAGSPEC) $(TARGET)/main$(OBJEXT) -L$(TARGET) -lConfigurationLibrary $(LIBRARIES) -o $(TARGET)/MessageSender$(EXEEXT) diff --git a/Interfaces/Logger/JTLogger/JTLogger.jar b/Interfaces/Logger/JTLogger/JTLogger.jar deleted file mode 100644 index 9e4bfe1..0000000 Binary files a/Interfaces/Logger/JTLogger/JTLogger.jar and /dev/null differ diff --git a/Interfaces/Logger/JTLogger/Makefile b/Interfaces/Logger/JTLogger/Makefile index 04e47d8..0ae233f 100644 --- a/Interfaces/Logger/JTLogger/Makefile +++ b/Interfaces/Logger/JTLogger/Makefile @@ -36,10 +36,13 @@ JAVAC = javac $(JFLAGS) -d $(BUILD_DIR) all : jar -compile : +compile : $(BUILD_DIR) $(shell find . -name \*.java -print > file.compile.list) $(JAVAC) @file.compile.list +$(BUILD_DIR): + mkdir $(BUILD_DIR); + jar : compile rm -f $(BUILD_DIR)/JTLogger.jar jar cvfm $(BUILD_DIR)/JTLogger.jar Manifest.mf -C $(BUILD_DIR) org @@ -52,5 +55,6 @@ doc : clean : rm -rf doc - rm -rf $(BUILD_DIR)/* + rm -rf $(BUILD_DIR)/* + rm -rf $(BUILD_DIR) rm JTLogger.jar diff --git a/MARTe/MARTeSupportLib/DataPollingDrivenTTS.h b/MARTe/MARTeSupportLib/DataPollingDrivenTTS.h index 929c889..8a4e3f9 100644 --- a/MARTe/MARTeSupportLib/DataPollingDrivenTTS.h +++ b/MARTe/MARTeSupportLib/DataPollingDrivenTTS.h @@ -42,6 +42,7 @@ class DataPollingDrivenTTS : public TimeTriggeringServiceInterface{ /** Constructor */ DataPollingDrivenTTS(){ polledDataReady = False; + reportSyncError = True; }; /** Destructor */ @@ -70,9 +71,14 @@ class DataPollingDrivenTTS : public TimeTriggeringServiceInterface{ while(!polledDataReady){ ok = timeModule->Poll(); if(!ok){ - AssertErrorCondition(FatalError, "DataPollingDrivenTTS::Syncronise exiting with false due to timing module."); + if(reportSyncError == True) { + AssertErrorCondition(FatalError, "DataPollingDrivenTTS::Syncronise exiting with false due to timing module."); + reportSyncError == False; + } break; - } + } else { + reportSyncError = True; + } } return ok; } @@ -92,6 +98,8 @@ class DataPollingDrivenTTS : public TimeTriggeringServiceInterface{ }; bool polledDataReady; + + bool reportSyncError; OBJECT_DLL_STUFF(DataPollingDrivenTTS) }; diff --git a/MARTe/Makefile.linux b/MARTe/Makefile.linux index 6387751..a4e0747 100644 --- a/MARTe/Makefile.linux +++ b/MARTe/Makefile.linux @@ -28,6 +28,7 @@ include Makefile.inc LIBRARIES += -L../BaseLib2/$(TARGET) -lBaseLib2 LIBRARIES += -L./MARTeSupportLib/$(TARGET) -lMARTeSupLib +LIBRARIES += -lm -ldl -lnsl -lpthread -lrt -lncurses OPTIM= -G6 -O2 -Ob2 OPTIM= diff --git a/MakeDefaults/MakeStdLibDefs.linux b/MakeDefaults/MakeStdLibDefs.linux index 454f067..3e853c8 100644 --- a/MakeDefaults/MakeStdLibDefs.linux +++ b/MakeDefaults/MakeStdLibDefs.linux @@ -65,7 +65,7 @@ CPPFLAGS = -fPIC -frtti CFLAGSPEC= -D_LINUX -DUSE_PTHREAD -pthread -LIBRARIES = -lm -ldl -lnsl -lpthread -lrt -lncurses +LIBRARIES = .SUFFIXES: .c .cpp .o .a .exe .ex .ex_ .so .gam diff --git a/MakeDefaults/MakeStdLibRules.linux b/MakeDefaults/MakeStdLibRules.linux index 4d3bf57..849c2ec 100644 --- a/MakeDefaults/MakeStdLibRules.linux +++ b/MakeDefaults/MakeStdLibRules.linux @@ -73,7 +73,7 @@ linux/%.gam : linux/%.o $(OBJS) $(COMPILER) -shared -fPIC $(OBJS) $(LIBRARIES) linux/$*.o -o $@ linux/%.drv : linux/%.o $(OBJS) - $(COMPILER) -shared -fPIC $(OBJS) $(LIBRARIES) linux/$*.o -o $@ + $(COMPILER) -shared -fPIC $(OBJS) linux/$*.o $(LIBRARIES) -o $@ %.spb : $(MAKE) -C $* -f Makefile.$(TARGET) @@ -86,6 +86,7 @@ linux/%.drv : linux/%.o $(OBJS) clean: $(SUBPROJC) rm -f depends* rm -rf temp + rm -rf *sinfo* rm -rf $(TARGET)