Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Karlitschek2012-11-07 10:52:52 +0000
committerPeter Karlitschek2012-12-05 09:10:57 +0000
commitbd54150119605649e858c0cb8e4b547a91c3582e (patch)
treeb122a822ea7a3137f122529201ae5ca1ac5ae212
parent3eb18cbda66432fa65ce7d6b82f75ce96c8e86b7 (diff)
downloadorg.eclipse.etrice-bd54150119605649e858c0cb8e4b547a91c3582e.tar.gz
org.eclipse.etrice-bd54150119605649e858c0cb8e4b547a91c3582e.tar.xz
org.eclipse.etrice-bd54150119605649e858c0cb8e4b547a91c3582e.zip
Changes necessary for state machine generation for C++
-rw-r--r--plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/ActorClassGen.xtend3
-rw-r--r--plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/CppExtensions.xtend6
-rw-r--r--plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/ProtocolClassGen.xtend10
-rw-r--r--plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/SubSystemRunnerGen.xtend2
-rw-r--r--plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/CppExtensions.java10
-rw-r--r--plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/ProtocolClassGen.java26
-rw-r--r--runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/service/timing/ATimingService.c5
-rw-r--r--runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/service/timing/ATimingService.h1
-rw-r--r--runtime/org.eclipse.etrice.modellib.cpp/.cproject143
-rw-r--r--runtime/org.eclipse.etrice.modellib.cpp/.gitignore2
-rw-r--r--runtime/org.eclipse.etrice.modellib.cpp/.project33
-rw-r--r--runtime/org.eclipse.etrice.modellib.cpp/.settings/org.eclipse.cdt.managedbuilder.core.prefs9
-rw-r--r--runtime/org.eclipse.etrice.modellib.cpp/cpp_gen_modellib.launch13
-rw-r--r--runtime/org.eclipse.etrice.modellib.cpp/model/Language.room3
-rw-r--r--runtime/org.eclipse.etrice.modellib.cpp/model/TimingService.room301
-rw-r--r--runtime/org.eclipse.etrice.modellib.cpp/model/Types.room21
-rw-r--r--runtime/org.eclipse.etrice.modellib.cpp/model/diagrams/room.basic.service.timing.ATimingService.behavior146
-rw-r--r--runtime/org.eclipse.etrice.modellib.cpp/model/diagrams/room.basic.service.timing.ATimingService.structure35
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/.cproject14
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/Message.h2
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/platform/etTimer.h40
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/config/etRuntimeConfig.h33
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/platforms/generic/etDatatypes.h6
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/platforms/generic/etTimer.c39
24 files changed, 875 insertions, 28 deletions
diff --git a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/ActorClassGen.xtend b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/ActorClassGen.xtend
index e0375c5fb..f24cc83b3 100644
--- a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/ActorClassGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/ActorClassGen.xtend
@@ -108,7 +108,8 @@ class ActorClassGen extends GenericActorClassGenerator {
«ac.name»(etRuntime::IRTObject* parent, std::string name, const std::vector<std::vector<etRuntime::Address> >& port_addr,
const std::vector<std::vector<etRuntime::Address> >& peer_addr);
- «attributeSettersGettersImplementation(ac.attributes, ac.name)»
+««« TODO: check whether attribute setters/getters are necessary at all, if yes own cpp implementation is needed for *,[],& variables
+««« «attributeSettersGettersImplementation(ac.attributes, ac.name)»
//--------------------- port getters
«FOR ep : ac.getEndPorts()»
«ep.portClassName.getterImplementation(ep.name, ac.name)»
diff --git a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/CppExtensions.xtend b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/CppExtensions.xtend
index 947ad0b0d..0da6b4bb0 100644
--- a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/CppExtensions.xtend
+++ b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/CppExtensions.xtend
@@ -88,7 +88,7 @@ class CppExtensions implements ILanguageExtension {
b.toString
}
- override String pointerLiteral() { "" }
+ override String pointerLiteral() { "*" }
override String nullPointer() { "0" }
override String voidPointer() { "void*" }
@@ -179,8 +179,8 @@ class CppExtensions implements ILanguageExtension {
return (dt as PrimitiveType).getDefaultValueLiteral
}
else if (dt instanceof ExternalType) {
- diagnostician.error("cannot initialize external type "+dt.name, dt.eContainer, dt.eContainingFeature)
- return "cannot instantiate external data type "+dt.name
+ diagnostician.warning("initialize external type with default constructor"+dt.name, dt.eContainer, dt.eContainingFeature)
+ return dt.typeName + "()"
}
else {
val dc = dt as DataClass
diff --git a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/ProtocolClassGen.xtend b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/ProtocolClassGen.xtend
index 6697ec6bb..afe525b28 100644
--- a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/ProtocolClassGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/ProtocolClassGen.xtend
@@ -222,19 +222,21 @@ class ProtocolClassGen extends GenericProtocolClassGenerator {
}
«IF pc.handlesReceive(conj)»
- switch (msg.getEvtId()) {
+ switch (msg->getEvtId()) {
«FOR hdlr : pc.getReceiveHandlers(conj)»
- case «hdlr.msg.getCodeName()»:
+ case «pc.name»::«hdlr.msg.getCodeName()»:
{
«FOR command : hdlr.detailCode.commands»
- «command»
+ «command»
«ENDFOR»
}
break;
«ENDFOR»
default:
- «ENDIF» getActor().receiveEvent(*this, msg->getEvtId(), msg->getData());
+ «ENDIF»
+ getActor().receiveEvent(*this, msg->getEvtId(), msg->getData());
«IF pc.handlesReceive(conj)»
+ break;
}
«ENDIF»
}
diff --git a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/SubSystemRunnerGen.xtend b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/SubSystemRunnerGen.xtend
index f6a8a3701..736f6bfea 100644
--- a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/SubSystemRunnerGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/SubSystemRunnerGen.xtend
@@ -89,7 +89,7 @@ class SubSystemRunnerGen {
main_component.start(); // lifecycle start
// application runs until quit
- waitForQuit();
+ waitForQuit(main_component);
// end the lifecycle
main_component.stop(); // lifecycle stop
diff --git a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/CppExtensions.java b/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/CppExtensions.java
index 67c61c9ce..bdc47ebac 100644
--- a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/CppExtensions.java
+++ b/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/CppExtensions.java
@@ -140,7 +140,7 @@ public class CppExtensions implements ILanguageExtension {
}
public String pointerLiteral() {
- return "";
+ return "*";
}
public String nullPointer() {
@@ -236,12 +236,12 @@ public class CppExtensions implements ILanguageExtension {
String _xifexpression_1 = null;
if ((dt instanceof ExternalType)) {
String _name = dt.getName();
- String _plus = ("cannot initialize external type " + _name);
+ String _plus = ("initialize external type with default constructor" + _name);
EObject _eContainer = dt.eContainer();
EStructuralFeature _eContainingFeature = dt.eContainingFeature();
- this.diagnostician.error(_plus, _eContainer, _eContainingFeature);
- String _name_1 = dt.getName();
- return ("cannot instantiate external data type " + _name_1);
+ this.diagnostician.warning(_plus, _eContainer, _eContainingFeature);
+ String _typeName = this._typeHelpers.typeName(dt);
+ return (_typeName + "()");
} else {
String _xblockexpression = null;
{
diff --git a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/ProtocolClassGen.java b/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/ProtocolClassGen.java
index fe300eae2..0cd388367 100644
--- a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/ProtocolClassGen.java
+++ b/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/ProtocolClassGen.java
@@ -607,7 +607,7 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator {
boolean _handlesReceive = this.roomExt.handlesReceive(pc, (conj).booleanValue());
if (_handlesReceive) {
_builder.append("\t\t");
- _builder.append("switch (msg.getEvtId()) {");
+ _builder.append("switch (msg->getEvtId()) {");
_builder.newLine();
{
List<MessageHandler> _receiveHandlers = this.roomExt.getReceiveHandlers(pc, (conj).booleanValue());
@@ -615,6 +615,9 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator {
_builder.append("\t\t");
_builder.append("\t");
_builder.append("case ");
+ String _name_2 = pc.getName();
+ _builder.append(_name_2, " ");
+ _builder.append("::");
Message _msg = hdlr.getMsg();
String _codeName = this.roomExt.getCodeName(_msg);
_builder.append(_codeName, " ");
@@ -622,6 +625,7 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator {
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("\t");
+ _builder.append("\t");
_builder.append("{");
_builder.newLine();
{
@@ -630,17 +634,19 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator {
for(final String command : _commands) {
_builder.append("\t\t");
_builder.append("\t");
- _builder.append("\t");
- _builder.append(command, " ");
+ _builder.append("\t\t");
+ _builder.append(command, " ");
_builder.newLineIfNotEmpty();
}
}
_builder.append("\t\t");
_builder.append("\t");
+ _builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("\t\t");
_builder.append("\t");
+ _builder.append("\t");
_builder.append("break;");
_builder.newLine();
}
@@ -649,15 +655,19 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator {
_builder.append("\t");
_builder.append("default:");
_builder.newLine();
- _builder.append("\t\t");
}
}
- _builder.append("\tgetActor().receiveEvent(*this, msg->getEvtId(),\tmsg->getData());");
- _builder.newLineIfNotEmpty();
+ _builder.append("\t\t\t\t");
+ _builder.append("getActor().receiveEvent(*this, msg->getEvtId(),\tmsg->getData());");
+ _builder.newLine();
{
boolean _handlesReceive_1 = this.roomExt.handlesReceive(pc, (conj).booleanValue());
if (_handlesReceive_1) {
_builder.append("\t\t");
+ _builder.append("\t\t");
+ _builder.append("break;");
+ _builder.newLine();
+ _builder.append("\t\t");
_builder.append("}");
_builder.newLine();
}
@@ -684,8 +694,8 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator {
{
List<Message> _outgoing = this.roomExt.getOutgoing(pc, (conj).booleanValue());
for(final Message m : _outgoing) {
- String _name_2 = pc.getName();
- CharSequence _sendMessage = this.sendMessage(m, _name_2, portClassName, (conj).booleanValue());
+ String _name_3 = pc.getName();
+ CharSequence _sendMessage = this.sendMessage(m, _name_3, portClassName, (conj).booleanValue());
_builder.append(_sendMessage, "");
_builder.newLineIfNotEmpty();
}
diff --git a/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/service/timing/ATimingService.c b/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/service/timing/ATimingService.c
index b401b16e5..421fed88d 100644
--- a/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/service/timing/ATimingService.c
+++ b/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/service/timing/ATimingService.c
@@ -24,7 +24,6 @@ enum interface_items {
IFITEM_timer = 1
};
-
/* state IDs */
enum state_ids {
NO_STATE = 0,
@@ -214,7 +213,7 @@ static void receiveEvent(ATimingService* self, InterfaceItemBase ifitem, int evt
boolean skip_entry = FALSE;
if (!handleSystemEvent(ifitem, evt, generic_data)) {
- switch (self->state) {
+ switch (getState()) {
case STATE_Operational:
switch(trigger) {
case POLLING:
@@ -243,7 +242,7 @@ static void receiveEvent(ATimingService* self, InterfaceItemBase ifitem, int evt
}
}
if (chain != NOT_CAUGHT) {
- exitTo(self, self->state, catching_state, is_handler);
+ exitTo(getState(), catching_state, is_handler);
int next = executeTransitionChain(self, chain, ifitem, generic_data);
next = enterHistory(self, next, is_handler, skip_entry);
setState(self, next);
diff --git a/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/service/timing/ATimingService.h b/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/service/timing/ATimingService.h
index 60822f469..339c69740 100644
--- a/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/service/timing/ATimingService.h
+++ b/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/service/timing/ATimingService.h
@@ -57,7 +57,6 @@ struct ATimingService {
etTimerControlBlock tcbs[10];
etTimerControlBlock* usedTcbsRoot;
etTimerControlBlock* freeTcbsRoot;
-
/* state machine variables */
diff --git a/runtime/org.eclipse.etrice.modellib.cpp/.cproject b/runtime/org.eclipse.etrice.modellib.cpp/.cproject
new file mode 100644
index 000000000..023c99859
--- /dev/null
+++ b/runtime/org.eclipse.etrice.modellib.cpp/.cproject
@@ -0,0 +1,143 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?>
+
+<cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+ <storageModule moduleId="org.eclipse.cdt.core.settings">
+ <cconfiguration id="cdt.managedbuild.config.gnu.mingw.lib.debug.44153035">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.mingw.lib.debug.44153035" moduleId="org.eclipse.cdt.core.settings" name="Debug">
+ <externalSettings>
+ <externalSetting>
+ <entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/org.eclipse.etrice.modellib.cpp"/>
+ <entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/org.eclipse.etrice.modellib.cpp/Debug"/>
+ <entry flags="RESOLVED" kind="libraryFile" name="org.eclipse.etrice.modellib.cpp" srcPrefixMapping="" srcRootPath=""/>
+ </externalSetting>
+ </externalSettings>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="a" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.staticLib" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.staticLib" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.mingw.lib.debug.44153035" name="Debug" parent="cdt.managedbuild.config.gnu.mingw.lib.debug">
+ <folderInfo id="cdt.managedbuild.config.gnu.mingw.lib.debug.44153035." name="/" resourcePath="">
+ <toolChain id="cdt.managedbuild.toolchain.gnu.mingw.lib.debug.528335783" name="MinGW GCC" superClass="cdt.managedbuild.toolchain.gnu.mingw.lib.debug">
+ <targetPlatform id="cdt.managedbuild.target.gnu.platform.mingw.lib.debug.1299569783" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.mingw.lib.debug"/>
+ <builder buildPath="${workspace_loc:/org.eclipse.etrice.modellib.cpp/Debug}" id="cdt.managedbuild.tool.gnu.builder.mingw.base.2013445161" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="CDT Internal Builder" superClass="cdt.managedbuild.tool.gnu.builder.mingw.base"/>
+ <tool id="cdt.managedbuild.tool.gnu.assembler.mingw.lib.debug.724387525" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.mingw.lib.debug">
+ <option id="gnu.both.asm.option.include.paths.1757143474" name="Include paths (-I)" superClass="gnu.both.asm.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value="&quot;${workspace_loc:/org.eclipse.etrice.runtime.cpp/src}&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${workspace_loc:/org.eclipse.etrice.modellib.cpp/src-gen}&quot;"/>
+ <listOptionValue builtIn="false" value="/org.eclipse.etrice.runtime.cpp/src/platform/generic"/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1284881452" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ </tool>
+ <tool id="cdt.managedbuild.tool.gnu.archiver.mingw.lib.debug.1766943569" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.mingw.lib.debug"/>
+ <tool id="cdt.managedbuild.tool.gnu.cpp.compiler.mingw.lib.debug.118960948" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.mingw.lib.debug">
+ <option id="gnu.cpp.compiler.mingw.lib.debug.option.optimization.level.1721757225" name="Optimization Level" superClass="gnu.cpp.compiler.mingw.lib.debug.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
+ <option id="gnu.cpp.compiler.mingw.lib.debug.option.debugging.level.1204207148" name="Debug Level" superClass="gnu.cpp.compiler.mingw.lib.debug.option.debugging.level" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
+ <option id="gnu.cpp.compiler.option.include.paths.1001723439" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value="&quot;${workspace_loc:/org.eclipse.etrice.runtime.cpp/src}&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${workspace_loc:/org.eclipse.etrice.modellib.cpp/src-gen}&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${workspace_loc:/org.eclipse.etrice.runtime.cpp/src/platforms/generic}&quot;"/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.402201359" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
+ </tool>
+ <tool id="cdt.managedbuild.tool.gnu.c.compiler.mingw.lib.debug.485632379" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.mingw.lib.debug">
+ <option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.mingw.lib.debug.option.optimization.level.386071444" name="Optimization Level" superClass="gnu.c.compiler.mingw.lib.debug.option.optimization.level" valueType="enumerated"/>
+ <option id="gnu.c.compiler.mingw.lib.debug.option.debugging.level.2121576926" name="Debug Level" superClass="gnu.c.compiler.mingw.lib.debug.option.debugging.level" value="gnu.c.debugging.level.max" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.1424766451" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value="&quot;${workspace_loc:/org.eclipse.etrice.runtime.cpp/src}&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${workspace_loc:/org.eclipse.etrice.modellib.cpp/src-gen}&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${workspace_loc:/org.eclipse.etrice.runtime.cpp/src/platforms/generic}&quot;"/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.2050037191" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
+ </tool>
+ <tool id="cdt.managedbuild.tool.gnu.c.linker.mingw.base.1525761784" name="MinGW C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.mingw.base"/>
+ <tool id="cdt.managedbuild.tool.gnu.cpp.linker.mingw.base.386321355" name="MinGW C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.mingw.base"/>
+ </toolChain>
+ </folderInfo>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ <cconfiguration id="cdt.managedbuild.config.gnu.mingw.lib.release.369390927">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.mingw.lib.release.369390927" moduleId="org.eclipse.cdt.core.settings" name="Release">
+ <externalSettings>
+ <externalSetting>
+ <entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/org.eclipse.etrice.modellib.cpp"/>
+ <entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/org.eclipse.etrice.modellib.cpp/Release"/>
+ <entry flags="RESOLVED" kind="libraryFile" name="org.eclipse.etrice.modellib.cpp" srcPrefixMapping="" srcRootPath=""/>
+ </externalSetting>
+ </externalSettings>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="a" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.staticLib" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.staticLib" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.mingw.lib.release.369390927" name="Release" parent="cdt.managedbuild.config.gnu.mingw.lib.release">
+ <folderInfo id="cdt.managedbuild.config.gnu.mingw.lib.release.369390927." name="/" resourcePath="">
+ <toolChain id="cdt.managedbuild.toolchain.gnu.mingw.lib.release.863050384" name="MinGW GCC" superClass="cdt.managedbuild.toolchain.gnu.mingw.lib.release">
+ <targetPlatform id="cdt.managedbuild.target.gnu.platform.mingw.lib.release.1531613870" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.mingw.lib.release"/>
+ <builder buildPath="${workspace_loc:/org.eclipse.etrice.modellib.cpp/Release}" id="cdt.managedbuild.tool.gnu.builder.mingw.base.658172533" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="CDT Internal Builder" superClass="cdt.managedbuild.tool.gnu.builder.mingw.base"/>
+ <tool id="cdt.managedbuild.tool.gnu.assembler.mingw.lib.release.1090371584" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.mingw.lib.release">
+ <option id="gnu.both.asm.option.include.paths.2079893992" name="Include paths (-I)" superClass="gnu.both.asm.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value="&quot;${workspace_loc:/org.eclipse.etrice.runtime.cpp/src}&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${workspace_loc:/org.eclipse.etrice.modellib.cpp/src-gen}&quot;"/>
+ <listOptionValue builtIn="false" value="/org.eclipse.etrice.runtime.cpp/src/platform/generic"/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1692202427" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ </tool>
+ <tool id="cdt.managedbuild.tool.gnu.archiver.mingw.lib.release.859095155" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.mingw.lib.release"/>
+ <tool id="cdt.managedbuild.tool.gnu.cpp.compiler.mingw.lib.release.756312591" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.mingw.lib.release">
+ <option id="gnu.cpp.compiler.mingw.lib.release.option.optimization.level.2147476314" name="Optimization Level" superClass="gnu.cpp.compiler.mingw.lib.release.option.optimization.level" value="gnu.cpp.compiler.optimization.level.most" valueType="enumerated"/>
+ <option id="gnu.cpp.compiler.mingw.lib.release.option.debugging.level.1387780898" name="Debug Level" superClass="gnu.cpp.compiler.mingw.lib.release.option.debugging.level" value="gnu.cpp.compiler.debugging.level.none" valueType="enumerated"/>
+ <option id="gnu.cpp.compiler.option.include.paths.528505037" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value="&quot;${workspace_loc:/org.eclipse.etrice.runtime.cpp/src}&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${workspace_loc:/org.eclipse.etrice.modellib.cpp/src-gen}&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${workspace_loc:/org.eclipse.etrice.runtime.cpp/src/platforms/generic}&quot;"/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1763050360" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
+ </tool>
+ <tool id="cdt.managedbuild.tool.gnu.c.compiler.mingw.lib.release.129970568" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.mingw.lib.release">
+ <option defaultValue="gnu.c.optimization.level.most" id="gnu.c.compiler.mingw.lib.release.option.optimization.level.1329568783" name="Optimization Level" superClass="gnu.c.compiler.mingw.lib.release.option.optimization.level" valueType="enumerated"/>
+ <option id="gnu.c.compiler.mingw.lib.release.option.debugging.level.1807223219" name="Debug Level" superClass="gnu.c.compiler.mingw.lib.release.option.debugging.level" value="gnu.c.debugging.level.none" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.316043543" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value="&quot;${workspace_loc:/org.eclipse.etrice.runtime.cpp/src}&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${workspace_loc:/org.eclipse.etrice.modellib.cpp/src-gen}&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${workspace_loc:/org.eclipse.etrice.runtime.cpp/src/platforms/generic}&quot;"/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.760635415" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
+ </tool>
+ <tool id="cdt.managedbuild.tool.gnu.c.linker.mingw.base.1854320864" name="MinGW C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.mingw.base"/>
+ <tool id="cdt.managedbuild.tool.gnu.cpp.linker.mingw.base.1472356875" name="MinGW C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.mingw.base"/>
+ </toolChain>
+ </folderInfo>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <project id="org.eclipse.etrice.modellib.cpp.cdt.managedbuild.target.gnu.mingw.lib.704211053" name="Static Library" projectType="cdt.managedbuild.target.gnu.mingw.lib"/>
+ </storageModule>
+ <storageModule moduleId="scannerConfiguration">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.lib.debug.44153035;cdt.managedbuild.config.gnu.mingw.lib.debug.44153035.;cdt.managedbuild.tool.gnu.cpp.compiler.mingw.lib.debug.118960948;cdt.managedbuild.tool.gnu.cpp.compiler.input.402201359">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"/>
+ </scannerConfigBuildInfo>
+ <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.lib.release.369390927;cdt.managedbuild.config.gnu.mingw.lib.release.369390927.;cdt.managedbuild.tool.gnu.c.compiler.mingw.lib.release.129970568;cdt.managedbuild.tool.gnu.c.compiler.input.760635415">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
+ </scannerConfigBuildInfo>
+ <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.lib.debug.44153035;cdt.managedbuild.config.gnu.mingw.lib.debug.44153035.;cdt.managedbuild.tool.gnu.c.compiler.mingw.lib.debug.485632379;cdt.managedbuild.tool.gnu.c.compiler.input.2050037191">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
+ </scannerConfigBuildInfo>
+ <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.lib.release.369390927;cdt.managedbuild.config.gnu.mingw.lib.release.369390927.;cdt.managedbuild.tool.gnu.cpp.compiler.mingw.lib.release.756312591;cdt.managedbuild.tool.gnu.cpp.compiler.input.1763050360">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"/>
+ </scannerConfigBuildInfo>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
+ <storageModule moduleId="refreshScope"/>
+</cproject>
diff --git a/runtime/org.eclipse.etrice.modellib.cpp/.gitignore b/runtime/org.eclipse.etrice.modellib.cpp/.gitignore
new file mode 100644
index 000000000..76b025ad1
--- /dev/null
+++ b/runtime/org.eclipse.etrice.modellib.cpp/.gitignore
@@ -0,0 +1,2 @@
+Debug
+Release
diff --git a/runtime/org.eclipse.etrice.modellib.cpp/.project b/runtime/org.eclipse.etrice.modellib.cpp/.project
new file mode 100644
index 000000000..25fbf253e
--- /dev/null
+++ b/runtime/org.eclipse.etrice.modellib.cpp/.project
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.etrice.modellib.cpp</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+ <triggers>clean,full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+ <triggers>full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.eclipse.cdt.core.ccnature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+ <nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
+ </natures>
+</projectDescription>
diff --git a/runtime/org.eclipse.etrice.modellib.cpp/.settings/org.eclipse.cdt.managedbuilder.core.prefs b/runtime/org.eclipse.etrice.modellib.cpp/.settings/org.eclipse.cdt.managedbuilder.core.prefs
new file mode 100644
index 000000000..5f6b7ee39
--- /dev/null
+++ b/runtime/org.eclipse.etrice.modellib.cpp/.settings/org.eclipse.cdt.managedbuilder.core.prefs
@@ -0,0 +1,9 @@
+eclipse.preferences.version=1
+environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.lib.debug.44153035/CPATH/delimiter=;
+environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.lib.debug.44153035/CPATH/operation=remove
+environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.lib.debug.44153035/CPLUS_INCLUDE_PATH/delimiter=;
+environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.lib.debug.44153035/CPLUS_INCLUDE_PATH/operation=remove
+environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.lib.debug.44153035/C_INCLUDE_PATH/delimiter=;
+environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.lib.debug.44153035/C_INCLUDE_PATH/operation=remove
+environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.lib.debug.44153035/append=true
+environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.lib.debug.44153035/appendContributed=true
diff --git a/runtime/org.eclipse.etrice.modellib.cpp/cpp_gen_modellib.launch b/runtime/org.eclipse.etrice.modellib.cpp/cpp_gen_modellib.launch
new file mode 100644
index 000000000..ca1f76ceb
--- /dev/null
+++ b/runtime/org.eclipse.etrice.modellib.cpp/cpp_gen_modellib.launch
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.etrice.generator.launch.cpp.launchConfigurationType">
+<booleanAttribute key="GenInstanceDiagram" value="false"/>
+<stringAttribute key="GenModelPath" value=""/>
+<booleanAttribute key="Lib" value="true"/>
+<listAttribute key="ModelFiles">
+<listEntry value="${workspace_loc:/org.eclipse.etrice.modellib.cpp/model/Language.room}"/>
+<listEntry value="${workspace_loc:/org.eclipse.etrice.modellib.cpp/model/TimingService.room}"/>
+<listEntry value="${workspace_loc:/org.eclipse.etrice.modellib.cpp/model/Types.room}"/>
+</listAttribute>
+<booleanAttribute key="SaveGenModel" value="false"/>
+<stringAttribute key="org.eclipse.debug.core.ATTR_REFRESH_SCOPE" value="${working_set:&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#13;&#10;&lt;resources&gt;&#13;&#10;&lt;item path=&quot;/org.eclipse.etrice.modellib.cpp/src-gen&quot; type=&quot;2&quot;/&gt;&#13;&#10;&lt;/resources&gt;}"/>
+</launchConfiguration>
diff --git a/runtime/org.eclipse.etrice.modellib.cpp/model/Language.room b/runtime/org.eclipse.etrice.modellib.cpp/model/Language.room
new file mode 100644
index 000000000..04e441aad
--- /dev/null
+++ b/runtime/org.eclipse.etrice.modellib.cpp/model/Language.room
@@ -0,0 +1,3 @@
+RoomModel room.basic.language {
+ PrimitiveType languageIndicator: ptInteger -> int8 default "2"
+} \ No newline at end of file
diff --git a/runtime/org.eclipse.etrice.modellib.cpp/model/TimingService.room b/runtime/org.eclipse.etrice.modellib.cpp/model/TimingService.room
new file mode 100644
index 000000000..538fe7b03
--- /dev/null
+++ b/runtime/org.eclipse.etrice.modellib.cpp/model/TimingService.room
@@ -0,0 +1,301 @@
+RoomModel room.basic.service.timing {
+
+ import room.basic.types.* from "Types.room"
+
+ async ActorClass ATimingService {
+ Interface {
+ SPP timer: PTimer
+ }
+ Structure {
+ usercode1 {
+ "
+ #include \"common/platform/etTimer.h\"
+ #define ET_NB_OF_TCBS 10
+ typedef struct etTCB etTimerControlBlock;
+ struct etTCB {
+ etTargetTime_t expTime;
+ etTargetTime_t pTime;
+ int32 portIdx;
+ etTimerControlBlock* next;
+ };
+ "
+ }
+ usercode2 {
+ "//uc2"
+ }
+ usercode3{
+ "//etTimerControlBlock tcbs[ET_NB_OF_TCBS];"
+ }
+ ServiceImplementation of timer
+ Attribute tcbs[10]:tcb
+ Attribute usedTcbsRoot : tcb ref
+ Attribute freeTcbsRoot : tcb ref
+ }
+ Behavior {
+ Operation getTcb():tcb ref{"
+ etTimerControlBlock* temp = freeTcbsRoot;
+
+ if(freeTcbsRoot!=0) {
+ freeTcbsRoot=freeTcbsRoot->next;
+ temp->next=0;
+ }
+ return temp;
+ "}
+ Operation returnTcb(block:tcb ref){"
+ block->next=freeTcbsRoot;
+ freeTcbsRoot=block;
+ "}
+ Operation removeTcbFromUsedList(idx:int32){"
+ etTimerControlBlock* temp=usedTcbsRoot;
+ etTimerControlBlock* temp2=usedTcbsRoot;
+
+ if (temp==0) return;
+
+ if (usedTcbsRoot->portIdx == idx){
+ // element found, the first one
+ usedTcbsRoot = usedTcbsRoot->next;
+ returnTcb(temp);
+ return;
+ }
+
+ temp=temp->next;
+ while(temp!=0){
+ if(temp->portIdx==idx){
+ temp2->next=temp->next;
+ returnTcb(temp);
+ return;
+ }else{
+ // try next
+ temp2=temp;
+ temp=temp->next;
+ }
+ }
+ "}
+ Operation putTcbToUsedList(block:tcb ref){"
+ etTimerControlBlock* temp=usedTcbsRoot;
+ etTimerControlBlock* temp2=usedTcbsRoot;
+
+ if (temp==0){
+ // list empty put new block to root
+ block->next=0;
+ usedTcbsRoot=block;
+ return;
+ }
+
+ while(1){
+ if (temp != 0){
+ if (isTimeGreater(&block->expTime,&temp->expTime)){
+ //try next position
+ temp2=temp;
+ temp=temp->next;
+ }else{
+ // right position found
+ block->next=temp;
+ if(temp==usedTcbsRoot){
+ usedTcbsRoot=block;
+ }else{
+ temp2->next=block;
+ }
+ return;
+ }
+ }else{
+ // end of list reached
+ block->next=0;
+ temp2->next=block;
+ return;
+ }
+ }
+ "}
+ Operation isTimeGreater(t1:targetTime ref, t2 :targetTime ref):boolean{"
+ if (t1->sec > t2->sec) return TRUE;
+ if (t1->sec < t2->sec) return FALSE;
+ if (t1->nSec > t2->nSec) return TRUE;
+ return FALSE;
+ "}
+
+ Operation addTime(t1:targetTime ref, t2:targetTime ref){"
+ t1->sec += t2->sec;
+ t1->nSec += t2->nSec;
+ while(t1->nSec >= 1000000000L){
+ t1->sec++;
+ t1->nSec-=1000000000L;
+ }
+ "}
+
+ Operation printList(){"
+ etTimerControlBlock* temp=usedTcbsRoot;
+ printf(\"list: \");
+ while (temp!=0){
+ printf(\"(%d,%d),\",temp->expTime.sec,temp->expTime.nSec);
+ temp=temp->next;
+ }
+ printf(\"\\n\");
+ "}
+ StateMachine {
+ Transition tr0: initial -> Operational {
+ action {
+ "int i;"
+ "usedTcbsRoot=0;"
+ "freeTcbsRoot=&tcbs[0];"
+ "tcbs[ET_NB_OF_TCBS-1].next=0;"
+ "for (i=0;i<ET_NB_OF_TCBS-1;i++){"
+ "\ttcbs[i].next=&tcbs[i+1];"
+ "\t}"
+ }
+ }
+ Transition tr1: Operational -> Operational {
+ triggers {
+ <startTimeout: timer>
+ }
+ action {
+ "etTimerControlBlock* timer = getTcb();"
+ "etTargetTime_t t;"
+ "if (timer!= 0){"
+ "\tt.sec=time/1000;"
+ "\tt.nSec=(time%1000)*1000000L;"
+ "\ttimer->pTime.sec = 0;"
+ "\ttimer->pTime.nSec = 0;"
+ "\ttimer->portIdx=ifitem->getIdx();"
+ "\tgetTimeFromTarget(&(timer->expTime));"
+ "\taddTime(&(timer->expTime),&t);"
+ "\tputTcbToUsedList(timer);"
+ "\t}"
+ }
+ }
+ Transition tr3: Operational -> Operational {
+ triggers {
+ <startTimer: timer>
+ }
+ action {
+ "etTimerControlBlock* timer = getTcb();"
+ "etTargetTime_t t;"
+ "if (timer!= 0){"
+ "\tt.sec=time/1000;"
+ "\tt.nSec=(time%1000)*1000000L;"
+ "\ttimer->pTime = t;"
+ "\ttimer->portIdx=ifitem->getIdx();"
+ "\tgetTimeFromTarget(&(timer->expTime));"
+ "\taddTime(&(timer->expTime),&t);"
+ "\tputTcbToUsedList(timer);"
+ "\t}"
+ }
+ }
+ Transition tr4: Operational -> Operational {
+ triggers {
+ <kill: timer>
+ }
+ action {
+ "removeTcbFromUsedList(ifitem->getIdx());"
+ }
+ }
+ State Operational {
+ entry {
+ "// prepare"
+ } do {
+ "// maintain timers"
+ "etTimerControlBlock* temp;"
+ "etTargetTime_t t;"
+ ""
+ "getTimeFromTarget(&t);"
+ "while (usedTcbsRoot !=0 ){"
+ "\tif (isTimeGreater(&t,&(usedTcbsRoot->expTime))){"
+ "\t\ttimer[usedTcbsRoot->portIdx].timeout();"
+ "\t\ttemp=usedTcbsRoot;"
+ "\t\tusedTcbsRoot=usedTcbsRoot->next;"
+ "\t\tif((temp->pTime.sec==0)&&(temp->pTime.nSec==0)){"
+ "\t\t\t// single shot timer"
+ "\t\t\treturnTcb(temp);"
+ "\t\t}else{"
+ "\t\t\t// periodic timer"
+ "\t\t\taddTime(&temp->expTime,&temp->pTime);"
+ "\t\t\tputTcbToUsedList(temp);"
+ "\t\t\t}"
+ "\t\t}else{"
+ "\t\t\tbreak;"
+ "\t\t\t}"
+ "\t}"
+ }
+ }
+ }
+ }
+ }
+
+
+ ProtocolClass PTimer {
+ usercode1 {"
+ #define ET_TIMER_RUNNING 0x01
+ #define ET_TIMER_PERIODIC 0x02
+ "
+ }
+ usercode2 {
+ "//uc2 "
+ }
+ incoming {
+ Message startTimer(time: uint32)
+ Message startTimeout(time: uint32)
+ Message kill()
+ }
+ outgoing {
+ Message timeout()
+ }
+ conjugate PortClass
+ {
+ handle incoming startTimer{
+ "
+ if (status==0){
+ status=ET_TIMER_RUNNING | ET_TIMER_PERIODIC;
+ DebuggingService::getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(),
+ PTimer::getMessageString(PTimer::IN_startTimer));
+ if (getPeerAddress().isValid()){
+ getPeerMsgReceiver()->receive(new Message(getPeerAddress(),PTimer::IN_startTimer,
+ reinterpret_cast<void*>(time),
+ sizeof(uint32)));
+ }
+ }
+ "
+ }
+ handle incoming startTimeout{
+ "
+ if (status==0){
+ status = ET_TIMER_RUNNING;
+ DebuggingService::getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(),
+ PTimer::getMessageString(PTimer::IN_startTimeout));
+ if (getPeerAddress().isValid()){
+ getPeerMsgReceiver()->receive(new Message(getPeerAddress(),PTimer::IN_startTimeout,
+ reinterpret_cast<void*>(time),
+ sizeof(uint32)));
+ }
+ }
+ "
+ }
+ handle outgoing timeout{
+ "
+ //TODO: clear active bit in case of single shot timer
+ if (status!=0){
+ if (status==ET_TIMER_RUNNING){
+ // single shot timer
+ status=0;
+ }
+ // msg to fsm
+ getActor().receiveEvent(*this, msg->getEvtId(), msg->getData());
+ }
+ "
+ }
+ handle incoming kill {
+ "
+ if (status!=0){
+ status=0;
+ DebuggingService::getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(),
+ PTimer::getMessageString(PTimer::IN_kill));
+ if (getPeerAddress().isValid()){
+ getPeerMsgReceiver()->receive(new Message(getPeerAddress(),PTimer::IN_kill, 0, 0));
+ }
+ }
+ "
+ }
+ Attribute status:int8="0"
+ }
+ }
+ ExternalType tcb -> etTimerControlBlock
+ ExternalType targetTime -> etTargetTime_t
+} \ No newline at end of file
diff --git a/runtime/org.eclipse.etrice.modellib.cpp/model/Types.room b/runtime/org.eclipse.etrice.modellib.cpp/model/Types.room
new file mode 100644
index 000000000..b9f15df1e
--- /dev/null
+++ b/runtime/org.eclipse.etrice.modellib.cpp/model/Types.room
@@ -0,0 +1,21 @@
+RoomModel room.basic.types {
+
+ PrimitiveType boolean: ptBoolean -> bool default "false"
+ PrimitiveType char: ptCharacter -> char default "0"
+ PrimitiveType int8: ptInteger -> int8 default "0"
+ PrimitiveType int16: ptInteger -> int16 default "0"
+ PrimitiveType int32: ptInteger -> int32 default "0"
+ PrimitiveType int64: ptInteger -> int64 default "0"
+
+ PrimitiveType uint8: ptInteger -> uint8 default "0"
+ PrimitiveType uint16: ptInteger -> uint16 default "0"
+ PrimitiveType uint32: ptInteger -> uint32 default "0"
+ PrimitiveType uint64: ptInteger -> uint64 default "0"
+
+ PrimitiveType float32:ptReal -> float32 default "0"
+ PrimitiveType float64:ptReal -> float64 default "0"
+
+ // TODO: define strings for C
+ PrimitiveType charPtr:ptCharacter -> charPtr default "0"
+ PrimitiveType string:ptCharacter -> charPtr default "0"
+} \ No newline at end of file
diff --git a/runtime/org.eclipse.etrice.modellib.cpp/model/diagrams/room.basic.service.timing.ATimingService.behavior b/runtime/org.eclipse.etrice.modellib.cpp/model/diagrams/room.basic.service.timing.ATimingService.behavior
new file mode 100644
index 000000000..dae159c62
--- /dev/null
+++ b/runtime/org.eclipse.etrice.modellib.cpp/model/diagrams/room.basic.service.timing.ATimingService.behavior
@@ -0,0 +1,146 @@
+<?xml version="1.0" encoding="ASCII"?>
+<pi:Diagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:al="http://eclipse.org/graphiti/mm/algorithms" xmlns:pi="http://eclipse.org/graphiti/mm/pictograms" visible="true" gridUnit="10" diagramTypeId="room.behavior" name="Behavior of ATimingService" pictogramLinks="//@link //@children.0/@link //@children.0/@children.1/@link //@children.0/@children.2/@link //@connections.0/@link //@connections.1/@link //@connections.2/@link //@connections.3/@link" verticalGridUnit="10" version="0.9.0">
+ <graphicsAlgorithm xsi:type="al:Rectangle" background="//@colors.1" foreground="//@colors.0" lineWidth="1" transparency="0.0" width="1000" height="1000"/>
+ <link>
+ <businessObjects href="../TimingService.room#ActorClass:ATimingService"/>
+ </link>
+ <children xsi:type="pi:ContainerShape" visible="true" active="true">
+ <properties key="obj-type" value="sg"/>
+ <graphicsAlgorithm xsi:type="al:Rectangle" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="858" height="381" x="37" y="33">
+ <graphicsAlgorithmChildren xsi:type="al:RoundedRectangle" background="//@colors.1" foreground="//@colors.2" lineWidth="4" transparency="0.5" width="778" height="301" x="40" y="40" cornerHeight="20" cornerWidth="20"/>
+ <graphicsAlgorithmChildren xsi:type="al:RoundedRectangle" foreground="//@colors.2" lineWidth="4" filled="false" transparency="0.0" width="778" height="301" x="40" y="40" cornerHeight="20" cornerWidth="20"/>
+ </graphicsAlgorithm>
+ <link>
+ <businessObjects href="../TimingService.room#StateGraph:ATimingService$sg"/>
+ </link>
+ <children visible="true">
+ <graphicsAlgorithm xsi:type="al:Text" background="//@colors.2" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0" width="778" height="80" y="40" font="//@fonts.1" horizontalAlignment="ALIGNMENT_RIGHT" verticalAlignment="ALIGNMENT_TOP" value="/"/>
+ </children>
+ <children xsi:type="pi:ContainerShape" visible="true" active="true">
+ <properties key="obj-type" value="trp"/>
+ <graphicsAlgorithm xsi:type="al:Rectangle" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="40" height="40" x="100" y="100">
+ <graphicsAlgorithmChildren xsi:type="al:Ellipse" background="//@colors.1" foreground="//@colors.2" lineWidth="2" transparency="0.0" width="20" height="20" x="10" y="10"/>
+ </graphicsAlgorithm>
+ <link>
+ <businessObjects href="../TimingService.room#StateGraph:ATimingService$sg"/>
+ </link>
+ <anchors xsi:type="pi:ChopboxAnchor" outgoingConnections="//@connections.0" referencedGraphicsAlgorithm="//@children.0/@children.1/@graphicsAlgorithm/@graphicsAlgorithmChildren.0"/>
+ <children visible="true">
+ <graphicsAlgorithm xsi:type="al:Text" background="//@colors.2" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0" width="40" height="20" y="10" font="//@fonts.0" horizontalAlignment="ALIGNMENT_CENTER" value="I"/>
+ </children>
+ </children>
+ <children xsi:type="pi:ContainerShape" visible="true" active="true">
+ <properties key="obj-type" value="state"/>
+ <graphicsAlgorithm xsi:type="al:Rectangle" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="435" height="216" x="237" y="52">
+ <graphicsAlgorithmChildren xsi:type="al:RoundedRectangle" background="//@colors.3" foreground="//@colors.2" lineWidth="1" transparency="0.0" width="375" height="156" x="30" y="30" cornerHeight="20" cornerWidth="20">
+ <graphicsAlgorithmChildren xsi:type="al:RoundedRectangle" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="15" height="8" x="350" y="3" cornerHeight="5" cornerWidth="5"/>
+ <graphicsAlgorithmChildren xsi:type="al:Polygon" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0" x="187" y="150">
+ <points x="-3" y="-3"/>
+ <points x="-3" y="3"/>
+ <points x="-11" y="3"/>
+ </graphicsAlgorithmChildren>
+ <graphicsAlgorithmChildren xsi:type="al:Polygon" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" x="187" y="150">
+ <points x="3" y="-3"/>
+ <points x="3" y="3"/>
+ <points x="11" y="3"/>
+ </graphicsAlgorithmChildren>
+ <graphicsAlgorithmChildren xsi:type="al:Polygon" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0" x="187" y="150">
+ <points x="-2" y="-3"/>
+ <points x="-2" y="3"/>
+ <points x="2" y="3"/>
+ <points x="2" y="-3"/>
+ </graphicsAlgorithmChildren>
+ </graphicsAlgorithmChildren>
+ </graphicsAlgorithm>
+ <link>
+ <businessObjects href="../TimingService.room#SimpleState:ATimingService$Operational"/>
+ </link>
+ <anchors xsi:type="pi:ChopboxAnchor" outgoingConnections="//@connections.1 //@connections.2 //@connections.3" incomingConnections="//@connections.0 //@connections.1 //@connections.2 //@connections.3" referencedGraphicsAlgorithm="//@children.0/@children.2/@graphicsAlgorithm/@graphicsAlgorithmChildren.0"/>
+ <children visible="true">
+ <graphicsAlgorithm xsi:type="al:Text" background="//@colors.2" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0" width="375" height="156" x="30" y="30" font="//@fonts.0" horizontalAlignment="ALIGNMENT_CENTER" value="Operational"/>
+ </children>
+ </children>
+ </children>
+ <connections xsi:type="pi:FreeFormConnection" visible="true" active="true" start="//@children.0/@children.1/@anchors.0" end="//@children.0/@children.2/@anchors.0">
+ <properties key="obj-type" value="trans"/>
+ <graphicsAlgorithm xsi:type="al:Polyline" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0"/>
+ <link>
+ <businessObjects href="../TimingService.room#InitialTransition:ATimingService$initial"/>
+ </link>
+ <connectionDecorators visible="true" locationRelative="true" location="1.0">
+ <graphicsAlgorithm xsi:type="al:Polygon" background="//@colors.2" foreground="//@colors.2" lineWidth="1" filled="true" transparency="0.0">
+ <points x="-15" y="5"/>
+ <points/>
+ <points x="-15" y="-5"/>
+ </graphicsAlgorithm>
+ </connectionDecorators>
+ <connectionDecorators visible="true" active="true" locationRelative="true" location="0.5">
+ <graphicsAlgorithm xsi:type="al:Text" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0" x="10" font="//@fonts.0" value="init"/>
+ </connectionDecorators>
+ </connections>
+ <connections xsi:type="pi:FreeFormConnection" visible="true" active="true" start="//@children.0/@children.2/@anchors.0" end="//@children.0/@children.2/@anchors.0">
+ <properties key="obj-type" value="trans"/>
+ <graphicsAlgorithm xsi:type="al:Polyline" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0"/>
+ <link>
+ <businessObjects href="../TimingService.room#TriggeredTransition:ATimingService$tr1"/>
+ </link>
+ <connectionDecorators visible="true" locationRelative="true" location="1.0">
+ <graphicsAlgorithm xsi:type="al:Polygon" background="//@colors.2" foreground="//@colors.2" lineWidth="1" filled="true" transparency="0.0">
+ <points x="-15" y="5"/>
+ <points/>
+ <points x="-15" y="-5"/>
+ </graphicsAlgorithm>
+ </connectionDecorators>
+ <connectionDecorators visible="true" active="true" locationRelative="true" location="0.5">
+ <graphicsAlgorithm xsi:type="al:Text" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0" x="10" font="//@fonts.0" value="tr1: &lt;startTimeout:t..."/>
+ </connectionDecorators>
+ <bendpoints x="679" y="253"/>
+ <bendpoints x="707" y="253"/>
+ <bendpoints x="707" y="206"/>
+ </connections>
+ <connections xsi:type="pi:FreeFormConnection" visible="true" active="true" start="//@children.0/@children.2/@anchors.0" end="//@children.0/@children.2/@anchors.0">
+ <properties key="obj-type" value="trans"/>
+ <graphicsAlgorithm xsi:type="al:Polyline" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0"/>
+ <link>
+ <businessObjects href="../TimingService.room#TriggeredTransition:ATimingService$tr3"/>
+ </link>
+ <connectionDecorators visible="true" locationRelative="true" location="1.0">
+ <graphicsAlgorithm xsi:type="al:Polygon" background="//@colors.2" foreground="//@colors.2" lineWidth="1" filled="true" transparency="0.0">
+ <points x="-15" y="5"/>
+ <points/>
+ <points x="-15" y="-5"/>
+ </graphicsAlgorithm>
+ </connectionDecorators>
+ <connectionDecorators visible="true" active="true" locationRelative="true" location="0.5">
+ <graphicsAlgorithm xsi:type="al:Text" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0" x="-36" y="13" font="//@fonts.0" value="tr3: &lt;startTimer:tim..."/>
+ </connectionDecorators>
+ <bendpoints x="490" y="305"/>
+ <bendpoints x="591" y="305"/>
+ </connections>
+ <connections xsi:type="pi:FreeFormConnection" visible="true" active="true" start="//@children.0/@children.2/@anchors.0" end="//@children.0/@children.2/@anchors.0">
+ <properties key="obj-type" value="trans"/>
+ <graphicsAlgorithm xsi:type="al:Polyline" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0"/>
+ <link>
+ <businessObjects href="../TimingService.room#TriggeredTransition:ATimingService$tr4"/>
+ </link>
+ <connectionDecorators visible="true" locationRelative="true" location="1.0">
+ <graphicsAlgorithm xsi:type="al:Polygon" background="//@colors.2" foreground="//@colors.2" lineWidth="1" filled="true" transparency="0.0">
+ <points x="-15" y="5"/>
+ <points/>
+ <points x="-15" y="-5"/>
+ </graphicsAlgorithm>
+ </connectionDecorators>
+ <connectionDecorators visible="true" active="true" locationRelative="true" location="0.5">
+ <graphicsAlgorithm xsi:type="al:Text" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0" x="10" y="12" font="//@fonts.0" value="tr4: &lt;kill:timer>"/>
+ </connectionDecorators>
+ <bendpoints x="321" y="271"/>
+ <bendpoints x="321" y="300"/>
+ <bendpoints x="392" y="300"/>
+ </connections>
+ <colors red="227" green="238" blue="249"/>
+ <colors red="255" green="255" blue="255"/>
+ <colors/>
+ <colors red="200" green="200" blue="200"/>
+ <fonts name="Arial" size="8"/>
+ <fonts name="Arial" size="9" bold="true"/>
+</pi:Diagram>
diff --git a/runtime/org.eclipse.etrice.modellib.cpp/model/diagrams/room.basic.service.timing.ATimingService.structure b/runtime/org.eclipse.etrice.modellib.cpp/model/diagrams/room.basic.service.timing.ATimingService.structure
new file mode 100644
index 000000000..0874065e7
--- /dev/null
+++ b/runtime/org.eclipse.etrice.modellib.cpp/model/diagrams/room.basic.service.timing.ATimingService.structure
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="ASCII"?>
+<pi:Diagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:al="http://eclipse.org/graphiti/mm/algorithms" xmlns:pi="http://eclipse.org/graphiti/mm/pictograms" visible="true" gridUnit="10" diagramTypeId="room.structure" name="Structure of ATimingService" pictogramLinks="//@children.0/@link //@link //@children.0/@children.0/@link" verticalGridUnit="10" version="0.9.0">
+ <graphicsAlgorithm xsi:type="al:Rectangle" background="//@colors.1" foreground="//@colors.0" lineWidth="1" transparency="0.0" width="1000" height="1000"/>
+ <link>
+ <businessObjects href="../TimingService.room#ActorClass:ATimingService"/>
+ </link>
+ <children xsi:type="pi:ContainerShape" visible="true" active="true">
+ <properties key="obj-type" value="cls"/>
+ <graphicsAlgorithm xsi:type="al:Rectangle" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="571" height="294" x="40" y="40">
+ <graphicsAlgorithmChildren xsi:type="al:Rectangle" background="//@colors.1" foreground="//@colors.2" lineWidth="4" transparency="0.5" width="491" height="214" x="40" y="40"/>
+ <graphicsAlgorithmChildren xsi:type="al:Rectangle" foreground="//@colors.2" lineWidth="4" filled="false" transparency="0.0" width="491" height="214" x="40" y="40"/>
+ </graphicsAlgorithm>
+ <link>
+ <businessObjects href="../TimingService.room#ActorClass:ATimingService"/>
+ </link>
+ <children xsi:type="pi:ContainerShape" visible="true" active="true">
+ <properties key="obj-type" value="port"/>
+ <properties key="item-kind" value=""/>
+ <graphicsAlgorithm xsi:type="al:Rectangle" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="80" height="80" x="245">
+ <graphicsAlgorithmChildren xsi:type="al:Ellipse" background="//@colors.2" foreground="//@colors.2" lineWidth="2" transparency="0.0" width="40" height="40" x="20" y="20"/>
+ </graphicsAlgorithm>
+ <link>
+ <businessObjects href="../TimingService.room#SPPRef:ATimingService$timer"/>
+ </link>
+ <anchors xsi:type="pi:ChopboxAnchor" referencedGraphicsAlgorithm="//@children.0/@children.0/@graphicsAlgorithm/@graphicsAlgorithmChildren.0"/>
+ <children visible="true">
+ <graphicsAlgorithm xsi:type="al:Text" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0" width="80" height="20" font="//@fonts.0" horizontalAlignment="ALIGNMENT_CENTER" value="timer"/>
+ </children>
+ </children>
+ </children>
+ <colors red="227" green="238" blue="249"/>
+ <colors red="255" green="255" blue="255"/>
+ <colors/>
+ <fonts name="Arial" size="8"/>
+</pi:Diagram>
diff --git a/runtime/org.eclipse.etrice.runtime.cpp/.cproject b/runtime/org.eclipse.etrice.runtime.cpp/.cproject
index ef22199c7..66d3daac4 100644
--- a/runtime/org.eclipse.etrice.runtime.cpp/.cproject
+++ b/runtime/org.eclipse.etrice.runtime.cpp/.cproject
@@ -25,6 +25,9 @@
<targetPlatform id="cdt.managedbuild.target.gnu.platform.mingw.lib.debug.1363258846" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.mingw.lib.debug"/>
<builder buildPath="${workspace_loc:/org.eclipse.etrice.runtime.cpp/Debug}" id="cdt.managedbuild.tool.gnu.builder.mingw.base.765054146" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="CDT Internal Builder" superClass="cdt.managedbuild.tool.gnu.builder.mingw.base"/>
<tool id="cdt.managedbuild.tool.gnu.assembler.mingw.lib.debug.778368249" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.mingw.lib.debug">
+ <option id="gnu.both.asm.option.include.paths.479529629" name="Include paths (-I)" superClass="gnu.both.asm.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value="&quot;${workspace_loc:/org.eclipse.etrice.runtime.cpp/src/platforms/generic}&quot;"/>
+ </option>
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.1431383431" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.archiver.mingw.lib.debug.2067321690" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.mingw.lib.debug"/>
@@ -33,12 +36,17 @@
<option id="gnu.cpp.compiler.mingw.lib.debug.option.debugging.level.1636571561" name="Debug Level" superClass="gnu.cpp.compiler.mingw.lib.debug.option.debugging.level" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
<option id="gnu.cpp.compiler.option.include.paths.371088988" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src/}&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src/platforms/generic}&quot;"/>
</option>
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.834970834" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.compiler.mingw.lib.debug.787652226" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.mingw.lib.debug">
<option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.mingw.lib.debug.option.optimization.level.1338147333" name="Optimization Level" superClass="gnu.c.compiler.mingw.lib.debug.option.optimization.level" valueType="enumerated"/>
<option id="gnu.c.compiler.mingw.lib.debug.option.debugging.level.1088652134" name="Debug Level" superClass="gnu.c.compiler.mingw.lib.debug.option.debugging.level" value="gnu.c.debugging.level.max" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.181765143" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src/}&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src/platforms/generic}&quot;"/>
+ </option>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1322245631" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.linker.mingw.base.833683108" name="MinGW C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.mingw.base"/>
@@ -75,6 +83,7 @@
<targetPlatform id="cdt.managedbuild.target.gnu.platform.mingw.lib.release.2033657787" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.mingw.lib.release"/>
<builder buildPath="${workspace_loc:/org.eclipse.etrice.runtime.cpp/Release}" id="cdt.managedbuild.tool.gnu.builder.mingw.base.629737011" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="CDT Internal Builder" superClass="cdt.managedbuild.tool.gnu.builder.mingw.base"/>
<tool id="cdt.managedbuild.tool.gnu.assembler.mingw.lib.release.1791075014" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.mingw.lib.release">
+ <option id="gnu.both.asm.option.include.paths.227502240" name="Include paths (-I)" superClass="gnu.both.asm.option.include.paths" valueType="includePath"/>
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.1768068662" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.archiver.mingw.lib.release.633341399" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.mingw.lib.release"/>
@@ -83,12 +92,17 @@
<option id="gnu.cpp.compiler.mingw.lib.release.option.debugging.level.1368123052" name="Debug Level" superClass="gnu.cpp.compiler.mingw.lib.release.option.debugging.level" value="gnu.cpp.compiler.debugging.level.none" valueType="enumerated"/>
<option id="gnu.cpp.compiler.option.include.paths.763277987" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src/}&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src/platforms/generic}&quot;"/>
</option>
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1712453980" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.compiler.mingw.lib.release.2143016498" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.mingw.lib.release">
<option defaultValue="gnu.c.optimization.level.most" id="gnu.c.compiler.mingw.lib.release.option.optimization.level.180068255" name="Optimization Level" superClass="gnu.c.compiler.mingw.lib.release.option.optimization.level" valueType="enumerated"/>
<option id="gnu.c.compiler.mingw.lib.release.option.debugging.level.1290753638" name="Debug Level" superClass="gnu.c.compiler.mingw.lib.release.option.debugging.level" value="gnu.c.debugging.level.none" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.1098867338" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src/platforms/generic}&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src/}&quot;"/>
+ </option>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1857566126" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.linker.mingw.base.536323295" name="MinGW C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.mingw.base"/>
diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/Message.h b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/Message.h
index 581542bab..414858c2c 100644
--- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/Message.h
+++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/Message.h
@@ -9,7 +9,7 @@
#define MESSAGE_H_
#include "common/messaging/Address.h"
-#include "platforms/generic/etDatatypes.h"
+#include "etDatatypes.h"
#include <string>
namespace etRuntime {
diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/platform/etTimer.h b/runtime/org.eclipse.etrice.runtime.cpp/src/common/platform/etTimer.h
new file mode 100644
index 000000000..0d212c593
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/platform/etTimer.h
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * 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.cpp/src/config/etRuntimeConfig.h b/runtime/org.eclipse.etrice.runtime.cpp/src/config/etRuntimeConfig.h
new file mode 100644
index 000000000..b1759ab47
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.cpp/src/config/etRuntimeConfig.h
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * 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 ETGLOBALFLAGS_H_
+#define ETGLOBALFLAGS_H_
+
+/* flags for debugging */
+#define ET_MSC_LOGGER_ACTIVATE /* needs ET_LOGGER_ACTIVATE */
+#define ET_LOGGER_ACTIVATE
+
+
+#define STRUCT_ALIGN 8
+
+/* timing and scheduling */
+#define FREQUENCY 10L
+#define ET_RUNTIME_MAXLOOP 100
+//#define ET_RUNTIME_ENDLESS
+
+/* pool and block size */
+#define MESSAGE_POOL_MAX 50
+#define MESSAGE_BLOCK_SIZE 64
+
+
+#endif /* ETGLOBALFLAGS_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/platforms/generic/etDatatypes.h b/runtime/org.eclipse.etrice.runtime.cpp/src/platforms/generic/etDatatypes.h
index 67c76aebf..dfae6df6c 100644
--- a/runtime/org.eclipse.etrice.runtime.cpp/src/platforms/generic/etDatatypes.h
+++ b/runtime/org.eclipse.etrice.runtime.cpp/src/platforms/generic/etDatatypes.h
@@ -39,7 +39,11 @@ 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*/
+
+#ifndef __cplusplus
+typedef char bool; /* TODO: bool, Bool, Boolean, and boolean are already defined in some platforms*/
+#endif /* __cplusplus */
+
//typedef bool boolean;
#ifndef TRUE
#define TRUE 1
diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/platforms/generic/etTimer.c b/runtime/org.eclipse.etrice.runtime.cpp/src/platforms/generic/etTimer.c
new file mode 100644
index 000000000..39989b4c9
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.cpp/src/platforms/generic/etTimer.c
@@ -0,0 +1,39 @@
+#include "common/platform/etTimer.h"
+
+#include <sys/time.h>
+
+#include "config/etRuntimeConfig.h"
+
+void etTimer_init(void){
+}
+
+uint64 getTargetTimeUs(void){
+ struct timeval currentTime;
+ gettimeofday(&currentTime, NULL);
+
+ return currentTime.tv_sec * 1000000L + currentTime.tv_usec;
+}
+
+etBool etTimer_executeNeeded(void){
+
+ static uint64 lastTime = 0L;
+
+ uint64 currentTime = getTargetTimeUs();
+
+ uint64 timestep = 1000000L/FREQUENCY;
+
+ if (currentTime >= lastTime + timestep) {
+ lastTime = currentTime;
+ return TRUE;
+ }
+ else {
+ return FALSE;
+ }
+}
+
+void getTimeFromTarget(etTargetTime_t *t){
+ struct timeval currentTime;
+ gettimeofday(&currentTime, NULL);
+ t->sec = currentTime.tv_sec;
+ t->nSec = currentTime.tv_usec*1000;
+}

Back to the top