Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Schuetz2013-04-29 15:41:43 -0400
committerThomas Schuetz2013-04-29 15:41:43 -0400
commit2903767e47d1d2a6d3135d7a26d2913987792f52 (patch)
tree86d2948ce587c67d289ad1213cae2b6e21a4e801 /runtime
parent8ab083b90fbf7f51e39ad6c9c7ef4cf7c92aae93 (diff)
downloadorg.eclipse.etrice-2903767e47d1d2a6d3135d7a26d2913987792f52.tar.gz
org.eclipse.etrice-2903767e47d1d2a6d3135d7a26d2913987792f52.tar.xz
org.eclipse.etrice-2903767e47d1d2a6d3135d7a26d2913987792f52.zip
[runtime.c] reorganization of API for C OSAL
Diffstat (limited to 'runtime')
-rw-r--r--runtime/org.eclipse.etrice.modellib.c/.gitignore1
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/.cproject8
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/debugging/etMSCLogger.c5
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/helpers/etTimeHelpers.c25
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/helpers/etTimeHelpers.h23
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageService.h5
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etWakeupService.h9
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/modelbase/etPort.c2
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/modelbase/etRTSystemServicesProtocol.h4
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/osal/etMemory.h (renamed from runtime/org.eclipse.etrice.runtime.c/src/common/platform/etMemory.h)50
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/osal/etMutex.h38
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/osal/etPlatformLifecycle.h46
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/osal/etSema.h37
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/osal/etThread.h (renamed from runtime/org.eclipse.etrice.runtime.c/src/common/platform/etPlatform.h)184
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/osal/etTime.h50
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/osal/etTimer.h38
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/platform/etTimer.h40
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/runtime/etThreadList.h2
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC/etDatatypes.h101
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC/info.txt10
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etDatatypes.h (renamed from runtime/org.eclipse.etrice.runtime.c/src/platforms/generic/etDatatypes.h)237
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etLogger.c (renamed from runtime/org.eclipse.etrice.runtime.c/src/platforms/generic/etLogger.c)142
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etMutex.c44
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etPlatformLifecycle.c21
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etSema.c46
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etThread.c59
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etTime.c58
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etTimer.c43
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/info.txt10
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/generic/etPlatform.c144
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/generic/etTimer.c39
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/generic/info.txt2
32 files changed, 956 insertions, 567 deletions
diff --git a/runtime/org.eclipse.etrice.modellib.c/.gitignore b/runtime/org.eclipse.etrice.modellib.c/.gitignore
index 76b025ad1..c95afa8e8 100644
--- a/runtime/org.eclipse.etrice.modellib.c/.gitignore
+++ b/runtime/org.eclipse.etrice.modellib.c/.gitignore
@@ -1,2 +1,3 @@
Debug
Release
+src-gen-info
diff --git a/runtime/org.eclipse.etrice.runtime.c/.cproject b/runtime/org.eclipse.etrice.runtime.c/.cproject
index 8700d49e2..30786f557 100644
--- a/runtime/org.eclipse.etrice.runtime.c/.cproject
+++ b/runtime/org.eclipse.etrice.runtime.c/.cproject
@@ -23,7 +23,7 @@
<folderInfo id="cdt.managedbuild.config.gnu.mingw.lib.debug.505530637." name="/" resourcePath="">
<toolChain id="cdt.managedbuild.toolchain.gnu.mingw.lib.debug.897987799" name="MinGW GCC" superClass="cdt.managedbuild.toolchain.gnu.mingw.lib.debug">
<targetPlatform id="cdt.managedbuild.target.gnu.platform.mingw.lib.debug.1195644765" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.mingw.lib.debug"/>
- <builder buildPath="${workspace_loc:/org.eclipse.etrice.runtime.c/Debug}" id="cdt.managedbuild.tool.gnu.builder.mingw.base.1199468624" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="CDT Internal Builder" superClass="cdt.managedbuild.tool.gnu.builder.mingw.base">
+ <builder buildPath="${workspace_loc:/org.eclipse.etrice.runtime.c/Debug}" id="cdt.managedbuild.tool.gnu.builder.mingw.base.1199468624" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="CDT Internal Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="cdt.managedbuild.tool.gnu.builder.mingw.base">
<outputEntries>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="outputPath" name="Debug"/>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="outputPath" name="Release"/>
@@ -41,7 +41,7 @@
<option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.mingw.lib.debug.option.optimization.level.157947957" name="Optimization Level" superClass="gnu.c.compiler.mingw.lib.debug.option.optimization.level" valueType="enumerated"/>
<option id="gnu.c.compiler.mingw.lib.debug.option.debugging.level.1083191317" name="Debug Level" superClass="gnu.c.compiler.mingw.lib.debug.option.debugging.level" value="gnu.c.debugging.level.max" valueType="enumerated"/>
<option id="gnu.c.compiler.option.include.paths.790097072" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
- <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src/platforms/generic}&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src/platforms/MT_WIN_MinGW}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src/config}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src/common}&quot;"/>
</option>
@@ -53,7 +53,7 @@
</folderInfo>
<sourceEntries>
<entry excluding="test|src" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
- <entry excluding="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"/>
+ <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>
@@ -99,7 +99,7 @@
</folderInfo>
<sourceEntries>
<entry excluding="test|src" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
- <entry excluding="platforms/ST_MSP430_F5438_CCS5_EXP430F5438|platforms/MSP430|platforms/ST_MSP430_F5438_CCS5_HWElevator|platforms/ST_MSP430_G2553_CCS5_LaunchPad" 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" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/>
</sourceEntries>
</configuration>
</storageModule>
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/debugging/etMSCLogger.c b/runtime/org.eclipse.etrice.runtime.c/src/common/debugging/etMSCLogger.c
index 547eec00b..6b032cf49 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/debugging/etMSCLogger.c
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/debugging/etMSCLogger.c
@@ -11,13 +11,14 @@
*******************************************************************************/
#include "debugging/etMSCLogger.h"
-
#include "debugging/etLogger.h"
-#include "platform/etPlatform.h"
+
+#include "osal/etThread.h"
static etFileHandle etMSCLogger_fileHandle = NULL;
static char* etMSCLogger_objectName = "";
+/*TODO: move or replace ET_MAX_FILENAME_LEN */
#define ET_MAX_FILENAME_LEN 256
void etMSCLogger_open(char* logPath, char* mscName){
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
new file mode 100644
index 000000000..1aadc102c
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/helpers/etTimeHelpers.c
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2013 protos software gmbh (http://www.protos.de).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Thomas Schuetz (initial contribution)
+ *
+ *******************************************************************************/
+
+#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
new file mode 100644
index 000000000..71f20e4ce
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/helpers/etTimeHelpers.h
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2013 protos software gmbh (http://www.protos.de).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Thomas Schuetz (initial contribution)
+ *
+ *******************************************************************************/
+
+#ifndef ETTIMEHELPERS_H_
+#define ETTIMEHELPERS_H_
+
+#include "osal/etTime.h"
+
+void etTime_subtract(etTime *self, etTime* subtractValue);
+void etTime_add(etTime *self, etTime* addValue);
+etInt32 etTimeHelpers_convertToMSec(etTime *time);
+
+
+#endif /* ETTIMEHELPERS_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageService.h b/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageService.h
index 7bfeaa2a0..b37f98391 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageService.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageService.h
@@ -17,7 +17,10 @@
#include "etDatatypes.h"
#include "messaging/etMessageQueue.h"
#include "messaging/etMessageReceiver.h"
-#include "platform/etPlatform.h"
+
+#include "osal/etMutex.h"
+#include "osal/etThread.h"
+#include "osal/etSema.h"
enum etMessageService_execmode {
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etWakeupService.h b/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etWakeupService.h
index c8a54213a..c6c5d4ba1 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etWakeupService.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etWakeupService.h
@@ -16,13 +16,8 @@
#include "etDatatypes.h"
#include "etSystemProtocol.h"
-/**
- * time definition composed by the number of seconds and the number of nano seconds
- */
-typedef struct etTime {
- etInt32 seconds;
- etInt32 nseconds;
-} etTime;
+#include "osal/etTime.h"
+
typedef struct etWakeupTarget {
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/modelbase/etPort.c b/runtime/org.eclipse.etrice.runtime.c/src/common/modelbase/etPort.c
index 0bf0a8fc7..a1e734618 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/modelbase/etPort.c
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/modelbase/etPort.c
@@ -13,7 +13,7 @@
#include "modelbase/etPort.h"
#include "debugging/etMSCLogger.h"
-#include "platform/etMemory.h"
+#include "osal/etMemory.h"
#include <string.h>
/*
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/modelbase/etRTSystemServicesProtocol.h b/runtime/org.eclipse.etrice.runtime.c/src/common/modelbase/etRTSystemServicesProtocol.h
index c192f452d..aab631482 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/modelbase/etRTSystemServicesProtocol.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/modelbase/etRTSystemServicesProtocol.h
@@ -10,8 +10,8 @@
*
*******************************************************************************/
-#ifndef ETRTSYSTEMSERVICESPROTOCOL_H_
-#define ETRTSYSTEMSERVICESPROTOCOL_H_
+#ifndef _ETRTSYSTEMSERVICESPROTOCOL_H_
+#define _ETRTSYSTEMSERVICESPROTOCOL_H_
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/platform/etMemory.h b/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etMemory.h
index 61c283a24..7854b1dbf 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/platform/etMemory.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etMemory.h
@@ -1,25 +1,25 @@
-/*******************************************************************************
- * Copyright (c) 2011 protos software gmbh (http://www.protos.de).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Henrik Rentz-Reichert (initial contribution)
- *
- *******************************************************************************/
-
-#ifndef _ETMEMORY_H_
-#define _ETMEMORY_H_
-
-#include "etDatatypes.h"
-#include "etRuntimeConfig.h"
-
-#define CONSTANT_MEM_CEIL(n) \
- ((n)+(((int32)STRUCT_ALIGN-((n)&((int32)STRUCT_ALIGN-1)))&((int32)STRUCT_ALIGN-1)))
-
-#define MEM_ALIGNMENT STRUCT_ALIGN /* power of 2 and >= sizeof(int) ! */
-#define MEM_CEIL(n) CONSTANT_MEM_CEIL(n)
-
-#endif /* _ETMEMORY_H_ */
+/*******************************************************************************
+ * Copyright (c) 2011 protos software gmbh (http://www.protos.de).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Henrik Rentz-Reichert (initial contribution)
+ *
+ *******************************************************************************/
+
+#ifndef _ETMEMORY_H_
+#define _ETMEMORY_H_
+
+#include "etDatatypes.h"
+#include "etRuntimeConfig.h"
+
+#define CONSTANT_MEM_CEIL(n) \
+ ((n)+(((int32)STRUCT_ALIGN-((n)&((int32)STRUCT_ALIGN-1)))&((int32)STRUCT_ALIGN-1)))
+
+#define MEM_ALIGNMENT STRUCT_ALIGN /* power of 2 and >= sizeof(int) ! */
+#define MEM_CEIL(n) CONSTANT_MEM_CEIL(n)
+
+#endif /* _ETMEMORY_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etMutex.h b/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etMutex.h
new file mode 100644
index 000000000..cff62f5f8
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etMutex.h
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2013 protos software gmbh (http://www.protos.de).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Thomas Schuetz, Thomas Jung (initial contribution)
+ *
+ *
+ *******************************************************************************/
+
+#ifndef _ETMUTEX_H_
+#define _ETMUTEX_H_
+
+/**
+ * etMutex.h defines a generic interface for platform specific implementations of a mutex
+ *
+ * */
+
+#include "etDatatypes.h"
+
+/**
+ * etMutex holds the object data for a mutex (for self pointer)
+ *
+ * */
+typedef struct etMutex {
+ etOSMutexData osData;
+} etMutex;
+
+void etMutex_construct(etMutex* self);
+void etMutex_destruct(etMutex* self);
+void etMutex_enter(etMutex* self);
+void etMutex_leave(etMutex* self);
+
+
+#endif /* _ETMUTEX_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etPlatformLifecycle.h b/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etPlatformLifecycle.h
new file mode 100644
index 000000000..8bf41170f
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etPlatformLifecycle.h
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2012 protos software gmbh (http://www.protos.de).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Thomas Schuetz (initial contribution)
+ *
+ *******************************************************************************/
+
+#ifndef _ETPLATFORMLIFECYCLE_H_
+#define _ETPLATFORMLIFECYCLE_H_
+
+/**
+ * etPlatformLifecycle.h defines a generic interface for platform specific startup and shutdown functions
+ * those functions are called at specific points during the lifecycle of an eTrice application
+ * they can be used to integrate and execute platform or OS specific code
+ *
+ * */
+
+#include "etDatatypes.h"
+
+
+/**
+ * Platform specific code, called at the start of the system startup of the main function
+ * */
+void etUserEntry(void);
+
+/**
+ * Platform specific code, called at the end of the startup right before the start of the actual application
+ * */
+void etUserPreRun(void);
+
+/**
+ * Platform specific code, called at the beginning of the shutdown right after before the stop of the actual application
+ * */
+void etUserPostRun(void);
+
+/**
+ * Platform specific code, called at the end of the system shutdown of the main function
+ * */
+void etUserExit(void);
+
+#endif /* _ETPLATFORMLIFECYCLE_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etSema.h b/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etSema.h
new file mode 100644
index 000000000..8ab3ecf82
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etSema.h
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2013 protos software gmbh (http://www.protos.de).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Thomas Schuetz (initial contribution)
+ *
+ *******************************************************************************/
+
+#ifndef _ETSEMA_H_
+#define _ETSEMA_H_
+
+/**
+ * etSema.h defines a generic interface for platform specific implementations of a semaphore
+ *
+ * */
+
+#include "etDatatypes.h"
+
+/**
+ * etSema holds the object data for a semaphore (for self pointer)
+ *
+ * */
+typedef struct etSema {
+ etOSSemaData osData;
+} etSema;
+
+void etSema_construct(etSema* self);
+void etSema_destruct(etSema* self);
+void etSema_wakeup(etSema* self);
+void etSema_waitForWakeup(etSema* self);
+
+
+#endif /* _ETSEMA_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/platform/etPlatform.h b/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etThread.h
index b332e2140..2262dd295 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/platform/etPlatform.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etThread.h
@@ -1,104 +1,80 @@
-/*******************************************************************************
- * Copyright (c) 2012 protos software gmbh (http://www.protos.de).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Thomas Schuetz (initial contribution)
- *
- *******************************************************************************/
-
-#ifndef __ETPLATFORM_H__
-#define __ETPLATFORM_H__
-
-#include "etDatatypes.h"
-
-/**
- * etPlatform.h defines a generic interface for platform specific implementations
- *
- * */
-
-/*
- * typedefs
- */
-
-typedef int32 etStacksize;
-typedef int32 etPriority;
-typedef charPtr etThreadname;
-typedef void (*etThreadFunction)(void *);
-
-/**
- * etThread holds all data needed to handle a thread instance
- * the struct has to be filled before calling etThread_construct except for osData and osId
- **/
-typedef struct etThread{
- etOSThreadData osData; /**< OS specific thread data (e.g. handle or id) -> is filled in by etThread_construct **/
- etOSThreadId osId; /**< integer thread id (used e.g. for debugging) -> is filled in by etThread_construct **/
- etStacksize stacksize; /**< configuration of stacksize -> has to be filled in by caller of etThread_construct **/
- etPriority priority; /**< configuration of priority -> has to be filled in by caller of etThread_construct **/
- etThreadname threadName; /**< configuration of threadName -> has to be filled in by caller of etThread_construct **/
- etThreadFunction threadFunction; /**< call back function to be called by thread -> has to be filled in by caller of etThread_construct **/
- void* threadFunctionData; /**< data for call back function to be called by thread -> has to be filled in by caller of etThread_construct **/
-} etThread;
-
-/**
- * create and start a new thread
- * \param self pointer to thread instance
- */
-// TODO: add return values for error handling
-void etThread_construct(etThread* self);
-
-/**
- * stop and destroy a new thread
- * \param self pointer to thread instance
- */
-void etThread_destruct(etThread* self);
-
-/**
- * pausing the execution of the thread for <b>millis</b> milliseconds
- * \param millis sleeping time in milliseconds
- */
-void etThread_sleep(etInt32 millis);
-etOSThreadData etThread_self(void);
-etOSThreadId etThread_self_id(void);
-
-
-/*****************mutex**********************/
-
-typedef struct etMutex {
- etOSMutexData osData;
-} etMutex;
-
-void etMutex_construct(etMutex* self);
-void etMutex_destruct(etMutex* self);
-void etMutex_enter(etMutex* self);
-void etMutex_leave(etMutex* self);
-
-/********************semaphore****************/
-
-typedef struct etSema {
- etOSSemaData osData;
-} etSema;
-
-void etSema_construct(etSema* self);
-void etSema_destruct(etSema* self);
-void etSema_wakeup(etSema* self);
-void etSema_waitForWakeup(etSema* self);
-
-/*********************************************/
-
-
-
-/*
- * Platform startup and shutdown -> generated code for SubSystemClass uses these interfaces
- * */
-
-void etUserEntry(void);
-void etUserPreRun(void);
-/* void etUserRun(void); */ /* TODO: do we need this function? */
-void etUserPostRun(void);
-void etUserExit(void);
-
-#endif /* __ETPLATFORM_H__ */
+/*******************************************************************************
+ * Copyright (c) 2013 protos software gmbh (http://www.protos.de).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Thomas Schuetz, Thomas Jung (initial contribution)
+ *
+ *******************************************************************************/
+
+#ifndef _ETTHREAD_H_
+#define _ETTHREAD_H_
+
+/**
+ * etThread.h defines a generic interface for platform specific implementations of a thread
+ *
+ * */
+
+
+#include "etDatatypes.h"
+
+/*
+ * typedefs for etThread
+ */
+
+typedef int32 etStacksize;
+typedef int32 etPriority;
+typedef charPtr etThreadname;
+typedef void (*etThreadFunction)(void *);
+
+/**
+ * etThread holds all data needed to handle a thread instance
+ * the struct has to be filled before calling etThread_construct except for osData and osId
+ **/
+typedef struct etThread{
+ etOSThreadData osData; /**< OS specific thread data (e.g. handle or id) -> is filled in by etThread_construct **/
+ etOSThreadId osId; /**< integer thread id (used e.g. for debugging) -> is filled in by etThread_construct **/
+ etStacksize stacksize; /**< configuration of stacksize -> has to be filled in by caller of etThread_construct **/
+ etPriority priority; /**< configuration of priority -> has to be filled in by caller of etThread_construct **/
+ etThreadname threadName; /**< configuration of threadName -> has to be filled in by caller of etThread_construct **/
+ etThreadFunction threadFunction; /**< call back function to be called by thread -> has to be filled in by caller of etThread_construct **/
+ 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
+
+/**
+ * create and start a new thread
+ * \param self pointer to thread instance
+ */
+void etThread_construct(etThread* self); /*TODO: add all neededarguments to constructor arguments */
+
+/**
+ * stop and destroy a new thread
+ * \param self pointer to thread instance
+ */
+void etThread_destruct(etThread* self);
+
+/**
+ * pausing the execution of the thread for <b>millis</b> milliseconds
+ * \param millis sleeping time in milliseconds
+ */
+void etThread_sleep(etInt32 millis);
+
+/**
+ * get the self pointer of the OS specific data (e.g. handle) of the current thread
+ * \return self pointer of the OS specific data (e.g. handle) of the current thread
+ */
+etOSThreadData etThread_self(void);
+
+/**
+ * get the unique id of the current thread
+ * \return unique id of the current thread
+ */
+etOSThreadId etThread_self_id(void);
+
+
+#endif /* _ETTHREAD_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etTime.h b/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etTime.h
new file mode 100644
index 000000000..56f2db35b
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etTime.h
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2013 protos software gmbh (http://www.protos.de).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Thomas Schuetz (initial contribution)
+ *
+ *******************************************************************************/
+
+#ifndef _ETTIME_H_
+#define _ETTIME_H_
+
+/**
+ * etTime.h defines a generic interface for platform specific implementations of services around time
+ *
+ * */
+#include "etDatatypes.h"
+
+/**
+ * time definition composed by the number of seconds and the number of nano seconds
+ */
+typedef struct etTime {
+ etInt32 sec;
+ etInt32 nSec;
+} etTime;
+
+/**
+ * get current time from target hardware
+ * this is no real world clock time and date
+ * should be used only for relative time measurement
+ * @return current target time as etTime*
+ */
+void getTimeFromTarget(etTime *t);
+
+/*
+ * TODO: remove old API functions
+int isTimeGreaterThanActualTime(const etTime *t);
+etBool etTimer_executeNeeded(void);
+uint32 getTimeBaseNS(void);
+
+uint32 getTimeBaseUS(void);
+
+uint32 getTimeBaseMS(void);
+*/
+
+
+#endif /* _ETTIME_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etTimer.h b/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etTimer.h
new file mode 100644
index 000000000..b332b63b9
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etTimer.h
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2012 protos software gmbh (http://www.protos.de).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Thomas Jung (initial contribution)
+ *
+ *******************************************************************************/
+
+#ifndef _ETTIMER_H_
+#define _ETTIMER_H_
+
+#include "etDatatypes.h"
+#include "etTime.h"
+#include "etThread.h"
+
+
+/**
+ * etThread holds all data needed to handle a thread instance
+ * the struct has to be filled before calling etThread_construct except for osData and osId
+ **/
+typedef struct etTimer{
+ etOSTimerId osTimerId; /**< OS specific timer id (e.g. handle or id) -> is filled in by etTimer_construct **/
+ etTime timerInterval; /**< timer interval **/
+ etTimerFunction timerFunction; /**< call back function to be called by timer -> has to be filled in by caller of etTimer_construct **/
+} etTimer;
+
+
+void etTimer_construct(etTimer* self, etTime* timerInterval, etTimerFunction threadFunction);
+void etTimer_start(etTimer* self);
+void etTimer_stop(etTimer* self);
+void etTimer_destruct(etTimer* self);
+
+
+#endif /* __ETTIMER_H__ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/platform/etTimer.h b/runtime/org.eclipse.etrice.runtime.c/src/common/platform/etTimer.h
deleted file mode 100644
index 0d212c593..000000000
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/platform/etTimer.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 protos software gmbh (http://www.protos.de).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Thomas Jung (initial contribution)
- *
- *******************************************************************************/
-
-#ifndef _ETTIMER_H_
-#define _ETTIMER_H_
-
-#include "etDatatypes.h"
-
-typedef struct etTargetTime {
- unsigned long nSec;
- unsigned long sec;
-} etTargetTime_t;
-
-void etTimer_init(void);
-
-uint32 getNSecFromTarget(void);
-uint32 getSecFromTarget(void);
-
-void getTimeFromTarget(etTargetTime_t *t);
-
-int isTimeGreaterThanActualTime(const etTargetTime_t *t);
-
-etBool etTimer_executeNeeded(void);
-
-uint32 getTimeBaseNS(void);
-
-uint32 getTimeBaseUS(void);
-
-uint32 getTimeBaseMS(void);
-
-#endif /* __ETTIMER_H__ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/runtime/etThreadList.h b/runtime/org.eclipse.etrice.runtime.c/src/common/runtime/etThreadList.h
index 7b20103df..79f2fe1be 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/runtime/etThreadList.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/runtime/etThreadList.h
@@ -13,7 +13,7 @@
#ifndef _etThreadController_H_
#define _etThreadController_H_
-#include "platform/etPlatform.h"
+#include "osal/etThread.h"
/**
* etThreadController holds a complete list of all threads
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC/etDatatypes.h b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC/etDatatypes.h
new file mode 100644
index 000000000..ee503e50b
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC/etDatatypes.h
@@ -0,0 +1,101 @@
+/*******************************************************************************
+ * Copyright (c) 2011 protos software gmbh (http://www.protos.de).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Thomas Schuetz (initial contribution)
+ *
+ *******************************************************************************/
+
+#ifndef _ETDATATYPES_H_
+#define _ETDATATYPES_H_
+
+/*
+ * typedefs for platform specific datatypes
+ * generic Version for most bigger 32 and 64 bit platforms like Linux an Windows
+ *
+ * */
+
+/* TODO: implement for posix */
+
+#include <stdio.h>
+
+/* unsigned integer datatypes */
+typedef unsigned char uint8;
+typedef unsigned short int uint16;
+typedef unsigned long uint32;
+typedef unsigned long long uint64;
+
+/* signed integer datatypes */
+typedef char int8;
+typedef short int int16;
+typedef long int32;
+typedef long long int64;
+
+
+/* float datatypes */
+typedef float float32;
+typedef double float64;
+
+/* string datatypes */
+typedef char* charPtr;
+
+
+#ifndef NULL
+ #define NULL 0
+#endif
+
+/* boolean datatypes and values */
+typedef char bool; /* TODO: bool, Bool, Boolean, and boolean are already defined in some platforms*/
+typedef bool boolean;
+
+#ifndef TRUE
+ #define TRUE 1
+#endif
+#ifndef FALSE
+ #define FALSE 0
+#endif
+
+#define ALIGNMENT 4
+
+/*
+ * typedefs for eTrice Runtime and Testing
+ *
+ * */
+
+typedef int8 etInt8;
+typedef int16 etInt16;
+typedef int32 etInt32;
+
+typedef uint8 etUInt8;
+typedef uint16 etUInt16;
+typedef uint32 etUInt32;
+
+typedef charPtr etCharPtr;
+
+typedef float32 etFloat32;
+typedef float64 etFloat64;
+
+typedef bool etBool;
+
+
+typedef FILE* etFileHandle;
+
+typedef int16 etAddressId;
+
+/*
+ * typedefs for OS-specific types
+ */
+
+typedef int etOSMutexData;
+typedef int etOSThreadData;
+/*typedef int etOSThreadId;*/ /*TODO: check if correct */
+typedef int etOSSemaData;
+
+/*typedef int etOSTimerId;*/ /*TODO: check if correct */
+
+
+#endif /* _DATATYPES_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC/info.txt b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC/info.txt
new file mode 100644
index 000000000..fe9d04e4b
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC/info.txt
@@ -0,0 +1,10 @@
+Platform: MT_POSIX_GENERIC_GCC
+
+Threading: Multi Threaded
+Processor: -
+Operating System: POSIX
+Compiler: GCC
+Board: -
+
+Description:
+This platform should work for all Posix systems with a GCC compiler
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/generic/etDatatypes.h b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etDatatypes.h
index d6a33fd4d..ff5f6ad61 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/platforms/generic/etDatatypes.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etDatatypes.h
@@ -1,124 +1,113 @@
-/*******************************************************************************
- * Copyright (c) 2011 protos software gmbh (http://www.protos.de).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Thomas Schuetz (initial contribution)
- *
- *******************************************************************************/
-
-#ifndef _ETDATATYPES_H_
-#define _ETDATATYPES_H_
-
-/*
- * typedefs for platform specific datatypes
- * generic Version for most bigger 32 and 64 bit platforms like Linux an Windows
- *
- * */
-
-#include <stdio.h>
-
-#if defined __MINGW32__
-#include <windows.h>
-#include <process.h>
-#elif defined __GNUC__
-#else
-#error
-#endif
-
-
-/* unsigned integer datatypes */
-typedef unsigned char uint8;
-typedef unsigned short int uint16;
-typedef unsigned long uint32;
-typedef unsigned long long uint64;
-
-/* signed integer datatypes */
-typedef char int8;
-typedef short int int16;
-typedef long int32;
-typedef long long int64;
-
-
-/* float datatypes */
-typedef float float32;
-typedef double float64;
-
-/* string datatypes */
-typedef char* charPtr;
-
-
-#ifndef NULL
- #define NULL 0
-#endif
-
-/* boolean datatypes and values */
-typedef char bool; /* TODO: bool, Bool, Boolean, and boolean are already defined in some platforms*/
-#ifndef __MINGW32__
- typedef bool boolean;
-#endif
-
-#ifndef TRUE
- #define TRUE 1
-#endif
-#ifndef FALSE
- #define FALSE 0
-#endif
-
-#define ALIGNMENT 4
-
-/*
- * typedefs for eTrice Runtime and Testing
- *
- * */
-
-typedef int8 etInt8;
-typedef int16 etInt16;
-typedef int32 etInt32;
-
-typedef uint8 etUInt8;
-typedef uint16 etUInt16;
-typedef uint32 etUInt32;
-
-typedef charPtr etCharPtr;
-
-typedef float32 etFloat32;
-typedef float64 etFloat64;
-
-typedef bool etBool;
-
-
-typedef FILE* etFileHandle;
-
-typedef int16 etAddressId;
-
-/*
- * typedefs for threading
- */
-
-#if defined __MINGW32__
-
- typedef CRITICAL_SECTION etOSMutexData;
- typedef HANDLE etOSThreadData;
- typedef DWORD etOSThreadId;
- typedef HANDLE etOSSemaData;
-
-
-
-#elif defined __GNUC__
-
- /* dummy for LINUX/UNIX */
- typedef int etOSMutexData;
- typedef int etOSThreadData;
- typedef int etOSSemaData;
-
-#else
- #error
-#endif
-
-
-
-#endif /* _DATATYPES_H_ */
+/*******************************************************************************
+ * Copyright (c) 2011 protos software gmbh (http://www.protos.de).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Thomas Schuetz (initial contribution)
+ *
+ *******************************************************************************/
+
+#ifndef _ETDATATYPES_H_
+#define _ETDATATYPES_H_
+
+/*
+ * typedefs for platform specific datatypes
+ * generic Version for most bigger 32 and 64 bit platforms like Linux an Windows
+ *
+ * */
+
+#include <stdio.h>
+
+#include <windows.h>
+#include <process.h>
+
+/* unsigned integer datatypes */
+typedef unsigned char uint8;
+typedef unsigned short int uint16;
+typedef unsigned long uint32;
+typedef unsigned long long uint64;
+
+/* signed integer datatypes */
+typedef char int8;
+typedef short int int16;
+typedef long int32;
+typedef long long int64;
+
+
+/* float datatypes */
+typedef float float32;
+typedef double float64;
+
+/* string datatypes */
+typedef char* charPtr;
+
+
+#ifndef NULL
+ #define NULL 0
+#endif
+
+/* boolean datatypes and values */
+typedef char bool; /* TODO: bool, Bool, Boolean, and boolean are already defined in some platforms*/
+
+#ifndef TRUE
+ #define TRUE 1
+#endif
+#ifndef FALSE
+ #define FALSE 0
+#endif
+
+#define ALIGNMENT 4
+
+/*
+ * typedefs for eTrice Runtime and Testing
+ *
+ * */
+
+typedef int8 etInt8;
+typedef int16 etInt16;
+typedef int32 etInt32;
+
+typedef uint8 etUInt8;
+typedef uint16 etUInt16;
+typedef uint32 etUInt32;
+
+typedef charPtr etCharPtr;
+
+typedef float32 etFloat32;
+typedef float64 etFloat64;
+
+typedef bool etBool;
+
+
+typedef FILE* etFileHandle;
+
+typedef int16 etAddressId;
+
+/*
+ * typedefs for OS-specific types
+ */
+
+ typedef CRITICAL_SECTION etOSMutexData;
+ typedef HANDLE etOSThreadData;
+ typedef DWORD etOSThreadId;
+ typedef HANDLE etOSSemaData;
+
+ typedef UINT_PTR etOSTimerId;
+
+//typedef TIMERPROC etTimerFunction;
+typedef VOID(CALLBACK *etTimerFunction)(HWND,UINT,UINT,DWORD);
+//typedef void (*etThreadFunction)(void *);
+
+#define etTimerFunction_RETURN_VALUE VOID CALLBACK
+
+#define etTimerFunction_ARGUMENT_LIST HWND arg1, UINT arg2, UINT arg3, DWORD arg4
+
+
+//typedef void (*etTimerFunction)(void); /**< OS specific timer callback function **/
+//typedef VOID(CALLBACK *TIMERPROC)(HWND,UINT,UINT,DWORD);
+
+
+#endif /* _DATATYPES_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/generic/etLogger.c b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etLogger.c
index 5ab7da075..aef339cfc 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/platforms/generic/etLogger.c
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etLogger.c
@@ -1,71 +1,71 @@
-/*******************************************************************************
- * Copyright (c) 2011 protos software gmbh (http://www.protos.de).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Thomas Schuetz (initial contribution)
- *
- *******************************************************************************/
-
-#include "debugging/etLogger.h"
-
-#include <stdarg.h>
-
-
-void etLogger_logError(const char* message){
- printf("ERROR: %s\n", message);
-}
-
-void etLogger_logWarning(const char* message){
- printf("WARNING: %s\n", message);
-}
-
-void etLogger_logInfo(const char* message){
- printf("INFO: %s\n", message);
- fflush(stdout);
-}
-
-void etLogger_logErrorF(const char* format, ... ){
- printf("ERROR: ");
- va_list arglist;
- va_start( arglist, format );
- vprintf( format, arglist );
- va_end( arglist );
- printf("\n");
-}
-
-void etLogger_logWarningF(const char* format, ... ){
- printf("WARNING: ");
- va_list arglist;
- va_start( arglist, format );
- vprintf( format, arglist );
- va_end( arglist );
- printf("\n");
-}
-
-void etLogger_logInfoF(const char* format, ... ){
- printf("INFO: ");
- va_list arglist;
- va_start( arglist, format );
- vprintf( format, arglist );
- va_end( arglist );
- printf("\n");
-}
-
-etFileHandle etLogger_fopen(const char* filename, const char* mode){
- return( fopen(filename, mode) );
-}
-
-int etLogger_fclose(etFileHandle file){
- return( fclose(file) );
-}
-
-void etLogger_fprintf(etFileHandle file, const char* format, ... ){
- va_list arglist;
- va_start( arglist, format );
- vfprintf(file, format, arglist );
- va_end( arglist );
-}
+/*******************************************************************************
+ * Copyright (c) 2011 protos software gmbh (http://www.protos.de).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Thomas Schuetz (initial contribution)
+ *
+ *******************************************************************************/
+
+#include "debugging/etLogger.h"
+
+#include <stdarg.h>
+
+
+void etLogger_logError(const char* message){
+ printf("ERROR: %s\n", message);
+}
+
+void etLogger_logWarning(const char* message){
+ printf("WARNING: %s\n", message);
+}
+
+void etLogger_logInfo(const char* message){
+ printf("INFO: %s\n", message);
+ fflush(stdout);
+}
+
+void etLogger_logErrorF(const char* format, ... ){
+ printf("ERROR: ");
+ va_list arglist;
+ va_start( arglist, format );
+ vprintf( format, arglist );
+ va_end( arglist );
+ printf("\n");
+}
+
+void etLogger_logWarningF(const char* format, ... ){
+ printf("WARNING: ");
+ va_list arglist;
+ va_start( arglist, format );
+ vprintf( format, arglist );
+ va_end( arglist );
+ printf("\n");
+}
+
+void etLogger_logInfoF(const char* format, ... ){
+ printf("INFO: ");
+ va_list arglist;
+ va_start( arglist, format );
+ vprintf( format, arglist );
+ va_end( arglist );
+ printf("\n");
+}
+
+etFileHandle etLogger_fopen(const char* filename, const char* mode){
+ return( fopen(filename, mode) );
+}
+
+int etLogger_fclose(etFileHandle file){
+ return( fclose(file) );
+}
+
+void etLogger_fprintf(etFileHandle file, const char* format, ... ){
+ va_list arglist;
+ va_start( arglist, format );
+ vfprintf(file, format, arglist );
+ va_end( arglist );
+}
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etMutex.c b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etMutex.c
new file mode 100644
index 000000000..5521682ac
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etMutex.c
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2013 protos software gmbh (http://www.protos.de).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Thomas Schuetz, Thomas Jung (initial contribution)
+ *
+ *******************************************************************************/
+
+/**
+ *
+ * etMutex.c MinGW implementation of etMutex
+ *
+ */
+
+#include "osal/etMutex.h"
+
+#include "debugging/etLogger.h"
+#include "debugging/etMSCLogger.h"
+
+void etMutex_construct(etMutex* self){
+ ET_MSC_LOGGER_SYNC_ENTRY("etMutex", "construct")
+ InitializeCriticalSection( &(self->osData) );
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+void etMutex_destruct(etMutex* self){
+ ET_MSC_LOGGER_SYNC_ENTRY("etMutex", "destruct")
+ DeleteCriticalSection( &(self->osData) );
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+
+void etMutex_enter(etMutex* self){
+ ET_MSC_LOGGER_SYNC_ENTRY("etMutex", "enter")
+ EnterCriticalSection( &(self->osData) );
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+void etMutex_leave(etMutex* self){
+ ET_MSC_LOGGER_SYNC_ENTRY("etMutex", "leave")
+ LeaveCriticalSection( &(self->osData) );
+ ET_MSC_LOGGER_SYNC_EXIT
+}
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etPlatformLifecycle.c b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etPlatformLifecycle.c
new file mode 100644
index 000000000..5dd07e1ae
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etPlatformLifecycle.c
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2013 protos software gmbh (http://www.protos.de).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Thomas Schuetz, Thomas Jung (initial contribution)
+ *
+ *******************************************************************************/
+
+
+
+#include "osal/etPlatformLifecycle.h"
+
+void etUserEntry(void){ /* not needed for this OS */ }
+void etUserPreRun(void){ /* not needed for this OS */ }
+void etUserPostRun(void){ /* not needed for this OS */ }
+void etUserExit(void){ /* not needed for this OS */ }
+
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
new file mode 100644
index 000000000..13f8daca8
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etSema.c
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2013 protos software gmbh (http://www.protos.de).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Thomas Schuetz, Thomas Jung (initial contribution)
+ *
+ *******************************************************************************/
+
+/**
+ *
+ * etSema.c MinGW implementation of etSema
+ *
+ */
+
+#include "osal/etSema.h"
+#include "etDatatypes.h"
+
+#include "debugging/etMSCLogger.h"
+
+
+void etSema_construct(etSema* self){
+ ET_MSC_LOGGER_SYNC_ENTRY("etSema", "construct")
+ self->osData = CreateEvent( NULL, FALSE, FALSE, NULL );
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+void etSema_destruct(etSema* self){
+ ET_MSC_LOGGER_SYNC_ENTRY("etSema", "destruct")
+ // TODO: implement this function
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+
+void etSema_wakeup(etSema* self){
+ ET_MSC_LOGGER_SYNC_ENTRY("etSema", "wakeup")
+ SetEvent( self->osData );
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+
+void etSema_waitForWakeup(etSema* self){
+ ET_MSC_LOGGER_SYNC_ENTRY("etSema", "waitForWakeup")
+ WaitForSingleObject( self->osData, INFINITE );
+ ET_MSC_LOGGER_SYNC_EXIT
+}
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etThread.c b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etThread.c
new file mode 100644
index 000000000..14ea2b98a
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etThread.c
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2013 protos software gmbh (http://www.protos.de).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Thomas Schuetz, Thomas Jung (initial contribution)
+ *
+ *******************************************************************************/
+
+/**
+ *
+ * etThread.c MinGW implementation of etThread
+ *
+ */
+
+#include "osal/etThread.h"
+
+#include "debugging/etLogger.h"
+#include "debugging/etMSCLogger.h"
+
+void etThread_execute(etThread* self);
+
+void etThread_construct(etThread* self){
+ ET_MSC_LOGGER_SYNC_ENTRY("etThread", "construct")
+ self->osData = (HANDLE)_beginthread( (etThreadFunction)etThread_execute, self->stacksize, self );
+ SetThreadPriority(self->osData, self->priority);
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+
+void etThread_execute(etThread* self){
+ ET_MSC_LOGGER_SYNC_ENTRY("etThread", "execute")
+ /* etThread_execute redirects the call from the thread to the execute function in the eTrice runtime to enable correct synchronous MSC logging */
+ self->threadFunction(self->threadFunctionData);
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+
+void etThread_destruct(etThread* self){
+ ET_MSC_LOGGER_SYNC_ENTRY("etThread", "destruct")
+ TerminateThread(self->osData, 0);
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+
+void etThread_sleep(etInt32 millis){
+ ET_MSC_LOGGER_SYNC_ENTRY("etThread", "sleep")
+ Sleep(millis);
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+
+etOSThreadData etThread_self(void){
+ return GetCurrentThread();
+}
+
+etOSThreadId etThread_self_id(void){
+ return GetCurrentThreadId();
+}
+
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etTime.c b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etTime.c
new file mode 100644
index 000000000..d367f9ebc
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etTime.c
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2013 protos software gmbh (http://www.protos.de).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Thomas Schuetz, Thomas Jung (initial contribution)
+ *
+ *******************************************************************************/
+
+/**
+ *
+ * etTime.c MinGW implementation of etTime
+ *
+ */
+
+#include "osal/etTime.h"
+
+#include <sys/time.h>
+
+void getTimeFromTarget(etTime *t){
+ struct timeval currentTime;
+ gettimeofday(&currentTime, NULL);
+ t->sec = currentTime.tv_sec;
+ t->nSec = currentTime.tv_usec*1000;
+}
+
+
+/* TODO: remove old API functions
+uint64 getTargetTimeUs(void){
+ struct timeval currentTime;
+ gettimeofday(&currentTime, NULL);
+
+ return currentTime.tv_sec * 1000000L + currentTime.tv_usec;
+}
+
+etBool etTimer_executeNeeded(void){
+
+ static uint64 lastTime = 0L;
+
+ uint64 currentTime = getTargetTimeUs();
+
+ uint64 timestep = 1000000L/FREQUENCY;
+
+ if (currentTime >= lastTime + timestep) {
+ lastTime = currentTime;
+ return TRUE;
+ }
+ else {
+ return FALSE;
+ }
+}
+
+*/
+
+
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etTimer.c b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etTimer.c
new file mode 100644
index 000000000..3cbd39fe6
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etTimer.c
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2013 protos software gmbh (http://www.protos.de).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Thomas Schuetz (initial contribution)
+ *
+ *******************************************************************************/
+
+/**
+ *
+ * etTimer.c MinGW implementation of etTimer
+ *
+ */
+
+#include "osal/etTimer.h"
+#include "helpers/etTimeHelpers.h"
+
+void etTimer_construct(etTimer* self, etTime* timerInterval, etTimerFunction threadFunction){
+ self->osTimerId = 0;
+ self->timerInterval.sec = timerInterval->sec;
+ self->timerInterval.nSec = timerInterval->nSec;
+ self->timerFunction = threadFunction;
+}
+
+void etTimer_start(etTimer* self){
+ UINT elapse;
+ /* calculate the time in milliseconds -> accuracy will of nSec will get lost in windows! */
+ elapse = etTimeHelpers_convertToMSec(&(self->timerInterval));
+ /*TODO: should we replace the forced cast by a platform specific implementation of the timer callback function? */
+ self->osTimerId = SetTimer(NULL, 0, elapse, self->timerFunction);
+}
+
+void etTimer_stop(etTimer* self){
+ KillTimer(NULL, self->osTimerId);
+}
+
+void etTimer_destruct(etTimer* self){
+ /* no implementation needed for this operating system */
+}
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/info.txt b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/info.txt
new file mode 100644
index 000000000..c5b3b86f5
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/info.txt
@@ -0,0 +1,10 @@
+Platform: MT_WIN_MinGW
+
+Threading: Multi Threaded
+Processor: -
+Operating System: Windows (MinGW)
+Compiler: GCC (MinGW)
+Board: -
+
+Description:
+This platform should work for all Windows based MinGW compilers
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/generic/etPlatform.c b/runtime/org.eclipse.etrice.runtime.c/src/platforms/generic/etPlatform.c
deleted file mode 100644
index 1e1a97bc4..000000000
--- a/runtime/org.eclipse.etrice.runtime.c/src/platforms/generic/etPlatform.c
+++ /dev/null
@@ -1,144 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 protos software gmbh (http://www.protos.de).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Thomas Schuetz (initial contribution)
- *
- *******************************************************************************/
-
-#include "etDatatypes.h"
-#include "platform/etPlatform.h"
-
-#include "debugging/etLogger.h"
-#include "debugging/etMSCLogger.h"
-
-/* implemenatation for eTrice interfaces*/
-
-void etUserEntry(void){ }
-
-void etUserPreRun(void){ }
-
-void etUserPostRun(void){ }
-
-void etUserExit(void){ }
-
-
-/* platform specific functions */
-
-#if defined __MINGW32__
-
-/******************thread********************/
-void etThread_execute(etThread* self);
-
-void etThread_construct(etThread* self){
- ET_MSC_LOGGER_SYNC_ENTRY("etThread", "construct")
- self->osData = (HANDLE)_beginthread( (etThreadFunction)etThread_execute, self->stacksize, self );
- SetThreadPriority(self->osData, self->priority);
- ET_MSC_LOGGER_SYNC_EXIT
-}
-
-void etThread_execute(etThread* self){
- ET_MSC_LOGGER_SYNC_ENTRY("etThread", "execute")
- /* etThread_execute redirects the call from the thread to the execute function in the eTrice runtime to enable correct synchronous MSC logging */
- self->threadFunction(self->threadFunctionData);
- ET_MSC_LOGGER_SYNC_EXIT
-}
-
-
-void etThread_destruct(etThread* self){
- ET_MSC_LOGGER_SYNC_ENTRY("etThread", "destruct")
- TerminateThread(self->osData, 0);
- ET_MSC_LOGGER_SYNC_EXIT
-}
-
-
-/******************thread helpers********************/
-void etThread_sleep(etInt32 millis){
- ET_MSC_LOGGER_SYNC_ENTRY("etThread", "sleep")
- Sleep(millis);
- ET_MSC_LOGGER_SYNC_EXIT
-}
-
-etOSThreadData etThread_self(void){
- return GetCurrentThread();
-}
-
-etOSThreadId etThread_self_id(void){
- return GetCurrentThreadId();
-}
-
-/*****************mutex**********************/
-void etMutex_construct(etMutex* self){
- ET_MSC_LOGGER_SYNC_ENTRY("etMutex", "construct")
- InitializeCriticalSection( &(self->osData) );
- ET_MSC_LOGGER_SYNC_EXIT
-}
-void etMutex_destruct(etMutex* self){
- ET_MSC_LOGGER_SYNC_ENTRY("etMutex", "destruct")
- DeleteCriticalSection( &(self->osData) );
- ET_MSC_LOGGER_SYNC_EXIT
-}
-
-void etMutex_enter(etMutex* self){
- ET_MSC_LOGGER_SYNC_ENTRY("etMutex", "enter")
- EnterCriticalSection( &(self->osData) );
- ET_MSC_LOGGER_SYNC_EXIT
-}
-void etMutex_leave(etMutex* self){
- ET_MSC_LOGGER_SYNC_ENTRY("etMutex", "leave")
- LeaveCriticalSection( &(self->osData) );
- ET_MSC_LOGGER_SYNC_EXIT
-}
-
-/********************semaphore****************/
-void etSema_construct(etSema* self){
- ET_MSC_LOGGER_SYNC_ENTRY("etSema", "construct")
- self->osData = CreateEvent( NULL, FALSE, FALSE, NULL );
- ET_MSC_LOGGER_SYNC_EXIT
-}
-void etSema_destruct(etSema* self){
- ET_MSC_LOGGER_SYNC_ENTRY("etSema", "destruct")
- // TODO: implement this function
- ET_MSC_LOGGER_SYNC_EXIT
-}
-
-void etSema_wakeup(etSema* self){
- ET_MSC_LOGGER_SYNC_ENTRY("etSema", "wakeup")
- SetEvent( self->osData );
- ET_MSC_LOGGER_SYNC_EXIT
-}
-
-void etSema_waitForWakeup(etSema* self){
- ET_MSC_LOGGER_SYNC_ENTRY("etSema", "waitForWakeup")
- WaitForSingleObject( self->osData, INFINITE );
- ET_MSC_LOGGER_SYNC_EXIT
-}
-/*********************************************/
-
-#elif defined __GNUC__
-
-/******************thread********************/
-void etThread_construct(etThread* self){}
-
-void etThread_destruct(etThread* self){}
-
-/*****************mutex**********************/
-void etMutex_construct(etMutex* self){}
-void etMutex_destruct(etMutex* self){}
-void etMutex_enter(etMutex* self){}
-void etMutex_leave(etMutex* self){}
-
-/********************semaphore****************/
-void etSema_construct(etSema* self){}
-void etSema_destruct(etSema* self){}
-
-void etSema_wakeup(etSema* self){}
-
-void etSema_waitForWakeup(etSema* self){}
-/*********************************************/
-
-#endif
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/generic/etTimer.c b/runtime/org.eclipse.etrice.runtime.c/src/platforms/generic/etTimer.c
deleted file mode 100644
index a0076c25a..000000000
--- a/runtime/org.eclipse.etrice.runtime.c/src/platforms/generic/etTimer.c
+++ /dev/null
@@ -1,39 +0,0 @@
-#include "platform/etTimer.h"
-
-#include <sys/time.h>
-
-#include "etRuntimeConfig.h"
-
-void etTimer_init(void){
-}
-
-uint64 getTargetTimeUs(void){
- struct timeval currentTime;
- gettimeofday(&currentTime, NULL);
-
- return currentTime.tv_sec * 1000000L + currentTime.tv_usec;
-}
-
-etBool etTimer_executeNeeded(void){
-
- static uint64 lastTime = 0L;
-
- uint64 currentTime = getTargetTimeUs();
-
- uint64 timestep = 1000000L/FREQUENCY;
-
- if (currentTime >= lastTime + timestep) {
- lastTime = currentTime;
- return TRUE;
- }
- else {
- return FALSE;
- }
-}
-
-void getTimeFromTarget(etTargetTime_t *t){
- struct timeval currentTime;
- gettimeofday(&currentTime, NULL);
- t->sec = currentTime.tv_sec;
- t->nSec = currentTime.tv_usec*1000;
-}
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/generic/info.txt b/runtime/org.eclipse.etrice.runtime.c/src/platforms/generic/info.txt
deleted file mode 100644
index a2ac1f6d4..000000000
--- a/runtime/org.eclipse.etrice.runtime.c/src/platforms/generic/info.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-This generic platform can be used for most 32 or 64 bit systems like windows and linux.
-It uses standard c libraries only and it makes use of the file system.

Back to the top