| /** |
| * ******************************************************************************* |
| * Copyright (c) 2019 Robert Bosch GmbH and others. |
| * |
| * This program and the accompanying materials are made |
| * available under the terms of the Eclipse Public License 2.0 |
| * which is available at https://www.eclipse.org/legal/epl-2.0/ |
| * |
| * SPDX-License-Identifier: EPL-2.0 |
| * |
| * Contributors: |
| * Robert Bosch GmbH - initial API and implementation |
| * ******************************************************************************* |
| */ |
| |
| package templates.m2m.hw |
| |
| import com.google.inject.Inject |
| |
| import com.inchron.realtime.root.model.Model |
| import org.eclipse.app4mc.amalthea.model.Cache |
| import org.eclipse.app4mc.amalthea.model.HwStructure |
| import org.eclipse.app4mc.amalthea.model.Memory |
| import org.eclipse.app4mc.amalthea.model.StructureType |
| import templates.AbstractAmaltheaInchronTransformer |
| import com.google.inject.Singleton |
| |
| @Singleton |
| class HWStructure_ECUTransformer extends AbstractAmaltheaInchronTransformer { |
| |
| @Inject HWStructure_MicroControllerTransformer microControllerTransformer |
| |
| @Inject MemoryTransformer memoryTransformer |
| |
| @Inject CacheTransformer cacheTransformer |
| |
| def transformHWECU(HwStructure amltHWECU, Model inchronModel) { |
| |
| amltHWECU.modules.forEach [ amltHwModule | |
| if (amltHwModule instanceof Memory) { |
| inchronModel.memories.add(memoryTransformer.createMemory(amltHwModule)) |
| } else if (amltHwModule instanceof Cache) { |
| inchronModel.memories.add(cacheTransformer.createCache(amltHwModule)) |
| } |
| ] |
| |
| amltHWECU.structures.forEach [ amltHwMicroController | |
| if (amltHwMicroController.structureType == StructureType.MICROCONTROLLER) { |
| inchronModel.cpus.add(microControllerTransformer.createCpu(amltHwMicroController)) |
| } |
| ] |
| |
| } |
| } |