Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenrik Rentz-Reichert2012-11-12 10:41:19 +0000
committerHenrik Rentz-Reichert2012-11-12 10:41:19 +0000
commit2114b696f47ff095502ae6293a878baa40381c8e (patch)
tree86012267c2dd6d3bf9a8cca34c0e5c33bdd13976 /runtime/org.eclipse.etrice.runtime.c/src/platforms
parentc19158d7b0cffe2179b6c08526e2912400a3d540 (diff)
downloadorg.eclipse.etrice-2114b696f47ff095502ae6293a878baa40381c8e.tar.gz
org.eclipse.etrice-2114b696f47ff095502ae6293a878baa40381c8e.tar.xz
org.eclipse.etrice-2114b696f47ff095502ae6293a878baa40381c8e.zip
[runtime.c] introduced compiler switches to distinguish platform
currently MinGW (Windows) or GNUC (Unix/Linux)
Diffstat (limited to 'runtime/org.eclipse.etrice.runtime.c/src/platforms')
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/generic/etDatatypes.h35
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/generic/etPlatform.c28
2 files changed, 56 insertions, 7 deletions
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/generic/etDatatypes.h b/runtime/org.eclipse.etrice.runtime.c/src/platforms/generic/etDatatypes.h
index 0c6d63dc4..82785b544 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/platforms/generic/etDatatypes.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/generic/etDatatypes.h
@@ -19,7 +19,13 @@
*
* */
+#if defined __MINGW32__
#include <windows.h>
+#elif defined __GNUC__
+#else
+#error
+#endif
+
#include <stdio.h>
#include <process.h>
@@ -83,12 +89,29 @@ typedef int8 etAddressId;
* typedefs for threading
*/
-typedef CRITICAL_SECTION etMutex;
-typedef HANDLE etThread;
-typedef HANDLE etSema;
+#if defined __MINGW32__
+
+ typedef CRITICAL_SECTION etMutex;
+ typedef HANDLE etThread;
+ typedef HANDLE etSema;
+
+ typedef int32 etStacksize;
+ typedef int32 etPriority;
+ typedef charPtr etThreadname;
-typedef int32 etStacksize;
-typedef int32 etPriority;
-typedef charPtr etThreadname;
+#elif defined __GNUC__
+
+ /* dummy for LINUX/UNIX */
+ typedef int etMutex;
+ typedef int etThread;
+ typedef int etSema;
+
+ typedef int32 etStacksize;
+ typedef int32 etPriority;
+ typedef charPtr etThreadname;
+
+#else
+ #error
+#endif
#endif /* _DATATYPES_H_ */
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
index c79c2ac1a..593ccefc4 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/platforms/generic/etPlatform.c
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/generic/etPlatform.c
@@ -25,8 +25,10 @@ void etUserExit(void){ }
/* platform specific functions */
+#if defined __MINGW32__
+
/******************thread********************/
-void etThread_construct(etThread* self, etThreadname name,void (*func)(void *),etStacksize stacksize, etPriority prio){
+void etThread_construct(etThread* self, const etThreadname name, void (*func)(void *), etStacksize stacksize, etPriority prio){
*self = (HANDLE)_beginthread( func, stacksize, NULL );
SetThreadPriority(*self,THREAD_PRIORITY_NORMAL);
}
@@ -59,3 +61,27 @@ void etSema_waitForWakeup(etSema* self){
WaitForSingleObject( self, INFINITE );
}
/*********************************************/
+
+#elif defined __GNUC__
+
+/******************thread********************/
+void etThread_construct(etThread* self, const etThreadname name, void (*func)(void *), etStacksize stacksize, etPriority prio){}
+
+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_contruct(etSema* self){}
+void etSema_destruct(etSema* self){}
+
+void etSema_wakeup(etSema* self){}
+
+void etSema_waitForWakeup(etSema* self){}
+/*********************************************/
+
+#endif

Back to the top