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/common/modelbase
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/common/modelbase')
-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.c30
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/modelbase/etPort.h62
4 files changed, 134 insertions, 0 deletions
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..dc7e1adcf
--- /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..8f115849f
--- /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..cbdbdaaf7
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/modelbase/etPort.c
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * 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"
+
+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) {
+ etMessage* msg = etMessageService_getMessageBuffer(self->msgService, sizeof(etMessage));
+ msg->address = self->peerAddress;
+ msg->evtID = evtId;
+ 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..3ddecd74d
--- /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);
+
+
+
+#endif /* _ETPORT_H_ */

Back to the top