Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Schuetz2012-02-26 14:58:40 +0000
committerThomas Schuetz2012-02-26 14:58:40 +0000
commitafc4b117aab39c0f6f726c4efdaa83f441faf61c (patch)
treedaaef66ac1629df2d828aff1559434fe67f55d13 /runtime/org.eclipse.etrice.runtime.c/src/platforms/generic
parent724f46d55b352c16731b46a332b13d436b536aae (diff)
downloadorg.eclipse.etrice-afc4b117aab39c0f6f726c4efdaa83f441faf61c.tar.gz
org.eclipse.etrice-afc4b117aab39c0f6f726c4efdaa83f441faf61c.tar.xz
org.eclipse.etrice-afc4b117aab39c0f6f726c4efdaa83f441faf61c.zip
[runtime.c] reorganized runtime.c for separation of common and platform specific parts, adapted include pathes, C-generator and tests
Diffstat (limited to 'runtime/org.eclipse.etrice.runtime.c/src/platforms/generic')
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/generic/etDatatypes.h72
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/generic/etGlobalFlags.h17
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/generic/etLogger.c78
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/generic/info.txt2
4 files changed, 169 insertions, 0 deletions
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/generic/etDatatypes.h b/runtime/org.eclipse.etrice.runtime.c/src/platforms/generic/etDatatypes.h
new file mode 100644
index 000000000..48a35e37f
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/generic/etDatatypes.h
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * 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)
+ *
+ *******************************************************************************/
+
+#ifndef _ETDATATYPES_H_
+#define _ETDATATYPES_H_
+
+/*
+ * typedefs for platform specific datatypes
+ *
+ * */
+
+#include <stdio.h>
+
+/* unsigned integer datatypes */
+typedef unsigned char uint8;
+typedef unsigned short int uint16;
+typedef unsigned long uint32;
+typedef unsigned long long uint64;
+
+/* signed integer datatypes */
+typedef char int8;
+typedef short int int16;
+typedef long int32;
+typedef long long int64;
+
+
+/* float datatypes */
+typedef float float32;
+typedef double float64;
+
+/* boolean datatypes and values */
+typedef char bool; /* TODO: bool, Bool, Boolean, and boolean are already defined in some platforms*/
+typedef bool boolean;
+#ifndef TRUE
+ #define TRUE 1
+#endif
+#ifndef FALSE
+ #define 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 float32 etFloat32;
+typedef float64 etFloat64;
+
+typedef FILE* etFileHandle;
+
+typedef int8 etAddressId;
+
+#endif /* _DATATYPES_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/generic/etGlobalFlags.h b/runtime/org.eclipse.etrice.runtime.c/src/platforms/generic/etGlobalFlags.h
new file mode 100644
index 000000000..80b16b5b0
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/generic/etGlobalFlags.h
@@ -0,0 +1,17 @@
+/*
+ * etGlobalFlags.h
+ *
+ * Created on: 26.02.2012
+ * Author: tschuetz
+ */
+
+#ifndef ETGLOBALFLAGS_H_
+#define ETGLOBALFLAGS_H_
+
+/* flags for debugging */
+#define ET_MSC_LOGGER_ACTIVATE /* needs ET_LOGGER_ACTIVATE */
+#define ET_LOGGER_ACTIVATE
+
+
+
+#endif /* ETGLOBALFLAGS_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/generic/etLogger.c b/runtime/org.eclipse.etrice.runtime.c/src/platforms/generic/etLogger.c
new file mode 100644
index 000000000..9b20f31a3
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/generic/etLogger.c
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * 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){
+ printf("ERROR: %s\n", message);
+}
+
+void etLogger_logWarning(const char* message){
+ printf("WARNING: %s\n", message);
+}
+
+void etLogger_logInfo(const char* message){
+ printf("INFO: %s\n", message);
+}
+
+void etLogger_logErrorF(const char* format, ... ){
+ printf("ERROR: ");
+ va_list arglist;
+ va_start( arglist, format );
+ vprintf( format, arglist );
+ va_end( arglist );
+ printf("\n");
+}
+
+void etLogger_logWarningF(const char* format, ... ){
+ printf("WARNING: ");
+ va_list arglist;
+ va_start( arglist, format );
+ vprintf( format, arglist );
+ va_end( arglist );
+ printf("\n");
+}
+
+void etLogger_logInfoF(const char* format, ... ){
+ printf("INFO: ");
+ va_list arglist;
+ va_start( arglist, format );
+ vprintf( format, arglist );
+ va_end( arglist );
+ printf("\n");
+}
+
+etFileHandle etLogger_fopen(const char* filename, const char* mode){
+ return( fopen(filename, mode) );
+}
+
+int etLogger_fclose(etFileHandle file){
+ return( fclose(file) );
+}
+
+void etLogger_fprintf(etFileHandle file, const char* format, ... ){
+ va_list arglist;
+ va_start( arglist, format );
+ vfprintf(file, format, arglist );
+ va_end( arglist );
+}
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/generic/info.txt b/runtime/org.eclipse.etrice.runtime.c/src/platforms/generic/info.txt
new file mode 100644
index 000000000..bcb721d20
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/generic/info.txt
@@ -0,0 +1,2 @@
+This generic platform can be used for most 32 or 64 bit systems like windows and linux.
+It uses standard c libraries only and it makes use of the file system.

Back to the top