Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Schuetz2013-04-29 15:41:43 -0400
committerThomas Schuetz2013-04-29 15:41:43 -0400
commit2903767e47d1d2a6d3135d7a26d2913987792f52 (patch)
tree86d2948ce587c67d289ad1213cae2b6e21a4e801 /runtime/org.eclipse.etrice.runtime.c/src/common
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/common')
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/debugging/etMSCLogger.c5
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/helpers/etTimeHelpers.c25
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/helpers/etTimeHelpers.h23
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageService.h5
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etWakeupService.h9
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/modelbase/etPort.c2
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/modelbase/etRTSystemServicesProtocol.h4
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/osal/etMemory.h (renamed from runtime/org.eclipse.etrice.runtime.c/src/common/platform/etMemory.h)50
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/osal/etMutex.h38
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/osal/etPlatformLifecycle.h46
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/osal/etSema.h37
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/osal/etThread.h (renamed from runtime/org.eclipse.etrice.runtime.c/src/common/platform/etPlatform.h)184
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/osal/etTime.h50
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/osal/etTimer.h38
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/platform/etTimer.h40
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/runtime/etThreadList.h2
16 files changed, 375 insertions, 183 deletions
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/debugging/etMSCLogger.c b/runtime/org.eclipse.etrice.runtime.c/src/common/debugging/etMSCLogger.c
index 547eec00b..6b032cf49 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/debugging/etMSCLogger.c
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/debugging/etMSCLogger.c
@@ -11,13 +11,14 @@
*******************************************************************************/
#include "debugging/etMSCLogger.h"
-
#include "debugging/etLogger.h"
-#include "platform/etPlatform.h"
+
+#include "osal/etThread.h"
static etFileHandle etMSCLogger_fileHandle = NULL;
static char* etMSCLogger_objectName = "";
+/*TODO: move or replace ET_MAX_FILENAME_LEN */
#define ET_MAX_FILENAME_LEN 256
void etMSCLogger_open(char* logPath, char* mscName){
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/helpers/etTimeHelpers.c b/runtime/org.eclipse.etrice.runtime.c/src/common/helpers/etTimeHelpers.c
new file mode 100644
index 000000000..1aadc102c
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/helpers/etTimeHelpers.c
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * 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)
+ *
+ *******************************************************************************/
+
+#include "helpers/etTimeHelpers.h"
+
+void etTimeHelpers_subtract(etTime *first, etTime* second){
+ /* TODO: implement */
+}
+
+void etTimeHelpers_add(etTime *first, etTime* second){
+ /* TODO: implement */
+}
+
+etInt32 etTimeHelpers_convertToMSec(etTime *time){
+ return time->sec * 1000 + time->nSec / 1000000;
+}
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/helpers/etTimeHelpers.h b/runtime/org.eclipse.etrice.runtime.c/src/common/helpers/etTimeHelpers.h
new file mode 100644
index 000000000..71f20e4ce
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/helpers/etTimeHelpers.h
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * 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)
+ *
+ *******************************************************************************/
+
+#ifndef ETTIMEHELPERS_H_
+#define ETTIMEHELPERS_H_
+
+#include "osal/etTime.h"
+
+void etTime_subtract(etTime *self, etTime* subtractValue);
+void etTime_add(etTime *self, etTime* addValue);
+etInt32 etTimeHelpers_convertToMSec(etTime *time);
+
+
+#endif /* ETTIMEHELPERS_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageService.h b/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageService.h
index 7bfeaa2a0..b37f98391 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageService.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageService.h
@@ -17,7 +17,10 @@
#include "etDatatypes.h"
#include "messaging/etMessageQueue.h"
#include "messaging/etMessageReceiver.h"
-#include "platform/etPlatform.h"
+
+#include "osal/etMutex.h"
+#include "osal/etThread.h"
+#include "osal/etSema.h"
enum etMessageService_execmode {
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etWakeupService.h b/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etWakeupService.h
index c8a54213a..c6c5d4ba1 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etWakeupService.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etWakeupService.h
@@ -16,13 +16,8 @@
#include "etDatatypes.h"
#include "etSystemProtocol.h"
-/**
- * time definition composed by the number of seconds and the number of nano seconds
- */
-typedef struct etTime {
- etInt32 seconds;
- etInt32 nseconds;
-} etTime;
+#include "osal/etTime.h"
+
typedef struct etWakeupTarget {
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/modelbase/etPort.c b/runtime/org.eclipse.etrice.runtime.c/src/common/modelbase/etPort.c
index 0bf0a8fc7..a1e734618 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/modelbase/etPort.c
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/modelbase/etPort.c
@@ -13,7 +13,7 @@
#include "modelbase/etPort.h"
#include "debugging/etMSCLogger.h"
-#include "platform/etMemory.h"
+#include "osal/etMemory.h"
#include <string.h>
/*
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/modelbase/etRTSystemServicesProtocol.h b/runtime/org.eclipse.etrice.runtime.c/src/common/modelbase/etRTSystemServicesProtocol.h
index c192f452d..aab631482 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/modelbase/etRTSystemServicesProtocol.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/modelbase/etRTSystemServicesProtocol.h
@@ -10,8 +10,8 @@
*
*******************************************************************************/
-#ifndef ETRTSYSTEMSERVICESPROTOCOL_H_
-#define ETRTSYSTEMSERVICESPROTOCOL_H_
+#ifndef _ETRTSYSTEMSERVICESPROTOCOL_H_
+#define _ETRTSYSTEMSERVICESPROTOCOL_H_
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/platform/etMemory.h b/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etMemory.h
index 61c283a24..7854b1dbf 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/platform/etMemory.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etMemory.h
@@ -1,25 +1,25 @@
-/*******************************************************************************
- * 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:
- * Henrik Rentz-Reichert (initial contribution)
- *
- *******************************************************************************/
-
-#ifndef _ETMEMORY_H_
-#define _ETMEMORY_H_
-
-#include "etDatatypes.h"
-#include "etRuntimeConfig.h"
-
-#define CONSTANT_MEM_CEIL(n) \
- ((n)+(((int32)STRUCT_ALIGN-((n)&((int32)STRUCT_ALIGN-1)))&((int32)STRUCT_ALIGN-1)))
-
-#define MEM_ALIGNMENT STRUCT_ALIGN /* power of 2 and >= sizeof(int) ! */
-#define MEM_CEIL(n) CONSTANT_MEM_CEIL(n)
-
-#endif /* _ETMEMORY_H_ */
+/*******************************************************************************
+ * 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:
+ * Henrik Rentz-Reichert (initial contribution)
+ *
+ *******************************************************************************/
+
+#ifndef _ETMEMORY_H_
+#define _ETMEMORY_H_
+
+#include "etDatatypes.h"
+#include "etRuntimeConfig.h"
+
+#define CONSTANT_MEM_CEIL(n) \
+ ((n)+(((int32)STRUCT_ALIGN-((n)&((int32)STRUCT_ALIGN-1)))&((int32)STRUCT_ALIGN-1)))
+
+#define MEM_ALIGNMENT STRUCT_ALIGN /* power of 2 and >= sizeof(int) ! */
+#define MEM_CEIL(n) CONSTANT_MEM_CEIL(n)
+
+#endif /* _ETMEMORY_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etMutex.h b/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etMutex.h
new file mode 100644
index 000000000..cff62f5f8
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etMutex.h
@@ -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)
+ *
+ *
+ *******************************************************************************/
+
+#ifndef _ETMUTEX_H_
+#define _ETMUTEX_H_
+
+/**
+ * etMutex.h defines a generic interface for platform specific implementations of a mutex
+ *
+ * */
+
+#include "etDatatypes.h"
+
+/**
+ * etMutex holds the object data for a mutex (for self pointer)
+ *
+ * */
+typedef struct etMutex {
+ etOSMutexData osData;
+} etMutex;
+
+void etMutex_construct(etMutex* self);
+void etMutex_destruct(etMutex* self);
+void etMutex_enter(etMutex* self);
+void etMutex_leave(etMutex* self);
+
+
+#endif /* _ETMUTEX_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etPlatformLifecycle.h b/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etPlatformLifecycle.h
new file mode 100644
index 000000000..8bf41170f
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etPlatformLifecycle.h
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * 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)
+ *
+ *******************************************************************************/
+
+#ifndef _ETPLATFORMLIFECYCLE_H_
+#define _ETPLATFORMLIFECYCLE_H_
+
+/**
+ * etPlatformLifecycle.h defines a generic interface for platform specific startup and shutdown functions
+ * those functions are called at specific points during the lifecycle of an eTrice application
+ * they can be used to integrate and execute platform or OS specific code
+ *
+ * */
+
+#include "etDatatypes.h"
+
+
+/**
+ * Platform specific code, called at the start of the system startup of the main function
+ * */
+void etUserEntry(void);
+
+/**
+ * Platform specific code, called at the end of the startup right before the start of the actual application
+ * */
+void etUserPreRun(void);
+
+/**
+ * Platform specific code, called at the beginning of the shutdown right after before the stop of the actual application
+ * */
+void etUserPostRun(void);
+
+/**
+ * Platform specific code, called at the end of the system shutdown of the main function
+ * */
+void etUserExit(void);
+
+#endif /* _ETPLATFORMLIFECYCLE_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etSema.h b/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etSema.h
new file mode 100644
index 000000000..8ab3ecf82
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etSema.h
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * 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)
+ *
+ *******************************************************************************/
+
+#ifndef _ETSEMA_H_
+#define _ETSEMA_H_
+
+/**
+ * etSema.h defines a generic interface for platform specific implementations of a semaphore
+ *
+ * */
+
+#include "etDatatypes.h"
+
+/**
+ * etSema holds the object data for a semaphore (for self pointer)
+ *
+ * */
+typedef struct etSema {
+ etOSSemaData osData;
+} etSema;
+
+void etSema_construct(etSema* self);
+void etSema_destruct(etSema* self);
+void etSema_wakeup(etSema* self);
+void etSema_waitForWakeup(etSema* self);
+
+
+#endif /* _ETSEMA_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/platform/etPlatform.h b/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etThread.h
index b332e2140..2262dd295 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/platform/etPlatform.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etThread.h
@@ -1,104 +1,80 @@
-/*******************************************************************************
- * 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)
- *
- *******************************************************************************/
-
-#ifndef __ETPLATFORM_H__
-#define __ETPLATFORM_H__
-
-#include "etDatatypes.h"
-
-/**
- * etPlatform.h defines a generic interface for platform specific implementations
- *
- * */
-
-/*
- * typedefs
- */
-
-typedef int32 etStacksize;
-typedef int32 etPriority;
-typedef charPtr etThreadname;
-typedef void (*etThreadFunction)(void *);
-
-/**
- * etThread holds all data needed to handle a thread instance
- * the struct has to be filled before calling etThread_construct except for osData and osId
- **/
-typedef struct etThread{
- etOSThreadData osData; /**< OS specific thread data (e.g. handle or id) -> is filled in by etThread_construct **/
- etOSThreadId osId; /**< integer thread id (used e.g. for debugging) -> is filled in by etThread_construct **/
- etStacksize stacksize; /**< configuration of stacksize -> has to be filled in by caller of etThread_construct **/
- etPriority priority; /**< configuration of priority -> has to be filled in by caller of etThread_construct **/
- etThreadname threadName; /**< configuration of threadName -> has to be filled in by caller of etThread_construct **/
- etThreadFunction threadFunction; /**< call back function to be called by thread -> has to be filled in by caller of etThread_construct **/
- void* threadFunctionData; /**< data for call back function to be called by thread -> has to be filled in by caller of etThread_construct **/
-} etThread;
-
-/**
- * create and start a new thread
- * \param self pointer to thread instance
- */
-// TODO: add return values for error handling
-void etThread_construct(etThread* self);
-
-/**
- * stop and destroy a new thread
- * \param self pointer to thread instance
- */
-void etThread_destruct(etThread* self);
-
-/**
- * pausing the execution of the thread for <b>millis</b> milliseconds
- * \param millis sleeping time in milliseconds
- */
-void etThread_sleep(etInt32 millis);
-etOSThreadData etThread_self(void);
-etOSThreadId etThread_self_id(void);
-
-
-/*****************mutex**********************/
-
-typedef struct etMutex {
- etOSMutexData osData;
-} etMutex;
-
-void etMutex_construct(etMutex* self);
-void etMutex_destruct(etMutex* self);
-void etMutex_enter(etMutex* self);
-void etMutex_leave(etMutex* self);
-
-/********************semaphore****************/
-
-typedef struct etSema {
- etOSSemaData osData;
-} etSema;
-
-void etSema_construct(etSema* self);
-void etSema_destruct(etSema* self);
-void etSema_wakeup(etSema* self);
-void etSema_waitForWakeup(etSema* self);
-
-/*********************************************/
-
-
-
-/*
- * Platform startup and shutdown -> generated code for SubSystemClass uses these interfaces
- * */
-
-void etUserEntry(void);
-void etUserPreRun(void);
-/* void etUserRun(void); */ /* TODO: do we need this function? */
-void etUserPostRun(void);
-void etUserExit(void);
-
-#endif /* __ETPLATFORM_H__ */
+/*******************************************************************************
+ * 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)
+ *
+ *******************************************************************************/
+
+#ifndef _ETTHREAD_H_
+#define _ETTHREAD_H_
+
+/**
+ * etThread.h defines a generic interface for platform specific implementations of a thread
+ *
+ * */
+
+
+#include "etDatatypes.h"
+
+/*
+ * typedefs for etThread
+ */
+
+typedef int32 etStacksize;
+typedef int32 etPriority;
+typedef charPtr etThreadname;
+typedef void (*etThreadFunction)(void *);
+
+/**
+ * etThread holds all data needed to handle a thread instance
+ * the struct has to be filled before calling etThread_construct except for osData and osId
+ **/
+typedef struct etThread{
+ etOSThreadData osData; /**< OS specific thread data (e.g. handle or id) -> is filled in by etThread_construct **/
+ etOSThreadId osId; /**< integer thread id (used e.g. for debugging) -> is filled in by etThread_construct **/
+ etStacksize stacksize; /**< configuration of stacksize -> has to be filled in by caller of etThread_construct **/
+ etPriority priority; /**< configuration of priority -> has to be filled in by caller of etThread_construct **/
+ etThreadname threadName; /**< configuration of threadName -> has to be filled in by caller of etThread_construct **/
+ etThreadFunction threadFunction; /**< call back function to be called by thread -> has to be filled in by caller of etThread_construct **/
+ void* threadFunctionData; /**< data for call back function to be called by thread -> has to be filled in by caller of etThread_construct **/
+} etThread;
+
+// TODO: add return values for error handling
+
+/**
+ * create and start a new thread
+ * \param self pointer to thread instance
+ */
+void etThread_construct(etThread* self); /*TODO: add all neededarguments to constructor arguments */
+
+/**
+ * stop and destroy a new thread
+ * \param self pointer to thread instance
+ */
+void etThread_destruct(etThread* self);
+
+/**
+ * pausing the execution of the thread for <b>millis</b> milliseconds
+ * \param millis sleeping time in milliseconds
+ */
+void etThread_sleep(etInt32 millis);
+
+/**
+ * get the self pointer of the OS specific data (e.g. handle) of the current thread
+ * \return self pointer of the OS specific data (e.g. handle) of the current thread
+ */
+etOSThreadData etThread_self(void);
+
+/**
+ * get the unique id of the current thread
+ * \return unique id of the current thread
+ */
+etOSThreadId etThread_self_id(void);
+
+
+#endif /* _ETTHREAD_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etTime.h b/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etTime.h
new file mode 100644
index 000000000..56f2db35b
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etTime.h
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * 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)
+ *
+ *******************************************************************************/
+
+#ifndef _ETTIME_H_
+#define _ETTIME_H_
+
+/**
+ * etTime.h defines a generic interface for platform specific implementations of services around time
+ *
+ * */
+#include "etDatatypes.h"
+
+/**
+ * time definition composed by the number of seconds and the number of nano seconds
+ */
+typedef struct etTime {
+ etInt32 sec;
+ etInt32 nSec;
+} etTime;
+
+/**
+ * get current time from target hardware
+ * this is no real world clock time and date
+ * should be used only for relative time measurement
+ * @return current target time as etTime*
+ */
+void getTimeFromTarget(etTime *t);
+
+/*
+ * TODO: remove old API functions
+int isTimeGreaterThanActualTime(const etTime *t);
+etBool etTimer_executeNeeded(void);
+uint32 getTimeBaseNS(void);
+
+uint32 getTimeBaseUS(void);
+
+uint32 getTimeBaseMS(void);
+*/
+
+
+#endif /* _ETTIME_H_ */
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
new file mode 100644
index 000000000..b332b63b9
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etTimer.h
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * 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 Jung (initial contribution)
+ *
+ *******************************************************************************/
+
+#ifndef _ETTIMER_H_
+#define _ETTIMER_H_
+
+#include "etDatatypes.h"
+#include "etTime.h"
+#include "etThread.h"
+
+
+/**
+ * etThread holds all data needed to handle a thread instance
+ * 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 **/
+ 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_start(etTimer* self);
+void etTimer_stop(etTimer* self);
+void etTimer_destruct(etTimer* self);
+
+
+#endif /* __ETTIMER_H__ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/platform/etTimer.h b/runtime/org.eclipse.etrice.runtime.c/src/common/platform/etTimer.h
deleted file mode 100644
index 0d212c593..000000000
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/platform/etTimer.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * 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 Jung (initial contribution)
- *
- *******************************************************************************/
-
-#ifndef _ETTIMER_H_
-#define _ETTIMER_H_
-
-#include "etDatatypes.h"
-
-typedef struct etTargetTime {
- unsigned long nSec;
- unsigned long sec;
-} etTargetTime_t;
-
-void etTimer_init(void);
-
-uint32 getNSecFromTarget(void);
-uint32 getSecFromTarget(void);
-
-void getTimeFromTarget(etTargetTime_t *t);
-
-int isTimeGreaterThanActualTime(const etTargetTime_t *t);
-
-etBool etTimer_executeNeeded(void);
-
-uint32 getTimeBaseNS(void);
-
-uint32 getTimeBaseUS(void);
-
-uint32 getTimeBaseMS(void);
-
-#endif /* __ETTIMER_H__ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/runtime/etThreadList.h b/runtime/org.eclipse.etrice.runtime.c/src/common/runtime/etThreadList.h
index 7b20103df..79f2fe1be 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/runtime/etThreadList.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/runtime/etThreadList.h
@@ -13,7 +13,7 @@
#ifndef _etThreadController_H_
#define _etThreadController_H_
-#include "platform/etPlatform.h"
+#include "osal/etThread.h"
/**
* etThreadController holds a complete list of all threads

Back to the top