Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Schuetz2013-04-29 19:41:43 +0000
committerThomas Schuetz2013-04-29 19:41:43 +0000
commit2903767e47d1d2a6d3135d7a26d2913987792f52 (patch)
tree86d2948ce587c67d289ad1213cae2b6e21a4e801 /runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etTimer.c
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/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etTimer.c')
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etTimer.c43
1 files changed, 43 insertions, 0 deletions
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 */
+}

Back to the top