Generation working and Compilation of MARTe components

This commit is contained in:
ferrog
2025-05-13 16:03:11 +00:00
parent 3a5e378d99
commit 4faee3802a
1571 changed files with 611466 additions and 0 deletions

View File

@@ -0,0 +1,206 @@
/**
* @file JATerminalInterfaceGAM.cpp
* @brief Source file for class JATerminalInterfaceGAM
* @date Feb 19, 2019
* @author kuchida
*
* @copyright Copyright 2015 F4E | European Joint Undertaking for ITER and
* the Development of Fusion Energy ('Fusion for Energy').
* Licensed under the EUPL, Version 1.1 or - as soon they will be approved
* by the European Commission - subsequent versions of the EUPL (the "Licence")
* You may not use this work except in compliance with the Licence.
* You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl
*
* @warning Unless required by applicable law or agreed to in writing,
* software distributed under the Licence is distributed on an "AS IS"
* basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the Licence permissions and limitations under the Licence.
* @details This source file contains the definition of all the methods for
* the class JATerminalInterfaceGAM (public, protected, and private). Be aware that some
* methods, such as those inline could be defined on the header file, instead.
*/
/*---------------------------------------------------------------------------*/
/* Standard header includes */
/*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/
/* Project header includes */
/*---------------------------------------------------------------------------*/
#include "JATerminalInterfaceGAM.h"
#include "AdvancedErrorManagement.h"
/*---------------------------------------------------------------------------*/
/* Static definitions */
/*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/
/* Method definitions */
/*---------------------------------------------------------------------------*/
JATerminalInterfaceGAM::JATerminalInterfaceGAM() {
// Fixed GAM input
aps_hvon_term = 0;
// Parameters which get from Input signals.
mhvps_hvon = NULL_PTR(MARTe::uint32 *);
aps_hvon = NULL_PTR(MARTe::uint32 *);
aps_swon = NULL_PTR(MARTe::uint32 *);
bps_hvon = NULL_PTR(MARTe::uint32 *);
bps_swon = NULL_PTR(MARTe::uint32 *);
stateMachineOutput = NULL_PTR(MARTe::uint32 *);
// write out target.
outputSignalNI6259 = NULL_PTR(MARTe::uint32 *);
outputSignalNI6528P3 = NULL_PTR(MARTe::uint8 *);
outputSignalNI6528P4 = NULL_PTR(MARTe::uint8 *);
aps_hvon_state = 0;
aps_swon_state = 0;
mhvps_hvon_state = 0;
bps_hvon_state = 0;
bps_swon_state = 0;
p3Value = 0;
p4Value = 0;
}
JATerminalInterfaceGAM::~JATerminalInterfaceGAM() {
}
bool JATerminalInterfaceGAM::Initialise(MARTe::StructuredDataI & data) {
using namespace MARTe;
bool ok = GAM::Initialise(data);
if (ok) {
ok = data.Read("mhvps_hvon_term", mhvps_hvon_term);
if (!ok) {
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "The mhvps_hvon_term shall be specified");
}
}
if (ok) {
ok = data.Read("aps_hvon_term", aps_hvon_term);
if (!ok) {
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "The aps_hvon_term shall be specified");
}
}
if (ok) {
ok = data.Read("aps_swon_term", aps_swon_term);
if (!ok) {
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "The aps_swon_term shall be specified");
}
}
if (ok) {
ok = data.Read("bps_hvon_term", bps_hvon_term);
if (!ok) {
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "The bps_hvon_term shall be specified");
}
}
if (ok) {
ok = data.Read("bps_swon_term", bps_swon_term);
if (!ok) {
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "The bps_swon_term shall be specified");
}
}
return ok;
}
bool JATerminalInterfaceGAM::PrepareNextState(const MARTe::char8 * const currentStateName, const MARTe::char8 * const nextStateName) {
return true;
}
bool JATerminalInterfaceGAM::Setup() {
using namespace MARTe;
bool ok = (numberOfInputSignals == 9u);
if (ok) {
ok = (numberOfOutputSignals == 3u);
if (!ok) {
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "Three output signals shall be defined");
}
}
else {
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "Nine input signals shall be defined");
}
if (ok) {
uint32 c;
for (c = 0u; c < numberOfInputSignals; c++) {
TypeDescriptor inputType = GetSignalType(InputSignals, c);
ok = (inputType == UnsignedInteger32Bit || inputType == UnsignedInteger8Bit);
if (!ok) {
StreamString signalName;
(void) GetSignalName(InputSignals, c, signalName);
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "Signal %s shall be defined as uint32 or uint8", signalName.Buffer());
}
}
}
if (ok) {
uint32 c;
for (c = 0u; c < numberOfOutputSignals; c++) {
TypeDescriptor outputType = GetSignalType(OutputSignals, c);
ok = (outputType == UnsignedInteger32Bit || outputType == UnsignedInteger8Bit);
if (!ok) {
StreamString signalName;
(void) GetSignalName(InputSignals, c, signalName);
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "Signal %s shall be defined as uint32 or uint8", signalName.Buffer());
}
}
}
if (ok) {
//mhvps_manm = reinterpret_cast<uint32 *>(GetInputSignalMemory(0));
mhvps_hvon = reinterpret_cast<uint32 *>(GetInputSignalMemory(0));
//aps_manm = reinterpret_cast<uint32 *>(GetInputSignalMemory(2));
aps_hvon = reinterpret_cast<uint32 *>(GetInputSignalMemory(1));
aps_swon = reinterpret_cast<uint32 *>(GetInputSignalMemory(2));
//bps_manm = reinterpret_cast<uint32 *>(GetInputSignalMemory(5));
bps_hvon = reinterpret_cast<uint32 *>(GetInputSignalMemory(3));
bps_swon = reinterpret_cast<uint32 *>(GetInputSignalMemory(4));
short_pulse_mode = reinterpret_cast<uint32 *>(GetInputSignalMemory(5));
stateMachineOutput = reinterpret_cast<uint32 *>(GetInputSignalMemory(6));
ni6528p3Value = reinterpret_cast<uint8 *>(GetInputSignalMemory(7));
ni6528p4Value = reinterpret_cast<uint8 *>(GetInputSignalMemory(8));
outputSignalNI6259 = reinterpret_cast<uint32 *>(GetOutputSignalMemory(0));
outputSignalNI6528P3 = reinterpret_cast<uint8 *>(GetOutputSignalMemory(1));
outputSignalNI6528P4 = reinterpret_cast<uint8 *>(GetOutputSignalMemory(2));
}
return ok;
}
bool JATerminalInterfaceGAM::Execute() {
using namespace MARTe;
uint8 sm = *stateMachineOutput;
//Update HVPS state
aps_hvon_state = ((sm >> (0))&1);
aps_swon_state = ((sm >> (4))&1);
mhvps_hvon_state = ((sm >> (2))&1);
bps_hvon_state = ((sm >> (1))&1);
bps_swon_state = ((sm >> (3))&1);
if(*short_pulse_mode == 1){
p3Value = 1*aps_hvon_state + 8*bps_hvon_state +16*bps_swon_state;
*outputSignalNI6259 = 1*aps_swon_state;
//uint8 ni6528p3ValueTemp = 0;//*ni6528p3Value;
//ni6528p3ValueTemp &= ~(1<<2); //Does not turn on ni6258 aps switch
//Update terminal value
//*outputSignalNI6528P3 = ~(ni6528p3ValueTemp | p3Value);
*outputSignalNI6528P3 = ~p3Value;
//REPORT_ERROR(ErrorManagement::Debug, "short pulse mode with p3: %d.", p3Value);
} else {
p3Value = 1*aps_hvon_state +2*aps_swon_state + 8*bps_hvon_state +16*bps_swon_state;
//REPORT_ERROR(ErrorManagement::Debug, "long pulse mode with p3: %d.", p3Value);
}
p4Value = 8*mhvps_hvon_state;
*outputSignalNI6528P4 = ~(*ni6528p4Value | p4Value);
return true;
}
CLASS_REGISTER(JATerminalInterfaceGAM, "1.0")

View File

@@ -0,0 +1,157 @@
/**
* @file JATerminalInterfaceGAM.h
* @brief Header file for class JATerminalInterfaceGAM
* @date Feb 19, 2020
* @author kuchida
*
* @copyright Copyright 2015 F4E | European Joint Undertaking for ITER and
* the Development of Fusion Energy ('Fusion for Energy').
* Licensed under the EUPL, Version 1.1 or - as soon they will be approved
* by the European Commission - subsequent versions of the EUPL (the "Licence")
* You may not use this work except in compliance with the Licence.
* You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl
*
* @warning Unless required by applicable law or agreed to in writing,
* software distributed under the Licence is distributed on an "AS IS"
* basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the Licence permissions and limitations under the Licence.
* @details This header file contains the declaration of the class JATerminalInterfaceGAM
* with all of its public, protected and private members. It may also include
* definitions for inline methods which need to be visible to the compiler.
*/
#ifndef GAMS_JATerminalInterfaceGAM_H_
#define GAMS_JATerminalInterfaceGAM_H_
/*---------------------------------------------------------------------------*/
/* Standard header includes */
/*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/
/* Project header includes */
/*---------------------------------------------------------------------------*/
#include "GAM.h"
/*---------------------------------------------------------------------------*/
/* Class declaration */
/*---------------------------------------------------------------------------*/
/**
* @brief GAM calculates one output value by comparing input value and fixed parameters.
*
* The configuration syntax is (names and signal quantity are only given as an example):
* <pre>
*
* +terminalInterfaceGAM = {
* Class = JATerminalInterfaceGAM
* mhvps_hvon_term = 4
* aps_hvon_term = 1
* aps_swon_term = 16
* bps_hvon_term = 2
* bps_swon_term = 8
* InputSignals = {
* MHVPS_HVON = {
* DataSource = DDB1
* Type = uint32
* }
* APS_HVON = {
* DataSource = DDB1
* Type = uint32
* }
* APS_SWON = {
* DataSource = DDB1
* Type = uint32
* }
* BPS_HVON = {
* DataSource = DDB1
* Type = uint32
* }
* BPS_SWON = {
* DataSource = DDB1
* Type = uint32
* }
* Value = {
* DataSource = DDB1
* Type = uint32
* }
* }
* OutputSignals = {
* Value = {
* DataSource = NI6259
* Type = uint32
* Trigger = 1
* }
* }
* }
*
* </pre>
*
*/
class JATerminalInterfaceGAM : public MARTe::GAM, public MARTe::StatefulI {
public:
CLASS_REGISTER_DECLARATION()
JATerminalInterfaceGAM();
virtual ~JATerminalInterfaceGAM();
virtual bool Initialise(MARTe::StructuredDataI & data);
virtual bool Setup();
virtual bool Execute();
virtual bool PrepareNextState(const MARTe::char8 * const currentStateName,
const MARTe::char8 * const nextStateName);
private:
// Fixed GAM input
MARTe::uint32 mhvps_hvon_term;
MARTe::uint32 aps_hvon_term;
MARTe::uint32 aps_swon_term;
MARTe::uint32 bps_hvon_term;
MARTe::uint32 bps_swon_term;
// Input signals
//MARTe::uint32 *mhvps_manm;
MARTe::uint32 *mhvps_hvon;
//MARTe::uint32 *aps_manm;
MARTe::uint32 *aps_hvon;
MARTe::uint32 *aps_swon;
//MARTe::uint32 *bps_manm;
MARTe::uint32 *bps_hvon;
MARTe::uint32 *bps_swon;
MARTe::uint32 *short_pulse_mode;
MARTe::uint32 *stateMachineOutput;
MARTe::uint8 *ni6528p3Value;
MARTe::uint8 *ni6528p4Value;
// Output signals
MARTe::uint32 *outputSignalNI6259;
MARTe::uint8 *outputSignalNI6528P3;
MARTe::uint8 *outputSignalNI6528P4;
MARTe::uint8 aps_hvon_state;
MARTe::uint8 aps_swon_state;
MARTe::uint8 mhvps_hvon_state;
MARTe::uint8 bps_hvon_state;
MARTe::uint8 bps_swon_state;
MARTe::uint8 p3Value;
MARTe::uint8 p4Value;
};
/*---------------------------------------------------------------------------*/
/* Inline method definitions */
/*---------------------------------------------------------------------------*/
#endif /* GAMS_JATerminalInterfaceGAM_H_ */

View File

@@ -0,0 +1,27 @@
#############################################################
#
# Copyright 2015 F4E | European Joint Undertaking for ITER
# and the Development of Fusion Energy ('Fusion for Energy')
#
# Licensed under the EUPL, Version 1.1 or - as soon they
# will be approved by the European Commission - subsequent
# versions of the EUPL (the "Licence");
# You may not use this work except in compliance with the
# Licence.
# You may obtain a copy of the Licence at:
#
# http://ec.europa.eu/idabc/eupl
#
# Unless required by applicable law or agreed to in
# writing, software distributed under the Licence is
# distributed on an "AS IS" basis,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
# express or implied.
# See the Licence for the specific language governing
# permissions and limitations under the Licence.
#
# $Id: Makefile.gcc 3 2012-01-15 16:26:07Z aneto $
#
#############################################################
include Makefile.inc

View File

@@ -0,0 +1,55 @@
#############################################################
#
# Copyright 2015 F4E | European Joint Undertaking for ITER
# and the Development of Fusion Energy ('Fusion for Energy')
#
# Licensed under the EUPL, Version 1.1 or - as soon they
# will be approved by the European Commission - subsequent
# versions of the EUPL (the "Licence");
# You may not use this work except in compliance with the
# Licence.
# You may obtain a copy of the Licence at:
#
# http://ec.europa.eu/idabc/eupl
#
# Unless required by applicable law or agreed to in
# writing, software distributed under the Licence is
# distributed on an "AS IS" basis,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
# express or implied.
# See the Licence for the specific language governing
# permissions and limitations under the Licence.
#
# $Id: Makefile.inc 3 2012-01-15 16:26:07Z aneto $
#
#############################################################
OBJSX=JATerminalInterfaceGAM.x
PACKAGE=GAMs
ROOT_DIR=../../
MAKEDEFAULTDIR=$(MARTe2_DIR)/MakeDefaults
include $(MAKEDEFAULTDIR)/MakeStdLibDefs.$(TARGET)
INCLUDES += -I.
INCLUDES += -I$(MARTe2_DIR)/Source/Core/BareMetal/L0Types
INCLUDES += -I$(MARTe2_DIR)/Source/Core/BareMetal/L1Portability
INCLUDES += -I$(MARTe2_DIR)/Source/Core/BareMetal/L2Objects
INCLUDES += -I$(MARTe2_DIR)/Source/Core/BareMetal/L3Streams
INCLUDES += -I$(MARTe2_DIR)/Source/Core/BareMetal/L4Messages
INCLUDES += -I$(MARTe2_DIR)/Source/Core/BareMetal/L4Configuration
INCLUDES += -I$(MARTe2_DIR)/Source/Core/BareMetal/L5GAMs
INCLUDES += -I$(MARTe2_DIR)/Source/Core/Scheduler/L1Portability
INCLUDES += -I$(MARTe2_DIR)/Source/Core/Scheduler/L3Services
INCLUDES += -I$(MARTe2_DIR)/Source/Core/Scheduler/L4Messages
INCLUDES += -I$(MARTe2_DIR)/Source/Core/FileSystem/L1Portability
INCLUDES += -I$(MARTe2_DIR)/Source/Core/FileSystem/L3Streams
all: $(OBJS) $(SUBPROJ) \
$(BUILD_DIR)/JATerminalInterfaceGAM$(LIBEXT) \
$(BUILD_DIR)/JATerminalInterfaceGAM$(DLLEXT)
echo $(OBJS)
include $(MAKEDEFAULTDIR)/MakeStdLibRules.$(TARGET)