Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/org.eclipse.etrice.runtime.c/src/common')
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/debugging/etLogger.h48
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/debugging/etMSCLogger.c57
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/debugging/etMSCLogger.h56
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/etUnit/etUnit.c334
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/etUnit/etUnit.h69
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessage.c25
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessage.h26
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageQueue.c99
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageQueue.h45
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageReceiver.h23
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageService.c103
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageService.h50
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/modelbase/etActor.c18
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/modelbase/etActor.h24
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/modelbase/etPort.c41
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/modelbase/etPort.h62
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/platform/etMemory.h29
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/platform/etPlatform.h27
18 files changed, 1136 insertions, 0 deletions
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/debugging/etLogger.h b/runtime/org.eclipse.etrice.runtime.c/src/common/debugging/etLogger.h
new file mode 100644
index 000000000..6c46889a8
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/debugging/etLogger.h
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * 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.h
+ *
+ * Created on: 16.01.2012
+ * Author: tschuetz
+ */
+
+#ifndef _ETLOGGER_H_
+#define _ETLOGGER_H_
+
+#include <stdio.h>
+#include "etDatatypes.h"
+/* logging */
+
+void etLogger_logError(const char* message);
+
+void etLogger_logWarning(const char* message);
+
+void etLogger_logInfo(const char* message);
+
+void etLogger_logErrorF(const char* format, ... );
+
+void etLogger_logWarningF(const char* format, ... );
+
+void etLogger_logInfoF(const char* format, ... );
+
+
+/* File handling */
+
+etFileHandle etLogger_fopen(const char* filename, const char* mode);
+
+int etLogger_fclose(etFileHandle file);
+
+void etLogger_fprintf(etFileHandle file, const char* format, ... );
+
+#endif /* _ETLOGGER_H_ */
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
new file mode 100644
index 000000000..4596292a7
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/debugging/etMSCLogger.c
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * 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)
+ *
+ *******************************************************************************/
+
+#include "debugging/etMSCLogger.h"
+
+#include "debugging/etLogger.h"
+
+static etFileHandle etMSCLogger_fileHandle = NULL;
+static char* etMSCLogger_objectName = "";
+
+#define ET_MAX_FILENAME_LEN 256
+
+void etMSCLogger_open(char* logPath, char* mscName){
+ char path[ET_MAX_FILENAME_LEN];
+ sprintf(path, "%s/%s.seq", logPath, mscName);
+ etMSCLogger_fileHandle = etLogger_fopen(path, "w+");
+}
+
+void etMSCLogger_close(void){
+ if (etMSCLogger_fileHandle != NULL){
+ etLogger_fclose(etMSCLogger_fileHandle);
+ }
+
+}
+
+void etMSCLogger_setObjectName(char* objectName){
+ etMSCLogger_objectName = objectName;
+}
+
+char* etMSCLogger_getObjectName(void){
+ return etMSCLogger_objectName;
+}
+
+void etMSCLogger_syncCall(char* sourceName, char* messageName, char* targetName){
+ etLogger_fprintf(etMSCLogger_fileHandle, "%s ==> %s %s\n", sourceName, targetName, messageName);
+}
+
+void etMSCLogger_syncReturn(char* sourceName, char* targetName){
+ etLogger_fprintf(etMSCLogger_fileHandle, "%s <== %s\n", sourceName, targetName);
+}
+
+void etMSCLogger_asyncOut(char* sourceName, char* messageName, char* targetName){
+ etLogger_fprintf(etMSCLogger_fileHandle, "%s >-- %s %s\n", sourceName, targetName, messageName);
+}
+
+void etMSCLogger_asyncIn(char* sourceName, char* messageName, char* targetName){
+ etLogger_fprintf(etMSCLogger_fileHandle, "%s --> %s %s\n", sourceName, targetName, messageName);
+}
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/debugging/etMSCLogger.h b/runtime/org.eclipse.etrice.runtime.c/src/common/debugging/etMSCLogger.h
new file mode 100644
index 000000000..b1720cec5
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/debugging/etMSCLogger.h
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * 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 _ETMSCLOGGER_H_
+#define _ETMSCLOGGER_H_
+
+#include "etGlobalFlags.h"
+
+void etMSCLogger_open(char* logPath, char* mscName);
+void etMSCLogger_close(void);
+
+void etMSCLogger_setObjectName(char* objectName);
+char* etMSCLogger_getObjectName(void);
+
+void etMSCLogger_syncCall(char* sourceName, char* messageName, char* targetName);
+void etMSCLogger_syncReturn(char* sourceName, char* targetName);
+
+void etMSCLogger_asyncOut(char* sourceName, char* messageName, char* targetName);
+void etMSCLogger_asyncIn(char* sourceName, char* messageName, char* targetName);
+
+#ifdef ET_MSC_LOGGER_ACTIVATE
+ #define ET_MSC_LOGGER_OPEN(object) \
+ etMSCLogger_open("tmp", "msc"); \
+ etMSCLogger_setObjectName(object);
+
+ #define ET_MSC_LOGGER_CLOSE etMSCLogger_close();
+
+ #define ET_MSC_LOGGER_SYNC_ENTRY(object, message) \
+ char* sourceName = etMSCLogger_getObjectName(); \
+ char* targetName = object; \
+ etMSCLogger_syncCall(sourceName, message, targetName); \
+ etMSCLogger_setObjectName(targetName);
+
+ #define ET_MSC_LOGGER_SYNC_EXIT \
+ etMSCLogger_syncReturn(sourceName, targetName); \
+ etMSCLogger_setObjectName(sourceName);
+
+#else
+ #define ET_MSC_LOGGER_OPEN
+ #define ET_MSC_LOGGER_CLOSE
+
+ #define ET_MSC_LOGGER_SYNC_ENTRY(object, message)
+ #define ET_MSC_LOGGER_SYNC_EXIT
+#endif
+
+
+#endif /* _ETMSCLOGGER_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/etUnit/etUnit.c b/runtime/org.eclipse.etrice.runtime.c/src/common/etUnit/etUnit.c
new file mode 100644
index 000000000..4facacbcd
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/etUnit/etUnit.c
@@ -0,0 +1,334 @@
+/*******************************************************************************
+ * 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)
+ *
+ *******************************************************************************/
+
+#include "etUnit/etUnit.h"
+#include <string.h>
+#include <time.h>
+#include "debugging/etLogger.h"
+
+
+/*** member variables */
+
+/* file handling */
+static FILE* etUnit_reportfile = NULL;
+
+/* names */
+static char* etUnit_TestFileName = NULL;
+static char* etUnit_TestResultPath = NULL;
+
+static char* etUnit_TestSuiteName = NULL;
+static char* etUnit_TestCaseName = NULL;
+
+/* counters */
+static etInt32 etUnit_passCount = 0;
+static etInt32 etUnit_failCount = 0;
+static etInt32 etUnit_passCountTotal = 0;
+static etInt32 etUnit_failCountTotal = 0;
+
+static etBool etUnit_testcaseSuccess = TRUE;
+
+#define ETUNIT_FAILURE_TEXT_LEN 256
+
+static char etUnit_failureText[ETUNIT_FAILURE_TEXT_LEN];
+
+/* time measuring */
+static clock_t etUnit_startTime = 0;
+static clock_t etUnit_currentTime = 0;
+
+/* forward declarations of private functions */
+void expect_equal_int(const char* message, etInt32 expected, etInt32 actual);
+void expect_equal_uint(const char* message, etUInt32 expected, etUInt32 actual);
+void expect_equal_float(const char* message, etFloat32 expected, etFloat32 actual, etFloat32 precision);
+void etUnit_writeTestLog(const char *testcase, etBool result, const char *resulttext);
+void etUnit_handleExpect(etBool result, const char *resulttext);
+
+/* public functions */
+
+void etUnit_open(char* testResultPath, char* testFileName) {
+ etUnit_passCount = 0;
+ etUnit_failCount = 0;
+ strcpy(etUnit_failureText,"");
+
+ etUnit_TestFileName = testFileName;
+ etUnit_TestResultPath = testResultPath;
+
+ etLogger_logInfoF("************* TEST START (%s) **************", etUnit_TestFileName);
+
+ char filename[ETUNIT_FAILURE_TEXT_LEN];
+ sprintf(filename, "%s/%s.xml", etUnit_TestResultPath, etUnit_TestFileName);
+
+ if (etUnit_reportfile == NULL) {
+ etUnit_reportfile = etLogger_fopen(filename, "w+");
+ if (etUnit_reportfile != NULL) {
+ etLogger_fprintf(etUnit_reportfile, "<testsuites name=\"%s\" tests=\"0\" failures=\"0\" errors=\"0\" time=\"0\">\n", etUnit_TestFileName);
+ } else {
+ etLogger_logErrorF("Unable to open file %s/%s.xml", etUnit_TestResultPath, etUnit_TestFileName);
+ }
+ }
+ /* prepare time measurement */
+ etUnit_startTime = clock();
+ etUnit_currentTime = clock();
+ etLogger_logInfoF("Start Time: %ld", etUnit_startTime);
+
+}
+
+void etUnit_close(void) {
+ etLogger_logInfoF("");
+ if (etUnit_failCount > 0) {
+ etLogger_logInfoF("************* TEST FAILED *************");
+ } else {
+ etLogger_logInfoF("************* TEST PASSED *************");
+ }
+ etLogger_logInfoF("Number of Tests: %ld", etUnit_failCount + etUnit_passCount);
+ etLogger_logInfoF("Failed: %ld", etUnit_failCount);
+ etLogger_logInfoF("Passed: %ld", etUnit_passCount);
+ etLogger_logInfoF("Time: %ld", clock() - etUnit_startTime);
+ etLogger_logInfoF("End Time: %ld[ms]", (clock() / 1000) * CLOCKS_PER_SEC );
+ etLogger_logInfoF("***************************************");
+ if (etUnit_failCountTotal > 0) {
+ etLogger_logInfoF(" ******* %d TEST(S) FAILED *****", etUnit_failCountTotal);
+ } else {
+ etLogger_logInfoF(" ******* ALL TESTS PASSED ******");
+ }
+ etLogger_logInfoF("***************************************");
+
+ if (etUnit_reportfile != NULL) {
+ etLogger_fprintf(etUnit_reportfile, "</testsuites>\n");
+ etLogger_fclose(etUnit_reportfile);
+ etUnit_reportfile = NULL;
+ }
+}
+
+void etUnit_openTestSuite(char* testSuiteName) {
+ etUnit_TestSuiteName = testSuiteName;
+ if (etUnit_reportfile != NULL) {
+ etLogger_fprintf(etUnit_reportfile, "\t<testsuite name=\"%s\" tests=\"0\" failures=\"0\" errors=\"0\" time=\"0\">\n",
+ etUnit_TestSuiteName);
+ }
+}
+
+void etUnit_closeTestSuite(void) {
+ if (etUnit_reportfile != NULL) {
+ etLogger_fprintf(etUnit_reportfile, "\t</testsuite>\n");
+ }
+}
+
+void etUnit_openTestCase(char* testCaseName) {
+ etUnit_TestCaseName = testCaseName;
+ etUnit_testcaseSuccess = TRUE;
+ strcpy(etUnit_failureText,"");
+}
+
+void etUnit_closeTestCase(void) {
+ if (etUnit_reportfile != NULL && etUnit_TestSuiteName != NULL) {
+ etUnit_writeTestLog(etUnit_TestCaseName, etUnit_testcaseSuccess, etUnit_failureText);
+ }
+}
+
+void etUnit_openAll(char* testResultPath, char* testFileName, char* testSuiteName, char* testCaseName){
+ etUnit_open(testResultPath, testFileName);
+ etUnit_openTestSuite(testSuiteName);
+ etUnit_openTestCase(testCaseName);
+}
+
+void etUnit_closeAll(void){
+ etUnit_closeTestCase();
+ etUnit_closeTestSuite();
+ etUnit_close();
+}
+
+void EXPECT_TRUE(const char* message, etBool condition) {
+ if (condition == FALSE) {
+ char testresult[ETUNIT_FAILURE_TEXT_LEN];
+ sprintf(testresult, "%s: *** EXPECT_TRUE == FALSE", message);
+ etUnit_handleExpect(FALSE, testresult);
+ } else {
+ etUnit_handleExpect(TRUE, "");
+ }
+}
+
+void EXPECT_FALSE(const char* message, etBool condition) {
+ if (condition == TRUE) {
+ char testresult[ETUNIT_FAILURE_TEXT_LEN];
+ sprintf(testresult, "%s: EXPECT_FALSE == TRUE", message);
+ etUnit_handleExpect(FALSE, testresult);
+ } else {
+ etUnit_handleExpect(TRUE, "");
+ }
+}
+
+void EXPECT_EQUAL_INT8(const char* message, etInt8 expected, etInt8 actual) {
+ expect_equal_int(message, (etInt32) expected, (etInt32) actual);
+}
+
+void EXPECT_EQUAL_INT16(const char* message, etInt16 expected, etInt16 actual) {
+ expect_equal_int(message, (etInt32) expected, (etInt32) actual);
+}
+
+void EXPECT_EQUAL_INT32(const char* message, etInt32 expected, etInt32 actual) {
+ expect_equal_int(message, (etInt32) expected, (etInt32) actual);
+}
+
+void EXPECT_EQUAL_UINT8(const char* message, etUInt8 expected, etUInt8 actual) {
+ expect_equal_uint(message, (etUInt32) expected, (etUInt32) actual);
+}
+
+void EXPECT_EQUAL_UINT16(const char* message, etUInt16 expected, etUInt16 actual) {
+ expect_equal_uint(message, (etUInt32) expected, (etUInt32) actual);
+}
+
+void EXPECT_EQUAL_UINT32(const char* message, etUInt32 expected, etUInt32 actual) {
+ expect_equal_uint(message, (etUInt32) expected, (etUInt32) actual);
+}
+
+
+void EXPECT_EQUAL_FLOAT32(const char* message, etFloat32 expected, etFloat32 actual, etFloat32 precision) {
+ expect_equal_float(message, expected, actual, precision);
+}
+
+/* order */
+static etInt16 etUnit_orderCurrentIndex = 0;
+static etInt16 etUnit_orderSize = 0;
+static etInt16* etUnit_orderList = NULL;
+
+void EXPECT_ORDER_START(etInt16* list, etInt16 size){
+ etUnit_orderCurrentIndex = 0;
+ etUnit_orderSize = size;
+ etUnit_orderList = list;
+}
+
+void EXPECT_ORDER(const char* message, etInt16 identifier){
+ if (etUnit_orderCurrentIndex < etUnit_orderSize) {
+ if (etUnit_orderList[etUnit_orderCurrentIndex] != identifier){
+ char testresult[ETUNIT_FAILURE_TEXT_LEN];
+ sprintf(testresult, "EXPECT_ORDER %s: index=%d, expected=%d, actual=%d", message, etUnit_orderCurrentIndex, identifier, etUnit_orderList[etUnit_orderCurrentIndex]);
+ etUnit_handleExpect(FALSE, testresult);
+ }
+ else {
+ etUnit_handleExpect(TRUE, "");
+ etUnit_orderCurrentIndex++;
+ }
+ }
+ else {
+ char testresult[ETUNIT_FAILURE_TEXT_LEN];
+ sprintf(testresult, "EXPECT_ORDER: index(%d) is too big in %s", etUnit_orderCurrentIndex, message);
+ etUnit_handleExpect(FALSE, testresult);
+ etLogger_logInfoF("EXPECT_ORDER: index too big in %s", message);
+ }
+}
+
+void EXPECT_ORDER_END(const char* message, etInt16 identifier){
+ EXPECT_ORDER(message, identifier);
+ if (etUnit_orderCurrentIndex != etUnit_orderSize){
+ char testresult[ETUNIT_FAILURE_TEXT_LEN];
+ sprintf(testresult, "EXPECT_ORDER_END %s: wrong index at the end: expected=%d, actual=%d", message, etUnit_orderSize, etUnit_orderCurrentIndex);
+ etUnit_handleExpect(FALSE, testresult);
+ }
+}
+
+/* private functions */
+
+void expect_equal_int(const char* message, etInt32 expected, etInt32 actual) {
+ if (expected != actual) {
+ char testresult[ETUNIT_FAILURE_TEXT_LEN];
+ sprintf(testresult, "%s: expected=%ld, actual=%ld", message, expected, actual);
+ etUnit_handleExpect(FALSE, testresult);
+ } else {
+ etUnit_handleExpect(TRUE, "");
+ }
+}
+
+void expect_equal_uint(const char* message, etUInt32 expected, etUInt32 actual) {
+ if (expected != actual) {
+ char testresult[ETUNIT_FAILURE_TEXT_LEN];
+ sprintf(testresult, "%s: expected=%lu, actual=%lu", message, expected, actual);
+ etUnit_handleExpect(FALSE, testresult);
+ } else {
+ etUnit_handleExpect(TRUE, "");
+ }
+}
+
+
+void expect_equal_float(const char* message, etFloat32 expected, etFloat32 actual, etFloat32 precision) {
+ if (expected - actual < -precision || expected - actual > precision) {
+ char testresult[ETUNIT_FAILURE_TEXT_LEN];
+ sprintf(testresult, "%s: expected=%f, actual=%f", message, expected, actual);
+ etUnit_handleExpect(FALSE, testresult);
+ } else {
+ etUnit_handleExpect(TRUE, "");
+ }
+}
+
+void expect_equal_void_ptr(const char* message, const void* expected, const void* actual) {
+ if (expected != actual) {
+ char testresult[ETUNIT_FAILURE_TEXT_LEN];
+ sprintf(testresult, "%s: expected=%ld, actual=%ld", message, (etUInt32) expected, (etUInt32) actual);
+ etUnit_handleExpect(FALSE, testresult);
+ } else {
+ etUnit_handleExpect(TRUE, "");
+ }
+}
+
+
+//_________
+
+void etUnit_handleExpect(etBool result, const char *resulttext){
+ if (result == TRUE) {
+ /* nothing to do because no failure */
+ }
+ else {
+ if (etUnit_testcaseSuccess == TRUE){
+ /* first failure will be remembered */
+ etUnit_testcaseSuccess = FALSE;
+ strcpy(etUnit_failureText, resulttext);
+ }
+ else{
+ /* more than one error will be ignored */
+ }
+ }
+}
+
+void etUnit_buildTestLogXML(char* xml, const char *testcase, etBool result, const char *resulttext, clock_t time) {
+ if (result == TRUE) {
+ sprintf(xml, "\t\t<testcase name=\"%s\" time=\"%ld\"/>\n", testcase, time);
+ } else {
+ sprintf(
+ xml,
+ "\t\t<testcase name=\"%s\" classname=\"none\" time=\"%ld\">\n\t\t\t<failure>%s</failure>\n\t\t</testcase>\n",
+ testcase, time, resulttext);
+ }
+}
+
+void etUnit_writeTestLog(const char *testcase, etBool result, const char *resulttext) {
+ char writeBuffer[ETUNIT_FAILURE_TEXT_LEN];
+
+ // counting
+ if (result == TRUE) {
+ etUnit_passCount++;
+ etUnit_passCountTotal++;
+ etLogger_logInfoF("PASS: %s %s", testcase, resulttext);
+ } else {
+ etUnit_failCount++;
+ etUnit_failCountTotal++;
+ etLogger_logInfoF("FAIL: %s : %s", testcase, resulttext);
+ }
+
+ clock_t time = clock() - etUnit_currentTime;
+ etUnit_currentTime = clock();
+
+ // writing to file
+ if (etUnit_reportfile != NULL) {
+ etUnit_buildTestLogXML(writeBuffer, testcase, result, resulttext, time);
+ etLogger_fprintf(etUnit_reportfile, writeBuffer);
+ }
+}
+
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/etUnit/etUnit.h b/runtime/org.eclipse.etrice.runtime.c/src/common/etUnit/etUnit.h
new file mode 100644
index 000000000..5daa4aa95
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/etUnit/etUnit.h
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * 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 _ETUNIT_H_
+#define _ETUNIT_H_
+
+#include "etDatatypes.h"
+
+
+/* open / close */
+void etUnit_open(char* testResultPath, char* testFileName);
+void etUnit_close(void);
+void etUnit_openTestSuite(char* testSuiteName);
+void etUnit_closeTestSuite(void);
+void etUnit_openTestCase(char* testCaseName);
+void etUnit_closeTestCase(void);
+
+/* functions for more convenience for model and generator tests */
+
+void etUnit_openAll(char* testResultPath, char* testFileName, char* testSuiteName, char* testCaseName);
+void etUnit_closeAll(void);
+
+/* boolean values */
+void EXPECT_TRUE(const char* testcase, etBool condition);
+void EXPECT_FALSE(const char* testcase, etBool condition);
+
+/* signed integer values */
+void EXPECT_EQUAL_INT8(const char* testcase, etInt8 expected, etInt8 actual);
+void EXPECT_EQUAL_INT16(const char* testcase, etInt16 expected, etInt16 actual);
+void EXPECT_EQUAL_INT32(const char* testcase, etInt32 expected, etInt32 actual);
+
+/* unsigned integer values */
+void EXPECT_EQUAL_UINT8(const char* testcase, etUInt8 expected, etUInt8 actual);
+void EXPECT_EQUAL_UINT16(const char* testcase, etUInt16 expected, etUInt16 actual);
+void EXPECT_EQUAL_UINT32(const char* testcase, etUInt32 expected, etUInt32 actual);
+
+/* float values */
+void EXPECT_EQUAL_FLOAT32(const char* testcase, etFloat32 expected, etFloat32 actual, etFloat32 precision);
+
+/* Pointers */
+#define EXPECT_EQUAL_PTR(testcase, expected, actual) \
+ expect_equal_void_ptr(testcase, (const void*) expected, (const void*) actual);
+
+void expect_equal_void_ptr(const char* testcase, const void* expected, const void* actual);
+
+/* more specialized functions */
+void EXPECT_ORDER_START(etInt16* list, etInt16 size);
+void EXPECT_ORDER(const char* message, etInt16 identifier);
+void EXPECT_ORDER_END(const char* message, etInt16 identifier);
+
+
+/* Helpers for adding testcases */
+
+#define ADD_TESTCASE(testcase) \
+ etUnit_openTestCase(#testcase); \
+ testcase(); \
+ etUnit_closeTestCase();
+
+
+#endif /* _ETUNIT_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessage.c b/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessage.c
new file mode 100644
index 000000000..49772f7b6
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessage.c
@@ -0,0 +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:
+ * Thomas Schuetz (initial contribution)
+ *
+ *******************************************************************************/
+
+#include "messaging/etMessage.h"
+
+#include "debugging/etMSCLogger.h"
+
+#include <stddef.h>
+
+void etMessage_init(etMessage* self){
+ ET_MSC_LOGGER_SYNC_ENTRY("etMessage", "init")
+ self->next = NULL;
+ self->address = 0;
+ self->evtID = 0;
+ ET_MSC_LOGGER_SYNC_EXIT
+}
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessage.h b/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessage.h
new file mode 100644
index 000000000..698a89c09
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessage.h
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * 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 _ETMESSAGE_H_
+#define _ETMESSAGE_H_
+
+#include "etDatatypes.h"
+
+typedef struct etMessage{
+ struct etMessage* next;
+ etInt16 address;
+ etInt16 evtID;
+} etMessage;
+
+void etMessage_init(etMessage* self);
+
+#endif /* _ETMESSAGE_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageQueue.c b/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageQueue.c
new file mode 100644
index 000000000..b1a5fea54
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageQueue.c
@@ -0,0 +1,99 @@
+/*******************************************************************************
+ * 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)
+ *
+ *******************************************************************************/
+
+#include "messaging/etMessageQueue.h"
+
+#include "debugging/etMSCLogger.h"
+
+void etMessageQueue_init(etMessageQueue* self){
+ ET_MSC_LOGGER_SYNC_ENTRY("etMessageQueue", "init")
+ self->first = NULL;
+ self->last = NULL;
+ self->highWaterMark = 0;
+ self->size = 0;
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+
+
+void etMessageQueue_push(etMessageQueue* self, etMessage* msg){
+ // TODO: optimize queue for concurrent push / pop
+ ET_MSC_LOGGER_SYNC_ENTRY("etMessageQueue", "push")
+ if (self->first == NULL) {
+ /*no message in queue*/
+ self->first = self->last = msg;
+ }
+ else {
+ /*at least one message in queue*/
+ self->last->next = msg;
+ self->last = msg;
+ }
+ msg->next = NULL; /*TODO: optimization: this line could be removed if we assume that all messages are initialized*/
+
+ if (++self->size > self->highWaterMark)
+ self->highWaterMark++;
+
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+
+etMessage* etMessageQueue_pop(etMessageQueue* self){
+ ET_MSC_LOGGER_SYNC_ENTRY("etMessageQueue", "pop")
+ etMessage* pop_msg = self->first;
+ if(self->first == NULL){
+ /*no message in queue*/
+ ET_MSC_LOGGER_SYNC_EXIT
+ return NULL;
+ }
+ if (self->first->next==NULL){
+ /*only one message in queue*/
+ self->first = self->last = NULL;
+ }
+ else {
+ /*more than one message in queue -> set first to nex message*/
+ self->first = self->first->next;
+ }
+
+ pop_msg->next=NULL;
+ self->size--;
+
+ ET_MSC_LOGGER_SYNC_EXIT
+ return pop_msg;
+}
+
+etInt16 etMessageQueue_getSize(etMessageQueue* self) {
+ ET_MSC_LOGGER_SYNC_ENTRY("etMessageQueue", "getSize")
+ ET_MSC_LOGGER_SYNC_EXIT
+ return self->size;
+}
+
+etMessage* etMessageQueue_getFirst(etMessageQueue* self){
+ ET_MSC_LOGGER_SYNC_ENTRY("etMessageQueue", "getFirst")
+ ET_MSC_LOGGER_SYNC_EXIT
+ return self->first;
+}
+
+etMessage* etMessageQueue_getLast(etMessageQueue* self){
+ ET_MSC_LOGGER_SYNC_ENTRY("etMessageQueue", "getLast")
+ ET_MSC_LOGGER_SYNC_EXIT
+ return self->last;
+}
+
+etBool etMessageQueue_isNotEmpty(etMessageQueue* self){
+ ET_MSC_LOGGER_SYNC_ENTRY("etMessageQueue", "isNotEmpty")
+ ET_MSC_LOGGER_SYNC_EXIT
+ return self->last != NULL;
+}
+
+etInt16 etMessageQueue_getHighWaterMark(etMessageQueue* self) {
+ ET_MSC_LOGGER_SYNC_ENTRY("etMessageQueue", "getHightWaterMark")
+ ET_MSC_LOGGER_SYNC_EXIT
+ return self->highWaterMark;
+}
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageQueue.h b/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageQueue.h
new file mode 100644
index 000000000..f305d1aa9
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageQueue.h
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * 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 _ETMESSAGEQUEUE_H_
+#define _ETMESSAGEQUEUE_H_
+
+#include "messaging/etMessage.h"
+#include <stddef.h>
+
+typedef struct etMessageQueue {
+ etMessage* first;
+ etMessage* last;
+ etInt16 highWaterMark;
+ etInt16 size;
+
+} etMessageQueue;
+
+void etMessageQueue_init(etMessageQueue* self);
+
+void etMessageQueue_push(etMessageQueue* self, etMessage* msg);
+
+etMessage* etMessageQueue_pop(etMessageQueue* self);
+
+etMessage* etMessageQueue_getFirst(etMessageQueue* self);
+
+etMessage* etMessageQueue_getLast(etMessageQueue* self);
+
+etBool etMessageQueue_isNotEmpty(etMessageQueue* self);
+
+etInt16 etMessageQueue_getHighWaterMark(etMessageQueue* self);
+
+etInt16 etMessageQueue_getSize(etMessageQueue* self);
+
+
+
+#endif /* _RMESSAGEQUEUE_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageReceiver.h b/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageReceiver.h
new file mode 100644
index 000000000..a1bd92ce2
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageReceiver.h
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * 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 _ETMESSAGERECEIVER_H_
+#define _ETMESSAGERECEIVER_H_
+
+#include "messaging/etMessage.h"
+
+typedef void (*etActorReceiveMessage)(void* self, void* ifitem, const etMessage* msg);
+typedef void (*etDispatcherReceiveMessage)(const etMessage* msg);
+
+#endif /* _ETMESSAGERECEIVER_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageService.c b/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageService.c
new file mode 100644
index 000000000..3755d2107
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageService.c
@@ -0,0 +1,103 @@
+/*******************************************************************************
+ * 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)
+ *
+ *******************************************************************************/
+
+
+#include "etMessageService.h"
+
+
+#include "debugging/etLogger.h"
+#include "debugging/etMSCLogger.h"
+
+void etMessageService_init(etMessageService* self, etUInt8* buffer, etUInt16 maxBlocks, etUInt16 blockSize, etDispatcherReceiveMessage msgDispatcher){
+ ET_MSC_LOGGER_SYNC_ENTRY("etMessageService", "init")
+ self->messageBuffer.buffer = buffer;
+ self->messageBuffer.maxBlocks = maxBlocks;
+ self->messageBuffer.blockSize = blockSize;
+ self->msgDispatcher = msgDispatcher;
+
+ etMessageQueue_init(&self->messagePool);
+ etMessageQueue_init(&self->messageQueue);
+
+ etMessageService_initMessagePool(self);
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+
+/*
+ * initialize message pool with block buffer
+ * all blocks are added to pool
+ */
+void etMessageService_initMessagePool(etMessageService* self){
+ ET_MSC_LOGGER_SYNC_ENTRY("etMessageService", "initMessagePool")
+ etInt16 i;
+
+ for (i=0; i<self->messageBuffer.maxBlocks; i++){
+ etMessage* block = (etMessage*) &self->messageBuffer.buffer[i*self->messageBuffer.blockSize];
+ etMessageQueue_push(&self->messagePool, block);
+ }
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+
+void etMessageService_pushMessage(etMessageService* self, etMessage* msg){
+ ET_MSC_LOGGER_SYNC_ENTRY("etMessageService", "pushMessage")
+ etMessageQueue_push(&self->messageQueue, msg);
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+
+etMessage* etMessageService_popMessage(etMessageService* self){
+ ET_MSC_LOGGER_SYNC_ENTRY("etMessageService", "popMessage")
+ etMessage* msg = etMessageQueue_pop(&self->messageQueue);
+ ET_MSC_LOGGER_SYNC_EXIT
+ return msg;
+}
+
+
+etMessage* etMessageService_getMessageBuffer(etMessageService* self, etUInt16 size){
+ ET_MSC_LOGGER_SYNC_ENTRY("etMessageService", "getMessageBuffer")
+ if (size<=self->messageBuffer.blockSize){
+ if (self->messagePool.size>0){
+ etMessage* msg = etMessageQueue_pop(&self->messagePool);
+ ET_MSC_LOGGER_SYNC_EXIT
+ return msg;
+ }
+ }
+ ET_MSC_LOGGER_SYNC_EXIT
+ return NULL;
+}
+
+void etMessageService_returnMessageBuffer(etMessageService* self, etMessage* buffer){
+ ET_MSC_LOGGER_SYNC_ENTRY("etMessageService", "returnMessageBuffer")
+ etMessageQueue_push(&self->messagePool, buffer);
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+
+void etMessageService_deliverAllMessages(etMessageService* self){
+ ET_MSC_LOGGER_SYNC_ENTRY("etMessageService", "deliverAllMessages")
+ while (etMessageQueue_isNotEmpty(&self->messageQueue)){
+ etMessage* msg = etMessageService_popMessage(self);
+ self->msgDispatcher(msg);
+ etMessageService_returnMessageBuffer(self, msg);
+ }
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+
+void etMessageService_execute(etMessageService* self){
+ ET_MSC_LOGGER_SYNC_ENTRY("etMessageService", "execute")
+ etMessageService_deliverAllMessages(self);
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+
+etInt16 etMessageService_getMessagePoolLowWaterMark(etMessageService* self){
+ ET_MSC_LOGGER_SYNC_ENTRY("etMessageService", "getMessagePoolLowWaterMark")
+ etInt16 lowWaterMark = self->messageBuffer.maxBlocks - etMessageQueue_getHighWaterMark(&self->messageQueue);
+ ET_MSC_LOGGER_SYNC_EXIT
+ return lowWaterMark;
+}
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
new file mode 100644
index 000000000..0303bbf0c
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageService.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)
+ *
+ *******************************************************************************/
+
+#ifndef _ETMESSAGESERVICE_H_
+#define _ETMESSAGESERVICE_H_
+
+#include <stddef.h>
+#include "etDatatypes.h"
+#include "messaging/etMessageQueue.h"
+#include "messaging/etMessageReceiver.h"
+
+typedef struct etBuffer{
+ etUInt8 *buffer;
+ etUInt16 maxBlocks;
+ etUInt16 blockSize;
+} etBuffer;
+
+typedef struct etMessageService {
+ etMessageQueue messageQueue;
+ etMessageQueue messagePool;
+ etBuffer messageBuffer;
+ etDispatcherReceiveMessage msgDispatcher;
+} etMessageService;
+
+void etMessageService_init(etMessageService* self, etUInt8* buffer, etUInt16 maxBlocks, etUInt16 blockSize, etDispatcherReceiveMessage msgDispatcher);
+
+void etMessageService_initMessagePool(etMessageService* self);
+
+void etMessageService_pushMessage(etMessageService* self, etMessage* msg);
+etMessage* etMessageService_popMessage(etMessageService* self);
+
+etMessage* etMessageService_getMessageBuffer(etMessageService* self, etUInt16 size);
+void etMessageService_returnMessageBuffer(etMessageService* self, etMessage* buffer);
+
+void etMessageService_execute(etMessageService* self);
+
+/* functions for debug and service information */
+etInt16 etMessageService_getMessagePoolLowWaterMark(etMessageService* self);
+
+
+#endif /* RMESSAGESERVICE_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/modelbase/etActor.c b/runtime/org.eclipse.etrice.runtime.c/src/common/modelbase/etActor.c
new file mode 100644
index 000000000..12d3808f0
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/modelbase/etActor.c
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * 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:
+ * Henrik Rentz-Reichert (initial contribution)
+ *
+ *******************************************************************************/
+
+#include "modelbase/etActor.h"
+
+boolean handleSystemEvent(InterfaceItemBase ifitem, int evt, void* generic_data) {
+ /* TODO */
+ return FALSE;
+}
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/modelbase/etActor.h b/runtime/org.eclipse.etrice.runtime.c/src/common/modelbase/etActor.h
new file mode 100644
index 000000000..88b6178cd
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/modelbase/etActor.h
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * 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:
+ * Henrik Rentz-Reichert (initial contribution)
+ *
+ *******************************************************************************/
+
+#ifndef _ETACTOR_H_
+#define _ETACTOR_H_
+
+#include "etDatatypes.h"
+#include "modelbase/etPort.h"
+
+#define NOT_CAUGHT 0
+#define EVT_SHIFT 100
+
+boolean handleSystemEvent(InterfaceItemBase ifitem, int evt, void* generic_data);
+
+#endif /* _ETACTOR_H_ */
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
new file mode 100644
index 000000000..90b0f19cb
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/modelbase/etPort.c
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * 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)
+ *
+ *******************************************************************************/
+
+#include "modelbase/etPort.h"
+
+#include "debugging/etMSCLogger.h"
+#include "platform/etMemory.h"
+#include <string.h>
+
+void etPort_receive(const etPort* self, const etMessage* msg) {
+ ET_MSC_LOGGER_SYNC_ENTRY("etPort", "receive")
+ if (self->receiveMessageFunc!=NULL)
+ (self->receiveMessageFunc)(self->myActor, (void*)self, msg);
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+
+
+void etPort_sendMessage(const etPort* self, etInt16 evtId, int size, void* data) {
+ int offset = MEM_CEIL(sizeof(etMessage));
+ int totalSize = offset+size;
+ etMessage* msg = etMessageService_getMessageBuffer(self->msgService, totalSize);
+ if (msg!=NULL) {
+ msg->address = self->peerAddress;
+ msg->evtID = evtId;
+
+ if (size>0 && data!=NULL) {
+ memcpy(((char*)msg)+offset, data, size);
+ }
+
+ etMessageService_pushMessage(self->msgService, msg);
+ }
+}
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/modelbase/etPort.h b/runtime/org.eclipse.etrice.runtime.c/src/common/modelbase/etPort.h
new file mode 100644
index 000000000..49321065a
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/modelbase/etPort.h
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * 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 _ETPORT_H_
+#define _ETPORT_H_
+
+
+#include "messaging/etMessage.h"
+#include "messaging/etMessageReceiver.h"
+#include "messaging/etMessageService.h"
+
+typedef struct {
+ void* myActor;
+ etActorReceiveMessage receiveMessageFunc;
+ etMessageService* msgService;
+ etAddressId peerAddress;
+ etAddressId localId;
+
+ #ifdef etDEBUG
+ etAddressId address;
+ /* thread ID from msg service: msgService->threadId */
+ #endif
+} etPort;
+
+typedef struct {
+ void* myActor;
+ etActorReceiveMessage receiveMessageFunc;
+ etMessageService* msgService;
+ etAddressId peerAddress;
+ etAddressId localId;
+ etAddressId index;
+
+ #ifdef etDEBUG
+ etAddressId address;
+ /* thread ID from msg service: msgService->threadId */
+ #endif
+} etReplSubPort;
+
+typedef struct {
+ etInt16 size;
+ const etReplSubPort* ports;
+} etReplPort;
+
+typedef etPort* InterfaceItemBase;
+
+void etPort_receive(const etPort* self, const etMessage* msg);
+void etPort_sendMessage(const etPort* self, etInt16 evtId, int size, void* data);
+
+
+
+#endif /* _ETPORT_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/platform/etMemory.h b/runtime/org.eclipse.etrice.runtime.c/src/common/platform/etMemory.h
new file mode 100644
index 000000000..997c7053c
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/platform/etMemory.h
@@ -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:
+ * Henrik Rentz-Reichert (initial contribution)
+ *
+ *******************************************************************************/
+
+#ifndef _ETMEMORY_H_
+#define _ETMEMORY_H_
+
+#include "etDatatypes.h"
+#include "etGlobalFlags.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)
+
+/* pool and block size */
+#define MESSAGE_POOL_MAX 50
+#define MESSAGE_BLOCK_SIZE 64
+
+#endif /* _ETMEMORY_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/platform/etPlatform.h b/runtime/org.eclipse.etrice.runtime.c/src/common/platform/etPlatform.h
new file mode 100644
index 000000000..1f3c17ec3
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/platform/etPlatform.h
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * 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)
+ *
+ *******************************************************************************/
+
+/*
+ * etPlatform.h defines a generic interface for platform specific implementations
+ *
+ * */
+
+/*
+ * 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);
+

Back to the top