Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Jung2015-05-15 13:55:57 +0000
committerThomas Jung2015-05-15 13:55:57 +0000
commitc43822b7a67b3691d77fc4cb49cf2f2d3832e11e (patch)
treea0799b34490dca8fd5dcfa6084f142acd576b931 /runtime/org.eclipse.etrice.runtime.c/src/platforms
parenta275e1550e63272c2a1b08d3b6dd0c636f644529 (diff)
downloadorg.eclipse.etrice-c43822b7a67b3691d77fc4cb49cf2f2d3832e11e.tar.gz
org.eclipse.etrice-c43822b7a67b3691d77fc4cb49cf2f2d3832e11e.tar.xz
org.eclipse.etrice-c43822b7a67b3691d77fc4cb49cf2f2d3832e11e.zip
etrice.runtime.c generic single threaded added
Diffstat (limited to 'runtime/org.eclipse.etrice.runtime.c/src/platforms')
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_32Bit_Generic/etDatatypes.h90
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_32Bit_Generic/etLogger.c100
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_32Bit_Generic/etMutex.c44
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_32Bit_Generic/etPlatform.c20
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_32Bit_Generic/etPlatform.h13
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_32Bit_Generic/etPlatformLifecycle.c45
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_32Bit_Generic/etSema.c51
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_32Bit_Generic/etSingleThreadedProjectSpecific_Examples/etSingleThreadedProjectSpecific_XMC_Dave.c70
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_32Bit_Generic/etSingleThreadedProjectSpecific_Examples/readme.txt18
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_32Bit_Generic/etThread.c76
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_32Bit_Generic/etTime.c21
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_32Bit_Generic/etTimer.c55
12 files changed, 603 insertions, 0 deletions
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_32Bit_Generic/etDatatypes.h b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_32Bit_Generic/etDatatypes.h
new file mode 100644
index 000000000..762d9b50c
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_32Bit_Generic/etDatatypes.h
@@ -0,0 +1,90 @@
+/*******************************************************************************
+ * 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
+ *
+ * */
+
+#include <stdio.h>
+
+/* unsigned integer datatypes */
+typedef unsigned char uint8;
+typedef unsigned short int uint16;
+typedef unsigned int uint32;
+typedef unsigned long long uint64;
+
+/* signed integer datatypes */
+typedef char int8;
+typedef short int int16;
+typedef int int32;
+typedef long long int64;
+
+
+/* float datatypes */
+typedef float float32;
+/* typedef double float64; */ /* not available on this platform */
+
+/* boolean datatypes and values */
+typedef char boolean;
+#ifndef ET_TRUE
+ #define ET_TRUE 1
+#endif
+#ifndef ET_FALSE
+ #define ET_FALSE 0
+#endif
+
+/*
+ * 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 bool etBool;
+typedef char etBool;
+
+#define ALIGNMENT 4 /* power of 2 and >= sizeof(int) ! */
+
+typedef float32 etFloat32;
+typedef float32 etFloat64;
+
+/* string datatypes */
+typedef char* charPtr;
+
+
+typedef FILE* etFileHandle;
+
+typedef int8 etAddressId;
+
+
+/*
+ * typedefs for OS-specific types
+ */
+typedef uint32 etOSMutexData;
+typedef uint32 etOSSemaData;
+typedef uint32 etOSThreadData;
+typedef uint32 etOSThreadId;
+typedef uint32 etOSTimerData;
+typedef uint32 etOSTimerId;
+
+#endif /* _DATATYPES_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_32Bit_Generic/etLogger.c b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_32Bit_Generic/etLogger.c
new file mode 100644
index 000000000..fb114d302
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_32Bit_Generic/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_32Bit_Generic/etMutex.c b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_32Bit_Generic/etMutex.c
new file mode 100644
index 000000000..9f78c16af
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_32Bit_Generic/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_32Bit_Generic/etPlatform.c b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_32Bit_Generic/etPlatform.c
new file mode 100644
index 000000000..acd640f30
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_32Bit_Generic/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) {
+
+ etTime_init();
+}
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_32Bit_Generic/etPlatform.h b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_32Bit_Generic/etPlatform.h
new file mode 100644
index 000000000..4234318ba
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_32Bit_Generic/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_32Bit_Generic/etPlatformLifecycle.c b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_32Bit_Generic/etPlatformLifecycle.c
new file mode 100644
index 000000000..38a92d5fb
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_32Bit_Generic/etPlatformLifecycle.c
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * 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();
+// DAVE_Init();
+// DAVE_InstallTickHandler();
+// initHw();
+}
+
+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_32Bit_Generic/etSema.c b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_32Bit_Generic/etSema.c
new file mode 100644
index 000000000..9a524edfd
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_32Bit_Generic/etSema.c
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * 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
+}
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_32Bit_Generic/etSingleThreadedProjectSpecific_Examples/etSingleThreadedProjectSpecific_XMC_Dave.c b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_32Bit_Generic/etSingleThreadedProjectSpecific_Examples/etSingleThreadedProjectSpecific_XMC_Dave.c
new file mode 100644
index 000000000..6a9a2c784
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_32Bit_Generic/etSingleThreadedProjectSpecific_Examples/etSingleThreadedProjectSpecific_XMC_Dave.c
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * 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)
+ *
+ *******************************************************************************/
+
+
+#include "osal/etTime.h"
+#include "XMC4500.h"
+#include "Dave.h"
+#include "helpers/etTimeHelpers.h"
+
+const PPB_Type *ppb=(PPB_Type *)0xE000E000;
+
+extern etTime etTargetTime;
+void DAVE_InstallTickHandler(void);
+
+void getTimeFromTarget(etTime *t) {
+etTime t1={0,0};
+
+ // keep in mind that it is not possible to stop the timer counter itself
+ // overflow must be checked after reading the counter
+ // if an overflow occurs do it again
+
+ // the count flag is clear on read, read it
+ t1.nSec=ppb->SYST_CSR;
+ do {
+ // amount of ticks = reloadRegister - countRegister
+ t1.nSec=(ppb->SYST_RVR-ppb->SYST_CVR);
+ *t = etTargetTime;
+ }while(ppb->SYST_CSR & 0x00010000);
+
+ // nSec = amount of ticks * 1000 / 120; if CPUCLK == 120Mhz
+ t1.nSec*=1000;
+ t1.nSec/=(SYSTIMER_SYS_CORE_CLOCK/1000000);
+ // add t1 to time
+ etTimeHelpers_add(t,&t1);
+}
+
+/* the timer interrupt */
+
+void etTick_Handler(void *nanoSecPerTick) {
+// this interrupt will be called every 1ms
+// targetTime.nSec += 1000000L;
+ etTargetTime.nSec += (uint32_t)nanoSecPerTick;
+
+ if (etTargetTime.nSec >= 1000000000L) {
+ etTargetTime.nSec -= 1000000000L;
+ etTargetTime.sec++;
+ }
+}
+
+void etSingleThreadedProjectSpecificUserEntry(void){
+ DAVE_Init();
+ DAVE_InstallTickHandler();
+}
+
+
+void DAVE_InstallTickHandler(void){
+uint32_t timerId;
+ timerId = SYSTIMER_CreateTimer(1000,SYSTIMER_PERIODIC,etTick_Handler,(void*) 1000000);
+ SYSTIMER_StartTimer(timerId);
+}
+
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_32Bit_Generic/etSingleThreadedProjectSpecific_Examples/readme.txt b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_32Bit_Generic/etSingleThreadedProjectSpecific_Examples/readme.txt
new file mode 100644
index 000000000..e2f26b777
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_32Bit_Generic/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_32Bit_Generic/etThread.c b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_32Bit_Generic/etThread.c
new file mode 100644
index 000000000..efec2794f
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_32Bit_Generic/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_32Bit_Generic/etTime.c b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_32Bit_Generic/etTime.c
new file mode 100644
index 000000000..1c020d3ea
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_32Bit_Generic/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_32Bit_Generic/etTimer.c b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_32Bit_Generic/etTimer.c
new file mode 100644
index 000000000..68ee59dc8
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_32Bit_Generic/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 = 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