diff --git a/org.fortiss.af3.platform.raspberry/trunk/model/raspberry.ecore b/org.fortiss.af3.platform.raspberry/trunk/model/raspberry.ecore index 01992bf07d64c269c12bd4f58689dcb2c5a5cc67..a5f7626631bcff476f0400de03b9a7f4e5ff8d00 100644 --- a/org.fortiss.af3.platform.raspberry/trunk/model/raspberry.ecore +++ b/org.fortiss.af3.platform.raspberry/trunk/model/raspberry.ecore @@ -32,4 +32,13 @@ <eClassifiers xsi:type="ecore:EClass" name="BusMasterPort" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//Transceiver platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//IIpCorePlatformArchitectureElement platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//IPlatformPort platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//ICommunicationMaster #//IProcessorDomain"/> <eClassifiers xsi:type="ecore:EClass" name="CANBusMasterPort" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//Transceiver platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//IBoardPlatformArchitectureElement platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//IPlatformPort platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//ICommunicationMaster #//IBoardDomain"/> <eClassifiers xsi:type="ecore:EClass" name="CANBusMasterInterface" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//Transceiver platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//IBoardPlatformArchitectureElement platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//IPlatformInterface platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//ICommunicationMaster #//IBoardDomain"/> + <eSubpackages name="annotation" nsURI="http://www.fortiss.org/af3/platform/raspberry/annotation" + nsPrefix="org-fortiss-af3-platform-raspberry-annotation"> + <eClassifiers xsi:type="ecore:EClass" name="CoreAddress" eSuperTypes="platform:/resource/org.fortiss.tooling.base/model/base.ecore#//element/IAnnotatedSpecification platform:/resource/org.fortiss.tooling.base/model/base.ecore#//element/IHiddenSpecification"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="coreAddress" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="PinNumber" eSuperTypes="platform:/resource/org.fortiss.tooling.base/model/base.ecore#//element/IAnnotatedSpecification platform:/resource/org.fortiss.tooling.base/model/base.ecore#//element/IHiddenSpecification"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="pinNumber" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/> + </eClassifiers> + </eSubpackages> </ecore:EPackage> diff --git a/org.fortiss.af3.platform.raspberry/trunk/model/raspberry.genmodel b/org.fortiss.af3.platform.raspberry/trunk/model/raspberry.genmodel index afd7303f39c3765d72bfea28455dae62a54eb49b..2779c477acad6dc2eecd5ec77c88dfe81a7ebe1d 100644 --- a/org.fortiss.af3.platform.raspberry/trunk/model/raspberry.genmodel +++ b/org.fortiss.af3.platform.raspberry/trunk/model/raspberry.genmodel @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<genmodel:GenModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" - modelDirectory="/org.fortiss.af3.platform.raspberry/generated-src" +<genmodel:GenModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" + xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" modelDirectory="/org.fortiss.af3.platform.raspberry/generated-src" modelPluginID="org.fortiss.af3.platform.raspberry" modelName="Raspberry" importerID="org.eclipse.emf.importer.ecore" containmentProxies="true" arrayAccessors="true" complianceLevel="7.0" copyrightFields="false" usedGenPackages="platform:/resource/org.fortiss.tooling.base/model/base.genmodel#//model platform:/resource/org.fortiss.af3.platform/model/platform.genmodel#//model platform:/resource/org.fortiss.tooling.kernel/model/kernel.genmodel#//model"> @@ -27,5 +27,14 @@ <genClasses ecoreClass="raspberry.ecore#//BusMasterPort"/> <genClasses ecoreClass="raspberry.ecore#//CANBusMasterPort"/> <genClasses ecoreClass="raspberry.ecore#//CANBusMasterInterface"/> + <nestedGenPackages prefix="Annotation" basePackage="org.fortiss.af3.platform.raspberry.model" + disposableProviderFactory="true" ecorePackage="raspberry.ecore#//annotation"> + <genClasses ecoreClass="raspberry.ecore#//annotation/CoreAddress"> + <genFeatures createChild="false" ecoreFeature="ecore:EAttribute raspberry.ecore#//annotation/CoreAddress/coreAddress"/> + </genClasses> + <genClasses ecoreClass="raspberry.ecore#//annotation/PinNumber"> + <genFeatures createChild="false" ecoreFeature="ecore:EAttribute raspberry.ecore#//annotation/PinNumber/pinNumber"/> + </genClasses> + </nestedGenPackages> </genPackages> </genmodel:GenModel> diff --git a/org.fortiss.af3.platform.raspberry/trunk/plugin.xml b/org.fortiss.af3.platform.raspberry/trunk/plugin.xml index f1215f99b701f2e284e87c3c0b02648ff2900cd0..f757f5039db4a8a41ee80824bf6314752d5b92e5 100644 --- a/org.fortiss.af3.platform.raspberry/trunk/plugin.xml +++ b/org.fortiss.af3.platform.raspberry/trunk/plugin.xml @@ -332,5 +332,29 @@ </target> </transformationProvider> </extension> + <extension + point="org.fortiss.tooling.base.annotation"> + <annotation + binding="org.fortiss.af3.platform.raspberry.annotation.valueprovider.CoreAddressValueProvider"> + <modelElementClass + modelElementClass="org.fortiss.af3.platform.raspberry.model.Core"> + </modelElementClass> + </annotation> + <annotation + binding="org.fortiss.af3.platform.raspberry.annotation.valueprovider.PinNumberValueProvider"> + <modelElementClass + modelElementClass="org.fortiss.af3.platform.raspberry.model.Sensor"> + </modelElementClass> + <modelElementClass + modelElementClass="org.fortiss.af3.platform.raspberry.model.Actuator"> + </modelElementClass> + <modelElementClass + modelElementClass="org.fortiss.af3.platform.raspberry.model.SensorIn"> + </modelElementClass> + <modelElementClass + modelElementClass="org.fortiss.af3.platform.raspberry.model.ActuatorOut"> + </modelElementClass> + </annotation> + </extension> </plugin> diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/annotation/valueprovider/CoreAddressValueProvider.java b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/annotation/valueprovider/CoreAddressValueProvider.java new file mode 100644 index 0000000000000000000000000000000000000000..fb0b17f26d3bb9656509f35e7a189c323838b269 --- /dev/null +++ b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/annotation/valueprovider/CoreAddressValueProvider.java @@ -0,0 +1,49 @@ +/*--------------------------------------------------------------------------+ +$Id$ +| | +| Copyright 2016 ForTISS GmbH | +| | +| Licensed under the Apache License, Version 2.0 (the "License"); | +| you may not use this file except in compliance with the License. | +| You may obtain a copy of the License at | +| | +| http://www.apache.org/licenses/LICENSE-2.0 | +| | +| Unless required by applicable law or agreed to in writing, software | +| distributed under the License is distributed on an "AS IS" BASIS, | +| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | +| See the License for the specific language governing permissions and | +| limitations under the License. | ++--------------------------------------------------------------------------*/ +package org.fortiss.af3.platform.raspberry.annotation.valueprovider; + +import org.fortiss.af3.platform.raspberry.model.annotation.AnnotationPackage; +import org.fortiss.af3.platform.raspberry.model.annotation.CoreAddress; +import org.fortiss.tooling.base.annotation.valueprovider.EStructuralFeatureValueProviderBase; + +/** + * + * @author zverlov + * @author $Author$ + * @version $Rev$ + * @ConQAT.Rating RED Hash: + */ +public class CoreAddressValueProvider extends EStructuralFeatureValueProviderBase<CoreAddress> { + + /** + * @param annotatedSpecificationEClass + */ + public CoreAddressValueProvider() { + super(AnnotationPackage.Literals.CORE_ADDRESS, + AnnotationPackage.Literals.CORE_ADDRESS__CORE_ADDRESS); + // TODO Auto-generated constructor stub + } + + /** {@inheritDoc} */ + @Override + public String getAnnotationName(CoreAddress specification) { + // TODO Auto-generated method stub + return "Core Address"; + } + +} diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/annotation/valueprovider/PinNumberValueProvider.java b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/annotation/valueprovider/PinNumberValueProvider.java new file mode 100644 index 0000000000000000000000000000000000000000..5e4789002ac8ff4b00659aa90e656cc267092f00 --- /dev/null +++ b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/annotation/valueprovider/PinNumberValueProvider.java @@ -0,0 +1,47 @@ +/*--------------------------------------------------------------------------+ +$Id$ +| | +| Copyright 2016 ForTISS GmbH | +| | +| Licensed under the Apache License, Version 2.0 (the "License"); | +| you may not use this file except in compliance with the License. | +| You may obtain a copy of the License at | +| | +| http://www.apache.org/licenses/LICENSE-2.0 | +| | +| Unless required by applicable law or agreed to in writing, software | +| distributed under the License is distributed on an "AS IS" BASIS, | +| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | +| See the License for the specific language governing permissions and | +| limitations under the License. | ++--------------------------------------------------------------------------*/ +package org.fortiss.af3.platform.raspberry.annotation.valueprovider; + +import org.fortiss.af3.platform.raspberry.model.annotation.AnnotationPackage; +import org.fortiss.af3.platform.raspberry.model.annotation.PinNumber; +import org.fortiss.tooling.base.annotation.valueprovider.EStructuralFeatureValueProviderBase; + +/** + * + * @author zverlov + * @author $Author$ + * @version $Rev$ + * @ConQAT.Rating RED Hash: + */ +public class PinNumberValueProvider extends EStructuralFeatureValueProviderBase<PinNumber> { + + /** + * @param annotatedSpecificationEClass + */ + public PinNumberValueProvider() { + super(AnnotationPackage.Literals.PIN_NUMBER, + AnnotationPackage.Literals.PIN_NUMBER__PIN_NUMBER); + } + + /** {@inheritDoc} */ + @Override + public String getAnnotationName(PinNumber specification) { + return "Pin Number"; + } + +} diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/ActuatorOutExecutable.java b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/ActuatorOutExecutable.java index 5cde1ec494eb86e94fa209dd0406fdd70ad76f91..5db350effd0a45d5a8338f3abbe6d074702e1721 100644 --- a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/ActuatorOutExecutable.java +++ b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/ActuatorOutExecutable.java @@ -18,14 +18,17 @@ $Id$ package org.fortiss.af3.platform.raspberry.generator.executable; import static org.fortiss.af3.expression.utils.ExpressionModelElementFactory.funcCall; +import static org.fortiss.tooling.base.utils.AnnotationUtils.getAnnotation; import org.fortiss.af3.component.model.OutputPort; import org.fortiss.af3.expression.model.terms.IExpressionTerm; +import org.fortiss.af3.expression.utils.ExpressionModelElementFactory; import org.fortiss.af3.platform.language.executable.IInitializableExecutable; import org.fortiss.af3.platform.language.executable.ITerminatableExecutable; import org.fortiss.af3.platform.language.executable.IWritableExecutableWithNoValSupport; import org.fortiss.af3.platform.language.executable.TransmitterExecutableBase; import org.fortiss.af3.platform.raspberry.model.ActuatorOut; +import org.fortiss.af3.platform.raspberry.model.annotation.PinNumber; /** * @@ -60,7 +63,11 @@ public class ActuatorOutExecutable extends TransmitterExecutableBase<ActuatorOut /** {@inheritDoc} */ @Override public IExpressionTerm getValueWriteAccessor(OutputPort logicalSignal, IExpressionTerm value) { - return funcCall("write_" + modelElement.getName(), value); + PinNumber ias = getAnnotation(modelElement, PinNumber.class); + int pinNr = ias.getPinNumber(); + return funcCall("write_" + modelElement.getName(), + ExpressionModelElementFactory.createVar(pinNr + "")); + } /** {@inheritDoc} */ diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/BusMasterPortExecutable.java b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/BusMasterPortExecutable.java index 47a574cf9dacf9c3f8cba65fabbb29bcf7d8c312..74593e20df71f6456898d31e5178f91aef459d03 100644 --- a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/BusMasterPortExecutable.java +++ b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/BusMasterPortExecutable.java @@ -22,12 +22,14 @@ import static org.fortiss.af3.expression.utils.ExpressionModelElementFactory.fun import org.fortiss.af3.component.model.InputPort; import org.fortiss.af3.component.model.OutputPort; import org.fortiss.af3.expression.model.terms.IExpressionTerm; +import org.fortiss.af3.expression.utils.ExpressionModelElementFactory; import org.fortiss.af3.platform.language.executable.IInitializableExecutable; import org.fortiss.af3.platform.language.executable.IReadableExecutableWithNoValSupport; import org.fortiss.af3.platform.language.executable.ITerminatableExecutable; import org.fortiss.af3.platform.language.executable.IWritableExecutableWithNoValSupport; import org.fortiss.af3.platform.language.executable.TransceiverExecutableBase; import org.fortiss.af3.platform.raspberry.model.BusMasterPort; +import org.fortiss.af3.platform.raspberry.model.annotation.CoreAddress; /** * @@ -69,7 +71,15 @@ public class BusMasterPortExecutable extends TransceiverExecutableBase<BusMaster /** {@inheritDoc} */ @Override public IExpressionTerm getValueReadAccessor(InputPort logicalSignal) { - return funcCall("read_" + modelElement.getName() + "_" + logicalSignal.getName()); + CoreAddress ias = + org.fortiss.tooling.base.utils.AnnotationUtils.getAnnotation( + modelElement.getPlatformElement(), CoreAddress.class); + + int coreAddress = ias.getCoreAddress(); + // return funcCall("read_" + modelElement.getName() + "_" + logicalSignal.getName()); + return funcCall("read_" + modelElement.getName(), + ExpressionModelElementFactory.createVar(coreAddress + "")); + } /** {@inheritDoc} */ diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/SensorInExecutable.java b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/SensorInExecutable.java index 3e2beec99db69bd61cb4783da1f2a16d20c67b06..61375c9ac150cb767485d6a33acc9cad29563aa0 100644 --- a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/SensorInExecutable.java +++ b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/SensorInExecutable.java @@ -18,14 +18,17 @@ $Id$ package org.fortiss.af3.platform.raspberry.generator.executable; import static org.fortiss.af3.expression.utils.ExpressionModelElementFactory.funcCall; +import static org.fortiss.tooling.base.utils.AnnotationUtils.getAnnotation; import org.fortiss.af3.component.model.InputPort; import org.fortiss.af3.expression.model.terms.IExpressionTerm; +import org.fortiss.af3.expression.utils.ExpressionModelElementFactory; import org.fortiss.af3.platform.language.executable.IInitializableExecutable; import org.fortiss.af3.platform.language.executable.IReadableExecutableWithNoValSupport; import org.fortiss.af3.platform.language.executable.ITerminatableExecutable; import org.fortiss.af3.platform.language.executable.ReceiverExecutableBase; import org.fortiss.af3.platform.raspberry.model.SensorIn; +import org.fortiss.af3.platform.raspberry.model.annotation.PinNumber; /** * @@ -45,6 +48,11 @@ public class SensorInExecutable extends ReceiverExecutableBase<SensorIn> impleme // TODO Auto-generated constructor stub } + // @Override + // public IExpressionTerm getValueReadAccessor(IExpressionTerm signal, IExpressionTerm buffer) { + // return funcCall("read_gpio", signal, buffer); + // } + /** {@inheritDoc} */ @Override public IExpressionTerm getInitialization() { @@ -60,7 +68,11 @@ public class SensorInExecutable extends ReceiverExecutableBase<SensorIn> impleme /** {@inheritDoc} */ @Override public IExpressionTerm getValueReadAccessor(InputPort logicalSignal) { - return funcCall("read_" + modelElement.getName()); + PinNumber ias = getAnnotation(modelElement, PinNumber.class); + int pinNr = ias.getPinNumber(); + + return funcCall("read_" + modelElement.getName(), + ExpressionModelElementFactory.createVar(pinNr + "")); } /** {@inheritDoc} */