Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenrik Rentz-Reichert2013-05-08 07:19:09 +0000
committerHenrik Rentz-Reichert2013-05-08 07:19:09 +0000
commitd41acf1b5f34a1baba8016f1eb4b7e98b541a815 (patch)
treef90b302855c514a91b6e83f11c4b551b8d42eaba
parentdc717ef8ba86ade2257e9edbaad0b7e674e16516 (diff)
downloadorg.eclipse.etrice-d41acf1b5f34a1baba8016f1eb4b7e98b541a815.tar.gz
org.eclipse.etrice-d41acf1b5f34a1baba8016f1eb4b7e98b541a815.tar.xz
org.eclipse.etrice-d41acf1b5f34a1baba8016f1eb4b7e98b541a815.zip
[runtime.c] bug 402275: Implementation of Codegenerator and C-Runtime for physical model
https://bugs.eclipse.org/bugs/show_bug.cgi?id=402275
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/.cproject16
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/etUnit/etUnit.c8
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/helpers/etTimeHelpers.c8
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/helpers/etTimeHelpers.h2
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etSystemProtocol.c4
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/osal/etThread.h2
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/runtime/etRuntime.c11
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/runtime/etRuntime.h2
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etSema.c2
9 files changed, 38 insertions, 17 deletions
diff --git a/runtime/org.eclipse.etrice.runtime.c/.cproject b/runtime/org.eclipse.etrice.runtime.c/.cproject
index 252bd2165..7fae49897 100644
--- a/runtime/org.eclipse.etrice.runtime.c/.cproject
+++ b/runtime/org.eclipse.etrice.runtime.c/.cproject
@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+<?fileVersion 4.0.0?>
+
+<cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
<storageModule moduleId="org.eclipse.cdt.core.settings">
<cconfiguration id="cdt.managedbuild.config.gnu.mingw.lib.debug.505530637">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.mingw.lib.debug.505530637" moduleId="org.eclipse.cdt.core.settings" name="Debug">
@@ -49,19 +51,9 @@
<tool id="cdt.managedbuild.tool.gnu.cpp.linker.mingw.base.278235928" name="MinGW C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.mingw.base"/>
</toolChain>
</folderInfo>
- <folderInfo id="cdt.managedbuild.config.gnu.mingw.lib.debug.505530637.1480114047" name="/" resourcePath="src/platforms/MT_POSIX_GENERIC_GCC">
- <toolChain id="cdt.managedbuild.toolchain.gnu.mingw.lib.debug.482193188" name="MinGW GCC" superClass="cdt.managedbuild.toolchain.gnu.mingw.lib.debug" unusedChildren="">
- <tool id="cdt.managedbuild.tool.gnu.assembler.mingw.lib.debug.1613201823" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.mingw.lib.debug.806687472"/>
- <tool id="cdt.managedbuild.tool.gnu.archiver.mingw.lib.debug.1912281256" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.mingw.lib.debug.1896612237"/>
- <tool id="cdt.managedbuild.tool.gnu.cpp.compiler.mingw.lib.debug.1703441571" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.mingw.lib.debug.1813889263"/>
- <tool id="cdt.managedbuild.tool.gnu.c.compiler.mingw.lib.debug.438507749" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.mingw.lib.debug.1185604346"/>
- <tool id="cdt.managedbuild.tool.gnu.c.linker.mingw.base.2043229911" name="MinGW C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.mingw.base.597146923"/>
- <tool id="cdt.managedbuild.tool.gnu.cpp.linker.mingw.base.58720581" name="MinGW C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.mingw.base.278235928"/>
- </toolChain>
- </folderInfo>
<sourceEntries>
<entry excluding="test|src" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
- <entry excluding="platforms/MT_POSIX_GENERIC_GCC|platforms/generic/etTcpSockets_Posix.c|platforms/ST_CoretexM3_Euros_GCCELF_SK_FM3_176PMC_Ethernet|platforms/ST_MSP430_G2553_CCS5_LaunchPad|platforms/ST_MSP430_F5438_CCS5_HWElevator|platforms/ST_MSP430_F5438_CCS5_EXP430F5438|platforms/MSP430" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/>
+ <entry excluding="platforms/MT_POSIX_GENERIC_GCC|platforms/ST_MSP430_F5438_CCS5_EXP430F5438|platforms/MSP430|platforms/ST_MSP430_F5438_CCS5_HWElevator|platforms/ST_MSP430_G2553_CCS5_LaunchPad|platforms/ST_CoretexM3_Euros_GCCELF_SK_FM3_176PMC_Ethernet" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/>
</sourceEntries>
</configuration>
</storageModule>
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/etUnit/etUnit.c b/runtime/org.eclipse.etrice.runtime.c/src/common/etUnit/etUnit.c
index 9df61df98..8fe509f55 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/etUnit/etUnit.c
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/etUnit/etUnit.c
@@ -15,6 +15,8 @@
#include <time.h>
#include <stdlib.h>
#include "debugging/etLogger.h"
+#include "osal/etSema.h"
+#include "runtime/etRuntime.h"
/*** member variables */
@@ -95,7 +97,10 @@ void etUnit_close(void) {
etUnit_reportfile = NULL;
}
etLogger_logInfoF("End Time: %ld", clock());
- etLogger_logErrorF("Error Counter: %ld", etUnit_errorCounter);
+ if (etUnit_errorCounter==0)
+ etLogger_logInfoF("Error Counter: %ld", etUnit_errorCounter);
+ else
+ etLogger_logErrorF("Error Counter: %ld", etUnit_errorCounter);
etLogger_logInfoF("************* TEST END **************");
}
@@ -145,6 +150,7 @@ void etUnit_closeAll(etInt16 id){
}
void etUnit_testFinished(etInt16 id) {
+ etSema_wakeup(etRuntime_getTerminateSemaphore());
}
void expectTrue(etInt16 id, const char* message, etBool condition, const char* file, int line) {
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/helpers/etTimeHelpers.c b/runtime/org.eclipse.etrice.runtime.c/src/common/helpers/etTimeHelpers.c
index 82ada3166..6de407a30 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/helpers/etTimeHelpers.c
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/helpers/etTimeHelpers.c
@@ -12,6 +12,14 @@
#include "helpers/etTimeHelpers.h"
+void etTimeHelpers_subtract(etTime *first, etTime* second){
+ /* TODO: implement */
+}
+
+void etTimeHelpers_add(etTime *first, etTime* second){
+ /* TODO: implement */
+}
+
etInt32 etTimeHelpers_convertToMSec(etTime *time){
return time->sec * 1000 + time->nSec / 1000000;
}
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/helpers/etTimeHelpers.h b/runtime/org.eclipse.etrice.runtime.c/src/common/helpers/etTimeHelpers.h
index c7aa1a49a..e04a5a755 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/helpers/etTimeHelpers.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/helpers/etTimeHelpers.h
@@ -15,6 +15,8 @@
#include "osal/etTime.h"
+void etTime_subtract(etTime *self, etTime* subtractValue);
+void etTime_add(etTime *self, etTime* addValue);
etInt32 etTimeHelpers_convertToMSec(etTime *time);
void etTimeHelpers_convertToEtTime(etTime *result, etInt32 milliSeconds);
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etSystemProtocol.c b/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etSystemProtocol.c
index d13520335..40be5342a 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etSystemProtocol.c
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etSystemProtocol.c
@@ -12,7 +12,7 @@
/*--------------------- port methods */
-// getReplication
+/* getReplication */
etInt32 etSystemProtocolReplPort_getReplication(const etSystemProtocolReplPort* self) {
return ((etReplPort*)self)->size;
}
@@ -66,7 +66,7 @@ void etSystemProtocolConjReplPort_terminate(const etSystemProtocolConjReplPort*
}
-// getReplication
+/* getReplication */
etInt32 etSystemProtocolConjReplPort_getReplication(const etSystemProtocolConjReplPort* self) {
return ((etReplPort*)self)->size;
}
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etThread.h b/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etThread.h
index 0355f0160..172723db6 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etThread.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etThread.h
@@ -44,7 +44,7 @@ typedef struct etThread{
void* threadFunctionData; /**< data for call back function to be called by thread -> has to be filled in by caller of etThread_construct **/
} etThread;
-// TODO: add return values for error handling
+/* TODO: add return values for error handling */
/**
* initialize the thread data
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/runtime/etRuntime.c b/runtime/org.eclipse.etrice.runtime.c/src/common/runtime/etRuntime.c
index a92a36c49..bca6ecd44 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/runtime/etRuntime.c
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/runtime/etRuntime.c
@@ -14,4 +14,15 @@
#include "runtime/etRuntime.h"
+static etSema terminateSemaphore;
+etSema* etRuntime_getTerminateSemaphore() {
+ static etBool initialized = FALSE;
+
+ if (!initialized) {
+ initialized = TRUE;
+ etSema_construct(&terminateSemaphore);
+ }
+
+ return &terminateSemaphore;
+}
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/runtime/etRuntime.h b/runtime/org.eclipse.etrice.runtime.c/src/common/runtime/etRuntime.h
index 229e2e5e6..83877fa6e 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/runtime/etRuntime.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/runtime/etRuntime.h
@@ -13,6 +13,8 @@
#ifndef _ETRUNTIME_H_
#define _ETRUNTIME_H_
+#include "osal/etSema.h"
+etSema* etRuntime_getTerminateSemaphore();
#endif /* _ETRUNTIME_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etSema.c b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etSema.c
index 13f8daca8..0f537a9fd 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etSema.c
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etSema.c
@@ -29,7 +29,7 @@ void etSema_construct(etSema* self){
}
void etSema_destruct(etSema* self){
ET_MSC_LOGGER_SYNC_ENTRY("etSema", "destruct")
- // TODO: implement this function
+ /* TODO: implement this function */
ET_MSC_LOGGER_SYNC_EXIT
}

Back to the top