Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'runtime')
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/.cproject2
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/etUnit/etUnit.c3
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/osal/etTimer.h5
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etDatatypes.h27
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etThread.c2
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etTimer.c38
6 files changed, 48 insertions, 29 deletions
diff --git a/runtime/org.eclipse.etrice.runtime.c/.cproject b/runtime/org.eclipse.etrice.runtime.c/.cproject
index 30786f557..7fae49897 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" parallelBuildOn="true" parallelizationNumber="optimal" 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="false" 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"/>
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 d5e0b7d89..8f153591f 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
@@ -24,6 +24,7 @@ static FILE* etUnit_reportfile = NULL;
/* counters */
static etInt16 etUnit_nextCaseId = 1;
+static etInt32 etUnit_errorCounter = 0;
#define ETUNIT_MAX_TEST_CASES 256
static etBool etUnit_testcaseSuccess[ETUNIT_MAX_TEST_CASES];
@@ -94,6 +95,7 @@ void etUnit_close(void) {
etUnit_reportfile = NULL;
}
etLogger_logInfoF("End Time: %ld", clock());
+ etLogger_logErrorF("Error Counter: %ld", etUnit_errorCounter);
etLogger_logInfoF("************* TEST END **************");
}
@@ -314,6 +316,7 @@ static void etUnit_handleExpect(etInt16 id, etBool result, const char *resulttex
/* nothing to do because no failure */
}
else {
+ etUnit_errorCounter++;
if (etUnit_testcaseSuccess[id] == TRUE){
/* first failure will be remembered */
etUnit_testcaseSuccess[id] = FALSE;
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
index b332b63b9..f782f9455 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etTimer.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etTimer.h
@@ -15,7 +15,6 @@
#include "etDatatypes.h"
#include "etTime.h"
-#include "etThread.h"
/**
@@ -23,13 +22,13 @@
* 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 **/
+ etOSTimerData osTimerData; /**< 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_construct(etTimer* self, etTime* timerInterval, etTimerFunction timerFunction);
void etTimer_start(etTimer* self);
void etTimer_stop(etTimer* self);
void etTimer_destruct(etTimer* self);
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etDatatypes.h b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etDatatypes.h
index ff5f6ad61..b7cfa1077 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etDatatypes.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etDatatypes.h
@@ -21,8 +21,8 @@
#include <stdio.h>
+#define WINVER 0x0500
#include <windows.h>
-#include <process.h>
/* unsigned integer datatypes */
typedef unsigned char uint8;
@@ -90,24 +90,15 @@ 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 *);
+typedef CRITICAL_SECTION etOSMutexData;
+typedef HANDLE etOSThreadData;
+typedef DWORD etOSThreadId;
+typedef HANDLE etOSSemaData;
+typedef HANDLE etOSTimerData;
+typedef DWORD etOSTimerId;
+typedef VOID(CALLBACK *etTimerFunction)(PVOID lpParam, BOOLEAN TimerOrWaitFired);
#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);
-
+#define etTimerFunction_ARGUMENT_LIST PVOID lpParam, BOOLEAN TimerOrWaitFired
#endif /* _DATATYPES_H_ */
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
index 14ea2b98a..61be3103d 100644
--- 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
@@ -21,6 +21,8 @@
#include "debugging/etLogger.h"
#include "debugging/etMSCLogger.h"
+#include <process.h>
+
void etThread_execute(etThread* self);
void etThread_construct(etThread* self){
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
index 3cbd39fe6..7e98fc932 100644
--- 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
@@ -19,25 +19,49 @@
#include "osal/etTimer.h"
#include "helpers/etTimeHelpers.h"
-void etTimer_construct(etTimer* self, etTime* timerInterval, etTimerFunction threadFunction){
- self->osTimerId = 0;
+#include "debugging/etLogger.h"
+#include "debugging/etMSCLogger.h"
+
+
+/** global handle for the Windows timer queue */
+static HANDLE hTimerQueue = NULL;
+
+void etTimer_construct(etTimer* self, etTime* timerInterval, etTimerFunction timerFunction){
+ self->osTimerData = NULL;
self->timerInterval.sec = timerInterval->sec;
self->timerInterval.nSec = timerInterval->nSec;
- self->timerFunction = threadFunction;
+ self->timerFunction = timerFunction;
+ if (hTimerQueue == NULL){
+ /* the Windows timer queue is only needed once for all timers */
+ hTimerQueue = CreateTimerQueue();
+ if (hTimerQueue == NULL){
+ etLogger_logError("etTimer_construct: CreateTimerQueue failed");
+ }
+ }
}
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);
+
+ if (hTimerQueue == NULL){
+ etLogger_logError("etTimer_start: no Timer Queue to create timer (NULL)");
+ }
+ else {
+ if (CreateTimerQueueTimer( &(self->osTimerData), hTimerQueue, self->timerFunction, NULL , 0, elapse, 0) == FALSE){
+ etLogger_logError("etTimer_start: Timer could not be created");
+ }
+ }
}
void etTimer_stop(etTimer* self){
- KillTimer(NULL, self->osTimerId);
+ if (DeleteTimerQueueTimer(hTimerQueue, self->osTimerData, NULL) == FALSE){
+ etLogger_logError("etTimer_stop: Timer could not be stopped");
+ }
}
void etTimer_destruct(etTimer* self){
- /* no implementation needed for this operating system */
+ /* TODO: destroy hTimerQueue if last timer is destroyed */
+ /* DeleteTimerQueue(hTimerQueue); */
}

Back to the top