Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenrik Rentz-Reichert2016-04-18 08:29:12 +0000
committerHenrik Rentz-Reichert2016-04-18 08:30:57 +0000
commitf7e62f7bc4fe98822a874c96befc9d765f40bac0 (patch)
tree6f1ca52a45954d73853666e395aa67721ace6b2f /runtime/org.eclipse.etrice.runtime.c/src/platforms
parentdc6cd1b7851886e81d58fb717197f090d0c9959a (diff)
downloadorg.eclipse.etrice-f7e62f7bc4fe98822a874c96befc9d765f40bac0.tar.gz
org.eclipse.etrice-f7e62f7bc4fe98822a874c96befc9d765f40bac0.tar.xz
org.eclipse.etrice-f7e62f7bc4fe98822a874c96befc9d765f40bac0.zip
added new runtimes for Dave (on behalf of Thomas Jung)
Diffstat (limited to 'runtime/org.eclipse.etrice.runtime.c/src/platforms')
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_XMC_FreeRTOS_Dave/etDatatypes.h55
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_XMC_FreeRTOS_Dave/etLogger.c100
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_XMC_FreeRTOS_Dave/etMultiThreadedFreeRTOSProjectSpecific_Examples/etMultiThreadedFreeRTOSProjectSpecific_XMC_Dave.c29
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_XMC_FreeRTOS_Dave/etMultiThreadedFreeRTOSProjectSpecific_Examples/readme.txt8
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_XMC_FreeRTOS_Dave/etMutex.c47
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_XMC_FreeRTOS_Dave/etPlatform.c17
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_XMC_FreeRTOS_Dave/etPlatform.h12
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_XMC_FreeRTOS_Dave/etPlatformLifecycle.c38
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_XMC_FreeRTOS_Dave/etSema.c54
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_XMC_FreeRTOS_Dave/etThread.c83
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_XMC_FreeRTOS_Dave/etTime.c44
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_XMC_FreeRTOS_Dave/etTimer.c75
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_XMC_Dave/etDatatypes.h50
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_XMC_Dave/etLogger.c100
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_XMC_Dave/etMutex.c44
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_XMC_Dave/etPlatform.c20
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_XMC_Dave/etPlatform.h13
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_XMC_Dave/etPlatformLifecycle.c43
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_XMC_Dave/etSema.c58
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_XMC_Dave/etSingleThreadedProjectSpecific_Examples/etSingleThreadedProjectSpecific_XMC_Dave_simple.c76
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_XMC_Dave/etSingleThreadedProjectSpecific_Examples/readme.txt18
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_XMC_Dave/etThread.c76
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_XMC_Dave/etTime.c21
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_XMC_Dave/etTimer.c55
24 files changed, 1136 insertions, 0 deletions
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_XMC_FreeRTOS_Dave/etDatatypes.h b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_XMC_FreeRTOS_Dave/etDatatypes.h
new file mode 100644
index 000000000..78538eec9
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_XMC_FreeRTOS_Dave/etDatatypes.h
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * 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), Thomas Jung
+ *
+ *******************************************************************************/
+
+#ifndef _ETDATATYPES_H_
+#define _ETDATATYPES_H_
+
+/*
+ * typedefs for platform specific datatypes
+ * FreeRTOS on a 32Bit version
+ */
+
+#define ET_INT64
+#define ET_FLOAT32
+//#define ET_FLOAT64 /* not available on this platform */
+
+#include "etStdDatatypes.h"
+
+#include <stdio.h>
+#include <Dave/Generated/FREERTOS/FREERTOS.h>
+#include <Dave/Generated/FREERTOS/task.h>
+#include <Dave/Generated/FREERTOS/timers.h>
+#include <Dave/Generated/FREERTOS/semphr.h>
+
+/*--- Data types for room.basic.types */
+
+/*-----------------------------------------------------------*/
+
+/*--- Data types for runtime */
+
+#define etALIGNMENT 4 /* power of 2 and >= sizeof(int) ! */
+
+typedef FILE* etFileHandle;
+
+/* types for osal */
+typedef xSemaphoreHandle etOSMutexData;
+typedef xSemaphoreHandle etOSSemaData;
+
+typedef xTaskHandle etOSThreadData;
+typedef etUInt16 etOSThreadId;
+
+typedef xTimerHandle etOSTimerData;
+typedef etUInt16 etOSTimerId;
+
+/*-----------------------------------------------------------*/
+
+#endif /* _DATATYPES_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_XMC_FreeRTOS_Dave/etLogger.c b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_XMC_FreeRTOS_Dave/etLogger.c
new file mode 100644
index 000000000..fb114d302
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_XMC_FreeRTOS_Dave/etLogger.c
@@ -0,0 +1,100 @@
+/*******************************************************************************
+ * 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)
+ *
+ *******************************************************************************/
+
+/*
+ * etLogger.c
+ *
+ * Created on: 16.01.2012
+ * Author: tschuetz
+ */
+
+
+#include "debugging/etLogger.h"
+
+#include <stdarg.h>
+
+
+void etLogger_logError(const char* message){
+#ifdef ET_LOGGER_ACTIVATE
+ printf("ERROR: %s\n", message);
+#endif
+}
+
+void etLogger_logWarning(const char* message){
+#ifdef ET_LOGGER_ACTIVATE
+ printf("WARNING: %s\n", message);
+#endif
+}
+
+void etLogger_logInfo(const char* message){
+#ifdef ET_LOGGER_ACTIVATE
+ printf("INFO: %s\n", message);
+#endif
+}
+
+void etLogger_logErrorF(const char* format, ... ){
+#ifdef ET_LOGGER_ACTIVATE
+ printf("ERROR: ");
+ va_list arglist;
+ va_start( arglist, format );
+ vprintf( format, arglist );
+ va_end( arglist );
+ printf("\n");
+#endif
+}
+
+void etLogger_logWarningF(const char* format, ... ){
+#ifdef ET_LOGGER_ACTIVATE
+ printf("WARNING: ");
+ va_list arglist;
+ va_start( arglist, format );
+ vprintf( format, arglist );
+ va_end( arglist );
+ printf("\n");
+#endif
+}
+
+void etLogger_logInfoF(const char* format, ... ){
+#ifdef ET_LOGGER_ACTIVATE
+ printf("INFO: ");
+ va_list arglist;
+ va_start( arglist, format );
+ vprintf( format, arglist );
+ va_end( arglist );
+ printf("\n");
+#endif
+}
+
+etFileHandle etLogger_fopen(const char* filename, const char* mode){
+#ifdef ET_LOGGER_ACTIVATE
+ return( fopen(filename, mode) );
+#else
+ return (0);
+#endif
+}
+
+int etLogger_fclose(etFileHandle file){
+#ifdef ET_LOGGER_ACTIVATE
+ return( fclose(file) );
+#else
+ return(0);
+#endif
+}
+
+void etLogger_fprintf(etFileHandle file, const char* format, ... ){
+#ifdef ET_LOGGER_ACTIVATE
+ va_list arglist;
+ va_start( arglist, format );
+ vfprintf(file, format, arglist );
+ va_end( arglist );
+#endif
+}
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_XMC_FreeRTOS_Dave/etMultiThreadedFreeRTOSProjectSpecific_Examples/etMultiThreadedFreeRTOSProjectSpecific_XMC_Dave.c b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_XMC_FreeRTOS_Dave/etMultiThreadedFreeRTOSProjectSpecific_Examples/etMultiThreadedFreeRTOSProjectSpecific_XMC_Dave.c
new file mode 100644
index 000000000..1231b0644
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_XMC_FreeRTOS_Dave/etMultiThreadedFreeRTOSProjectSpecific_Examples/etMultiThreadedFreeRTOSProjectSpecific_XMC_Dave.c
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * 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 Jung (initial contribution)
+ *
+ *******************************************************************************/
+/*******************************************************************************
+ * This file implements the project specific part of the FreeRTOS
+ * runtime for a XMC ARM Cortex microcontroller from Infineon.
+ *
+ * It demonstrates how to adapt to your specific microcontroller and Realtime OS.
+ *
+ ********************************************************************************/
+
+#include "osal/etTime.h"
+#include "Dave.h"
+#include "helpers/etTimeHelpers.h"
+
+void etMultiThreadedFreeRTOSProjectSpecificUserEntry();
+
+// this function will be called during initialization
+// and must be implemented project spezific
+void etMultiThreadedFreeRTOSProjectSpecificUserEntry(){
+}
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_XMC_FreeRTOS_Dave/etMultiThreadedFreeRTOSProjectSpecific_Examples/readme.txt b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_XMC_FreeRTOS_Dave/etMultiThreadedFreeRTOSProjectSpecific_Examples/readme.txt
new file mode 100644
index 000000000..3dffa4a14
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_XMC_FreeRTOS_Dave/etMultiThreadedFreeRTOSProjectSpecific_Examples/readme.txt
@@ -0,0 +1,8 @@
+The FreeRTOS eTrice runtime environment requires a running FreeRTOS for your specific target.
+Once you have your FreeRTOS running, it is very simple to adapt to your specific target.
+
+Within this directory you find some example implementations for dedicated targets.
+
+Please copy one of those example files into your project and compile it in your context.
+If necessary adapt the file to your needs.
+
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_XMC_FreeRTOS_Dave/etMutex.c b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_XMC_FreeRTOS_Dave/etMutex.c
new file mode 100644
index 000000000..7d473ce3e
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_XMC_FreeRTOS_Dave/etMutex.c
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * 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 Jung (initial contribution)
+ *
+ *******************************************************************************/
+
+/**
+ *
+ * etMutex.c FreeRTOS 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")
+ self->osData = xSemaphoreCreateMutex();
+ if((self->osData) == NULL){
+ while(1){};
+ }
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+void etMutex_destruct(etMutex* self){
+ ET_MSC_LOGGER_SYNC_ENTRY("etMutex", "destruct")
+ vSemaphoreDelete( self->osData );
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+
+void etMutex_enter(etMutex* self){
+ ET_MSC_LOGGER_SYNC_ENTRY("etMutex", "enter")
+ xSemaphoreTake(self->osData,portMAX_DELAY );
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+void etMutex_leave(etMutex* self){
+ ET_MSC_LOGGER_SYNC_ENTRY("etMutex", "leave")
+ xSemaphoreGive(self->osData);
+ ET_MSC_LOGGER_SYNC_EXIT
+}
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_XMC_FreeRTOS_Dave/etPlatform.c b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_XMC_FreeRTOS_Dave/etPlatform.c
new file mode 100644
index 000000000..57f783027
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_XMC_FreeRTOS_Dave/etPlatform.c
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * 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), Thomas Jung
+ *
+ *******************************************************************************/
+
+
+#include "etPlatform.h"
+#include "etDatatypes.h"
+#include "osal/etTime.h"
+
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_XMC_FreeRTOS_Dave/etPlatform.h b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_XMC_FreeRTOS_Dave/etPlatform.h
new file mode 100644
index 000000000..0cb59bd9e
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_XMC_FreeRTOS_Dave/etPlatform.h
@@ -0,0 +1,12 @@
+/*
+ * etPlatform.h
+ *
+ * Created on: 23.06.2012
+ * Author: junggtho
+ */
+
+#ifndef ETPLATFORM_H_
+#define ETPLATFORM_H_
+
+
+#endif /* ETPLATFORM_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_XMC_FreeRTOS_Dave/etPlatformLifecycle.c b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_XMC_FreeRTOS_Dave/etPlatformLifecycle.c
new file mode 100644
index 000000000..75c69bda7
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_XMC_FreeRTOS_Dave/etPlatformLifecycle.c
@@ -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)
+ *
+ *******************************************************************************/
+
+
+
+#include "osal/etPlatformLifecycle.h"
+#include "etPlatform.h"
+
+
+/* implemenatation for eTrice interfaces*/
+
+// must be implemented projectspecific
+extern void etMultiThreadedFreeRTOSProjectSpecificUserEntry();
+void etTimeInit(void);
+
+void etUserEntry(void){
+ etTimeInit();
+ etMultiThreadedFreeRTOSProjectSpecificUserEntry();
+}
+
+void etUserPreRun(void){
+
+ /* Start the scheduler. */
+ vTaskStartScheduler();
+}
+
+void etUserPostRun(void){ }
+void etUserExit(void){ }
+
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_XMC_FreeRTOS_Dave/etSema.c b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_XMC_FreeRTOS_Dave/etSema.c
new file mode 100644
index 000000000..c01b28724
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_XMC_FreeRTOS_Dave/etSema.c
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * 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 FreeRTOS implementation of etSema
+ *
+ */
+
+#include "osal/etSema.h"
+
+#include "debugging/etMSCLogger.h"
+
+
+void etSema_construct(etSema* self){
+ ET_MSC_LOGGER_SYNC_ENTRY("etSema", "construct")
+ self->osData = xSemaphoreCreateCounting( 1, 0 );
+ if ((self->osData) == NULL){
+ while(1){};
+ }
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+void etSema_destruct(etSema* self){
+ ET_MSC_LOGGER_SYNC_ENTRY("etSema", "destruct")
+ vSemaphoreDelete( self->osData );
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+
+void etSema_wakeup(etSema* self){
+ ET_MSC_LOGGER_SYNC_ENTRY("etSema", "wakeup")
+ xSemaphoreGive( self->osData );
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+
+void etSema_wakeupFromISR(etSema* self){
+ ET_MSC_LOGGER_SYNC_ENTRY("etSema", "wakeupFromISR")
+ xSemaphoreGiveFromISR( self->osData, NULL );
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+
+void etSema_waitForWakeup(etSema* self){
+ ET_MSC_LOGGER_SYNC_ENTRY("etSema", "waitForWakeup")
+ xSemaphoreTake(self->osData, portMAX_DELAY );
+ ET_MSC_LOGGER_SYNC_EXIT
+}
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_XMC_FreeRTOS_Dave/etThread.c b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_XMC_FreeRTOS_Dave/etThread.c
new file mode 100644
index 000000000..d682bfa11
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_XMC_FreeRTOS_Dave/etThread.c
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * 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 FreeRTOS 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,
+ etStacksize stacksize,
+ etPriority priority,
+ etThreadname threadName,
+ etThreadFunction threadFunction,
+ void* threadFunctionData)
+{
+ ET_MSC_LOGGER_SYNC_ENTRY("etThread", "construct")
+
+ /* fill in data */
+ self->stacksize = stacksize;
+ self->priority = priority;
+ self->threadName = threadName;
+ self->threadFunction = threadFunction;
+ self->threadFunctionData = threadFunctionData;
+
+ if (xTaskCreate( threadFunction, ( signed char * ) threadName, stacksize, self->threadFunctionData, priority, &(self->osData)) != pdPASS){
+ while(1){};
+ }
+// xTaskCreate( threadFunction, ( signed char * ) threadName, stacksize, self->threadFunctionData, priority, &(self->osData) );
+
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+
+void etThread_start(etThread* self) {
+ ET_MSC_LOGGER_SYNC_ENTRY("etThread", "start")
+ 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")
+ vTaskDelete( self->osData );
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+
+void etThread_sleep(etInt32 millis){
+ ET_MSC_LOGGER_SYNC_ENTRY("etThread", "sleep")
+
+ 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_XMC_FreeRTOS_Dave/etTime.c b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_XMC_FreeRTOS_Dave/etTime.c
new file mode 100644
index 000000000..1ea587d03
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_XMC_FreeRTOS_Dave/etTime.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)
+ *
+ *******************************************************************************/
+
+/**
+ *
+ * etTime.c FreeRTOS implementation of etTime
+ *
+ */
+
+#include "osal/etTime.h"
+
+etTime targetTime;
+
+void etTimeInit(void){
+ targetTime.nSec=0;
+ targetTime.sec=0;
+}
+
+
+void getTimeFromTarget(etTime *t) {
+ portENTER_CRITICAL();
+ *t = targetTime;
+ portEXIT_CRITICAL();
+}
+
+void vApplicationTickHook(void){
+ /* Tickrate from FreeRTOS Config */
+ targetTime.nSec += (1000000000UL / configTICK_RATE_HZ);
+ if (targetTime.nSec >= 1000000000UL) {
+ targetTime.nSec -= 1000000000UL;
+ targetTime.sec++;
+ }
+}
+
+
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_XMC_FreeRTOS_Dave/etTimer.c b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_XMC_FreeRTOS_Dave/etTimer.c
new file mode 100644
index 000000000..ad5d04630
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_XMC_FreeRTOS_Dave/etTimer.c
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * 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), Thomas Jung
+ *
+ *******************************************************************************/
+
+/**
+ *
+ * etTimer.c FreeRTOS implementation of etTimer
+ *
+ */
+
+#include "osal/etTimer.h"
+#include "helpers/etTimeHelpers.h"
+
+#include "debugging/etLogger.h"
+#include "debugging/etMSCLogger.h"
+
+void etTimer_callback(xTimerHandle timer);
+
+void etTimer_construct(etTimer* self, etTime* timerInterval, etTimerFunction timerFunction, void* timerFunctionData){
+ ET_MSC_LOGGER_SYNC_ENTRY("etTimer", "construct")
+ {
+ self->osTimerData = NULL;
+ self->timerInterval.sec = timerInterval->sec;
+ self->timerInterval.nSec = timerInterval->nSec;
+ self->timerFunction = timerFunction;
+ self->timerFunctionData = timerFunctionData;
+ }
+
+ portTickType period = (timerInterval->sec*configTICK_RATE_HZ) + (timerInterval->nSec / (1000000000 / configTICK_RATE_HZ));
+
+
+ self->osTimerData = xTimerCreate ( "etTimer", period, pdTRUE, (void *) self, etTimer_callback );
+
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+
+void etTimer_start(etTimer* self){
+ ET_MSC_LOGGER_SYNC_ENTRY("etTimer", "start")
+ if (xTimerStart( self->osTimerData, 0 ) != pdPASS){
+ while(1){};
+ }
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+
+void etTimer_stop(etTimer* self){
+ ET_MSC_LOGGER_SYNC_ENTRY("etTimer", "stop")
+ if (xTimerStop( self->osTimerData, 0 ) != pdPASS){
+ while(1){};
+ }
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+
+void etTimer_destruct(etTimer* self){
+ ET_MSC_LOGGER_SYNC_ENTRY("etTimer", "destruct")
+
+ if (xTimerDelete( self->osTimerData, 0 ) != pdPASS){
+ while(1){};
+ }
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+
+void etTimer_callback(xTimerHandle timer){
+ {
+ etTimer* self = (etTimer*) pvTimerGetTimerID( timer );
+ self->timerFunction(self->timerFunctionData);
+ }
+}
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_XMC_Dave/etDatatypes.h b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_XMC_Dave/etDatatypes.h
new file mode 100644
index 000000000..675ab357b
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_XMC_Dave/etDatatypes.h
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * 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), Thomas Jung
+ *
+ *******************************************************************************/
+
+#ifndef _ETDATATYPES_H_
+#define _ETDATATYPES_H_
+
+/*
+ * typedefs for platform specific datatypes
+ * Version for 32 Bit Controllers like ARM Cortex M
+ */
+
+#define ET_INT64
+#define ET_FLOAT32
+//#define ET_FLOAT64 /* not available on this platform */
+
+
+#include "etStdDatatypes.h"
+
+#include <stdio.h>
+
+/*--- Data types for room.basic.types */
+
+/*-----------------------------------------------------------*/
+
+/*--- Data types for runtime */
+
+#define etALIGNMENT 4 /* power of 2 and >= sizeof(int) ! */
+
+typedef FILE* etFileHandle;
+
+/* types for osal */
+typedef etUInt32 etOSMutexData;
+typedef etUInt32 etOSSemaData;
+typedef etUInt32 etOSThreadData;
+typedef etUInt32 etOSThreadId;
+typedef etUInt32 etOSTimerData;
+typedef etUInt32 etOSTimerId;
+
+/*-----------------------------------------------------------*/
+
+#endif /* _DATATYPES_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_XMC_Dave/etLogger.c b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_XMC_Dave/etLogger.c
new file mode 100644
index 000000000..fb114d302
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_XMC_Dave/etLogger.c
@@ -0,0 +1,100 @@
+/*******************************************************************************
+ * 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)
+ *
+ *******************************************************************************/
+
+/*
+ * etLogger.c
+ *
+ * Created on: 16.01.2012
+ * Author: tschuetz
+ */
+
+
+#include "debugging/etLogger.h"
+
+#include <stdarg.h>
+
+
+void etLogger_logError(const char* message){
+#ifdef ET_LOGGER_ACTIVATE
+ printf("ERROR: %s\n", message);
+#endif
+}
+
+void etLogger_logWarning(const char* message){
+#ifdef ET_LOGGER_ACTIVATE
+ printf("WARNING: %s\n", message);
+#endif
+}
+
+void etLogger_logInfo(const char* message){
+#ifdef ET_LOGGER_ACTIVATE
+ printf("INFO: %s\n", message);
+#endif
+}
+
+void etLogger_logErrorF(const char* format, ... ){
+#ifdef ET_LOGGER_ACTIVATE
+ printf("ERROR: ");
+ va_list arglist;
+ va_start( arglist, format );
+ vprintf( format, arglist );
+ va_end( arglist );
+ printf("\n");
+#endif
+}
+
+void etLogger_logWarningF(const char* format, ... ){
+#ifdef ET_LOGGER_ACTIVATE
+ printf("WARNING: ");
+ va_list arglist;
+ va_start( arglist, format );
+ vprintf( format, arglist );
+ va_end( arglist );
+ printf("\n");
+#endif
+}
+
+void etLogger_logInfoF(const char* format, ... ){
+#ifdef ET_LOGGER_ACTIVATE
+ printf("INFO: ");
+ va_list arglist;
+ va_start( arglist, format );
+ vprintf( format, arglist );
+ va_end( arglist );
+ printf("\n");
+#endif
+}
+
+etFileHandle etLogger_fopen(const char* filename, const char* mode){
+#ifdef ET_LOGGER_ACTIVATE
+ return( fopen(filename, mode) );
+#else
+ return (0);
+#endif
+}
+
+int etLogger_fclose(etFileHandle file){
+#ifdef ET_LOGGER_ACTIVATE
+ return( fclose(file) );
+#else
+ return(0);
+#endif
+}
+
+void etLogger_fprintf(etFileHandle file, const char* format, ... ){
+#ifdef ET_LOGGER_ACTIVATE
+ va_list arglist;
+ va_start( arglist, format );
+ vfprintf(file, format, arglist );
+ va_end( arglist );
+#endif
+}
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_XMC_Dave/etMutex.c b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_XMC_Dave/etMutex.c
new file mode 100644
index 000000000..9f78c16af
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_XMC_Dave/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 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")
+
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+void etMutex_destruct(etMutex* self){
+ ET_MSC_LOGGER_SYNC_ENTRY("etMutex", "destruct")
+
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+
+void etMutex_enter(etMutex* self){
+ ET_MSC_LOGGER_SYNC_ENTRY("etMutex", "enter")
+
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+void etMutex_leave(etMutex* self){
+ ET_MSC_LOGGER_SYNC_ENTRY("etMutex", "leave")
+
+ ET_MSC_LOGGER_SYNC_EXIT
+}
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_XMC_Dave/etPlatform.c b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_XMC_Dave/etPlatform.c
new file mode 100644
index 000000000..552917613
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_XMC_Dave/etPlatform.c
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * 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), Thomas Jung
+ *
+ *******************************************************************************/
+
+#include "etPlatform.h"
+#include "etDatatypes.h"
+#include "osal/etTime.h"
+
+void initHw(void) {
+
+ etTimeInit();
+}
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_XMC_Dave/etPlatform.h b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_XMC_Dave/etPlatform.h
new file mode 100644
index 000000000..4234318ba
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_XMC_Dave/etPlatform.h
@@ -0,0 +1,13 @@
+/*
+ * etPlatform.h
+ *
+ * Created on: 23.06.2012
+ * Author: junggtho
+ */
+
+#ifndef ETPLATFORM_H_
+#define ETPLATFORM_H_
+
+void initHw(void);
+
+#endif /* ETPLATFORM_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_XMC_Dave/etPlatformLifecycle.c b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_XMC_Dave/etPlatformLifecycle.c
new file mode 100644
index 000000000..c007a524a
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_XMC_Dave/etPlatformLifecycle.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, Thomas Jung (initial contribution)
+ *
+ *******************************************************************************/
+
+
+
+#include "osal/etPlatformLifecycle.h"
+#include "osal/etTime.h"
+#include "osal/etThread.h"
+#include "etPlatform.h"
+
+/* implemenatation for eTrice interfaces*/
+
+// noThread contains the pointer to the one and only execute function
+// in the single threaded environment
+extern etThread * noThread;
+void etThread_execute(etThread* self);
+
+// must be implemented projectspecific
+extern void etSingleThreadedProjectSpecificUserEntry();
+
+void etUserEntry(void){
+
+ etTimeInit();
+ etSingleThreadedProjectSpecificUserEntry();
+}
+
+void etUserPreRun(void){
+// __enable_irq();
+ etThread_execute(noThread);
+}
+
+void etUserPostRun(void){ }
+void etUserExit(void){ }
+
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_XMC_Dave/etSema.c b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_XMC_Dave/etSema.c
new file mode 100644
index 000000000..aee0abff7
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_XMC_Dave/etSema.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)
+ *
+ *******************************************************************************/
+
+
+#include "osal/etSema.h"
+#include "osal/etTimer.h"
+
+#include "debugging/etMSCLogger.h"
+#include "helpers/etTimeHelpers.h"
+
+extern etTimer * singleThreadedTimer;
+
+void etSema_construct(etSema* self){
+ ET_MSC_LOGGER_SYNC_ENTRY("etSema", "construct")
+
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+void etSema_destruct(etSema* self){
+ ET_MSC_LOGGER_SYNC_ENTRY("etSema", "destruct")
+
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+
+void etSema_wakeup(etSema* self){
+ ET_MSC_LOGGER_SYNC_ENTRY("etSema", "wakeup")
+
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+
+void etSema_waitForWakeup(etSema* self){
+ static etTime nextTime = {0,0};
+ etTime actualTime;
+ ET_MSC_LOGGER_SYNC_ENTRY("etSema", "waitForWakeup")
+ // busy wait as specified in etphys
+ getTimeFromTarget(&actualTime);
+ if (etTimeHelpers_isGreater(&actualTime, &nextTime)){
+ etTimeHelpers_add(&nextTime,&(singleThreadedTimer->timerInterval));
+ // call the do actions for the single thread
+ singleThreadedTimer->timerFunction(singleThreadedTimer->timerFunctionData);
+ }
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+
+void etSema_wakeupFromISR(etSema* self){
+ ET_MSC_LOGGER_SYNC_ENTRY("etSema", "wakeupFromISR")
+
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_XMC_Dave/etSingleThreadedProjectSpecific_Examples/etSingleThreadedProjectSpecific_XMC_Dave_simple.c b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_XMC_Dave/etSingleThreadedProjectSpecific_Examples/etSingleThreadedProjectSpecific_XMC_Dave_simple.c
new file mode 100644
index 000000000..75c32de6f
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_XMC_Dave/etSingleThreadedProjectSpecific_Examples/etSingleThreadedProjectSpecific_XMC_Dave_simple.c
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * 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 Jung (initial contribution)
+ *
+ *******************************************************************************/
+
+/*******************************************************************************
+ * This file implements the project specific part of teh single threaded
+ * runtime for a XMC ARM Cortex microcontroller from Infineon.
+ *
+ * It demonstrates how to adapt to your specific microcontroller. The only thing
+ * you need is a periodic interrupt which maintains the etTime. This is the base
+ * for all the modeltimers you can use in your eTrice model.
+ *
+ * This implementation gives you a 1ms accurate time. For most applications this
+ * resolution is sufficient and the implementation is much simpler. This version
+ * could serve as a starting point for your own project with any other microcontroller.
+ *
+ ********************************************************************************/
+
+#include "osal/etTime.h"
+#include "Dave.h"
+#include "helpers/etTimeHelpers.h"
+#include "etRuntimeConfig.h"
+
+extern etTime etTargetTime;
+void DAVE_InstallTickHandler(void);
+
+void getTimeFromTarget(etTime *t) {
+// return the time
+// make sure that reading the time is an atomic opration
+// => the timer interrupt should not interrupt this operation
+ __disable_irq();
+ *t = etTargetTime;
+ __enable_irq();
+}
+
+// the timer interrupt
+void etTick_Handler(void *nanoSecPerTick) {
+
+ etTargetTime.nSec += (uint32_t)nanoSecPerTick;
+
+ if (etTargetTime.nSec >= 1000000000L) {
+ etTargetTime.nSec -= 1000000000L;
+ etTargetTime.sec++;
+ }
+}
+
+// this function will be called during initialization
+void etSingleThreadedProjectSpecificUserEntry(void){
+ DAVE_InstallTickHandler();
+}
+
+#ifdef ET_USE_DAVE_SYSTIMER_APP
+#else
+void SysTick_Handler(void){
+ etTick_Handler((void *)(ET_DAVE_TICK_PERIOD_USEC * 1000));
+}
+#endif
+
+// The SYSTIMER App from DAVE must be available
+void DAVE_InstallTickHandler(void){
+#ifdef ET_USE_DAVE_SYSTIMER_APP
+ uint32_t timerId;
+ timerId = SYSTIMER_CreateTimer(ET_DAVE_TICK_PERIOD_USEC,SYSTIMER_MODE_PERIODIC,etTick_Handler,(void*) (ET_DAVE_TICK_PERIOD_USEC * 1000));
+ SYSTIMER_StartTimer(timerId);
+#else
+ SysTick_Config(SystemCoreClock * (ET_DAVE_TICK_PERIOD_USEC * 0.000001F));
+#endif //ET_USE_DAVE_SYSTIMER_APP
+}
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_XMC_Dave/etSingleThreadedProjectSpecific_Examples/readme.txt b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_XMC_Dave/etSingleThreadedProjectSpecific_Examples/readme.txt
new file mode 100644
index 000000000..e2f26b777
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_XMC_Dave/etSingleThreadedProjectSpecific_Examples/readme.txt
@@ -0,0 +1,18 @@
+The SingleThreaded runtime environment is very simple to adapt to your specific target.
+The following functions must be implemented:
+
+- getTimeFromTarget
+This function returns the target time in sec and nsec. Normaly it requires to set up
+a timer interrupt and call a count function on a fixed time base. getTimeFromTarget just returns
+the time to the eTrice environment.
+Take care about the interruptprotection (or some other mechanism) during reading the etTargetTime.
+On must targets it is not possible to read it atomic.
+
+
+-etSingleThreadedProjectSpecificUserEntry
+This function will be called during startup. Here you have to initialize your HW and
+everything else that is needed to setup your timer interrupts.
+
+Within this directory you find some example implementations for dedicated targets.
+Please copy one of those example files into your project and compile it in the your context.
+If necessary adapt the file to your needs. \ No newline at end of file
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_XMC_Dave/etThread.c b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_XMC_Dave/etThread.c
new file mode 100644
index 000000000..efec2794f
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_XMC_Dave/etThread.c
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * 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 FreeRTOS implementation of etThread
+ *
+ */
+
+#include "osal/etThread.h"
+
+#include "debugging/etLogger.h"
+#include "debugging/etMSCLogger.h"
+
+void etThread_execute(etThread* self);
+
+etThread * noThread = 0;
+
+void etThread_construct(
+ etThread* self,
+ etStacksize stacksize,
+ etPriority priority,
+ etThreadname threadName,
+ etThreadFunction threadFunction,
+ void* threadFunctionData)
+{
+ ET_MSC_LOGGER_SYNC_ENTRY("etThread", "construct")
+
+ /* fill in data */
+ self->stacksize = stacksize;
+ self->priority = priority;
+ self->threadName = threadName;
+ self->threadFunction = threadFunction;
+ self->threadFunctionData = threadFunctionData;
+ // for the single threaded port stacksize and prio is not needed
+ // save the Threadpointer as singleton
+ if(noThread==0){
+ noThread=self;
+ }else{
+ while(1){};
+ }
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+
+void etThread_start(etThread* self) {
+ ET_MSC_LOGGER_SYNC_ENTRY("etThread", "start")
+ 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")
+
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+
+void etThread_sleep(etInt32 millis){
+ ET_MSC_LOGGER_SYNC_ENTRY("etThread", "sleep")
+
+ ET_MSC_LOGGER_SYNC_EXIT
+}
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_XMC_Dave/etTime.c b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_XMC_Dave/etTime.c
new file mode 100644
index 000000000..1c020d3ea
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_XMC_Dave/etTime.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/etTime.h"
+
+etTime etTargetTime;
+
+void etTimeInit(void){
+ etTargetTime.nSec=0;
+ etTargetTime.sec=0;
+}
+
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_XMC_Dave/etTimer.c b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_XMC_Dave/etTimer.c
new file mode 100644
index 000000000..b75385e3c
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_XMC_Dave/etTimer.c
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * 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), Thomas Jung
+ *
+ *******************************************************************************/
+
+#include "osal/etTimer.h"
+#include "helpers/etTimeHelpers.h"
+
+#include "debugging/etLogger.h"
+#include "debugging/etMSCLogger.h"
+
+etTimer * singleThreadedTimer = 0;
+
+void etTimer_construct(etTimer* self, etTime* timerInterval, etTimerFunction timerFunction, void* timerFunctionData){
+ ET_MSC_LOGGER_SYNC_ENTRY("etTimer", "construct")
+ {
+ self->osTimerData = (etOSTimerData) NULL;
+ self->timerInterval.sec = timerInterval->sec;
+ self->timerInterval.nSec = timerInterval->nSec;
+ self->timerFunction = timerFunction;
+ self->timerFunctionData = timerFunctionData;
+ }
+ // store the timer, it will be needed to call the do actions
+ singleThreadedTimer = self;
+
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+
+void etTimer_start(etTimer* self){
+ ET_MSC_LOGGER_SYNC_ENTRY("etTimer", "start")
+
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+
+
+void etTimer_stop(etTimer* self){
+ ET_MSC_LOGGER_SYNC_ENTRY("etTimer", "stop")
+
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+
+void etTimer_destruct(etTimer* self){
+ ET_MSC_LOGGER_SYNC_ENTRY("etTimer", "destruct")
+
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+
+

Back to the top